megareviewer 0.2.14 → 0.2.15
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/dist/THIRD_PARTY_LICENSES.txt +64 -0
- package/dist/server.js +1 -1
- package/dist/web/assets/{core-Ba9Dg9_3.js → core-a5EcSd0Y.js} +1 -1
- package/dist/web/assets/index-Bywy_-XQ.css +1 -0
- package/dist/web/assets/{index-Dv5qZoW7.js → index-DI578zZj.js} +13 -13
- package/dist/web/assets/properties-B3r0DjE7.svg +4 -0
- package/dist/web/assets/properties_dark-DnHs7phT.svg +4 -0
- package/dist/web/index.html +2 -2
- package/package.json +1 -1
- package/dist/web/assets/index-CTC3MAiC.css +0 -1
|
@@ -71,16 +71,16 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
71
71
|
`)}}nested(t){return new e(t,this.depth+1).read()}quote(e,t){let n=[],r=e;for(;r<this.lines.length;){let e=this.lines[r]??``,t=jd.exec(e);if(t!==null)n.push(t[1]??``);else if(!Ed(n.at(-1)??``)&&!this.interrupts(r))n.push(e);else break;r+=1}return t.push({kind:`quote`,blocks:this.nested(n)}),r}list(e,t,n){let{lines:r}=this,i=[],a=e,o=t;for(;o!==null;){let e=[o.content];for(a+=1;a<r.length;){let t=r[a]??``;if(Ed(t)){let t=a;for(;t<r.length&&Ed(r[t]??``);)t+=1;if(t<r.length&&Dd(r[t]??``)>=o.contentIndent){for(;a<t;a+=1)e.push(``);continue}break}if(Dd(t)>=o.contentIndent)e.push(t.slice(o.contentIndent));else if(!Ed(e.at(-1)??``)&&!this.interrupts(a)&&Fd(t)===null)e.push(t.trimStart());else break;a+=1}let[n=``,...s]=e,c=Nd.exec(n);i.push({checked:c===null?null:c[1]!==` `,blocks:this.nested([c===null?n:n.slice(c[0].length),...s])});let l=a;for(;l<r.length&&Ed(r[l]??``);)l+=1;let u=l<r.length?Fd(r[l]??``):null;u!==null&&Id(t,u)?(a=l,o=u):o=null}return n.push({kind:`list`,ordered:t.ordered,start:t.number,items:i}),a}table(e,t,n){let r=t.length,i=e=>{let t=Ld(e).slice(0,r);for(;t.length<r;)t.push(``);return t.map(Sd)},a=[],o=e+2;for(;o<this.lines.length&&!this.interrupts(o);)a.push(i(this.lines[o]??``)),o+=1;return n.push({kind:`table`,align:t,head:i(this.lines[e]??``),rows:a}),o}},Bd=e=>new zd(e.replaceAll(`\r
|
|
72
72
|
`,`
|
|
73
73
|
`).split(`
|
|
74
|
-
`),0).read(),Vd=e=>({blocks:Bd(e)}),Hd=Ks([`approve`,`request_changes`,`comment`]),Ud=G().regex(/^(summary|decision:d[1-9][0-9]*|hunk:h_[0-9a-f]{16}(-[2-9]|-[1-9][0-9]+)?:(new|old):[1-9][0-9]*)$/).brand(),Wd=K({hunkId:Hc,side:Ks([`new`,`old`]),line:Ts().int().positive(),startLine:Ts().int().positive().optional(),body:G(),suggestion:Fs(G()).readonly().optional()}).readonly().refine(e=>e.startLine===void 0||e.startLine<e.line,{message:`startLine must come before line`}),Gd=K({key:Ud,path:G().min(1),line:Ts().int().positive(),startLine:Ts().int().positive().optional(),side:Ks([`new`,`old`]),body:G().min(1)}).readonly(),Kd=K({verdict:Hd,summary:G(),comments:Fs(Gd).readonly()}).readonly(),qd=os().brand(),Jd=e=>e.verdict===`comment`&&e.summary.trim()===``&&e.comments.length===0,Yd=K({url:wc.nullable(),publishedAt:Sc,postedCommentIds:Ws(Ud,G().min(1)).readonly()}).readonly(),Xd=Ks([`open`,`draft`,`merged`,`closed`]),Zd=Ks([`approved`,`changes-requested`,`commented`]),Qd=K({id:G().min(1),name:G(),team:ks(),verdict:Zd.nullable()}).readonly(),$d=Ks([`approved`,`changes-requested`]),ef=Ks([`passed`,`failed`,`running`,`skipped`]),tf=K({name:G().min(1),state:ef,url:wc.nullable()}).readonly(),nf=K({state:Xd,reviewStatus:$d.nullable(),reviewers:Fs(Qd).readonly(),checks:Fs(tf).readonly().nullable(),checksUnreadable:G().nullable()}).readonly(),rf={"changes-requested":0,approved:1,commented:2,none:3},af=e=>[...e].sort((e,t)=>rf[e.verdict??`none`]-rf[t.verdict??`none`]),of={failed:0,running:1,passed:2,skipped:3},sf=e=>[...e].sort((e,t)=>of[e.state]-of[t.state]||e.name.localeCompare(t.name)),cf=e=>{let t=t=>e.filter(e=>e.state===t).length,n=t(`passed`),r=t(`failed`),i=t(`running`),a=t(`skipped`);return{state:r>0?`failed`:i>0?`running`:n>0?`passed`:a>0?`skipped`:null,total:n+r+i,passed:n,failed:r,running:i,skipped:a}},lf={"github.com":{kind:`github`,pullSegment:`pull`},"bitbucket.org":{kind:`bitbucket`,pullSegment:`pull-requests`}},uf=/^[A-Za-z0-9._-]+$/,df=/^[1-9][0-9]*$/,ff=e=>e!==void 0&&uf.test(e)&&e!==`.`&&e!==`..`,pf=e=>/^(github\.com|bitbucket\.org)\//i.test(e)?`https://${e}`:e,mf=e=>{let t;try{t=new URL(pf(e.trim()))}catch{return vl(`unsupported-url`)}let n=lf[t.hostname];if(n===void 0||t.protocol!==`https:`||t.port!==``||t.username!==``||t.password!==``)return vl(`unsupported-url`);let[r,i,a,o,s]=t.pathname.split(`/`);return r!==``||!ff(i)||!ff(a)||o!==n.pullSegment||s===void 0||!df.test(s)||!Number.isSafeInteger(Number(s))?vl(`unsupported-url`):_l({repo:{host:n.kind,owner:i.toLowerCase(),repo:a.toLowerCase()},number:Number(s)})},hf=e=>{let{host:t,owner:n,repo:r}=e.repo;switch(t){case`github`:return`https://github.com/${n}/${r}/pull/${e.number}`;case`bitbucket`:return`https://bitbucket.org/${n}/${r}/pull-requests/${e.number}`}},gf=G().regex(/^[A-Za-z0-9_-]{1,200}$/),_f=K({id:G().regex(/^[A-Za-z0-9_-]{1,200}$/),author:Oc,body:G(),createdAt:Sc,originalCommit:Cc.nullable()}).readonly(),vf=K({reply:ks(),resolve:ks()}).readonly(),yf=K({threads:Fs(K({id:gf,path:G().min(1),side:Ks([`new`,`old`]),line:Ts().int().positive().nullable(),startLine:Ts().int().positive().nullable(),originalLine:Ts().int().positive().nullable(),resolved:ks(),resolvedBy:Oc.nullable(),outdated:ks(),can:vf,comments:Fs(_f).min(1).readonly()}).readonly()).readonly()}).readonly();K({kind:Ks([`missing`,`duplicate`,`unknown`]),id:Uc}).readonly();var bf=`x-megareviewer-token`,xf=`token`,Sf=K({configured:ks(),user:Oc.nullable(),error:G().nullable()}).readonly(),Cf=K({version:G(),hosts:K({github:Sf,bitbucket:Sf}).readonly(),jira:K({configured:ks()}).readonly(),model:Ll}).readonly(),wf=K({items:Fs(jc).readonly(),errors:Fs(K({host:Tc,message:G()}).readonly()).readonly()}).readonly(),Tf=K({url:G().min(1)}).readonly(),Ef=K({optionId:Fl.optional()}).readonly().optional(),Df=K({analysisId:Cu}).readonly(),Of=K({analysis:Ru,pointReviews:Fs(fu).readonly(),publication:Yd.nullable(),isAuthor:ks(),stale:ks()}).readonly(),kf=K({analysis:Ru,pointReviews:Fs(fu).readonly()}).readonly(),Af=K({state:du}).readonly(),jf={hunkComments:Fs(Wd).readonly().optional(),verdict:Hd.nullable().optional()},Mf=K({summary:G(),...jf}).readonly(),Nf=K({publicationId:qd,summary:G(),allowStale:ks(),...jf}).readonly(),Pf=K({stage:xu,status:Su}).readonly(),Ff=K({}).readonly(),If=K({content:G().nullable()}).readonly(),Lf=yf,Rf=K({body:G().trim().min(1)}).readonly(),zf=K({}).readonly(),Bf=K({resolved:ks()}).readonly(),Vf=Bf,Hf=K({repo:Ec,guidelineFiles:Fs(Zl).readonly().nullable(),guidelineNote:G().nullable()}).readonly(),Uf=K({preferences:Fs(Kl).readonly(),proposals:Fs(ql).readonly(),repositories:Fs(Hf).readonly(),signalsSinceSuggestion:Ts().int().nonnegative()}).readonly(),Wf=K({kind:Hl,text:Gl,scope:Ul,source:Ks([`written`,`learned`]).optional()}).readonly(),Gf=K({kind:Hl.optional(),text:Gl.optional(),scope:Ul.optional(),enabled:ks().optional()}).readonly(),Kf=K({}).readonly(),qf=Ef,Jf=K({proposals:Fs(ql).readonly(),signals:Ts().int().nonnegative()}).readonly(),Yf=K({repo:Ec,optionId:Fl.optional()}).readonly(),Xf=K({proposals:Fs(ql).readonly(),comments:Ts().int().nonnegative(),pullRequests:Ts().int().nonnegative()}).readonly(),Zf=K({decision:Ks([`accept`,`reject`]),kind:Hl.optional(),text:Gl.optional(),scope:Ul.optional()}).readonly(),Qf=K({preference:Kl.nullable()}).readonly(),$f=K({repo:Ec,path:Yl,enabled:ks()}).readonly(),ep=K({}).readonly(),tp=K({error:K({code:Ks([`bad-request`,`unsupported-url`,`host-not-configured`,`unauthorized`,`not-found`,`stale-analysis`,`analysis-not-complete`,`host-error`,`model-error`,`model-unavailable`,`internal`]),message:G()}).readonly()}).readonly(),np=K({id:Cu}).readonly(),rp=K({id:Cu,pointId:uu}).readonly(),ip=K({id:Cu,side:Ks([`base`,`head`]),path:G().min(1)}).readonly(),ap=K({id:Cu,threadId:gf}).readonly(),op=K({preferenceId:Bl}).readonly(),sp=K({proposalId:Vl}).readonly(),cp=K({}).readonly(),lp={getStatus:{method:`GET`,path:`/api/status`,params:cp,request:null,response:Cf},listPullRequests:{method:`GET`,path:`/api/pull-requests`,params:cp,request:null,response:wf},getReviewActivity:{method:`GET`,path:`/api/review-activity`,params:cp,request:null,response:Mc},startAnalysis:{method:`POST`,path:`/api/analyses`,params:cp,request:Tf,response:Df},getAnalysis:{method:`GET`,path:`/api/analyses/:id`,params:np,request:null,response:Of},getFileContent:{method:`GET`,path:`/api/analyses/:id/files/:side/:path`,params:ip,request:null,response:If},retryAnalysis:{method:`POST`,path:`/api/analyses/:id/retry`,params:np,request:null,response:Df},runModel:{method:`POST`,path:`/api/analyses/:id/model`,params:np,request:Ef,response:Df},removeModelRun:{method:`DELETE`,path:`/api/analyses/:id/model`,params:np,request:null,response:kf},putPointState:{method:`PUT`,path:`/api/analyses/:id/points/:pointId`,params:rp,request:Af,response:fu},previewPublication:{method:`POST`,path:`/api/analyses/:id/publication/preview`,params:np,request:Mf,response:Kd},publish:{method:`POST`,path:`/api/analyses/:id/publication`,params:np,request:Nf,response:Yd},getThreads:{method:`GET`,path:`/api/analyses/:id/threads`,params:np,request:null,response:Lf},getPullRequestStatus:{method:`GET`,path:`/api/analyses/:id/pull-request-status`,params:np,request:null,response:nf},replyToThread:{method:`POST`,path:`/api/analyses/:id/threads/:threadId/replies`,params:ap,request:Rf,response:_f},postComment:{method:`POST`,path:`/api/analyses/:id/comments`,params:np,request:Wd,response:zf},resolveThread:{method:`PUT`,path:`/api/analyses/:id/threads/:threadId/resolved`,params:ap,request:Bf,response:Vf},getPreferences:{method:`GET`,path:`/api/preferences`,params:cp,request:null,response:Uf},addPreference:{method:`POST`,path:`/api/preferences`,params:cp,request:Wf,response:Kl},suggestPreferences:{method:`POST`,path:`/api/preferences/suggestions`,params:cp,request:qf,response:Jf},importPreferences:{method:`POST`,path:`/api/preferences/imports`,params:cp,request:Yf,response:Xf},setGuidelineSwitch:{method:`PUT`,path:`/api/preferences/guidelines`,params:cp,request:$f,response:ep},decideProposal:{method:`PUT`,path:`/api/preferences/proposals/:proposalId`,params:sp,request:Zf,response:Qf},updatePreference:{method:`PUT`,path:`/api/preferences/:preferenceId`,params:op,request:Gf,response:Kl},deletePreference:{method:`DELETE`,path:`/api/preferences/:preferenceId`,params:op,request:null,response:Kf}},up={method:`GET`,path:`/api/analyses/:id/events`,params:np,events:{updated:Pf,done:Ff}},dp={method:`GET`,path:`/api/analyses/:id/attachment`,params:np,query:K({url:cs({protocol:/^https$/})}).readonly()},fp=(e,t)=>e.replace(/:([A-Za-z]+)/g,(n,r)=>{let i=t[r];if(i===void 0)throw Error(`missing path param ${r} for ${e}`);return encodeURIComponent(i)}),pp=`The server sent a response this page doesn't understand, so the server and the UI may be different versions. Reload the page.`,mp=`Can't reach megareviewer. Check that it's still running in your terminal.`,hp=e=>{let t=async(t,n,r)=>{let i;try{i=await e.fetch(fp(t.path,n),{method:t.method,headers:{[bf]:e.token,...r===void 0?{}:{"content-type":`application/json`}},...r===void 0?{}:{body:JSON.stringify(r)}})}catch{return vl({code:`unreachable`,message:mp})}let a=await i.json().catch(()=>void 0);if(!i.ok){i.status===401&&e.onUnauthorized();let t=tp.safeParse(a);return t.success?vl(t.data.error):vl({code:i.status>=500?`unreachable`:`internal`,message:i.status>=500?mp:pp})}let o=t.response.safeParse(a);return o.success?_l(o.data):vl({code:`internal`,message:pp})};return{getStatus:()=>t(lp.getStatus,{}),listPullRequests:()=>t(lp.listPullRequests,{}),getReviewActivity:()=>t(lp.getReviewActivity,{}),startAnalysis:e=>t(lp.startAnalysis,{},e),getAnalysis:e=>t(lp.getAnalysis,{id:e}),getFileContent:(e,n,r)=>t(lp.getFileContent,{id:e,side:n,path:r}),retryAnalysis:e=>t(lp.retryAnalysis,{id:e}),runModel:(e,n={})=>t(lp.runModel,{id:e},n),removeModelRun:e=>t(lp.removeModelRun,{id:e}),putPointState:(e,n,r)=>t(lp.putPointState,{id:e,pointId:n},r),previewPublication:(e,n)=>t(lp.previewPublication,{id:e},n),publish:(e,n)=>t(lp.publish,{id:e},n),getThreads:e=>t(lp.getThreads,{id:e}),getPullRequestStatus:e=>t(lp.getPullRequestStatus,{id:e}),replyToThread:(e,n,r)=>t(lp.replyToThread,{id:e,threadId:n},r),resolveThread:(e,n,r)=>t(lp.resolveThread,{id:e,threadId:n},r),postComment:(e,n)=>t(lp.postComment,{id:e},n),getPreferences:()=>t(lp.getPreferences,{}),addPreference:e=>t(lp.addPreference,{},e),suggestPreferences:(e={})=>t(lp.suggestPreferences,{},e),importPreferences:e=>t(lp.importPreferences,{},e),setGuidelineSwitch:e=>t(lp.setGuidelineSwitch,{},e),decideProposal:(e,n)=>t(lp.decideProposal,{proposalId:e},n),updatePreference:(e,n)=>t(lp.updatePreference,{preferenceId:e},n),deletePreference:e=>t(lp.deletePreference,{preferenceId:e}),attachmentUrl:(t,n)=>`${fp(dp.path,{id:t})}?${new URLSearchParams({url:n,[xf]:e.token})}`}},gp=2,_p=(e,t,n,r=e=>new EventSource(e))=>{let i=new URLSearchParams({[xf]:t}),a=r(`${fp(up.path,{id:e})}?${i}`),o=!1,s=!1,c=()=>{s=!0,a.close()};return a.addEventListener(`open`,()=>{o&&(o=!1,n({type:`changed`}))}),a.addEventListener(`error`,()=>{o=!0,!(s||a.readyState!==gp)&&(s=!0,n({type:`closed`}))}),a.addEventListener(`updated`,()=>n({type:`changed`})),a.addEventListener(`done`,()=>{c(),n({type:`done`})}),()=>{s||c()}},vp=(0,q.createContext)(null),yp=()=>{let e=(0,q.useContext)(vp);if(e===null)throw Error(`useApi needs an ApiContext provider`);return e},bp={data:null,error:null,loading:!0},xp=e=>{let[t,n]=(0,q.useState)(bp),[r,i]=(0,q.useState)(0);(0,q.useEffect)(()=>{let t=!0;return n(e=>({...e,loading:!0})),e().then(e=>{t&&n(t=>e.ok?{data:e.value,error:null,loading:!1}:{data:t.data,error:e.error,loading:!1})}),()=>{t=!1}},[e,r]);let a=(0,q.useCallback)(()=>i(e=>e+1),[]);return{...t,refresh:a}},Sp=()=>{let{client:e}=yp(),{data:t,...n}=xp((0,q.useCallback)(()=>e.getStatus(),[e]));return{status:t,...n}},Cp=()=>{let{client:e}=yp(),{data:t,...n}=xp((0,q.useCallback)(()=>e.listPullRequests(),[e]));return{pullRequests:t,...n}},wp=()=>{let{client:e}=yp(),{data:t,...n}=xp((0,q.useCallback)(()=>e.getReviewActivity(),[e]));return{activity:t,...n}},Tp=()=>{let{client:e}=yp(),{data:t,...n}=xp((0,q.useCallback)(()=>e.getPreferences(),[e]));return{preferences:t,...n}},Ep=(e,t=null)=>{let{client:n,subscribe:r}=yp(),[i,a]=(0,q.useState)({view:t,error:null,loading:t===null}),o=(0,q.useRef)(0),s=(0,q.useRef)(t),c=(0,q.useRef)(t!==null&&!Bu(t.analysis)?t.analysis.id:null),[l,u]=(0,q.useState)(0),d=(0,q.useRef)(null),f=(0,q.useCallback)(async()=>{o.current+=1;let t=o.current,r=await n.getAnalysis(e);t===o.current&&(r.ok&&(s.current=r.value),a(e=>r.ok?{view:r.value,error:null,loading:!1}:{view:e.view,error:r.error,loading:!1}))},[n,e]);(0,q.useEffect)(()=>{if(l===0&&c.current===e){d.current=e;return}d.current!==e&&(d.current=e,s.current=null,a({view:null,error:null,loading:!0})),f();let t,n=r(e,e=>{if(clearTimeout(t),e.type===`changed`){t=setTimeout(()=>void f(),100);return}let n=s.current;(n===null||Bu(n.analysis))&&f()});return()=>{clearTimeout(t),n(),o.current+=1}},[e,f,r,l]);let p=(0,q.useCallback)(()=>u(e=>e+1),[]);return{...i,refetch:f,follow:p}},Dp=e=>{let[t,n]=(0,q.useState)({pending:!1,error:null}),r=(0,q.useCallback)(async(...t)=>{n({pending:!0,error:null});let r=await e(...t);return n({pending:!1,error:r.ok?null:r.error}),r},[e]),i=(0,q.useCallback)(()=>n({pending:!1,error:null}),[]);return{...t,run:r,reset:i}},Op=e=>{let t=e.trim();return t===``||/[.!?]$/.test(t)?t:`${t}.`},kp={"bad-request":e=>`megareviewer rejected the request: ${Op(e)}`,"unsupported-url":()=>`Only github.com and bitbucket.org pull request links are supported.`,"host-not-configured":e=>`${Op(e)} Run npx megareviewer doctor to see how to set it up.`,unauthorized:()=>`This session has ended. Open megareviewer from the link printed in your terminal.`,"not-found":e=>Op(e),"stale-analysis":()=>`The pull request has new commits since this analysis.`,"analysis-not-complete":()=>`The analysis isn't complete yet.`,"host-error":e=>`The git host returned an error: ${Op(e)}`,"model-error":e=>`The model call failed: ${Op(e)}`,"model-unavailable":e=>Op(e),internal:e=>Op(e)||`Something went wrong.`,unreachable:e=>Op(e)},Ap=e=>kp[e.code](e.message),jp=o((e=>{var t=Symbol.for(`react.transitional.element`),n=Symbol.for(`react.fragment`);function r(e,n,r){var i=null;if(r!==void 0&&(i=``+r),n.key!==void 0&&(i=``+n.key),`key`in n)for(var a in r={},n)a!==`key`&&(r[a]=n[a]);else r=n;return n=r.ref,{$$typeof:t,type:e,key:i,ref:n===void 0?null:n,props:r}}e.Fragment=n,e.jsx=r,e.jsxs=r})),J=o(((e,t)=>{t.exports=jp()}))(),Mp=(0,q.createContext)(null),Np=(0,q.createContext)(()=>{}),Pp=({children:e})=>{let[t,n]=(0,q.useState)(null);return(0,J.jsx)(Np.Provider,{value:n,children:(0,J.jsx)(Mp.Provider,{value:t,children:e})})},Fp=()=>(0,q.useContext)(Mp),Ip=e=>{let t=(0,q.useContext)(Np),n=(0,q.useRef)(e.onChange);n.current=e.onChange;let r=(0,q.useRef)(e.toggle?.onChange);r.current=e.toggle?.onChange;let{label:i,options:a,value:o}=e,s=e.toggle?.label,c=e.toggle?.checked??!1,l=(0,q.useMemo)(()=>({label:i,options:a,value:o,onChange:e=>n.current(e),...s===void 0?{}:{toggle:{label:s,checked:c,onChange:e=>r.current?.(e)}}}),[i,a,o,s,c]);(0,q.useEffect)(()=>t(l),[t,l]),(0,q.useEffect)(()=>()=>t(null),[t])};function Lp(e){var t,n,r=``;if(typeof e==`string`||typeof e==`number`)r+=e;else if(typeof e==`object`){if(Array.isArray(e)){var i=e.length;for(t=0;t<i;t++)e[t]&&(n=Lp(e[t]))&&(r&&(r+=` `),r+=n)}else for(n in e)e[n]&&(r&&(r+=` `),r+=n)}return r}function Rp(){for(var e,t,n=0,r=``,i=arguments.length;n<i;n++)(e=arguments[n])&&(t=Lp(e))&&(r&&(r+=` `),r+=t);return r}var zp=(e,t)=>{let n=Array(e.length+t.length);for(let t=0;t<e.length;t++)n[t]=e[t];for(let r=0;r<t.length;r++)n[e.length+r]=t[r];return n},Bp=(e,t)=>({classGroupId:e,validator:t}),Vp=(e=new Map,t=null,n)=>({nextPart:e,validators:t,classGroupId:n}),Hp=`-`,Up=[],Wp=`arbitrary..`,Gp=e=>{let t=Jp(e),{conflictingClassGroups:n,conflictingClassGroupModifiers:r}=e;return{getClassGroupId:e=>{if(e.startsWith(`[`)&&e.endsWith(`]`))return qp(e);let n=e.split(Hp);return Kp(n,+(n[0]===``&&n.length>1),t)},getConflictingClassGroupIds:(e,t)=>{if(t){let t=r[e],i=n[e];return t?i?zp(i,t):t:i||Up}return n[e]||Up}}},Kp=(e,t,n)=>{if(e.length-t===0)return n.classGroupId;let r=e[t],i=n.nextPart.get(r);if(i){let n=Kp(e,t+1,i);if(n)return n}let a=n.validators;if(a===null)return;let o=t===0?e.join(Hp):e.slice(t).join(Hp),s=a.length;for(let e=0;e<s;e++){let t=a[e];if(t.validator(o))return t.classGroupId}},qp=e=>e.slice(1,-1).indexOf(`:`)===-1?void 0:(()=>{let t=e.slice(1,-1),n=t.indexOf(`:`),r=t.slice(0,n);return r?Wp+r:void 0})(),Jp=e=>{let{theme:t,classGroups:n}=e;return Yp(n,t)},Yp=(e,t)=>{let n=Vp();for(let r in e){let i=e[r];Xp(i,n,r,t)}return n},Xp=(e,t,n,r)=>{let i=e.length;for(let a=0;a<i;a++){let i=e[a];Zp(i,t,n,r)}},Zp=(e,t,n,r)=>{typeof e==`string`?Qp(e,t,n):typeof e==`function`?$p(e,t,n,r):em(e,t,n,r)},Qp=(e,t,n)=>{let r=e===``?t:tm(t,e);r.classGroupId=n},$p=(e,t,n,r)=>{nm(e)?Xp(e(r),t,n,r):(t.validators===null&&(t.validators=[]),t.validators.push(Bp(n,e)))},em=(e,t,n,r)=>{let i=Object.entries(e),a=i.length;for(let e=0;e<a;e++){let[a,o]=i[e];Xp(o,tm(t,a),n,r)}},tm=(e,t)=>{let n=e,r=t.split(Hp),i=r.length;for(let e=0;e<i;e++){let t=r[e],i=n.nextPart.get(t);i||(i=Vp(),n.nextPart.set(t,i)),n=i}return n},nm=e=>`isThemeGetter`in e&&e.isThemeGetter===!0,rm=e=>{if(e<1)return{get:()=>void 0,set:()=>{}};let t=0,n=Object.create(null),r=Object.create(null),i=(i,a)=>{n[i]=a,t++,t>e&&(t=0,r=n,n=Object.create(null))};return{get(e){let t=n[e];if(t!==void 0)return t;if((t=r[e])!==void 0)return i(e,t),t},set(e,t){e in n?n[e]=t:i(e,t)}}},im=`!`,am=`:`,om=[],sm=(e,t,n,r,i)=>({modifiers:e,hasImportantModifier:t,baseClassName:n,maybePostfixModifierPosition:r,isExternal:i}),cm=e=>{let{prefix:t,experimentalParseClassName:n}=e,r=e=>{let t=[],n=0,r=0,i=0,a,o=e.length;for(let s=0;s<o;s++){let o=e[s];if(n===0&&r===0){if(o===am){t.push(e.slice(i,s)),i=s+1;continue}if(o===`/`){a=s;continue}}o===`[`?n++:o===`]`?n--:o===`(`?r++:o===`)`&&r--}let s=t.length===0?e:e.slice(i),c=s,l=!1;s.endsWith(im)?(c=s.slice(0,-1),l=!0):s.startsWith(im)&&(c=s.slice(1),l=!0);let u=a&&a>i?a-i:void 0;return sm(t,l,c,u)};if(t){let e=t+am,n=r;r=t=>t.startsWith(e)?n(t.slice(e.length)):sm(om,!1,t,void 0,!0)}if(n){let e=r;r=t=>n({className:t,parseClassName:e})}return r},lm=e=>{let t=new Map;return e.orderSensitiveModifiers.forEach((e,n)=>{t.set(e,1e6+n)}),e=>{let n=[],r=[];for(let i=0;i<e.length;i++){let a=e[i],o=a[0]===`[`,s=t.has(a);o||s?(r.length>0&&(r.sort(),n.push(...r),r=[]),n.push(a)):r.push(a)}return r.length>0&&(r.sort(),n.push(...r)),n}},um=e=>({cache:rm(e.cacheSize),parseClassName:cm(e),sortModifiers:lm(e),postfixLookupClassGroupIds:dm(e),...Gp(e)}),dm=e=>{let t=Object.create(null),n=e.postfixLookupClassGroups;if(n)for(let e=0;e<n.length;e++)t[n[e]]=!0;return t},fm=/\s+/,pm=(e,t)=>{let{parseClassName:n,getClassGroupId:r,getConflictingClassGroupIds:i,sortModifiers:a,postfixLookupClassGroupIds:o}=t,s=[],c=e.trim().split(fm),l=``;for(let e=c.length-1;e>=0;--e){let t=c[e],{isExternal:u,modifiers:d,hasImportantModifier:f,baseClassName:p,maybePostfixModifierPosition:m}=n(t);if(u){l=t+(l.length>0?` `+l:l);continue}let h=!!m,g;if(h){g=r(p.substring(0,m));let e=g&&o[g]?r(p):void 0;e&&e!==g&&(g=e,h=!1)}else g=r(p);if(!g){if(!h||(g=r(p),!g)){l=t+(l.length>0?` `+l:l);continue}h=!1}let _=d.length===0?``:d.length===1?d[0]:a(d).join(`:`),v=f?_+im:_,y=v+g;if(s.indexOf(y)>-1)continue;s.push(y);let b=i(g,h);for(let e=0;e<b.length;++e){let t=b[e];s.push(v+t)}l=t+(l.length>0?` `+l:l)}return l},mm=(...e)=>{let t=0,n,r,i=``;for(;t<e.length;)(n=e[t++])&&(r=hm(n))&&(i&&(i+=` `),i+=r);return i},hm=e=>{if(typeof e==`string`)return e;let t,n=``;for(let r=0;r<e.length;r++)e[r]&&(t=hm(e[r]))&&(n&&(n+=` `),n+=t);return n},gm=(e,...t)=>{let n,r,i,a,o=o=>(n=um(t.reduce((e,t)=>t(e),e())),r=n.cache.get,i=n.cache.set,a=s,s(o)),s=e=>{let t=r(e);if(t)return t;let a=pm(e,n);return i(e,a),a};return a=o,(...e)=>a(mm(...e))},_m=[],vm=e=>{let t=t=>t[e]||_m;return t.isThemeGetter=!0,t.themeKey=e,t},ym=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,bm=/^\((?:(\w[\w-]*):)?(.+)\)$/i,xm=/^\d+(?:\.\d+)?\/\d+(?:\.\d+)?$/,Sm=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,Cm=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,wm=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix|color|light-dark)\(.+\)$/,Tm=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,Em=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,Dm=e=>xm.test(e),Om=e=>!!e&&!Number.isNaN(Number(e)),km=e=>!!e&&Number.isInteger(Number(e)),Am=e=>e.endsWith(`%`)&&Om(e.slice(0,-1)),jm=e=>Sm.test(e),Mm=()=>!0,Nm=e=>Cm.test(e)&&!wm.test(e),Pm=()=>!1,Fm=e=>Tm.test(e),Im=e=>Em.test(e),Lm=e=>!Y(e)&&!qm(e),Rm=e=>e.startsWith(`@container`)&&(e[10]===`/`&&e[11]!==void 0||e[11]===`s`&&e[16]!==void 0&&e.startsWith(`-size/`,10)||e[11]===`n`&&e[18]!==void 0&&e.startsWith(`-normal/`,10)),zm=e=>th(e,ah,Pm),Y=e=>ym.test(e),Bm=e=>th(e,oh,Nm),Vm=e=>th(e,sh,Om),Hm=e=>th(e,lh,Mm),Um=e=>th(e,ch,Pm),Wm=e=>th(e,rh,Pm),Gm=e=>th(e,ih,Im),Km=e=>th(e,uh,Fm),qm=e=>bm.test(e),Jm=e=>nh(e,oh),Ym=e=>nh(e,ch),Xm=e=>nh(e,rh),Zm=e=>nh(e,ah),Qm=e=>nh(e,ih),$m=e=>nh(e,uh,!0),eh=e=>nh(e,lh,!0),th=(e,t,n)=>{let r=ym.exec(e);return r?r[1]?t(r[1]):n(r[2]):!1},nh=(e,t,n=!1)=>{let r=bm.exec(e);return r?r[1]?t(r[1]):n:!1},rh=e=>e===`position`||e===`percentage`,ih=e=>e===`image`||e===`url`,ah=e=>e===`length`||e===`size`||e===`bg-size`,oh=e=>e===`length`,sh=e=>e===`number`,ch=e=>e===`family-name`,lh=e=>e===`number`||e===`weight`,uh=e=>e===`shadow`,dh=()=>{let e=vm(`color`),t=vm(`font`),n=vm(`text`),r=vm(`font-weight`),i=vm(`tracking`),a=vm(`leading`),o=vm(`breakpoint`),s=vm(`container`),c=vm(`spacing`),l=vm(`radius`),u=vm(`shadow`),d=vm(`inset-shadow`),f=vm(`text-shadow`),p=vm(`drop-shadow`),m=vm(`blur`),h=vm(`perspective`),g=vm(`aspect`),_=vm(`ease`),v=vm(`animate`),y=()=>[`auto`,`avoid`,`all`,`avoid-page`,`page`,`left`,`right`,`column`],b=()=>[`center`,`top`,`bottom`,`left`,`right`,`top-left`,`left-top`,`top-right`,`right-top`,`bottom-right`,`right-bottom`,`bottom-left`,`left-bottom`],x=()=>[...b(),qm,Y],S=()=>[`auto`,`hidden`,`clip`,`visible`,`scroll`],C=()=>[`auto`,`contain`,`none`],w=()=>[qm,Y,c],T=()=>[Dm,`full`,`auto`,...w()],E=()=>[km,`none`,`subgrid`,qm,Y],D=()=>[`auto`,{span:[`full`,km,qm,Y]},km,qm,Y],O=()=>[km,`auto`,qm,Y],k=()=>[`auto`,`min`,`max`,`fr`,qm,Y],A=()=>[`start`,`end`,`center`,`between`,`around`,`evenly`,`stretch`,`baseline`,`center-safe`,`end-safe`],j=()=>[`start`,`end`,`center`,`stretch`,`center-safe`,`end-safe`],M=()=>[`auto`,...w()],N=()=>[Dm,`auto`,`full`,`dvw`,`dvh`,`lvw`,`lvh`,`svw`,`svh`,`min`,`max`,`fit`,...w()],P=()=>[s,Dm,`screen`,`full`,`dvw`,`lvw`,`svw`,`min`,`max`,`fit`,...w()],F=()=>[Dm,`screen`,`full`,`lh`,`dvh`,`lvh`,`svh`,`min`,`max`,`fit`,...w()],I=()=>[e,qm,Y],L=()=>[...b(),Xm,Wm,{position:[qm,Y]}],R=()=>[`no-repeat`,{repeat:[``,`x`,`y`,`space`,`round`]}],ee=()=>[`auto`,`cover`,`contain`,Zm,zm,{size:[qm,Y]}],z=()=>[Am,Jm,Bm],te=()=>[``,`none`,`full`,l,qm,Y],B=()=>[``,Om,Jm,Bm],ne=()=>[`solid`,`dashed`,`dotted`,`double`],V=()=>[`normal`,`multiply`,`screen`,`overlay`,`darken`,`lighten`,`color-dodge`,`color-burn`,`hard-light`,`soft-light`,`difference`,`exclusion`,`hue`,`saturation`,`color`,`luminosity`],H=()=>[Om,Am,Xm,Wm],re=()=>[``,`none`,m,qm,Y],ie=()=>[`none`,Om,qm,Y],ae=()=>[`none`,Om,qm,Y],oe=()=>[Om,qm,Y],se=()=>[Dm,`full`,...w()];return{cacheSize:500,theme:{animate:[`spin`,`ping`,`pulse`,`bounce`],aspect:[`video`],blur:[jm],breakpoint:[jm],color:[Mm],container:[jm],"drop-shadow":[jm],ease:[`in`,`out`,`in-out`],font:[Lm],"font-weight":[`thin`,`extralight`,`light`,`normal`,`medium`,`semibold`,`bold`,`extrabold`,`black`],"inset-shadow":[jm],leading:[`none`,`tight`,`snug`,`normal`,`relaxed`,`loose`],perspective:[`dramatic`,`near`,`normal`,`midrange`,`distant`,`none`],radius:[jm],shadow:[jm],spacing:[`px`,Om],text:[jm],"text-shadow":[jm],tracking:[`tighter`,`tight`,`normal`,`wide`,`wider`,`widest`]},classGroups:{aspect:[{aspect:[`auto`,`square`,Dm,Y,qm,g]}],container:[`container`],"container-type":[{"@container":[``,`normal`,`size`,qm,Y]}],"container-named":[Rm],columns:[{columns:[Om,`auto`,Y,qm,s]}],"break-after":[{"break-after":y()}],"break-before":[{"break-before":y()}],"break-inside":[{"break-inside":[`auto`,`avoid`,`avoid-page`,`avoid-column`]}],"box-decoration":[{"box-decoration":[`slice`,`clone`]}],box:[{box:[`border`,`content`]}],display:[`block`,`inline-block`,`inline`,`flex`,`inline-flex`,`table`,`inline-table`,`table-caption`,`table-cell`,`table-column`,`table-column-group`,`table-footer-group`,`table-header-group`,`table-row-group`,`table-row`,`flow-root`,`grid`,`inline-grid`,`contents`,`list-item`,`hidden`],sr:[`sr-only`,`not-sr-only`],float:[{float:[`right`,`left`,`none`,`start`,`end`]}],clear:[{clear:[`left`,`right`,`both`,`none`,`start`,`end`]}],isolation:[`isolate`,`isolation-auto`],"object-fit":[{object:[`contain`,`cover`,`fill`,`none`,`scale-down`]}],"object-position":[{object:x()}],overflow:[{overflow:S()}],"overflow-x":[{"overflow-x":S()}],"overflow-y":[{"overflow-y":S()}],overscroll:[{overscroll:C()}],"overscroll-x":[{"overscroll-x":C()}],"overscroll-y":[{"overscroll-y":C()}],position:[`static`,`fixed`,`absolute`,`relative`,`sticky`],inset:[{inset:T()}],"inset-x":[{"inset-x":T()}],"inset-y":[{"inset-y":T()}],start:[{"inset-s":T(),start:T()}],end:[{"inset-e":T(),end:T()}],"inset-bs":[{"inset-bs":T()}],"inset-be":[{"inset-be":T()}],top:[{top:T()}],right:[{right:T()}],bottom:[{bottom:T()}],left:[{left:T()}],visibility:[`visible`,`invisible`,`collapse`],z:[{z:[km,`auto`,qm,Y]}],basis:[{basis:[Dm,`full`,`auto`,s,...w()]}],"flex-direction":[{flex:[`row`,`row-reverse`,`col`,`col-reverse`]}],"flex-wrap":[{flex:[`nowrap`,`wrap`,`wrap-reverse`]}],flex:[{flex:[Om,Dm,`auto`,`initial`,`none`,Y]}],grow:[{grow:[``,Om,qm,Y]}],shrink:[{shrink:[``,Om,qm,Y]}],order:[{order:[km,`first`,`last`,`none`,qm,Y]}],"grid-cols":[{"grid-cols":E()}],"col-start-end":[{col:D()}],"col-start":[{"col-start":O()}],"col-end":[{"col-end":O()}],"grid-rows":[{"grid-rows":E()}],"row-start-end":[{row:D()}],"row-start":[{"row-start":O()}],"row-end":[{"row-end":O()}],"grid-flow":[{"grid-flow":[`row`,`col`,`dense`,`row-dense`,`col-dense`]}],"auto-cols":[{"auto-cols":k()}],"auto-rows":[{"auto-rows":k()}],gap:[{gap:w()}],"gap-x":[{"gap-x":w()}],"gap-y":[{"gap-y":w()}],"justify-content":[{justify:[...A(),`normal`]}],"justify-items":[{"justify-items":[...j(),`normal`]}],"justify-self":[{"justify-self":[`auto`,...j()]}],"align-content":[{content:[`normal`,...A()]}],"align-items":[{items:[...j(),{baseline:[``,`last`]}]}],"align-self":[{self:[`auto`,...j(),{baseline:[``,`last`]}]}],"place-content":[{"place-content":A()}],"place-items":[{"place-items":[...j(),`baseline`]}],"place-self":[{"place-self":[`auto`,...j()]}],p:[{p:w()}],px:[{px:w()}],py:[{py:w()}],ps:[{ps:w()}],pe:[{pe:w()}],pbs:[{pbs:w()}],pbe:[{pbe:w()}],pt:[{pt:w()}],pr:[{pr:w()}],pb:[{pb:w()}],pl:[{pl:w()}],m:[{m:M()}],mx:[{mx:M()}],my:[{my:M()}],ms:[{ms:M()}],me:[{me:M()}],mbs:[{mbs:M()}],mbe:[{mbe:M()}],mt:[{mt:M()}],mr:[{mr:M()}],mb:[{mb:M()}],ml:[{ml:M()}],"space-x":[{"space-x":w()}],"space-x-reverse":[`space-x-reverse`],"space-y":[{"space-y":w()}],"space-y-reverse":[`space-y-reverse`],size:[{size:N()}],"inline-size":[{inline:[`auto`,...P()]}],"min-inline-size":[{"min-inline":[`auto`,...P()]}],"max-inline-size":[{"max-inline":[`none`,...P()]}],"block-size":[{block:[`auto`,...F()]}],"min-block-size":[{"min-block":[`auto`,...F()]}],"max-block-size":[{"max-block":[`none`,...F()]}],w:[{w:[s,`screen`,...N()]}],"min-w":[{"min-w":[s,`screen`,`none`,...N()]}],"max-w":[{"max-w":[s,`screen`,`none`,`prose`,{screen:[o]},...N()]}],h:[{h:[`screen`,`lh`,...N()]}],"min-h":[{"min-h":[`screen`,`lh`,`none`,...N()]}],"max-h":[{"max-h":[`screen`,`lh`,`none`,...N()]}],"font-size":[{text:[`base`,n,Jm,Bm]}],"font-smoothing":[`antialiased`,`subpixel-antialiased`],"font-style":[`italic`,`not-italic`],"font-weight":[{font:[r,eh,Hm]}],"font-stretch":[{"font-stretch":[`ultra-condensed`,`extra-condensed`,`condensed`,`semi-condensed`,`normal`,`semi-expanded`,`expanded`,`extra-expanded`,`ultra-expanded`,Am,Y]}],"font-family":[{font:[Ym,Um,t]}],"font-features":[{"font-features":[Y]}],"fvn-normal":[`normal-nums`],"fvn-ordinal":[`ordinal`],"fvn-slashed-zero":[`slashed-zero`],"fvn-figure":[`lining-nums`,`oldstyle-nums`],"fvn-spacing":[`proportional-nums`,`tabular-nums`],"fvn-fraction":[`diagonal-fractions`,`stacked-fractions`],tracking:[{tracking:[i,qm,Y]}],"line-clamp":[{"line-clamp":[Om,`none`,qm,Vm]}],leading:[{leading:[`none`,a,...w()]}],"list-image":[{"list-image":[`none`,qm,Y]}],"list-style-position":[{list:[`inside`,`outside`]}],"list-style-type":[{list:[`disc`,`decimal`,`none`,qm,Y]}],"text-alignment":[{text:[`left`,`center`,`right`,`justify`,`start`,`end`]}],"placeholder-color":[{placeholder:I()}],"text-color":[{text:I()}],"text-decoration":[`underline`,`overline`,`line-through`,`no-underline`],"text-decoration-style":[{decoration:[...ne(),`wavy`]}],"text-decoration-thickness":[{decoration:[Om,`from-font`,`auto`,qm,Bm]}],"text-decoration-color":[{decoration:I()}],"underline-offset":[{"underline-offset":[Om,`auto`,qm,Y]}],"text-transform":[`uppercase`,`lowercase`,`capitalize`,`normal-case`],"text-overflow":[`truncate`,`text-ellipsis`,`text-clip`],"text-wrap":[{text:[`wrap`,`nowrap`,`balance`,`pretty`]}],indent:[{indent:w()}],"tab-size":[{tab:[km,qm,Y]}],"vertical-align":[{align:[`baseline`,`top`,`middle`,`bottom`,`text-top`,`text-bottom`,`sub`,`super`,qm,Y]}],whitespace:[{whitespace:[`normal`,`nowrap`,`pre`,`pre-line`,`pre-wrap`,`break-spaces`]}],break:[{break:[`normal`,`words`,`all`,`keep`]}],wrap:[{wrap:[`break-word`,`anywhere`,`normal`]}],hyphens:[{hyphens:[`none`,`manual`,`auto`]}],content:[{content:[`none`,qm,Y]}],"bg-attachment":[{bg:[`fixed`,`local`,`scroll`]}],"bg-clip":[{"bg-clip":[`border`,`padding`,`content`,`text`]}],"bg-origin":[{"bg-origin":[`border`,`padding`,`content`]}],"bg-position":[{bg:L()}],"bg-repeat":[{bg:R()}],"bg-size":[{bg:ee()}],"bg-image":[{bg:[`none`,{linear:[{to:[`t`,`tr`,`r`,`br`,`b`,`bl`,`l`,`tl`]},km,qm,Y],radial:[``,qm,Y],conic:[``,km,qm,Y]},Qm,Gm]}],"bg-color":[{bg:I()}],"gradient-from-pos":[{from:z()}],"gradient-via-pos":[{via:z()}],"gradient-to-pos":[{to:z()}],"gradient-from":[{from:I()}],"gradient-via":[{via:I()}],"gradient-to":[{to:I()}],rounded:[{rounded:te()}],"rounded-s":[{"rounded-s":te()}],"rounded-e":[{"rounded-e":te()}],"rounded-t":[{"rounded-t":te()}],"rounded-r":[{"rounded-r":te()}],"rounded-b":[{"rounded-b":te()}],"rounded-l":[{"rounded-l":te()}],"rounded-ss":[{"rounded-ss":te()}],"rounded-se":[{"rounded-se":te()}],"rounded-ee":[{"rounded-ee":te()}],"rounded-es":[{"rounded-es":te()}],"rounded-tl":[{"rounded-tl":te()}],"rounded-tr":[{"rounded-tr":te()}],"rounded-br":[{"rounded-br":te()}],"rounded-bl":[{"rounded-bl":te()}],"border-w":[{border:B()}],"border-w-x":[{"border-x":B()}],"border-w-y":[{"border-y":B()}],"border-w-s":[{"border-s":B()}],"border-w-e":[{"border-e":B()}],"border-w-bs":[{"border-bs":B()}],"border-w-be":[{"border-be":B()}],"border-w-t":[{"border-t":B()}],"border-w-r":[{"border-r":B()}],"border-w-b":[{"border-b":B()}],"border-w-l":[{"border-l":B()}],"divide-x":[{"divide-x":B()}],"divide-x-reverse":[`divide-x-reverse`],"divide-y":[{"divide-y":B()}],"divide-y-reverse":[`divide-y-reverse`],"border-style":[{border:[...ne(),`hidden`,`none`]}],"divide-style":[{divide:[...ne(),`hidden`,`none`]}],"border-color":[{border:I()}],"border-color-x":[{"border-x":I()}],"border-color-y":[{"border-y":I()}],"border-color-s":[{"border-s":I()}],"border-color-e":[{"border-e":I()}],"border-color-bs":[{"border-bs":I()}],"border-color-be":[{"border-be":I()}],"border-color-t":[{"border-t":I()}],"border-color-r":[{"border-r":I()}],"border-color-b":[{"border-b":I()}],"border-color-l":[{"border-l":I()}],"divide-color":[{divide:I()}],"outline-style":[{outline:[...ne(),`none`,`hidden`]}],"outline-offset":[{"outline-offset":[Om,qm,Y]}],"outline-w":[{outline:[``,Om,Jm,Bm]}],"outline-color":[{outline:I()}],shadow:[{shadow:[``,`inner`,`none`,u,$m,Km]}],"shadow-color":[{shadow:I()}],"inset-shadow":[{"inset-shadow":[`none`,d,$m,Km]}],"inset-shadow-color":[{"inset-shadow":I()}],"ring-w":[{ring:B()}],"ring-w-inset":[`ring-inset`],"ring-color":[{ring:I()}],"ring-offset-w":[{"ring-offset":[Om,Bm]}],"ring-offset-color":[{"ring-offset":I()}],"inset-ring-w":[{"inset-ring":B()}],"inset-ring-color":[{"inset-ring":I()}],"text-shadow":[{"text-shadow":[`none`,f,$m,Km]}],"text-shadow-color":[{"text-shadow":I()}],opacity:[{opacity:[Om,qm,Y]}],"mix-blend":[{"mix-blend":[...V(),`plus-darker`,`plus-lighter`]}],"bg-blend":[{"bg-blend":V()}],"mask-clip":[{"mask-clip":[`border`,`padding`,`content`,`fill`,`stroke`,`view`]},`mask-no-clip`],"mask-composite":[{mask:[`add`,`subtract`,`intersect`,`exclude`]}],"mask-image-linear-pos":[{"mask-linear":[Om]}],"mask-image-linear-from-pos":[{"mask-linear-from":H()}],"mask-image-linear-to-pos":[{"mask-linear-to":H()}],"mask-image-linear-from-color":[{"mask-linear-from":I()}],"mask-image-linear-to-color":[{"mask-linear-to":I()}],"mask-image-t-from-pos":[{"mask-t-from":H()}],"mask-image-t-to-pos":[{"mask-t-to":H()}],"mask-image-t-from-color":[{"mask-t-from":I()}],"mask-image-t-to-color":[{"mask-t-to":I()}],"mask-image-r-from-pos":[{"mask-r-from":H()}],"mask-image-r-to-pos":[{"mask-r-to":H()}],"mask-image-r-from-color":[{"mask-r-from":I()}],"mask-image-r-to-color":[{"mask-r-to":I()}],"mask-image-b-from-pos":[{"mask-b-from":H()}],"mask-image-b-to-pos":[{"mask-b-to":H()}],"mask-image-b-from-color":[{"mask-b-from":I()}],"mask-image-b-to-color":[{"mask-b-to":I()}],"mask-image-l-from-pos":[{"mask-l-from":H()}],"mask-image-l-to-pos":[{"mask-l-to":H()}],"mask-image-l-from-color":[{"mask-l-from":I()}],"mask-image-l-to-color":[{"mask-l-to":I()}],"mask-image-x-from-pos":[{"mask-x-from":H()}],"mask-image-x-to-pos":[{"mask-x-to":H()}],"mask-image-x-from-color":[{"mask-x-from":I()}],"mask-image-x-to-color":[{"mask-x-to":I()}],"mask-image-y-from-pos":[{"mask-y-from":H()}],"mask-image-y-to-pos":[{"mask-y-to":H()}],"mask-image-y-from-color":[{"mask-y-from":I()}],"mask-image-y-to-color":[{"mask-y-to":I()}],"mask-image-radial":[{"mask-radial":[qm,Y]}],"mask-image-radial-from-pos":[{"mask-radial-from":H()}],"mask-image-radial-to-pos":[{"mask-radial-to":H()}],"mask-image-radial-from-color":[{"mask-radial-from":I()}],"mask-image-radial-to-color":[{"mask-radial-to":I()}],"mask-image-radial-shape":[{"mask-radial":[`circle`,`ellipse`]}],"mask-image-radial-size":[{"mask-radial":[{closest:[`side`,`corner`],farthest:[`side`,`corner`]}]}],"mask-image-radial-pos":[{"mask-radial-at":b()}],"mask-image-conic-pos":[{"mask-conic":[Om]}],"mask-image-conic-from-pos":[{"mask-conic-from":H()}],"mask-image-conic-to-pos":[{"mask-conic-to":H()}],"mask-image-conic-from-color":[{"mask-conic-from":I()}],"mask-image-conic-to-color":[{"mask-conic-to":I()}],"mask-mode":[{mask:[`alpha`,`luminance`,`match`]}],"mask-origin":[{"mask-origin":[`border`,`padding`,`content`,`fill`,`stroke`,`view`]}],"mask-position":[{mask:L()}],"mask-repeat":[{mask:R()}],"mask-size":[{mask:ee()}],"mask-type":[{"mask-type":[`alpha`,`luminance`]}],"mask-image":[{mask:[`none`,qm,Y]}],filter:[{filter:[``,`none`,qm,Y]}],blur:[{blur:re()}],brightness:[{brightness:[Om,qm,Y]}],contrast:[{contrast:[Om,qm,Y]}],"drop-shadow":[{"drop-shadow":[``,`none`,p,$m,Km]}],"drop-shadow-color":[{"drop-shadow":I()}],grayscale:[{grayscale:[``,Om,qm,Y]}],"hue-rotate":[{"hue-rotate":[Om,qm,Y]}],invert:[{invert:[``,Om,qm,Y]}],saturate:[{saturate:[Om,qm,Y]}],sepia:[{sepia:[``,Om,qm,Y]}],"backdrop-filter":[{"backdrop-filter":[``,`none`,qm,Y]}],"backdrop-blur":[{"backdrop-blur":re()}],"backdrop-brightness":[{"backdrop-brightness":[Om,qm,Y]}],"backdrop-contrast":[{"backdrop-contrast":[Om,qm,Y]}],"backdrop-grayscale":[{"backdrop-grayscale":[``,Om,qm,Y]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[Om,qm,Y]}],"backdrop-invert":[{"backdrop-invert":[``,Om,qm,Y]}],"backdrop-opacity":[{"backdrop-opacity":[Om,qm,Y]}],"backdrop-saturate":[{"backdrop-saturate":[Om,qm,Y]}],"backdrop-sepia":[{"backdrop-sepia":[``,Om,qm,Y]}],"border-collapse":[{border:[`collapse`,`separate`]}],"border-spacing":[{"border-spacing":w()}],"border-spacing-x":[{"border-spacing-x":w()}],"border-spacing-y":[{"border-spacing-y":w()}],"table-layout":[{table:[`auto`,`fixed`]}],caption:[{caption:[`top`,`bottom`]}],transition:[{transition:[``,`all`,`colors`,`opacity`,`shadow`,`transform`,`none`,qm,Y]}],"transition-behavior":[{transition:[`normal`,`discrete`]}],duration:[{duration:[Om,`initial`,qm,Y]}],ease:[{ease:[`linear`,`initial`,_,qm,Y]}],delay:[{delay:[Om,qm,Y]}],animate:[{animate:[`none`,v,qm,Y]}],backface:[{backface:[`hidden`,`visible`]}],perspective:[{perspective:[h,qm,Y]}],"perspective-origin":[{"perspective-origin":x()}],rotate:[{rotate:ie()}],"rotate-x":[{"rotate-x":ie()}],"rotate-y":[{"rotate-y":ie()}],"rotate-z":[{"rotate-z":ie()}],scale:[{scale:ae()}],"scale-x":[{"scale-x":ae()}],"scale-y":[{"scale-y":ae()}],"scale-z":[{"scale-z":ae()}],"scale-3d":[`scale-3d`],skew:[{skew:oe()}],"skew-x":[{"skew-x":oe()}],"skew-y":[{"skew-y":oe()}],transform:[{transform:[qm,Y,``,`none`,`gpu`,`cpu`]}],"transform-origin":[{origin:x()}],"transform-style":[{transform:[`3d`,`flat`]}],translate:[{translate:se()}],"translate-x":[{"translate-x":se()}],"translate-y":[{"translate-y":se()}],"translate-z":[{"translate-z":se()}],"translate-none":[`translate-none`],zoom:[{zoom:[km,qm,Y]}],accent:[{accent:I()}],appearance:[{appearance:[`none`,`auto`]}],"caret-color":[{caret:I()}],"color-scheme":[{scheme:[`normal`,`dark`,`light`,`light-dark`,`only-dark`,`only-light`]}],cursor:[{cursor:[`auto`,`default`,`pointer`,`wait`,`text`,`move`,`help`,`not-allowed`,`none`,`context-menu`,`progress`,`cell`,`crosshair`,`vertical-text`,`alias`,`copy`,`no-drop`,`grab`,`grabbing`,`all-scroll`,`col-resize`,`row-resize`,`n-resize`,`e-resize`,`s-resize`,`w-resize`,`ne-resize`,`nw-resize`,`se-resize`,`sw-resize`,`ew-resize`,`ns-resize`,`nesw-resize`,`nwse-resize`,`zoom-in`,`zoom-out`,qm,Y]}],"field-sizing":[{"field-sizing":[`fixed`,`content`]}],"pointer-events":[{"pointer-events":[`auto`,`none`]}],resize:[{resize:[`none`,``,`y`,`x`]}],"scroll-behavior":[{scroll:[`auto`,`smooth`]}],"scrollbar-thumb-color":[{"scrollbar-thumb":I()}],"scrollbar-track-color":[{"scrollbar-track":I()}],"scrollbar-gutter":[{"scrollbar-gutter":[`auto`,`stable`,`both`]}],"scrollbar-w":[{scrollbar:[`auto`,`thin`,`none`]}],"scroll-m":[{"scroll-m":w()}],"scroll-mx":[{"scroll-mx":w()}],"scroll-my":[{"scroll-my":w()}],"scroll-ms":[{"scroll-ms":w()}],"scroll-me":[{"scroll-me":w()}],"scroll-mbs":[{"scroll-mbs":w()}],"scroll-mbe":[{"scroll-mbe":w()}],"scroll-mt":[{"scroll-mt":w()}],"scroll-mr":[{"scroll-mr":w()}],"scroll-mb":[{"scroll-mb":w()}],"scroll-ml":[{"scroll-ml":w()}],"scroll-p":[{"scroll-p":w()}],"scroll-px":[{"scroll-px":w()}],"scroll-py":[{"scroll-py":w()}],"scroll-ps":[{"scroll-ps":w()}],"scroll-pe":[{"scroll-pe":w()}],"scroll-pbs":[{"scroll-pbs":w()}],"scroll-pbe":[{"scroll-pbe":w()}],"scroll-pt":[{"scroll-pt":w()}],"scroll-pr":[{"scroll-pr":w()}],"scroll-pb":[{"scroll-pb":w()}],"scroll-pl":[{"scroll-pl":w()}],"snap-align":[{snap:[`start`,`end`,`center`,`align-none`]}],"snap-stop":[{snap:[`normal`,`always`]}],"snap-type":[{snap:[`none`,`x`,`y`,`both`]}],"snap-strictness":[{snap:[`mandatory`,`proximity`]}],touch:[{touch:[`auto`,`none`,`manipulation`]}],"touch-x":[{"touch-pan":[`x`,`left`,`right`]}],"touch-y":[{"touch-pan":[`y`,`up`,`down`]}],"touch-pz":[`touch-pinch-zoom`],select:[{select:[`none`,`text`,`all`,`auto`]}],"will-change":[{"will-change":[`auto`,`scroll`,`contents`,`transform`,qm,Y]}],fill:[{fill:[`none`,...I()]}],"stroke-w":[{stroke:[Om,Jm,Bm,Vm]}],stroke:[{stroke:[`none`,...I()]}],"forced-color-adjust":[{"forced-color-adjust":[`auto`,`none`]}]},conflictingClassGroups:{"container-named":[`container-type`],overflow:[`overflow-x`,`overflow-y`],overscroll:[`overscroll-x`,`overscroll-y`],inset:[`inset-x`,`inset-y`,`inset-bs`,`inset-be`,`start`,`end`,`top`,`right`,`bottom`,`left`],"inset-x":[`start`,`end`,`right`,`left`],"inset-y":[`inset-bs`,`inset-be`,`top`,`bottom`],flex:[`basis`,`grow`,`shrink`],gap:[`gap-x`,`gap-y`],p:[`px`,`py`,`ps`,`pe`,`pbs`,`pbe`,`pt`,`pr`,`pb`,`pl`],px:[`ps`,`pe`,`pr`,`pl`],py:[`pbs`,`pbe`,`pt`,`pb`],m:[`mx`,`my`,`ms`,`me`,`mbs`,`mbe`,`mt`,`mr`,`mb`,`ml`],mx:[`ms`,`me`,`mr`,`ml`],my:[`mbs`,`mbe`,`mt`,`mb`],size:[`w`,`h`],"font-size":[`leading`],"fvn-normal":[`fvn-ordinal`,`fvn-slashed-zero`,`fvn-figure`,`fvn-spacing`,`fvn-fraction`],"fvn-ordinal":[`fvn-normal`],"fvn-slashed-zero":[`fvn-normal`],"fvn-figure":[`fvn-normal`],"fvn-spacing":[`fvn-normal`],"fvn-fraction":[`fvn-normal`],"line-clamp":[`display`,`overflow`],rounded:[`rounded-s`,`rounded-e`,`rounded-t`,`rounded-r`,`rounded-b`,`rounded-l`,`rounded-ss`,`rounded-se`,`rounded-ee`,`rounded-es`,`rounded-tl`,`rounded-tr`,`rounded-br`,`rounded-bl`],"rounded-s":[`rounded-ss`,`rounded-es`],"rounded-e":[`rounded-se`,`rounded-ee`],"rounded-t":[`rounded-tl`,`rounded-tr`],"rounded-r":[`rounded-tr`,`rounded-br`],"rounded-b":[`rounded-br`,`rounded-bl`],"rounded-l":[`rounded-tl`,`rounded-bl`],"border-spacing":[`border-spacing-x`,`border-spacing-y`],"border-w":[`border-w-x`,`border-w-y`,`border-w-s`,`border-w-e`,`border-w-bs`,`border-w-be`,`border-w-t`,`border-w-r`,`border-w-b`,`border-w-l`],"border-w-x":[`border-w-s`,`border-w-e`,`border-w-r`,`border-w-l`],"border-w-y":[`border-w-bs`,`border-w-be`,`border-w-t`,`border-w-b`],"border-color":[`border-color-x`,`border-color-y`,`border-color-s`,`border-color-e`,`border-color-bs`,`border-color-be`,`border-color-t`,`border-color-r`,`border-color-b`,`border-color-l`],"border-color-x":[`border-color-s`,`border-color-e`,`border-color-r`,`border-color-l`],"border-color-y":[`border-color-bs`,`border-color-be`,`border-color-t`,`border-color-b`],translate:[`translate-x`,`translate-y`,`translate-none`],"translate-none":[`translate`,`translate-x`,`translate-y`,`translate-z`],"scroll-m":[`scroll-mx`,`scroll-my`,`scroll-ms`,`scroll-me`,`scroll-mbs`,`scroll-mbe`,`scroll-mt`,`scroll-mr`,`scroll-mb`,`scroll-ml`],"scroll-mx":[`scroll-ms`,`scroll-me`,`scroll-mr`,`scroll-ml`],"scroll-my":[`scroll-mbs`,`scroll-mbe`,`scroll-mt`,`scroll-mb`],"scroll-p":[`scroll-px`,`scroll-py`,`scroll-ps`,`scroll-pe`,`scroll-pbs`,`scroll-pbe`,`scroll-pt`,`scroll-pr`,`scroll-pb`,`scroll-pl`],"scroll-px":[`scroll-ps`,`scroll-pe`,`scroll-pr`,`scroll-pl`],"scroll-py":[`scroll-pbs`,`scroll-pbe`,`scroll-pt`,`scroll-pb`],touch:[`touch-x`,`touch-y`,`touch-pz`],"touch-x":[`touch`],"touch-y":[`touch`],"touch-pz":[`touch`]},conflictingClassGroupModifiers:{"font-size":[`leading`]},postfixLookupClassGroups:[`container-type`],orderSensitiveModifiers:[`*`,`**`,`after`,`backdrop`,`before`,`details-content`,`file`,`first-letter`,`first-line`,`marker`,`placeholder`,`selection`]}},fh=(e,{cacheSize:t,prefix:n,experimentalParseClassName:r,extend:i={},override:a={}})=>(ph(e,`cacheSize`,t),ph(e,`prefix`,n),ph(e,`experimentalParseClassName`,r),mh(e.theme,a.theme),mh(e.classGroups,a.classGroups),mh(e.conflictingClassGroups,a.conflictingClassGroups),mh(e.conflictingClassGroupModifiers,a.conflictingClassGroupModifiers),ph(e,`postfixLookupClassGroups`,a.postfixLookupClassGroups),ph(e,`orderSensitiveModifiers`,a.orderSensitiveModifiers),hh(e.theme,i.theme),hh(e.classGroups,i.classGroups),hh(e.conflictingClassGroups,i.conflictingClassGroups),hh(e.conflictingClassGroupModifiers,i.conflictingClassGroupModifiers),gh(e,i,`postfixLookupClassGroups`),gh(e,i,`orderSensitiveModifiers`),e),ph=(e,t,n)=>{n!==void 0&&(e[t]=n)},mh=(e,t)=>{if(t)for(let n in t)ph(e,n,t[n])},hh=(e,t)=>{if(t)for(let n in t)gh(e,t,n)},gh=(e,t,n)=>{let r=t[n];r!==void 0&&(e[n]=e[n]?e[n].concat(r):r)},_h=((e,...t)=>typeof e==`function`?gm(dh,e,...t):gm(()=>fh(dh(),e),...t))({extend:{theme:{text:[`title`,`heading`,`body`,`ui`,`caption`,`code`,`code-compact`,`code-comfy`,`kbd`]}}}),X=(...e)=>_h(Rp(e)),vh=e=>e,yh=e=>e?.replace(/([a-z0-9])([A-Z])/g,`$1-$2`).toLowerCase();function bh(e,t,n=[]){if(t==null)throw Error(`[lucide]: iconNode is required when icon name is used`);return{name:yh(e),size:24,node:t,...n.length>0?{aliases:n}:{}}}var xh=e=>{let t=``,n=!1;for(let r of e)r===`-`||r===`_`||r<=` `?n=t.length>0:(t.length===0?t+=r.toLowerCase():t+=n?r.toUpperCase():r,n=!1);return t},Sh=e=>{let t=xh(e);return t.charAt(0).toUpperCase()+t.slice(1)},Ch=(...e)=>e.filter((e,t,n)=>!!e&&e.trim()!==``&&n.indexOf(e)===t).join(` `).trim(),wh={xmlns:`http://www.w3.org/2000/svg`,width:24,height:24,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":2,"stroke-linecap":`round`,"stroke-linejoin":`round`};function Th(e){return e!=null}function Eh(e,t={}){let n=t.attributeNames??{},r=e=>n[e]??e,i=e.size??e.width??wh.width,a=e.size??e.height??wh.height,o=e.aliases?.filter(e=>typeof e==`string`&&e.trim()!==``).map(e=>`lucide-${e}`)??[],s=[...e.name?[`lucide-${e.name}`]:[],...o],c=t.className?.split(` `).filter(Boolean)??[],l=t.includeDefaultClasses===!1?Ch(...c):Ch(`lucide`,...s,...c),u=t.absoluteStrokeWidth?Number(t.strokeWidth??wh[`stroke-width`])*Number(e.size??e.width??wh.width)/Number(t.size??t.width??wh.width):t.strokeWidth??wh[`stroke-width`];return[`svg`,{...Object.entries(wh).reduce((e,[t,n])=>(e[r(t)]=n,e),{}),...`color`in t&&t.color&&{[r(`stroke`)]:t.color},...`size`in t&&Th(t.size)&&{[r(`width`)]:t.size,[r(`height`)]:t.size},...`width`in t&&Th(t.width)&&{[r(`width`)]:t.width},...`height`in t&&Th(t.height)&&{[r(`height`)]:t.height},[r(`stroke-width`)]:u,...l&&{[r(`class`)]:l},[r(`viewBox`)]:`0 0 ${i} ${a}`,...t.hasA11yProp===!1?{[r(`aria-hidden`)]:`true`}:{},...`attributes`in t&&t.attributes},e.node.map(e=>{let[n,i,a]=e,o=t.nonScalingStroke?{[r(`vector-effect`)]:`non-scaling-stroke`,...i}:i;return a?[n,o,a]:[n,o]})]}function Dh(e,t={}){return Eh(e,{...t,attributeNames:{...t.attributeNames,class:`className`,"stroke-width":`strokeWidth`,"stroke-linecap":`strokeLinecap`,"stroke-linejoin":`strokeLinejoin`,"vector-effect":`vectorEffect`}})}var Oh=e=>{for(let t in e)if(t.startsWith(`aria-`)||t===`role`||t===`title`)return!0;return!1},kh=(0,q.createContext)({}),Ah=()=>(0,q.useContext)(kh),jh=(0,q.forwardRef)(({color:e,size:t,width:n,height:r,strokeWidth:i,absoluteStrokeWidth:a,nonScalingStroke:o,className:s=``,children:c,iconNode:l=[],icon:u={node:l,aliases:[],size:24},...d},f)=>{let{size:p=24,strokeWidth:m=2,absoluteStrokeWidth:h=!1,nonScalingStroke:g=!1,color:_=`currentColor`,className:v=``}=Ah()??{},y=!!c||Oh(d),[b,x,S=[]]=Dh(u,{color:e??_,width:n??t??p,height:r??t??p,strokeWidth:i??m,absoluteStrokeWidth:a??h,nonScalingStroke:o??g,className:Ch(v,s),hasA11yProp:y,attributes:d});return(0,q.createElement)(b,{ref:f,...x},[...S.map(([e,t])=>(0,q.createElement)(e,t)),...Array.isArray(c)?c:[c]])});function Mh(e,t=[],n=[]){let r=typeof e==`string`?bh(e,t,n):e,i=(0,q.forwardRef)(({className:e,...t},n)=>(0,q.createElement)(jh,{ref:n,icon:r,className:e,...t}));return r.name&&(i.displayName=Sh(r.name)),i}var Nh={name:`braces`,size:24,node:[[`path`,{d:`M8 3H7a2 2 0 0 0-2 2v5a2 2 0 0 1-2 2 2 2 0 0 1 2 2v5c0 1.1.9 2 2 2h1`,key:`ezmyqa`}],[`path`,{d:`M16 21h1a2 2 0 0 0 2-2v-5c0-1.1.9-2 2-2a2 2 0 0 1-2-2V5a2 2 0 0 0-2-2h-1`,key:`e1hn23`}]],aliases:[`curly-braces`]};Nh.node;var Ph=Mh(Nh),Fh={name:`bug`,size:24,node:[[`path`,{d:`M12 20v-9`,key:`1qisl0`}],[`path`,{d:`M14 7a4 4 0 0 1 4 4v3a6 6 0 0 1-12 0v-3a4 4 0 0 1 4-4z`,key:`uouzyp`}],[`path`,{d:`M14.12 3.88 16 2`,key:`qol33r`}],[`path`,{d:`M21 21a4 4 0 0 0-3.81-4`,key:`1b0z45`}],[`path`,{d:`M21 5a4 4 0 0 1-3.55 3.97`,key:`5cxbf6`}],[`path`,{d:`M22 13h-4`,key:`1jl80f`}],[`path`,{d:`M3 21a4 4 0 0 1 3.81-4`,key:`1fjd4g`}],[`path`,{d:`M3 5a4 4 0 0 0 3.55 3.97`,key:`1d7oge`}],[`path`,{d:`M6 13H2`,key:`82j7cp`}],[`path`,{d:`m8 2 1.88 1.88`,key:`fmnt4t`}],[`path`,{d:`M9 7.13V6a3 3 0 1 1 6 0v1.13`,key:`1vgav8`}]]};Fh.node;var Ih=Mh(Fh),Lh={name:`check`,size:24,node:[[`path`,{d:`M20 6 9 17l-5-5`,key:`1gmf2c`}]]};Lh.node;var Rh=Mh(Lh),zh={name:`chevron-down`,size:24,node:[[`path`,{d:`m6 9 6 6 6-6`,key:`qrunsl`}]]};zh.node;var Bh=Mh(zh),Vh={name:`chevron-left`,size:24,node:[[`path`,{d:`m15 18-6-6 6-6`,key:`1wnfg3`}]]};Vh.node;var Hh=Mh(Vh),Uh={name:`chevron-right`,size:24,node:[[`path`,{d:`m9 18 6-6-6-6`,key:`mthhwq`}]]};Uh.node;var Wh=Mh(Uh),Gh={name:`chevron-up`,size:24,node:[[`path`,{d:`m18 15-6-6-6 6`,key:`153udz`}]]};Gh.node;var Kh=Mh(Gh),qh={name:`circle-check`,size:24,node:[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`m16 9-5.5 5.5L8 12`,key:`xofnsj`}]],aliases:[`check-circle-2`]};qh.node;var Jh=Mh(qh),Yh={name:`circle-dashed`,size:24,node:[[`path`,{d:`M10.1 2.182a10 10 0 0 1 3.8 0`,key:`5ilxe3`}],[`path`,{d:`M13.9 21.818a10 10 0 0 1-3.8 0`,key:`11zvb9`}],[`path`,{d:`M17.609 3.721a10 10 0 0 1 2.69 2.7`,key:`1iw5b2`}],[`path`,{d:`M2.182 13.9a10 10 0 0 1 0-3.8`,key:`c0bmvh`}],[`path`,{d:`M20.279 17.609a10 10 0 0 1-2.7 2.69`,key:`1ruxm7`}],[`path`,{d:`M21.818 10.1a10 10 0 0 1 0 3.8`,key:`qkgqxc`}],[`path`,{d:`M3.721 6.391a10 10 0 0 1 2.7-2.69`,key:`1mcia2`}],[`path`,{d:`M6.391 20.279a10 10 0 0 1-2.69-2.7`,key:`1fvljs`}]]};Yh.node;var Xh=Mh(Yh),Zh={name:`ellipsis`,size:24,node:[[`circle`,{cx:`12`,cy:`12`,r:`1`,key:`41hilf`}],[`circle`,{cx:`19`,cy:`12`,r:`1`,key:`1wjl8i`}],[`circle`,{cx:`5`,cy:`12`,r:`1`,key:`1pcz8c`}]],aliases:[`more-horizontal`]};Zh.node;var Qh=Mh(Zh),$h={name:`eye-off`,size:24,node:[[`path`,{d:`M10.733 5.076a10.744 10.744 0 0 1 11.205 6.575 1 1 0 0 1 0 .696 10.747 10.747 0 0 1-1.444 2.49`,key:`ct8e1f`}],[`path`,{d:`M14.084 14.158a3 3 0 0 1-4.242-4.242`,key:`151rxh`}],[`path`,{d:`M17.479 17.499a10.75 10.75 0 0 1-15.417-5.151 1 1 0 0 1 0-.696 10.75 10.75 0 0 1 4.446-5.143`,key:`13bj9a`}],[`path`,{d:`m2 2 20 20`,key:`1ooewy`}]]};$h.node;var eg=Mh($h),tg={name:`file-code`,size:24,node:[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,key:`1oefj6`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`path`,{d:`M10 12.5 8 15l2 2.5`,key:`1tg20x`}],[`path`,{d:`m14 12.5 2 2.5-2 2.5`,key:`yinavb`}]]};tg.node;var ng=Mh(tg),rg={name:`file-minus`,size:24,node:[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,key:`1oefj6`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`path`,{d:`M9 15h6`,key:`cctwl0`}]]};rg.node;var ig=Mh(rg),ag={name:`file-plus`,size:24,node:[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,key:`1oefj6`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`path`,{d:`M9 15h6`,key:`cctwl0`}],[`path`,{d:`M12 18v-6`,key:`17g6i2`}]]};ag.node;var og=Mh(ag),sg={name:`file-text`,size:24,node:[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,key:`1oefj6`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`path`,{d:`M10 9H8`,key:`b1mrlr`}],[`path`,{d:`M16 13H8`,key:`t4e002`}],[`path`,{d:`M16 17H8`,key:`z1uh3a`}]]};sg.node;var cg=Mh(sg),lg={name:`file`,size:24,node:[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,key:`1oefj6`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}]]};lg.node;var ug=Mh(lg),dg={name:`flag-off`,size:24,node:[[`path`,{d:`M16 16c-3 0-5-2-8-2a6 6 0 0 0-4 1.528`,key:`1q158e`}],[`path`,{d:`m2 2 20 20`,key:`1ooewy`}],[`path`,{d:`M4 22V4`,key:`1plyxx`}],[`path`,{d:`M7.656 2H8c3 0 5 2 7.333 2q2 0 3.067-.8A1 1 0 0 1 20 4v10.347`,key:`xj1b71`}]]};dg.node;var fg=Mh(dg),pg={name:`flask-conical`,size:24,node:[[`path`,{d:`M14 2v6a2 2 0 0 0 .245.96l5.51 10.08A2 2 0 0 1 18 22H6a2 2 0 0 1-1.755-2.96l5.51-10.08A2 2 0 0 0 10 8V2`,key:`18mbvz`}],[`path`,{d:`M6.453 15h11.094`,key:`3shlmq`}],[`path`,{d:`M8.5 2h7`,key:`csnxdl`}]]};pg.node;var mg=Mh(pg),hg={name:`folder-open`,size:24,node:[[`path`,{d:`m6 14 1.5-2.9A2 2 0 0 1 9.24 10H20a2 2 0 0 1 1.94 2.5l-1.54 6a2 2 0 0 1-1.95 1.5H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H18a2 2 0 0 1 2 2v2`,key:`usdka0`}]]};hg.node;var gg=Mh(hg),_g={name:`folder`,size:24,node:[[`path`,{d:`M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z`,key:`1kt360`}]]};_g.node;var vg=Mh(_g),yg={name:`git-merge`,size:24,node:[[`circle`,{cx:`18`,cy:`18`,r:`3`,key:`1xkwt0`}],[`circle`,{cx:`6`,cy:`6`,r:`3`,key:`1lh9wr`}],[`path`,{d:`M6 21V9a9 9 0 0 0 9 9`,key:`7kw0sc`}]]};yg.node;var bg=Mh(yg),xg={name:`git-pull-request-arrow`,size:24,node:[[`circle`,{cx:`5`,cy:`6`,r:`3`,key:`1qnov2`}],[`path`,{d:`M5 9v12`,key:`ih889a`}],[`circle`,{cx:`19`,cy:`18`,r:`3`,key:`1qljk2`}],[`path`,{d:`m15 9-3-3 3-3`,key:`1lwv8l`}],[`path`,{d:`M12 6h5a2 2 0 0 1 2 2v7`,key:`1yj91y`}]]};xg.node;var Sg=Mh(xg),Cg={name:`git-pull-request-closed`,size:24,node:[[`path`,{d:`m15.5 3.5 5 5`,key:`1kmx7t`}],[`path`,{d:`m15.5 8.5 5-5`,key:`saftza`}],[`path`,{d:`M18 11.62V15`,key:`1greaj`}],[`path`,{d:`M6 9v12`,key:`1sc30k`}],[`circle`,{cx:`18`,cy:`18`,r:`3`,key:`1xkwt0`}],[`circle`,{cx:`6`,cy:`6`,r:`3`,key:`1lh9wr`}]]};Cg.node;var wg=Mh(Cg),Tg={name:`git-pull-request-draft`,size:24,node:[[`circle`,{cx:`18`,cy:`18`,r:`3`,key:`1xkwt0`}],[`circle`,{cx:`6`,cy:`6`,r:`3`,key:`1lh9wr`}],[`path`,{d:`M18 6V5`,key:`1oao2s`}],[`path`,{d:`M18 11v-1`,key:`11c8tz`}],[`line`,{x1:`6`,x2:`6`,y1:`9`,y2:`21`,key:`rroup`}]]};Tg.node;var Eg=Mh(Tg),Dg={name:`git-pull-request`,size:24,node:[[`circle`,{cx:`18`,cy:`18`,r:`3`,key:`1xkwt0`}],[`circle`,{cx:`6`,cy:`6`,r:`3`,key:`1lh9wr`}],[`path`,{d:`M13 6h3a2 2 0 0 1 2 2v7`,key:`1yeb86`}],[`line`,{x1:`6`,x2:`6`,y1:`9`,y2:`21`,key:`rroup`}]]};Dg.node;var Og=Mh(Dg),kg={name:`image`,size:24,node:[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,ry:`2`,key:`1m3agn`}],[`circle`,{cx:`9`,cy:`9`,r:`2`,key:`af1f0g`}],[`path`,{d:`m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21`,key:`1xmnt7`}]]};kg.node;var Ag=Mh(kg),jg={name:`inbox`,size:24,node:[[`polyline`,{points:`22 12 16 12 14 15 10 15 8 12 2 12`,key:`o97t9d`}],[`path`,{d:`M5.45 5.11 2 12v6a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-6l-3.45-6.89A2 2 0 0 0 16.76 4H7.24a2 2 0 0 0-1.79 1.11z`,key:`oot6mr`}]]};jg.node;var Mg=Mh(jg),Ng={name:`info`,size:24,node:[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M12 16v-4`,key:`1dtifu`}],[`path`,{d:`M12 8h.01`,key:`e9boi3`}]]};Ng.node;var Pg=Mh(Ng),Fg={name:`laptop`,size:24,node:[[`path`,{d:`M18 5a2 2 0 0 1 2 2v8.526a2 2 0 0 0 .212.897l1.068 2.127a1 1 0 0 1-.9 1.45H3.62a1 1 0 0 1-.9-1.45l1.068-2.127A2 2 0 0 0 4 15.526V7a2 2 0 0 1 2-2z`,key:`1pdavp`}],[`path`,{d:`M20.054 15.987H3.946`,key:`14rxg9`}]]};Fg.node;var Ig=Mh(Fg),Lg={name:`layout-grid`,size:24,node:[[`rect`,{width:`7`,height:`7`,x:`3`,y:`3`,rx:`1`,key:`1g98yp`}],[`rect`,{width:`7`,height:`7`,x:`14`,y:`3`,rx:`1`,key:`6d4xhi`}],[`rect`,{width:`7`,height:`7`,x:`14`,y:`14`,rx:`1`,key:`nxv5o0`}],[`rect`,{width:`7`,height:`7`,x:`3`,y:`14`,rx:`1`,key:`1bb6yr`}]]};Lg.node;var Rg=Mh(Lg),zg={name:`link`,size:24,node:[[`path`,{d:`M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71`,key:`1cjeqo`}],[`path`,{d:`M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71`,key:`19qd67`}]]};zg.node;var Bg=Mh(zg),Vg={name:`loader-circle`,size:24,node:[[`path`,{d:`M21 12a9 9 0 1 1-6.219-8.56`,key:`13zald`}]],aliases:[`loader-2`]};Vg.node;var Hg=Mh(Vg),Ug={name:`lock`,size:24,node:[[`rect`,{width:`18`,height:`11`,x:`3`,y:`11`,rx:`2`,ry:`2`,key:`1w4ew1`}],[`path`,{d:`M7 11V7a5 5 0 0 1 10 0v4`,key:`fwvmzm`}]]};Ug.node;var Wg=Mh(Ug),Gg={name:`message-square`,size:24,node:[[`path`,{d:`M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z`,key:`18887p`}]]};Gg.node;var Kg=Mh(Gg),qg={name:`octagon-x`,size:24,node:[[`path`,{d:`m15 9-6 6`,key:`1uzhvr`}],[`path`,{d:`M2.586 16.726A2 2 0 0 1 2 15.312V8.688a2 2 0 0 1 .586-1.414l4.688-4.688A2 2 0 0 1 8.688 2h6.624a2 2 0 0 1 1.414.586l4.688 4.688A2 2 0 0 1 22 8.688v6.624a2 2 0 0 1-.586 1.414l-4.688 4.688a2 2 0 0 1-1.414.586H8.688a2 2 0 0 1-1.414-.586z`,key:`2d38gg`}],[`path`,{d:`m9 9 6 6`,key:`z0biqf`}]],aliases:[`x-octagon`]};qg.node;var Jg=Mh(qg),Yg={name:`palette`,size:24,node:[[`path`,{d:`M12 22a1 1 0 0 1 0-20 10 9 0 0 1 10 9 5 5 0 0 1-5 5h-2.25a1.75 1.75 0 0 0-1.4 2.8l.3.4a1.75 1.75 0 0 1-1.4 2.8z`,key:`e79jfc`}],[`circle`,{cx:`13.5`,cy:`6.5`,r:`.5`,fill:`currentColor`,key:`1okk4w`}],[`circle`,{cx:`17.5`,cy:`10.5`,r:`.5`,fill:`currentColor`,key:`f64h9f`}],[`circle`,{cx:`6.5`,cy:`12.5`,r:`.5`,fill:`currentColor`,key:`qy21gx`}],[`circle`,{cx:`8.5`,cy:`7.5`,r:`.5`,fill:`currentColor`,key:`fotxhn`}]]};Yg.node;var Xg=Mh(Yg),Zg={name:`pencil`,size:24,node:[[`path`,{d:`M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z`,key:`1a8usu`}],[`path`,{d:`m15 5 4 4`,key:`1mk7zo`}]]};Zg.node;var Qg=Mh(Zg),$g={name:`plus`,size:24,node:[[`path`,{d:`M5 12h14`,key:`1ays0h`}],[`path`,{d:`M12 5v14`,key:`s699le`}]]};$g.node;var e_=Mh($g),t_={name:`rotate-ccw-clock`,size:24,node:[[`path`,{d:`M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8`,key:`1357e3`}],[`path`,{d:`M3 3v5h5`,key:`1xhq8a`}],[`path`,{d:`M12 7v5l4 2`,key:`1fdv2h`}]],aliases:[`history`]};t_.node;var n_=Mh(t_),r_={name:`scan-eye`,size:24,node:[[`path`,{d:`M3 7V5a2 2 0 0 1 2-2h2`,key:`aa7l1z`}],[`path`,{d:`M17 3h2a2 2 0 0 1 2 2v2`,key:`4qcy5o`}],[`path`,{d:`M21 17v2a2 2 0 0 1-2 2h-2`,key:`6vwrx8`}],[`path`,{d:`M7 21H5a2 2 0 0 1-2-2v-2`,key:`ioqczr`}],[`circle`,{cx:`12`,cy:`12`,r:`1`,key:`41hilf`}],[`path`,{d:`M18.944 12.33a1 1 0 0 0 0-.66 7.5 7.5 0 0 0-13.888 0 1 1 0 0 0 0 .66 7.5 7.5 0 0 0 13.888 0`,key:`11ak4c`}]]};r_.node;var i_=Mh(r_),a_={name:`search`,size:24,node:[[`path`,{d:`m21 21-4.34-4.34`,key:`14j7rj`}],[`circle`,{cx:`11`,cy:`11`,r:`8`,key:`4ej97u`}]]};a_.node;var o_=Mh(a_),s_={name:`signpost`,size:24,node:[[`path`,{d:`M12 13v8`,key:`1l5pq0`}],[`path`,{d:`M12 3v3`,key:`1n5kay`}],[`path`,{d:`M2.354 10.354a1.207 1.207 0 0 1 0-1.708l2.06-2.06A2 2 0 0 1 5.828 6h12.344a2 2 0 0 1 1.414.586l2.06 2.06a1.207 1.207 0 0 1 0 1.708l-2.06 2.06a2 2 0 0 1-1.414.586H5.828a2 2 0 0 1-1.414-.586z`,key:`1tm261`}]]};s_.node;var c_=Mh(s_),l_={name:`sliders-horizontal`,size:24,node:[[`path`,{d:`M10 5H3`,key:`1qgfaw`}],[`path`,{d:`M12 19H3`,key:`yhmn1j`}],[`path`,{d:`M14 3v4`,key:`1sua03`}],[`path`,{d:`M16 17v4`,key:`1q0r14`}],[`path`,{d:`M21 12h-9`,key:`1o4lsq`}],[`path`,{d:`M21 19h-5`,key:`1rlt1p`}],[`path`,{d:`M21 5h-7`,key:`1oszz2`}],[`path`,{d:`M8 10v4`,key:`tgpxqk`}],[`path`,{d:`M8 12H3`,key:`a7s4jb`}]]};l_.node;var u_=Mh(l_),d_={name:`sparkles`,size:24,node:[[`path`,{d:`M11.017 2.814a1 1 0 0 1 1.966 0l1.051 5.558a2 2 0 0 0 1.594 1.594l5.558 1.051a1 1 0 0 1 0 1.966l-5.558 1.051a2 2 0 0 0-1.594 1.594l-1.051 5.558a1 1 0 0 1-1.966 0l-1.051-5.558a2 2 0 0 0-1.594-1.594l-5.558-1.051a1 1 0 0 1 0-1.966l5.558-1.051a2 2 0 0 0 1.594-1.594z`,key:`1s2grr`}],[`path`,{d:`M20 2v4`,key:`1rf3ol`}],[`path`,{d:`M22 4h-4`,key:`gwowj6`}],[`circle`,{cx:`4`,cy:`20`,r:`2`,key:`6kqj1y`}]],aliases:[`stars`]};d_.node;var f_=Mh(d_),p_={name:`ticket`,size:24,node:[[`path`,{d:`M2 9a3 3 0 0 1 0 6v2a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-2a3 3 0 0 1 0-6V7a2 2 0 0 0-2-2H4a2 2 0 0 0-2 2Z`,key:`qn84l0`}],[`path`,{d:`M13 5v2`,key:`dyzc3o`}],[`path`,{d:`M13 17v2`,key:`1ont0d`}],[`path`,{d:`M13 11v2`,key:`1wjjxi`}]]};p_.node;var m_=Mh(p_),h_={name:`trash`,size:24,node:[[`path`,{d:`M10 11v6`,key:`nco0om`}],[`path`,{d:`M14 11v6`,key:`outv1u`}],[`path`,{d:`M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6`,key:`miytrc`}],[`path`,{d:`M3 6h18`,key:`d0wm0j`}],[`path`,{d:`M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2`,key:`e791ji`}]],aliases:[`trash-2`]};h_.node;var g_=Mh(h_),__={name:`triangle-alert`,size:24,node:[[`path`,{d:`m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3`,key:`wmoenq`}],[`path`,{d:`M12 9v4`,key:`juzpu7`}],[`path`,{d:`M12 17h.01`,key:`p32p05`}]],aliases:[`alert-triangle`]};__.node;var v_=Mh(__),y_={name:`x`,size:24,node:[[`path`,{d:`M18 6 6 18`,key:`1bl5f8`}],[`path`,{d:`m6 6 12 12`,key:`d8bk6v`}]]};y_.node;var b_=Mh(y_),x_={page:`not-found`},S_=`/preferences`,C_=e=>{if(e===void 0)return null;try{return decodeURIComponent(e)}catch{return null}},w_=(e,t)=>C_(RegExp(`^/${t}/([^/]+)/?$`).exec(e)?.[1]),T_=e=>{if(e===`/`)return{page:`picker`};if(e===`/preferences`||e===`/preferences/`)return{page:`preferences`};let t=w_(e,`review`);if(t!==null){let e=Cu.safeParse(t);return e.success?{page:`review`,analysisId:e.data}:x_}let n=/^\/pr\/([^/]+)\/([^/]+)\/([^/]+)\/([^/]+)\/?$/.exec(e);if(n!==null){let e=Tc.safeParse(n[1]),t=C_(n[2]),r=C_(n[3]),i=C_(n[4]);if(!e.success||t===null||r===null||i===null)return x_;let a=mf(hf({repo:{host:e.data,owner:t,repo:r},number:Number(i)}));return a.ok&&String(a.value.number)===i?{page:`open`,ref:a.value}:x_}return x_},E_=({repo:e,number:t})=>`/pr/${e.host}/${[e.owner,e.repo].map(encodeURIComponent).join(`/`)}/${t}`,D_=e=>`/review/${encodeURIComponent(e)}`,O_=e=>(window.addEventListener(`popstate`,e),()=>window.removeEventListener(`popstate`,e)),k_=()=>(0,q.useSyncExternalStore)(O_,()=>window.location.pathname),A_=e=>{window.history.pushState(null,``,e),window.dispatchEvent(new PopStateEvent(`popstate`))},j_=e=>{window.history.replaceState(null,``,e),window.dispatchEvent(new PopStateEvent(`popstate`))},M_=e=>!e.defaultPrevented&&e.button===0&&!(e.metaKey||e.ctrlKey||e.shiftKey||e.altKey),N_=({to:e,onClick:t,...n})=>(0,J.jsx)(`a`,{href:e,onClick:n=>{t?.(n),M_(n)&&(n.preventDefault(),A_(e))},...n});function P_(){return typeof window<`u`}function F_(e){return R_(e)?(e.nodeName||``).toLowerCase():`#document`}function I_(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function L_(e){return((R_(e)?e.ownerDocument:e.document)||window.document)?.documentElement}function R_(e){return P_()?e instanceof Node||e instanceof I_(e).Node:!1}function z_(e){return P_()?e instanceof Element||e instanceof I_(e).Element:!1}function B_(e){return P_()?e instanceof HTMLElement||e instanceof I_(e).HTMLElement:!1}function V_(e){return!P_()||typeof ShadowRoot>`u`?!1:e instanceof ShadowRoot||e instanceof I_(e).ShadowRoot}function H_(e){let{overflow:t,overflowX:n,overflowY:r,display:i}=$_(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&i!==`inline`&&i!==`contents`}function U_(e){return/^(table|td|th)$/.test(F_(e))}function W_(e){try{if(e.matches(`:popover-open`))return!0}catch{}try{return e.matches(`:modal`)}catch{return!1}}var G_=/transform|translate|scale|rotate|perspective|filter/,K_=/paint|layout|strict|content/,q_=e=>!!e&&e!==`none`,J_;function Y_(e){let t=z_(e)?$_(e):e;return q_(t.transform)||q_(t.translate)||q_(t.scale)||q_(t.rotate)||q_(t.perspective)||!Z_()&&(q_(t.backdropFilter)||q_(t.filter))||G_.test(t.willChange||``)||K_.test(t.contain||``)}function X_(e){let t=tv(e);for(;B_(t)&&!Q_(t);){if(Y_(t))return t;if(W_(t))return null;t=tv(t)}return null}function Z_(){return J_??=typeof CSS<`u`&&CSS.supports&&CSS.supports(`-webkit-backdrop-filter`,`none`),J_}function Q_(e){return/^(html|body|#document)$/.test(F_(e))}function $_(e){return I_(e).getComputedStyle(e)}function ev(e){return z_(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function tv(e){if(F_(e)===`html`)return e;let t=e.assignedSlot||e.parentNode||V_(e)&&e.host||L_(e);return V_(t)?t.host:t}function nv(e){let t=tv(e);return Q_(t)?(e.ownerDocument||e).body:B_(t)&&H_(t)?t:nv(t)}function rv(e,t,n){t===void 0&&(t=[]),n===void 0&&(n=!0);let r=nv(e),i=r===e.ownerDocument?.body,a=I_(r);if(i){let e=iv(a);return t.concat(a,a.visualViewport||[],H_(r)?r:[],e&&n?rv(e):[])}return t.concat(r,rv(r,[],n))}function iv(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}var av={...q},ov={};function sv(e,t){let n=q.useRef(ov);return n.current===ov&&(n.current=e(t)),n}var cv=av.useInsertionEffect,lv=cv&&cv!==av.useLayoutEffect?cv:e=>e();function Z(e){let t=sv(uv).current;return t.next=e,lv(t.effect),t.trampoline}function uv(){let e={next:void 0,callback:dv,trampoline:(...t)=>e.callback?.(...t),effect:()=>{e.callback=e.next}};return e}function dv(){}var Q=typeof document<`u`?q.useLayoutEffect:()=>{};function fv(e,t){if(e&&!t)return e;if(!e&&t)return t;if(e||t)return{...e,...t}}var pv={};function mv(e,t,n,r,i){if(!n&&!r&&!i&&!e)return gv(t);let a=gv(e);return t&&(a=_v(a,t)),n&&(a=_v(a,n)),r&&(a=_v(a,r)),i&&(a=_v(a,i)),a}function hv(e){if(e.length===0)return pv;if(e.length===1)return gv(e[0]);let t=gv(e[0]);for(let n=1;n<e.length;n+=1)t=_v(t,e[n]);return t}function gv(e){return xv(e)?{...e(pv)}:vv(e)}function _v(e,t){return xv(t)?t(e):yv(e,t)}function vv(e){let t={...e};for(let e in t){let n=t[e];bv(e,n)&&(t[e]=Cv(n))}return t}function yv(e,t){if(!t)return e;for(let n in t){let r=t[n];switch(n){case`style`:e[n]=fv(e.style,r);break;case`className`:e[n]=Tv(e.className,r);break;default:e[n]=bv(n,r)?Sv(e[n],r):r}}return e}function bv(e,t){let n=e.charCodeAt(0),r=e.charCodeAt(1),i=e.charCodeAt(2);return n===111&&r===110&&i>=65&&i<=90&&(typeof t==`function`||t===void 0)}function xv(e){return typeof e==`function`}function Sv(e,t){return t?e?(...n)=>{let r=n[0];if(Ev(r)){let i=r;wv(i);let a=t(...n);return i.baseUIHandlerPrevented||e?.(...n),a}let i=t(...n);return e?.(...n),i}:Cv(t):e}function Cv(e){return e&&((...t)=>{let n=t[0];return Ev(n)&&wv(n),e(...t)})}function wv(e){return e.preventBaseUIHandler=()=>{e.baseUIHandlerPrevented=!0},e}function Tv(e,t){return t?e?t+` `+e:t:e}function Ev(e){return typeof e==`object`&&!!e&&`nativeEvent`in e}function Dv(e,t){return function(n,...r){let i=new URL(e);return i.searchParams.set(`code`,n.toString()),r.forEach(e=>i.searchParams.append(`args[]`,e)),`${t} error #${n}; visit ${i} for the full message.`}}var Ov=Dv(`https://base-ui.com/production-error`,`Base UI`),kv=q.createContext(void 0);function Av(e=!1){let t=q.useContext(kv);if(t===void 0&&!e)throw Error(Ov(16));return t}function jv(e){let{focusableWhenDisabled:t,disabled:n,composite:r=!1,tabIndex:i=0,isNativeButton:a}=e,o=r&&t!==!1,s=r&&t===!1;return{props:q.useMemo(()=>{let e={onKeyDown(e){n&&t&&e.key!==`Tab`&&e.preventDefault()}};return r||(e.tabIndex=i,!a&&n&&(e.tabIndex=t?i:-1)),(a&&(t||o)||!a&&n)&&(e[`aria-disabled`]=n),a&&(!t||s)&&(e.disabled=n),e},[r,n,t,o,s,a,i])}}function Mv(e){return e?.ownerDocument||document}function Nv(e,t,{detail:n=0,pointerType:r=``}={}){e.dispatchEvent(new(I_(e)).PointerEvent(`click`,{bubbles:!0,cancelable:!0,composed:!0,detail:n,pointerType:r,shiftKey:t.shiftKey,ctrlKey:t.ctrlKey,altKey:t.altKey,metaKey:t.metaKey}))}function Pv(e={}){let{disabled:t=!1,focusableWhenDisabled:n,tabIndex:r=0,native:i=!0,composite:a}=e,o=q.useRef(null),s=Av(!0),c=a??s!==void 0,{props:l}=jv({focusableWhenDisabled:n,disabled:t,composite:c,tabIndex:r,isNativeButton:i}),u=q.useCallback(()=>{let e=o.current;Fv(e)&&c&&t&&l.disabled===void 0&&e.disabled&&(e.disabled=!1)},[t,l.disabled,c]);return Q(u,[u]),{getButtonProps:q.useCallback((e={})=>{let{onClick:n,onMouseDown:r,onKeyUp:a,onKeyDown:o,onPointerDown:s,...u}=e;return mv({onClick(e){t?e.preventDefault():n?.(e)},onMouseDown(e){t||r?.(e)},onKeyDown(e){if(t||(wv(e),o?.(e),e.baseUIHandlerPrevented))return;let n=e.target===e.currentTarget,r=e.currentTarget,a=Fv(r),s=!i&&Iv(r),l=n&&(i?a:!s),u=e.key===`Enter`,d=e.key===` `,f=r.getAttribute(`role`),p=f?.startsWith(`menuitem`)||f===`option`||f===`gridcell`;if(n&&c&&d){if(e.defaultPrevented&&p)return;e.preventDefault(),(!i||a)&&(e.preventBaseUIHandler(),Nv(r,e))}else!l||i||!d&&!u?n&&s&&d&&e.preventDefault():e.defaultPrevented||(e.preventDefault(),u&&(e.preventBaseUIHandler(),Nv(r,e)))},onKeyUp(e){t||(wv(e),a?.(e),e.target===e.currentTarget&&i&&c&&Fv(e.currentTarget)&&e.key===` `?e.preventDefault():e.baseUIHandlerPrevented||e.target===e.currentTarget&&!i&&!c&&!e.defaultPrevented&&e.key===` `&&(e.preventBaseUIHandler(),Nv(e.currentTarget,e)))},onPointerDown(e){t?e.preventDefault():s?.(e)}},i?{type:`button`}:{role:`button`},l,u)},[t,l,c,i]),buttonRef:Z(e=>{o.current=e,u()})}}function Fv(e){return B_(e)&&e.tagName===`BUTTON`}function Iv(e){return B_(e)&&e.tagName===`A`&&!!e.href}function Lv(e,t,n,r){let i=sv(zv).current;return Bv(i,e,t,n,r)&&Hv(i,[e,t,n,r]),i.callback}function Rv(e){let t=sv(zv).current;return Vv(t,e)&&Hv(t,e),t.callback}function zv(){return{callback:null,cleanup:null,refs:[]}}function Bv(e,t,n,r,i){return e.refs[0]!==t||e.refs[1]!==n||e.refs[2]!==r||e.refs[3]!==i}function Vv(e,t){return e.refs.length!==t.length||e.refs.some((e,n)=>e!==t[n])}function Hv(e,t){e.refs=t,e.callback=t.every(e=>e==null)?null:n=>{if(e.cleanup&&=(e.cleanup(),null),n!=null){let r=Array(t.length).fill(null);for(let e=0;e<t.length;e+=1){let i=t[e];if(i!=null)switch(typeof i){case`function`:{let t=i(n);typeof t==`function`&&(r[e]=t);break}case`object`:i.current=n}}e.cleanup=()=>{for(let e=0;e<t.length;e+=1){let n=t[e];if(n!=null)switch(typeof n){case`function`:{let t=r[e];typeof t==`function`?t():n(null);break}case`object`:n.current=null}}}}}}var Uv=19;function Wv(e){return Uv>=e}function Gv(e){if(!q.isValidElement(e))return null;let t=e,n=t.props;return(Wv(19)?n?.ref:t.ref)??null}function Kv(){}var qv=Object.freeze([]),Jv=Object.freeze({});function Yv(e,t){let n={};for(let r in e){let i=e[r];if(t?.hasOwnProperty(r)){let e=t[r](i);e!=null&&Object.assign(n,e)}else i===!0?n[`data-${r.toLowerCase()}`]=``:i&&(n[`data-${r.toLowerCase()}`]=i.toString())}return n}function Xv(e,t){return typeof e==`function`?e(t):e}function Zv(e,t){return typeof e==`function`?e(t):e}function Qv(e,t,n={}){let r=t.render;n.enabled!==!1&&(r=ny(r));let i=$v(t,n,r);if(n.enabled===!1)return null;let a=n.state??Jv;return ry(e,r,i,a)}function $v(e,t,n){let{className:r,style:i}=e,{state:a=Jv,ref:o,props:s,stateAttributesMapping:c,enabled:l=!0}=t,u=l?Xv(r,a):void 0,d=l?Zv(i,a):void 0,f=l?Yv(a,c):Jv,p=l&&s?ey(s):void 0,m=l?fv(f,p)??{}:Jv;return typeof document<`u`&&(l?m.ref=Array.isArray(o)?Rv([m.ref,Gv(n),...o]):Lv(m.ref,Gv(n),o):Lv(null,null)),l?(u!==void 0&&(m.className=Tv(m.className,u)),d!==void 0&&(m.style=fv(m.style,d)),m):Jv}function ey(e){return Array.isArray(e)?hv(e):mv(void 0,e)}var ty=Symbol.for(`react.lazy`);function ny(e){if(e?.$$typeof!==ty)return e;let t=q.Children.toArray(e)[0];return q.isValidElement(t)?t:e}function ry(e,t,n,r){if(t){if(typeof t==`function`)return t(n,r);let e=mv(n,t.props);return e.ref=n.ref,q.cloneElement(t,e)}return iy(e,n)}function iy(e,t){return e===`button`?(0,q.createElement)(`button`,{type:`button`,...t,key:t.key}):e===`img`?(0,q.createElement)(`img`,{alt:``,...t,key:t.key}):q.createElement(e,t)}var ay=q.forwardRef(function(e,t){let{render:n,className:r,disabled:i=!1,focusableWhenDisabled:a=!1,nativeButton:o=!0,style:s,...c}=e,{getButtonProps:l,buttonRef:u}=Pv({disabled:i,focusableWhenDisabled:a,native:o});return Qv(`button`,e,{state:{disabled:i},ref:[t,u],props:[c,l]})}),oy=e=>typeof e==`boolean`?`${e}`:e===0?`0`:e,sy=Rp,cy=(e,t)=>n=>{if(t?.variants==null)return sy(e,n?.class,n?.className);let{variants:r,defaultVariants:i}=t,a=Object.keys(r).map(e=>{let t=n?.[e],a=i?.[e];if(t===null)return null;let o=oy(t)||oy(a);return r[e][o]}),o=n&&Object.entries(n).reduce((e,t)=>{let[n,r]=t;return r===void 0||(e[n]=r),e},{});return sy(e,a,t?.compoundVariants?.reduce((e,t)=>{let{class:n,className:r,...a}=t;return Object.entries(a).every(e=>{let[t,n]=e;return Array.isArray(n)?n.includes({...i,...o}[t]):{...i,...o}[t]===n})?[...e,n,r]:e},[]),n?.class,n?.className)},ly=cy(`group/button inline-flex shrink-0 items-center justify-center rounded-md border border-transparent bg-clip-padding text-ui font-medium whitespace-nowrap transition-all select-none active:not-aria-[haspopup]:not-aria-disabled:translate-y-px disabled:pointer-events-none disabled:opacity-50 aria-disabled:cursor-not-allowed aria-disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4`,{variants:{variant:{default:`bg-primary text-primary-foreground hover:bg-primary/80 aria-disabled:hover:bg-primary`,outline:`border-border bg-background hover:bg-muted hover:text-foreground aria-expanded:bg-muted aria-expanded:text-foreground aria-disabled:hover:bg-background`,secondary:`bg-secondary text-secondary-foreground hover:bg-[color-mix(in_oklch,var(--secondary),var(--foreground)_5%)] aria-expanded:bg-secondary aria-expanded:text-secondary-foreground`,ghost:`hover:bg-muted hover:text-foreground aria-expanded:bg-muted aria-expanded:text-foreground`,destructive:`bg-destructive/10 text-destructive hover:bg-destructive/20 focus-visible:border-destructive/40 focus-visible:ring-destructive/20`,link:`text-primary underline-offset-4 hover:underline`},size:{default:`h-8 gap-1.5 px-2.5 has-data-[icon=inline-end]:pr-2 has-data-[icon=inline-start]:pl-2`,xs:`h-6 gap-1 rounded-md px-2 text-caption in-data-[slot=button-group]:rounded-md has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 [&_svg:not([class*='size-'])]:size-3`,sm:`h-7 gap-1 rounded-md px-2.5 text-ui in-data-[slot=button-group]:rounded-md has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 [&_svg:not([class*='size-'])]:size-3.5`,lg:`h-9 gap-1.5 px-2.5 has-data-[icon=inline-end]:pr-2 has-data-[icon=inline-start]:pl-2`,icon:`size-8`,"icon-xs":`size-6 rounded-md in-data-[slot=button-group]:rounded-md [&_svg:not([class*='size-'])]:size-3`,"icon-sm":`size-7 rounded-md in-data-[slot=button-group]:rounded-md`,"icon-lg":`size-9`}},defaultVariants:{variant:`default`,size:`default`}});function $({className:e,variant:t=`default`,size:n=`default`,...r}){return(0,J.jsx)(ay,{"data-slot":`button`,className:X(ly({variant:t,size:n,className:e})),...r})}var uy=[],dy=void 0;function fy(){return dy}function py(e){uy.push(e)}function my(e){let t=(t,n)=>{let r=sv(gy).current,i;try{dy=r;for(let e of uy)e.before(r);i=e(t,n);for(let e of uy)e.after(r);r.didInitialize=!0}finally{dy=void 0}return i};return t.displayName=e.displayName||e.name,t}function hy(e){return q.forwardRef(my(e))}function gy(){return{didInitialize:!1}}function _y(e){q.useEffect(e,qv)}var vy=0,yy=class e{static create(){return new e}currentId=vy;start(e,t){this.clear(),this.currentId=setTimeout(()=>{this.currentId=vy,t()},e)}isStarted(){return this.currentId!==vy}clear=()=>{this.currentId!==vy&&(clearTimeout(this.currentId),this.currentId=vy)};disposeEffect=()=>this.clear};function by(){let e=sv(yy.create).current;return _y(e.disposeEffect),e}function xy(){return typeof navigator>`u`?{userAgent:``,platform:``,maxTouchPoints:0}:{userAgent:navigator.userAgent,platform:navigator.platform??``,maxTouchPoints:navigator.maxTouchPoints??0}}var{userAgent:Sy,platform:Cy,maxTouchPoints:wy}=xy(),Ty=Sy.toLowerCase(),Ey=Cy.toLowerCase(),Dy=/^i(os$|p)/.test(Ey)||Ey===`macintel`&&wy>1,Oy=`android`,ky=Ey===Oy||Ty.includes(Oy),Ay=!Dy&&Ey.startsWith(`mac`);Ey.startsWith(`win`),!ky&&/^(linux|chrome os)/.test(Ey);var jy=Ay||Dy,My=typeof CSS<`u`&&!!CSS.supports?.(`-webkit-backdrop-filter:none`);!My&&Ty.includes(`firefox`),!My&&Ty.includes(`chrom`);var Ny=jy,Py=/jsdom|happydom/.test(Ty);function Fy(e){e.preventDefault(),e.stopPropagation()}function Iy(e){return`nativeEvent`in e}function Ly(e){return e.pointerType===``&&e.isTrusted?!0:ky&&e.pointerType?e.type===`click`&&e.buttons===1:e.detail===0&&!e.pointerType}function Ry(e){return Py?!1:!ky&&e.width===0&&e.height===0||e.type===`pointerdown`&&e.width===1&&e.height===1&&e.pressure===0&&e.detail===0&&e.pointerType===`mouse`&&(ky||e.buttons===0)||e.width<1&&e.height<1&&e.pressure===0&&e.detail===0&&e.pointerType===`touch`}function zy(e,t){let n=[`mouse`,`pen`];return t||n.push(``,void 0),n.includes(e)}function By(e){let t=e.type;return t===`click`||t===`mousedown`||t===`keydown`||t===`keyup`}function Vy(e){let t=e.activeElement;for(;t?.shadowRoot?.activeElement!=null;)t=t.shadowRoot.activeElement;return t}function Hy(e,t){if(!e||!t)return!1;let n=t.getRootNode?.();if(e.contains(t))return!0;if(n&&V_(n)){let n=t;for(;n;){if(e===n)return!0;n=n.parentNode||n.host}}return!1}function Uy(e,t){let n=e;for(;n;){if(z_(n)&&n.matches(t))return n;n=n.assignedSlot??n.parentNode??(V_(n)?n.host:null)}return null}function Wy(e){return`composedPath`in e?e.composedPath()[0]??e.target:e.target}var Gy=`data-base-ui-focusable`,Ky=`input:not([type='hidden']):not([disabled]),[contenteditable]:not([contenteditable='false']),textarea:not([disabled])`,qy=`ArrowLeft`,Jy=`ArrowRight`,Yy=`ArrowUp`,Xy=`ArrowDown`,Zy=`data-starting-style`,Qy=`data-ending-style`,$y={[Zy]:``},eb={[Qy]:``},tb={transitionStatus(e){return e===`starting`?$y:e===`ending`?eb:null}},nb=`data-open`,rb=`data-closed`,ib=`data-anchor-hidden`,ab=`data-popup-open`,ob=`data-pressed`,sb={[ab]:``},cb={[ab]:``,[ob]:``},lb={[nb]:``},ub={[rb]:``},db={[ib]:``},fb={open(e){return e?sb:null}},pb={open(e){return e?cb:null}},mb={open(e){return e?lb:ub},anchorHidden(e){return e?db:null}},hb={...mb,...tb},gb=`data-trigger-disabled`;function _b(e,t){if(!z_(e))return!1;let n=e;if(t.hasElement(n))return!n.hasAttribute(gb);for(let[,e]of t.entries())if(Hy(e,n))return!e.hasAttribute(gb);return!1}function vb(e,t){if(t==null)return!1;if(`composedPath`in e)return e.composedPath().includes(t);let n=e;return n.target!=null&&t.contains(n.target)}function yb(e){return e.matches(`html,body`)}function bb(e){return B_(e)&&e.matches(`input:not([type='hidden']):not([disabled]),[contenteditable]:not([contenteditable='false']),textarea:not([disabled])`)}function xb(e){return Uy(e,`button,a[href],[role="button"],select,[tabindex]:not([tabindex="-1"]),${Ky}`)!=null}function Sb(e){return e?e.getAttribute(`role`)===`combobox`&&bb(e):!1}function Cb(e){if(!e||Py)return!0;try{return e.matches(`:focus-visible`)}catch{return!0}}function wb(e){return e?e.hasAttribute(`data-base-ui-focusable`)?e:e.querySelector(`[data-base-ui-focusable]`)||e:null}function Tb(e,t){return t!=null&&!zy(t)?0:typeof e==`function`?e():e}function Eb(e,t,n){let r=Tb(e,n);return typeof r==`number`?r:r?.[t]}function Db(e){return typeof e==`function`?e():e}function Ob(e,t){return t||e===`click`||e===`mousedown`}function kb(e){return e?.includes(`mouse`)&&e!==`mousedown`}function Ab(e,t,n,r){let i=!1,a=!1,o=r??Jv;return{reason:e,event:t??new Event(`base-ui`),cancel(){i=!0},allowPropagation(){a=!0},get isCanceled(){return i},get isPropagationAllowed(){return a},trigger:n,...o}}function jb(e,t,n){let r=n??Jv;return{reason:e,event:t??new Event(`base-ui`),...r}}var Mb=`none`,Nb=`trigger-press`,Pb=`trigger-hover`,Fb=`trigger-focus`,Ib=`outside-press`,Lb=`item-press`,Rb=`close-press`,zb=`focus-out`,Bb=`escape-key`,Vb=`list-navigation`,Hb=`keyboard`,Ub=`pointer`,Wb=`cancel-open`,Gb=`sibling-open`,Kb=`disabled`,qb=`missing`,Jb=`initial`,Yb=`imperative-action`,Xb=`window-resize`,Zb=q.createContext({hasProvider:!1,timeoutMs:0,delayRef:{current:0},initialDelayRef:{current:0},timeout:new yy,currentIdRef:{current:null},currentContextRef:{current:null}});function Qb(e,t){e.current=t.current}function $b(e){let{children:t,delay:n,timeoutMs:r=0}=e,i=q.useRef(n),a=q.useRef(n),o=q.useRef(null),s=q.useRef(null),c=by();return Q(()=>{a.current=n,o.current?i.current={open:Eb(i.current,`open`),close:Eb(n,`close`)}:i.current=n},[n,o,i,a]),(0,J.jsx)(Zb.Provider,{value:q.useMemo(()=>({hasProvider:!0,delayRef:i,initialDelayRef:a,currentIdRef:o,timeoutMs:r,currentContextRef:s,timeout:c}),[r,c]),children:t})}function ex(e,t={open:!1}){let{open:n}=t,r=e.useState(`floatingId`),{currentIdRef:i,delayRef:a,timeoutMs:o,initialDelayRef:s,currentContextRef:c,hasProvider:l,timeout:u}=q.useContext(Zb),[d,f]=q.useState(!1),p=q.useRef(n);return Q(()=>{p.current=n},[n]),Q(()=>{function t(){c.current?.setIsInstantPhase(!1),i.current=null,c.current=null,a.current=s.current,u.clear()}if(i.current&&!n&&i.current===r){if(f(!1),o){let n=r;return u.start(o,()=>{e.select(`open`)||i.current&&i.current!==n||t()}),()=>{(p.current||i.current!==n)&&u.clear()}}t()}},[n,r,i,a,o,s,c,u,e]),Q(()=>{if(!n)return;let t=c.current,o=i.current;u.clear(),c.current={onOpenChange:e.setOpen,setIsInstantPhase:f},i.current=r,a.current={open:0,close:Eb(s.current,`close`)},o!==null&&o!==r?(f(!0),t?.setIsInstantPhase(!0),t?.onOpenChange(!1,Ab(Mb))):(f(!1),t?.setIsInstantPhase(!1))},[n,r,e,i,a,s,c,u]),Q(()=>()=>{if(i.current===r){if(c.current=null,!p.current)return;i.current=null,Qb(a,s),u.clear()}},[c,i,a,r,s,u]),q.useMemo(()=>({activeIdRef:i,hasProvider:l,delayRef:a,isInstantPhase:d}),[i,l,a,d])}function tx(e,t,n,r){return e.addEventListener(t,n,r),()=>{e.removeEventListener(t,n,r)}}function nx(...e){return()=>{for(let t=0;t<e.length;t+=1){let n=e[t];n&&n()}}}function rx(e){let t=sv(ix,e).current;return t.next=e,Q(t.effect),t}function ix(e){let t={current:e,next:e,effect:()=>{t.current=t.next}};return t}var ax=null;globalThis.requestAnimationFrame;var ox=new class{callbacks=[];callbacksCount=0;nextId=1;startId=1;isScheduled=!1;tick=e=>{this.isScheduled=!1;let t=this.callbacks,n=this.callbacksCount;if(this.callbacks=[],this.callbacksCount=0,this.startId=this.nextId,n>0)for(let n=0;n<t.length;n+=1)t[n]?.(e)};request(e){let t=this.nextId;return this.nextId+=1,this.callbacks.push(e),this.callbacksCount+=1,this.isScheduled||=(requestAnimationFrame(this.tick),!0),t}cancel(e){let t=e-this.startId;t<0||t>=this.callbacks.length||this.callbacks[t]!==null&&(this.callbacks[t]=null,--this.callbacksCount)}},sx=class e{static create(){return new e}static request(e){return ox.request(e)}static cancel(e){return ox.cancel(e)}currentId=ax;request(e){this.cancel(),this.currentId=ox.request(()=>{this.currentId=ax,e()})}cancel=()=>{this.currentId!==ax&&(ox.cancel(this.currentId),this.currentId=ax)};disposeEffect=()=>this.cancel};function cx(){let e=sv(sx.create).current;return _y(e.disposeEffect),e}var lx={clipPath:`inset(50%)`,overflow:`hidden`,whiteSpace:`nowrap`,border:0,padding:0,width:1,height:1,margin:-1},ux={...lx,position:`fixed`,margin:0,top:0,left:0},dx={...lx,position:`absolute`},fx=q.forwardRef(function(e,t){let[n,r]=q.useState();Q(()=>{Ny&&My&&r(`button`)},[]);let i={tabIndex:0,role:n};return(0,J.jsx)(`span`,{...e,ref:t,style:ux,"aria-hidden":!n||void 0,...i,"data-base-ui-focus-guard":``})}),px=Math.min,mx=Math.max,hx=Math.round,gx=Math.floor,_x=e=>({x:e,y:e}),vx={left:`right`,right:`left`,bottom:`top`,top:`bottom`};function yx(e,t,n){return mx(e,px(t,n))}function bx(e,t){return typeof e==`function`?e(t):e}function xx(e){return e.split(`-`)[0]}function Sx(e){return e.split(`-`)[1]}function Cx(e){return e===`x`?`y`:`x`}function wx(e){return e===`y`?`height`:`width`}function Tx(e){let t=e[0];return t===`t`||t===`b`?`y`:`x`}function Ex(e){return Cx(Tx(e))}function Dx(e,t,n){n===void 0&&(n=!1);let r=Sx(e),i=Ex(e),a=wx(i),o=i===`x`?r===(n?`end`:`start`)?`right`:`left`:r===`start`?`bottom`:`top`;return t.reference[a]>t.floating[a]&&(o=Ix(o)),[o,Ix(o)]}function Ox(e){let t=Ix(e);return[kx(e),t,kx(t)]}function kx(e){return e.includes(`start`)?e.replace(`start`,`end`):e.replace(`end`,`start`)}var Ax=[`left`,`right`],jx=[`right`,`left`],Mx=[`top`,`bottom`],Nx=[`bottom`,`top`];function Px(e,t,n){switch(e){case`top`:case`bottom`:return n?t?jx:Ax:t?Ax:jx;case`left`:case`right`:return t?Mx:Nx;default:return[]}}function Fx(e,t,n,r){let i=Sx(e),a=Px(xx(e),n===`start`,r);return i&&(a=a.map(e=>e+`-`+i),t&&(a=a.concat(a.map(kx)))),a}function Ix(e){let t=xx(e);return vx[t]+e.slice(t.length)}function Lx(e){return{top:e.top??0,right:e.right??0,bottom:e.bottom??0,left:e.left??0}}function Rx(e){return typeof e==`number`?{top:e,right:e,bottom:e,left:e}:Lx(e)}function zx(e){let{x:t,y:n,width:r,height:i}=e;return{width:r,height:i,top:n,left:t,right:t+r,bottom:n+i,x:t,y:n}}function Bx(e,t){return t<0||t>=e.length}function Vx(e,t){return Wx(e.current,{disabledIndices:t})}function Hx(e,t){return Wx(e.current,{decrement:!0,startingIndex:e.current.length,disabledIndices:t})}function Ux(e,t,n){let{decrement:r,loopFocus:i,allowEscape:a,disabledIndices:o,minIndex:s,maxIndex:c}=n,l=()=>Wx(e,{startingIndex:t,decrement:r,disabledIndices:o}),u,d=!1;if(!i)u=r?Math.max(s,l()):Math.min(c,l());else if(r?t<=s:t>=c){let n=r?-1:e.length;a&&t!==n?u=-1:(u=r?c:s,d=!0)}else u=l();return{index:Bx(e,u)?-1:u,wrapped:d}}function Wx(e,{startingIndex:t=-1,decrement:n=!1,disabledIndices:r,amount:i=1}={}){let a=t;do a+=n?-i:i;while(a>=0&&a<=e.length-1&&Gx(e,a,r));return a}function Gx(e,t,n){if(typeof n==`function`?n(t):n?.includes(t)??!1)return!0;let r=e[t];return r?!qx(r)||r.matches(`:disabled`)?!0:!n&&(r.hasAttribute(`disabled`)||r.getAttribute(`aria-disabled`)===`true`):!1}function Kx(e){return e.visibility===`hidden`||e.visibility===`collapse`}function qx(e,t=e?$_(e):null){return!e||!e.isConnected||!t||Kx(t)?!1:typeof e.checkVisibility==`function`?e.checkVisibility():t.display!==`none`&&t.display!==`contents`}var Jx=`a[href],button,input,select,textarea,summary,details,iframe,object,embed,[tabindex],[contenteditable]:not([contenteditable="false"]),audio[controls],video[controls]`;function Yx(e){let t=e.assignedSlot;if(t)return t;if(e.parentElement)return e.parentElement;let n=e.getRootNode();return V_(n)?n.host:null}function Xx(e){for(let t of Array.from(e.children))if(F_(t)===`summary`)return t;return null}function Zx(e,t){let n=Xx(t);return!!n&&(e===n||Hy(n,e))}function Qx(e){let t=e?F_(e):``;return e!=null&&e.matches(Jx)&&(t!==`summary`||e.parentElement!=null&&F_(e.parentElement)===`details`&&Xx(e.parentElement)===e)&&(t!==`details`||Xx(e)==null)&&(t!==`input`||e.type!==`hidden`)}function $x(e){if(!Qx(e)||!e.isConnected||e.matches(`:disabled`))return!1;for(let t=e;t;t=Yx(t)){let n=t!==e,r=F_(t)===`slot`;if(t.hasAttribute(`inert`)||n&&F_(t)===`details`&&!t.open&&!Zx(e,t)||t.hasAttribute(`hidden`)||!r&&!eS(t,n))return!1}return!0}function eS(e,t){let n=$_(e);return t?n.display!==`none`:qx(e,n)}function tS(e){let t=e.tabIndex;if(t<0){let t=F_(e);if(t===`details`||t===`audio`||t===`video`||B_(e)&&e.isContentEditable)return 0}return t}function nS(e){if(F_(e)!==`input`)return null;let t=e;return t.type===`radio`&&t.name!==``?t:null}function rS(e,t){let n=nS(e);if(!n)return!0;let r=t.find(e=>{let t=nS(e);return t?.name===n.name&&t.form===n.form&&t.checked});return r?r===n:t.find(e=>{let t=nS(e);return t?.name===n.name&&t.form===n.form})===n}function iS(e){if(B_(e)&&F_(e)===`slot`){let t=e.assignedElements({flatten:!0});if(t.length>0)return t}return B_(e)&&e.shadowRoot?Array.from(e.shadowRoot.children):Array.from(e.children)}function aS(e,t){iS(e).forEach(e=>{Qx(e)&&t.push(e),aS(e,t)})}function oS(e,t,n){iS(e).forEach(e=>{B_(e)&&e.matches(t)&&n.push(e),oS(e,t,n)})}function sS(e){return $x(e)&&tS(e)>=0}function cS(e){let t=[];return aS(e,t),t.filter($x)}function lS(e){let t=cS(e);return t.filter(e=>tS(e)>=0&&rS(e,t))}function uS(e,t){let n=lS(e),r=n.length;if(r===0)return;let i=Vy(Mv(e)),a=n.indexOf(i);return n[a===-1?t===1?0:r-1:a+t]}function dS(e){return uS(Mv(e).body,1)||e}function fS(e){return uS(Mv(e).body,-1)||e}function pS(e,t,n){if(!e)return null;let r=[];aS(Mv(e).body,r);let i=r.indexOf(e);if(i===-1)return null;let a=r.filter($x);for(let e=1;e<r.length;e+=1){let o=r[(i+t*e+r.length)%r.length];if(!Hy(n,o)&&sS(o)&&rS(o,a))return o}return r[i]}function mS(e,t){let n=t||e.currentTarget,r=e.relatedTarget;return!r||!Hy(n,r)}function hS(e){lS(e).forEach(e=>{e.dataset.tabindex=e.getAttribute(`tabindex`)||``,e.setAttribute(`tabindex`,`-1`)})}function gS(e){let t=[];oS(e,`[data-tabindex]`,t),t.forEach(e=>{let t=e.dataset.tabindex;delete e.dataset.tabindex,t?e.setAttribute(`tabindex`,t):e.removeAttribute(`tabindex`)})}function _S(e,t,n=!0){return e.filter(e=>e.parentId===t).flatMap(t=>[...!n||t.context?.open?[t]:[],..._S(e,t.id,n)])}function vS(e,t){let n=[],r=e.find(e=>e.id===t)?.parentId;for(;r;){let t=e.find(e=>e.id===r);r=t?.parentId,t&&(n=n.concat(t))}return n}function yS(e){return`data-base-ui-${e}`}var bS=0;function xS(e,t={}){let{preventScroll:n=!1,sync:r=!1,shouldFocus:i}=t;cancelAnimationFrame(bS);function a(){(!i||i())&&e?.focus({preventScroll:n})}if(r)return a(),Kv;let o=requestAnimationFrame(a);return bS=o,()=>{bS===o&&(cancelAnimationFrame(o),bS=0)}}var SS=`data-base-ui-inert`,CS=new WeakMap,wS=new WeakSet,TS=new WeakMap,ES=0;function DS(e){return e?V_(e)?e.host:DS(e.parentNode):null}var OS=(e,t)=>t.map(t=>{if(e.contains(t))return t;let n=DS(t);return e.contains(n)?n:null}).filter(e=>e!=null),kS=e=>{let t=new Set;return e.forEach(e=>{let n=e;for(;n&&!t.has(n);)t.add(n),n=n.parentNode}),t},AS=(e,t,n)=>{let r=[],i=e=>{e&&!n.has(e)&&Array.from(e.children).forEach(e=>{F_(e)!==`script`&&(t.has(e)?i(e):r.push(e))})};return i(e),r};function jS(e,t,n,{mark:r=!0}){let i=OS(t,e),a=r?AS(t,kS(i),new Set(i)):[],o=[],s=[];if(n){let e=OS(t,Array.from(t.querySelectorAll(`[aria-live]`))),n=i.concat(e);AS(t,kS(n),new Set(n)).forEach(e=>{let t=e.getAttribute(`aria-hidden`),n=t!==null&&t!==`false`,r=(CS.get(e)||0)+1;CS.set(e,r),o.push(e),r===1&&n&&wS.add(e),n||e.setAttribute(`aria-hidden`,`true`)})}return r&&a.forEach(e=>{let t=(TS.get(e)||0)+1;TS.set(e,t),s.push(e),t===1&&e.setAttribute(SS,``)}),ES+=1,()=>{o.forEach(e=>{let t=(CS.get(e)||0)-1;CS.set(e,t),t||(wS.has(e)||e.removeAttribute(`aria-hidden`),wS.delete(e))}),r&&s.forEach(e=>{let t=(TS.get(e)||0)-1;TS.set(e,t),t||e.removeAttribute(SS)}),--ES,ES||(CS=new WeakMap,wS=new WeakSet,TS=new WeakMap)}}function MS(e,t={}){let{ariaHidden:n=!1,mark:r=!0}=t,i=Mv(e[0]).body;return jS(e,i,n,{mark:r})}function NS(){let[,e]=q.useState({});return q.useCallback(()=>{e({})},[])}var PS=0;function FS(e,t=`mui`){let n=q.useRef(void 0),r=NS(),i=e??n.current;return q.useEffect(()=>{n.current??(PS+=1,n.current=`${t}-${PS}`,e??r())},[e,t,r]),i}var IS=av.useId;function LS(e,t){if(IS!==void 0){let n=IS();return e??(t?`${t}-${n}`:n)}return FS(e,t)}var RS={style:{transition:`none`}},zS=`data-base-ui-click-trigger`,BS={fallbackAxisSide:`none`},VS={fallbackAxisSide:`end`},HS={clipPath:`inset(50%)`,position:`fixed`,top:0,left:0},US=l(h(),1),WS=q.createContext(null),GS=()=>q.useContext(WS),KS=yS(`portal`);function qS(e={}){let{ref:t,container:n,componentProps:r=Jv,elementProps:i}=e,a=LS(),o=GS()?.portalNode,[s,c]=q.useState(null),[l,u]=q.useState(null),d=Z(e=>{e!==null&&u(e)}),f=q.useRef(null);Q(()=>{if(n===null){f.current&&(f.current=null,u(null),c(null));return}let e=(n&&(R_(n)?n:n.current))??o??document.body;e==null?f.current&&(f.current=null,u(null),c(null)):f.current!==e&&(f.current=e,u(null),c(e))},[n,o]);let p=Qv(`div`,r,{ref:[t,d],props:[{id:a,[KS]:``},i]}),m=s&&p?US.createPortal(p,s):null;return{node:l,nodeId:q.isValidElement(p)?p.props.id:void 0,subtree:m}}var JS=q.forwardRef(function(e,t){let{render:n,className:r,style:i,children:a,container:o,portalOwnerRole:s,...c}=e,{node:l,nodeId:u,subtree:d}=qS({container:o,ref:t,componentProps:e,elementProps:c}),f=q.useRef(null),p=q.useRef(null),m=q.useRef(null),h=q.useRef(null),[g,_]=q.useState(null),v=q.useRef(!1),y=g?.modal,b=g?.open,x=!!g&&!g.modal&&g.open&&!!l;q.useEffect(()=>{if(!l||y)return;function e(e){l&&e.relatedTarget&&mS(e)&&(e.type===`focusin`?v.current&&=(gS(l),!1):(hS(l),v.current=!0))}return nx(tx(l,`focusin`,e,!0),tx(l,`focusout`,e,!0))},[l,y]),Q(()=>{l&&b===!0&&v.current&&(gS(l),v.current=!1)},[b,l]);let S=q.useMemo(()=>({beforeOutsideRef:f,afterOutsideRef:p,beforeInsideRef:m,afterInsideRef:h,portalNode:l,setFocusManagerState:_}),[l]);return(0,J.jsxs)(q.Fragment,{children:[d,(0,J.jsxs)(WS.Provider,{value:S,children:[x&&l&&(0,J.jsx)(fx,{"data-type":`outside`,ref:f,onFocus:e=>{mS(e,l)?m.current?.focus():fS(g?g.domReference:null)?.focus()}}),x&&l&&(0,J.jsx)(`span`,{role:s,"aria-owns":u,style:HS}),l&&US.createPortal(a,l),x&&l&&(0,J.jsx)(fx,{"data-type":`outside`,ref:p,onFocus:e=>{mS(e,l)?h.current?.focus():(dS(g?g.domReference:null)?.focus(),g?.closeOnFocusOut&&g?.onOpenChange(!1,Ab(`focus-out`,e.nativeEvent)))}})]})]})});function YS(){let e=new Map;return{emit(t,n){e.get(t)?.forEach(e=>e(n))},on(t,n){e.has(t)||e.set(t,new Set),e.get(t).add(n)},off(t,n){e.get(t)?.delete(n)}}}var XS=class{nodesRef={current:[]};events=YS();addNode(e){this.nodesRef.current.push(e)}removeNode(e){let t=this.nodesRef.current.findIndex(t=>t===e);t!==-1&&this.nodesRef.current.splice(t,1)}},ZS=q.createContext(null),QS=q.createContext(null),$S=()=>q.useContext(ZS)?.id||null,eC=e=>{let t=q.useContext(QS);return e??t};function tC(e){let t=LS(),n=eC(e),r=$S();return Q(()=>{if(!t)return;let e={id:t,parentId:r};return n?.addNode(e),()=>{n?.removeNode(e)}},[n,t,r]),t}function nC(e){let{children:t,id:n}=e,r=$S();return(0,J.jsx)(ZS.Provider,{value:q.useMemo(()=>({id:n,parentId:r}),[n,r]),children:t})}function rC(e){let{children:t,externalTree:n}=e,r=sv(()=>n??new XS).current;return(0,J.jsx)(QS.Provider,{value:r,children:t})}function iC(e){return e==null?e:`current`in e?e.current:e}function aC(e,t){let n=I_(Wy(e));return e instanceof n.KeyboardEvent?`keyboard`:e instanceof n.FocusEvent?t||`keyboard`:`pointerType`in e?e.pointerType||(Ly(e)?`keyboard`:t||`mouse`):`touches`in e?`touch`:e instanceof n.MouseEvent?t||(e.detail===0?`keyboard`:`mouse`):``}var oC=20,sC=[];function cC(){sC=sC.filter(e=>e.deref()?.isConnected)}function lC(e){cC(),e&&F_(e)!==`body`&&(sC.push(new WeakRef(e)),sC.length>oC&&(sC=sC.slice(-20)))}function uC(){return cC(),sC[sC.length-1]?.deref()}function dC(e){return e?sS(e)?e:lS(e)[0]||e:null}function fC(e){if(e.hasAttribute(`tabindex`)&&!e.hasAttribute(`data-tabindex`)||!e.getAttribute(`role`)?.includes(`dialog`))return;let t=cS(e).filter(e=>{let t=e.getAttribute(`data-tabindex`)||``;return sS(e)||e.hasAttribute(`data-tabindex`)&&!t.startsWith(`-`)}),n=e.getAttribute(`tabindex`);t.length===0?n!==`0`&&(e.setAttribute(`tabindex`,`0`),e.setAttribute(`data-tabindex`,`0`)):(n!==`-1`||e.hasAttribute(`data-tabindex`)&&e.getAttribute(`data-tabindex`)!==`-1`)&&(e.setAttribute(`tabindex`,`-1`),e.setAttribute(`data-tabindex`,`-1`))}function pC(e){let{context:t,children:n,disabled:r=!1,initialFocus:i=!0,returnFocus:a=!0,explicitReturnFocus:o,restoreFocus:s=!1,modal:c=!0,closeOnFocusOut:l=!0,openInteractionType:u=``,nextFocusableElement:d,previousFocusableElement:f,beforeContentFocusGuardRef:p,externalTree:m,getInsideElements:h}=e,g=t.useState(`open`),_=t.useState(`domReferenceElement`),v=t.useState(`floatingElement`),{events:y,dataRef:b}=t.context,x=Z(()=>b.current.floatingContext?.nodeId),S=i===!1,C=Sb(_)&&S,w=rx(i),T=rx(a),E=rx(o),D=rx(u),O=rx(g),k=eC(m),A=GS(),j=q.useRef(!1),M=q.useRef(!1),N=q.useRef(!1),P=q.useRef(null),F=q.useRef(``),I=q.useRef(``),L=q.useRef(null),R=q.useRef(null),ee=Lv(L,p,A?.beforeInsideRef),z=Lv(R,A?.afterInsideRef),te=by(),B=by(),ne=cx(),V=A!=null,H=wb(v),re=Z((e=H)=>e?lS(e):[]),ie=Z(()=>h?.().filter(e=>e!=null)??[]);q.useEffect(()=>{if(r||!c)return;function e(e){e.key===`Tab`&&Hy(H,Vy(Mv(H)))&&re().length===0&&!C&&Fy(e)}return tx(Mv(H),`keydown`,e)},[r,H,c,C,re]),q.useEffect(()=>{if(r||!g)return;let e=Mv(H);function t(){N.current=!1}function n(e){let t=Wy(e),n=ie(),r=Hy(v,t)||Hy(_,t)||Hy(A?.portalNode,t)||n.some(e=>e===t||Hy(e,t));N.current=!r,I.current=e.pointerType||`keyboard`,Uy(t,`[data-base-ui-click-trigger]`)&&(M.current=!0,B.start(0,()=>{M.current=!1}))}function i(){I.current=`keyboard`}return nx(tx(e,`pointerdown`,n,!0),tx(e,`pointerup`,t,!0),tx(e,`pointercancel`,t,!0),tx(e,`keydown`,i,!0),t)},[r,v,_,H,g,A,B,ie]),q.useEffect(()=>{if(r||!l)return;let e=Mv(H);function n(){M.current=!0,B.start(0,()=>{M.current=!1})}function i(e){let t=Wy(e);sS(t)&&(P.current=t)}function a(n){let r=n.relatedTarget,i=n.currentTarget,a=Wy(n);c&&r==null&&a!=null&&Hy(v,a)&&lC(a),queueMicrotask(()=>{let o=x(),l=t.context.triggerElements,u=ie(),p=r?.hasAttribute(yS(`focus-guard`))&&[L.current,R.current,A?.beforeInsideRef.current,A?.afterInsideRef.current,A?.beforeOutsideRef.current,A?.afterOutsideRef.current,iC(f),iC(d)].includes(r),m=!(Hy(_,r)||Hy(v,r)||Hy(r,v)||Hy(A?.portalNode,r)||u.some(e=>e===r||Hy(e,r))||l.hasMatchingElement(e=>Hy(e,r))||p||k&&(_S(k.nodesRef.current,o).find(e=>Hy(e.context?.elements.floating,r)||Hy(e.context?.elements.domReference,r))||vS(k.nodesRef.current,o).find(e=>[e.context?.elements.floating,wb(e.context?.elements.floating)].includes(r)||e.context?.elements.domReference===r)));if(i===_&&H&&fC(H),s&&i!==_&&!qx(a)&&Vy(e)===e.body){if(B_(H)&&(H.focus(),s===`popup`)){ne.request(()=>{H.focus()});return}let e=re(),t=P.current,n=(t&&e.includes(t)?t:null)||e[e.length-1]||H;B_(n)&&n.focus()}b.current.insideReactTree?b.current.insideReactTree=!1:(C||!c)&&r&&m&&!M.current&&(C||r!==uC())&&(j.current=!0,t.setOpen(!1,Ab(zb,n)))})}function o(){N.current||(b.current.insideReactTree=!0,te.start(0,()=>{b.current.insideReactTree=!1}))}let u=B_(_)?_:null;if(v||u)return nx(u&&tx(u,`focusout`,a),u&&tx(u,`pointerdown`,n),v&&tx(v,`focusin`,i),v&&tx(v,`focusout`,a),v&&A&&tx(v,`focusout`,o,!0))},[r,_,v,H,c,k,A,t,l,s,re,C,x,b,te,B,ne,d,f,ie]),q.useEffect(()=>{if(r||!v||!g)return;let e=Array.from(A?.portalNode?.querySelectorAll(`[${yS(`portal`)}]`)||[]),t=(k?vS(k.nodesRef.current,x()):[]).find(e=>Sb(e.context?.elements.domReference||null))?.context?.elements.domReference,n=MS([v,...e,L.current,R.current,A?.beforeOutsideRef.current,A?.afterOutsideRef.current,...ie(),t,iC(f),iC(d),C?_:null].filter(e=>e!=null),{ariaHidden:c||C,mark:!1}),i=MS([v,...e].filter(e=>e!=null));return()=>{i(),n()}},[g,r,_,v,c,A,C,k,x,d,f,ie]),Q(()=>{if(!g||r||!B_(H))return;F.current=``,I.current=``;let e=Mv(H),t=Vy(e);queueMicrotask(()=>{let n=w.current,r=typeof n==`function`?n(D.current||``):n;if(r===void 0||r===!1||Hy(H,t))return;let i=null,a=()=>(i??=re(H),i[0]||H),o;o=r===!0||r===null?a():iC(r),o||=a();let s=Hy(H,Vy(e)),c=b.current.openEvent,l=c?.type===`mousedown`&&Ly(c);xS(o,{sync:l,preventScroll:o===H,shouldFocus(){if(!O.current)return!1;if(s)return!0;let t=Vy(e);return!(t!==o&&Hy(H,t))}})})},[r,g,H,re,w,D,O,b]);let ae=q.useRef(null);Q(()=>{if(r||!H){ae.current=null;return}ae.current&&=(ae.current.cancelled=!0,null);let e=Mv(H),t=Vy(e),n=D.current==null;lC(t);function i(e){if(e.open||(F.current=aC(e.nativeEvent,I.current)),(e.reason===`focus-out`&&e.triggerElement?.hasAttribute(yS(`focus-guard`))||e.reason===`trigger-hover`&&e.nativeEvent.type===`mouseleave`)&&(j.current=!0),e.reason===`outside-press`){if(e.nested)j.current=!1;else if(Ly(e.nativeEvent)||Ry(e.nativeEvent))j.current=!1;else{let e=!1;Mv(H).createElement(`div`).focus({get preventScroll(){return e=!0,!1}}),e?j.current=!1:j.current=!0}}}y.on(`openchange`,i);function a(e){let r=T.current,i=typeof r==`function`?r(e):r;if(i===void 0||i===!1)return null;i===null&&(i=!0);let a=_?.isConnected?_:null,o=t?.isConnected&&F_(t)!==`body`?t:null,s=n?o||a:a||o;return s||=uC()||null,typeof i==`boolean`?s:iC(i)||s||null}return()=>{y.off(`openchange`,i);let t=Vy(e),n=ie(),r=Hy(v,t)||n.some(e=>e===t||Hy(e,t))||k&&_S(k.nodesRef.current,x(),!1).some(e=>Hy(e.context?.elements.floating,t)),o=T.current,s=F.current,c=a(s),l={cancelled:!1};ae.current=l,queueMicrotask(()=>{ae.current===l&&(ae.current=null);let n=dC(c),i=E.current??typeof o!=`boolean`;if(!l.cancelled&&o&&!j.current&&B_(n)&&(i||n===t||t===e.body||r)){let e={preventScroll:!0};s===`keyboard`&&(e.focusVisible=!0),n.focus(e)}j.current=!1})}},[r,v,H,T,E,D,y,k,_,x,ie]),Q(()=>{if(!My||g||!v)return;let e=Vy(Mv(v));B_(e)&&bb(e)&&Hy(v,e)&&e.blur()},[g,v]),Q(()=>{if(!r&&A)return A.setFocusManagerState({modal:c,closeOnFocusOut:l,open:g,onOpenChange:t.setOpen,domReference:_}),()=>{A.setFocusManagerState(null)}},[r,A,c,g,t,l,_]),Q(()=>{if(!r&&H)return fC(H),()=>{queueMicrotask(cC)}},[r,H]);let oe=!r&&(!c||!C)&&(V||c);return(0,J.jsxs)(q.Fragment,{children:[oe&&(0,J.jsx)(fx,{"data-type":`inside`,ref:ee,onFocus:e=>{if(c){let e=re();xS(e[e.length-1])}else A?.portalNode&&(j.current=!1,mS(e,A.portalNode)?dS(_)?.focus():iC(f??A.beforeOutsideRef)?.focus())}}),n,oe&&(0,J.jsx)(fx,{"data-type":`inside`,ref:z,onFocus:e=>{c?xS(re()[0]):A?.portalNode&&(l&&(j.current=!0),mS(e,A.portalNode)?fS(_)?.focus():iC(d??A.afterOutsideRef)?.focus())}})]})}function mC(e,t={}){let{enabled:n=!0,event:r=`click`,toggle:i=!0,ignoreMouse:a=!1,stickIfOpen:o=!0,touchOpenDelay:s=0,reason:c=Nb}=t,l=e.context.dataRef,u=q.useRef(void 0),d=cx(),f=by(),p=q.useMemo(()=>{function t(t,n,r,i){let a=Ab(c,n,r);t&&i===`touch`&&s>0?f.start(s,()=>{e.setOpen(!0,a)}):e.setOpen(t,a)}function n(t,n,r){let a=l.current.openEvent,s=e.select(`domReferenceElement`)!==n;return t&&s||!t||!i?!0:a&&(typeof o==`function`?o():o)?!r(a.type):!1}return{onPointerDown(e){u.current=zy(e.pointerType,!0)&&Ry(e.nativeEvent)?`virtual`:e.pointerType},onMouseDown(i){let o=u.current,s=i.nativeEvent,c=e.select(`open`);if(i.button!==0||r===`click`||zy(o,!0)&&a)return;let l=n(c,i.currentTarget,e=>e===`click`||e===`mousedown`),f=Wy(s),p=bb(f);if(p||o===`virtual`){t(l,s,p?f:i.currentTarget,o);return}let m=i.currentTarget;d.request(()=>{t(l,s,m,o)})},onClick(i){if(r===`mousedown-only`)return;let o=u.current;r===`mousedown`&&o?u.current=void 0:zy(o,!0)&&a||t(n(e.select(`open`),i.currentTarget,e=>e===`click`||e===`mousedown`||e===`keydown`||e===`keyup`),i.nativeEvent,i.currentTarget,o)},onKeyDown(){u.current=void 0}}},[l,r,a,c,e,o,i,d,f,s]);return q.useMemo(()=>n?{reference:p}:Jv,[n,p])}function hC(e,t){let n=null,r=null,i=!1;return{contextElement:e||void 0,getBoundingClientRect(){let a=e?.getBoundingClientRect()||{width:0,height:0,x:0,y:0},o=t.axis===`x`||t.axis===`both`,s=t.axis===`y`||t.axis===`both`,c=[`mouseenter`,`mousemove`].includes(t.dataRef.current.openEvent?.type||``)&&t.pointerType!==`touch`,l=t.axis===`y`?a.width:0,u=t.axis===`x`?a.height:0,d=a.x,f=a.y;return n==null&&t.x&&o&&(n=a.x-t.x),r==null&&t.y&&s&&(r=a.y-t.y),d-=n||0,f-=r||0,(!i||c)&&(d=o&&t.x!=null?t.x:d,f=s&&t.y!=null?t.y:f),i=!0,{width:l,height:u,x:d,y:f,top:f,right:d+l,bottom:f+u,left:d}}}}function gC(e){return e!=null&&e.clientX!=null}function _C(e,t={}){let{enabled:n=!0,axis:r=`both`}=t,i=e.useState(`open`),a=e.useState(`floatingElement`),o=e.useState(`domReferenceElement`),s=e.context.dataRef,c=q.useRef(!1),l=q.useRef(null),[u,d]=q.useState(),[f,p]=q.useState([]),m=Z(t=>{e.set(`positionReference`,t)}),h=Z((t,n,i)=>{c.current||(!s.current.openEvent||gC(s.current.openEvent))&&e.set(`positionReference`,hC(i??o,{x:t,y:n,axis:r,dataRef:s,pointerType:u}))}),g=Z(e=>{i?l.current||(h(e.clientX,e.clientY,e.currentTarget),p([])):h(e.clientX,e.clientY,e.currentTarget)}),_=zy(u)?a:i;q.useEffect(()=>{if(!n){m(o);return}if(!_)return;function e(){l.current?.(),l.current=null}let t=I_(a);function r(t){let n=Wy(t);Hy(a,n)?e():h(t.clientX,t.clientY)}return!s.current.openEvent||gC(s.current.openEvent)?l.current=tx(t,`mousemove`,r):m(o),e},[_,n,a,s,o,e,h,m,f]),q.useEffect(()=>()=>{e.set(`positionReference`,null)},[e]),q.useEffect(()=>{n&&!a&&(c.current=!1)},[n,a]),q.useEffect(()=>{!n&&i&&(c.current=!0)},[n,i]);let v=q.useMemo(()=>{function e(e){d(e.pointerType)}return{onPointerDown:e,onPointerEnter:e,onMouseMove:g,onMouseEnter:g}},[g]);return q.useMemo(()=>n?{reference:v,trigger:v}:{},[n,v])}function vC(){return!1}function yC(e){return{escapeKey:typeof e==`boolean`?e:e?.escapeKey??!1,outsidePress:typeof e==`boolean`?e:e?.outsidePress??!0}}function bC(e,t={}){let{enabled:n=!0,escapeKey:r=!0,outsidePress:i=!0,outsidePressEvent:a=`sloppy`,referencePress:o=vC,bubbles:s,externalTree:c}=t,l=e.useState(`open`),u=e.useState(`floatingElement`),{dataRef:d,events:f}=e.context,p=eC(c),m=Z(typeof i==`function`?i:()=>!1),h=typeof i==`function`?m:i,g=h!==!1,_=Z(()=>a),{escapeKey:v,outsidePress:y}=yC(s),b=q.useRef(!1),x=q.useRef(!1),S=q.useRef(!1),C=q.useRef(!1),w=q.useRef(!1),T=q.useRef(``),E=q.useRef(null),D=by(),O=by(),k=by(),A=Z(()=>{O.clear(),d.current.insideReactTree=!1}),j=Z(e=>{let t=d.current.floatingContext?.nodeId;return(p?_S(p.nodesRef.current,t):[]).some(t=>t.context?.open&&!t.context.dataRef.current[e])}),M=Z(t=>vb(t,e.select(`floatingElement`))||vb(t,e.select(`domReferenceElement`))),N=Z(t=>{o()&&e.setOpen(!1,Ab(Nb,t.nativeEvent))}),P=Z(t=>{if(!l||!n||!r||t.key!==`Escape`)return;let i=Iy(t)?t.nativeEvent:t;if(w.current||i.isComposing||!v&&j(`__escapeKeyBubbles`))return;let a=Ab(Bb,i);e.setOpen(!1,a),a.isCanceled||t.preventDefault(),!v&&!a.isPropagationAllowed&&t.stopPropagation()}),F=Z(()=>{d.current.insideReactTree=!0,O.start(0,A)}),I=Z(t=>{if(!l||!n||t.button!==0)return;let r=Wy(t.nativeEvent);Hy(e.select(`floatingElement`),r)&&(b.current||(b.current=!0,x.current=!1))}),L=Z(e=>{l&&n&&(e.defaultPrevented||e.nativeEvent.defaultPrevented)&&b.current&&(x.current=!0)});q.useEffect(()=>{function e(e){e.open||(C.current=!1)}return f.on(`openchange`,e),()=>{f.off(`openchange`,e)}},[f]),q.useEffect(()=>A,[A]),q.useEffect(()=>{if(!l||!n)return l||(C.current=!1,w.current=!1,T.current=``,E.current=null),A;d.current.__escapeKeyBubbles=v,d.current.__outsidePressBubbles=y;let t=new yy,i=Mv(u);function a(){k.clear(),w.current=!0}function o(){w.current=!0,k.start(My?5:0,()=>{w.current=!1})}function s(){S.current=!0,t.start(0,()=>{S.current=!1})}function c(){b.current=!1,x.current=!1}function f(){let e=T.current,t=e===`pen`||!e?`mouse`:e,n=_(),r=typeof n==`function`?n():n;return typeof r==`string`?r:r[t]}function m(e){let t=f();return t===`intentional`&&e.type!==`click`||t===`sloppy`&&e.type===`click`}function O(e){let t=d.current.floatingContext?.nodeId,n=p&&_S(p.nodesRef.current,t).some(t=>vb(e,t.context?.elements.floating));return M(e)||n}function N(n){if(m(n)){n.type!==`click`&&!M(n)&&(t.clear(),S.current=!1),A();return}if(d.current.insideReactTree){A();return}let r=Wy(n),i=`[${yS(`inert`)}]`,a=z_(r)?r.getRootNode():null,o=Array.from((V_(a)?a:Mv(e.select(`floatingElement`))).querySelectorAll(i)),s=e.context.triggerElements;if(r&&(s.hasElement(r)||s.hasMatchingElement(e=>Hy(e,r))))return;let c=z_(r)?r:null;for(;c&&!Q_(c);){let e=tv(c);if(Q_(e)||!z_(e))break;c=e}if(!(o.length&&z_(r)&&!yb(r)&&!Hy(r,e.select(`floatingElement`))&&o.every(e=>!Hy(c,e)))){if(B_(r)&&!(`touches`in n)){let e=Q_(r),t=$_(r),i=/auto|scroll/,a=e||i.test(t.overflowX),o=e||i.test(t.overflowY),s=a&&r.clientWidth>0&&r.scrollWidth>r.clientWidth,c=o&&r.clientHeight>0&&r.scrollHeight>r.clientHeight,l=t.direction===`rtl`,u=c&&(l?n.offsetX<=r.offsetWidth-r.clientWidth:n.offsetX>r.clientWidth),d=s&&n.offsetY>r.clientHeight;if(u||d)return}if(!O(n)){if(f()===`intentional`){if(n.detail!==0&&!Ly(n)&&!C.current)return;if(S.current){t.clear(),S.current=!1;return}}(typeof h!=`function`||h(n))&&(j(`__outsidePressBubbles`)||(e.setOpen(!1,Ab(Ib,n)),A()))}}}function F(t){f()===`sloppy`&&t.pointerType!==`touch`&&e.select(`open`)&&n&&!M(t)&&N(t)}function I(t){if(f()!==`sloppy`||!e.select(`open`)||!n||M(t))return;let r=t.touches[0];r&&(E.current={startTime:Date.now(),startX:r.clientX,startY:r.clientY,dismissOnTouchEnd:!1,dismissOnMouseDown:!0},D.start(1e3,()=>{E.current&&(E.current.dismissOnTouchEnd=!1,E.current.dismissOnMouseDown=!1)}))}function L(e,t){let n=Wy(e);if(!n)return;let r=tx(n,e.type,()=>{t(e),r()})}function R(e){T.current=`touch`,L(e,I)}function ee(e){D.clear(),e.type===`pointerdown`&&(e.button===0&&(C.current=!0),T.current=e.pointerType),(e.type!==`mousedown`||!E.current||E.current.dismissOnMouseDown)&&L(e,e=>{e.type===`pointerdown`?F(e):N(e)})}function z(e){if(e.type===`pointercancel`&&(C.current=!1),!b.current)return;let n=x.current;c(),f()===`intentional`&&(e.type===`pointercancel`?n&&s():O(e)||(n?s():(typeof h!=`function`||h(e))&&(t.clear(),S.current=!0,A())))}function te(e){if(f()!==`sloppy`||!E.current||M(e))return;let t=e.touches[0];if(!t)return;let n=Math.abs(t.clientX-E.current.startX),r=Math.abs(t.clientY-E.current.startY),i=Math.sqrt(n*n+r*r);i>5&&(E.current.dismissOnTouchEnd=!0),i>10&&(N(e),D.clear(),E.current=null)}function B(e){L(e,te)}function ne(e){f()===`sloppy`&&E.current&&!M(e)&&(E.current.dismissOnTouchEnd&&N(e),D.clear(),E.current=null)}function V(e){L(e,ne)}let H=nx(r&&nx(tx(i,`keydown`,P),tx(i,`compositionstart`,a),tx(i,`compositionend`,o)),g&&nx(tx(i,`click`,ee,!0),tx(i,`pointerdown`,ee,!0),tx(i,`pointerup`,z,!0),tx(i,`pointercancel`,z,!0),tx(i,`mousedown`,ee,!0),tx(i,`mouseup`,z,!0),tx(i,`touchstart`,R,{capture:!0,passive:!0}),tx(i,`touchmove`,B,{capture:!0,passive:!0}),tx(i,`touchend`,V,{capture:!0,passive:!0})));return()=>{H(),t.clear(),c(),S.current=!1}},[d,u,r,g,h,l,n,v,y,P,A,_,j,M,p,e,D,k]);let R=q.useMemo(()=>({onKeyDown:P,onPointerDown:N,onClick:N}),[P,N]),ee=q.useMemo(()=>({onKeyDown:P,onPointerDown:L,onMouseDown:L,onClickCapture:F,onMouseDownCapture(e){F(),I(e)},onPointerDownCapture(e){F(),I(e)},onMouseUpCapture:F,onTouchEndCapture:F,onTouchMoveCapture:F}),[P,F,I,L]);return q.useMemo(()=>n?{reference:R,floating:ee,trigger:R}:{},[n,R,ee])}function xC(e,t,n,r){return{left:e,top:t,right:n,bottom:r,x:e,y:t,width:n-e,height:r-t}}function SC(e){return{left:e.left,top:e.top,right:e.right,bottom:e.bottom,width:e.width,height:e.height}}function CC(e){let t=[],n,r=1/0,i=1/0,a=-1/0,o=-1/0;for(let s of Array.from(e).sort((e,t)=>e.top-t.top)){if(r=Math.min(r,s.left),i=Math.min(i,s.top),a=Math.max(a,s.right),o=Math.max(o,s.bottom),!n||s.top-n.top>n.height/2)t.push(SC(s));else{let e=t[t.length-1];e.left=Math.min(e.left,s.left),e.right=Math.max(e.right,s.right),e.bottom=Math.max(e.bottom,s.bottom),e.width=e.right-e.left,e.height=e.bottom-e.top}n=s}return{lines:t,fallback:xC(r,i,a,o)}}function wC(e,t,n){return e.findIndex(e=>t>e.left-2&&t<e.right+2&&n>e.top-2&&n<e.bottom+2)}function TC(e){return xC(e.left,e.top,e.right,e.bottom)}function EC(e,t,n){let{lines:r}=CC(e.getClientRects());if(r.length<2)return;let i=wC(r,t,n);return{x:t,y:n,lineIndex:i===-1?void 0:i,element:e}}function DC(e,t,n){let{lines:r,fallback:i}=CC(e.getClientRects());if(r.length<2)return null;let a=n?.x,o=n?.y,s=t[0];if(n?.lineIndex!=null&&r[n.lineIndex])return TC(r[n.lineIndex]);if(a!=null&&o!=null){let e=wC(r,a,o);if(e!==-1)return TC(r[e])}if(r.length===2&&r[0].left>r[1].right&&a!=null&&o!=null)return i;if(s===`t`||s===`b`){let e=r[0],t=r[r.length-1],n=s===`t`?e:t;return xC(n.left,e.top,n.right,t.bottom)}let c=s===`l`,l=r[0].left,u=r[0].right,d=c?1/0:-1/0,f=r[0],p=r[0];for(let e of r){l=Math.min(l,e.left),u=Math.max(u,e.right);let t=c?e.left:e.right;c&&t<d||!c&&t>d?(d=t,f=e,p=e):t===d&&(p=e)}return xC(l,f.top,u,p.bottom)}function OC(e){return`contextElement`in e&&e.contextElement?e.contextElement:z_(e)?e:void 0}function kC(e,t){function n(t){AC(e,t.currentTarget,t.clientX,t.clientY)}function r(e){t||n(e)}return{onFocus(){e.current=void 0},onMouseEnter:r,onMouseMove:r}}function AC(e,t,n,r){let i=EC(t,n,r);return e.current=i,i}function jC(e){return{name:`inline`,async fn(t){let n=t.elements.reference;if(typeof n?.getClientRects!=`function`)return{};let r=OC(n),i=e.current,a=i?.element===n||i?.element===r?i:void 0,o=DC(n,t.placement,a);if(!o||typeof t.platform.getElementRects!=`function`)return{};let s=await t.platform.getElementRects({reference:{contextElement:r,getBoundingClientRect(){return o}},floating:t.elements.floating,strategy:t.strategy});return t.rects.reference.x===s.reference.x&&t.rects.reference.y===s.reference.y&&t.rects.reference.width===s.reference.width&&t.rects.reference.height===s.reference.height?{}:{reset:{rects:s}}}}}var MC=class{attachedStores=[];attachedStoreValue=null;storeListeners=new Set;constructor(e,t,n=!0){this.fallbackStore=e,this.componentName=t,this.throwOnMissingTrigger=n}get attachedStore(){return this.attachedStoreValue}get store(){return this.attachedStoreValue??this.fallbackStore}get serverStore(){return this.fallbackStore}subscribeStore(e){return this.storeListeners.add(e),()=>{this.storeListeners.delete(e)}}attachStore(e){return this.attachedStores.push(e),this.setActiveStore(e),()=>{let t=this.attachedStores.lastIndexOf(e);t!==-1&&this.attachedStores.splice(t,1),this.setActiveStore(this.attachedStores[this.attachedStores.length-1]??null)}}setActiveStore(e){this.attachedStoreValue!==e&&(this.attachedStoreValue=e,this.storeListeners.forEach(e=>{e()}))}openByTrigger(e){let t=this.attachedStore;if(t===null)return;let n;if(e){for(let t=this.attachedStores.length-1;t>=0&&!n;--t)n=this.attachedStores[t].context.triggerElements.getById(e);n??=this.fallbackStore.context.triggerElements.getById(e)}if(e&&!n&&this.throwOnMissingTrigger)throw Error(Ov(99,this.componentName,e,this.componentName));t.setOpen(!0,Ab(Yb,void 0,n))}closePopup(){let e=this.attachedStore;e!==null&&e.setOpen(!1,Ab(Yb))}};function NC(e){let{popupStore:t,treatPopupAsFloatingElement:n=!1,floatingRootContext:r,floatingId:i,nested:a,onOpenChange:o}=e,s=t.useState(`open`),c=t.useState(`activeTriggerElement`),l=t.useState(n?`popupElement`:`positionerElement`),u=o;return t.useSyncedValue(`floatingId`,i),Q(()=>{let e={open:s,floatingId:i,referenceElement:c,floatingElement:l};z_(c)&&(e.domReferenceElement=c),r.state.positionReference===r.state.referenceElement&&(e.positionReference=c),r.update(e)},[s,i,c,l,r]),r.context.onOpenChange=u,r.context.nested=a,r}function PC(e,t=!1,n=!1,r=!1){let[i,a]=q.useState(e&&t?`idle`:void 0),[o,s]=q.useState(e&&!r);return e&&!o&&(s(!0),a(`starting`)),!e&&o&&i!==`ending`&&!n&&a(`ending`),!e&&!o&&i===`ending`&&a(void 0),Q(()=>{if(!e&&o&&i!==`ending`&&n){let e=sx.request(()=>{a(`ending`)});return()=>{sx.cancel(e)}}},[e,o,i,n]),Q(()=>{if(!e||t||i===void 0)return;let n=sx.request(()=>{a(void 0)});return()=>{sx.cancel(n)}},[t,e,i]),Q(()=>{if(!e||!t)return;e&&o&&i!==`idle`&&a(`starting`);let n=sx.request(()=>{a(`idle`)});return()=>{sx.cancel(n)}},[t,e,o,i]),{mounted:o,setMounted:s,transitionStatus:i}}function FC(e,t){return e.getAnimations(t).filter(e=>{let t=e.effect?.getTiming();return t?.duration!==1/0&&t?.iterations!==1/0})}var IC=null;function LC(e){if(!IC){let e=[];IC=e,queueMicrotask(()=>{IC=null,US.flushSync(()=>{for(let t of e)t()})})}IC.push(e)}function RC(e,t=!1,n=!1){let r=cx();return Z((i,a=null)=>{r.cancel();let o=iC(e);if(o==null)return;let s=o,c=()=>{n?LC(()=>{a?.aborted||i()}):US.flushSync(i)};if(typeof s.getAnimations!=`function`||globalThis.BASE_UI_ANIMATIONS_DISABLED){i();return}function l(){Promise.all(FC(s).map(e=>e.finished.then(Kv))).then(()=>{a?.aborted||c()},()=>{a?.aborted||(FC(s).some(e=>e.pending||e.playState!==`finished`)?l():c())})}if(t){let e=Zy;if(!s.hasAttribute(e)){r.request(l);return}let t=new MutationObserver(()=>{s.hasAttribute(e)||(t.disconnect(),l())});t.observe(s,{attributes:!0,attributeFilter:[e]}),a?.addEventListener(`abort`,()=>t.disconnect(),{once:!0})}else r.request(l)})}function zC(e){let{enabled:t=!0,open:n,ref:r,batch:i=!1,onComplete:a}=e,o=Z(a),s=RC(r,n,i);q.useEffect(()=>{if(!t)return;let e=new AbortController;return s(o,e.signal),()=>{e.abort()}},[t,n,o,s])}function BC(e){let{open:t,ref:n,preventUnmountOnClose:r,setPreventUnmountOnClose:i,onUnmount:a,animateInitialOpen:o}=e,s=Z(i),{mounted:c,setMounted:l,transitionStatus:u}=PC(t,!1,!1,o),d=!t&&r;Q(()=>{t&&s(!1)},[t,s]);let f=q.useRef(c),p=q.useRef(!1),m=NS(),h=()=>{f.current=!1,l(!1),a()};Q(()=>{f.current=c,p.current&&(p.current=!1,!t&&c&&h())});let g=Z(()=>{f.current&&(t?(p.current=!0,m()):h())});return zC({enabled:c&&!t&&!d,open:t,ref:n,onComplete(){t||g()}}),{mounted:c,transitionStatus:u,preventUnmountingOnClose:d,forceUnmount:g}}var VC={tabIndex:-1,[Gy]:``};function HC(e){return t=>t!==`touch`||e.current}function UC(e,t=!1){let n=LS(),r=$S()!=null,i=sv(()=>e(n,r)).current;return NC({popupStore:i,treatPopupAsFloatingElement:t,floatingRootContext:i.state.floatingRootContext,floatingId:n,nested:r,onOpenChange:i.setOpen}),i}function WC({handle:e,store:t}){return Q(()=>e.attachStore(t),[e,t]),null}function GC(e){let t=e.context.triggerElements.size;e.select(`open`)&&e.state.triggerCount!==t&&e.set(`triggerCount`,t)}function KC(e,t){let n=q.useRef(null);return Z(r=>{let i=n.current;if(i!==null){if(i.element===r&&i.store===t&&i.id===e)return;n.current=null;let a=i.store;a.context.triggerElements.getById(i.id)===i.element&&(a.context.triggerElements.delete(i.id),GC(a))}r!==null&&e!==void 0&&(n.current={store:t,id:e,element:r},t.context.triggerElements.add(e,r),GC(t))})}function qC(e,t,n,r=!1){let i=e.preventUnmountingOnClose;t?i=!1:r&&(i=!0);let a=n?.id??null,o=e.activeTriggerId,s=e.activeTriggerElement;return(a||t)&&(o=a,s=n??null),{open:t,preventUnmountingOnClose:i,activeTriggerId:o,activeTriggerElement:s,openedWithoutTrigger:t?n==null:e.openedWithoutTrigger}}function JC(e){let t=!1;return e.preventUnmountOnClose=()=>{t=!0},()=>t}function YC(e,t,n,r={}){let i=n.reason,a=i===Pb,o=t&&i===`trigger-focus`,s=!t&&(i===`trigger-press`||i===`escape-key`),c=JC(n);if(e.context.onOpenChange?.(t,n),n.isCanceled)return;r.onBeforeDispatch?.(),e.state.floatingRootContext.dispatchOpenChange(t,n);let l=()=>{let i=qC(e.state,t,n.trigger,c()),l={...r.extraState,...i};o?l.instantType=`focus`:s?l.instantType=`dismiss`:a&&(l.instantType=void 0),e.update(l)};a?US.flushSync(l):l()}function XC(e,t,n,r){let i=n.useState(`isMountedByTrigger`,e),a=KC(e,n),o=Z(t=>{let i=n.select(`open`),a=n.select(`activeTriggerId`);if(a===e){let e={activeTriggerElement:t,...i?r:null};n.update(e)}else if(a==null&&i&&!n.state.openedWithoutTrigger){let i={activeTriggerId:e??null,activeTriggerElement:t,...r};n.update(i)}}),s=Z(e=>{a(e),e&&o(e)});return Q(()=>(s(t.current),()=>s(null)),[s,t,n,e]),Q(()=>{if(i){let e={activeTriggerElement:t.current,...r};n.update(e)}},[i,n,t,...Object.values(r)]),{registerTrigger:s,isMountedByThisTrigger:i}}function ZC(e,t={}){let{closeOnActiveTriggerUnmount:n=!1}=t,r=q.useRef(null),i=e.useState(`open`);Q(()=>{if(!i){r.current=null,e.state.triggerCount!==0&&e.set(`triggerCount`,0),e.state.openedWithoutTrigger&&e.set(`openedWithoutTrigger`,!1);return}let t=e.context.triggerElements.size,a={};e.state.triggerCount!==t&&(a.triggerCount=t);let o=e.select(`activeTriggerId`),s=null;if(o){let t=e.context.triggerElements.getById(o);if(t)r.current=o,t!==e.state.activeTriggerElement&&(a.activeTriggerElement=t);else{for(let[t,n]of e.context.triggerElements.entries())if(n===e.state.activeTriggerElement){a.activeTriggerId=t,a.activeTriggerElement=n,r.current=t;break}a.activeTriggerId===void 0&&(r.current===o?s=o:r.current=null)}}else r.current=null;if(!s&&!o&&!e.state.openedWithoutTrigger&&t===1){let t=e.context.triggerElements.entries().next();if(!t.done){let[e,n]=t.value;a.activeTriggerId=e,a.activeTriggerElement=n,r.current=e}}(a.triggerCount!==void 0||a.activeTriggerId!==void 0||a.activeTriggerElement!==void 0)&&e.update(a),s&&n&&queueMicrotask(()=>{if(e.select(`open`)&&e.select(`activeTriggerId`)===s&&!e.context.triggerElements.getById(s)){let t=Ab(Mb);e.setOpen(!1,t),t.isCanceled||e.update({activeTriggerId:null,activeTriggerElement:null})}})},[i,e,e.useState(`triggerCount`),e.useState(`activeTriggerId`),e.useState(`activeTriggerElement`),n])}function QC(e,t,n,r){let{mounted:i,transitionStatus:a,forceUnmount:o}=BC({open:e,ref:t.context.popupRef,preventUnmountOnClose:t.useState(`preventUnmountingOnClose`),setPreventUnmountOnClose:e=>t.set(`preventUnmountingOnClose`,e),animateInitialOpen:r,onUnmount(){t.update({activeTriggerId:null,activeTriggerElement:null,mounted:!1,preventUnmountingOnClose:!1}),n?.(),t.context.onOpenChangeComplete?.(!1)}});return sv(()=>(t.set(`mounted`,i),null)),t.useSyncedValues({mounted:i,transitionStatus:a}),{forceUnmount:o,transitionStatus:a}}function $C(e,t){e.useSyncedValues(t),Q(()=>()=>{e.update({activeTriggerProps:Jv,inactiveTriggerProps:Jv,popupProps:Jv})},[e])}function ew(e,t){Q(()=>{!t&&e.state.openMethod!==null&&e.set(`openMethod`,null)},[t,e]),Q(()=>()=>{e.state.openMethod!==null&&e.set(`openMethod`,null)},[e])}var tw=class{idMap=new Map;add(e,t){this.idMap.set(e,t)}delete(e){this.idMap.delete(e)}hasElement(e){for(let t of this.idMap.values())if(t===e)return!0;return!1}hasMatchingElement(e){for(let t of this.idMap.values())if(e(t))return!0;return!1}getById(e){return this.idMap.get(e)}entries(){return this.idMap.entries()}elements(){return this.idMap.values()}get size(){return this.idMap.size}},nw=o((e=>{var t=d();function n(e,t){return e===t&&(e!==0||1/e==1/t)||e!==e&&t!==t}var r=typeof Object.is==`function`?Object.is:n,i=t.useState,a=t.useEffect,o=t.useLayoutEffect,s=t.useDebugValue;function c(e,t){var n=t(),r=i({inst:{value:n,getSnapshot:t}}),c=r[0].inst,u=r[1];return o(function(){c.value=n,c.getSnapshot=t,l(c)&&u({inst:c})},[e,n,t]),a(function(){return l(c)&&u({inst:c}),e(function(){l(c)&&u({inst:c})})},[e]),s(n),n}function l(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!r(e,n)}catch{return!0}}function u(e,t){return t()}var f=typeof window>`u`||window.document===void 0||window.document.createElement===void 0?u:c;e.useSyncExternalStore=t.useSyncExternalStore===void 0?f:t.useSyncExternalStore})),rw=o(((e,t)=>{t.exports=nw()})),iw=o((e=>{var t=d(),n=rw();function r(e,t){return e===t&&(e!==0||1/e==1/t)||e!==e&&t!==t}var i=typeof Object.is==`function`?Object.is:r,a=n.useSyncExternalStore,o=t.useRef,s=t.useEffect,c=t.useMemo,l=t.useDebugValue;e.useSyncExternalStoreWithSelector=function(e,t,n,r,u){var d=o(null);if(d.current===null){var f={hasValue:!1,value:null};d.current=f}else f=d.current;d=c(function(){function e(e){if(!a){if(a=!0,o=e,e=r(e),u!==void 0&&f.hasValue){var t=f.value;if(u(t,e))return s=t}return s=e}if(t=s,i(o,e))return t;var n=r(e);return u!==void 0&&u(t,n)?(o=e,t):(o=e,s=n)}var a=!1,o,s,c=n===void 0?null:n;return[function(){return e(t())},c===null?void 0:function(){return e(c())}]},[t,n,r,u]);var p=a(e,d[0],d[1]);return s(function(){f.hasValue=!0,f.value=p},[p]),l(p),p}})),aw=o(((e,t)=>{t.exports=iw()})),ow=rw(),sw=aw(),cw=Wv(19)?dw:fw;function lw(e,t,n,r,i){return cw(e,t,n,r,i)}function uw(e,t,n,r,i){let a=q.useCallback(()=>t(e.getSnapshot(),n,r,i),[e,t,n,r,i]);return(0,ow.useSyncExternalStore)(e.subscribe,a,a)}py({before(e){e.syncIndex=0,e.didInitialize||(e.syncTick=1,e.syncHooks=[],e.didChangeStore=!0,e.getSnapshot=()=>{let t=!1;for(let n=0;n<e.syncHooks.length;n+=1){let r=e.syncHooks[n],i=r.selector(r.store.state,r.a1,r.a2,r.a3);Object.is(r.value,i)||(t=!0,r.value=i)}return t&&(e.syncTick+=1),e.syncTick})},after(e){e.syncHooks.length>0&&(e.didChangeStore&&(e.didChangeStore=!1,e.subscribe=t=>{let n=new Set;for(let t of e.syncHooks)n.add(t.store);let r=[];for(let e of n)r.push(e.subscribe(t));return()=>{for(let e of r)e()}}),(0,ow.useSyncExternalStore)(e.subscribe,e.getSnapshot,e.getSnapshot))}});function dw(e,t,n,r,i){let a=fy();if(!a)return uw(e,t,n,r,i);let o=a.syncIndex;a.syncIndex+=1;let s;return a.didInitialize?(s=a.syncHooks[o],(s.store!==e||s.selector!==t||!Object.is(s.a1,n)||!Object.is(s.a2,r)||!Object.is(s.a3,i))&&(s.store!==e&&(a.didChangeStore=!0),s.store=e,s.selector=t,s.a1=n,s.a2=r,s.a3=i,s.value=t(e.getSnapshot(),n,r,i))):(s={store:e,selector:t,a1:n,a2:r,a3:i,value:t(e.getSnapshot(),n,r,i)},a.syncHooks.push(s)),s.value}function fw(e,t,n,r,i){return(0,sw.useSyncExternalStoreWithSelector)(e.subscribe,e.getSnapshot,e.getSnapshot,e=>t(e,n,r,i))}var pw=class{static create(e){return new this(e)}constructor(e){this.state=e,this.listeners=new Set,this.updateTick=0}subscribe=e=>(this.listeners.add(e),()=>{this.listeners.delete(e)});getSnapshot=()=>this.state;setState(e){if(this.state===e)return;this.state=e,this.updateTick+=1;let t=this.updateTick;for(let n of this.listeners){if(t!==this.updateTick)return;n(e)}}update(e){for(let t in e)if(!Object.is(this.state[t],e[t])){this.setState({...this.state,...e});return}}set(e,t){Object.is(this.state[e],t)||this.setState({...this.state,[e]:t})}notifyAll(){let e={...this.state};this.setState(e)}use(e,t,n,r){return lw(this,e,t,n,r)}},mw=class extends pw{constructor(e,t={},n){super(e),this.context=t,this.selectors=n}useSyncedValue(e,t){q.useDebugValue(e);let n=this;Q(()=>{n.state[e]!==t&&n.set(e,t)},[n,e,t])}useSyncedValueWithCleanup(e,t){let n=this;Q(()=>(n.state[e]!==t&&n.set(e,t),()=>{n.set(e,void 0)}),[n,e,t])}useSyncedValues(e){let t=this;Q(()=>{t.update(e)},[t,...Object.values(e)])}useControlledProp(e,t){q.useDebugValue(e);let n=this,r=t!==void 0;Q(()=>{r&&!Object.is(n.state[e],t)&&n.setState({...n.state,[e]:t})},[n,e,t,r])}select(e,t,n,r){let i=this.selectors[e];return i(this.state,t,n,r)}useState(e,t,n,r){return q.useDebugValue(e),lw(this,this.selectors[e],t,n,r)}useContextCallback(e,t){q.useDebugValue(e);let n=Z(t??Kv);this.context[e]=n}useStateSetter(e){let t=q.useRef(void 0);return t.current===void 0&&(t.current=t=>{this.set(e,t)}),t.current}observe(e,t){let n;n=typeof e==`function`?e:this.selectors[e];let r=n(this.state);return t(r,r,this),this.subscribe(e=>{let i=n(e);if(!Object.is(r,i)){let e=r;r=i,t(i,e,this)}})}},hw={open:e=>e.open,transitionStatus:e=>e.transitionStatus,domReferenceElement:e=>e.domReferenceElement,referenceElement:e=>e.positionReference??e.referenceElement,floatingElement:e=>e.floatingElement,floatingId:e=>e.floatingId},gw=class extends mw{constructor(e){let{syncOnly:t,nested:n,onOpenChange:r,triggerElements:i,...a}=e;super({...a,positionReference:a.referenceElement,domReferenceElement:a.referenceElement},{onOpenChange:r,dataRef:{current:{}},events:YS(),nested:n,triggerElements:i},hw),this.syncOnly=t}syncOpenEvent=(e,t)=>{(!e||!this.state.open||t!=null&&By(t))&&(this.context.dataRef.current.openEvent=e?t:void 0)};dispatchOpenChange=(e,t)=>{this.syncOpenEvent(e,t.event);let n={open:e,reason:t.reason,nativeEvent:t.event,nested:this.context.nested,triggerElement:t.trigger};this.context.events.emit(`openchange`,n)};setOpen=(e,t)=>{this.syncOnly||this.dispatchOpenChange(e,t),this.context.onOpenChange?.(e,t)}};function _w(e,t,n=!1){return{open:!1,openProp:void 0,mounted:!1,transitionStatus:void 0,floatingRootContext:new gw({open:!1,transitionStatus:void 0,floatingElement:null,referenceElement:null,triggerElements:e,floatingId:t,syncOnly:!0,nested:n,onOpenChange:void 0}),floatingId:t,triggerCount:0,preventUnmountingOnClose:!1,payload:void 0,activeTriggerId:null,activeTriggerElement:null,openedWithoutTrigger:!1,triggerIdProp:void 0,popupElement:null,positionerElement:null,activeTriggerProps:Jv,inactiveTriggerProps:Jv,popupProps:Jv}}var vw=e=>e.triggerIdProp??e.activeTriggerId,yw=e=>e.openProp??e.open,bw=e=>(e.popupElement?.id??e.floatingId)||void 0;function xw(e,t){return t!==void 0&&yw(e)&&vw(e)===t}function Sw(e,t){return xw(e,t)?!0:t!==void 0&&yw(e)&&vw(e)==null&&!e.openedWithoutTrigger&&e.triggerCount===1}var Cw={open:yw,mounted:e=>e.mounted,transitionStatus:e=>yw(e)&&!e.mounted?`starting`:e.transitionStatus,floatingRootContext:e=>e.floatingRootContext,triggerCount:e=>e.triggerCount,preventUnmountingOnClose:e=>e.preventUnmountingOnClose,payload:e=>e.payload,activeTriggerId:vw,activeTriggerElement:e=>e.mounted?e.activeTriggerElement:null,popupId:bw,isTriggerActive:(e,t)=>t!==void 0&&vw(e)===t,isOpenedByTrigger:(e,t)=>xw(e,t),isMountedByTrigger:(e,t)=>t!==void 0&&vw(e)===t&&e.mounted,triggerProps:(e,t)=>t?e.activeTriggerProps:e.inactiveTriggerProps,triggerPopupId:(e,t)=>Sw(e,t)?bw(e):void 0,popupProps:e=>e.popupProps,popupElement:e=>e.popupElement,positionerElement:e=>e.positionerElement};function ww(e){let t=q.useCallback(t=>e===void 0?Kv:e.subscribeStore(t),[e]),n=q.useCallback(()=>e===void 0?void 0:e.store,[e]);return(0,ow.useSyncExternalStore)(t,n,()=>e?.serverStore)}function Tw(e){let{open:t=!1,onOpenChange:n,elements:r={}}=e,i=LS(),a=$S()!=null,o=sv(()=>new gw({open:t,transitionStatus:void 0,onOpenChange:n,referenceElement:r.reference??null,floatingElement:r.floating??null,triggerElements:new tw,floatingId:i,syncOnly:!1,nested:a})).current;return Q(()=>{let e={open:t,floatingId:i};r.reference!==void 0&&(e.referenceElement=r.reference,e.domReferenceElement=z_(r.reference)?r.reference:null),r.floating!==void 0&&(e.floatingElement=r.floating),o.update(e)},[t,i,r.reference,r.floating,o]),o.context.onOpenChange=n,o.context.nested=a,o}var Ew=Ay&&My;function Dw(e,t={}){let{enabled:n=!0,delay:r}=t,{events:i,dataRef:a}=e.context,o=q.useRef(!1),s=q.useRef(null),c=q.useRef(!0),l=by();q.useEffect(()=>{let t=e.select(`domReferenceElement`);if(!n)return;let r=I_(t);function i(){let t=e.select(`domReferenceElement`);!e.select(`open`)&&B_(t)&&t===Vy(Mv(t))&&(o.current=!0,s.current=t)}function a(){c.current=!0}function l(){c.current=!1}return nx(tx(r,`blur`,i),Ew&&tx(r,`keydown`,a,!0),Ew&&tx(r,`pointerdown`,l,!0))},[e,n]),q.useEffect(()=>{if(!n)return;function t(t){if(t.reason===`trigger-press`||t.reason===`escape-key`){let t=e.select(`domReferenceElement`);z_(t)&&(s.current=t,o.current=!0)}}return i.on(`openchange`,t),()=>{i.off(`openchange`,t)}},[i,n,e]);let u=q.useMemo(()=>{function t(){o.current=!1,s.current=null}return{onMouseLeave(){t()},onFocus(n){let i=n.currentTarget;if(o.current){if(s.current===i)return;t()}let a=Wy(n.nativeEvent);if(z_(a)){if(Ew&&!n.relatedTarget){if(!c.current&&!bb(a))return}else if(!Cb(a))return}let u=_b(n.relatedTarget,e.context.triggerElements),{nativeEvent:d,currentTarget:f}=n;e.select(`open`)&&u||!r?e.setOpen(!0,Ab(Fb,d,f)):l.start(r,()=>{o.current||e.setOpen(!0,Ab(Fb,d,f))})},onBlur(n){t();let r=n.relatedTarget,i=n.nativeEvent,o=z_(r)&&r.hasAttribute(yS(`focus-guard`))&&r.getAttribute(`data-type`)===`outside`;l.start(0,()=>{let t=e.select(`domReferenceElement`),n=Vy(Mv(t));(r||n!==t)&&(Hy(a.current.floatingContext?.refs.floating.current,n)||Hy(t,n)||o||_b(r??n,e.context.triggerElements)||e.setOpen(!1,Ab(Fb,i)))})}}},[a,r,e,l]);return q.useMemo(()=>n?{reference:u,trigger:u}:{},[n,u])}var Ow=class e{pointerType=void 0;interactedInside=!1;handler=void 0;blockMouseMove=!0;performedPointerEventsMutation=!1;pointerEventsScopeElement=null;pointerEventsReferenceElement=null;pointerEventsFloatingElement=null;restTimeoutPending=!1;openChangeTimeout=new yy;restTimeout=new yy;handleCloseOptions=void 0;static create(){return new e}dispose=()=>{this.openChangeTimeout.clear(),this.restTimeout.clear()};disposeEffect=()=>this.dispose},kw=new WeakMap;function Aw(e){if(!e.performedPointerEventsMutation)return;let t=e.pointerEventsScopeElement;t&&kw.get(t)===e&&(e.pointerEventsScopeElement?.style.removeProperty(`pointer-events`),e.pointerEventsReferenceElement?.style.removeProperty(`pointer-events`),e.pointerEventsFloatingElement?.style.removeProperty(`pointer-events`),kw.delete(t)),e.performedPointerEventsMutation=!1,e.pointerEventsScopeElement=null,e.pointerEventsReferenceElement=null,e.pointerEventsFloatingElement=null}function jw(e,t){let{scopeElement:n,referenceElement:r,floatingElement:i}=t,a=kw.get(n);a&&a!==e&&Aw(a),Aw(e),e.performedPointerEventsMutation=!0,e.pointerEventsScopeElement=n,e.pointerEventsReferenceElement=r,e.pointerEventsFloatingElement=i,kw.set(n,e),n.style.pointerEvents=`none`,r.style.pointerEvents=`auto`,i.style.pointerEvents=`auto`}function Mw(e){let t=e.context.dataRef.current,n=sv(()=>t.hoverInteractionState??Ow.create()).current;return t.hoverInteractionState||=n,_y(t.hoverInteractionState.disposeEffect),t.hoverInteractionState}function Nw(e,t={}){let{enabled:n=!0,closeDelay:r=0,nodeId:i}=t,a=e.useState(`open`),o=e.useState(`floatingElement`),s=e.useState(`domReferenceElement`),{dataRef:c}=e.context,l=eC(),u=$S(),d=Mw(e),f=by(),p=Z(()=>Ob(c.current.openEvent?.type,d.interactedInside)),m=Z(()=>kb(c.current.openEvent?.type)),h=Z(()=>{Aw(d)});Q(()=>{a||(d.pointerType=void 0,d.restTimeoutPending=!1,d.interactedInside=!1,h())},[a,d,h]),q.useEffect(()=>h,[h]),Q(()=>{if(n&&a&&d.handleCloseOptions?.blockPointerEvents&&m()&&z_(s)&&o){let e=s,t=o,n=Mv(o),r=l?.nodesRef.current.find(e=>e.id===u)?.context?.elements.floating;r&&(r.style.pointerEvents=``);let i=d.pointerEventsScopeElement===t?null:d.pointerEventsScopeElement,a=r===t?null:r,c=d.handleCloseOptions?.getScope?.()??i??a??Uy(e,`[data-rootownerid]`)??n.body;return jw(d,{scopeElement:c,referenceElement:e,floatingElement:t}),()=>{h()}}},[n,a,s,o,d,m,l,u,h]),q.useEffect(()=>{if(!n)return;function t(){return!!(l&&u&&_S(l.nodesRef.current,u).length>0)}function a(t){let n=Eb(r,`close`,d.pointerType),i=()=>{e.setOpen(!1,Ab(Pb,t)),l?.events.emit(`floating.closed`,t)};n?d.openChangeTimeout.start(n,i):(d.openChangeTimeout.clear(),i())}function s(e){let t=Wy(e);xb(t)?d.interactedInside=Uy(t,`[aria-haspopup]`)!=null:d.interactedInside=!1}function g(){d.openChangeTimeout.clear(),f.clear(),l?.events.off(`floating.closed`,v),h()}function _(n){if(t()&&l){l.events.on(`floating.closed`,v);return}if(_b(n.relatedTarget,e.context.triggerElements))return;let r=c.current.floatingContext?.nodeId??i,o=n.relatedTarget;l&&r&&z_(o)&&_S(l.nodesRef.current,r,!1).some(e=>Hy(e.context?.elements.floating,o))||(d.handler?d.handler(n):(h(),m()&&!p()&&a(n)))}function v(n){l&&u&&!t()&&f.start(0,()=>{l.events.off(`floating.closed`,v),e.setOpen(!1,Ab(Pb,n)),l.events.emit(`floating.closed`,n)})}let y=o;return nx(y&&tx(y,`mouseenter`,g),y&&tx(y,`mouseleave`,_),y&&tx(y,`pointerdown`,s,!0),()=>{l?.events.off(`floating.closed`,v)})},[n,o,e,c,r,i,m,p,h,d,l,u,f])}var Pw={current:null};function Fw(e,t={}){let{enabled:n=!0,delay:r=0,handleClose:i=null,mouseOnly:a=!1,restMs:o=0,move:s=!0,triggerElementRef:c=Pw,externalTree:l,isActiveTrigger:u=!0,getHandleCloseContext:d,isClosing:f,shouldOpen:p,guardStaleOpen:m=!1}=t,{dataRef:h,events:g}=e.context,_=eC(l),v=Mw(e),y=q.useRef(!1),b=rx(i),x=rx(r),S=rx(o),C=rx(n),w=rx(p),T=rx(f),E=Z(()=>Ob(h.current.openEvent?.type,v.interactedInside)),D=Z(()=>w.current?.()!==!1),O=Z((t,n,r)=>{let i=e.context.triggerElements;if(i.hasElement(n))return!t||!Hy(t,n);if(!z_(r))return!1;let a=r;return i.hasMatchingElement(e=>Hy(e,a))&&(!t||!Hy(t,a))}),k=Z(()=>{v.handler&&=(Mv(e.select(`domReferenceElement`)).removeEventListener(`mousemove`,v.handler),void 0)}),A=Z(()=>{Aw(v)});return u&&(v.handleCloseOptions=i?.__options),q.useEffect(()=>k,[k]),q.useEffect(()=>{if(!n)return;function e(e){e.open?y.current=!1:(y.current=e.reason===Pb,k(),v.openChangeTimeout.clear(),v.restTimeout.clear(),v.blockMouseMove=!0,v.restTimeoutPending=!1)}return g.on(`openchange`,e),()=>{g.off(`openchange`,e)}},[n,g,v,k]),q.useEffect(()=>{if(!n)return;function t(t,n=!0){let r=Eb(x.current,`close`,v.pointerType);r?v.openChangeTimeout.start(r,()=>{e.setOpen(!1,Ab(Pb,t)),_?.events.emit(`floating.closed`,t)}):n&&(v.openChangeTimeout.clear(),e.setOpen(!1,Ab(Pb,t)),_?.events.emit(`floating.closed`,t))}let r=c.current??(u?e.select(`domReferenceElement`):null);if(!z_(r))return;function i(t){if(v.openChangeTimeout.clear(),v.blockMouseMove=!1,a&&!zy(v.pointerType))return;let n=Db(S.current),r=Eb(x.current,`open`,v.pointerType),i=Wy(t),o=t.currentTarget??null,s=e.select(`domReferenceElement`),c=o;if(z_(i)&&!e.context.triggerElements.hasElement(i)){for(let t of e.context.triggerElements.elements())if(Hy(t,i)){c=t;break}}z_(o)&&z_(s)&&!e.context.triggerElements.hasElement(o)&&Hy(o,s)&&(c=s);let l=c!=null&&O(s,c,i),u=e.select(`open`),d=T.current?.()??e.select(`transitionStatus`)===`ending`,f=!u&&d&&y.current,p=!l&&z_(c)&&z_(s)&&Hy(s,c)&&f,m=n>0&&!r,h=l&&(u||f)||p,g=!u||l;h?D()&&e.setOpen(!0,Ab(Pb,t,c)):m||(r?v.openChangeTimeout.start(r,()=>{g&&D()&&e.setOpen(!0,Ab(Pb,t,c))}):g&&D()&&e.setOpen(!0,Ab(Pb,t,c)))}function o(n){if(E()){A();return}k();let r=Mv(e.select(`domReferenceElement`));v.restTimeout.clear(),v.restTimeoutPending=!1;let i=h.current.floatingContext??d?.();if(!_b(n.relatedTarget,e.context.triggerElements)){if(b.current&&i){e.select(`open`)||v.openChangeTimeout.clear();let a=c.current;v.handler=b.current({...i,tree:_,x:n.clientX,y:n.clientY,onClose(){A(),k(),C.current&&!E()&&a===e.select(`domReferenceElement`)&&t(n,!0)}}),r.addEventListener(`mousemove`,v.handler),v.handler(n)}else(v.pointerType!==`touch`||!Hy(e.select(`floatingElement`),n.relatedTarget))&&t(n)}}function l(e){Hy(r,e.relatedTarget)||(v.openChangeTimeout.clear(),v.restTimeout.clear(),v.restTimeoutPending=!1)}let f=m?tx(r,`mouseout`,l):void 0;return s?nx(tx(r,`mousemove`,i,{once:!0}),tx(r,`mouseenter`,i),tx(r,`mouseleave`,o),f):nx(tx(r,`mouseenter`,i),tx(r,`mouseleave`,o),f)},[k,A,h,x,e,n,b,v,u,O,E,a,s,S,c,_,C,d,T,D,m]),q.useMemo(()=>{if(!n)return;function t(e){v.pointerType=e.pointerType}return{onPointerDown:t,onPointerEnter:t,onMouseMove(t){let{nativeEvent:n}=t,r=t.currentTarget,i=e.select(`domReferenceElement`),o=e.select(`open`),s=O(i,r,t.target);if(a&&!zy(v.pointerType))return;if(o&&s&&v.handleCloseOptions?.blockPointerEvents){let t=e.select(`floatingElement`);if(t){let e=v.handleCloseOptions?.getScope?.()??r.ownerDocument.body;jw(v,{scopeElement:e,referenceElement:r,floatingElement:t})}}let c=Db(S.current);if(o&&!s||c===0||!s&&v.restTimeoutPending&&t.movementX**2+t.movementY**2<2)return;v.restTimeout.clear();function l(){if(v.restTimeoutPending=!1,E())return;let t=e.select(`open`);!v.blockMouseMove&&(!t||s)&&D()&&e.setOpen(!0,Ab(Pb,n,r))}v.pointerType===`touch`?US.flushSync(()=>{l()}):s&&o?l():(v.restTimeoutPending=!0,v.restTimeout.start(c,l))}}},[n,v,E,O,a,e,S,D])}function Iw(e){return My&&e.movementX===0&&e.movementY===0}function Lw(e,t,n){switch(e){case`vertical`:return t;case`horizontal`:return n;default:return t||n}}function Rw(e,t){return Lw(t,e===`ArrowUp`||e===`ArrowDown`,e===`ArrowLeft`||e===`ArrowRight`)}function zw(e,t,n){return Lw(t,e===`ArrowDown`,n?e===`ArrowLeft`:e===`ArrowRight`)||e===`Enter`||e===` `||e===``}function Bw(e,t,n){return Lw(t,n?e===qy:e===Jy,e===Xy)}function Vw(e,t,n,r){return t===`both`||t===`horizontal`&&r?e===`Escape`:Lw(t,n?e===Jy:e===qy,e===Yy)}function Hw(e,t){let{listRef:n,activeIndex:r,onNavigate:i=()=>{},enabled:a=!0,selectedIndex:o=null,allowEscape:s=!1,loopFocus:c=!1,nested:l=!1,rtl:u=!1,virtual:d=!1,focusItemOnOpen:f=`auto`,focusItemOnHover:p=!0,openOnArrowKeyDown:m=!0,disabledIndices:h=void 0,orientation:g=`vertical`,triggerOrientation:_=g,parentOrientation:v,id:y,resetOnPointerLeave:b=!0,externalTree:x,nestedReturnFocusRef:S,grid:C}=t,w=C!=null,T=e.useState(`open`),E=e.useState(`floatingElement`),D=e.useState(`domReferenceElement`),O=e.context.dataRef,k=wb(E),A=Sb(D),j=rx(k),M=$S(),N=eC(x),P=q.useRef(f),F=q.useRef(o??-1),I=q.useRef(null),L=q.useRef(!0),R=Z(e=>{i(F.current===-1?null:F.current,e)}),ee=q.useRef(!!E),z=q.useRef(T),te=q.useRef(!1),B=q.useRef(!1),ne=q.useRef(null),V=rx(h),H=rx(T),re=rx(o),ie=rx(b),ae=cx(),oe=cx(),se=Z(()=>{ae.cancel();function e(e){d||(ne.current=xS(e,{sync:te.current,preventScroll:!0}))}let t=n.current[F.current],r=B.current;t&&e(t),(te.current?e=>e():e=>ae.request(e))(()=>{let i=n.current[F.current]||t;i&&(t||e(i),fe&&(r||!L.current)&&i.scrollIntoView?.({block:`nearest`,inline:`nearest`}))})});Q(()=>{O.current.orientation=g},[O,g]),Q(()=>{T||(I.current=null),(!T||f!==`auto`)&&(P.current=f)},[T,f]),Q(()=>{a&&(T&&E?(F.current=o??-1,P.current&&o!=null&&(B.current=!0,R())):ee.current&&(F.current=-1,R()))},[a,T,E,o,R]),Q(()=>{if(a){if(!T)te.current=!1;else if(E){if(r==null){if(te.current=!1,re.current!=null)return;if(ee.current&&(F.current=-1,se()),(!z.current||!ee.current)&&P.current&&(I.current!=null||P.current===!0&&I.current==null)){let e=0,t=()=>{n.current[0]==null?(e<2&&(e?e=>oe.request(e):queueMicrotask)(t),e+=1):(F.current=I.current==null||zw(I.current,_,u)||l?Vx(n):Hx(n),I.current=null,R())};t()}}else Bx(n.current,r)||(F.current=r,se(),B.current=!1)}}},[a,T,E,r,re,l,n,_,u,R,se,oe]),Q(()=>{if(!a||E||!N||d||!ee.current)return;let e=N.nodesRef.current,t=e.find(e=>e.id===M)?.context?.elements.floating,n=Vy(Mv(D??t??null)),r=e.some(e=>e.context&&Hy(e.context.elements.floating,n));t&&!r&&L.current&&t.focus({preventScroll:!0})},[a,E,D,N,M,d]),Q(()=>{z.current=T,ee.current=!!E});let U=r!=null,ce=Z(e=>{if(!H.current)return;let t=n.current.indexOf(e.currentTarget);t!==-1&&(F.current!==t||r!==t)&&(F.current=t,R(e))}),le=Z(()=>v??N?.nodesRef.current.find(e=>e.id===M)?.context?.dataRef?.current.orientation),ue=Z(()=>Vx(n,V.current)),de=Z(t=>{if(L.current=!1,te.current=!0,t.which===229||!H.current&&t.currentTarget===j.current)return;if(l&&Vw(t.key,g,u,w)){Rw(t.key,le())||Fy(t),e.setOpen(!1,Ab(Vb,t.nativeEvent));let n=S?.current??D;B_(n)&&n.focus();return}r!=null&&r!==F.current&&!Bx(n.current,r)&&(F.current=r);let i=F.current,a=Vx(n,h),o=Hx(n,h);if(A||(t.key===`Home`&&(Fy(t),F.current=a,R(t)),t.key===`End`&&(Fy(t),F.current=o,R(t))),C!=null){let e=C(t,F.current,n,g,c,u,h,a,o);if(e!=null&&e!==F.current&&(F.current=e,R(t)),g===`both`)return}if(Rw(t.key,g)){Fy(t);let e=Vy(t.currentTarget.ownerDocument);if(T&&!d&&Hy(t.currentTarget,e)&&!n.current.some(t=>t!=null&&Hy(t,e))){F.current=zw(t.key,g,u)?a:o,R(t),r===F.current&&se();return}let{index:l,wrapped:f}=Ux(n.current,i,{decrement:!zw(t.key,g,u),loopFocus:c,allowEscape:s,disabledIndices:h,minIndex:a,maxIndex:o});f&&(te.current=!1),F.current=l,R(t)}}),fe=q.useMemo(()=>({onFocus(e){te.current=!0,ce(e)},onClick({currentTarget:e}){d||e.focus({preventScroll:!0})},onMouseMove(e){Iw(e)||(te.current=!0,B.current=!1,p&&ce(e))},onPointerLeave(e){if(!H.current||!L.current||e.pointerType===`touch`)return;te.current=!0;let t=e.relatedTarget;if(p&&!n.current.includes(t)&&ie.current&&(ne.current?.(),ne.current=null,F.current=-1,R(e),!d)){let e=j.current,t=Vy(Mv(e));e&&Hy(e,t)&&e.focus({preventScroll:!0})}}}),[ce,H,j,p,n,R,ie,d]),pe=q.useMemo(()=>d&&T&&U&&{"aria-activedescendant":`${y}-${r}`},[d,T,U,y,r]),me=q.useMemo(()=>({...A?{}:pe,onKeyDown(t){if(t.key===`Tab`&&t.shiftKey&&T&&!d){let n=Wy(t.nativeEvent);if(n&&!Hy(j.current,n))return;Fy(t);let r=Ab(zb,t.nativeEvent);e.setOpen(!1,r);let i=S?.current??D;!r.isCanceled&&B_(i)&&i.focus()}else de(t)},onPointerMove(e){Iw(e)||(L.current=!0)}}),[pe,de,j,A,e,T,d,D,S]),he=q.useMemo(()=>{function t(t){e.setOpen(!0,Ab(Vb,t.nativeEvent,t.currentTarget))}function n(e){f===`auto`&&Ly(e.nativeEvent)&&(P.current=!d)}function r(e){P.current=f,f===`auto`&&Ry(e.nativeEvent)&&(P.current=!0)}return{onKeyDown(n){let r=e.select(`open`);L.current=!1;let i=n.key.startsWith(`Arrow`),a=Bw(n.key,le(),u),o=Rw(n.key,r?g:_),s=(l?a:o)||n.key===`Enter`||n.key.trim()===``;if(d&&r&&(!l||bb(n.currentTarget)))return de(n);if(r||m||!i){if(s){let e=Rw(n.key,le());I.current=l&&e?null:n.key}l?a&&(Fy(n),r?(F.current=ue(),R(n),d&&j.current?.focus()):t(n)):o&&(re.current!=null&&(F.current=re.current),Fy(n),!r&&m?t(n):de(n),r&&R(n))}},onFocus(t){t.target===t.currentTarget&&e.select(`open`)&&!d&&(F.current=-1,R(t))},onPointerDown:r,onPointerEnter:r,onMouseDown:n,onClick:n}},[de,f,ue,l,R,e,m,g,_,le,u,re,d,j]),ge=q.useMemo(()=>({...pe,...he}),[pe,he]);return q.useMemo(()=>a?{reference:ge,floating:me,item:fe,trigger:he}:{},[a,ge,me,he,fe])}function Uw(e,t){let{listRef:n,elementsRef:r,activeIndex:i,onMatch:a,disabledIndices:o,onTyping:s,enabled:c=!0,resetMs:l=750,selectedIndex:u=null}=t,d=Z(s),f=e.useState(`open`),p=by(),m=q.useRef(``),h=q.useRef(u??i??-1),g=q.useRef(null),_=Z(e=>{function t(e){return r?.current[e]}function s(e){let n=t(e);return n&&!qx(n)||n?.matches(`:disabled`)?!1:o==null||!Gx(qv,e,o)}function c(e,t,n=0){if(e.length===0)return-1;let r=(n%e.length+e.length)%e.length,i=t.toLowerCase();for(let t=0;t<e.length;t+=1){let n=(r+t)%e.length;if(e[n]?.toLowerCase().startsWith(i)&&s(n))return n}return-1}let _=n.current;if(m.current.length>0&&e.key===` `&&(Fy(e),d?.(!0)),m.current.length>0&&m.current[0]!==` `&&c(_,m.current)===-1&&e.key!==` `&&d?.(!1),_==null||e.key.length!==1||e.ctrlKey||e.metaKey||e.altKey)return;f&&e.key!==` `&&(Fy(e),d?.(!0));let v=m.current===``;v&&(h.current=u??i??-1),_.every((e,t)=>e&&s(t)?e[0]?.toLowerCase()!==e[1]?.toLowerCase():!0)&&m.current===e.key&&(m.current=``,h.current=g.current),m.current+=e.key,p.start(l,()=>{m.current=``,h.current=g.current,d?.(!1)});let y=((v?u??i??-1:h.current)??0)+1,b=c(_,m.current,y);b===-1?e.key!==` `&&(m.current=``,d?.(!1)):(a?.(b,e),g.current=b)}),v=Z(t=>{let n=t.relatedTarget,r=e.select(`domReferenceElement`),i=e.select(`floatingElement`);Hy(r,n)||Hy(i,n)||(p.clear(),m.current=``,h.current=g.current,d?.(!1))});Q(()=>{(f||u===null)&&(p.clear(),g.current=null,m.current!==``&&(m.current=``,d?.(!1)))},[f,u,p,d]);let y=q.useMemo(()=>({onKeyDown:_,onBlur:v}),[_,v]);return q.useMemo(()=>c?{reference:y,floating:y}:{},[c,y])}var Ww=.1,Gw=Ww*Ww,Kw=.5;function qw(e,t,n,r,i,a){return r>=t!=a>=t&&e<=(i-n)*(t-r)/(a-r)+n}function Jw(e,t,n,r,i,a,o,s,c,l){let u=!1;return qw(e,t,n,r,i,a)&&(u=!u),qw(e,t,i,a,o,s)&&(u=!u),qw(e,t,o,s,c,l)&&(u=!u),qw(e,t,c,l,n,r)&&(u=!u),u}function Yw(e,t,n){return e>=n.x&&e<=n.x+n.width&&t>=n.y&&t<=n.y+n.height}function Xw(e,t,n,r,i,a){return e>=Math.min(n,i)&&e<=Math.max(n,i)&&t>=Math.min(r,a)&&t<=Math.max(r,a)}function Zw(e={}){let{blockPointerEvents:t=!1}=e,n=new yy,r=({x:e,y:t,placement:r,elements:i,onClose:a,nodeId:o,tree:s})=>{let c=r?.split(`-`)[0],l=!1,u=null,d=null,f=typeof performance<`u`?performance.now():0;function p(e,t){let n=performance.now(),r=n-f;if(u===null||d===null||r===0)return u=e,d=t,f=n,!1;let i=e-u,a=t-d,o=i*i+a*a,s=r*r*Gw;return u=e,d=t,f=n,o<s}function m(){n.clear(),a()}return function(r){n.clear();let a=i.domReference,u=i.floating;if(!a||!u||c==null||e==null||t==null)return;let{clientX:d,clientY:f}=r,h=Wy(r),g=r.type===`mouseleave`,_=Hy(u,h),v=Hy(a,h);if(_&&(l=!0,!g))return;if(v&&(l=!1,!g)){l=!0;return}if(g&&z_(r.relatedTarget)&&Hy(u,r.relatedTarget))return;function y(){return!!(s&&_S(s.nodesRef.current,o).length>0)}function b(){y()||m()}if(y())return;let x=a.getBoundingClientRect(),S=u.getBoundingClientRect(),C=e>S.right-S.width/2,w=t>S.bottom-S.height/2,T=S.width>x.width,E=S.height>x.height,D=(T?x:S).left,O=(T?x:S).right,k=(E?x:S).top,A=(E?x:S).bottom;if(c===`top`&&t>=x.bottom-1||c===`bottom`&&t<=x.top+1||c===`left`&&e>=x.right-1||c===`right`&&e<=x.left+1){b();return}let j=!1;switch(c){case`top`:j=Xw(d,f,D,x.top+1,O,S.bottom-1);break;case`bottom`:j=Xw(d,f,D,S.top+1,O,x.bottom-1);break;case`left`:j=Xw(d,f,S.right-1,A,x.left+1,k);break;case`right`:j=Xw(d,f,x.right-1,A,S.left+1,k)}if(j)return;if(l&&!Yw(d,f,x)||!g&&p(d,f)){b();return}let M=!1;switch(c){case`top`:{let n=T?Kw/2:Kw*4,r=T||C?e+n:e-n,i=T?e-n:C?e+n:e-n,a=t+Kw+1,o=C||T?S.bottom-Kw:S.top,s=C?T?S.bottom-Kw:S.top:S.bottom-Kw;M=Jw(d,f,r,a,i,a,S.left,o,S.right,s);break}case`bottom`:{let n=T?Kw/2:Kw*4,r=T||C?e+n:e-n,i=T?e-n:C?e+n:e-n,a=t-Kw,o=C||T?S.top+Kw:S.bottom,s=C?T?S.top+Kw:S.bottom:S.top+Kw;M=Jw(d,f,r,a,i,a,S.left,o,S.right,s);break}case`left`:{let n=E?Kw/2:Kw*4,r=E||w?t+n:t-n,i=E?t-n:w?t+n:t-n,a=e+Kw+1,o=w||E?S.right-Kw:S.left,s=w?E?S.right-Kw:S.left:S.right-Kw;M=Jw(d,f,o,S.top,s,S.bottom,a,r,a,i);break}case`right`:{let n=E?Kw/2:Kw*4,r=E||w?t+n:t-n,i=E?t-n:w?t+n:t-n,a=e-Kw,o=w||E?S.left+Kw:S.right,s=w?E?S.left+Kw:S.right:S.left+Kw;M=Jw(d,f,a,r,a,i,o,S.top,s,S.bottom);break}}M?l||n.start(40,b):b()}};return r.__options={...e,blockPointerEvents:t},r}function Qw(e,t,n){let{reference:r,floating:i}=e,a=Tx(t),o=Ex(t),s=wx(o),c=xx(t),l=a===`y`,u=r.x+r.width/2-i.width/2,d=r.y+r.height/2-i.height/2,f=r[s]/2-i[s]/2,p;switch(c){case`top`:p={x:u,y:r.y-i.height};break;case`bottom`:p={x:u,y:r.y+r.height};break;case`right`:p={x:r.x+r.width,y:d};break;case`left`:p={x:r.x-i.width,y:d};break;default:p={x:r.x,y:r.y}}let m=Sx(t);return m&&(p[o]+=f*(m===`end`?1:-1)*(n&&l?-1:1)),p}async function $w(e,t){t===void 0&&(t={});let{x:n,y:r,platform:i,rects:a,elements:o,strategy:s}=e,{boundary:c=`clippingAncestors`,rootBoundary:l=`viewport`,elementContext:u=`floating`,altBoundary:d=!1,padding:f=0}=bx(t,e),p=Rx(f),m=o[d?u===`floating`?`reference`:`floating`:u],h=zx(await i.getClippingRect({element:await(i.isElement==null?void 0:i.isElement(m))??!0?m:m.contextElement||await(i.getDocumentElement==null?void 0:i.getDocumentElement(o.floating)),boundary:c,rootBoundary:l,strategy:s})),g=u===`floating`?{x:n,y:r,width:a.floating.width,height:a.floating.height}:a.reference,_=await(i.getOffsetParent==null?void 0:i.getOffsetParent(o.floating)),v=await(i.isElement==null?void 0:i.isElement(_))&&await(i.getScale==null?void 0:i.getScale(_))||{x:1,y:1},y=zx(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({elements:o,rect:g,offsetParent:_,strategy:s}):g);return{top:(h.top-y.top+p.top)/v.y,bottom:(y.bottom-h.bottom+p.bottom)/v.y,left:(h.left-y.left+p.left)/v.x,right:(y.right-h.right+p.right)/v.x}}var eT=50,tT=async(e,t,n)=>{let{placement:r=`bottom`,strategy:i=`absolute`,middleware:a=[],platform:o}=n,s=o.detectOverflow?o:{...o,detectOverflow:$w},c=await(o.isRTL==null?void 0:o.isRTL(t)),l=await o.getElementRects({reference:e,floating:t,strategy:i}),{x:u,y:d}=Qw(l,r,c),f=r,p=0,m={};for(let n=0;n<a.length;n++){let h=a[n];if(!h)continue;let{name:g,fn:_}=h,{x:v,y,data:b,reset:x}=await _({x:u,y:d,initialPlacement:r,placement:f,strategy:i,middlewareData:m,rects:l,platform:s,elements:{reference:e,floating:t}});u=v??u,d=y??d,m[g]={...m[g],...b},x&&p<eT&&(p++,typeof x==`object`&&(x.placement&&(f=x.placement),x.rects&&(l=x.rects===!0?await o.getElementRects({reference:e,floating:t,strategy:i}):x.rects),{x:u,y:d}=Qw(l,f,c)),n=-1)}return{x:u,y:d,placement:f,strategy:i,middlewareData:m}},nT=function(e){return e===void 0&&(e={}),{name:`flip`,options:e,async fn(t){var n;let{placement:r,middlewareData:i,rects:a,initialPlacement:o,platform:s,elements:c}=t,{mainAxis:l=!0,crossAxis:u=!0,fallbackPlacements:d,fallbackStrategy:f=`bestFit`,fallbackAxisSideDirection:p=`none`,flipAlignment:m=!0,...h}=bx(e,t);if((n=i.arrow)!=null&&n.alignmentOffset)return{};let g=xx(r),_=Tx(o),v=xx(o)===o,y=await(s.isRTL==null?void 0:s.isRTL(c.floating)),b=d||(v||!m?[Ix(o)]:Ox(o)),x=p!==`none`;!d&&x&&b.push(...Fx(o,m,p,y));let S=[o,...b],C=await s.detectOverflow(t,h),w=[],T=i.flip?.overflows||[];if(l&&w.push(C[g]),u){let e=Dx(r,a,y);w.push(C[e[0]],C[e[1]])}if(T=[...T,{placement:r,overflows:w}],!w.every(e=>e<=0)){let e=(i.flip?.index||0)+1,t=S[e];if(t&&(u!==`alignment`||_===Tx(t)||T.every(e=>Tx(e.placement)!==_||e.overflows[0]>0)))return{data:{index:e,overflows:T},reset:{placement:t}};let n=T.filter(e=>e.overflows[0]<=0).sort((e,t)=>e.overflows[1]-t.overflows[1])[0]?.placement;if(!n)switch(f){case`bestFit`:{let e=T.filter(e=>{if(x){let t=Tx(e.placement);return t===_||t===`y`}return!0}).map(e=>[e.placement,e.overflows.filter(e=>e>0).reduce((e,t)=>e+t,0)]).sort((e,t)=>e[1]-t[1])[0]?.[0];e&&(n=e);break}case`initialPlacement`:n=o}if(r!==n)return{reset:{placement:n}}}return{}}}},rT=new Set([`left`,`top`]);async function iT(e,t){let{placement:n,platform:r,elements:i}=e,a=await(r.isRTL==null?void 0:r.isRTL(i.floating)),o=xx(n),s=Sx(n),c=Tx(n)===`y`,l=rT.has(o)?-1:1,u=a&&c?-1:1,d=bx(t,e),{mainAxis:f,crossAxis:p,alignmentAxis:m}=typeof d==`number`?{mainAxis:d,crossAxis:0,alignmentAxis:null}:{mainAxis:d.mainAxis||0,crossAxis:d.crossAxis||0,alignmentAxis:d.alignmentAxis};return s&&typeof m==`number`&&(p=s===`end`?m*-1:m),c?{x:p*u,y:f*l}:{x:f*l,y:p*u}}var aT=function(e){return e===void 0&&(e=0),{name:`offset`,options:e,async fn(t){var n;let{x:r,y:i,placement:a,middlewareData:o}=t,s=await iT(t,e);return a===o.offset?.placement&&(n=o.arrow)!=null&&n.alignmentOffset?{}:{x:r+s.x,y:i+s.y,data:{...s,placement:a}}}}},oT=function(e){return e===void 0&&(e={}),{name:`shift`,options:e,async fn(t){let{x:n,y:r,placement:i,platform:a}=t,{mainAxis:o=!0,crossAxis:s=!1,limiter:c={fn:e=>{let{x:t,y:n}=e;return{x:t,y:n}}},...l}=bx(e,t),u={x:n,y:r},d=await a.detectOverflow(t,l),f=Tx(i),p=Cx(f),m=u[p],h=u[f],g=(e,t)=>yx(t+d[e===`y`?`top`:`left`],t,t-d[e===`y`?`bottom`:`right`]);o&&(m=g(p,m)),s&&(h=g(f,h));let _=c.fn({...t,[p]:m,[f]:h});return{..._,data:{x:_.x-n,y:_.y-r,enabled:{[p]:o,[f]:s}}}}}},sT=function(e){return e===void 0&&(e={}),{options:e,fn(t){let{x:n,y:r,placement:i,rects:a,middlewareData:o}=t,{offset:s=0,mainAxis:c=!0,crossAxis:l=!0}=bx(e,t),u={x:n,y:r},d=Tx(i),f=Cx(d),p=u[f],m=u[d],h=bx(s,t),g=typeof h==`number`?{mainAxis:h,crossAxis:0}:{mainAxis:h.mainAxis??0,crossAxis:h.crossAxis??0};if(c){let e=f===`y`?`height`:`width`,t=a.reference[f]-a.floating[e]+g.mainAxis,n=a.reference[f]+a.reference[e]-g.mainAxis;p<t?p=t:p>n&&(p=n)}if(l){let e=f===`y`?`width`:`height`,t=rT.has(xx(i)),n=a.reference[d]-a.floating[e]+(t&&o.offset?.[d]||0)+(t?0:g.crossAxis),r=a.reference[d]+a.reference[e]+(t?0:o.offset?.[d]||0)-(t?g.crossAxis:0);m<n?m=n:m>r&&(m=r)}return{[f]:p,[d]:m}}}},cT=function(e){return e===void 0&&(e={}),{name:`size`,options:e,async fn(t){let{placement:n,rects:r,platform:i,elements:a}=t,{apply:o=()=>{},...s}=bx(e,t),c=await i.detectOverflow(t,s),l=xx(n),u=Sx(n),d=Tx(n)===`y`,{width:f,height:p}=r.floating,m,h;l===`top`||l===`bottom`?(m=l,h=u===(await(i.isRTL==null?void 0:i.isRTL(a.floating))?`start`:`end`)?`left`:`right`):(h=l,m=u===`end`?`top`:`bottom`);let g=p-c.top-c.bottom,_=f-c.left-c.right,v=px(p-c[m],g),y=px(f-c[h],_),b=t.middlewareData.shift,x=!b,S=v,C=y;b!=null&&b.enabled.x&&(C=_),b!=null&&b.enabled.y&&(S=g),x&&!u&&(d?C=f-2*mx(c.left,c.right):S=p-2*mx(c.top,c.bottom)),await o({...t,availableWidth:C,availableHeight:S});let w=await i.getDimensions(a.floating);return f!==w.width||p!==w.height?{reset:{rects:!0}}:{}}}};function lT(e){let t=$_(e),n=parseFloat(t.width)||0,r=parseFloat(t.height)||0,i=B_(e),a=i?e.offsetWidth:n,o=i?e.offsetHeight:r,s=hx(n)!==a||hx(r)!==o;return s&&(n=a,r=o),{width:n,height:r,$:s}}function uT(e){return z_(e)?e:e.contextElement}function dT(e){let t=uT(e);if(!B_(t))return _x(1);let n=t.getBoundingClientRect(),{width:r,height:i,$:a}=lT(t),o=(a?hx(n.width):n.width)/r,s=(a?hx(n.height):n.height)/i;return(!o||!Number.isFinite(o))&&(o=1),(!s||!Number.isFinite(s))&&(s=1),{x:o,y:s}}var fT=_x(0);function pT(e){let t=I_(e);return!Z_()||!t.visualViewport?fT:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function mT(e,t,n){return t===void 0&&(t=!1),!!n&&t&&n===I_(e)}function hT(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);let i=e.getBoundingClientRect(),a=uT(e),o=_x(1);t&&(r?z_(r)&&(o=dT(r)):o=dT(e));let s=mT(a,n,r)?pT(a):_x(0),c=(i.left+s.x)/o.x,l=(i.top+s.y)/o.y,u=i.width/o.x,d=i.height/o.y;if(a&&r){let e=I_(a),t=z_(r)?I_(r):r,n=e,i=iv(n);for(;i&&t!==n;){let e=dT(i),t=i.getBoundingClientRect(),r=$_(i),a=t.left+(i.clientLeft+parseFloat(r.paddingLeft))*e.x,o=t.top+(i.clientTop+parseFloat(r.paddingTop))*e.y;c*=e.x,l*=e.y,u*=e.x,d*=e.y,c+=a,l+=o,n=I_(i),i=iv(n)}}return zx({width:u,height:d,x:c,y:l})}function gT(e,t){let n=ev(e).scrollLeft;return t?t.left+n:hT(L_(e)).left+n}function _T(e,t){let n=e.getBoundingClientRect();return{x:n.left+t.scrollLeft-gT(e,n),y:n.top+t.scrollTop}}function vT(e){let{elements:t,rect:n,offsetParent:r,strategy:i}=e,a=i===`fixed`,o=L_(r),s=t?W_(t.floating):!1;if(r===o||s&&a)return n;let c={scrollLeft:0,scrollTop:0},l=_x(1),u=_x(0),d=B_(r);if((d||!a)&&((F_(r)!==`body`||H_(o))&&(c=ev(r)),d)){let e=hT(r);l=dT(r),u.x=e.x+r.clientLeft,u.y=e.y+r.clientTop}let f=o&&!d&&!a?_T(o,c):_x(0);return{width:n.width*l.x,height:n.height*l.y,x:n.x*l.x-c.scrollLeft*l.x+u.x+f.x,y:n.y*l.y-c.scrollTop*l.y+u.y+f.y}}function yT(e){return e.getClientRects?Array.from(e.getClientRects()):[]}function bT(e){let t=ev(e),n=e.ownerDocument.body,r=mx(e.scrollWidth,e.clientWidth,n.scrollWidth,n.clientWidth),i=mx(e.scrollHeight,e.clientHeight,n.scrollHeight,n.clientHeight),a=-t.scrollLeft+gT(e),o=-t.scrollTop;return $_(n).direction===`rtl`&&(a+=mx(e.clientWidth,n.clientWidth)-r),{width:r,height:i,x:a,y:o}}var xT=25;function ST(e,t,n){n===void 0&&(n=`viewport`);let r=n===`layoutViewport`,i=I_(e),a=L_(e),o=i.visualViewport,s=a.clientWidth,c=a.clientHeight,l=0,u=0;if(o){let e=!Z_()||t===`fixed`;r?e||(l=-o.offsetLeft,u=-o.offsetTop):(s=o.width,c=o.height,e&&(l=o.offsetLeft,u=o.offsetTop))}if(gT(a)<=0){let e=a.ownerDocument,t=e.body,n=getComputedStyle(t),r=e.compatMode===`CSS1Compat`&&parseFloat(n.marginLeft)+parseFloat(n.marginRight)||0,i=Math.abs(a.clientWidth-t.clientWidth-r),o=getComputedStyle(a).scrollbarGutter===`stable both-edges`?i/2:i;o<=xT&&(s-=o)}return{width:s,height:c,x:l,y:u}}function CT(e,t){let n=hT(e,!0,t===`fixed`),r=n.top+e.clientTop,i=n.left+e.clientLeft,a=dT(e);return{width:e.clientWidth*a.x,height:e.clientHeight*a.y,x:i*a.x,y:r*a.y}}function wT(e,t,n){let r;if(t===`viewport`||t===`layoutViewport`)r=ST(e,n,t);else if(t===`document`)r=bT(L_(e));else if(z_(t))r=CT(t,n);else{let n=pT(e);r={x:t.x-n.x,y:t.y-n.y,width:t.width,height:t.height}}return zx(r)}function TT(e,t){let n=t.get(e);if(n)return n;let r=rv(e,[],!1).filter(e=>z_(e)&&F_(e)!==`body`),i=null,a=$_(e).position===`fixed`,o=a?tv(e):e;for(;z_(o)&&!Q_(o);){let e=$_(o),t=Y_(o),n=i?i.position:a?`fixed`:``;!t&&(n===`fixed`||n===`absolute`&&e.position===`static`)?r=r.filter(e=>e!==o):i=e,o=tv(o)}return t.set(e,r),r}function ET(e){let{element:t,boundary:n,rootBoundary:r,strategy:i}=e,a=[...n===`clippingAncestors`?W_(t)?[]:TT(t,this._c):[].concat(n),r],o=wT(t,a[0],i),s=o.top,c=o.right,l=o.bottom,u=o.left;for(let e=1;e<a.length;e++){let n=wT(t,a[e],i);s=mx(n.top,s),c=px(n.right,c),l=px(n.bottom,l),u=mx(n.left,u)}return{width:c-u,height:l-s,x:u,y:s}}function DT(e){let{width:t,height:n}=lT(e);return{width:t,height:n}}function OT(e,t,n){let r=B_(t),i=L_(t),a=n===`fixed`,o=hT(e,!0,a,t),s={scrollLeft:0,scrollTop:0},c=_x(0);if((r||!a)&&((F_(t)!==`body`||H_(i))&&(s=ev(t)),r)){let e=hT(t,!0,a,t);c.x=e.x+t.clientLeft,c.y=e.y+t.clientTop}!r&&i&&(c.x=gT(i));let l=i&&!r&&!a?_T(i,s):_x(0);return{x:o.left+s.scrollLeft-c.x-l.x,y:o.top+s.scrollTop-c.y-l.y,width:o.width,height:o.height}}function kT(e){return $_(e).position===`static`}function AT(e,t){if(!B_(e)||$_(e).position===`fixed`)return null;if(t)return t(e);let n=e.offsetParent;return L_(e)===n&&(n=n.ownerDocument.body),n}function jT(e,t){let n=I_(e);if(W_(e))return n;if(!B_(e)){let t=tv(e);for(;t&&!Q_(t);){if(z_(t)&&!kT(t))return t;t=tv(t)}return n}let r=AT(e,t);for(;r&&U_(r)&&kT(r);)r=AT(r,t);return r&&Q_(r)&&kT(r)&&!Y_(r)?n:r||X_(e)||n}var MT=async function(e){let t=this.getOffsetParent||jT,n=this.getDimensions,r=await n(e.floating);return{reference:OT(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function NT(e){return $_(e).direction===`rtl`}var PT={convertOffsetParentRelativeRectToViewportRelativeRect:vT,getDocumentElement:L_,getClippingRect:ET,getOffsetParent:jT,getElementRects:MT,getClientRects:yT,getDimensions:DT,getScale:dT,isElement:z_,isRTL:NT};function FT(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function IT(e,t,n){let r=null,i,a=L_(e);function o(){var e;clearTimeout(i),(e=r)==null||e.disconnect(),r=null}function s(n,c){n===void 0&&(n=!1),c===void 0&&(c=1),o();let l=e.getBoundingClientRect(),{left:u,top:d,width:f,height:p}=l;if(n||t(),!f||!p)return;let m=gx(d),h=gx(a.clientWidth-(u+f)),g=gx(a.clientHeight-(d+p)),_=gx(u),v={rootMargin:-m+`px `+-h+`px `+-g+`px `+-_+`px`,threshold:mx(0,px(1,c))||1},y=!0;function b(t){let n=t[0].intersectionRatio;if(!FT(l,e.getBoundingClientRect()))return s();if(n!==c){if(!y)return s();n?s(!1,n):i=setTimeout(()=>{s(!1,1e-7)},1e3)}y=!1}try{r=new IntersectionObserver(b,{...v,root:a.ownerDocument})}catch{r=new IntersectionObserver(b,v)}r.observe(e)}let c=I_(e),l=()=>s(n);return c.addEventListener(`resize`,l),s(!0),()=>{c.removeEventListener(`resize`,l),o()}}function LT(e,t,n,r){r===void 0&&(r={});let{ancestorScroll:i=!0,ancestorResize:a=!0,elementResize:o=typeof ResizeObserver==`function`,layoutShift:s=typeof IntersectionObserver==`function`,animationFrame:c=!1}=r,l=uT(e),u=i||a?[...l?rv(l):[],...t?rv(t):[]]:[];u.forEach(e=>{i&&e.addEventListener(`scroll`,n),a&&e.addEventListener(`resize`,n)});let d=l&&s?IT(l,n,a):null,f=-1,p=null;o&&(p=new ResizeObserver(e=>{let[r]=e;r&&r.target===l&&p&&t&&(p.unobserve(t),cancelAnimationFrame(f),f=requestAnimationFrame(()=>{var e;(e=p)==null||e.observe(t)})),n()}),l&&!c&&p.observe(l),t&&p.observe(t));let m,h=c?hT(e):null;c&&g();function g(){let t=hT(e);h&&!FT(h,t)&&n(),h=t,m=requestAnimationFrame(g)}return n(),()=>{var e;u.forEach(e=>{i&&e.removeEventListener(`scroll`,n),a&&e.removeEventListener(`resize`,n)}),d?.(),(e=p)==null||e.disconnect(),p=null,c&&cancelAnimationFrame(m)}}var RT=aT,zT=oT,BT=nT,VT=cT,HT=sT,UT=(e,t,n)=>{let r=new Map,i=n??{},a={...PT,...i.platform,_c:r};return tT(e,t,{...i,platform:a})},WT=typeof document<`u`?q.useLayoutEffect:function(){};function GT(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(typeof e==`function`&&e.toString()===t.toString())return!0;let n,r,i;if(e&&t&&typeof e==`object`){if(Array.isArray(e)){if(n=e.length,n!==t.length)return!1;for(r=n;r--!==0;)if(!GT(e[r],t[r]))return!1;return!0}if(i=Object.keys(e),n=i.length,n!==Object.keys(t).length)return!1;for(r=n;r--!==0;)if(!{}.hasOwnProperty.call(t,i[r]))return!1;for(r=n;r--!==0;){let n=i[r];if(!(n===`_owner`&&e.$$typeof)&&!GT(e[n],t[n]))return!1}return!0}return e!==e&&t!==t}function KT(e){return typeof window>`u`?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function qT(e,t){let n=KT(e);return Math.round(t*n)/n}function JT(e){let t=q.useRef(e);return WT(()=>{t.current=e}),t}function YT(e){e===void 0&&(e={});let{placement:t=`bottom`,strategy:n=`absolute`,middleware:r=[],platform:i,elements:{reference:a,floating:o}={},transform:s=!0,whileElementsMounted:c,open:l}=e,[u,d]=q.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[f,p]=q.useState(r);GT(f,r)||p(r);let[m,h]=q.useState(null),[g,_]=q.useState(null),v=q.useCallback(e=>{e!==S.current&&(S.current=e,h(e))},[]),y=q.useCallback(e=>{e!==C.current&&(C.current=e,_(e))},[]),b=a||m,x=o||g,S=q.useRef(null),C=q.useRef(null),w=q.useRef(u),T=c!=null,E=JT(c),D=JT(i),O=JT(l),k=q.useCallback(()=>{if(!S.current||!C.current)return;let e={placement:t,strategy:n,middleware:f};D.current&&(e.platform=D.current),UT(S.current,C.current,e).then(e=>{let t={...e,isPositioned:O.current!==!1};A.current&&!GT(w.current,t)&&(w.current=t,US.flushSync(()=>{d(t)}))})},[f,t,n,D,O]);WT(()=>{l===!1&&w.current.isPositioned&&(w.current.isPositioned=!1,d(e=>({...e,isPositioned:!1})))},[l]);let A=q.useRef(!1);WT(()=>(A.current=!0,()=>{A.current=!1}),[]),WT(()=>{if(b&&(S.current=b),x&&(C.current=x),b&&x){if(E.current)return E.current(b,x,k);k()}},[b,x,k,E,T]);let j=q.useMemo(()=>({reference:S,floating:C,setReference:v,setFloating:y}),[v,y]),M=q.useMemo(()=>({reference:b,floating:x}),[b,x]),N=q.useMemo(()=>{let e={position:n,left:0,top:0};if(!M.floating)return e;let t=qT(M.floating,u.x),r=qT(M.floating,u.y);return s?{...e,transform:`translate(`+t+`px, `+r+`px)`,...KT(M.floating)>=1.5&&{willChange:`transform`}}:{position:n,left:t,top:r}},[n,s,M.floating,u.x,u.y]);return q.useMemo(()=>({...u,update:k,refs:j,elements:M,floatingStyles:N}),[u,k,j,M,N])}var XT=(e,t)=>{let n=RT(e);return{name:n.name,fn:n.fn,options:[e,t]}},ZT=(e,t)=>{let n=zT(e);return{name:n.name,fn:n.fn,options:[e,t]}},QT=(e,t)=>({fn:HT(e).fn,options:[e,t]}),$T=(e,t)=>{let n=BT(e);return{name:n.name,fn:n.fn,options:[e,t]}},eE=(e,t)=>{let n=VT(e);return{name:n.name,fn:n.fn,options:[e,t]}},tE=q.createContext(void 0);function nE(e){let t=q.useContext(tE);if(t===void 0&&!e)throw Error(Ov(50));return t}var rE=class extends mw{setState(e){}update(e){}set(e,t){}notifyAll(){}},iE={...Cw,instantType:e=>e.instantType,adaptiveOrigin:e=>e.adaptiveOrigin,closeDelay:e=>e.closeDelay},aE=class extends mw{constructor(e,t,n){let r=new tw;super(sE(e,r,t,n),cE(r),iE)}setOpen=(e,t)=>{let{inlineRectCoordsRef:n}=this.context;YC(this,e,t,{onBeforeDispatch(){let r=t.event;e&&t.reason===`trigger-hover`&&t.trigger&&`clientX`in r&&`clientY`in r&&n.current?.element!==t.trigger&&AC(n,t.trigger,r.clientX,r.clientY)}})}};function oE(){let e=new tw;return new rE(Object.freeze(sE(void 0,e)),Object.freeze(cE(e)),iE)}function sE(e,t,n,r=!1){return{..._w(t,n,r),instantType:void 0,adaptiveOrigin:void 0,closeDelay:300,...e}}function cE(e){return{popupRef:q.createRef(),onOpenChange:void 0,onOpenChangeComplete:void 0,triggerElements:e,inlineRectCoordsRef:{current:void 0}}}function lE(e){let{open:t,defaultOpen:n=!1,onOpenChange:r,onOpenChangeComplete:i,actionsRef:a,handle:o,triggerId:s,defaultTriggerId:c=null,children:l}=e,u=UC((e,r)=>new aE({open:n,openProp:t,activeTriggerId:c,triggerIdProp:s},e,r));u.useControlledProp(`openProp`,t),u.useControlledProp(`triggerIdProp`,s),u.useContextCallback(`onOpenChange`,r),u.useContextCallback(`onOpenChangeComplete`,i);let d=u.useState(`open`),f=u.useState(`activeTriggerId`),p=u.useState(`mounted`),m=u.useState(`payload`);ZC(u,{closeOnActiveTriggerUnmount:!0});let{forceUnmount:h}=QC(d,u,()=>{u.context.inlineRectCoordsRef.current=void 0});Q(()=>{d&&(f??u.set(`payload`,void 0))},[u,f,d]),q.useImperativeHandle(a,()=>({unmount:h,close:()=>u.setOpen(!1,Ab(Yb))}),[h,u]);let g=d||p||o!=null;return(0,J.jsxs)(tE.Provider,{value:u,children:[o&&(0,J.jsx)(WC,{handle:o,store:u}),g&&(0,J.jsx)(uE,{store:u}),typeof l==`function`?l({payload:m}):l]})}function uE({store:e}){let t=bC(e.useState(`floatingRootContext`));return $C(e,{activeTriggerProps:t.reference,inactiveTriggerProps:t.trigger,popupProps:t.floating}),null}var dE=my(function(e){return nE(!0)?(0,J.jsx)(lE,{...e}):(0,J.jsx)(rC,{children:(0,J.jsx)(lE,{...e})})}),fE=q.createContext(void 0);function pE(){let e=q.useContext(fE);if(e===void 0)throw Error(Ov(48));return e}var mE=q.forwardRef(function(e,t){let{children:n,container:r,className:i,render:a,style:o,...s}=e,{node:c,subtree:l}=qS({container:r,ref:t,componentProps:e,elementProps:s});return!l&&!c?null:(0,J.jsxs)(q.Fragment,{children:[l,c&&US.createPortal(n,c)]})}),hE=q.forwardRef(function(e,t){let{keepMounted:n=!1,...r}=e;return nE().useState(`mounted`)||n?(0,J.jsx)(fE.Provider,{value:n,children:(0,J.jsx)(mE,{ref:t,...r})}):null});function gE(e){return LS(e,`base-ui`)}var _E=hy(function(e,t){let{render:n,className:r,delay:i,closeDelay:a,id:o,payload:s,handle:c,style:l,...u}=e,d=nE(!0),f=ww(c)??d;if(!f)throw Error(Ov(89));let p=gE(o),m=f.useState(`isTriggerActive`,p),h=f.useState(`isOpenedByTrigger`,p),g=f.useState(`floatingRootContext`),_=f.context.inlineRectCoordsRef,v=q.useRef(null),y=i??600,b=a??300,{registerTrigger:x,isMountedByThisTrigger:S}=XC(p,v,f,{payload:s,closeDelay:b}),C=Fw(g,{mouseOnly:!0,move:!1,handleClose:Zw(),delay:()=>({open:y,close:b}),triggerElementRef:v,isActiveTrigger:m,isClosing:()=>f.select(`transitionStatus`)===`ending`}),w=Dw(g,{delay:y}),T={open:h},E=f.useState(`triggerProps`,S),D=kC(_,h);return Qv(`a`,e,{state:T,ref:[t,x,v],props:[C,w.reference,E,D,{id:p},u],stateAttributesMapping:fb})}),vE=q.createContext(void 0);function yE(){let e=q.useContext(vE);if(e===void 0)throw Error(Ov(49));return e}function bE(e){let{nodeId:t,externalTree:n,rootContext:r}=e,i=r.useState(`referenceElement`),a=r.useState(`floatingElement`),o=r.useState(`domReferenceElement`),s=r.useState(`open`),c=r.useState(`floatingId`),[l,u]=q.useState(null),d=q.useRef(null),f=eC(n),p=q.useMemo(()=>({reference:i,floating:a,domReference:o}),[i,a,o]),m=YT({...e,elements:{...p,...l&&{reference:l}}}),h=q.useCallback(e=>{let t=z_(e)?{getBoundingClientRect:()=>e.getBoundingClientRect(),getClientRects:()=>e.getClientRects(),contextElement:e}:e;u(t),m.refs.setReference(t)},[m.refs]),g=q.useMemo(()=>({...m.refs,setPositionReference:h,domReference:d}),[m.refs,h]),_=q.useMemo(()=>({...m.elements,domReference:o}),[m.elements,o]),v=q.useMemo(()=>({...m,dataRef:r.context.dataRef,open:s,onOpenChange:r.setOpen,events:r.context.events,floatingId:c,refs:g,elements:_,nodeId:t,rootStore:r}),[m,g,_,t,r,s,c]);return Q(()=>{o&&(d.current=o)},[o]),Q(()=>{r.context.dataRef.current.floatingContext=v;let e=f?.nodesRef.current.find(e=>e.id===t);e&&(e.context=v)}),q.useMemo(()=>({...m,context:v,refs:g,elements:_,rootStore:r}),[m,g,_,v,r])}var xE=q.createContext(void 0);function SE(){return q.useContext(xE)?.direction??`ltr`}var CE=e=>({name:`arrow`,options:e,async fn(t){let{x:n,y:r,placement:i,rects:a,platform:o,elements:s,middlewareData:c}=t,{element:l,padding:u=0}=bx(e,t)||{};if(l==null)return{};let d=Rx(u),f={x:n,y:r},p=Ex(i),m=wx(p),h=await o.getDimensions(l),g=p===`y`,_=g?`top`:`left`,v=g?`bottom`:`right`,y=g?`clientHeight`:`clientWidth`,b=a.reference[m]+a.reference[p]-f[p]-a.floating[m],x=f[p]-a.reference[p],S=s.floating[y]||a.floating[m],C=b/2-x/2,w=S/2-h[m]/2-1,T=Math.min(d[_],w),E=Math.min(d[v],w),D=T,O=S-h[m]-E,k=S/2-h[m]/2+C,A=yx(D,k,O),j=!c.arrow&&Sx(i)!=null&&k!==A&&a.reference[m]/2-(k<D?T:E)-h[m]/2<0,M=j?k<D?k-D:k-O:0;return{[p]:f[p]+M,data:{[p]:A,centerOffset:k-A-M,...j&&{alignmentOffset:M}},reset:j}}}),wE=(e,t)=>{let{name:n,fn:r}=CE(e);return{name:n,fn:r,options:[e,t]}},TE={name:`hide`,async fn(e){let{width:t,height:n,x:r,y:i}=e.rects.reference,a=t===0&&n===0&&r===0&&i===0,o=await e.platform.detectOverflow(e,{elementContext:`reference`});return{data:{referenceHidden:o.top-n>=0||o.right-t>=0||o.bottom-n>=0||o.left-t>=0||a}}}},EE={sideX:`left`,sideY:`top`},DE=`--available-width`,OE=`--available-height`,kE=`--anchor-width`,AE=`--anchor-height`,jE=`--transform-origin`,ME=DE,NE=OE;function PE(e,t,n){let r=e===`inline-start`||e===`inline-end`;return{top:`top`,right:r?n?`inline-start`:`inline-end`:`right`,bottom:`bottom`,left:r?n?`inline-end`:`inline-start`:`left`}[t]}function FE(e,t,n){let{rects:r,placement:i}=e;return{side:PE(t,xx(i),n),align:Sx(i)||`center`,anchor:{width:r.reference.width,height:r.reference.height},positioner:{width:r.floating.width,height:r.floating.height}}}function IE(e){return LE(e,bE)}function LE(e,t){let{anchor:n,positionMethod:r=`absolute`,side:i=`bottom`,sideOffset:a=0,align:o=`center`,alignOffset:s=0,collisionBoundary:c,collisionPadding:l=5,sticky:u=!1,arrowPadding:d=5,disableAnchorTracking:f=!1,inline:p,keepMounted:m=!1,floatingRootContext:h,mounted:g,collisionAvoidance:_,shift:v,nodeId:y,adaptiveOrigin:b,lazyFlip:x=!1,externalTree:S}=e,C=_.side||`flip`,w=_.align||`flip`,T=_.fallbackAxisSide||`end`,E=v?.crossAxis??!1,D=v?.rootBoundary,O=typeof n==`function`?n:void 0,k=Z(O),A=O?k:n,j=rx(n),M=rx(g),N=SE()===`rtl`,[P,F]=q.useState(null);!g&&P!==null&&F(null);let I=x===`placement`,L=P?xx(P):null,R=P&&I?Sx(P)||`center`:null,ee=L||{top:`top`,right:`right`,bottom:`bottom`,left:`left`,"inline-end":N?`left`:`right`,"inline-start":N?`right`:`left`}[i],z=R||o,te=z===`center`?ee:`${ee}-${z}`,B=l;typeof B==`number`?B={top:B,right:B,bottom:B,left:B}:B&&={top:B.top||0,right:B.right||0,bottom:B.bottom||0,left:B.left||0};let ne=+(i===`bottom`),V=+(i===`top`),H=+(i===`right`),re=+(i===`left`),ie={boundary:c===`clipping-ancestors`?`clippingAncestors`:c,padding:B},ae=q.useRef(null),oe=rx(a),se=rx(s),U=typeof a==`function`?0:a,ce=typeof s==`function`?0:s,le=[];p&&le.push(p),le.push(XT(e=>{let t=FE(e,i,N),n=typeof oe.current==`function`?oe.current(t):oe.current,r=typeof se.current==`function`?se.current(t):se.current;return{mainAxis:n,crossAxis:r,alignmentAxis:r}},[U,ce,N,i]));let ue=w===`none`&&C!==`shift`,de=!ue&&(u||E||C===`shift`),fe=C===`none`?null:$T({...ie,padding:{top:B.top+1+ne,right:B.right+1+re,bottom:B.bottom+1+V,left:B.left+1+H},mainAxis:!E&&C===`flip`,crossAxis:w===`flip`&&`alignment`,fallbackAxisSideDirection:T}),pe=ue?null:ZT({...ie,rootBoundary:D,mainAxis:w!==`none`,crossAxis:de,limiter:u||E?void 0:QT(e=>{if(!ae.current)return{};let{width:t,height:n}=ae.current.getBoundingClientRect(),r=Tx(xx(e.placement)),i=r===`y`?t:n,a=r===`y`?B.left+B.right:B.top+B.bottom;return{offset:i/2+a/2}})},[ie,u,E,D,B,w]);C===`shift`||w===`shift`||z===`center`?le.push(pe,fe):le.push(fe,pe),le.push(eE({...ie,apply({elements:{floating:e},availableWidth:t,availableHeight:n,rects:r}){if(!M.current)return;let i=e.style;i.setProperty(ME,`${t}px`),i.setProperty(NE,`${n}px`);let a=I_(e).devicePixelRatio||1,{x:o,y:s,width:c,height:l}=r.reference,u=(Math.round((o+c)*a)-Math.round(o*a))/a,d=(Math.round((s+l)*a)-Math.round(s*a))/a;i.setProperty(kE,`${u}px`),i.setProperty(AE,`${d}px`)}}),wE(e=>({element:ae.current||Mv(e.elements.floating).createElement(`div`),padding:ae.current?d:0}),[d]),{name:`transformOrigin`,fn(e){let{elements:{floating:t},middlewareData:n,placement:r,platform:o,rects:s,y:c}=e,l=xx(r),u=Sx(r),d=Tx(l)===`y`,f=ae.current,p=typeof a==`function`?a(FE(e,i,N)):a,m;m=!f&&u&&Math.abs(d?n.shift?.x||0:n.shift?.y||0)<=1?u===`start`===(d&&o.isRTL?.(t)===!0)?`100%`:`0%`:`${(d?n.arrow?.x||0:n.arrow?.y||0)+(d?f?.clientWidth||0:f?.clientHeight||0)/2}px`;let h=l===`top`||l===`left`?`calc(100% + ${p}px)`:`${-p}px`;return de&&d&&Math.abs(n.shift?.y||0)>p&&(h=`${s.reference.y+s.reference.height/2-c}px`),t.style.setProperty(jE,d?`${m} ${h}`:`${h} ${m}`),{}}},TE,b),Q(()=>{!g&&h&&h.update({referenceElement:null,floatingElement:null,domReferenceElement:null,positionReference:null})},[g,h]);let me=q.useMemo(()=>({ancestorScroll:!f,elementResize:!f&&typeof ResizeObserver<`u`,layoutShift:!f&&typeof IntersectionObserver<`u`}),[f]),{refs:he,elements:ge,x:_e,y:ve,middlewareData:ye,update:be,placement:xe,context:Se,isPositioned:Ce,floatingStyles:we}=t({rootContext:h,open:m?g:void 0,placement:te,middleware:le,strategy:r,whileElementsMounted:m?void 0:(...e)=>LT(...e,me),nodeId:y,externalTree:S}),{sideX:Te,sideY:Ee}=ye.adaptiveOrigin||EE,De=Ce?r:`fixed`,Oe=q.useMemo(()=>{let e;return e=Ce?b?{position:De,[Te]:_e,[Ee]:ve}:{...we,position:De}:{position:De,top:0,left:0},e[ME]=`100vw`,e[NE]=`100vh`,Ce||(e.opacity=0),e},[b,De,Te,_e,Ee,ve,we,Ce]),ke=q.useRef(null);Q(()=>{if(!g)return;let e=j.current,t=typeof e==`function`?e():e,n=(RE(t)?t.current:t)||null;n!==ke.current&&(he.setPositionReference(n),ke.current=n)},[g,he,A,j]),q.useEffect(()=>{if(!g)return;let e=j.current;typeof e!=`function`&&RE(e)&&e.current!==ke.current&&(he.setPositionReference(e.current),ke.current=e.current)},[g,he,A,j]),q.useEffect(()=>{if(m&&g&&ge.reference&&ge.floating)return LT(ge.reference,ge.floating,be,me)},[m,g,ge,be,me]);let Ae=xx(xe),je=PE(i,Ae,N),Me=Sx(xe)||`center`,Ne=!!ye.hide?.referenceHidden;Q(()=>{x&&g&&Ce&&(Ae!==ee||I&&Me!==z)&&F(xe)},[x,I,g,Ce,xe,Ae,Me,ee,z]);let Pe=q.useMemo(()=>({position:`absolute`,top:ye.arrow?.y,left:ye.arrow?.x}),[ye.arrow]),Fe=ye.arrow?.centerOffset!==0;return q.useMemo(()=>({positionerStyles:Oe,arrowStyles:Pe,arrowRef:ae,arrowUncentered:Fe,side:je,align:Me,physicalSide:Ae,anchorHidden:Ne,refs:he,context:Se,isPositioned:Ce,update:be}),[Oe,Pe,ae,Fe,je,Me,Ae,Ne,he,Se,Ce,be])}function RE(e){return e!=null&&`current`in e}function zE(e){return e===`starting`?RS:Jv}function BE(e,t,{styles:n,transitionStatus:r,props:i,refs:a,hidden:o,inert:s=!1}){let c={...n};return s&&(c.pointerEvents=`none`),Qv(`div`,e,{state:t,ref:a,props:[{role:`presentation`,hidden:o,style:c},zE(r),i],stateAttributesMapping:mb})}var VE=q.forwardRef(function(e,t){let{render:n,className:r,anchor:i,positionMethod:a=`absolute`,side:o=`bottom`,align:s=`center`,sideOffset:c=0,alignOffset:l=0,collisionBoundary:u=`clipping-ancestors`,collisionPadding:d=5,arrowPadding:f=5,sticky:p=!1,disableAnchorTracking:m=!1,collisionAvoidance:h=VS,style:g,..._}=e,v=nE(),y=pE(),b=tC(),x=v.useState(`open`),S=v.useState(`mounted`),C=v.useState(`floatingRootContext`),w=v.useState(`instantType`),T=v.useState(`transitionStatus`),E=v.useState(`adaptiveOrigin`),D=v.context.inlineRectCoordsRef,O=IE({anchor:i,floatingRootContext:C,positionMethod:a,mounted:S,side:o,sideOffset:c,align:s,alignOffset:l,arrowPadding:f,collisionBoundary:u,collisionPadding:d,sticky:p,disableAnchorTracking:m,keepMounted:y,nodeId:b,collisionAvoidance:h,adaptiveOrigin:E,inline:jC(D)}),k=O.update;Q(()=>{x&&S&&k()},[x,S,k]);let A=BE(e,{open:x,side:O.side,align:O.align,anchorHidden:O.anchorHidden,instant:w},{styles:O.positionerStyles,transitionStatus:T,props:_,refs:[t,v.useStateSetter(`positionerElement`)],hidden:!S,inert:!x});return(0,J.jsx)(vE.Provider,{value:O,children:(0,J.jsx)(nC,{id:b,children:A})})}),HE=q.forwardRef(function(e,t){let{className:n,render:r,style:i,...a}=e,o=nE(),{side:s,align:c}=yE(),l=o.useState(`open`),u=o.useState(`instantType`),d=o.useState(`transitionStatus`),f=o.useState(`popupProps`),p=o.useState(`floatingRootContext`),m=o.useState(`closeDelay`);return zC({open:l,ref:o.context.popupRef,onComplete(){l&&o.context.onOpenChangeComplete?.(!0)}}),Nw(p,{closeDelay:m}),Qv(`div`,e,{state:{open:l,side:s,align:c,instant:u,transitionStatus:d},ref:[t,o.context.popupRef,o.useStateSetter(`popupElement`)],props:[VC,f,zE(d),a],stateAttributesMapping:hb})});function UE(e){return Wv(19)?e:e?`true`:void 0}function WE(e){let[t,n]=q.useState({current:e,previous:null});return Object.is(e,t.current)||n({current:e,previous:t.current}),t.previous}var GE=class extends MC{constructor(){super(oE(),`PreviewCard`)}open(e){this.openByTrigger(e)}close(){this.closePopup()}get isOpen(){return this.attachedStore?.select(`open`)??!1}};function KE(){return new GE}function qE({...e}){return(0,J.jsx)(dE,{"data-slot":`hover-card`,...e})}function JE({...e}){return(0,J.jsx)(_E,{"data-slot":`hover-card-trigger`,...e})}var YE=()=>KE();function XE({className:e,side:t=`bottom`,sideOffset:n=4,align:r=`center`,alignOffset:i=4,...a}){return(0,J.jsx)(hE,{"data-slot":`hover-card-portal`,children:(0,J.jsx)(VE,{align:r,alignOffset:i,side:t,sideOffset:n,className:`isolate z-50`,children:(0,J.jsx)(HE,{"data-slot":`hover-card-content`,className:X(`z-50 w-64 origin-(--transform-origin) rounded-xl bg-popover p-2.5 text-ui text-popover-foreground shadow-md ring-1 ring-foreground/10 outline-hidden duration-(--duration-fast) data-[side=bottom]:slide-in-from-top-2 data-[side=inline-end]:slide-in-from-left-2 data-[side=inline-start]:slide-in-from-right-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95`,e),...a})})})}var ZE={compact:`text-code-compact`,default:`text-code`,comfy:`text-code-comfy`},QE={add:{row:`bg-diff-add-bg`,gutter:`bg-diff-add-gutter text-diff-add-fg`,word:`bg-diff-add-word`,marker:`+`,label:`added`},del:{row:`bg-diff-del-bg`,gutter:`bg-diff-del-gutter text-diff-del-fg`,word:`bg-diff-del-word`,marker:`−`,label:`removed`},context:{row:`bg-background`,gutter:`bg-diff-gutter-bg text-diff-gutter-fg`,word:``,marker:` `,label:`unchanged`}},$E={keyword:`text-syntax-keyword`,string:`text-syntax-string`,function:`text-syntax-function`,comment:`text-syntax-comment`,number:`text-syntax-number`},eD=(e,t,n,r=[])=>{let i=[],a=0;for(let o of t??[{text:e,type:null}]){let t=a+o.text.length,s=new Set([a,t]);for(let e of[...n,...r])e.start>a&&e.start<t&&s.add(e.start),e.end>a&&e.end<t&&s.add(e.end);let c=[...s].sort((e,t)=>e-t);for(let r=0;r+1<c.length;r++){let s=c[r]??a,l=c[r+1]??t;i.push({text:e.slice(s,l),type:o.type,changed:n.some(e=>e.start<=s&&l<=e.end),start:s})}a=t}return i},tD={finding:`isolate font-medium text-review-changes before:absolute before:inset-0 before:-z-1 before:bg-review-changes-bg before:shadow-[inset_-3px_0_0_var(--review-changes)]`,risk:`isolate font-medium text-risk-contract before:absolute before:inset-0 before:-z-1 before:bg-risk-contract-bg before:shadow-[inset_-3px_0_0_var(--risk-contract-solid)]`,decision:``},nD=(0,q.memo)(function({line:e,id:t,layout:n=`unified`,density:r=`default`,wrap:i=!1,focused:a=!1,selected:o=!1,marked:s=!1,pointKind:c=null,pointLanding:l,onComment:u,onGutterClick:d,numberButton:f,onRowClick:p,cellRole:m=`gridcell`,marks:h=rD,flagged:g=!1,end:_}){let v=QE[e.kind],y=e.newNo??e.oldNo,b=n===`split-old`?`old`:`new`,x=(t,n)=>(0,J.jsxs)(`span`,{role:m,onClick:d===void 0?void 0:t=>d(e,t),"data-point-mark":c!==null&&c!==`decision`&&n===b?c:void 0,className:X(`tabular relative w-12 shrink-0 select-none text-right`,f?.side===n&&t!==null?`pr-0`:`pr-2`,v.gutter,c!==null&&n===b&&tD[c],d!==void 0&&`cursor-pointer hover:text-foreground`),children:[f?.side===n&&t!==null?(0,J.jsx)(`button`,{type:`button`,"aria-label":f.label,onClick:f.onClick,"data-inline-target":!0,className:X(`h-full w-full pr-2 text-right hover:bg-primary hover:text-primary-foreground focus-visible:-outline-offset-2`,p!==void 0&&`group-hover/line:bg-primary group-hover/line:text-primary-foreground focus-visible:bg-primary focus-visible:text-primary-foreground`,p!==void 0&&t<1e4&&`before:mr-1 before:content-none group-hover/line:before:content-['+'] focus-visible:before:content-['+']`),children:t}):t??``,n===`new`&&g&&t!==null&&t<1e3&&(0,J.jsx)(Ih,{"aria-hidden":`true`,"data-slot":`finding-flag`,className:`pointer-events-none absolute top-1/2 left-1 size-3 -translate-y-1/2 text-review-changes group-hover/line:hidden`}),n===`new`&&u!==void 0&&f===void 0&&(0,J.jsx)(`button`,{type:`button`,tabIndex:-1,"aria-label":`Comment on line ${y??``}`,onClick:t=>{t.stopPropagation(),u(e)},className:`absolute top-0 left-0 hidden h-full w-5 items-center justify-center rounded-sm bg-primary text-primary-foreground group-hover/line:flex group-data-focused/line:flex`,children:(0,J.jsx)(`span`,{"aria-hidden":`true`,children:`+`})})]});return(0,J.jsxs)(`div`,{role:`row`,id:t,onClick:p,"aria-selected":o||void 0,"data-line":e.key,"data-kind":e.kind,"data-focused":a||void 0,"data-marked":s||void 0,"data-point":c??void 0,"data-point-line":l===void 0?void 0:l.line,style:l===void 0?void 0:vh({"--landing-i":l.at,"--point-line":l.line,"--point-lines":l.lines}),className:X(`group/line relative flex min-w-full font-mono`,p!==void 0&&`cursor-pointer`,ZE[r],v.row,o&&`before:pointer-events-none before:absolute before:inset-0 before:z-[1] before:bg-primary/15`,!o&&p!==void 0&&`hover:before:pointer-events-none hover:before:absolute hover:before:inset-0 hover:before:z-[1] hover:before:bg-primary/8`,(a||s)&&`after:pointer-events-none after:absolute after:inset-y-0 after:left-0 after:z-[1] after:w-[3px] after:bg-ring`),children:[n!==`split-new`&&x(e.oldNo,`old`),n!==`split-old`&&x(e.newNo,`new`),(0,J.jsx)(`span`,{"aria-hidden":`true`,className:X(`w-5 shrink-0 select-none text-center font-semibold`,e.kind===`add`&&`text-diff-add-fg`,e.kind===`del`&&`text-diff-del-fg`),children:v.marker}),(0,J.jsxs)(`span`,{role:m,className:X(`pr-4`,i?`min-w-0 flex-1 whitespace-pre-wrap break-all`:`whitespace-pre`),children:[(0,J.jsx)(`span`,{className:`sr-only`,children:`${v.label} line ${y??``}: `}),iD(eD(e.text,e.tokens,e.wordRanges,h).map(e=>({start:e.start,element:(0,J.jsx)(`span`,{"data-changed":e.changed||void 0,className:X(e.type!==null&&$E[e.type],e.changed&&X(v.word,`rounded-sm`)),children:e.text},e.start)})),h),e.notes.map(e=>(0,J.jsx)(`span`,{className:`ml-2 rounded-sm border px-1 align-middle font-sans text-caption text-muted-foreground`,children:e},e)),_]})]})}),rD=[],iD=(e,t)=>{if(t.length===0)return e.map(({element:e})=>e);let n=[];for(let{start:r,element:i}of e){let e=t.find(e=>r>=e.start&&r<e.end)??null,a=n.at(-1);e!==null&&a?.mark===e?a.code.push(i):n.push({mark:e,code:[i]})}return n.flatMap(({mark:e,code:t})=>e===null?t:[(0,J.jsx)(q.Fragment,{children:e.render(t)},`mark-${e.start}`)])},aD=({kind:e,className:t})=>(0,J.jsx)(`div`,{"aria-hidden":`true`,"data-slot":`line-end`,"data-kind":e,className:X(`flex min-w-full`,QE[e].row,t),children:(0,J.jsx)(`span`,{className:X(`w-12 shrink-0`,QE[e].gutter)})}),oD={finding:{label:`Finding`,glyph:`⚠`,className:`text-review-changes bg-review-changes-bg border-review-changes/25`},risk:{label:`Risk`,glyph:`▲`,className:`text-risk-contract bg-risk-contract-bg border-risk-contract-border`},decision:{label:`Decision`,glyph:`◇`,className:`text-muted-foreground bg-muted border-border`}},sD={finding:Ih,risk:i_,decision:c_},cD={contract:{label:`Contract`,glyph:`▲`,className:`text-risk-contract bg-risk-contract-bg border-risk-contract-border`},logic:{label:`Logic`,glyph:`●`,className:`text-risk-logic bg-risk-logic-bg border-risk-logic-border`},mechanical:{label:`Mechanical`,glyph:`○`,className:`text-risk-mechanical bg-risk-mechanical-bg border-risk-mechanical-border`}},lD={added:{kind:`mark`,label:`new`,tone:`text-diff-add-fg`,name:`text-diff-add-fg`},modified:null,deleted:{kind:`mark`,label:`deleted`,tone:`text-diff-del-fg`,name:`text-diff-del-fg line-through`},renamed:{kind:`chip`,label:`renamed`,className:`text-diff-hunk-fg bg-diff-hunk-bg border-diff-hunk-fg/25`}},uD={open:{label:`Open`,className:`text-pr-open bg-pr-open-bg border-pr-open/25`},draft:{label:`Draft`,className:`text-muted-foreground bg-muted border-border`},merged:{label:`Merged`,className:`text-pr-merged bg-pr-merged-bg border-pr-merged/25`},closed:{label:`Closed`,className:`text-review-changes bg-review-changes-bg border-review-changes/25`}},dD={approved:{label:`Approved`,glyph:`✓`,className:`text-review-approved bg-review-approved-bg border-review-approved/25`},"changes-requested":{label:`Changes requested`,glyph:`✕`,className:`text-review-changes bg-review-changes-bg border-review-changes/25`}},fD={passed:{label:`Passed`,glyph:`✓`,tone:`text-ci-success`},failed:{label:`Failed`,glyph:`✕`,tone:`text-ci-failure`},running:{label:`Running`,glyph:`◌`,tone:`text-ci-running`},skipped:{label:`Skipped`,glyph:`–`,tone:`text-ci-skipped`}},pD={"changes-requested":{label:`Requested changes`,tone:`text-review-changes`},approved:{label:`Approved`,tone:`text-review-approved`},commented:{label:`Commented`,tone:`text-review-commented`},waiting:{label:`Not reviewed yet`,tone:`text-muted-foreground`}},mD=`modulepreload`,hD=function(e){return`/`+e},gD={},_D=function(e){return e.pathname.endsWith(`.css`)},vD=function(e,t,n){if(t in e)return e[t];let r=n();if(!r){e[t]=void 0;return}let i=r.then(()=>{e[t]=void 0},n=>{throw e[t]=void 0,n});return e[t]=i,i},yD=function(e,t,n){let r=Promise.resolve();if(t&&t.length>0){let e,i=document.querySelector(`meta[property=csp-nonce]`),a=i?.nonce||i?.getAttribute(`nonce`);function o(e){return Promise.all(e.map(e=>Promise.resolve(e).then(e=>({status:`fulfilled`,value:e}),e=>({status:`rejected`,reason:e}))))}function s(e){return import.meta.resolve?new URL(import.meta.resolve(e)):new URL(e,import.meta.url)}r=o(t.map(t=>{t=hD(t,n);let r=s(t),i=_D(r);return vD(gD,r.href,()=>{if(e===void 0){e={all:new Set,styles:new Set};let t=document.getElementsByTagName(`link`);for(let n=t.length-1;n>=0;n--){let r=t[n];e.all.add(r.href),r.rel===`stylesheet`&&e.styles.add(r.href)}}if((i?e.styles:e.all).has(r.href))return;let t=document.createElement(`link`);if(t.rel=i?`stylesheet`:mD,i||(t.as=`script`),t.crossOrigin=``,t.href=r.href,a&&t.setAttribute(`nonce`,a),document.head.appendChild(t),i)return new Promise((e,n)=>{t.addEventListener(`load`,e),t.addEventListener(`error`,()=>n(Error(`Unable to preload CSS for ${r}`)))})})}).filter(e=>e!==void 0))}function i(e){let t=new Event(`vite:preloadError`,{cancelable:!0});if(t.payload=e,window.dispatchEvent(t),!t.defaultPrevented)throw e}return r.then(t=>{for(let e of t||[])e.status===`rejected`&&i(e.reason);return e().catch(i)})},bD={name:`java-constants`,scopeName:`source.java.constants`,injectTo:[`source.java`],injectionSelector:`L:source.java -comment -string -meta.import -meta.package`,repository:{},patterns:[{match:`(?<![\\w$])[A-Z][A-Z0-9_]*[A-Z0-9](?![\\w$])`,name:`variable.other.constant.java`},{match:`(\\.)\\s*([A-Z][A-Z0-9_]*[A-Z0-9])(?![\\w$]|\\s*\\()`,captures:{1:{name:`punctuation.separator.period.java`},2:{name:`variable.other.constant.java`}}}]},xD={c:()=>yD(()=>import(`./c-Cz4nF6n_.js`),__vite__mapDeps([0,1])),cpp:()=>yD(()=>import(`./cpp-DzjeI0uH.js`),__vite__mapDeps([2,3,1])),csharp:()=>yD(()=>import(`./csharp-dmMxLVLW.js`),[]),css:()=>yD(()=>import(`./css-DgaLhXQH.js`),__vite__mapDeps([4,5])),diff:()=>yD(()=>import(`./diff-woXpYk--.js`),[]),docker:()=>yD(()=>import(`./docker-IyjqRm3v.js`),[]),go:()=>yD(()=>import(`./go-rLFTqkRN.js`),[]),graphql:()=>yD(()=>import(`./graphql-BHtseKAV.js`),__vite__mapDeps([6,7,8,9,10,11])),html:()=>yD(()=>import(`./html-BWDvXlHg.js`),__vite__mapDeps([12,13,5,8])),ini:()=>yD(()=>import(`./ini-B5eOa1yu.js`),[]),java:async()=>({default:[...(await yD(async()=>{let{default:e}=await import(`./java-_ATy9zCa.js`);return{default:e}},__vite__mapDeps([14,15]))).default,bD]}),javascript:()=>yD(()=>import(`./javascript-CpIGwZ_Y.js`),__vite__mapDeps([16,8])),json:()=>yD(()=>import(`./json-C3WlssX3.js`),__vite__mapDeps([17,18])),jsonc:()=>yD(()=>import(`./jsonc-CYpm1nAK.js`),[]),jsx:()=>yD(()=>import(`./jsx-C4yDKi0A.js`),__vite__mapDeps([19,10])),kotlin:()=>yD(()=>import(`./kotlin-DhhofPvG.js`),[]),make:()=>yD(()=>import(`./make-Dixweg8N.js`),[]),markdown:()=>yD(()=>import(`./markdown-BYOwaDjH.js`),[]),php:()=>yD(()=>import(`./php-CUj1wjLQ.js`),__vite__mapDeps([20,5,8,13,18,21,15,22])),python:()=>yD(()=>import(`./python-gzcpVVnB.js`),[]),ruby:()=>yD(()=>import(`./ruby-DAHFNlv9.js`),__vite__mapDeps([23,1,3,5,8,7,9,10,11,13,21,15,22,24,25])),rust:()=>yD(()=>import(`./rust-DpiIf5JO.js`),[]),scss:()=>yD(()=>import(`./scss-8bKmll0B.js`),__vite__mapDeps([26,5])),shellscript:()=>yD(()=>import(`./shellscript-CVTB3cr6.js`),__vite__mapDeps([27,24])),sql:()=>yD(()=>import(`./sql-CfM2IJm3.js`),__vite__mapDeps([28,22])),svelte:()=>yD(()=>import(`./svelte-DAcAPYhA.js`),__vite__mapDeps([29,5,8,9])),swift:()=>yD(()=>import(`./swift-CyEgAFGc.js`),[]),toml:()=>yD(()=>import(`./toml-CcmNWLt0.js`),[]),tsx:()=>yD(()=>import(`./tsx-CGosfAUg.js`),__vite__mapDeps([30,11])),typescript:()=>yD(()=>import(`./typescript-Bb1J8qyy.js`),__vite__mapDeps([31,9])),vue:()=>yD(()=>import(`./vue-DfeOw4hL.js`),__vite__mapDeps([32,5,8,9,13,18])),xml:()=>yD(()=>import(`./xml-DuKfbPI6.js`),__vite__mapDeps([33,21,15])),yaml:()=>yD(()=>import(`./yaml-DDA_XMNu.js`),__vite__mapDeps([34,25]))},SD={c_sharp:`csharp`},CD={bash:`shellscript`,c:`c`,cc:`cpp`,cjs:`javascript`,cpp:`cpp`,cs:`csharp`,css:`css`,cts:`typescript`,cxx:`cpp`,diff:`diff`,go:`go`,gql:`graphql`,graphql:`graphql`,h:`c`,hh:`cpp`,hpp:`cpp`,htm:`html`,html:`html`,ini:`ini`,java:`java`,js:`javascript`,json:`json`,jsonc:`jsonc`,jsx:`jsx`,kt:`kotlin`,kts:`kotlin`,md:`markdown`,mjs:`javascript`,mts:`typescript`,patch:`diff`,php:`php`,py:`python`,pyi:`python`,rb:`ruby`,rs:`rust`,scss:`scss`,sh:`shellscript`,sql:`sql`,svelte:`svelte`,swift:`swift`,toml:`toml`,ts:`typescript`,tsx:`tsx`,vue:`vue`,xml:`xml`,yaml:`yaml`,yml:`yaml`,zsh:`shellscript`},wD={Dockerfile:`docker`,GNUmakefile:`make`,Makefile:`make`},TD=e=>{let t=e.language===null?null:SD[e.language]??e.language;if(t!==null&&t in xD)return t;let n=e.path.slice(e.path.lastIndexOf(`/`)+1),r=n.lastIndexOf(`.`),i=r>0?n.slice(r+1).toLowerCase():``;return wD[n]??CD[i]??null},ED=e=>({old:DD(e,`add`),new:DD(e,`del`)}),DD=(e,t)=>e.filter(({line:e})=>e.kind!==t).map(({text:e})=>e).join(`
|
|
75
|
-
`),
|
|
76
|
-
`.repeat(e),
|
|
77
|
-
`.repeat(e-2)}
|
|
78
|
-
`).filter(e=>e.trim()!==``),r=n[0];if(r===void 0)return``;let i=
|
|
79
|
-
`:``;if(a===void 0)return o;let s=PD(a,n),c=a.trim();return(s===0?``:AD.test(c)||s===1&&!jD.test(c)?OD(s):kD(Math.max(s,2)))+o},PD=(e,t)=>{let n=/^[ \t]*/.exec(e)?.[0]??``,r=n.split(` `).length-1;if(r>0)return r+Math.floor((n.length-r)/4);let i=t.some(e=>(/^ */.exec(e)?.[0].length??0)%4==2&&!MD.test(e.trim()));return Math.floor(n.length/(i?2:4))},FD=new Set([`graphql`,`ini`,`json`,`jsonc`,`sql`,`toml`,`xml`,`yaml`]),ID=new Set([`css`,`scss`]),LD=new Set([`css`,`html`,`scss`,`svelte`,`vue`]),RD=new Set([`javascript`,`jsx`,`tsx`,`typescript`]),zD=/\.(md|mdx|rst|txt)$/i,BD=e=>TD({path:e,language:null}),VD=e=>{if(ul(e))return`test`;if(zD.test(e))return`docs`;let t=BD(e);return t===null?`other`:FD.has(t)?`data`:ID.has(t)?`style`:`code`},HD=e=>{let t=BD(e);return t===null||zD.test(e)?`plain`:t===`python`?`python`:RD.has(t)?`script`:FD.has(t)?`data`:LD.has(t)?`markup`:`plain`},UD={test:mg,code:ng,data:Ph,docs:cg,style:Xg,other:ug},WD={python:`text-syntax-function`,script:`text-syntax-number`,data:`text-syntax-string`,markup:`text-syntax-keyword`,plain:`text-muted-foreground`},GD={added:og,deleted:ig},KD=({path:e,status:t,className:n})=>{let r=t===void 0?null:lD[t],i=t===void 0?void 0:GD[t];if(r?.kind===`mark`&&i!==void 0)return(0,J.jsx)(i,{"aria-hidden":`true`,"data-status":t,className:X(`size-3.5 shrink-0`,r.tone,n)});let a=VD(e),o=UD[a];return(0,J.jsx)(o,{"aria-hidden":`true`,"data-role":a,className:X(`size-3.5 shrink-0`,WD[HD(e)],n)})},qD=({path:e,name:t})=>{let n=e.lastIndexOf(`/`)+1;return(0,J.jsxs)(J.Fragment,{children:[n>0&&(0,J.jsx)(`span`,{className:`text-muted-foreground`,children:e.slice(0,n)}),(0,J.jsx)(`span`,{"data-slot":`file-name`,className:X(`font-medium`,t),children:e.slice(n)})]})},JD=({file:e,status:t,className:n})=>{let r=t===void 0?null:lD[t],i=r?.kind===`mark`?r:null;return(0,J.jsxs)(`span`,{"data-slot":`file-path`,className:X(`min-w-0 break-all font-mono text-code`,n),children:[i!==null&&(0,J.jsx)(KD,{path:e.path,status:t,className:`mr-1 inline-block align-[-2px]`}),e.oldPath!==null&&e.oldPath!==e.path?(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(`span`,{className:`text-muted-foreground`,children:e.oldPath}),` `,(0,J.jsx)(`span`,{"aria-hidden":`true`,children:`→`}),(0,J.jsx)(`span`,{className:`sr-only`,children:`renamed to`}),` `,(0,J.jsx)(qD,{path:e.path,name:i?.name})]}):(0,J.jsx)(qD,{path:e.path,name:i?.name}),i!==null&&(0,J.jsxs)(`span`,{className:`sr-only`,children:[`, `,i.label]})]})},YD=({status:e})=>{let t=lD[e];return t?.kind===`chip`?(0,J.jsx)(`span`,{"data-slot":`file-status`,className:X(`shrink-0 rounded-full border px-1.5 text-caption font-medium leading-4`,t.className),children:t.label}):null},XD=(e,t)=>`${e} ${t}${e===1?``:`s`}`,ZD=({callers:e,named:t})=>{let[n,r]=(0,q.useState)(!1),i=(0,q.useId)(),{uses:a,more:o}=e,s=a.filter(e=>ul(e.path)).length,c=a.length-s,l=`${[...c>0?[XD(c,`place`)]:[],...s>0?[XD(s,`test`)]:[]].join(` and `)}${o>0?`, and ${o} more`:``}`;return(0,J.jsxs)(`div`,{"data-slot":`unchanged-uses`,className:`border-b bg-surface-subtle px-3 py-1.5`,children:[(0,J.jsx)(`p`,{children:(0,J.jsxs)(`button`,{type:`button`,"aria-expanded":n,"aria-controls":i,onClick:()=>r(!n),className:`min-h-6 rounded-sm text-primary underline-offset-2 hover:underline`,children:[t&&(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(`code`,{className:`font-mono text-code-compact`,children:e.symbol}),` `]}),t?`used`:`Used`,` unchanged in `,l]})}),n&&(0,J.jsxs)(`ul`,{id:i,className:`mt-1.5 flex flex-col gap-2`,children:[a.map(e=>(0,J.jsxs)(`li`,{"data-slot":`unchanged-use`,children:[(0,J.jsxs)(`p`,{"data-slot":`unchanged-place`,className:`font-mono text-code-compact text-muted-foreground`,children:[(0,J.jsx)(`span`,{className:`text-foreground`,children:e.path}),`:`,e.line,e.use===`type`&&(0,J.jsx)(`span`,{children:` type`})]}),(0,J.jsx)(`pre`,{className:`overflow-x-auto rounded-md border bg-background py-1 font-mono text-code-compact`,children:e.excerpt.lines.map((t,n)=>{let r=e.excerpt.start+n,i=r===e.line;return(0,J.jsxs)(`span`,{"data-slot":`unchanged-line`,"data-used":i||void 0,className:X(`block pr-3`,i&&`bg-diff-hunk-bg text-diff-hunk-fg`),children:[(0,J.jsx)(`span`,{className:`tabular inline-block w-12 select-none pr-3 text-right text-diff-gutter-fg`,children:r}),t]},r)})})]},`${e.path}:${e.line}`)),o>0&&(0,J.jsxs)(`li`,{className:`text-muted-foreground`,children:[`and `,o,` more`]})]})]})};function QD(e){return Qv(e.defaultTagName??`div`,e,e)}var $D=cy(`group/badge inline-flex h-5 w-fit shrink-0 items-center justify-center gap-1 overflow-hidden rounded-full border border-transparent px-2 py-0.5 text-caption font-medium whitespace-nowrap transition-all has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 aria-invalid:border-destructive aria-invalid:ring-destructive/20 [&>svg]:pointer-events-none [&>svg]:size-3!`,{variants:{variant:{default:`bg-primary text-primary-foreground [a]:hover:bg-primary/80`,secondary:`bg-secondary text-secondary-foreground [a]:hover:bg-secondary/80`,destructive:`bg-destructive/10 text-destructive focus-visible:ring-destructive/20 [a]:hover:bg-destructive/20`,outline:`border-border text-foreground [a]:hover:bg-muted [a]:hover:text-muted-foreground`,ghost:`hover:bg-muted hover:text-muted-foreground`,link:`text-primary underline-offset-4 hover:underline`}},defaultVariants:{variant:`default`}});function eO({className:e,variant:t=`default`,render:n,...r}){return QD({defaultTagName:`span`,props:mv({className:X($D({variant:t}),e)},r),render:n,state:{slot:`badge`,variant:t}})}function tO({status:e,label:t=e.label,className:n}){return(0,J.jsxs)(eO,{variant:`outline`,className:X(e.className,n),children:[(0,J.jsx)(`span`,{"aria-hidden":`true`,children:e.glyph}),t]})}function nO({controlled:e,default:t,name:n,state:r=`value`}){let{current:i}=q.useRef(e!==void 0),[a,o]=q.useState(()=>t);return[i&&e!==void 0?e:a,q.useCallback(e=>{i||o(e)},[])]}var rO=q.createContext({register:()=>{},unregister:()=>{},subscribeMapChange:()=>()=>{},nextIndexRef:{current:0}});function iO(){return q.useContext(rO)}function aO(e){let{children:t,elementsRef:n,labelsRef:r,onMapChange:i}=e,a=Z(i),[,o]=q.useState(0),s=sv(sO).current,c=sv(oO).current,l=q.useRef(0),u=q.useRef(!0),d=q.useRef(null),f=q.useRef(null),p=Z(()=>{u.current||(u.current=!0,o(e=>e+1))}),m=Z((e,t)=>{c.set(e,t),p()}),h=Z(e=>{c.delete(e),p()}),g=Z(e=>{let t=new Map;return n.current.length=0,r&&(r.current.length=0),e.forEach(e=>{t.set(e.element,{...e.registration.metadata??{},index:e.index}),n.current[e.index]=e.element,r&&(r.current[e.index]=e.registration.label===void 0?e.registration.textRef?.current?.textContent??e.element.textContent:e.registration.label)}),l.current=n.current.length,t});function _(e){if(f.current?.disconnect(),f.current=null,typeof MutationObserver!=`function`||e.length<2)return;let t=new MutationObserver(n=>{if(!uO(n))return;let r=null;for(let n of e)if(n.isConnected){if(r&&dO(r,n)>0){t.disconnect(),p();return}r=n}});f.current=t;let n=new Set;for(let t=1;t<e.length;t+=1){let r=lO(e[t-1],e[t]);r&&n.add(r)}n.forEach(e=>t.observe(e,{childList:!0}))}let v=Z(()=>{let[e,t]=cO(c),n=g(e),r=d.current,i=!r||r.length!==e.length||e.some((e,t)=>{let n=r[t];return e.index!==n.index||e.element!==n.element||e.registration.index!==n.registration.index||e.registration.metadata!==n.registration.metadata});_(t),d.current=e,u.current=!1,i&&(s.forEach(e=>e(n)),a(n))});Q(()=>(!u.current&&d.current&&g(d.current),()=>{n.current=[],r&&(r.current=[])}),[n,r,g]),Q(()=>{u.current&&v()}),Q(()=>()=>{f.current?.disconnect(),u.current=!0},[]);let y=Z(e=>(s.add(e),()=>{s.delete(e)})),b=q.useMemo(()=>({register:m,unregister:h,subscribeMapChange:y,nextIndexRef:l}),[m,h,y,l]);return(0,J.jsx)(rO.Provider,{value:b,children:t})}function oO(){return new Map}function sO(){return new Set}function cO(e){let t=new Set,n=[],r=[];e.forEach((e,i)=>{if(!i.isConnected)return;let a=e.index,o={index:a??-1,element:i,registration:e};a===null?r.push(o):a>=0&&(t.add(a),n.push(o))});let i=0;return r.sort((e,t)=>dO(e.element,t.element)),r.forEach(e=>{for(;t.has(i);)i+=1;e.index=i,n.push(e),i+=1}),t.size>0&&n.sort((e,t)=>e.index-t.index),[n,r.map(e=>e.element)]}function lO(e,t){let n=e.parentElement;for(;n&&!n.contains(t);)n=n.parentElement;return n}function uO(e){for(let t of e)for(let e=0;e<t.removedNodes.length;e+=1)if(t.removedNodes[e].isConnected)return!0;return!1}function dO(e,t){return e.nextElementSibling===t?-1:t.nextElementSibling===e?1:e.compareDocumentPosition(t)&Node.DOCUMENT_POSITION_FOLLOWING?-1:1}var fO=q.createContext(void 0);function pO(){let e=q.useContext(fO);if(e===void 0)throw Error(Ov(64));return e}var mO=`data-activation-direction`,hO={tabActivationDirection:e=>({[mO]:e})},gO=q.forwardRef(function(e,t){let{className:n,defaultValue:r=0,onValueChange:i,orientation:a=`horizontal`,render:o,value:s,style:c,...l}=e,u=e.defaultValue!==void 0,d=q.useRef([]),[f,p]=q.useState(()=>new Map),[m,h]=nO({controlled:s,default:r,name:`Tabs`,state:`value`}),g=s!==void 0,[_,v]=q.useState(()=>new Map),y=q.useRef(void 0),b=q.useCallback(e=>_O(_,e),[_]),[x,S]=q.useState(()=>({previousValue:m,tabActivationDirection:`none`})),{previousValue:C,tabActivationDirection:w}=x,T=w,E=!1;C!==m&&(T=vO(C,m,a,_),E=C!=null&&m!=null&&b(m)==null);let D=E?C:m,O=C!==D||w!==T;Q(()=>{O&&S({previousValue:D,tabActivationDirection:T})},[D,O,T]);let k=Z((e,t)=>{t.activationDirection=vO(m,e,a,_),i?.(e,t),!t.isCanceled&&h(()=>e)}),A=Z((e,t)=>{i?.(e,Ab(t,void 0,void 0,{activationDirection:`none`}))}),j=Z((e,t)=>(p(n=>{let r=new Map(n);return r.set(e,t),r}),()=>{p(n=>{if(n.get(e)!==t)return n;let r=new Map(n);return r.delete(e),r})})),M=q.useCallback(e=>f.get(e),[f]),N=q.useCallback(e=>{for(let t of _.values())if(e===t.value)return t.id},[_]),P=q.useMemo(()=>({getTabElementBySelectedValue:b,getTabIdByPanelValue:N,getTabPanelIdByValue:M,onValueChange:k,orientation:a,registerMountedTabPanel:j,setTabMap:v,tabActivationDirection:T,value:m}),[b,N,M,k,a,j,v,T,m]),F=q.useMemo(()=>{for(let e of _.values())if(e.value===m)return e},[_,m]),I=q.useMemo(()=>{for(let e of _.values())if(!e.disabled)return e.value},[_]),L=q.useRef(!u),R=q.useRef(r),ee=q.useRef(u),z=q.useRef(!1);Q(()=>{if(g)return;function e(e,t){h(()=>e),S({previousValue:e,tabActivationDirection:`none`}),A(e,t),L.current=!1}if(_.size===0){z.current&&m!==null&&!y.current?.isConnected&&e(null,qb);return}z.current=!0,y.current=_.keys().next().value;let t=F?.disabled,n=F==null&&m!==null;if(!t&&m===R.current&&(ee.current=!1),ee.current&&t&&m===R.current)return;let r=L.current;if(t||n){let n=I??null;if(m===n){L.current=!1;return}let i=qb;r?i=Jb:t&&(i=Kb),e(n,i)}else r&&F!=null&&(A(m,Jb),L.current=!1)},[I,g,A,F,h,_,m]);let te=Qv(`div`,e,{state:{orientation:a,tabActivationDirection:T},ref:t,props:l,stateAttributesMapping:hO});return(0,J.jsx)(fO.Provider,{value:P,children:(0,J.jsx)(aO,{elementsRef:d,children:te})})});function _O(e,t){for(let[n,r]of e.entries())if(t===r.value)return n;return null}function vO(e,t,n,r){if(e==null||t==null)return`none`;let[i,a,o]=n===`horizontal`?[`left`,`left`,`right`]:[`top`,`up`,`down`],s=_O(r,e),c=_O(r,t);if(s==null||c==null)return s!==c&&(typeof e==`number`||typeof e==`string`)&&typeof e==typeof t?t>e?o:a:`none`;let l=s.getBoundingClientRect()[i],u=c.getBoundingClientRect()[i];return u<l?a:u>l?o:`none`}var yO=`data-composite-item-active`;function bO(e={}){let{guess:t,label:n,metadata:r,textRef:i,index:a}=e,{register:o,unregister:s,subscribeMapChange:c,nextIndexRef:l}=iO(),u=q.useRef(-1),[d,f]=q.useState(a==null&&t?()=>{if(u.current===-1){let e=l.current;l.current+=1,u.current=e}return u.current}:-1),p=a??d,m=q.useRef(null),h=q.useCallback(e=>{let t=m.current;t&&s(t),m.current=e,e&&o(e,{metadata:r??null,index:a??null,label:n,textRef:i})},[a,o,s,r,n,i]);return Q(()=>{if(a==null)return c(e=>{let t=m.current?e.get(m.current)?.index:null;t!=null&&f(t)})},[a,c]),{ref:h,index:p}}function xO(e={}){let{highlightItemOnHover:t,highlightedIndex:n,onHighlightedIndexChange:r}=Av(),{ref:i,index:a}=bO(e),o=n===a,s=q.useRef(null),c=Lv(i,s);return{compositeProps:{tabIndex:o?0:-1,onFocus(){r(a)},onMouseMove(){let e=s.current;if(!t||!e)return;let n=e.hasAttribute(`disabled`)||e.ariaDisabled===`true`;!o&&!n&&e.focus()}},compositeRef:c,index:a}}var SO=q.createContext(void 0);function CO(){let e=q.useContext(SO);if(e===void 0)throw Error(Ov(65));return e}var wO=q.forwardRef(function(e,t){let{className:n,disabled:r=!1,render:i,value:a,id:o,nativeButton:s=!0,style:c,...l}=e,{value:u,getTabPanelIdByValue:d,onValueChange:f,orientation:p,tabActivationDirection:m}=pO(),{activateOnFocus:h,registerTabResizeObserverElement:g,tabsListElement:_}=CO(),{highlightedIndex:v,onHighlightedIndexChange:y}=Av(),b=gE(o),{compositeProps:x,compositeRef:S,index:C}=xO({metadata:q.useMemo(()=>({disabled:r,id:b,value:a}),[r,b,a])}),w=a===u,T=q.useRef(!1),E=q.useRef(null),D=Z(e=>{E.current?.(),E.current=e?g(e):null});Q(()=>{if(T.current){T.current=!1;return}if(!(w&&C>-1&&v!==C))return;let e=_;if(e!=null){let t=Vy(Mv(e));if(t&&Hy(e,t))return}r||y(C)},[w,C,v,y,r,_]);let{getButtonProps:O,buttonRef:k}=Pv({disabled:r,native:s,focusableWhenDisabled:!0}),A=d(a),j=q.useRef(!1),M=q.useRef(!1);function N(e){f(a,Ab(Mb,e.nativeEvent,void 0,{activationDirection:`none`}))}function P(e){w||r||N(e)}function F(e){w||r||h&&(!j.current||M.current)&&N(e)}function I(e){if(w||r)return;j.current=!0,M.current=e.button===0;let t=Mv(e.currentTarget);function n(){j.current=!1,M.current=!1,t.removeEventListener(`pointerup`,n),t.removeEventListener(`pointercancel`,n)}t.addEventListener(`pointerup`,n),t.addEventListener(`pointercancel`,n)}return Qv(`button`,e,{state:{disabled:r,active:w,orientation:p,tabActivationDirection:m},ref:[t,k,S,D],props:[x,{role:`tab`,"aria-controls":A,"aria-selected":w,id:b,onClick:P,onFocus:F,onPointerDown:I,[yO]:w?``:void 0,onKeyDownCapture(){T.current=!0}},l,O],stateAttributesMapping:hO})}),TO=q.createContext(void 0),EO={disableStyleElements:!1};function DO(){return q.useContext(TO)??EO}var OO=`data-index`,kO={...hO,...tb},AO=q.forwardRef(function(e,t){let{className:n,value:r,render:i,keepMounted:a=!1,style:o,...s}=e,{value:c,getTabIdByPanelValue:l,orientation:u,tabActivationDirection:d,registerMountedTabPanel:f}=pO(),p=gE(),{ref:m,index:h}=bO(),g=r===c,{mounted:_,transitionStatus:v,setMounted:y}=PC(g),b=!_,x=l(r),S={hidden:b,orientation:u,tabActivationDirection:d,transitionStatus:v},C=q.useRef(null),w=Qv(`div`,e,{state:S,ref:[t,m,C],props:[{"aria-labelledby":x,hidden:b,id:p,role:`tabpanel`,tabIndex:g?0:-1,inert:UE(!g),[OO]:h},s],stateAttributesMapping:kO});return zC({open:g,ref:C,onComplete(){g||y(!1)}}),Q(()=>{if(!(p==null||b&&!a))return f(r,p)},[b,a,r,p,f]),a||_?w:null});function jO(e){return e==null||e.hasAttribute(`disabled`)||e.getAttribute(`aria-disabled`)===`true`}var MO=`ArrowUp`,NO=`ArrowDown`,PO=`ArrowLeft`,FO=`ArrowRight`,IO=new Set([MO,NO,PO,FO,`Home`,`End`]),LO=[`Shift`,`Control`,`Alt`,`Meta`];function RO(e){return B_(e)&&e.tagName===`INPUT`}function zO(e){return!!(RO(e)&&e.selectionStart!=null||B_(e)&&e.tagName===`TEXTAREA`)}function BO(e,t,n,r){if(!e||!t||!t.scrollTo)return;let i=e.scrollLeft,a=e.scrollTop,o=e.clientWidth<e.scrollWidth,s=e.clientHeight<e.scrollHeight;if(o&&r!==`vertical`){let r=VO(e,t,`left`),a=HO(e),o=HO(t);n===`ltr`&&(r+t.offsetWidth+o.scrollMarginRight>e.scrollLeft+e.clientWidth-a.scrollPaddingRight?i=r+t.offsetWidth+o.scrollMarginRight-e.clientWidth+a.scrollPaddingRight:r-o.scrollMarginLeft<e.scrollLeft+a.scrollPaddingLeft&&(i=r-o.scrollMarginLeft-a.scrollPaddingLeft)),n===`rtl`&&(r-o.scrollMarginLeft<e.scrollLeft+a.scrollPaddingLeft?i=r-o.scrollMarginLeft-a.scrollPaddingLeft:r+t.offsetWidth+o.scrollMarginRight>e.scrollLeft+e.clientWidth-a.scrollPaddingRight&&(i=r+t.offsetWidth+o.scrollMarginRight-e.clientWidth+a.scrollPaddingRight))}if(s&&r!==`horizontal`){let n=VO(e,t,`top`),r=HO(e),i=HO(t);n-i.scrollMarginTop<e.scrollTop+r.scrollPaddingTop?a=n-i.scrollMarginTop-r.scrollPaddingTop:n+t.offsetHeight+i.scrollMarginBottom>e.scrollTop+e.clientHeight-r.scrollPaddingBottom&&(a=n+t.offsetHeight+i.scrollMarginBottom-e.clientHeight+r.scrollPaddingBottom)}e.scrollTo({left:i,top:a,behavior:`auto`})}function VO(e,t,n){let r=n===`left`?`offsetLeft`:`offsetTop`,i=0;for(;t.offsetParent&&(i+=t[r],t.offsetParent!==e);)t=t.offsetParent;return i}function HO(e){let t=getComputedStyle(e);return{scrollMarginTop:parseFloat(t.scrollMarginTop)||0,scrollMarginRight:parseFloat(t.scrollMarginRight)||0,scrollMarginBottom:parseFloat(t.scrollMarginBottom)||0,scrollMarginLeft:parseFloat(t.scrollMarginLeft)||0,scrollPaddingTop:parseFloat(t.scrollPaddingTop)||0,scrollPaddingRight:parseFloat(t.scrollPaddingRight)||0,scrollPaddingBottom:parseFloat(t.scrollPaddingBottom)||0,scrollPaddingLeft:parseFloat(t.scrollPaddingLeft)||0}}function UO(e){let{loopFocus:t=!0,orientation:n=`both`,grid:r,onLoop:i,direction:a,highlightedIndex:o,onHighlightedIndexChange:s,rootRef:c,enableHomeAndEndKeys:l=!1,stopEventPropagation:u,disabledIndices:d,modifierKeys:f=qv}=e,[p,m]=q.useState(0),h=r!=null,g=q.useRef(null),_=Lv(g,c),v=q.useRef([]),y=q.useRef(!1),b=q.useRef(null),x=o??p,S=Z((e,t=!1)=>{if(b.current=v.current[e]??null,(s??m)(e),t){let t=v.current[e];BO(g.current,t,a,n)}}),C=Z(e=>{if(e.size===0)return;if(y.current){let e=v.current,t=e.indexOf(b.current);if(t===-1){let t=e[x];!t||Gx(e,x,d)?S(WO(e,d)):b.current=t}else t!==x&&S(t);return}y.current=!0;let t=Array.from(e.keys()),r=t.find(e=>e?.hasAttribute(`data-composite-item-active`))??null,i=r?e.get(r)?.index??-1:-1;if(i!==-1)S(i);else if(Gx(t,x,d)){let e=Wx(t,{disabledIndices:d});Bx(t,e)||S(e)}BO(g.current,r,a,n)});Q(()=>{if(d==null||o!=null||!y.current)return;let e=v.current;if(Gx(e,x,d)){let t=Wx(e,{disabledIndices:d});Bx(e,t)||S(t)}},[d,o,x,v,S]);let w=Z((e,t,n)=>i?i(e,t,n,v):n),T=Z(e=>{let o=e.key===`Home`||e.key===`End`;if(!IO.has(e.key)||!l&&o||GO(e,f)||!g.current)return;let s=a===`rtl`,c=s?PO:FO,p=s?FO:PO,m=n===`vertical`?NO:c,_=n===`vertical`?MO:p,y=Wy(e.nativeEvent);if(y!=null&&zO(y)&&!jO(y)){let t=y.selectionStart,n=y.selectionEnd,r=y.value;if(t==null||e.shiftKey||t!==n||e.key!==_&&t<r.length||e.key!==m&&t>0)return}let b=x,C=Vx(v,d),T=Hx(v,d);r!=null&&(b=r({disabledIndices:d,elementsRef:v,event:e,highlightedIndex:x,loopFocus:t,maxIndex:T,minIndex:C,onLoop:w,orientation:n,rtl:s}));let E=n!==`vertical`&&e.key===c||n!==`horizontal`&&e.key===`ArrowDown`,D=n!==`vertical`&&e.key===p||n!==`horizontal`&&e.key===`ArrowUp`;l&&(e.key===`Home`?b=C:e.key===`End`&&(b=T)),b===x&&(E||D)&&(t&&b===T&&E?(b=C,i&&(b=i(e,x,b,v))):t&&b===C&&D?(b=T,i&&(b=i(e,x,b,v))):b=Wx(v.current,{startingIndex:b,decrement:D,disabledIndices:d})),b!==x&&!Bx(v.current,b)&&(u&&e.stopPropagation(),(h||o||E||D)&&e.preventDefault(),S(b,!0),queueMicrotask(()=>{v.current[b]?.focus()}))});return{props:{ref:_,onFocus(e){let t=g.current,n=Wy(e.nativeEvent);t&&n!=null&&zO(n)&&n.setSelectionRange(0,n.value.length)},onKeyDown:T},highlightedIndex:x,onHighlightedIndexChange:S,elementsRef:v,onMapChange:C,relayKeyboardEvent:T}}function WO(e,t){let n=-1;for(let r=0;r<e.length;r+=1){let i=e[r];if(i&&!Gx(e,r,t)){if(i.hasAttribute(`data-composite-item-active`))return r;n===-1&&(n=r)}}return Math.max(n,0)}function GO(e,t){for(let n of LO)if(!t.includes(n)&&e.getModifierState(n))return!0;return!1}function KO(e){let{render:t,className:n,style:r,refs:i=qv,props:a=qv,state:o=Jv,stateAttributesMapping:s,highlightedIndex:c,onHighlightedIndexChange:l,orientation:u,grid:d,loopFocus:f,onLoop:p,enableHomeAndEndKeys:m,onMapChange:h,stopEventPropagation:g=!0,rootRef:_,disabledIndices:v,modifierKeys:y,highlightItemOnHover:b=!1,tag:x=`div`,...S}=e,{props:C,highlightedIndex:w,onHighlightedIndexChange:T,elementsRef:E,onMapChange:D,relayKeyboardEvent:O}=UO({grid:d,loopFocus:f,onLoop:p,orientation:u,highlightedIndex:c,onHighlightedIndexChange:l,rootRef:_,stopEventPropagation:g,enableHomeAndEndKeys:m,direction:SE(),disabledIndices:v,modifierKeys:y}),k=Qv(x,e,{state:o,ref:i,props:[C,...a,S],stateAttributesMapping:s}),A=q.useMemo(()=>({highlightedIndex:w,onHighlightedIndexChange:T,highlightItemOnHover:b,relayKeyboardEvent:O}),[w,T,b,O]);return(0,J.jsx)(kv.Provider,{value:A,children:(0,J.jsx)(aO,{elementsRef:E,onMapChange:e=>{h?.(e),D(e)},children:k})})}var qO=q.forwardRef(function(e,t){let{activateOnFocus:n=!1,className:r,loopFocus:i=!0,render:a,style:o,...s}=e,{orientation:c,setTabMap:l,tabActivationDirection:u}=pO(),[d,f]=q.useState(0),[p,m]=q.useState(null),h=q.useRef(new Set),g=q.useRef(new Set),_=q.useRef(null);Q(()=>{if(typeof ResizeObserver>`u`)return;let e=new ResizeObserver(()=>{h.current.forEach(e=>{e()})});return _.current=e,p&&e.observe(p),g.current.forEach(t=>{e.observe(t)}),()=>{e.disconnect(),_.current=null}},[p]);let v=Z(e=>(h.current.add(e),()=>{h.current.delete(e)})),y=Z(e=>(g.current.add(e),_.current?.observe(e),()=>{g.current.delete(e),_.current?.unobserve(e)})),b={orientation:c,tabActivationDirection:u},x={"aria-orientation":c===`vertical`?`vertical`:void 0,role:`tablist`},S=q.useMemo(()=>({activateOnFocus:n,registerIndicatorUpdateListener:v,registerTabResizeObserverElement:y,tabsListElement:p}),[n,v,y,p]);return(0,J.jsx)(SO.Provider,{value:S,children:(0,J.jsx)(KO,{render:a,className:r,style:o,state:b,refs:[t,m],props:[x,s],stateAttributesMapping:hO,highlightedIndex:d,enableHomeAndEndKeys:!0,loopFocus:i,orientation:c,onHighlightedIndexChange:f,onMapChange:l,disabledIndices:qv})})});function JO({className:e,orientation:t=`horizontal`,...n}){return(0,J.jsx)(gO,{"data-slot":`tabs`,"data-orientation":t,className:X(`group/tabs flex gap-2 data-horizontal:flex-col`,e),...n})}var YO=cy(`group/tabs-list inline-flex w-fit items-center justify-center rounded-md p-[3px] text-muted-foreground group-data-horizontal/tabs:h-8 group-data-vertical/tabs:h-fit group-data-vertical/tabs:flex-col data-[variant=underline]:rounded-none`,{variants:{variant:{default:`bg-muted`,underline:`gap-1 bg-transparent`}},defaultVariants:{variant:`default`}});function XO({className:e,variant:t=`default`,...n}){return(0,J.jsx)(qO,{"data-slot":`tabs-list`,"data-variant":t,className:X(YO({variant:t}),e),...n})}function ZO({className:e,...t}){return(0,J.jsx)(wO,{"data-slot":`tabs-trigger`,className:X(`relative inline-flex h-[calc(100%-1px)] flex-1 items-center justify-center gap-1.5 rounded-md border border-transparent px-1.5 py-0.5 text-ui font-medium whitespace-nowrap text-foreground/60 transition-all group-data-vertical/tabs:w-full group-data-vertical/tabs:justify-start hover:text-foreground disabled:pointer-events-none disabled:opacity-50 has-data-[icon=inline-end]:pr-1 has-data-[icon=inline-start]:pl-1 aria-disabled:pointer-events-none aria-disabled:opacity-50 group-data-[variant=default]/tabs-list:data-active:shadow-sm group-data-[variant=underline]/tabs-list:data-active:shadow-none [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4`,`group-data-[variant=underline]/tabs-list:bg-transparent group-data-[variant=underline]/tabs-list:data-active:bg-transparent`,`data-active:bg-background data-active:text-foreground group-data-[variant=default]/tabs-list:data-active:ring-1 group-data-[variant=default]/tabs-list:data-active:ring-muted-foreground`,`after:absolute after:bg-primary after:opacity-0 after:transition-opacity group-data-horizontal/tabs:after:inset-x-0 group-data-horizontal/tabs:after:bottom-[-5px] group-data-horizontal/tabs:after:h-0.5 group-data-vertical/tabs:after:inset-y-0 group-data-vertical/tabs:after:-right-1 group-data-vertical/tabs:after:w-0.5 group-data-[variant=underline]/tabs-list:data-active:after:opacity-100`,e),...t})}function QO({className:e,...t}){return(0,J.jsx)(AO,{"data-slot":`tabs-content`,className:X(`flex-1 text-ui -outline-offset-2`,e),...t})}function $O({className:e,onSubmitShortcut:t,onKeyDown:n,...r}){return(0,J.jsx)(`textarea`,{"data-slot":`textarea`,onKeyDown:e=>{n?.(e),t!==void 0&&!e.defaultPrevented&&e.key===`Enter`&&(e.metaKey||e.ctrlKey)&&(e.preventDefault(),t())},className:X(`flex field-sizing-content min-h-16 w-full rounded-md border border-input bg-transparent px-2.5 py-2 text-ui transition-colors placeholder:text-muted-foreground disabled:cursor-not-allowed disabled:bg-input/50 disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20`,e),...r})}var ek=[{id:`nextFile`,chords:[{key:`n`}],action:`Next file`,scope:`diff`},{id:`previousFile`,chords:[{key:`p`}],action:`Previous file`,scope:`diff`},{id:`lineDown`,chords:[{key:`ArrowDown`}],action:`Focus the next line`,scope:`diff`},{id:`lineUp`,chords:[{key:`ArrowUp`}],action:`Focus the previous line`,scope:`diff`},{id:`extendDown`,chords:[{key:`ArrowDown`,shift:!0}],action:`Extend the selection down`,scope:`diff`},{id:`extendUp`,chords:[{key:`ArrowUp`,shift:!0}],action:`Extend the selection up`,scope:`diff`},{id:`comment`,chords:[{key:`c`}],action:`Comment on the selected decision, or on the focused change`,scope:`diff`},{id:`openCall`,chords:[{key:`o`}],action:`Show the code a call on the focused line runs; again for the next call`,scope:`diff`},{id:`toggleSplit`,chords:[{key:`u`}],action:`Unified or split diff`,scope:`diff`},{id:`toggleLayout`,chords:[{key:`v`}],action:`Map or overview`,scope:`global`},{id:`moveFile`,chords:[{key:`ArrowLeft`},{key:`ArrowRight`},{key:`ArrowUp`},{key:`ArrowDown`}],action:`Move between files`,scope:`overview`},{id:`openFile`,chords:[{key:`Enter`}],action:`Open the file's code in the map, or a group of files in place`,scope:`overview`},{id:`filterTree`,chords:[{key:`/`}],action:`Filter the files`,scope:`tree`},{id:`openReview`,chords:[{key:`R`,shift:!0}],action:`Open the review to publish`,scope:`global`},{id:`submit`,chords:[{key:`Enter`,mod:!0}],action:`Send the comment or review`,scope:`composer`},{id:`close`,chords:[{key:`Escape`}],action:`Close, clear the highlight, or go back to the overview`,scope:`global`},{id:`help`,chords:[{key:`?`,shift:!0}],action:`Show all shortcuts`,scope:`global`},{id:`focusLink`,chords:[{key:`/`}],action:`Paste a pull request link`,scope:`picker`},{id:`moveRow`,chords:[{key:`ArrowUp`},{key:`ArrowDown`},{key:`ArrowLeft`},{key:`ArrowRight`},{key:`Home`},{key:`End`}],action:`Move between a list's pull requests, or the activity calendar's days`,scope:`picker`},{id:`openRow`,chords:[{key:`Enter`}],action:`Open the pull request`,scope:`picker`},{id:`openInNewTab`,chords:[{key:`Enter`,mod:!0}],action:`Open the pull request or the link in a new tab`,scope:`picker`},{id:`cancelOpening`,chords:[{key:`Escape`}],action:`Stop waiting for a review to open`,scope:`picker`}],tk=new Map(ek.map(e=>[e.id,e])),nk=e=>{let t=tk.get(e);if(t===void 0)throw Error(`No shortcut ${e}`);return t},rk=new Set([`Escape`]),ik=e=>e.mod!==!0&&!rk.has(e.key),ak=e=>e.mod!==!0&&e.key.length===1,ok={ArrowDown:`↓`,ArrowUp:`↑`,ArrowLeft:`←`,ArrowRight:`→`,Enter:`↵`,Escape:`Esc`,Home:`Home`,End:`End`},sk=(e,t)=>{let n=[];return e.mod===!0&&n.push(t?`⌘`:`Ctrl`),e.shift===!0&&e.key!==`?`&&n.push(`⇧`),n.push(ok[e.key]??e.key),n},ck=(e,t,n)=>{let r=n?e.metaKey:e.ctrlKey,i=n?e.ctrlKey:e.metaKey;return e.altKey||i||r!==(t.mod===!0)||t.key.length>1&&e.shiftKey!==(t.shift===!0)?!1:e.key===t.key},lk=e=>e instanceof HTMLElement?e.isContentEditable||e instanceof HTMLTextAreaElement||e instanceof HTMLSelectElement?!0:e instanceof HTMLInputElement&&![`checkbox`,`radio`,`button`,`submit`,`reset`,`range`,`color`,`file`].includes(e.type):!1,uk=(e,t,n)=>{let r=lk(e.target);for(let i of t)for(let t of nk(i).chords)if(ck(e,t,n.mac)&&!(ik(t)&&r)&&(!ak(t)||n.singleKeys))return i;return null},dk=()=>typeof navigator<`u`&&/Mac|iPhone|iPad/.test(navigator.platform),fk=`megareviewer:singleKeyShortcuts`,pk=new Set,mk=()=>{try{return window.localStorage.getItem(fk)!==`false`}catch{return!0}},hk=e=>(pk.add(e),window.addEventListener(`storage`,e),()=>{pk.delete(e),window.removeEventListener(`storage`,e)}),gk=()=>[(0,q.useSyncExternalStore)(hk,mk),(0,q.useCallback)(e=>{try{window.localStorage.setItem(fk,String(e))}catch{}for(let e of pk)e()},[])],_k=(e,t=!0)=>{let[n]=gk(),r=(0,q.useRef)(e);r.current=e,(0,q.useEffect)(()=>{if(!t)return;let e=dk(),i=t=>{if(t.defaultPrevented)return;let i=uk(t,ek.filter(e=>r.current[e.id]!==void 0).map(e=>e.id),{mac:e,singleKeys:n});i!==null&&(t.preventDefault(),r.current[i]?.(t))};return window.addEventListener(`keydown`,i),()=>window.removeEventListener(`keydown`,i)},[t,n])};function vk({className:e,...t}){return(0,J.jsx)(`kbd`,{"data-slot":`kbd`,className:X(`pointer-events-none inline-flex h-5 w-fit min-w-5 items-center justify-center gap-1 rounded-sm border-b-2 border-border bg-muted px-1 font-mono text-kbd font-medium text-muted-foreground select-none in-data-[slot=tooltip-content]:bg-background/20 in-data-[slot=tooltip-content]:text-background [&_svg:not([class*='size-'])]:size-3`,e),...t})}function yk({className:e,...t}){return(0,J.jsx)(`kbd`,{"data-slot":`kbd-group`,className:X(`inline-flex items-center gap-1`,e),...t})}var bk=({id:e,className:t})=>{let[n]=gk(),r=(0,q.useMemo)(dk,[]),[i]=nk(e).chords;return i===void 0||!n&&ak(i)?null:(0,J.jsx)(yk,{"aria-hidden":`true`,className:X(`shrink-0`,t),children:sk(i,r).map(e=>(0,J.jsx)(vk,{children:e},e))})},xk=({hints:e,className:t})=>(0,J.jsx)(`p`,{"aria-hidden":`true`,"data-slot":`key-hint-line`,className:X(`flex flex-wrap items-center gap-x-1.5 gap-y-1 text-caption text-muted-foreground`,t),children:e.map(({id:e,action:t},n)=>(0,J.jsxs)(q.Fragment,{children:[n>0&&(0,J.jsx)(`span`,{children:`·`}),(0,J.jsx)(bk,{id:e}),(0,J.jsx)(`span`,{children:t})]},e))}),Sk={draft:`bg-review-pending`,open:`bg-thread-marker`,resolved:`bg-review-approved`,outdated:`bg-muted-foreground`},Ck=({as:e=`div`,state:t,className:n,children:r,...i})=>(0,J.jsxs)(e,{"data-slot":`comment-card`,"data-state":t,className:X(`relative rounded-lg border bg-thread-bg py-2.5 pr-4 pl-5 font-sans`,`[&_:is(textarea,input):focus-visible]:-outline-offset-1`,n),...i,children:[(0,J.jsx)(`span`,{"aria-hidden":`true`,"data-slot":`comment-bar`,className:X(`absolute top-2 bottom-2 left-1.5 w-[3px] rounded-full`,Sk[t])}),r]}),wk=e=>{let t=e.trim().split(/[\s._-]+/).filter(Boolean),n=(t.length===1?[...t[0]??``].slice(0,2):t.slice(0,2).map(e=>[...e][0]??``)).join(``).toUpperCase();return n===``?`?`:n},Tk=6e4,Ek=60*Tk,Dk=24*Ek,Ok=(e,t)=>{let n=Math.max(0,t-Date.parse(e));if(n<Tk)return`just now`;if(n<Ek)return`${Math.floor(n/Tk)}m ago`;if(n<Dk)return`${Math.floor(n/Ek)}h ago`;let r=Math.floor(n/Dk);return r<30?r===1?`yesterday`:`${r} days ago`:new Date(e).toLocaleDateString(void 0,{year:`numeric`,month:`short`,day:`numeric`})},kk=e=>new Date(e).toLocaleString(void 0,{dateStyle:`medium`,timeStyle:`short`}),Ak=(e,t,n)=>`${e===`old`?`L`:`R`}${t===null||t===n?n:`${t}–${n}`}`,jk=({children:e})=>(0,J.jsx)(`code`,{className:`rounded-sm bg-diff-hunk-bg px-1 font-mono text-code-compact text-diff-hunk-fg`,children:e}),Mk=e=>{let t=e.map(e=>e.text.endsWith(`\r`)),n=t.includes(!0)&&t.includes(!1);return e.map((e,r)=>({line:e,text:t[r]?e.text.slice(0,-1):e.text,carriageReturn:n&&t[r]===!0}))},Nk=e=>({added:e.lines.filter(e=>e.kind===`add`).length,deleted:e.lines.filter(e=>e.kind===`del`).length}),Pk=(e,t)=>t<=1?`${e}`:`${e}–${e+t-1}`,Fk=e=>e.newLines>0?`lines ${Pk(e.newStart,e.newLines)}`:`deleted lines ${Pk(e.oldStart,e.oldLines)}`,Ik={"token-keyword":`keyword`,"token-string":`string`,"token-string-expression":`string`,"token-function":`function`,"token-comment":`comment`,"token-constant":`number`},Lk=e=>{let t=/^var\(--shiki-([\w-]+)/.exec(e??``)?.[1];return t===void 0?null:Ik[t]??null},Rk=e=>{let t=[];for(let{content:n,color:r}of e){let e=Lk(r),i=t.at(-1);i!==void 0&&i.type===e?t[t.length-1]={text:i.text+n,type:e}:t.push({text:n,type:e})}return t},zk=(e,t,n)=>{let r=0,i=0;return Mk(e.lines).map(({line:e,text:a})=>{let o=e.kind===`del`?t?.[r]:n?.[i];return e.kind!==`add`&&r++,e.kind!==`del`&&i++,o!==void 0&&o.map(e=>e.text).join(``)===a?o:null})},Bk=e=>`var(--shiki-${e})`,Vk=[{scope:[`storage.type.annotation.java`,`punctuation.definition.annotation.java`,`variable.language.java`],color:Bk(`token-constant`)},{scope:[`storage.type.primitive.java`,`storage.type.primitive.array.java`,`keyword.operator.instanceof.java`],color:Bk(`token-keyword`)},{scope:[`storage.type.java`,`storage.type.generic.java`,`storage.type.object.array.java`,`storage.type.generic.wildcard.java`,`entity.other.inherited-class.java`,`meta.function-call.java`,`storage.modifier.package.java`,`storage.modifier.import.java`,`variable.other.object.java`,`variable.other.object.property.java`,`source.java keyword.operator`,`keyword.control.ternary.java`],color:Bk(`foreground`)}],Hk=1e3,Uk=(0,q.createContext)((()=>{let e=null,t=new Map,n=new Map,r=(e,t,r)=>{let i=`${r}\0${t}`,a=n.get(i)??e.getLastGrammarState(t,{lang:r,theme:`hunk`});return n.set(i,a),a},i=async()=>{let[{createHighlighterCore:e,createCssVariablesTheme:t},{createJavaScriptRegexEngine:n}]=await Promise.all([yD(()=>import(`./core-Ba9Dg9_3.js`),[]),yD(()=>import(`./engine-javascript-D-6se_EF.js`),[])]),r=t({name:`hunk`,variablePrefix:`--shiki-`});return e({themes:[{...r,tokenColors:[...r.tokenColors??[],...Vk.map(({scope:e,color:t})=>({scope:[...e],settings:{foreground:t}}))]}],langs:[],engine:n()})},a=(e,n)=>{let r=t.get(n)??(async()=>{let t=xD[n];return t!==void 0&&(await e.loadLanguage(...(await t()).default),!0)})();return t.set(n,r),r};return{async highlight(t,n){if(xD[n]===void 0)return null;e??=i();let o=await e;if(!await a(o,n))return null;let s=ND(t,n);return o.codeToTokensBase(t,{lang:n,theme:`hunk`,tokenizeMaxLineLength:Hk,...s===``?{}:{grammarState:r(o,s,n)}}).map(e=>Rk(e))}}})()),Wk=new WeakMap,Gk=(e,t,n)=>{let r=Wk.get(e)??new Map;Wk.set(e,r);let i=`${n}\0${t.id}\0${t.oldStart},${t.newStart},${t.lines.length}`,a=r.get(i);if(a!==void 0)return a;let o=Mk(t.lines),s=ED(o),c=(t,r)=>r?e.highlight(t,n):Promise.resolve(null),l={promise:Promise.all([c(s.old,o.some(({line:e})=>e.kind!==`add`)),c(s.new,o.some(({line:e})=>e.kind!==`del`))]).then(([e,n])=>{let r=zk(t,e,n);return l.value=r,r}),value:null};return r.set(i,l),l},Kk=`1200px 0px`,qk=null,Jk=new Map,Yk=(e,t)=>(qk??=new IntersectionObserver(e=>{for(let t of e)t.isIntersecting&&(Jk.get(t.target)?.(),Jk.delete(t.target),qk?.unobserve(t.target))},{rootMargin:Kk}),Jk.set(e,t),qk.observe(e),()=>{Jk.delete(e),qk?.unobserve(e)}),Xk=e=>{let[t,n]=(0,q.useState)(()=>typeof IntersectionObserver>`u`);return(0,q.useEffect)(()=>{let r=e.current;if(!(t||r===null))return Yk(r,()=>n(!0))},[e,t]),t},Zk=(e,t,n=!0)=>{let r=(0,q.useContext)(Uk),i=TD(t),a=i===null||!n?null:Gk(r,e,i),[o,s]=(0,q.useState)();return(0,q.useEffect)(()=>{if(a===null)return;let e=!0;return a.promise.then(t=>{e&&s(e=>e?.entry===a?e:{entry:a,tokens:t})}),()=>{e=!1}},[a]),a?.value??(o?.entry===a?o.tokens:null)},Qk=(e,t)=>{let n=(0,q.useContext)(Uk),r=TD(t),[i,a]=(0,q.useState)(null);return(0,q.useEffect)(()=>{if(r===null||e===null)return;let t=!0;return n.highlight(e.join(`
|
|
80
|
-
`),r).then(n=>{t&&n!==null&&a({lines:e,tokens:e.map((e,t)=>{let r=n[t];return r!==void 0&&r.map(e=>e.text).join(``)===e?r:null})})}),()=>{t=!1}},[n,r,e]),i?.lines===e?i.tokens:null}
|
|
81
|
-
`),e===null?null:n),a=
|
|
82
|
-
`),n);return(0,J.jsxs)(`div`,{"data-slot":`suggestion-diff`,className:`overflow-x-auto rounded-md border font-mono text-code-compact`,children:[r!==void 0&&(0,J.jsx)(`p`,{className:`border-b px-2 py-1 font-sans text-caption font-medium text-primary`,children:r}),(e??[]).map((e,t)=>(0,J.jsx)(nA,{kind:`del`,text:e,tokens:i?.[t]},`del:${t}`)),t.map((e,t)=>(0,J.jsx)(nA,{kind:`add`,text:e,tokens:a?.[t]},`add:${t}`)),t.length===0&&(0,J.jsxs)(`p`,{className:`px-2 py-1 font-sans text-caption text-muted-foreground`,children:[`Deletes`,` `,e===null?`the lines`:e.length===1?`the line`:`the ${e.length} lines`,`.`]})]})},iA=q.createContext(void 0);function aA(e){let t=q.useContext(iA);if(!e&&t===void 0)throw Error(Ov(27));return t}var oA=q.forwardRef(function(e,t){let{render:n,className:r,style:i,forceRender:a=!1,...o}=e,s=aA(),c=s.useState(`open`),l=s.useState(`nested`),u=s.useState(`mounted`);return Qv(`div`,e,{state:{open:c,transitionStatus:s.useState(`transitionStatus`)},ref:[s.context.backdropRef,t],stateAttributesMapping:hb,props:[{role:`presentation`,hidden:!u,style:{userSelect:`none`,WebkitUserSelect:`none`}},o],enabled:a||!l})}),sA=q.forwardRef(function(e,t){let{render:n,className:r,style:i,disabled:a=!1,nativeButton:o=!0,...s}=e,c=aA(),l=c.useState(`open`),{getButtonProps:u,buttonRef:d}=Pv({disabled:a,native:o}),f={disabled:a};function p(e){l&&c.setOpen(!1,Ab(Rb,e.nativeEvent))}return Qv(`button`,e,{state:f,ref:[t,d],props:[{onClick:p},s,u]})}),cA=q.forwardRef(function(e,t){let{render:n,className:r,style:i,id:a,...o}=e,s=aA(),c=gE(a);return s.useSyncedValueWithCleanup(`descriptionElementId`,c),Qv(`p`,e,{ref:t,props:[{id:c},o]})}),lA=q.createContext(void 0);function uA(){let e=q.useContext(lA);if(e===void 0)throw Error(Ov(26));return e}var dA=`--nested-dialogs`,fA=`data-nested-dialog-open`,pA={...mb,...tb,nestedDialogOpen(e){return e?{[fA]:``}:null}},mA=q.forwardRef(function(e,t){let{render:n,className:r,style:i,finalFocus:a,initialFocus:o,...s}=e,c=aA(),l=c.useState(`descriptionElementId`),u=c.useState(`disablePointerDismissal`),d=c.useState(`floatingRootContext`),f=c.useState(`popupProps`),p=c.useState(`modal`),m=c.useState(`mounted`),h=c.useState(`nested`),g=c.useState(`nestedOpenDialogCount`),_=c.useState(`open`),v=c.useState(`openMethod`),y=c.useState(`titleElementId`),b=c.useState(`transitionStatus`),x=c.useState(`role`),S=d.useState(`floatingId`);uA(),zC({open:_,ref:c.context.popupRef,onComplete(){_&&c.context.onOpenChangeComplete?.(!0)}});let C=o===void 0?HC(c.context.popupRef):o,w=g>0,T=c.useStateSetter(`popupElement`),E=Qv(`div`,e,{state:{open:_,nested:h,transitionStatus:b,nestedDialogOpen:w},props:[f,{id:S,"aria-labelledby":y,"aria-describedby":l,role:x,...VC,hidden:!m,onKeyDown(e){IO.has(e.key)&&e.stopPropagation()},style:{[dA]:g}},s],ref:[t,c.context.popupRef,T],stateAttributesMapping:pA});return(0,J.jsx)(pC,{context:d,openInteractionType:v,disabled:!m,closeOnFocusOut:!u,initialFocus:C,returnFocus:a,modal:p!==!1,restoreFocus:`popup`,children:E})}),hA=q.forwardRef(function(e,t){let{cutout:n,...r}=e,i;if(n){let e=n.getBoundingClientRect();i=`polygon(0% 0%,100% 0%,100% 100%,0% 100%,0% 0%,${e.left}px ${e.top}px,${e.left}px ${e.bottom}px,${e.right}px ${e.bottom}px,${e.right}px ${e.top}px,${e.left}px ${e.top}px)`}return(0,J.jsx)(`div`,{ref:t,role:`presentation`,"data-base-ui-inert":``,...r,style:{position:`fixed`,inset:0,userSelect:`none`,WebkitUserSelect:`none`,clipPath:i}})}),gA=q.forwardRef(function(e,t){let{keepMounted:n=!1,...r}=e,i=aA(),a=i.useState(`mounted`),o=i.useState(`modal`),s=i.useState(`open`);return a||n?(0,J.jsx)(lA.Provider,{value:n,children:(0,J.jsxs)(JS,{ref:t,...r,children:[a&&o===!0&&(0,J.jsx)(hA,{ref:i.context.internalBackdropRef,inert:UE(!s)}),e.children]})}):null}),_A={},vA={},yA=``;function bA(e,t){return H_(e)?e:t}function xA(e,t,n){return/hidden|clip/.test(e.getComputedStyle(bA(t,n)).overflowY)}function SA(e){if(typeof document>`u`)return!1;let t=Mv(e);return I_(t).innerWidth-t.documentElement.clientWidth>0}function CA(e){if(!(typeof CSS<`u`&&CSS.supports&&CSS.supports(`scrollbar-gutter`,`stable`))||typeof document>`u`)return!1;let t=Mv(e),n=t.documentElement,r=t.body,i=bA(n,r),a=i.style.overflowY,o=n.style.scrollbarGutter;n.style.scrollbarGutter=`stable`,i.style.overflowY=`scroll`;let s=i.offsetWidth;i.style.overflowY=`hidden`;let c=i.offsetWidth;return i.style.overflowY=a,n.style.scrollbarGutter=o,s===c}function wA(e){let t=Mv(e),n=t.documentElement,r=t.body,i=bA(n,r),a={overflowY:i.style.overflowY,overflowX:i.style.overflowX};return Object.assign(i.style,{overflowY:`hidden`,overflowX:`hidden`}),()=>{Object.assign(i.style,a)}}function TA(e){let t=Mv(e),n=t.documentElement,r=t.body,i=I_(n),a=0,o=0,s=!1,c=sx.create();if(My&&(i.visualViewport?.scale??1)!==1)return()=>{};function l(){let t=i.getComputedStyle(n),c=i.getComputedStyle(r),l=(t.scrollbarGutter||``).includes(`both-edges`)?`stable both-edges`:`stable`;a=n.scrollTop,o=n.scrollLeft,_A={scrollbarGutter:n.style.scrollbarGutter,overflowY:n.style.overflowY,overflowX:n.style.overflowX},yA=n.style.scrollBehavior,vA={position:r.style.position,height:r.style.height,width:r.style.width,boxSizing:r.style.boxSizing,overflowY:r.style.overflowY,overflowX:r.style.overflowX,scrollBehavior:r.style.scrollBehavior};let u=n.scrollHeight>n.clientHeight,d=n.scrollWidth>n.clientWidth,f=t.overflowY===`scroll`||c.overflowY===`scroll`,p=t.overflowX===`scroll`||c.overflowX===`scroll`,m=Math.max(0,i.innerWidth-r.clientWidth),h=Math.max(0,i.innerHeight-r.clientHeight),g=parseFloat(c.marginTop)+parseFloat(c.marginBottom),_=parseFloat(c.marginLeft)+parseFloat(c.marginRight),v=bA(n,r);s=CA(e),s?(n.style.scrollbarGutter=l,v.style.overflowY=`hidden`,v.style.overflowX=`hidden`):(Object.assign(n.style,{scrollbarGutter:l,overflowY:`hidden`,overflowX:`hidden`}),(u||f)&&(n.style.overflowY=`scroll`),(d||p)&&(n.style.overflowX=`scroll`),Object.assign(r.style,{position:`relative`,height:g||h?`calc(100dvh - ${g+h}px)`:`100dvh`,width:_||m?`calc(100vw - ${_+m}px)`:`100vw`,boxSizing:`border-box`,overflowY:`hidden`,overflowX:`hidden`,scrollBehavior:`unset`}),r.scrollTop=a,r.scrollLeft=o,n.setAttribute(`data-base-ui-scroll-locked`,``),n.style.scrollBehavior=`unset`)}function u(){Object.assign(n.style,_A),Object.assign(r.style,vA),s||(n.scrollTop=a,n.scrollLeft=o,n.removeAttribute(`data-base-ui-scroll-locked`),n.style.scrollBehavior=yA)}function d(){u(),c.request(l)}l();let f=tx(i,`resize`,d);return()=>{c.cancel(),u(),typeof i.removeEventListener==`function`&&f()}}var EA=new class{lockCount=0;restore=null;timeoutLock=yy.create();timeoutUnlock=yy.create();acquire(e){return this.lockCount+=1,this.lockCount===1&&this.restore===null&&this.timeoutLock.start(0,()=>this.lock(e)),this.release}release=()=>{--this.lockCount,this.lockCount===0&&this.restore&&this.timeoutUnlock.start(0,this.unlock)};unlock=()=>{this.lockCount===0&&this.restore&&(this.restore?.(),this.restore=null)};lock(e){if(this.lockCount===0||this.restore!==null)return;let t=Mv(e),n=t.documentElement,r=t.body,i=I_(n);if(xA(i,n,r)){let t=new i.MutationObserver(()=>{xA(i,n,r)||(t.disconnect(),this.restore=null,this.lock(e))}),a={attributes:!0};t.observe(n,a),t.observe(r,a),this.restore=()=>t.disconnect();return}let a=Dy||!SA(e);this.restore=a?wA(e):TA(e)}};function DA(e=!0,t=null){Q(()=>{if(e)return EA.acquire(t)},[e,t])}function OA({store:e,parentContext:t,isDrawer:n}){let r=e.useState(`open`),i=e.useState(`mounted`),a=e.useState(`disablePointerDismissal`),o=e.useState(`modal`),s=e.useState(`popupElement`),c=e.useState(`floatingRootContext`),[l,u]=q.useState(0),[d,f]=q.useState(0),p=l===0,m=bC(c,{outsidePressEvent(){return e.context.internalBackdropRef.current||e.context.backdropRef.current?`intentional`:{mouse:o===`trap-focus`?`sloppy`:`intentional`,touch:`sloppy`}},outsidePress(t){if(!e.context.outsidePressEnabledRef.current||`button`in t&&t.button!==0)return!1;if(`touches`in t){if(t.type===`touchend`){if(t.changedTouches.length!==1||t.touches.length!==0)return!1}else if(t.touches.length!==1)return!1}let n=Wy(t);if(p&&!a){if(o){let t=e.context.internalBackdropRef.current,r=e.context.backdropRef.current;return t||r?t===n||r===n||Hy(n,s)&&!n?.hasAttribute(`data-base-ui-portal`):!0}return!0}return!1},escapeKey:p});return DA(r&&o===!0,s),e.useContextCallback(`onNestedDialogOpen`,(t,n)=>{(e.select(`open`)||e.select(`mounted`))&&(u(t),f(n))}),Q(()=>{!r&&!i&&(u(0),f(0))},[r,i]),Q(()=>(t?.onNestedDialogOpen&&r&&t.onNestedDialogOpen(l+1,d+ +!!n),()=>{t?.onNestedDialogOpen&&r&&t.onNestedDialogOpen(0,0)}),[n,r,l,d,t]),$C(e,{activeTriggerProps:m.reference,inactiveTriggerProps:m.trigger,popupProps:m.floating,nestedOpenDialogCount:l,nestedOpenDrawerCount:d}),null}var kA={...Cw,modal:e=>e.modal,nested:e=>e.nested,nestedOpenDialogCount:e=>e.nestedOpenDialogCount,nestedOpenDrawerCount:e=>e.nestedOpenDrawerCount,disablePointerDismissal:e=>e.disablePointerDismissal,openMethod:e=>e.openMethod,descriptionElementId:e=>e.descriptionElementId,titleElementId:e=>e.titleElementId,viewportElement:e=>e.viewportElement,role:e=>e.role},AA=class extends mw{constructor(e,t,n){let r=new tw,i=jA(e,r,t,n);super(i,MA(r),kA)}setOpen=(e,t)=>{t.preventUnmountOnClose=()=>{this.set(`preventUnmountingOnClose`,!0)},!e&&t.trigger==null&&this.state.activeTriggerId!=null&&(t.trigger=this.state.activeTriggerElement??void 0),this.context.onOpenChange?.(e,t),!t.isCanceled&&(this.state.floatingRootContext.dispatchOpenChange(e,t),this.update(qC(this.state,e,t.trigger)))}};function jA(e,t,n,r=!1){return{..._w(t,n,r),modal:!0,disablePointerDismissal:!1,viewportElement:null,descriptionElementId:void 0,titleElementId:void 0,openMethod:null,nested:!1,nestedOpenDialogCount:0,nestedOpenDrawerCount:0,role:`dialog`,...e}}function MA(e){return{popupRef:q.createRef(),backdropRef:q.createRef(),internalBackdropRef:q.createRef(),outsidePressEnabledRef:{current:!0},triggerElements:e,onOpenChange:void 0,onOpenChangeComplete:void 0}}function NA(e,t){let{children:n,open:r,defaultOpen:i=!1,onOpenChange:a,onOpenChangeComplete:o,disablePointerDismissal:s=!1,modal:c=!0,actionsRef:l,handle:u,triggerId:d,defaultTriggerId:f=null}=t,p=e===`drawer`,m=e===`alert-dialog`,h=m?!0:c,g=m||s,_=m?`alertdialog`:`dialog`,v=aA(!0),y={modal:h,disablePointerDismissal:g,nested:v!=null,role:_},b=UC((e,t)=>new AA({open:i,openProp:r,activeTriggerId:f,triggerIdProp:d,...y},e,t),!0);b.useControlledProp(`openProp`,r),b.useControlledProp(`triggerIdProp`,d),b.useSyncedValues(y),b.useContextCallback(`onOpenChange`,a),b.useContextCallback(`onOpenChangeComplete`,o);let x=b.useState(`open`),S=b.useState(`mounted`),C=b.useState(`payload`);ew(b,x),ZC(b);let{forceUnmount:w}=QC(x,b);q.useImperativeHandle(l,()=>({unmount:w,close:()=>b.setOpen(!1,Ab(Yb))}),[w,b]);let T=x||S||u!=null;return(0,J.jsxs)(iA.Provider,{value:b,children:[u&&(0,J.jsx)(WC,{handle:u,store:b}),T&&(0,J.jsx)(OA,{store:b,parentContext:v?.context,isDrawer:p}),typeof n==`function`?n({payload:C}):n]})}var PA=my(function(e){return NA(`dialog`,e)}),FA=q.forwardRef(function(e,t){let{render:n,className:r,style:i,id:a,...o}=e,s=aA(),c=gE(a);return s.useSyncedValueWithCleanup(`titleElementId`,c),Qv(`h2`,e,{ref:t,props:[{id:c},o]})});function IA(e){let t=q.useRef(``),n=q.useCallback(n=>{n.defaultPrevented||(t.current=n.pointerType,e(n,n.pointerType))},[e]);return{onClick:q.useCallback(n=>{n.detail===0?e(n,`keyboard`):(`pointerType`in n?e(n,n.pointerType):e(n,t.current),t.current=``)},[e]),onPointerDown:n}}function LA(e,t){let n=q.useRef(e),r=Z(t);Q(()=>{n.current!==e&&r(n.current),n.current=e},[e,r])}function RA(e,t){let{onClick:n,onPointerDown:r}=IA(Z((n,r)=>{(typeof e==`function`?e():e)||t(r||(Dy?`touch`:``))}));return q.useMemo(()=>({onClick:n,onPointerDown:r}),[n,r])}function zA(e){let[t,n]=q.useState(null),r=RA(e,n);return LA(e,t=>{t&&!e&&n(null)}),q.useMemo(()=>({openMethod:t,triggerProps:r}),[t,r])}function BA({...e}){return(0,J.jsx)(PA,{"data-slot":`dialog`,...e})}function VA({...e}){return(0,J.jsx)(gA,{"data-slot":`dialog-portal`,...e})}function HA({className:e,...t}){return(0,J.jsx)(oA,{"data-slot":`dialog-overlay`,className:X(`fixed inset-0 isolate z-50 bg-background/70 duration-(--duration-fast) supports-backdrop-filter:backdrop-blur-xs data-open:animate-in data-open:fade-in-0 data-closed:animate-out data-closed:fade-out-0`,e),...t})}function UA({className:e,children:t,showCloseButton:n=!0,...r}){return(0,J.jsxs)(VA,{children:[(0,J.jsx)(HA,{}),(0,J.jsxs)(mA,{"data-slot":`dialog-content`,className:X(`fixed top-1/2 left-1/2 z-50 grid w-full max-w-[calc(100%-2rem)] -translate-x-1/2 -translate-y-1/2 gap-4 rounded-xl bg-popover p-4 text-ui text-popover-foreground ring-1 ring-foreground/10 duration-(--duration-fast) outline-none sm:max-w-sm data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95`,e),...r,children:[t,n&&(0,J.jsxs)(sA,{"data-slot":`dialog-close`,render:(0,J.jsx)($,{variant:`ghost`,className:`absolute top-2 right-2`,size:`icon-sm`}),children:[(0,J.jsx)(b_,{}),(0,J.jsx)(`span`,{className:`sr-only`,children:`Close`})]})]})]})}function WA({className:e,...t}){return(0,J.jsx)(`div`,{"data-slot":`dialog-header`,className:X(`flex flex-col gap-2`,e),...t})}function GA({className:e,...t}){return(0,J.jsx)(FA,{"data-slot":`dialog-title`,className:X(`text-heading font-semibold`,e),...t})}function KA({className:e,...t}){return(0,J.jsx)(cA,{"data-slot":`dialog-description`,className:X(`text-ui text-muted-foreground *:[a]:underline *:[a]:underline-offset-3 *:[a]:hover:text-foreground`,e),...t})}var qA=({src:e,alt:t,onClose:n})=>(0,J.jsx)(BA,{open:!0,onOpenChange:e=>{e||n()},children:(0,J.jsxs)(UA,{"data-slot":`image-viewer`,className:`top-0 left-0 flex h-dvh w-screen max-w-none translate-x-0 translate-y-0 items-center justify-center rounded-none bg-background/95 p-4 pt-12 ring-0 sm:max-w-none`,onClick:e=>{e.target===e.currentTarget&&n()},children:[(0,J.jsx)(GA,{className:`sr-only`,children:t}),(0,J.jsx)(`img`,{src:e,alt:t,className:`max-h-full max-w-full object-contain`})]})}),JA=e=>e===null?null:TD({path:`code.${e}`,language:e}),YA=({text:e,language:t})=>{let n=eA(e,JA(t)),r=e.split(`
|
|
83
|
-
`);return(0,J.jsx)(`pre`,{"data-slot":`thread-code`,className:`overflow-x-auto rounded-md border bg-surface-subtle px-2.5 py-1.5 font-mono text-code-compact`,children:(0,J.jsx)(`code`,{children:r.map((e,t)=>(0,J.jsx)(`span`,{className:`block min-h-[1lh] whitespace-pre`,children:(0,J.jsx)(tA,{text:e,tokens:n?.[t]})},t))})})},XA=({kind:e,alt:t,src:n,size:r})=>{let[i,a]=(0,q.useState)(!1),[o,s]=(0,q.useState)(!1);if(i)return(0,J.jsxs)(`span`,{"data-slot":`thread-image`,className:`inline-flex items-center gap-1 rounded-sm border bg-muted px-1 text-caption text-muted-foreground`,children:[(0,J.jsx)(Ag,{"aria-hidden":`true`,className:`size-3`}),e===`image`?`Image`:`Video`,t===``?``:`: ${t}`,` couldn't be loaded`]});let c=`block max-h-[28rem] max-w-full rounded-md border bg-muted`,l=t===``?`Image from the comment`:t;return e===`image`?(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(`button`,{type:`button`,"aria-label":`Open ${l} full screen`,onClick:()=>s(!0),className:`block max-w-full cursor-zoom-in rounded-md`,children:(0,J.jsx)(`img`,{"data-slot":`thread-media`,src:n,alt:l,...r===void 0?{}:{width:r.width,height:r.height},loading:`lazy`,onError:()=>a(!0),className:X(c,`h-auto w-auto`)})}),o&&(0,J.jsx)(qA,{src:n,alt:l,onClose:()=>s(!1)})]}):(0,J.jsx)(`video`,{"data-slot":`thread-media`,src:n,controls:!0,preload:`metadata`,onError:()=>a(!0),className:c})},ZA=({span:e,mediaUrl:t})=>{switch(e.kind){case`text`:return(0,J.jsx)(J.Fragment,{children:e.text});case`code`:return(0,J.jsx)(`code`,{className:`rounded-sm bg-muted px-1 font-mono text-code-compact`,children:e.text});case`strong`:return(0,J.jsx)(`strong`,{className:`font-semibold`,children:(0,J.jsx)(QA,{spans:e.spans,mediaUrl:t})});case`emphasis`:return(0,J.jsx)(`em`,{children:(0,J.jsx)(QA,{spans:e.spans,mediaUrl:t})});case`strike`:return(0,J.jsx)(`del`,{children:(0,J.jsx)(QA,{spans:e.spans,mediaUrl:t})});case`link`:return e.url===null?(0,J.jsx)(QA,{spans:e.spans,mediaUrl:t}):(0,J.jsx)(`a`,{href:e.url,title:e.url,target:`_blank`,rel:`noreferrer noopener nofollow`,className:`underline`,children:(0,J.jsx)(QA,{spans:e.spans,mediaUrl:t})});case`image`:case`video`:{if(e.url!==null&&t)return(0,J.jsx)(XA,{kind:e.kind,alt:e.text,src:t(e.url),size:e.size});let n=e.kind===`image`?`Image`:`Video`;return(0,J.jsxs)(`span`,{"data-slot":`thread-image`,className:`inline-flex items-center gap-1 rounded-sm border bg-muted px-1 text-caption text-muted-foreground`,children:[(0,J.jsx)(Ag,{"aria-hidden":`true`,className:`size-3`}),e.text===``?n:`${n}: ${e.text}`,(0,J.jsx)(`span`,{className:`sr-only`,children:`, not loaded: it isn't in the host's own attachments`})]})}}},QA=({spans:e,mediaUrl:t})=>e.map((e,n)=>(0,J.jsx)(ZA,{span:e,mediaUrl:t},`${e.kind}:${n}`)),$A={1:`text-heading font-semibold`,2:`text-heading font-semibold`,3:`text-body font-semibold`},ej={left:`text-left`,center:`text-center`,right:`text-right`},tj=({blocks:e,...t})=>e.map((e,n)=>(0,J.jsx)(nj,{block:e,...t},`${e.kind}:${n}`)),nj=({block:e,suggestion:t,mediaUrl:n})=>{switch(e.kind){case`suggestion`:return(0,J.jsx)(`div`,{children:t(e.lines)});case`code`:return(0,J.jsx)(YA,{text:e.text,language:e.language});case`paragraph`:return(0,J.jsx)(`p`,{className:`whitespace-pre-wrap`,children:(0,J.jsx)(QA,{spans:e.spans,mediaUrl:n})});case`heading`:return(0,J.jsx)(`p`,{"data-slot":`thread-heading`,className:X(`whitespace-pre-wrap`,$A[e.level]??`font-semibold`),children:(0,J.jsx)(QA,{spans:e.spans,mediaUrl:n})});case`quote`:return(0,J.jsx)(`blockquote`,{className:`flex flex-col gap-2 border-l-2 border-border pl-3 text-muted-foreground`,children:(0,J.jsx)(tj,{blocks:e.blocks,suggestion:t,mediaUrl:n})});case`list`:{let r=e.items.map((e,r)=>(0,J.jsx)(`li`,{className:X(`pl-1`,e.checked!==null&&`list-none -ml-5 pl-0`),children:(0,J.jsxs)(`div`,{className:`flex items-baseline gap-1.5`,children:[e.checked!==null&&(0,J.jsx)(`span`,{"aria-hidden":`true`,className:`w-4 shrink-0 text-center`,children:e.checked?`☑`:`☐`}),e.checked!==null&&(0,J.jsx)(`span`,{className:`sr-only`,children:e.checked?`Done: `:`Not done: `}),(0,J.jsx)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-1`,children:(0,J.jsx)(tj,{blocks:e.blocks,suggestion:t,mediaUrl:n})})]})},r));return e.ordered?(0,J.jsx)(`ol`,{start:e.start,className:`flex list-decimal flex-col gap-1 pl-5`,children:r}):(0,J.jsx)(`ul`,{className:`flex list-disc flex-col gap-1 pl-5`,children:r})}case`table`:return(0,J.jsx)(`div`,{className:`overflow-x-auto`,children:(0,J.jsxs)(`table`,{className:`border-collapse text-ui`,children:[(0,J.jsx)(`thead`,{children:(0,J.jsx)(`tr`,{children:e.head.map((t,r)=>(0,J.jsx)(`th`,{className:X(`border bg-muted px-2 py-1 font-semibold`,ej[e.align[r]??`left`]),children:(0,J.jsx)(QA,{spans:t,mediaUrl:n})},r))})}),(0,J.jsx)(`tbody`,{children:e.rows.map((t,r)=>(0,J.jsx)(`tr`,{children:t.map((t,r)=>(0,J.jsx)(`td`,{className:X(`border px-2 py-1`,ej[e.align[r]??`left`]),children:(0,J.jsx)(QA,{spans:t,mediaUrl:n})},r))},r))})]})});case`rule`:return(0,J.jsx)(`hr`,{className:`border-border`})}},rj=({blocks:e,suggestion:t,mediaUrl:n})=>(0,J.jsx)(`div`,{"data-slot":`thread-body`,className:`flex flex-col gap-2 text-body break-words`,children:(0,J.jsx)(tj,{blocks:e,suggestion:t,mediaUrl:n})}),ij=`inline-flex items-center gap-1 rounded-sm border px-1.5 text-caption font-medium`,aj=`shadow-[inset_0_0_0_2px_var(--ring)]`,oj=({name:e})=>(0,J.jsx)(`span`,{"aria-hidden":`true`,className:`flex size-6 shrink-0 items-center justify-center rounded-full bg-muted text-caption font-medium text-muted-foreground`,children:wk(e)}),sj=e=>{let t=e.line??e.originalLine;if(t===null)return e.path;let n=e.side===`old`?`old `:``;return e.startLine!==null&&e.line!==null?`${n}lines ${e.startLine}–${t}`:`${n}line ${t}`},cj=e=>{let t=[];for(let n of e){let e=t.at(-1);e!==void 0&&e[0]?.author.id===n.author.id?e.push(n):t.push([n])}return t},lj=({thread:e,authorId:t,now:n,language:r,covered:i,onReply:a,onResolve:o,replying:s=!1,mediaUrl:c,initialReply:l,current:u=!1,anchorId:d,linesAbove:f=0,className:p})=>{let[m,h]=(0,q.useState)(!e.resolved||u),[g,_]=(0,q.useState)(u);u!==g&&(_(u),u&&h(!0));let[v,y]=(0,q.useState)(l!==void 0),[b,x]=(0,q.useState)(0),[S,C]=(0,q.useState)(l?.text??``),[w,T]=(0,q.useState)(l?.status===`posting`),[E,D]=(0,q.useState)(l?.status===`failed`?l.error??``:null),[O,k]=(0,q.useState)(!1),[A,j]=(0,q.useState)(null),M=(0,q.useRef)(null),N=(0,q.useId)(),P=e.resolved?`resolved`:e.outdated?`outdated`:`open`,F=!e.outdated&&e.line!==null&&e.side===`new`,I=a!==void 0&&e.can.reply,L=o!==void 0&&e.can.resolve,R=I&&(v||S!==``||w||E!==null),ee=()=>{h(!0),y(!0),x(e=>e+1)};(0,q.useEffect)(()=>{b>0&&M.current?.focus()},[b]),(0,q.useEffect)(()=>{s&&ee()},[s]);let z=()=>M.current?.closest(`[data-slot=review-thread]`)?.focus(),te=()=>{w||(z(),C(``),D(null),y(!1))},B=async()=>{let e=S.trim();if(e===``||w||a===void 0)return;let t=M.current?.closest(`[data-slot=review-thread]`);T(!0),D(null);let n=await a(e);T(!1),n===null?(C(``),y(!1),t?.focus()):D(n)},ne=async()=>{if(o===void 0||O)return;k(!0),j(null);let t=await o(!e.resolved);k(!1),t===null?h(e.resolved):j(t)},V=e=>(0,J.jsx)(rA,{title:`Suggested change`,removed:F?i:null,added:e,language:r}),H=e=>(0,J.jsx)(`time`,{dateTime:e.createdAt,title:kk(e.createdAt),className:`ml-auto shrink-0 pl-3 text-caption text-muted-foreground`,children:Ok(e.createdAt,n)}),re=e=>{let[n]=e;return n===void 0?null:(0,J.jsxs)(`section`,{"data-slot":`thread-group`,className:`grid grid-cols-[1.5rem_minmax(0,1fr)] gap-x-2.5 gap-y-0.5`,children:[(0,J.jsx)(oj,{name:n.author.name}),(0,J.jsxs)(`header`,{className:`flex min-w-0 flex-wrap items-center gap-x-2 gap-y-0.5`,children:[(0,J.jsx)(`span`,{className:`font-medium`,children:n.author.name}),t!==null&&n.author.id===t&&(0,J.jsx)(`span`,{className:X(`inline-flex items-center gap-1 rounded-sm border px-1.5 text-caption font-medium`,`border-border bg-muted text-muted-foreground`),children:`Author`}),H(n)]}),e.length>1?(0,J.jsx)(`span`,{"data-slot":`thread-run`,"aria-hidden":`true`,className:`flex justify-center pt-1.5 pb-1`,children:(0,J.jsx)(`span`,{className:`w-px bg-thread-run`})}):(0,J.jsx)(`span`,{"aria-hidden":`true`}),(0,J.jsx)(`div`,{className:`flex min-w-0 flex-col gap-3`,children:e.map((e,t)=>{let{blocks:n}=Vd(e.body);return(0,J.jsxs)(`div`,{"data-slot":`thread-comment`,className:`flex items-baseline`,children:[(0,J.jsx)(`div`,{className:`flex min-w-0 flex-1 flex-col items-start gap-1.5`,children:(0,J.jsx)(`div`,{className:`w-full`,children:(0,J.jsx)(rj,{blocks:n,suggestion:V,...c===void 0?{}:{mediaUrl:c}})})}),t>0&&H(e)]},e.id)})})]})},[ie]=e.comments,ae=e.line??e.originalLine,oe=e.resolvedBy?.name,se=I||L;return(0,J.jsx)(Ck,{as:`article`,state:P,"data-slot":`review-thread`,id:d,"data-current":u||void 0,"aria-label":`Thread on ${sj(e)}${e.resolved?`, resolved`:``}`,tabIndex:-1,style:vh({"--lines-above":Math.min(f,5)}),className:X(`flex scroll-mt-[calc(6rem+var(--lines-above)*var(--text-code--line-height))] flex-col gap-3 -outline-offset-2`,!m&&`py-1.5`,u&&aj,p),children:m?(0,J.jsxs)(J.Fragment,{children:[(0,J.jsxs)(`div`,{"data-slot":`thread-header`,className:`flex flex-wrap items-center gap-x-1.5 gap-y-1 text-caption text-muted-foreground`,children:[ae!==null&&(0,J.jsxs)(J.Fragment,{children:[e.startLine!==null&&e.line!==null?`Lines`:`Line`,` `,(0,J.jsx)(jk,{children:Ak(e.side,e.line===null?null:e.startLine,ae)}),(0,J.jsx)(`span`,{children:`·`})]}),(0,J.jsxs)(`span`,{children:[e.comments.length,` `,e.comments.length===1?`comment`:`comments`]}),e.outdated&&(0,J.jsx)(`span`,{className:X(`inline-flex items-center gap-1 rounded-sm border px-1.5 text-caption font-medium`,`border-border bg-muted text-muted-foreground`),children:`Outdated`}),e.resolved&&(0,J.jsxs)(J.Fragment,{children:[(0,J.jsxs)(`span`,{className:`text-review-approved`,children:[(0,J.jsx)(`span`,{"aria-hidden":`true`,children:`✓ `}),`Resolved`,oe===void 0?``:` by ${oe}`]}),(0,J.jsx)($,{variant:`ghost`,size:`sm`,onClick:()=>h(!1),"aria-expanded":!0,children:`Hide`})]})]}),cj(e.comments).map((e,t)=>(0,J.jsxs)(q.Fragment,{children:[t>0&&(0,J.jsx)(`hr`,{"data-slot":`thread-divider`}),re(e)]},e[0]?.id??t)),A!==null&&(0,J.jsxs)(`p`,{role:`alert`,className:`text-caption text-destructive`,children:[`✕ `,e.resolved?`Not reopened`:`Not resolved`,`: `,A]}),R?(0,J.jsxs)(`div`,{"data-slot":`thread-reply`,className:`flex flex-col gap-1.5 border-t pt-3 pl-8.5`,children:[(0,J.jsxs)(`label`,{htmlFor:N,className:`sr-only`,children:[`Reply to the thread on `,sj(e)]}),(0,J.jsx)($O,{id:N,ref:M,rows:2,value:S,placeholder:`Reply…`,disabled:w,"aria-invalid":E!==null||void 0,onChange:e=>C(e.target.value),onSubmitShortcut:()=>void B(),onKeyDown:e=>{e.key===`Escape`&&(e.stopPropagation(),te())},className:`min-h-14 bg-background`}),E!==null&&(0,J.jsxs)(`p`,{role:`alert`,className:`text-caption text-destructive`,children:[`✕ Not sent: `,E,` Your reply is still here; send it again when you're ready.`]}),(0,J.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,J.jsx)(xk,{hints:[{id:`submit`,action:`reply`},{id:`close`,action:`cancel`}]}),(0,J.jsxs)(`div`,{className:`ml-auto flex items-center gap-2`,children:[(0,J.jsx)($,{variant:`ghost`,size:`sm`,disabled:w,onClick:te,children:`Cancel`}),(0,J.jsx)($,{size:`sm`,disabled:S.trim()===``||w,onClick:()=>void B(),children:w?`Sending…`:`Reply`})]})]})]}):se&&(0,J.jsxs)(`div`,{"data-slot":`thread-actions`,className:`flex items-center gap-2 pl-8.5`,children:[I&&(0,J.jsx)(`button`,{type:`button`,onClick:ee,className:`h-8 min-w-0 flex-1 cursor-text truncate rounded-md border border-input bg-background px-2.5 text-left text-ui text-muted-foreground hover:border-foreground/40`,children:`Reply…`}),L&&(0,J.jsx)($,{variant:`outline`,size:`sm`,disabled:O,onClick:()=>void ne(),className:X(!I&&`ml-auto`),children:e.resolved?`Reopen`:(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(Rh,{"aria-hidden":`true`}),`Resolve`]})})]})]}):(0,J.jsxs)(`div`,{className:`flex min-h-7 flex-wrap items-center gap-2`,children:[(0,J.jsxs)(`span`,{className:`text-caption text-review-approved`,children:[(0,J.jsx)(`span`,{"aria-hidden":`true`,children:`✓ `}),`Resolved`,oe===void 0?``:` by ${oe}`]}),ie!==void 0&&(0,J.jsxs)(`span`,{className:`min-w-0 flex-1 truncate text-caption text-muted-foreground`,children:[ie.author.name,`: `,Td(ie.body)]}),(0,J.jsxs)($,{variant:`ghost`,size:`sm`,onClick:()=>h(!0),"aria-expanded":!1,children:[`Show `,e.comments.length,` `,e.comments.length===1?`comment`:`comments`]})]})})},uj=/[\p{L}\p{N}_]+|\s+|[^\p{L}\p{N}_\s]/gu,dj=e=>e.match(uj)??[],fj=e=>{let t=new Map,n=0;for(;n<e.length;){if(e[n]?.kind!==`del`){n++;continue}let r=n;for(;e[n]?.kind===`del`;)n++;let i=n;for(;e[n]?.kind===`add`;)n++;let a=Math.min(i-r,n-i);for(let n=0;n<a;n++){let a=pj(e[r+n]?.text??``,e[i+n]?.text??``);a!==null&&(t.set(r+n,a.old),t.set(i+n,a.new))}}return t},pj=(e,t)=>{if(e.length>500||t.length>500)return null;let n=dj(e),r=dj(t),{inOld:i,inNew:a}=hj(n,r),o=n.reduce((e,t,n)=>e+(i[n]?t.length:0),0),s=e.length+t.length;return s>0&&2*o/s<.3?null:{old:mj(n,i),new:mj(r,a)}},mj=(e,t)=>{let n=[],r=0;return e.forEach((e,i)=>{let a=r+e.length;if(!t[i]){let e=n.at(-1);e?.end===r?n[n.length-1]={start:e.start,end:a}:n.push({start:r,end:a})}r=a}),n},hj=(e,t)=>{let n=e.map(()=>!1),r=t.map(()=>!1),i=new Map([[1,0]]),a=[],o=(e,t)=>a[e]?.[t+e+1]??0,s=0;search:for(let n=0;n<=e.length+t.length;n++){let r=new Int32Array(2*n+3);for(let e=-n-1;e<=n+1;e++)r[e+n+1]=i.get(e)??0;a.push(r);for(let r=-n;r<=n;r+=2){let a=r===-n||r!==n&&(i.get(r-1)??0)<(i.get(r+1)??0)?i.get(r+1)??0:(i.get(r-1)??0)+1,o=a-r;for(;a<e.length&&o<t.length&&e[a]===t[o];)a++,o++;if(i.set(r,a),a>=e.length&&o>=t.length){s=n;break search}}}let c=e.length,l=t.length;for(let e=s;e>=0;e--){let t=c-l,i=t===-e||t!==e&&o(e,t-1)<o(e,t+1)?t+1:t-1,a=o(e,i),s=a-i;for(;c>a&&l>s;)c--,l--,n[c]=!0,r[l]=!0;c=a,l=s}return{inOld:n,inNew:r}},gj=(e,t=null)=>{let n=fj(e.lines);return Mk(e.lines).map(({line:r,text:i,carriageReturn:a},o)=>({key:`${e.id}:${o}`,hunkId:e.id,kind:r.kind,oldNo:r.oldLine,newNo:r.newLine,text:i,tokens:t?.[o]??null,wordRanges:n.get(o)??[],notes:[...a?[`CRLF`]:[],...r.noNewlineAtEnd?[`No newline at end of file`]:[]]}))},_j=e=>e.kind===`del`?e.oldLine===null?null:{side:`old`,line:e.oldLine}:e.newLine===null?null:{side:`new`,line:e.newLine},vj=`sticky left-0 w-[100cqw]`,yj=`pr-3 pl-29`,bj=({inset:e,children:t})=>(0,J.jsx)(`div`,{role:`row`,"data-slot":`line-row`,className:X(e&&X(yj,`py-2`),`font-sans`,vj),children:(0,J.jsx)(`div`,{role:`cell`,children:t})}),xj=(e,t)=>e.side===t.side&&e.line===t.line,Sj=e=>e.startLine===void 0?`Comment on ${e.side===`old`?`old `:``}line ${e.line}`:`Comment on ${e.side===`old`?`old `:``}lines ${e.startLine}–${e.line}`,Cj=(e,t,n)=>{let r=new Map(e.lines.flatMap(e=>e.kind!==`del`&&e.newLine!==null?[[e.newLine,e.text]]:[])),i=[];for(let e=t;e<=n;e+=1){let t=r.get(e);if(t===void 0)return null;i.push(t)}return i},wj=[],Tj=(0,q.memo)(function({id:e,hunk:t,file:n,risk:r,proofs:i=[],highlighted:a=!1,focused:o=!1,onFocus:s,lineLimit:c,unchanged:l=[],comments:u=[],openComment:d=null,onOpenComment:f,onCancelComment:p,onComment:m,onCommentNow:h,afterHeader:g,threadsAt:_,rangeNote:v,inFile:y=!1,marks:b,pointLines:x,pointsAt:S,pointsAtEnd:C,flagged:w}){let T=e??t.id,E=(0,q.useRef)(null),[D,O]=(0,q.useState)(!1),k=Zk(t,n,Xk(E)),A=(0,q.useMemo)(()=>gj(t,k),[t,k]),j=c===void 0||D||A.length<=c?A:A.slice(0,c);(0,q.useEffect)(()=>{let e=E.current;o&&e!==null&&!e.contains(document.activeElement)&&(e.focus({preventScroll:!0}),e.scrollIntoView({block:`start`}))},[o]);let M=Nk(t),N=!y||i.length>0,P=f!==void 0&&m!==void 0,F=(e,t)=>{let n=d;if(n!==null&&n.side===e.side&&n.line===e.line)f?.(T,null);else if(t&&n!==null&&n.side===e.side){let t=Math.min(n.startLine??n.line,e.line),r=Math.max(n.line,e.line);f?.(T,{side:e.side,line:r,startLine:t})}else f?.(T,e)};return(0,J.jsxs)(`section`,{ref:E,"data-slot":`hunk-card`,"data-risk":r?.riskClass,"data-highlighted":a||void 0,className:X(`relative scroll-mt-24 bg-card -outline-offset-2`,!y&&`overflow-hidden rounded-lg border`,a&&`bg-primary/5 shadow-[inset_0_0_0_2px_var(--ring)]`),"aria-label":`${n.path}, ${Fk(t)}`,tabIndex:0,onFocus:()=>s?.(T),children:[N&&(0,J.jsxs)(`header`,{"data-slot":`hunk-header`,className:X(`flex flex-wrap items-center gap-x-3 gap-y-1 border-b bg-surface-subtle px-3 py-1.5`,y&&`sticky left-0 w-[100cqw]`),children:[!y&&(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(JD,{file:n,status:n.status}),(0,J.jsx)(YD,{status:n.status}),t.sectionHeading!==null&&(0,J.jsx)(`code`,{className:`font-mono text-code-compact text-diff-hunk-fg`,children:t.sectionHeading}),(0,J.jsxs)(`span`,{className:`tabular font-mono text-code-compact`,children:[(0,J.jsxs)(`span`,{className:`text-diff-add-fg`,children:[`+`,M.added]}),` `,(0,J.jsxs)(`span`,{className:`text-diff-del-fg`,children:[`−`,M.deleted]})]})]}),i.map(e=>(0,J.jsxs)(`span`,{className:`text-caption text-review-approved`,children:[(0,J.jsx)(`span`,{"aria-hidden":`true`,children:`✓ `}),e.detail]},e.kind)),!y&&r!==null&&(0,J.jsxs)(`span`,{className:`ml-auto`,title:r.reason===``?void 0:r.reason,children:[(0,J.jsx)(tO,{status:cD[r.riskClass]}),r.reason!==``&&(0,J.jsxs)(`span`,{className:`sr-only`,children:[`: `,r.reason]})]})]}),(l.length>0||g!=null)&&(0,J.jsxs)(`div`,{className:X(y&&`sticky left-0 w-[100cqw]`),children:[l.map(e=>(0,J.jsx)(ZD,{callers:e,named:l.length>1},e.symbol)),g]}),(0,J.jsx)(`div`,{role:`table`,"aria-label":`Lines`,className:X(`[content-visibility:auto]`,!y&&`overflow-x-auto`),style:{containIntrinsicSize:`auto ${j.length*20}px`},children:(0,J.jsx)(`div`,{className:`w-max min-w-full`,children:j.map(e=>{let r=_j({kind:e.kind,oldLine:e.oldNo,newLine:e.newNo}),i=r===null?void 0:u.find(e=>xj(e,r)),a=r!==null&&d!==null&&xj(d,r),o=a?d:i,s=r===null?null:_?.(r)??null,c=r===null?null:S?.(r)??null,l=r===null?null:C?.(r)??null,g=r===null?null:`${r.side}:${r.line}`,E=g===null?void 0:x?.get(g);return(0,J.jsxs)(q.Fragment,{children:[(0,J.jsx)(nD,{line:e,cellRole:`cell`,pointKind:E?.kind??null,flagged:g!==null&&w?.has(g)===!0,...l===null?{}:{end:l},...E?.landing===void 0?{}:{pointLanding:E.landing},marks:(e.kind===`del`||e.newNo===null?void 0:b?.get(e.newNo))??wj,marked:r!==null&&m!==void 0&&d!==null&&d.side===r.side&&r.line>=(d.startLine??d.line)&&r.line<=d.line,numberButton:r===null||!P?void 0:{side:r.side,label:Sj(r),onClick:e=>F(r,e.shiftKey)},...r===null||!P?{}:{onRowClick:e=>{window.getSelection()?.isCollapsed!==!1&&(e.target instanceof Element&&e.target.closest(`button`)||F(r,e.shiftKey))}}}),c,r!==null&&o!=null&&(i!==void 0||a&&m!==void 0)&&(0,J.jsx)(Ej,{place:o,comment:i,editing:a&&m!==void 0,shown:(e,n)=>Cj(t,e,n),language:TD(n),rangeNote:v,fileName:n.path.split(`/`).at(-1)??n.path,onChange:m===void 0?void 0:e=>m(T,{side:o.side,line:o.line,...o.startLine===void 0?{}:{startLine:o.startLine},...e}),onEdit:()=>f?.(T,{side:o.side,line:o.line,...o.startLine===void 0?{}:{startLine:o.startLine}}),onDone:()=>f?.(T,null),onCancel:()=>p?.(T,o),...h===void 0?{}:{onPostNow:e=>h(T,{side:o.side,line:o.line,...o.startLine===void 0?{}:{startLine:o.startLine},...e})},pinned:y}),s!==null&&(0,J.jsx)(`div`,{role:`row`,"data-slot":`line-threads`,className:X(yj,`py-2 font-sans`,y&&`sticky left-0 w-[100cqw]`),children:(0,J.jsx)(`div`,{role:`cell`,className:`flex max-w-3xl flex-col gap-2`,children:s})})]},e.key)})})}),j.length<A.length&&(0,J.jsx)(`div`,{className:X(`border-t p-2`,y&&`sticky left-0 w-[100cqw]`),children:(0,J.jsxs)($,{variant:`outline`,size:`sm`,onClick:()=>O(!0),children:[`Show all `,A.length,` lines`]})})]})}),Ej=({place:e,comment:t,editing:n,shown:r,language:i,rangeNote:a,fileName:o,onChange:s,onEdit:c,onDone:l,onCancel:u,onPostNow:d,pinned:f})=>{let p=(0,q.useRef)(null),m=(0,q.useRef)(null),[h,g]=(0,q.useState)(`write`),[_,v]=(0,q.useState)(!1),[y,b]=(0,q.useState)(null);(0,q.useEffect)(()=>{n?m.current?.focus():(g(`write`),b(null))},[n]);let x=Sj(e),S=t?.body??``,C=t?.suggestion,w={body:S,...C===void 0?{}:{suggestion:C}},T=(0,q.useRef)(null);n?T.current===null&&(T.current=w):T.current=null;let E=e.side===`new`?r(e.startLine??e.line,e.line):null,D=e.startLine===void 0?null:`Lines ${e.startLine}–${e.line}`,O=()=>p.current?.closest(`[data-slot=hunk-card]`)?.focus({preventScroll:!0}),k=()=>s?.({body:``}),A=()=>{O(),S.trim()===``&&C===void 0&&s?.({body:``}),l()},j=async()=>{if(d===void 0||_||S.trim()===``)return;v(!0),b(null);let e=await d(w);v(!1),e===null?(O(),s?.({body:``}),l()):b(e)},M=()=>{O();let e=T.current;s?.(e===null||e.body.trim()===``&&e.suggestion===void 0?{body:``}:e),u?.(),l()},N=e=>(0,J.jsx)(rA,{title:`Suggested change`,removed:E,added:e,language:i});return(0,J.jsx)(`div`,{ref:p,role:`row`,"data-slot":`line-comment`,"data-editing":n||void 0,className:X(yj,`py-2 font-sans`,f&&`sticky left-0 w-[100cqw]`),children:(0,J.jsx)(Ck,{role:`cell`,state:`draft`,className:`flex max-w-3xl flex-col gap-2`,onKeyDown:n?e=>{if(e.key===`Enter`&&(e.metaKey||e.ctrlKey)){if(e.defaultPrevented)return;e.preventDefault(),A()}else e.key===`Escape`&&(e.stopPropagation(),M())}:void 0,children:n?(0,J.jsxs)(J.Fragment,{children:[(0,J.jsxs)(`p`,{className:`flex flex-wrap items-center gap-x-1.5 gap-y-1 text-caption text-muted-foreground`,children:[`Commenting on `,(0,J.jsx)(jk,{children:o}),e.startLine===void 0?`line`:`lines`,` `,(0,J.jsx)(jk,{children:Ak(e.side,e.startLine??null,e.line)}),a!==void 0&&e.startLine!==void 0&&(0,J.jsx)(`span`,{children:a})]}),(0,J.jsxs)(JO,{value:h,onValueChange:e=>g(e===`preview`?`preview`:`write`),children:[(0,J.jsxs)(XO,{children:[(0,J.jsx)(ZO,{value:`write`,children:`Write`}),(0,J.jsx)(ZO,{value:`preview`,children:`Preview`})]}),(0,J.jsx)(QO,{value:`write`,children:(0,J.jsx)($O,{ref:m,rows:2,"aria-label":x,placeholder:`Leave a comment`,value:S,onChange:e=>s?.({...w,body:e.target.value}),onSubmitShortcut:A,className:`min-h-14 bg-background`})}),(0,J.jsx)(QO,{value:`preview`,"data-slot":`comment-preview`,className:`min-h-14 rounded-md border px-2.5 py-2`,children:S.trim()===``?(0,J.jsx)(`p`,{className:`text-caption text-muted-foreground`,children:`Nothing to preview`}):(0,J.jsx)(rj,{blocks:Vd(S).blocks,suggestion:N})})]}),(0,J.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,J.jsx)(xk,{hints:[{id:`submit`,action:`add to review`},{id:`close`,action:`cancel`}]}),(0,J.jsxs)(`div`,{className:`ml-auto flex items-center gap-2`,children:[(0,J.jsx)($,{variant:`ghost`,size:`sm`,disabled:_,onClick:M,children:`Cancel`}),d!==void 0&&(0,J.jsx)($,{variant:`outline`,size:`sm`,disabled:_||S.trim()===``,onClick:()=>void j(),children:_?`Posting…`:`Comment now`}),(0,J.jsx)($,{size:`sm`,disabled:_,onClick:A,children:`Add to review`})]})]}),y!==null&&(0,J.jsxs)(`p`,{role:`alert`,className:`text-caption text-destructive`,children:[`✕ Not posted: `,y,` Your comment is still here.`]})]}):(0,J.jsxs)(J.Fragment,{children:[(0,J.jsxs)(`header`,{className:`flex flex-wrap items-center gap-2`,children:[(0,J.jsxs)(`span`,{className:`sr-only`,children:[x,`: `]}),(0,J.jsx)(`span`,{className:X(ij,`border-review-pending/25 bg-review-pending-bg text-review-pending`),children:s===void 0?`Posted with your review`:`Draft · posts with your review`}),D!==null&&(0,J.jsx)(`span`,{className:`text-caption text-muted-foreground`,children:D})]}),S.trim()!==``&&(0,J.jsx)(rj,{blocks:Vd(S).blocks,suggestion:N}),C!==void 0&&N(C),s!==void 0&&(0,J.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,J.jsx)($,{variant:`outline`,size:`sm`,onClick:c,children:`Edit`}),(0,J.jsx)($,{variant:`ghost`,size:`sm`,onClick:k,children:`Discard`})]})]})})})},Dj=()=>YE(),Oj=({handle:e,payload:t,id:n,render:r=(0,J.jsx)(`span`,{}),children:i})=>(0,J.jsx)(JE,{handle:e,payload:t,id:n,delay:300,closeDelay:150,render:r,"data-slot":`call`,className:`underline decoration-current decoration-dotted underline-offset-3 hover:decoration-primary hover:decoration-solid data-popup-open:decoration-primary data-popup-open:decoration-solid`,children:i}),kj=({handle:e,onGoTo:t})=>(0,J.jsx)(qE,{handle:e,children:({payload:n})=>n===void 0?null:(0,J.jsx)(XE,{side:`bottom`,align:`start`,"aria-label":n.label??`Code ${n.symbol} runs`,className:`flex max-h-[min(26rem,60vh)] w-[min(44rem,calc(100vw-2rem))] flex-col overflow-hidden p-0`,children:(0,J.jsx)(Aj,{payload:n,onGoTo:n=>{e.close(),t(n)}})})}),Aj=({payload:e,onGoTo:t})=>{let n=(0,q.useRef)(null),r=e.targets[0],i=r===void 0?null:`${r.hunk.id}:${Mj(r.hunk,e.symbol)}`;return(0,q.useEffect)(()=>{let e=n.current,t=i===null?null:e?.querySelector(`[data-line="${i}"]`),r=e?.querySelector(`header`);e!=null&&t!=null&&(e.scrollTop=t.offsetTop-(r?.offsetHeight??0))},[i]),(0,J.jsx)(`div`,{ref:n,"data-slot":`peek-scroller`,className:`@container relative min-h-0 overflow-auto`,children:(0,J.jsx)(`div`,{className:`w-max min-w-full`,children:e.targets.map((n,r)=>(0,J.jsx)(jj,{target:n,symbol:e.symbol,onGoTo:t,divided:r>0,last:r===e.targets.length-1},n.id))})})},jj=({target:e,symbol:t,onGoTo:n,divided:r,last:i})=>{let{hunk:a,file:o}=e,s=Zk(a,o,!0),c=(0,q.useMemo)(()=>gj(a,s),[a,s]),l=Nk(a),u=Fk(a);return(0,J.jsxs)(`section`,{"aria-label":`${o.path}, ${u}`,className:r?`border-t`:void 0,children:[(0,J.jsxs)(`header`,{className:X(vj,`top-0 z-[2] flex flex-wrap items-center gap-x-3 gap-y-1 border-b bg-surface-subtle px-3 py-1 text-caption`),children:[(0,J.jsx)(JD,{file:o,status:o.status}),(0,J.jsx)(`span`,{className:`text-muted-foreground`,children:u}),(0,J.jsxs)(`span`,{className:`tabular font-mono text-code-compact`,children:[(0,J.jsxs)(`span`,{className:`text-diff-add-fg`,children:[`+`,l.added]}),` `,(0,J.jsxs)(`span`,{className:`text-diff-del-fg`,children:[`−`,l.deleted]})]}),(0,J.jsx)($,{variant:`link`,size:`xs`,className:`ml-auto px-0`,onClick:()=>n(e.id),children:`Go to file`})]}),(0,J.jsx)(`div`,{role:`table`,"aria-label":`Lines of ${t}`,className:`w-max min-w-full`,children:c.map(e=>(0,J.jsx)(nD,{line:e,layout:`split-new`,cellRole:`cell`,density:`compact`},e.key))}),i&&(0,J.jsx)(aD,{kind:c.at(-1)?.kind??`context`,className:`h-3`})]})},Mj=(e,t)=>{let n=t.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`),r=RegExp(`(?<![\\w$])${n}(?![\\w$])`),i=RegExp(`\\b(def|class|function|func|fn|const|let|var|type|interface|enum|struct|trait|impl)\\b[^=(]*?(?<![\\w$])${n}(?![\\w$])`),a=e.lines.map((e,t)=>({line:e,at:t})).filter(({line:e})=>e.kind!==`del`);return a.find(({line:e})=>i.test(e.text))?.at??a.find(({line:e})=>r.test(e.text))?.at??0},Nj=q.createContext(void 0);function Pj(){return q.useContext(Nj)}function Fj(e){let{render:t,className:n,style:r,state:i=Jv,props:a=qv,refs:o=qv,metadata:s,stateAttributesMapping:c,tag:l=`div`,...u}=e,{compositeProps:d,compositeRef:f}=xO({metadata:s});return Qv(l,e,{state:i,ref:[f,...o],props:[d,...a,u],stateAttributesMapping:c})}var Ij=q.forwardRef(function(e,t){let{className:n,defaultPressed:r=!1,disabled:i=!1,form:a,onPressedChange:o,pressed:s,render:c,type:l,value:u,nativeButton:d=!0,style:f,...p}=e,m=gE(u||void 0),h=Pj(),g=h?.value??[],_=(i||h?.disabled)??!1,[v,y]=nO({controlled:h?m!==void 0&&g.indexOf(m)>-1:s,default:r,name:`Toggle`,state:`pressed`}),{getButtonProps:b,buttonRef:x}=Pv({disabled:_,native:d}),S={disabled:_,pressed:v},C=[x,t],w=[{"aria-pressed":v,onClick(e){let t=!v,n=Ab(Mb,e.nativeEvent);o?.(t,n),!n.isCanceled&&(m&&h?.setGroupValue?.(m,t,n),!n.isCanceled&&y(t))}},p,b],T=Qv(`button`,e,{enabled:!h,state:S,ref:C,props:w}),E=q.useMemo(()=>({disabled:_,focusableWhenDisabled:!1}),[_]);return h?(0,J.jsx)(Fj,{tag:`button`,render:c,className:n,style:f,metadata:E,state:S,refs:C,props:w}):T}),Lj=q.createContext(void 0);function Rj(e){let t=q.useContext(Lj);if(t===void 0&&!e)throw Error(Ov(69));return t}var zj=cy(`group/toggle inline-flex items-center justify-center gap-1 rounded-md text-ui font-medium whitespace-nowrap transition-all hover:bg-muted hover:text-foreground disabled:pointer-events-none disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-destructive/20 aria-pressed:bg-background aria-pressed:text-foreground aria-pressed:shadow-sm aria-pressed:ring-1 aria-pressed:ring-muted-foreground [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4`,{variants:{variant:{default:`bg-transparent`,outline:`border border-input bg-transparent hover:bg-muted`},size:{default:`h-8 min-w-8 px-2.5 has-data-[icon=inline-end]:pr-2 has-data-[icon=inline-start]:pl-2`,sm:`h-7 min-w-7 rounded-md px-2.5 text-ui has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 [&_svg:not([class*='size-'])]:size-3.5`,lg:`h-9 min-w-9 px-2.5 has-data-[icon=inline-end]:pr-2 has-data-[icon=inline-start]:pl-2`}},defaultVariants:{variant:`default`,size:`default`}});function Bj({className:e,variant:t=`default`,size:n=`default`,...r}){return(0,J.jsx)(Ij,{"data-slot":`toggle`,className:X(zj({variant:t,size:n,className:e})),...r})}q.createContext({size:`default`,variant:`default`,spacing:2,orientation:`horizontal`});var Vj=(e,t)=>{let n=new Set,r=e=>{let r=t.filter(t=>!n.has(t)&&e(t));for(let e of r)n.add(e);return r},i=e.flatMap(e=>{let t=r(t=>t.path===e.path&&t.hunkId===null).map(t=>({key:`${e.path}\0${t.kind}`,path:e.path,file:e,hunk:null,proofs:[t],summary:Hj(t,e)})),n=e.hunks.flatMap(t=>{let n=r(e=>e.hunkId===t.id);if(n.length===0)return[];let{added:i,deleted:a}=Nk(t),o=n.map(e=>e.detail).join(`; `);return[{key:t.id,path:e.path,file:e,hunk:t,proofs:n,summary:`${e.path} — ${o} (+${i} −${a})`}]});return[...t,...n]}),a=t.filter(e=>!n.has(e)).map((e,t)=>({key:`orphan-${t}`,path:e.path,file:null,hunk:null,proofs:[e],summary:`${e.path} — ${e.detail}`}));return[...i,...a]},Hj=(e,t)=>e.kind===`rename`&&t.oldPath!==null?`${t.oldPath} → ${t.path} — renamed, content unchanged`:`${t.path} — ${e.detail}`,Uj=`flex min-h-8 w-full items-center gap-2 rounded-md px-2 py-1 text-left text-muted-foreground`,Wj=({open:e,children:t,...n})=>(0,J.jsxs)(`button`,{type:`button`,"data-slot":`mechanical-toggle`,"aria-expanded":e,className:X(Uj,`hover:bg-accent hover:text-accent-foreground`),...n,children:[(0,J.jsx)(`span`,{"aria-hidden":`true`,className:X(`w-3 shrink-0 transition-transform duration-(--duration-fast) ease-standard`,!e&&`-rotate-90`),children:`▾`}),(0,J.jsx)(`span`,{className:`min-w-0`,children:t})]}),Gj=(0,q.memo)(function({hunk:e,file:t,risk:n,proofs:r,focused:i=!1,onFocus:a}){let o=(0,q.useRef)(null),[s,c]=(0,q.useState)(!1),{added:l,deleted:u}=Nk(e);return(0,q.useEffect)(()=>{let e=o.current;i&&e!==null&&e!==document.activeElement&&(e.focus({preventScroll:!0}),e.scrollIntoView({block:`start`}))},[i]),(0,J.jsxs)(`div`,{"data-slot":`mechanical-hunk`,className:`bg-surface-subtle`,children:[(0,J.jsxs)(Wj,{ref:o,open:s,onClick:()=>c(e=>!e),onFocus:()=>a?.(e.id),children:[t.path,`, `,Fk(e),` — `,r.map(e=>e.detail).join(`; `),` (+`,l,` −`,u,`)`]}),s&&(0,J.jsx)(Tj,{hunk:e,file:t,risk:n,proofs:r,lineLimit:500})]})}),Kj=({files:e,proofs:t,risk:n})=>{let r=(0,q.useId)(),i=(0,q.useMemo)(()=>Vj(e,t),[e,t]),[a,o]=(0,q.useState)(new Set),s=i.filter(e=>e.hunk!==null).map(e=>e.key),c=s.length>0&&s.every(e=>a.has(e));if(i.length===0)return null;let l=e=>o(t=>{let n=new Set(t);return n.delete(e)||n.add(e),n});return(0,J.jsxs)(`section`,{"aria-labelledby":r,className:`flex flex-col gap-2 rounded-lg border bg-card p-3`,children:[(0,J.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,J.jsxs)(`h2`,{id:r,className:`flex items-center gap-2 text-heading font-semibold`,children:[`Mechanical changes`,` `,(0,J.jsx)(`span`,{className:`tabular rounded-full bg-muted px-2 text-caption font-medium text-muted-foreground`,children:i.length})]}),s.length>0&&(0,J.jsx)($,{variant:`outline`,size:`sm`,onClick:()=>o(new Set(c?[]:s)),children:c?`Collapse all`:`Expand all`})]}),(0,J.jsx)(`ul`,{className:`flex flex-col gap-1`,children:i.map(e=>{let t=a.has(e.key);return(0,J.jsxs)(`li`,{className:`flex flex-col gap-1`,children:[e.hunk===null||e.file===null?(0,J.jsxs)(`span`,{className:Uj,children:[(0,J.jsx)(`span`,{"aria-hidden":`true`,className:`w-3 shrink-0`}),e.summary]}):(0,J.jsx)(Wj,{open:t,onClick:()=>l(e.key),children:e.summary}),t&&e.hunk!==null&&e.file!==null&&(0,J.jsx)(Tj,{hunk:e.hunk,file:e.file,risk:n.find(t=>t.hunkId===e.hunk?.id)??null,proofs:e.proofs,lineLimit:500})]},e.key)})})]})},qj={added:`added`,deleted:`deleted`,modified:`changed`,renamed:`changed`},Jj=e=>e.flatMap(e=>{let t=e.oldMode!==null||e.newMode!==null,n=!e.binary&&!t&&e.hunks.length===0&&e.status!==`renamed`;return[...e.binary?[{key:`${e.path}\0binary`,file:e,text:`binary file ${qj[e.status]}`}]:[],...t?[{key:`${e.path}\0mode`,file:e,text:`mode ${e.oldMode??`unknown`} → ${e.newMode??`unknown`}`}]:[],...n?[{key:`${e.path}\0empty`,file:e,text:e.status===`modified`?`changed, no lines to show`:`empty file ${e.status}`}]:[]]}),Yj=({files:e})=>{let t=(0,q.useId)(),n=Jj(e);return n.length===0?null:(0,J.jsxs)(`section`,{"aria-labelledby":t,className:`flex flex-col gap-2 rounded-lg border bg-card p-3`,children:[(0,J.jsx)(`h2`,{id:t,className:`text-heading font-semibold`,children:`Changes without lines to show`}),(0,J.jsx)(`ul`,{className:`flex flex-col gap-1`,children:n.map(({key:e,file:t,text:n})=>(0,J.jsxs)(`li`,{className:`flex flex-wrap items-center gap-2`,children:[(0,J.jsx)(JD,{file:t,status:t.status}),(0,J.jsx)(YD,{status:t.status}),(0,J.jsx)(`span`,{children:n})]},e))})]})},Xj=({hunkId:e,lines:t})=>t.length===0?null:(0,J.jsx)(`div`,{role:`table`,"aria-label":`Unchanged lines`,children:(0,J.jsx)(`div`,{className:`w-max min-w-full`,children:t.map(({oldNo:t,newNo:n,text:r,tokens:i})=>{let a={key:`${e}:unchanged:${n}`,hunkId:e,kind:`context`,oldNo:t,newNo:n,text:r,tokens:i,wordRanges:[],notes:[]};return(0,J.jsx)(nD,{line:a,cellRole:`cell`},n)})})}),Zj=q.createContext(void 0);function Qj(e){let t=q.useContext(Zj);if(t===void 0&&!e)throw Error(Ov(47));return t}var $j={...Cw,disabled:e=>e.disabled,instantType:e=>e.instantType===`trigger-change`&&!Cw.open(e)?void 0:e.instantType,openMethod:e=>e.openMethod,openChangeReason:e=>e.openChangeReason,isPressOpenedByTrigger:(e,t)=>e.openChangeReason===`trigger-press`&&Cw.isOpenedByTrigger(e,t),isTouchPressOpen:(e,t)=>t&&e.openMethod===`touch`&&e.openChangeReason===`trigger-press`,hasTriggerFocusGuards:(e,t)=>Cw.isOpenedByTrigger(e,t)&&!e.focusManagerModal,modal:e=>e.modal,titleElementId:e=>e.titleElementId,descriptionElementId:e=>e.descriptionElementId,openOnHover:e=>e.openOnHover,closeDelay:e=>e.closeDelay,adaptiveOrigin:e=>e.adaptiveOrigin},eM=class extends mw{constructor(e,t,n){let r=new tw;super(tM(e,r,t,n),nM(r),$j)}setOpen=(e,t)=>{let n=t.reason===Pb,r=t.reason===`trigger-press`&&t.event.detail===0,i=!e&&(t.reason===`escape-key`||t.reason==null),a=JC(t),o=this.select(`activeTriggerId`);if(!e&&t.reason===`close-press`&&t.trigger==null&&o!=null&&(t.trigger=this.context.triggerElements.getById(o)??this.select(`activeTriggerElement`)??void 0),this.context.onOpenChange?.(e,t),t.isCanceled)return;this.state.floatingRootContext.dispatchOpenChange(e,t);let s=()=>{let n=qC(this.state,e,t.trigger,a());n.openChangeReason=t.reason,this.update(n)};n?(this.context.stickIfOpen=!0,this.context.stickIfOpenTimeout.start(500,()=>{this.context.stickIfOpen=!1}),US.flushSync(s)):s();let c;r?c=`click`:i?c=`dismiss`:t.reason===`focus-out`&&(c=`focus`),this.set(`instantType`,c)}};function tM(e,t,n,r=!1){let i={..._w(t,n,r),disabled:!1,modal:!1,focusManagerModal:!1,instantType:void 0,openMethod:null,openChangeReason:null,titleElementId:void 0,descriptionElementId:void 0,openOnHover:!1,closeDelay:0,adaptiveOrigin:void 0,...e};return i.open&&e?.mounted===void 0&&(i.mounted=!0),i}function nM(e){return{popupRef:q.createRef(),onOpenChange:void 0,onOpenChangeComplete:void 0,triggerFocusTargetRef:q.createRef(),beforeTriggerFocusGuardRef:q.createRef(),beforeContentFocusGuardRef:q.createRef(),stickIfOpenTimeout:new yy,stickIfOpen:!0,triggerElements:e}}var rM=my(function({props:e}){let{children:t,open:n,defaultOpen:r=!1,onOpenChange:i,onOpenChangeComplete:a,modal:o=!1,handle:s,triggerId:c,defaultTriggerId:l=null}=e,u=aM(s,{modal:o,open:r,openProp:n,activeTriggerId:l,triggerIdProp:c});u.useControlledProp(`openProp`,n),u.useControlledProp(`triggerIdProp`,c);let d=u.useState(`open`),f=u.useState(`mounted`),p=u.useState(`payload`);u.useContextCallback(`onOpenChange`,i),u.useContextCallback(`onOpenChangeComplete`,a),ew(u,d),ZC(u);let{forceUnmount:m}=QC(d,u,()=>{u.context.stickIfOpen=!0,u.set(`openChangeReason`,null)});u.useSyncedValues({modal:o}),q.useEffect(()=>{d||u.context.stickIfOpenTimeout.clear()},[u,d]),q.useImperativeHandle(e.actionsRef,()=>({unmount:m,close:()=>u.setOpen(!1,Ab(Yb))}),[m,u]);let h=d||f||s!=null;return(0,J.jsxs)(Zj.Provider,{value:u,children:[s&&(0,J.jsx)(WC,{handle:s,store:u}),h&&(0,J.jsx)(oM,{store:u,modal:o}),typeof t==`function`?t({payload:p}):t]})});function iM(e){return Qj(!0)?(0,J.jsx)(rM,{props:e}):(0,J.jsx)(rC,{children:(0,J.jsx)(rM,{props:e})})}function aM(e,t){let n=UC((e,n)=>new eM(t,e,n));return q.useEffect(()=>n.context.stickIfOpenTimeout.disposeEffect(),[n]),n}function oM({store:e,modal:t}){let n=bC(e.useState(`floatingRootContext`),{outsidePressEvent:{mouse:t===`trap-focus`?`sloppy`:`intentional`,touch:`sloppy`}}),r=n.reference,i=n.floating;return $C(e,{activeTriggerProps:r,inactiveTriggerProps:r,popupProps:i}),null}function sM(e,t){function n(n,r,i){let a=n.currentTarget;US.flushSync(()=>{e.setOpen(!1,Ab(zb,n.nativeEvent,a))}),pS(a.isConnected?a:t.current,r,i)?.focus()}function r(t){n(t,-1,e.select(`positionerElement`))}function i(t){let r=e.select(`positionerElement`);r&&mS(t,r)?e.context.beforeContentFocusGuardRef.current?.focus():n(t,1,r)}return{handlePreFocusGuardFocus:r,handleFocusTargetFocus:i}}var cM=hy(function(e,t){let{render:n,className:r,style:i,disabled:a=!1,nativeButton:o=!0,handle:s,payload:c,openOnHover:l=!1,delay:u=300,closeDelay:d=0,id:f,...p}=e,m=Qj(!0),h=ww(s)??m;if(!h)throw Error(Ov(74));let g=gE(f),_=h.useState(`isTriggerActive`,g),v=h.useState(`floatingRootContext`),y=h.useState(`isOpenedByTrigger`,g),b=h.useState(`triggerPopupId`,g),x=q.useRef(null),{registerTrigger:S,isMountedByThisTrigger:C}=XC(g,x,h,{payload:c,disabled:a,openOnHover:l,closeDelay:d}),w=h.useState(`isPressOpenedByTrigger`,g),T=h.useState(`isTouchPressOpen`,l),E=h.useState(`hasTriggerFocusGuards`,g),D=Fw(v,{enabled:!a&&l&&!T,mouseOnly:!0,move:!1,handleClose:Zw(),restMs:u,delay:{close:d},triggerElementRef:x,isActiveTrigger:_,isClosing:()=>h.select(`transitionStatus`)===`ending`}),O=mC(v,{stickIfOpen:Z(()=>h.context.stickIfOpen)}),k=RA(()=>h.select(`open`),e=>{h.set(`openMethod`,e)}),A=h.useState(`triggerProps`,C),{getButtonProps:j,buttonRef:M}=Pv({disabled:a,native:o}),N={open(e){return w?pb.open(e):fb.open(e)}},{handlePreFocusGuardFocus:P,handleFocusTargetFocus:F}=sM(h,x),I=Qv(`button`,e,{state:{disabled:a,open:y},ref:[M,t,S,x],props:[O.reference,D,A,k,{[zS]:``,id:g,"aria-haspopup":`dialog`,"aria-expanded":y,"aria-controls":b},p,j],stateAttributesMapping:N}),L=(0,J.jsx)(q.Fragment,{children:I},g);return E?(0,J.jsxs)(q.Fragment,{children:[(0,J.jsx)(fx,{ref:h.context.beforeTriggerFocusGuardRef,onFocus:P}),L,(0,J.jsx)(fx,{ref:h.context.triggerFocusTargetRef,onFocus:F})]}):L}),lM=q.createContext(void 0);function uM(){let e=q.useContext(lM);if(e===void 0)throw Error(Ov(45));return e}var dM=q.forwardRef(function(e,t){let{keepMounted:n=!1,...r}=e;return Qj().useState(`mounted`)||n?(0,J.jsx)(lM.Provider,{value:n,children:(0,J.jsx)(JS,{ref:t,...r})}):null}),fM=q.createContext(void 0);function pM(){let e=q.useContext(fM);if(!e)throw Error(Ov(46));return e}function mM(e){let{store:t,domReference:n,positionerElement:r,open:i}=e,a=q.useRef(null),o=q.useRef(null),s=RC(r);Q(()=>{i||(o.current?.abort(),o.current=null,t.state.instantType===`trigger-change`&&t.set(`instantType`,void 0))},[i,t]),Q(()=>{let e=n,r=a.current;if(e&&(a.current=e),!r||!e||e===r||!t.select(`open`))return;t.set(`instantType`,void 0);let i=new AbortController;return o.current=i,s(()=>{t.select(`open`)&&t.set(`instantType`,`trigger-change`)},i.signal),()=>{i.abort()}},[n,s,t])}var hM=20;function gM(e,t,n,r){let[i,a]=q.useState(!1);Q(()=>{if(!e||!t||n==null){a(!1);return}let r=Mv(n).documentElement.clientWidth,i=n.offsetWidth;a(r>0&&i>0&&i>=r-hM)},[e,t,n]),DA(e&&(!t||i),r)}var _M=q.forwardRef(function(e,t){let{render:n,className:r,style:i,anchor:a,positionMethod:o,side:s,align:c,sideOffset:l,alignOffset:u,collisionBoundary:d=`clipping-ancestors`,collisionPadding:f,arrowPadding:p,sticky:m,disableAnchorTracking:h=!1,collisionAvoidance:g=VS,..._}=e,v=Qj(),y=uM(),b=tC(),x=v.useState(`floatingRootContext`),S=v.useState(`mounted`),C=v.useState(`open`),w=v.useState(`openChangeReason`),T=v.useState(`activeTriggerElement`),E=v.useState(`modal`),D=v.useState(`openMethod`),O=v.useState(`positionerElement`),k=v.useState(`instantType`),A=v.useState(`transitionStatus`),j=IE({anchor:a,floatingRootContext:x,positionMethod:o,mounted:S,side:s,sideOffset:l,align:c,alignOffset:u,arrowPadding:p,collisionBoundary:d,collisionPadding:f,sticky:m,disableAnchorTracking:h,keepMounted:y,nodeId:b,collisionAvoidance:g,adaptiveOrigin:v.useState(`adaptiveOrigin`)});mM({store:v,domReference:x.useState(`domReferenceElement`),positionerElement:O,open:C});let M=E===!0&&w!==`trigger-hover`;gM(C&&M,D===`touch`,O,T);let N=v.useStateSetter(`positionerElement`),P=BE(e,{open:C,side:j.side,align:j.align,anchorHidden:j.anchorHidden,instant:k},{styles:j.positionerStyles,transitionStatus:A,props:_,refs:[t,N],hidden:!S,inert:!C});return(0,J.jsxs)(fM.Provider,{value:j,children:[S&&M&&(0,J.jsx)(hA,{inert:UE(!C),cutout:T}),(0,J.jsx)(nC,{id:b,children:P})]})}),vM=q.createContext(void 0);function yM(){let[e,t]=q.useState(0),n=Z(()=>(t(e=>e+1),()=>{t(e=>Math.max(0,e-1))}));return{context:q.useMemo(()=>({register:n}),[n]),hasClosePart:e>0}}var bM=q.forwardRef(function(e,t){let{render:n,className:r,style:i,initialFocus:a,finalFocus:o,...s}=e,c=Qj(),l=pM(),u=Rj(!0)!=null,{context:d,hasClosePart:f}=yM(),p=c.useState(`open`),m=c.useState(`openMethod`),h=c.useState(`instantType`),g=c.useState(`transitionStatus`),_=c.useState(`popupProps`),v=c.useState(`titleElementId`),y=c.useState(`descriptionElementId`),b=c.useState(`modal`),x=c.useState(`mounted`),S=c.useState(`openChangeReason`),C=c.useState(`activeTriggerElement`),w=c.useState(`floatingRootContext`),T=w.useState(`floatingId`),E=c.useState(`disabled`),D=c.useState(`openOnHover`),O=c.useState(`closeDelay`);zC({open:p,ref:c.context.popupRef,onComplete(){p&&c.context.onOpenChangeComplete?.(!0)}}),Nw(w,{enabled:D&&!E,closeDelay:O});let k=a===void 0?HC(c.context.popupRef):a,A=b!==!1&&f;c.useSyncedValue(`focusManagerModal`,A);let j=c.useStateSetter(`popupElement`),M=Qv(`div`,e,{state:{open:p,side:l.side,align:l.align,instant:h,transitionStatus:g},ref:[t,c.context.popupRef,j],props:[_,{id:T,role:`dialog`,...VC,"aria-labelledby":v,"aria-describedby":y,onKeyDown(e){u&&IO.has(e.key)&&e.stopPropagation()}},zE(g),s],stateAttributesMapping:hb});return(0,J.jsx)(pC,{context:w,openInteractionType:m,modal:A,disabled:!x||S===`trigger-hover`,initialFocus:k,returnFocus:o,restoreFocus:`popup`,getInsideElements:()=>[c.context.beforeTriggerFocusGuardRef.current],previousFocusableElement:B_(C)?C:void 0,nextFocusableElement:c.context.triggerFocusTargetRef,beforeContentFocusGuardRef:c.context.beforeContentFocusGuardRef,children:(0,J.jsx)(vM.Provider,{value:d,children:M})})}),xM=q.forwardRef(function(e,t){let{render:n,className:r,style:i,...a}=e,o=Qj(),s=gE(a.id);return o.useSyncedValueWithCleanup(`titleElementId`,s),Qv(`h2`,e,{ref:t,props:[{id:s},a]})});function SM({...e}){return(0,J.jsx)(iM,{"data-slot":`popover`,...e})}function CM({...e}){return(0,J.jsx)(cM,{"data-slot":`popover-trigger`,...e})}function wM({className:e,align:t=`center`,alignOffset:n=0,side:r=`bottom`,sideOffset:i=4,...a}){return(0,J.jsx)(dM,{children:(0,J.jsx)(_M,{align:t,alignOffset:n,side:r,sideOffset:i,className:`isolate z-50`,children:(0,J.jsx)(bM,{"data-slot":`popover-content`,className:X(`z-50 flex w-72 origin-(--transform-origin) flex-col gap-2.5 rounded-xl bg-popover p-2.5 text-ui text-popover-foreground shadow-md ring-1 ring-foreground/10 outline-hidden duration-(--duration-fast) data-[side=bottom]:slide-in-from-top-2 data-[side=inline-end]:slide-in-from-left-2 data-[side=inline-start]:slide-in-from-right-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95`,e),...a})})})}function TM({className:e,...t}){return(0,J.jsx)(xM,{"data-slot":`popover-title`,className:X(`font-medium`,e),...t})}var EM={open:Sg,draft:Eg,merged:bg,closed:wg},DM=({state:e})=>{let{label:t,className:n}=uD[e],r=EM[e];return(0,J.jsxs)(eO,{"data-slot":`pr-state`,variant:`outline`,className:n,children:[(0,J.jsx)(r,{"aria-hidden":`true`}),t]})},OM=({status:e})=>e===null?null:(0,J.jsx)(`span`,{"data-slot":`review-status`,children:(0,J.jsx)(tO,{status:dD[e]})}),kM=e=>{switch(e.state){case`failed`:return`CI ${e.failed} of ${e.total} failed`;case`running`:return`CI ${e.running} of ${e.total} running`;case`skipped`:return`CI ${e.skipped} skipped`;default:return`CI ${e.passed}/${e.total} passed`}},AM=e=>{let t=e=>`${e} ${e===1?`check`:`checks`}`;switch(e.state){case`failed`:return`CI: ${e.failed} of ${t(e.total)} failed`;case`running`:return`CI: ${e.running} of ${t(e.total)} running`;case`skipped`:return`CI: ${t(e.skipped)} skipped`;default:return`CI: ${e.passed} of ${t(e.total)} passed`}},jM=`h-6 gap-1.5 px-1.5 font-normal text-muted-foreground`,MM=({check:e})=>{let t=fD[e.state];return(0,J.jsxs)(`li`,{className:`flex min-w-0 items-center gap-2`,children:[(0,J.jsx)(`span`,{"aria-hidden":`true`,className:X(`w-3 shrink-0 text-center`,t.tone),children:t.glyph}),(0,J.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,title:e.name,children:e.name}),(0,J.jsx)(`span`,{className:`shrink-0 text-caption text-muted-foreground`,children:t.label}),e.url!==null&&(0,J.jsx)(`a`,{className:`shrink-0 text-caption`,href:e.url,target:`_blank`,rel:`noreferrer noopener`,"aria-label":`Details of ${e.name}`,children:`Details`})]})},NM=({checks:e,unreadable:t,head:n})=>{let r=e===null?null:cf(e),i=r===null||r.state===null?null:AM(r),a=PM(i);if(e===null)return(0,J.jsxs)(SM,{children:[(0,J.jsx)(CM,{render:(0,J.jsx)($,{variant:`ghost`,size:`xs`,className:jM,"data-slot":`ci-summary`,children:`CI not readable`})}),(0,J.jsxs)(wM,{align:`end`,children:[(0,J.jsx)(TM,{children:`CI not readable`}),(0,J.jsx)(`p`,{className:`text-muted-foreground`,children:t})]})]});if(r===null||r.state===null)return null;let o=fD[r.state];return(0,J.jsxs)(J.Fragment,{children:[(0,J.jsxs)(SM,{children:[(0,J.jsx)(CM,{render:(0,J.jsxs)($,{variant:`ghost`,size:`xs`,className:jM,"data-slot":`ci-summary`,"data-state":r.state,"aria-label":`${i}, show checks`,children:[(0,J.jsx)(`span`,{"aria-hidden":`true`,className:o.tone,children:o.glyph}),(0,J.jsx)(`span`,{className:`tabular`,children:kM(r)})]})}),(0,J.jsxs)(wM,{align:`end`,className:`w-96`,children:[(0,J.jsxs)(TM,{children:[`Checks on `,(0,J.jsx)(`code`,{className:`font-mono text-code-compact`,children:n.slice(0,7)})]}),(0,J.jsx)(`ul`,{className:`flex max-h-80 flex-col gap-1.5 overflow-y-auto`,"aria-label":`Checks`,children:sf(e).map(e=>(0,J.jsx)(MM,{check:e},`${e.name}:${e.url??``}`))})]})]}),(0,J.jsx)(`span`,{role:`status`,className:`sr-only`,children:a})]})},PM=e=>{let t=(0,q.useRef)(void 0),[n,r]=(0,q.useState)(``);return(0,q.useEffect)(()=>{t.current===void 0?t.current=e:e!==null&&e!==t.current&&(t.current=e,r(e))},[e]),n},FM={"changes-requested":b_,approved:Rh,commented:Kg},IM=3,LM=({reviewer:e})=>{let t=e.verdict===null?null:FM[e.verdict];return(0,J.jsxs)(`span`,{className:`relative flex size-6 shrink-0 items-center justify-center rounded-full bg-muted text-caption font-medium text-muted-foreground ring-2 ring-background`,children:[wk(e.name),t!==null&&e.verdict!==null&&(0,J.jsx)(`span`,{className:`absolute -right-0.5 -bottom-0.5 flex size-3 items-center justify-center rounded-full bg-background`,children:(0,J.jsx)(t,{className:X(`size-2.5`,pD[e.verdict].tone),strokeWidth:3.5})})]})},RM=e=>{let t=new Map;for(let n of e){let e=pD[n.verdict??`waiting`].label.toLowerCase();t.set(e,(t.get(e)??0)+1)}let n=[...t].map(([e,t])=>`${t} ${e}`);return`${`${e.length} ${e.length===1?`reviewer`:`reviewers`}`}: ${n.join(`, `)}`},zM=({reviewers:e})=>{if(e.length===0)return null;let t=af(e),n=t.length>IM?t.slice(0,2):t,r=t.length-n.length;return(0,J.jsxs)(SM,{children:[(0,J.jsx)(CM,{render:(0,J.jsx)($,{variant:`ghost`,size:`xs`,className:`h-7 px-1`,"data-slot":`reviewers`,"aria-label":`${RM(t)}, show reviewers`,children:(0,J.jsxs)(`span`,{"aria-hidden":`true`,className:`flex items-center -space-x-1`,children:[n.map(e=>(0,J.jsx)(LM,{reviewer:e},e.id)),r>0&&(0,J.jsxs)(`span`,{className:`flex size-6 items-center justify-center rounded-full bg-muted text-caption font-medium text-muted-foreground ring-2 ring-background`,children:[`+`,r]})]})})}),(0,J.jsxs)(wM,{align:`end`,children:[(0,J.jsx)(TM,{children:`Reviewers`}),(0,J.jsx)(`ul`,{className:`flex flex-col gap-2`,"aria-label":`Reviewers`,children:t.map(e=>{let t=pD[e.verdict??`waiting`];return(0,J.jsxs)(`li`,{className:`flex min-w-0 items-center gap-2`,children:[(0,J.jsx)(`span`,{"aria-hidden":`true`,children:(0,J.jsx)(LM,{reviewer:e})}),(0,J.jsxs)(`span`,{className:`min-w-0 flex-1 truncate`,children:[e.name,e.team&&(0,J.jsx)(`span`,{className:`text-muted-foreground`,children:` (team)`})]}),(0,J.jsx)(`span`,{className:X(`shrink-0 text-caption`,t.tone),children:t.label})]},e.id)})})]})]})};function BM(e){if(!e||typeof document>`u`)return;let t=document.head||document.getElementsByTagName(`head`)[0],n=document.createElement(`style`);n.type=`text/css`,t.appendChild(n),n.styleSheet?n.styleSheet.cssText=e:n.appendChild(document.createTextNode(e))}var VM=e=>{switch(e){case`success`:return WM;case`info`:return KM;case`warning`:return GM;case`error`:return qM;default:return null}},HM=Array(12).fill(0),UM=({visible:e,className:t})=>q.createElement(`div`,{className:[`sonner-loading-wrapper`,t].filter(Boolean).join(` `),"data-visible":e},q.createElement(`div`,{className:`sonner-spinner`},HM.map((e,t)=>q.createElement(`div`,{className:`sonner-loading-bar`,key:`spinner-bar-${t}`})))),WM=q.createElement(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 20 20`,fill:`currentColor`,height:`20`,width:`20`,"aria-hidden":`true`},q.createElement(`path`,{fillRule:`evenodd`,d:`M10 18a8 8 0 100-16 8 8 0 000 16zm3.857-9.809a.75.75 0 00-1.214-.882l-3.483 4.79-1.88-1.88a.75.75 0 10-1.06 1.061l2.5 2.5a.75.75 0 001.137-.089l4-5.5z`,clipRule:`evenodd`})),GM=q.createElement(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 24 24`,fill:`currentColor`,height:`20`,width:`20`,"aria-hidden":`true`},q.createElement(`path`,{fillRule:`evenodd`,d:`M9.401 3.003c1.155-2 4.043-2 5.197 0l7.355 12.748c1.154 2-.29 4.5-2.599 4.5H4.645c-2.309 0-3.752-2.5-2.598-4.5L9.4 3.003zM12 8.25a.75.75 0 01.75.75v3.75a.75.75 0 01-1.5 0V9a.75.75 0 01.75-.75zm0 8.25a.75.75 0 100-1.5.75.75 0 000 1.5z`,clipRule:`evenodd`})),KM=q.createElement(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 20 20`,fill:`currentColor`,height:`20`,width:`20`,"aria-hidden":`true`},q.createElement(`path`,{fillRule:`evenodd`,d:`M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-7-4a1 1 0 11-2 0 1 1 0 012 0zM9 9a.75.75 0 000 1.5h.253a.25.25 0 01.244.304l-.459 2.066A1.75 1.75 0 0010.747 15H11a.75.75 0 000-1.5h-.253a.25.25 0 01-.244-.304l.459-2.066A1.75 1.75 0 009.253 9H9z`,clipRule:`evenodd`})),qM=q.createElement(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 20 20`,fill:`currentColor`,height:`20`,width:`20`,"aria-hidden":`true`},q.createElement(`path`,{fillRule:`evenodd`,d:`M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-8-5a.75.75 0 01.75.75v4.5a.75.75 0 01-1.5 0v-4.5A.75.75 0 0110 5zm0 10a1 1 0 100-2 1 1 0 000 2z`,clipRule:`evenodd`})),JM=q.createElement(`svg`,{xmlns:`http://www.w3.org/2000/svg`,width:`12`,height:`12`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.5`,strokeLinecap:`round`,strokeLinejoin:`round`,"aria-hidden":`true`},q.createElement(`line`,{x1:`18`,y1:`6`,x2:`6`,y2:`18`}),q.createElement(`line`,{x1:`6`,y1:`6`,x2:`18`,y2:`18`})),YM=()=>{let[e,t]=q.useState(document.hidden);return q.useEffect(()=>{let e=()=>{t(document.hidden)};return document.addEventListener(`visibilitychange`,e),()=>document.removeEventListener(`visibilitychange`,e)},[]),e},XM=1,ZM=100,QM=e=>typeof e?.id==`number`||e?.id?.length>0?e.id:XM++,$M=new class{constructor(){this.subscribe=e=>(this.subscribers.push(e),this.getActiveToasts().forEach(t=>e(t)),()=>{let t=this.subscribers.indexOf(e);this.subscribers.splice(t,1)}),this.publish=e=>{this.subscribers.forEach(t=>t(e))},this.addToast=e=>{this.publish(e),this.toasts=[...this.toasts,e],this.trimHistory()},this.trimHistory=()=>{let e=this.toasts.length-ZM;e<=0||(this.toasts=this.toasts.filter(t=>e>0&&this.dismissedToasts.has(t.id)?(this.dismissedToasts.delete(t.id),e--,!1):!0))},this.create=e=>{let{message:t,...n}=e,r=QM(e),i=this.pendingDismissals.get(r);i!==void 0&&(cancelAnimationFrame(i),this.pendingDismissals.delete(r),this.dismissedToasts.delete(r));let a=this.dismissedToasts.has(r),o=e.dismissible===void 0||e.dismissible;return a&&(this.dismissedToasts.delete(r),this.toasts=this.toasts.filter(e=>e.id!==r)),!a&&this.toasts.find(e=>e.id===r)?this.toasts=this.toasts.map(n=>n.id===r?(this.publish({...n,...e,id:r,title:t}),{...n,...e,id:r,dismissible:o,title:t}):n):this.addToast({title:t,...n,dismissible:o,id:r}),r},this.dismiss=e=>{if(e==null)return this.getActiveToasts().forEach(e=>{this.dismissedToasts.add(e.id),this.subscribers.forEach(t=>t({id:e.id,dismiss:!0}))}),e;this.dismissedToasts.add(e);let t=this.pendingDismissals.get(e);return t!==void 0&&cancelAnimationFrame(t),this.pendingDismissals.set(e,requestAnimationFrame(()=>{this.pendingDismissals.delete(e),this.subscribers.forEach(t=>t({id:e,dismiss:!0}))})),e},this.message=(e,t)=>this.create({...t,message:e,type:void 0}),this.error=(e,t)=>this.create({...t,message:e,type:`error`}),this.success=(e,t)=>this.create({...t,type:`success`,message:e}),this.info=(e,t)=>this.create({...t,type:`info`,message:e}),this.warning=(e,t)=>this.create({...t,type:`warning`,message:e}),this.loading=(e,t)=>this.create({...t,type:`loading`,message:e}),this.promise=(e,t)=>{if(!t)return;let n;t.loading!==void 0&&(n=this.create({...t,promise:e,type:`loading`,message:t.loading,description:typeof t.description==`function`?void 0:t.description}));let r=Promise.resolve(e instanceof Function?e():e),i=n!==void 0,a,o=r.then(async e=>{if(a=[`resolve`,e],q.isValidElement(e))i=!1,this.create({id:n,type:`default`,message:e});else if(tN(e)&&!e.ok){i=!1;let r=typeof t.error==`function`?await t.error(`HTTP error! status: ${e.status}`):t.error,a=typeof t.description==`function`?await t.description(`HTTP error! status: ${e.status}`):t.description,o=typeof r==`object`&&!q.isValidElement(r)?r:{message:r};this.create({id:n,type:`error`,description:a,...o})}else if(e instanceof Error){i=!1;let r=typeof t.error==`function`?await t.error(e):t.error,a=typeof t.description==`function`?await t.description(e):t.description,o=typeof r==`object`&&!q.isValidElement(r)?r:{message:r};this.create({id:n,type:`error`,description:a,...o})}else if(t.success!==void 0){i=!1;let r=typeof t.success==`function`?await t.success(e):t.success,a=typeof t.description==`function`?await t.description(e):t.description,o=typeof r==`object`&&!q.isValidElement(r)?r:{message:r};this.create({id:n,type:`success`,description:a,...o})}}).catch(async e=>{if(a=[`reject`,e],t.error!==void 0){i=!1;let r=typeof t.error==`function`?await t.error(e):t.error,a=typeof t.description==`function`?await t.description(e):t.description,o=typeof r==`object`&&!q.isValidElement(r)?r:{message:r};this.create({id:n,type:`error`,description:a,...o})}}).finally(()=>{i&&(this.dismiss(n),n=void 0),t.finally==null||t.finally.call(t)}),s=()=>new Promise((e,t)=>o.then(()=>a[0]===`reject`?t(a[1]):e(a[1])).catch(t));return typeof n!=`string`&&typeof n!=`number`?{unwrap:s}:Object.assign(n,{unwrap:s})},this.custom=(e,t)=>{let n=QM(t);return this.create({...t,jsx:e(n),id:n,type:void 0}),n},this.getActiveToasts=()=>this.toasts.filter(e=>!this.dismissedToasts.has(e.id)),this.subscribers=[],this.toasts=[],this.dismissedToasts=new Set,this.pendingDismissals=new Map}},eN=(e,t)=>$M.message(e,t),tN=e=>e&&typeof e==`object`&&`ok`in e&&typeof e.ok==`boolean`&&`status`in e&&typeof e.status==`number`;Object.assign(eN,{success:$M.success,info:$M.info,warning:$M.warning,error:$M.error,custom:$M.custom,message:$M.message,promise:$M.promise,dismiss:$M.dismiss,loading:$M.loading},{getHistory:()=>$M.toasts,getToasts:()=>$M.getActiveToasts()}),BM(`[data-sonner-toaster][dir=ltr],html[dir=ltr]{--toast-icon-margin-start:-3px;--toast-icon-margin-end:4px;--toast-svg-margin-start:-1px;--toast-svg-margin-end:0px;--toast-button-margin-start:auto;--toast-button-margin-end:0;--toast-close-button-start:0;--toast-close-button-end:unset;--toast-close-button-transform:translate(-35%, -35%)}[data-sonner-toaster][dir=rtl],html[dir=rtl]{--toast-icon-margin-start:4px;--toast-icon-margin-end:-3px;--toast-svg-margin-start:0px;--toast-svg-margin-end:-1px;--toast-button-margin-start:0;--toast-button-margin-end:auto;--toast-close-button-start:unset;--toast-close-button-end:0;--toast-close-button-transform:translate(35%, -35%)}[data-sonner-toaster]{position:fixed;width:var(--width);font-family:ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,Noto Sans,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji;--gray1:hsl(0, 0%, 99%);--gray2:hsl(0, 0%, 97.3%);--gray3:hsl(0, 0%, 95.1%);--gray4:hsl(0, 0%, 93%);--gray5:hsl(0, 0%, 90.9%);--gray6:hsl(0, 0%, 88.7%);--gray7:hsl(0, 0%, 85.8%);--gray8:hsl(0, 0%, 78%);--gray9:hsl(0, 0%, 56.1%);--gray10:hsl(0, 0%, 52.3%);--gray11:hsl(0, 0%, 43.5%);--gray12:hsl(0, 0%, 9%);--border-radius:8px;box-sizing:border-box;padding:0;margin:0;list-style:none;outline:0;z-index:999999999;transition:transform .4s ease}@media (hover:none) and (pointer:coarse){[data-sonner-toaster][data-lifted=true]{transform:none}}[data-sonner-toaster][data-x-position=right]{right:var(--offset-right)}[data-sonner-toaster][data-x-position=left]{left:var(--offset-left)}[data-sonner-toaster][data-x-position=center]{left:50%;transform:translateX(-50%)}[data-sonner-toaster][data-y-position=top]{top:var(--offset-top)}[data-sonner-toaster][data-y-position=bottom]{bottom:var(--offset-bottom)}[data-sonner-toast]{--y:translateY(100%);--lift-amount:calc(var(--lift) * var(--gap));z-index:var(--z-index);position:absolute;opacity:0;transform:var(--y);touch-action:none;transition:transform .4s,opacity .4s,height .4s,box-shadow .2s;box-sizing:border-box;outline:0;overflow-wrap:anywhere}[data-sonner-toast][data-styled=true]{padding:16px;background:var(--normal-bg);border:1px solid var(--normal-border);color:var(--normal-text);border-radius:var(--border-radius);box-shadow:0 4px 12px rgba(0,0,0,.1);width:var(--width);font-size:13px;display:flex;align-items:center;gap:6px}[data-sonner-toast]:focus-visible{box-shadow:0 4px 12px rgba(0,0,0,.1),0 0 0 2px rgba(0,0,0,.2)}[data-sonner-toast][data-y-position=top]{top:0;--y:translateY(-100%);--lift:1;--lift-amount:calc(1 * var(--gap))}[data-sonner-toast][data-y-position=bottom]{bottom:0;--y:translateY(100%);--lift:-1;--lift-amount:calc(var(--lift) * var(--gap))}[data-sonner-toast][data-styled=true] [data-description]{font-weight:400;line-height:1.4;color:#3f3f3f}[data-rich-colors=true][data-sonner-toast][data-styled=true] [data-description]{color:inherit}[data-sonner-toaster][data-sonner-theme=dark] [data-description]{color:#e8e8e8}[data-sonner-toast][data-styled=true] [data-title]{font-weight:500;line-height:1.5;color:inherit}[data-sonner-toast][data-styled=true] [data-icon]{display:flex;height:16px;width:16px;position:relative;justify-content:flex-start;align-items:center;flex-shrink:0;margin-left:var(--toast-icon-margin-start);margin-right:var(--toast-icon-margin-end)}[data-sonner-toast][data-promise=true] [data-icon]>svg{opacity:0;transform:scale(.8);transform-origin:center;animation:sonner-fade-in .3s ease forwards}[data-sonner-toast][data-styled=true] [data-icon]>*{flex-shrink:0}[data-sonner-toast][data-styled=true] [data-icon] svg{margin-left:var(--toast-svg-margin-start);margin-right:var(--toast-svg-margin-end)}[data-sonner-toast][data-styled=true] [data-content]{display:flex;flex-direction:column;gap:2px;flex:1;min-width:0}[data-sonner-toast][data-styled=true] [data-button]{border-radius:4px;padding-left:8px;padding-right:8px;height:24px;font-size:12px;color:var(--normal-bg);background:var(--normal-text);margin-left:var(--toast-button-margin-start);margin-right:var(--toast-button-margin-end);border:none;font-weight:500;cursor:pointer;outline:0;display:flex;align-items:center;flex-shrink:0;transition:opacity .4s,box-shadow .2s}[data-sonner-toast][data-styled=true] [data-button]:focus-visible{box-shadow:0 0 0 2px rgba(0,0,0,.4)}[data-sonner-toast][data-styled=true] [data-button]:first-of-type{margin-left:var(--toast-button-margin-start);margin-right:var(--toast-button-margin-end)}[data-sonner-toast][data-styled=true] [data-cancel]{color:var(--normal-text);background:rgba(0,0,0,.08)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast][data-styled=true] [data-cancel]{background:rgba(255,255,255,.3)}[data-sonner-toast][data-styled=true] [data-close-button]{position:absolute;left:var(--toast-close-button-start);right:var(--toast-close-button-end);top:0;height:20px;width:20px;display:flex;justify-content:center;align-items:center;padding:0;color:var(--normal-text);background:var(--normal-bg);border:1px solid var(--normal-border);transform:var(--toast-close-button-transform);border-radius:50%;cursor:pointer;z-index:1;transition:opacity .1s,background .2s,border-color .2s}[data-sonner-toast][data-styled=true] [data-close-button]:focus-visible{box-shadow:0 4px 12px rgba(0,0,0,.1),0 0 0 2px rgba(0,0,0,.2)}[data-sonner-toast][data-styled=true] [data-disabled=true]{cursor:not-allowed}[data-sonner-toast][data-styled=true]:hover [data-close-button]:hover{background:var(--gray2);border-color:var(--gray5)}[data-sonner-toast][data-swiping=true]::before{content:'';position:absolute;left:-100%;right:-100%;height:100%;z-index:-1}[data-sonner-toast][data-y-position=top][data-swiping=true]::before{bottom:50%;transform:scaleY(3) translateY(50%)}[data-sonner-toast][data-y-position=bottom][data-swiping=true]::before{top:50%;transform:scaleY(3) translateY(-50%)}[data-sonner-toast][data-swiping=false][data-removed=true]::before{content:'';position:absolute;inset:0;transform:scaleY(2)}[data-sonner-toast][data-expanded=true]::after{content:'';position:absolute;left:0;height:calc(var(--gap) + 1px);bottom:100%;width:100%}[data-sonner-toast][data-mounted=true]{--y:translateY(0);opacity:1}[data-sonner-toast][data-expanded=false][data-front=false]{--scale:var(--toasts-before) * 0.05 + 1;--y:translateY(calc(var(--lift-amount) * var(--toasts-before))) scale(calc(-1 * var(--scale)));height:var(--front-toast-height)}[data-sonner-toast]>*{transition:opacity .4s}[data-sonner-toast][data-x-position=right]{right:0}[data-sonner-toast][data-x-position=left]{left:0}[data-sonner-toast][data-expanded=false][data-front=false][data-styled=true]>*{opacity:0}[data-sonner-toast][data-visible=false]{opacity:0;pointer-events:none}[data-sonner-toast][data-mounted=true][data-expanded=true]{--y:translateY(calc(var(--lift) * var(--offset)));height:var(--initial-height)}[data-sonner-toast][data-removed=true][data-front=true][data-swipe-out=false]{--y:translateY(calc(var(--lift) * -100%));opacity:0}[data-sonner-toast][data-removed=true][data-front=false][data-swipe-out=false][data-expanded=true]{--y:translateY(calc(var(--lift) * var(--offset) + var(--lift) * -100%));opacity:0}[data-sonner-toast][data-removed=true][data-front=false][data-swipe-out=false][data-expanded=false]{--y:translateY(40%);opacity:0;transition:transform .5s,opacity .2s}[data-sonner-toast][data-removed=true][data-front=false]::before{height:calc(var(--initial-height) + 20%)}[data-sonner-toast][data-swiping=true]{transform:var(--y) translateY(var(--swipe-amount-y,0)) translateX(var(--swipe-amount-x,0));transition:none}[data-sonner-toast][data-swiped=true]{-webkit-user-select:none;user-select:none}[data-sonner-toast][data-swipe-out=true][data-y-position=bottom],[data-sonner-toast][data-swipe-out=true][data-y-position=top]{animation-duration:.2s;animation-timing-function:ease-out;animation-fill-mode:forwards}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=left]{animation-name:swipe-out-left}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=right]{animation-name:swipe-out-right}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=up]{animation-name:swipe-out-up}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=down]{animation-name:swipe-out-down}@keyframes swipe-out-left{from{transform:var(--y) translateX(var(--swipe-amount-x));opacity:1}to{transform:var(--y) translateX(calc(var(--swipe-amount-x) - 100%));opacity:0}}@keyframes swipe-out-right{from{transform:var(--y) translateX(var(--swipe-amount-x));opacity:1}to{transform:var(--y) translateX(calc(var(--swipe-amount-x) + 100%));opacity:0}}@keyframes swipe-out-up{from{transform:var(--y) translateY(var(--swipe-amount-y));opacity:1}to{transform:var(--y) translateY(calc(var(--swipe-amount-y) - 100%));opacity:0}}@keyframes swipe-out-down{from{transform:var(--y) translateY(var(--swipe-amount-y));opacity:1}to{transform:var(--y) translateY(calc(var(--swipe-amount-y) + 100%));opacity:0}}@media (max-width:600px){[data-sonner-toaster]{position:fixed;right:var(--mobile-offset-right);left:var(--mobile-offset-left);width:100%}[data-sonner-toaster][dir=rtl]{left:calc(var(--mobile-offset-left) * -1)}[data-sonner-toaster] [data-sonner-toast]{left:0;right:0;width:calc(100% - var(--mobile-offset-left) * 2)}[data-sonner-toaster][data-x-position=left]{left:var(--mobile-offset-left)}[data-sonner-toaster][data-y-position=bottom]{bottom:var(--mobile-offset-bottom)}[data-sonner-toaster][data-y-position=top]{top:var(--mobile-offset-top)}[data-sonner-toaster][data-x-position=center]{left:var(--mobile-offset-left);right:var(--mobile-offset-right);transform:none}}[data-sonner-toaster][data-sonner-theme=light]{--normal-bg:#fff;--normal-border:var(--gray4);--normal-text:var(--gray12);--success-bg:hsl(143, 85%, 96%);--success-border:hsl(145, 92%, 87%);--success-text:hsl(140, 100%, 27%);--info-bg:hsl(208, 100%, 97%);--info-border:hsl(221, 91%, 93%);--info-text:hsl(210, 92%, 45%);--warning-bg:hsl(49, 100%, 97%);--warning-border:hsl(49, 91%, 84%);--warning-text:hsl(31, 92%, 45%);--error-bg:hsl(359, 100%, 97%);--error-border:hsl(359, 100%, 94%);--error-text:hsl(360, 100%, 45%)}[data-sonner-toaster][data-sonner-theme=light] [data-sonner-toast][data-invert=true]{--normal-bg:#000;--normal-border:hsl(0, 0%, 20%);--normal-text:var(--gray1)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast][data-invert=true]{--normal-bg:#fff;--normal-border:var(--gray3);--normal-text:var(--gray12)}[data-sonner-toaster][data-sonner-theme=dark]{--normal-bg:#000;--normal-bg-hover:hsl(0, 0%, 12%);--normal-border:hsl(0, 0%, 20%);--normal-border-hover:hsl(0, 0%, 25%);--normal-text:var(--gray1);--success-bg:hsl(150, 100%, 6%);--success-border:hsl(147, 100%, 12%);--success-text:hsl(150, 86%, 65%);--info-bg:hsl(215, 100%, 6%);--info-border:hsl(223, 43%, 17%);--info-text:hsl(216, 87%, 65%);--warning-bg:hsl(64, 100%, 6%);--warning-border:hsl(60, 100%, 9%);--warning-text:hsl(46, 87%, 65%);--error-bg:hsl(358, 76%, 10%);--error-border:hsl(357, 89%, 16%);--error-text:hsl(358, 100%, 81%)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast] [data-close-button]{background:var(--normal-bg);border-color:var(--normal-border);color:var(--normal-text)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast] [data-close-button]:hover{background:var(--normal-bg-hover);border-color:var(--normal-border-hover)}[data-rich-colors=true][data-sonner-toast][data-type=success]{background:var(--success-bg);border-color:var(--success-border);color:var(--success-text)}[data-rich-colors=true][data-sonner-toast][data-type=success] [data-close-button]{background:var(--success-bg);border-color:var(--success-border);color:var(--success-text)}[data-rich-colors=true][data-sonner-toast][data-type=info]{background:var(--info-bg);border-color:var(--info-border);color:var(--info-text)}[data-rich-colors=true][data-sonner-toast][data-type=info] [data-close-button]{background:var(--info-bg);border-color:var(--info-border);color:var(--info-text)}[data-rich-colors=true][data-sonner-toast][data-type=warning]{background:var(--warning-bg);border-color:var(--warning-border);color:var(--warning-text)}[data-rich-colors=true][data-sonner-toast][data-type=warning] [data-close-button]{background:var(--warning-bg);border-color:var(--warning-border);color:var(--warning-text)}[data-rich-colors=true][data-sonner-toast][data-type=error]{background:var(--error-bg);border-color:var(--error-border);color:var(--error-text)}[data-rich-colors=true][data-sonner-toast][data-type=error] [data-close-button]{background:var(--error-bg);border-color:var(--error-border);color:var(--error-text)}.sonner-loading-wrapper{--size:16px;height:var(--size);width:var(--size);position:absolute;inset:0;z-index:10}.sonner-loading-wrapper[data-visible=false]{transform-origin:center;animation:sonner-fade-out .2s ease forwards}.sonner-spinner{position:relative;top:50%;left:50%;height:var(--size);width:var(--size)}.sonner-loading-bar{animation:sonner-spin 1.2s linear infinite;background:var(--gray11);border-radius:6px;height:8%;left:-10%;position:absolute;top:-3.9%;width:24%}.sonner-loading-bar:first-child{animation-delay:-1.2s;transform:rotate(.0001deg) translate(146%)}.sonner-loading-bar:nth-child(2){animation-delay:-1.1s;transform:rotate(30deg) translate(146%)}.sonner-loading-bar:nth-child(3){animation-delay:-1s;transform:rotate(60deg) translate(146%)}.sonner-loading-bar:nth-child(4){animation-delay:-.9s;transform:rotate(90deg) translate(146%)}.sonner-loading-bar:nth-child(5){animation-delay:-.8s;transform:rotate(120deg) translate(146%)}.sonner-loading-bar:nth-child(6){animation-delay:-.7s;transform:rotate(150deg) translate(146%)}.sonner-loading-bar:nth-child(7){animation-delay:-.6s;transform:rotate(180deg) translate(146%)}.sonner-loading-bar:nth-child(8){animation-delay:-.5s;transform:rotate(210deg) translate(146%)}.sonner-loading-bar:nth-child(9){animation-delay:-.4s;transform:rotate(240deg) translate(146%)}.sonner-loading-bar:nth-child(10){animation-delay:-.3s;transform:rotate(270deg) translate(146%)}.sonner-loading-bar:nth-child(11){animation-delay:-.2s;transform:rotate(300deg) translate(146%)}.sonner-loading-bar:nth-child(12){animation-delay:-.1s;transform:rotate(330deg) translate(146%)}@keyframes sonner-fade-in{0%{opacity:0;transform:scale(.8)}100%{opacity:1;transform:scale(1)}}@keyframes sonner-fade-out{0%{opacity:1;transform:scale(1)}100%{opacity:0;transform:scale(.8)}}@keyframes sonner-spin{0%{opacity:1}100%{opacity:.15}}@media (prefers-reduced-motion){.sonner-loading-bar,[data-sonner-toast],[data-sonner-toast]>*{transition:none!important;animation:none!important}}.sonner-loader{position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);transform-origin:center;transition:opacity .2s,transform .2s}.sonner-loader[data-visible=false]{opacity:0;transform:scale(.8) translate(-50%,-50%)}`);function nN(e){return e.label!==void 0}var rN=3,iN=`24px`,aN=`16px`,oN=4e3,sN=356,cN=14,lN=45,uN=200;function dN(...e){return e.filter(Boolean).join(` `)}function fN(e){let[t,n]=e.split(`-`),r=[];return t&&r.push(t),n&&r.push(n),r}var pN=e=>{let{invert:t,toast:n,unstyled:r,interacting:i,setHeights:a,visibleToasts:o,heights:s,index:c,toasts:l,expanded:u,removeToast:d,defaultRichColors:f,closeButton:p,style:m,cancelButtonStyle:h,actionButtonStyle:g,className:_=``,descriptionClassName:v=``,duration:y,position:b,gap:x,expandByDefault:S,classNames:C,icons:w,closeButtonAriaLabel:T=`Close toast`}=e,[E,D]=q.useState(null),[O,k]=q.useState(null),[A,j]=q.useState(!1),[M,N]=q.useState(!1),[P,F]=q.useState(!1),[I,L]=q.useState(!1),[R,ee]=q.useState(!1),[z,te]=q.useState(0),[B,ne]=q.useState(0),V=q.useRef(n.duration||y||oN),H=q.useRef(null),re=q.useRef(null),ie=c===0,ae=c+1<=o,oe=n.type,se=oe??`default`,U=n.dismissible!==!1,ce=n.className||``,le=n.descriptionClassName||``,ue=q.useMemo(()=>s.findIndex(e=>e.toastId===n.id)||0,[s,n.id]),de=q.useMemo(()=>n.closeButton??p,[n.closeButton,p]),fe=q.useMemo(()=>n.duration||y||oN,[n.duration,y]),pe=q.useRef(0),me=q.useRef(0),he=q.useRef(0),ge=q.useRef(null),[_e,ve]=b.split(`-`),ye=q.useMemo(()=>s.reduce((e,t,n)=>n>=ue?e:e+t.height,0),[s,ue]),be=YM(),xe=q.useMemo(()=>e.swipeDirections??fN(b),[e.swipeDirections,b]),Se=n.invert||t,Ce=oe===`loading`;me.current=q.useMemo(()=>ue*x+ye,[ue,ye]),q.useEffect(()=>{V.current=fe},[fe]),q.useEffect(()=>{j(!0)},[]),q.useEffect(()=>{let e=re.current;if(e){let t=e.getBoundingClientRect().height;return ne(t),a(e=>[{toastId:n.id,height:t,position:n.position},...e]),()=>a(e=>e.filter(e=>e.toastId!==n.id))}},[a,n.id]),q.useLayoutEffect(()=>{if(!A)return;let e=re.current,t=e.style.height;e.style.height=`auto`;let r=e.getBoundingClientRect().height;e.style.height=t,ne(r),a(e=>e.find(e=>e.toastId===n.id)?e.map(e=>e.toastId===n.id?{...e,height:r}:e):[{toastId:n.id,height:r,position:n.position},...e])},[A,n.title,n.description,a,n.id,n.jsx,n.action,n.cancel]);let we=q.useCallback(()=>{N(!0),te(me.current),a(e=>e.filter(e=>e.toastId!==n.id)),setTimeout(()=>{d(n)},uN)},[n,d,a,me]);q.useEffect(()=>{if(n.promise&&oe===`loading`||n.duration===1/0||n.type===`loading`)return;let e;return u||i||be?(()=>{if(he.current<pe.current){let e=new Date().getTime()-pe.current;V.current-=e}he.current=new Date().getTime()})():V.current!==1/0&&(pe.current=new Date().getTime(),e=setTimeout(()=>{n.onAutoClose==null||n.onAutoClose.call(n,n),we()},V.current)),()=>clearTimeout(e)},[u,i,n,oe,be,we]),q.useEffect(()=>{n.delete&&(we(),n.onDismiss==null||n.onDismiss.call(n,n))},[we,n.delete]);function Te(){return w?.loading?q.createElement(`div`,{className:dN(C?.loader,n?.classNames?.loader,`sonner-loader`),"data-visible":oe===`loading`},w.loading):q.createElement(UM,{className:dN(C?.loader,n?.classNames?.loader),visible:oe===`loading`})}let Ee=n.icon||w?.[oe]||VM(oe);return q.createElement(`li`,{tabIndex:0,ref:re,className:dN(_,ce,C?.toast,n?.classNames?.toast,C?.[se],n?.classNames?.[se]),"data-sonner-toast":``,"data-rich-colors":n.richColors??f,"data-styled":!(n.jsx||n.unstyled||r),"data-mounted":A,"data-promise":!!n.promise,"data-swiped":R,"data-removed":M,"data-visible":ae,"data-y-position":_e,"data-x-position":ve,"data-index":c,"data-front":ie,"data-swiping":P,"data-dismissible":U,"data-type":oe,"data-invert":Se,"data-swipe-out":I,"data-swipe-direction":O,"data-expanded":!!(u||S&&A),"data-testid":n.testId,style:{"--index":c,"--toasts-before":c,"--z-index":l.length-c,"--offset":`${M?z:me.current}px`,"--initial-height":S?`auto`:`${B}px`,...m,...n.style},onDragEnd:()=>{F(!1),D(null),ge.current=null},onPointerDown:e=>{e.button!==2&&!Ce&&U&&(H.current=new Date,te(me.current),e.target.setPointerCapture(e.pointerId),e.target.tagName!==`BUTTON`&&(F(!0),ge.current={x:e.clientX,y:e.clientY}))},onPointerUp:()=>{if(I||!U)return;ge.current=null;let e=Number(re.current?.style.getPropertyValue(`--swipe-amount-x`).replace(`px`,``)||0),t=Number(re.current?.style.getPropertyValue(`--swipe-amount-y`).replace(`px`,``)||0),r=new Date().getTime()-H.current?.getTime(),i=E===`x`?e:t,a=Math.abs(i)/r;if((E===`x`?xe.includes(e>0?`right`:`left`):xe.includes(t>0?`bottom`:`top`))&&(Math.abs(i)>=lN||a>.11))te(me.current),n.onDismiss==null||n.onDismiss.call(n,n),k(E===`x`?e>0?`right`:`left`:t>0?`down`:`up`),we(),L(!0);else{var o,s;(o=re.current)==null||o.style.setProperty(`--swipe-amount-x`,`0px`),(s=re.current)==null||s.style.setProperty(`--swipe-amount-y`,`0px`),ee(!1),F(!1),D(null)}},onPointerMove:e=>{var t,n;if(!ge.current||!U||window.getSelection()?.toString().length>0)return;let r=e.clientY-ge.current.y,i=e.clientX-ge.current.x;!E&&(Math.abs(i)>1||Math.abs(r)>1)&&D(Math.abs(i)>Math.abs(r)?`x`:`y`);let a={x:0,y:0},o=e=>1/(1.5+Math.abs(e)/20);if(E===`y`){if(xe.includes(`top`)||xe.includes(`bottom`)){if(xe.includes(`top`)&&r<0||xe.includes(`bottom`)&&r>0)a.y=r;else{let e=r*o(r);a.y=Math.abs(e)<Math.abs(r)?e:r}}}else if(E===`x`&&(xe.includes(`left`)||xe.includes(`right`))){if(xe.includes(`left`)&&i<0||xe.includes(`right`)&&i>0)a.x=i;else{let e=i*o(i);a.x=Math.abs(e)<Math.abs(i)?e:i}}(Math.abs(a.x)>0||Math.abs(a.y)>0)&&ee(!0),(t=re.current)==null||t.style.setProperty(`--swipe-amount-x`,`${a.x}px`),(n=re.current)==null||n.style.setProperty(`--swipe-amount-y`,`${a.y}px`)}},de&&!n.jsx&&oe!==`loading`?q.createElement(`button`,{"aria-label":T,"data-disabled":Ce,"data-close-button":!0,onClick:Ce||!U?()=>{}:()=>{we(),n.onDismiss==null||n.onDismiss.call(n,n)},className:dN(C?.closeButton,n?.classNames?.closeButton)},w?.close??JM):null,(oe||n.icon||n.promise)&&n.icon!==null&&(w?.[oe]!==null||n.icon)?q.createElement(`div`,{"data-icon":``,className:dN(C?.icon,n?.classNames?.icon)},oe===`loading`?n.icon||Te():n.promise?Te():null,oe===`loading`?null:Ee):null,q.createElement(`div`,{"data-content":``,className:dN(C?.content,n?.classNames?.content)},q.createElement(`div`,{"data-title":``,className:dN(C?.title,n?.classNames?.title)},n.jsx?n.jsx:typeof n.title==`function`?n.title():n.title),n.description?q.createElement(`div`,{"data-description":``,className:dN(v,le,C?.description,n?.classNames?.description)},typeof n.description==`function`?n.description():n.description):null),q.isValidElement(n.cancel)?n.cancel:n.cancel&&nN(n.cancel)?q.createElement(`button`,{"data-button":!0,"data-cancel":!0,style:n.cancelButtonStyle||h,onClick:e=>{nN(n.cancel)&&U&&(n.cancel.onClick==null||n.cancel.onClick.call(n.cancel,e),we())},className:dN(C?.cancelButton,n?.classNames?.cancelButton)},n.cancel.label):null,q.isValidElement(n.action)?n.action:n.action&&nN(n.action)?q.createElement(`button`,{"data-button":!0,"data-action":!0,style:n.actionButtonStyle||g,onClick:e=>{nN(n.action)&&(n.action.onClick==null||n.action.onClick.call(n.action,e),!e.defaultPrevented&&we())},className:dN(C?.actionButton,n?.classNames?.actionButton)},n.action.label):null)};function mN(){if(typeof window>`u`||typeof document>`u`)return`ltr`;let e=document.documentElement.getAttribute(`dir`);return e===`auto`||!e?window.getComputedStyle(document.documentElement).direction:e}function hN(e,t){let n={};return[e,t].forEach((e,t)=>{let r=t===1,i=r?`--mobile-offset`:`--offset`,a=r?aN:iN;function o(e){[`top`,`right`,`bottom`,`left`].forEach(t=>{n[`${i}-${t}`]=typeof e==`number`?`${e}px`:e})}typeof e==`number`||typeof e==`string`?o(e):typeof e==`object`?[`top`,`right`,`bottom`,`left`].forEach(t=>{e[t]===void 0?n[`${i}-${t}`]=a:n[`${i}-${t}`]=typeof e[t]==`number`?`${e[t]}px`:e[t]}):o(a)}),n}var gN=q.forwardRef(function(e,t){let{id:n,invert:r,position:i=`bottom-right`,hotkey:a=[`altKey`,`KeyT`],expand:o,closeButton:s,className:c,offset:l,mobileOffset:u,theme:d=`light`,richColors:f,duration:p,style:m,visibleToasts:h=rN,toastOptions:g,dir:_=mN(),gap:v=cN,icons:y,customAriaLabel:b,containerAriaLabel:x=`Notifications`}=e,[S,C]=q.useState([]),w=q.useMemo(()=>n?S.filter(e=>e.toasterId===n):S.filter(e=>!e.toasterId),[S,n]),T=q.useMemo(()=>Array.from(new Set([i].concat(w.filter(e=>e.position).map(e=>e.position)))),[w,i]),[E,D]=q.useState([]),[O,k]=q.useState(!1),[A,j]=q.useState(!1),[M,N]=q.useState(d===`system`?typeof window<`u`&&window.matchMedia&&window.matchMedia(`(prefers-color-scheme: dark)`).matches?`dark`:`light`:d),P=q.useRef(null),F=a.join(`+`).replace(/Key/g,``).replace(/Digit/g,``),I=q.useRef(null),L=q.useRef(!1),R=q.useCallback(e=>{C(t=>(t.find(t=>t.id===e.id)?.delete||$M.dismiss(e.id),t.filter(({id:t})=>t!==e.id)))},[]);return q.useEffect(()=>$M.subscribe(e=>{e.dismiss?requestAnimationFrame(()=>{C(t=>t.map(t=>t.id===e.id?{...t,delete:!0}:t))}):setTimeout(()=>{US.flushSync(()=>{C(t=>{let n=t.findIndex(t=>t.id===e.id);return n===-1?[e,...t]:[...t.slice(0,n),{...t[n],...e},...t.slice(n+1)]})})})}),[]),q.useEffect(()=>{if(d!==`system`){N(d);return}if(d===`system`&&(window.matchMedia&&window.matchMedia(`(prefers-color-scheme: dark)`).matches?N(`dark`):N(`light`)),typeof window>`u`)return;let e=window.matchMedia(`(prefers-color-scheme: dark)`);try{e.addEventListener(`change`,({matches:e})=>{N(e?`dark`:`light`)})}catch{e.addListener(({matches:e})=>{try{N(e?`dark`:`light`)}catch(e){console.error(e)}})}},[d]),q.useEffect(()=>{S.length<=1&&k(!1)},[S]),q.useEffect(()=>{let e=e=>{if(a.length>0&&a.every(t=>e[t]||e.code===t)){var t;k(!0),(t=P.current)==null||t.focus()}e.code===`Escape`&&(document.activeElement===P.current||P.current?.contains(document.activeElement))&&k(!1)};return document.addEventListener(`keydown`,e),()=>document.removeEventListener(`keydown`,e)},[a]),q.useEffect(()=>{if(P.current)return()=>{I.current&&(I.current.focus({preventScroll:!0}),I.current=null,L.current=!1)}},[P.current]),q.createElement(`section`,{ref:t,"aria-label":b??`${x} ${F}`,tabIndex:-1,"aria-live":`polite`,"aria-relevant":`additions text`,"aria-atomic":`false`,suppressHydrationWarning:!0,"data-react-aria-top-layer":!0},T.map((t,n)=>{let[i,a]=t.split(`-`);return w.length?q.createElement(`ol`,{key:t,dir:_===`auto`?mN():_,tabIndex:-1,ref:P,className:c,"data-sonner-toaster":!0,"data-sonner-theme":M,"data-y-position":i,"data-x-position":a,style:{"--front-toast-height":`${E[0]?.height||0}px`,"--width":`${sN}px`,"--gap":`${v}px`,...m,...hN(l,u)},onBlur:e=>{L.current&&!e.currentTarget.contains(e.relatedTarget)&&(L.current=!1,I.current&&=(I.current.focus({preventScroll:!0}),null))},onFocus:e=>{e.target instanceof HTMLElement&&e.target.dataset.dismissible===`false`||L.current||(L.current=!0,I.current=e.relatedTarget)},onMouseEnter:()=>k(!0),onMouseMove:()=>k(!0),onMouseLeave:()=>{A||k(!1)},onDragEnd:()=>k(!1),onPointerDown:e=>{e.target instanceof HTMLElement&&e.target.dataset.dismissible===`false`||j(!0)},onPointerUp:()=>j(!1)},w.filter(e=>!e.position&&n===0||e.position===t).map((n,i)=>q.createElement(pN,{key:n.id,icons:y,index:i,toast:n,defaultRichColors:f,duration:g?.duration??p,className:g?.className,descriptionClassName:g?.descriptionClassName,invert:r,visibleToasts:h,closeButton:g?.closeButton??s,interacting:A,position:t,style:g?.style,unstyled:g?.unstyled,classNames:g?.classNames,cancelButtonStyle:g?.cancelButtonStyle,actionButtonStyle:g?.actionButtonStyle,closeButtonAriaLabel:g?.closeButtonAriaLabel,removeToast:R,toasts:w.filter(e=>e.position==n.position),heights:E.filter(e=>e.position==n.position),setHeights:D,expandByDefault:o,gap:v,expanded:O,swipeDirections:e.swipeDirections}))):null}))});function _N({className:e,...t}){return(0,J.jsx)(`label`,{"data-slot":`label`,className:X(`flex items-center gap-2 text-ui leading-none font-medium select-none group-data-[disabled=true]:pointer-events-none group-data-[disabled=true]:opacity-50 peer-disabled:cursor-not-allowed peer-disabled:opacity-50`,e),...t})}var vN=`data-valid`,yN=`data-invalid`,bN={badInput:!1,customError:!1,patternMismatch:!1,rangeOverflow:!1,rangeUnderflow:!1,stepMismatch:!1,tooLong:!1,tooShort:!1,typeMismatch:!1,valid:null,valueMissing:!1},xN={disabled:!1,valid:null,touched:!1,dirty:!1,filled:!1,focused:!1},SN={valid(e){return e===null?null:e?{[vN]:``}:{[yN]:``}}},CN={invalid:void 0,name:void 0,validityData:{state:bN,errors:[],error:``,value:``,initialValue:null},setValidityData:Kv,disabled:void 0,setTouched:Kv,setDirty:Kv,setFilled:Kv,setFocused:Kv,focusOwnerRef:{current:void 0},validationMode:`onSubmit`,shouldValidateOnChange:()=>!1,state:xN,registerFieldControl:Kv,validation:{getValidationProps:(e,t=Jv)=>t,inputRef:{current:null},registeredInputs:new Map,registerInput:Kv,getInputControl:()=>null,commit:async()=>{},change:Kv}},wN=q.createContext(CN);function TN(e=!0){let t=q.useContext(wN);if(t.setValidityData===Kv&&!e)throw Error(Ov(28));return t}function EN(e,t,n){let{setFocused:r,focusOwnerRef:i}=TN(),a=Z(t=>{(t?!e:i.current===a)&&(i.current=t&&a,n?.(t),r(t))});return Q(()=>{let e=t.current;return e?.getRootNode()?.activeElement===e&&a(!0),()=>a(!1)},[e,t,a]),a}var DN=q.createContext({controlId:void 0,registerControlId:Kv,resetControlId:Kv,labelId:void 0,setLabelId:Kv,messageIds:[],setMessageIds:Kv,getDescriptionProps:e=>e});function ON(){return q.useContext(DN)}function kN(e,t,n,r=!0,i,a){let[o,s]=q.useState(),c=gE(i?`${i}-label`:void 0),l=!!a?.trim(),u=e??(l?void 0:t)??o;return Q(()=>{let i=e||t||l||!r?void 0:AN(n.current,c);o!==i&&s(i)}),u}function AN(e,t){let n=jN(e);if(n)return!n.id&&t&&(n.id=t),n.id||void 0}function jN(e){if(!e)return;let t=e.parentElement;if(t&&t.tagName===`LABEL`)return t;let n=e.id;if(n){let t=e.nextElementSibling;if(t&&t.htmlFor===n)return t}let r=e.labels;return r&&r[0]}function MN(e={}){let{id:t,enabled:n=!0}=e,{controlId:r,registerControlId:i,resetControlId:a}=ON(),o=gE(),s=sv(()=>Symbol()),c=q.useRef(!1),l=q.useRef(!1),u=Z(()=>{c.current&&i!==Kv&&(c.current=!1,i(s.current,void 0))});return Q(()=>{if(!n||i===Kv){u();return}let e;if(t!==void 0)l.current=!0,e=t;else if(l.current)e=o;else{a();return}e===void 0?u():(c.current=!0,i(s.current,e))},[t,n,i,a,o,s,u]),Q(()=>u,[u]),(n?r:void 0)??t??o}function NN(e){if(e==null)return``;if(typeof e==`string`)return e;try{return JSON.stringify(e)}catch{return String(e)}}function PN(e,t,n,r,i=!0,a){let{registerFieldControl:o}=TN(),s=sv(()=>Symbol());Q(()=>{let c=s.current;i?o(c,{controlRef:e,getValue:r,id:t,name:a,value:n}):o(c,void 0)},[e,i,r,t,a,o,s,n]),Q(()=>{let e=s.current;return()=>{o(e,void 0)}},[o,s])}var FN=q.createContext({elementRef:{current:null},formRef:{current:{fields:new Map}},errors:{},clearErrors:Kv,validationMode:`onSubmit`,submitCountRef:{current:0}});function IN(){return q.useContext(FN)}var LN=`rounded-lg border border-review-changes/25 bg-review-changes-bg px-3 py-2 text-review-changes`,RN=`rounded-lg border border-review-pending/25 bg-review-pending-bg px-3 py-2 text-review-pending`;function zN({className:e,...t}){return(0,J.jsx)(`div`,{"data-slot":`skeleton`,className:X(`animate-pulse rounded-md bg-muted`,e),...t})}var BN={muted:`bg-muted text-muted-foreground`,done:`bg-review-approved-bg text-review-approved`,info:`bg-diff-hunk-bg text-diff-hunk-fg`},VN=({glyph:e,title:t,body:n,actions:r=[],tone:i=`muted`,inline:a=!1})=>(0,J.jsxs)(`div`,{className:X(`flex flex-col gap-2`,a?`items-start p-3`:`mx-auto max-w-sm items-center px-6 py-12 text-center`),children:[(0,J.jsx)(`span`,{"aria-hidden":`true`,className:X(`flex items-center justify-center rounded-full font-semibold`,a?`size-7 text-ui`:`size-10 text-heading`,BN[i]),children:e}),(0,J.jsx)(`p`,{className:X(`font-semibold`,a?`text-ui`:`text-heading`),children:t}),(0,J.jsx)(`p`,{className:`text-muted-foreground`,children:n}),r.length>0&&(0,J.jsx)(`div`,{className:`mt-1 flex flex-wrap gap-2`,children:r.map((e,t)=>(0,J.jsxs)($,{variant:t===0?`outline`:`ghost`,size:`sm`,onClick:e.onClick,children:[e.label,e.shortcut!==void 0&&(0,J.jsx)(bk,{id:e.shortcut})]},e.label))})]}),HN=({lines:e=7})=>(0,J.jsxs)(`div`,{role:`status`,"aria-label":`Loading the diff`,className:`overflow-hidden rounded-lg border bg-card`,children:[(0,J.jsxs)(`div`,{className:`flex h-10 items-center gap-3 border-b px-3`,children:[(0,J.jsx)(zN,{className:`h-3 w-3`}),(0,J.jsx)(zN,{className:`h-3 w-56`}),(0,J.jsx)(zN,{className:`ml-auto h-3 w-12`})]}),(0,J.jsx)(`div`,{className:`flex flex-col py-1`,children:Array.from({length:e},(e,t)=>(0,J.jsxs)(`div`,{className:`flex h-5 items-center gap-3 px-3`,children:[(0,J.jsx)(zN,{className:`h-2.5 w-8`}),(0,J.jsx)(zN,{className:`h-2.5`,style:{width:`${30+t*37%55}%`}})]},t))})]}),UN=({rows:e=8})=>(0,J.jsxs)(`div`,{role:`status`,"aria-label":`Loading the files`,className:`flex flex-col gap-2 px-1`,children:[(0,J.jsx)(zN,{className:`h-7 w-full`}),Array.from({length:e},(e,t)=>(0,J.jsxs)(`div`,{className:`flex h-6 items-center gap-2`,style:{paddingLeft:`${t%3*12}px`},children:[(0,J.jsx)(zN,{className:`h-2.5 flex-1`}),(0,J.jsx)(zN,{className:`h-2.5 w-10`})]},t))]}),WN=q.createContext(void 0);function GN(){let e=q.useContext(WN);if(e===void 0)throw Error(Ov(63));return e}var KN=`data-checked`,qN=`data-unchecked`,JN={...SN,checked(e){return e?{[KN]:``}:{[qN]:``}}},YN=q.forwardRef(function(e,t){let{checked:n,className:r,defaultChecked:i,"aria-labelledby":a,form:o,id:s,inputRef:c,name:l,nativeButton:u=!1,onCheckedChange:d,readOnly:f=!1,required:p=!1,disabled:m=!1,render:h,uncheckedValue:g,value:_,style:v,...y}=e,{clearErrors:b}=IN(),{state:x,setTouched:S,setDirty:C,validityData:w,setFilled:T,validationMode:E,disabled:D,name:O,validation:k}=TN(),{labelId:A}=ON(),j=D||m,M=O??l,N=q.useRef(null),P=Lv(N,c,k.inputRef),F=q.useRef(null),I=EN(j,F),L=gE(),R=MN({id:s}),ee=u?void 0:R,[z,te]=nO({controlled:n,default:!!i,name:`Switch`,state:`checked`});PN(F,L,z,void 0,!j,l),Q(()=>{T(z)},[z,T]),LA(z,()=>{b(M),C(z!==w.initialValue),k.change(z)});let{getButtonProps:B,buttonRef:ne}=Pv({disabled:j,native:u}),V=kN(a,A,N,!u,ee,y[`aria-label`]),H={id:u?R:L,role:`switch`,"aria-checked":z,"aria-readonly":f||void 0,"aria-required":p||void 0,"aria-labelledby":V,onFocus(){I(!0)},onBlur(){let e=N.current;e&&!j&&(S(!0),I(!1),E===`onBlur`&&k.commit(e.checked))},onClick(e){if(f||j)return;e.preventDefault();let t=N.current;t&&Nv(t,e)}},re={...k.getValidationProps(j),checked:z,disabled:j,form:o,id:ee,name:M,required:p,style:M?dx:ux,tabIndex:-1,type:`checkbox`,"aria-hidden":!0,ref:P,onChange(e){if(e.nativeEvent.defaultPrevented)return;if(f){e.preventDefault();return}let t=e.currentTarget.checked,n=Ab(Mb,e.nativeEvent);d?.(t,n),!n.isCanceled&&te(t)},onClick(e){e.stopPropagation()},onFocus(){F.current?.focus()},..._===void 0?Jv:{value:_}},ie=q.useMemo(()=>({...x,checked:z,disabled:j,readOnly:f,required:p}),[x,z,j,f,p]),ae=Qv(`span`,e,{state:ie,ref:[t,F,ne],props:[H,y,B,e=>k.getValidationProps(j,e)],stateAttributesMapping:JN});return(0,J.jsxs)(WN.Provider,{value:ie,children:[ae,!z&&M&&g!==void 0&&(0,J.jsx)(`input`,{type:`hidden`,form:o,name:M,value:g,disabled:j}),(0,J.jsx)(`input`,{...re,suppressHydrationWarning:!0})]})}),XN=q.forwardRef(function(e,t){let{render:n,className:r,style:i,...a}=e;return Qv(`span`,e,{state:GN(),ref:t,stateAttributesMapping:JN,props:a})});function ZN({className:e,size:t=`default`,...n}){return(0,J.jsx)(YN,{"data-slot":`switch`,"data-size":t,className:X(`peer group/switch relative inline-flex shrink-0 items-center rounded-full border border-transparent transition-all group-has-[:focus-visible]/field-label:border-transparent group-has-[:focus-visible]/field-label:ring-0 after:absolute after:-inset-x-3 after:-inset-y-2 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 data-[size=default]:h-[18.4px] data-[size=default]:w-[32px] data-[size=sm]:h-[14px] data-[size=sm]:w-[24px] data-checked:bg-primary data-unchecked:bg-input data-disabled:cursor-not-allowed data-disabled:opacity-50`,e),...n,children:(0,J.jsx)(XN,{"data-slot":`switch-thumb`,className:`pointer-events-none block rounded-full bg-background ring-0 transition-transform group-data-[size=default]/switch:size-4 group-data-[size=sm]/switch:size-3 group-data-[size=default]/switch:data-checked:translate-x-[calc(100%-2px)] group-data-[size=sm]/switch:data-checked:translate-x-[calc(100%-2px)] group-data-[size=default]/switch:data-unchecked:translate-x-0 group-data-[size=sm]/switch:data-unchecked:translate-x-0`})})}var QN=[{scope:`global`,title:`Anywhere`},{scope:`diff`,title:`In the code`},{scope:`overview`,title:`In the overview`},{scope:`tree`,title:`In the file tree`},{scope:`composer`,title:`Writing a comment or review`},{scope:`picker`,title:`On the pull requests page`}],$N=({open:e,onOpenChange:t,ids:n})=>{let r=ek.filter(e=>n===void 0||n.includes(e.id)),[i,a]=gk(),o=(0,q.useMemo)(dk,[]),s=(0,q.useId)();return(0,J.jsx)(BA,{open:e,onOpenChange:t,children:(0,J.jsxs)(UA,{className:`max-h-[85vh] overflow-y-auto sm:max-w-lg`,children:[(0,J.jsxs)(WA,{children:[(0,J.jsx)(GA,{children:`Keyboard shortcuts`}),(0,J.jsx)(KA,{children:`Keys don't fire while you type in a field.`})]}),(0,J.jsxs)(`div`,{className:`flex items-center justify-between gap-3 rounded-lg border p-3`,children:[(0,J.jsxs)(_N,{htmlFor:s,className:`leading-snug`,children:[`Single-key shortcuts`,(0,J.jsx)(`span`,{className:`block text-caption font-normal text-muted-foreground`,children:`Letter keys like n and c. Off if they get in the way of speech input or another tool.`})]}),(0,J.jsx)(ZN,{id:s,checked:i,onCheckedChange:a})]}),QN.filter(({scope:e})=>r.some(t=>t.scope===e)).map(({scope:e,title:t})=>(0,J.jsxs)(`section`,{"aria-label":t,className:`flex flex-col gap-1`,children:[(0,J.jsx)(`h3`,{className:`text-caption font-medium text-muted-foreground`,children:t}),(0,J.jsx)(`dl`,{className:`flex flex-col`,children:r.filter(t=>t.scope===e).map(e=>{let t=!i&&e.chords.every(ak);return(0,J.jsxs)(`div`,{className:`flex min-h-7 items-center justify-between gap-4 border-b py-1 last:border-0`,children:[(0,J.jsxs)(`dt`,{className:t?`text-muted-foreground line-through`:void 0,children:[e.action,t&&(0,J.jsx)(`span`,{className:`sr-only`,children:` (off)`})]}),(0,J.jsx)(`dd`,{className:`flex gap-2`,children:e.chords.map(e=>(0,J.jsx)(yk,{children:sk(e,o).map(e=>(0,J.jsx)(vk,{children:e},e))},sk(e,o).join(` `)))})]},e.id)})})]},e))]})})},eP=q.forwardRef(function(e,t){let{render:n,className:r,id:i,name:a,value:o,disabled:s=!1,onValueChange:c,defaultValue:l,autoFocus:u=!1,style:d,...f}=e,{state:p,name:m,disabled:h,setTouched:g,setDirty:_,validityData:v,setFilled:y,validationMode:b,validation:x}=TN(),{clearErrors:S,elementRef:C,submitCountRef:w}=IN(),T=h||s,E=m??a,D={...p,disabled:T},{labelId:O}=ON(),k=MN({id:i}),A=o!==void 0,j=o==null?void 0:String(o),M=Z(()=>x.inputRef.current?.value);PN(x.inputRef,k,j,M,!T,a),Q(()=>{let e=j??x.inputRef.current?.value;e!==void 0&&y(e!==``)},[j,l,x.inputRef,y]),LA(j,()=>{j!==void 0&&(S(E),_(j!==(v.initialValue??``)),x.change(j))});let N=q.useRef(null),P=EN(T,N),F=by();return Qv(`input`,e,{ref:[t,N],state:D,props:[{id:k,disabled:T,name:E,ref:x.inputRef,"aria-labelledby":O,autoFocus:u,...A?{value:o}:{defaultValue:l},onChange(e){let t=e.currentTarget.value,n=Ab(Mb,e.nativeEvent);c?.(t,n),!A&&(_(t!==(v.initialValue??``)),y(t!==``),!e.nativeEvent.defaultPrevented&&!n.isCanceled&&(S(E),x.change(t)))},onFocus(){P(!0)},onBlur(e){if(g(!0),P(!1),b===`onBlur`){let t=e.currentTarget.value;x.commit(t),A&&queueMicrotask(()=>{let e=x.inputRef.current?.value;e!==void 0&&e!==t&&e!==(v.initialValue??``)&&x.commit(e)})}},onKeyDown(e){if(e.currentTarget.tagName===`INPUT`&&e.key===`Enter`){g(!0);let t=e.currentTarget.value,n=e.currentTarget.form;if(n&&n===C.current&&!e.defaultPrevented){let t=e.currentTarget,n=w.current;F.start(0,()=>{w.current===n&&x.commit(t.value)})}else x.commit(t)}}},f,e=>x.getValidationProps(T,e)],stateAttributesMapping:SN})}),tP=q.forwardRef(function(e,t){return(0,J.jsx)(eP,{ref:t,...e})});function nP({className:e,type:t,...n}){return(0,J.jsx)(tP,{type:t,"data-slot":`input`,className:X(`h-8 w-full min-w-0 rounded-md border border-input bg-transparent px-2.5 py-1 text-ui transition-colors file:inline-flex file:h-6 file:border-0 file:bg-transparent file:text-ui file:font-medium file:text-foreground placeholder:text-muted-foreground disabled:pointer-events-none disabled:cursor-not-allowed disabled:bg-input/50 disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20`,e),...n})}var rP=q.createContext(void 0);function iP(){let e=q.useContext(rP);if(e===void 0)throw Error(Ov(53));return e}function aP(e,t,n){if(!e)return 0;let r=getComputedStyle(e),i=`${t}${n===`x`?`Inline`:`Block`}`,a=parseFloat(r[`${i}Start`]);return n===`x`&&t===`margin`?a*2:a+parseFloat(r[`${i}End`])}var oP=`base-ui-disable-scrollbar`,sP={className:oP,getElement(e){return(0,J.jsx)(`style`,{nonce:e,href:oP,precedence:`base-ui:low`,children:`.${oP}{scrollbar-width:none}.${oP}::-webkit-scrollbar{display:none}`})}},cP=`data-has-overflow-x`,lP=`data-has-overflow-y`,uP=`data-overflow-x-start`,dP=`data-overflow-x-end`,fP=`data-overflow-y-start`,pP=`data-overflow-y-end`,mP=e=>t=>t?{[e]:``}:null,hP={hasOverflowX:mP(cP),hasOverflowY:mP(lP),overflowXStart:mP(uP),overflowXEnd:mP(dP),overflowYStart:mP(fP),overflowYEnd:mP(pP),cornerHidden:()=>null},gP=`--scroll-area-corner-height`,_P=`--scroll-area-corner-width`,vP=`data-orientation`,yP={x:0,y:0},bP={width:0,height:0},xP={xStart:!1,xEnd:!1,yStart:!1,yEnd:!1},SP={x:!0,y:!0,corner:!0},CP=q.forwardRef(function(e,t){let{render:n,className:r,overflowEdgeThreshold:i,style:a,...o}=e,{xStart:s,xEnd:c,yStart:l,yEnd:u}=wP(i),d=gE(),f=by(),p=by(),{nonce:m,disableStyleElements:h}=DO(),[g,_]=q.useState(!1),[v,y]=q.useState(!1),[b,x]=q.useState(!1),[S,C]=q.useState(!1),[w,T]=q.useState(!1),[E,D]=q.useState(bP),[O,k]=q.useState(bP),[A,j]=q.useState(xP),[M,N]=q.useState(SP),P=q.useRef(null),F=q.useRef(null),I=q.useRef(null),L=q.useRef(null),R=q.useRef(null),ee=q.useRef(null),z=q.useRef(null),te=q.useRef(null),B=q.useRef(0),ne=q.useRef(0),V=q.useRef(0),H=q.useRef(0),re=q.useRef(`vertical`),ie=q.useRef(yP),ae=q.useRef(null);function oe(e){let t=e?x:y,n=e?f:p;t(!0),n.start(500,()=>{t(!1)})}let se=Z(e=>{let t=e.x-ie.current.x,n=e.y-ie.current.y;ie.current=e,n!==0&&oe(!0),t!==0&&oe(!1)}),U=Z(()=>{let e=F.current;e&&ae.current===null&&(ae.current=e.style.scrollSnapType,e.style.scrollSnapType=`none`)}),ce=Z(e=>{if(e.button!==0||te.current!==null&&(re.current===`vertical`?R.current:ee.current)?.hasPointerCapture(te.current))return;te.current=e.pointerId,B.current=e.clientY,ne.current=e.clientX,re.current=e.currentTarget.getAttribute(vP);let t=F.current;t&&(V.current=t.scrollTop,H.current=t.scrollLeft,U()),(re.current===`vertical`?R.current:ee.current)?.setPointerCapture(e.pointerId)}),le=Z(e=>{if(e.pointerId!==te.current)return;te.current=null,(re.current===`vertical`?x:y)(!1),ae.current!==null&&(F.current&&(F.current.style.scrollSnapType=ae.current),ae.current=null);let t=re.current===`vertical`?R.current:ee.current;t?.hasPointerCapture(e.pointerId)&&t.releasePointerCapture(e.pointerId)}),ue=Z(e=>{if(e.pointerId!==te.current)return;if(e.buttons%2==0){le(e);return}let t=F.current;if(!t)return;let n=re.current===`vertical`,r=n?R.current:ee.current,i=n?I.current:L.current;if(!r||!i)return;let a=n?`y`:`x`,o=aP(i,`padding`,a),s=aP(r,`margin`,a),c=n?r.offsetHeight:r.offsetWidth,l=(n?i.offsetHeight:i.offsetWidth)-c-o-s,u=n?e.clientY-B.current:e.clientX-ne.current,d=l<=0?0:u/l,f=n?t.scrollHeight:t.scrollWidth,p=n?t.clientHeight:t.clientWidth,m=(n?V.current:H.current)+d*(f-p);n?t.scrollTop=m:t.scrollLeft=m,e.preventDefault(),oe(n)});function de(e){C(e.pointerType===`touch`)}function fe(e){if(de(e),e.pointerType!==`touch`){let t=Hy(P.current,e.target);_(t)}}let pe=q.useMemo(()=>({scrolling:v||b,hasOverflowX:!M.x,hasOverflowY:!M.y,overflowXStart:A.xStart,overflowXEnd:A.xEnd,overflowYStart:A.yStart,overflowYEnd:A.yEnd,cornerHidden:M.corner}),[v,b,M.x,M.y,M.corner,A]),me={role:`presentation`,onPointerEnter:fe,onPointerMove:fe,onPointerDown:de,onPointerLeave(){_(!1)},style:{position:`relative`,[gP]:`${E.height}px`,[_P]:`${E.width}px`}},he=Qv(`div`,e,{state:pe,ref:[t,P],props:[me,o],stateAttributesMapping:hP}),ge=q.useMemo(()=>({handlePointerDown:ce,handlePointerMove:ue,handlePointerUp:le,handleScroll:se,disableViewportSnap:U,cornerSize:E,setCornerSize:D,thumbSize:O,setThumbSize:k,hasMeasuredScrollbar:w,setHasMeasuredScrollbar:T,touchModality:S,cornerRef:z,scrollingX:v,scrollingY:b,hovering:g,setHovering:_,viewportRef:F,scrollbarYRef:I,scrollbarXRef:L,thumbYRef:R,thumbXRef:ee,rootId:d,hiddenState:M,setHiddenState:N,overflowEdges:A,setOverflowEdges:j,viewportState:pe,overflowEdgeThreshold:{xStart:s,xEnd:c,yStart:l,yEnd:u}}),[ce,ue,le,se,U,E,O,w,S,v,b,g,d,M,A,pe,s,c,l,u]);return(0,J.jsxs)(rP.Provider,{value:ge,children:[!h&&sP.getElement(m),he]})});function wP(e){let t=typeof e==`number`?{xStart:e,xEnd:e,yStart:e,yEnd:e}:e;return{xStart:Math.max(0,t?.xStart||0),xEnd:Math.max(0,t?.xEnd||0),yStart:Math.max(0,t?.yStart||0),yEnd:Math.max(0,t?.yEnd||0)}}function TP(e,t=-(2**53-1),n=2**53-1){return Math.max(t,Math.min(e,n))}var EP=q.createContext(void 0);function DP(e,t){return Math.max(0,e-t)}function OP(e,t){if(t<=0)return 0;let n=TP(e,0,t),r=n,i=t-n,a=r<=1,o=i<=1;return a&&o?r<=i?0:t:a?0:o?t:n}var kP=`--scroll-area-overflow-x-start`,AP=`--scroll-area-overflow-x-end`,jP=`--scroll-area-overflow-y-start`,MP=`--scroll-area-overflow-y-end`,NP=`--scroll-area-thumb-height`,PP=`--scroll-area-thumb-width`,FP=[kP,AP,jP,MP],IP=!1;function LP(){IP||My||(typeof CSS<`u`&&`registerProperty`in CSS&&FP.forEach(e=>{try{CSS.registerProperty({name:e,syntax:`<length>`,inherits:!1,initialValue:`0px`})}catch{}}),IP=!0)}var RP=q.forwardRef(function(e,t){let{render:n,className:r,style:i,...a}=e,{viewportRef:o,scrollbarYRef:s,scrollbarXRef:c,thumbYRef:l,thumbXRef:u,cornerRef:d,cornerSize:f,setCornerSize:p,setThumbSize:m,rootId:h,setHiddenState:g,hiddenState:_,setHasMeasuredScrollbar:v,handleScroll:y,touchModality:b,setHovering:x,setOverflowEdges:S,overflowEdgeThreshold:C,viewportState:w}=iP(),T=SE(),E=q.useRef(!0),D=q.useRef([NaN,NaN,NaN,NaN]),O=by(),k=by(),A=Z(()=>{let e=o.current,t=s.current,n=c.current,r=l.current,i=u.current,a=d.current;if(!e)return;let h=e.scrollHeight,_=e.scrollWidth,y=e.clientHeight,b=e.clientWidth,x=e.scrollTop,w=e.scrollLeft,E=D.current,O=Number.isNaN(E[0]);if(E[0]=y,E[1]=h,E[2]=b,E[3]=_,O&&v(!0),h===0||_===0)return;let k=zP(e),A=k.y,j=k.x,M=b/_,N=y/h,P=Math.max(0,_-b),F=Math.max(0,h-y),I=0,L=0;j||(I=OP(T===`rtl`?-w:w,P),L=P-I);let R=A?0:OP(x,F),ee=A?0:F-R,z=j?0:b,te=A?0:y,B=0,ne=0;!j&&!A&&(B=t?.offsetWidth||0,ne=n?.offsetHeight||0);let V=f.width===0&&f.height===0,H=V?B:0,re=V?ne:0,ie=aP(n,`padding`,`x`),ae=aP(t,`padding`,`y`),oe=aP(i,`margin`,`x`),se=aP(r,`margin`,`y`),U=z-ie-oe,ce=te-ae-se,le=n?Math.min(n.offsetWidth-H,U):U,ue=t?Math.min(t.offsetHeight-re,ce):ce,de=Math.max(16,le*M),fe=Math.max(16,ue*N);if(m(e=>BP(e,{width:de,height:fe})),t&&r){let e=VP(r,NP,x,F,h,fe,t.offsetHeight-fe-ae-se);r.style.transform=`translate3d(0,${e}px,0)`}if(n&&i){let e=n.offsetWidth-de-ie-oe,t=VP(i,PP,T===`rtl`?-w:w,P,_,de,e);i.style.transform=`translate3d(${T===`rtl`?-t:t}px,0,0)`}let pe=[I,L,R,ee];FP.forEach((t,n)=>{e.style.setProperty(t,`${pe[n]}px`)}),a&&p(e=>BP(e,{width:B,height:ne})),g(e=>BP(e,k));let me={xStart:!j&&I>C.xStart,xEnd:!j&&L>C.xEnd,yStart:!A&&R>C.yStart,yEnd:!A&&ee>C.yEnd};S(e=>BP(e,me))});Q(()=>{LP()},[]),Q(()=>{queueMicrotask(A)},[A,_,T,C.xStart,C.xEnd,C.yStart,C.yEnd]),Q(()=>{o.current?.matches(`:hover`)&&x(!0)},[o,x]),Q(()=>{let e=o.current;if(typeof ResizeObserver>`u`||!e)return;let t=!1,n=new ResizeObserver(()=>{if(!t){t=!0;let n=D.current;if(n[0]===e.clientHeight&&n[1]===e.scrollHeight&&n[2]===e.clientWidth&&n[3]===e.scrollWidth)return}A()});return n.observe(e),k.start(0,()=>{let t=FC(e,{subtree:!0});t.length!==0&&Promise.allSettled(t.map(e=>e.finished.then(Kv))).then(A).catch(()=>{})}),()=>{n.disconnect(),k.clear()}},[A,o,k]);function j(){E.current=!1}let M={...h&&{"data-id":`${h}-viewport`},tabIndex:_.x&&_.y?-1:0,className:sP.className,style:{overflow:`scroll`},onScroll(){o.current&&(A(),(b||!E.current)&&y({x:o.current.scrollLeft,y:o.current.scrollTop}),O.start(100,()=>{E.current=!0}))},onWheel:j,onPointerMove:j,onPointerEnter:j,onKeyDown:j},N=Qv(`div`,e,{ref:[t,o],state:w,props:[M,a],stateAttributesMapping:hP}),P=q.useMemo(()=>({computeThumbPosition:A}),[A]);return(0,J.jsx)(EP.Provider,{value:P,children:N})});function zP(e){let t=e.clientHeight>=e.scrollHeight,n=e.clientWidth>=e.scrollWidth;return{y:t,x:n,corner:t||n}}function BP(e,t){for(let n in t)if(e[n]!==t[n])return t;return e}function VP(e,t,n,r,i,a,o){let s=TP(n,0,r),c=n-s,l=Math.max(16,a*i/(i+Math.abs(c)));return e.style.setProperty(t,c?`${l}px`:``),(r?s/r*o:0)+(c>0?a-l:0)}var HP=q.createContext(void 0);function UP(){let e=q.useContext(HP);if(e===void 0)throw Error(Ov(54));return e}var WP=q.forwardRef(function(e,t){let{render:n,className:r,orientation:i=`vertical`,keepMounted:a=!1,style:o,...s}=e,{hovering:c,scrollingX:l,scrollingY:u,hiddenState:d,scrollbarYRef:f,scrollbarXRef:p,viewportRef:m,thumbYRef:h,thumbXRef:g,handlePointerDown:_,handlePointerUp:v,handleScroll:y,disableViewportSnap:b,rootId:x,thumbSize:S,hasMeasuredScrollbar:C,viewportState:w}=iP(),T=i===`vertical`,E={...w,hovering:c,scrolling:T?u:l,orientation:i},D=SE(),O=!C&&!a,k=T?d.y:d.x,A=a||!k;q.useEffect(()=>{if(!A)return;let e=m.current,t=T?f.current:p.current;if(!t)return;function n(t){if(!e||t.ctrlKey)return;let n=!T,r=n?`scrollLeft`:`scrollTop`,i=n?t.deltaX:t.deltaY;if(i===0)return;let a=n?e.scrollWidth-e.clientWidth:e.scrollHeight-e.clientHeight,o=n&&D===`rtl`?-a:0,s=n&&D===`rtl`?0:a,c=e[r];c<=o&&i<0||c>=s&&i>0||(t.preventDefault(),e[r]=Math.min(s,Math.max(o,c+i)),y({x:e.scrollLeft,y:e.scrollTop}))}return tx(t,`wheel`,n,{passive:!1})},[D,y,T,p,f,A,m]);let j={...x&&{"data-id":`${x}-scrollbar`},"aria-hidden":!0,onPointerDown(e){if(e.button!==0)return;let t=Wy(e.nativeEvent),n=T?h.current:g.current;if(n&&Hy(n,t))return;let r=m.current;if(!r)return;let i=T?f.current:p.current;if(!n||!i)return;let a=T?`y`:`x`,o=aP(n,`margin`,a),s=aP(i,`padding`,a),c=T?n.offsetHeight:n.offsetWidth,l=i.getBoundingClientRect(),u=T?e.clientY-l.top-c/2-s+o/2:e.clientX-l.left-c/2-s+o/2,d=T?r.scrollHeight:r.scrollWidth,v=T?r.clientHeight:r.clientWidth,x=(T?i.offsetHeight:i.offsetWidth)-c-s-o;if(x<=0)return;let S=u/x,C=d-v;b(),T?r.scrollTop=S*C:r.scrollLeft=D===`rtl`?-(1-S)*C:S*C,y({x:r.scrollLeft,y:r.scrollTop}),_(e)},onMouseDown(e){e.preventDefault()},onPointerUp:v,onPointerCancel:v,style:{position:`absolute`,touchAction:`none`,WebkitUserSelect:`none`,userSelect:`none`,visibility:O?`hidden`:void 0,...T?{top:0,bottom:`var(${gP})`,insetInlineEnd:0,[NP]:`${S.height}px`}:{insetInlineStart:0,insetInlineEnd:`var(${_P})`,bottom:0,[PP]:`${S.width}px`}}},M=Qv(`div`,e,{ref:[t,T?f:p],state:E,props:[j,s],stateAttributesMapping:hP});return A?(0,J.jsx)(HP.Provider,{value:i,children:M}):null}),GP=q.forwardRef(function(e,t){let{render:n,className:r,style:i,...a}=e,{thumbYRef:o,thumbXRef:s,handlePointerDown:c,handlePointerMove:l,handlePointerUp:u,scrollingX:d,scrollingY:f,hasMeasuredScrollbar:p}=iP(),m=UP(),h=m===`vertical`;return Qv(`div`,e,{ref:[t,h?o:s],state:{scrolling:h?f:d,orientation:m},props:[{onPointerDown:c,onPointerMove:l,onPointerUp:u,onPointerCancel:u,style:{visibility:p?void 0:`hidden`,...h?{height:`var(--scroll-area-thumb-height)`}:{width:`var(--scroll-area-thumb-width)`}}},a]})}),KP=q.forwardRef(function(e,t){let{render:n,className:r,style:i,...a}=e,{cornerRef:o,cornerSize:s,hiddenState:c}=iP(),l=Qv(`div`,e,{ref:[t,o],props:[{"aria-hidden":!0,style:{position:`absolute`,bottom:0,insetInlineEnd:0,width:s.width,height:s.height}},a]});return c.corner?null:l});function qP({className:e,children:t,...n}){return(0,J.jsxs)(CP,{"data-slot":`scroll-area`,className:X(`relative`,e),...n,children:[(0,J.jsx)(RP,{"data-slot":`scroll-area-viewport`,className:`size-full rounded-[inherit] transition-[color,box-shadow] -outline-offset-2`,children:t}),(0,J.jsx)(JP,{}),(0,J.jsx)(KP,{})]})}function JP({className:e,orientation:t=`vertical`,...n}){return(0,J.jsx)(WP,{"data-slot":`scroll-area-scrollbar`,"data-orientation":t,orientation:t,className:X(`flex touch-none p-px transition-colors select-none data-horizontal:h-2.5 data-horizontal:flex-col data-horizontal:border-t data-horizontal:border-t-transparent data-vertical:h-full data-vertical:w-2.5 data-vertical:border-l data-vertical:border-l-transparent`,e),...n,children:(0,J.jsx)(GP,{"data-slot":`scroll-area-thumb`,className:`relative flex-1 rounded-full bg-border`})})}var YP=(e,t)=>{let n=e.split(`/`),r=t.split(`/`);for(let e=0;e<Math.min(n.length,r.length);e++){let t=n[e]??``,i=r[e]??``;if(t===i)continue;let a=e<n.length-1;if(a!==e<r.length-1)return a?-1:1;let o=t.toLowerCase().localeCompare(i.toLowerCase(),`en`);return o===0?t<i?-1:1:o}return n.length-r.length},XP=e=>e.slice(0,Math.max(e.lastIndexOf(`/`),0)),ZP=e=>e.slice(e.lastIndexOf(`/`)+1),QP=e=>{let t={directories:new Map,files:[]};for(let n of e){let e=t;for(let t of n.split(`/`).slice(0,-1)){let n=e.directories.get(t)??{directories:new Map,files:[]};e.directories.set(t,n),e=n}e.files.push(n)}let n=(e,t)=>{let r=[...e.directories].map(([e,r])=>{let i=e,a=r,o=t===``?e:`${t}/${e}`;for(let[e]=a.directories;a.files.length===0&&a.directories.size===1&&e!==void 0;[e]=a.directories)i=`${i}/${e[0]}`,o=`${o}/${e[0]}`,a=e[1];let[s]=a.files;return s!==void 0&&a.files.length===1&&a.directories.size===0?{kind:`file`,path:s,name:ZP(s),directory:`${i}/`}:{kind:`directory`,path:o,label:`${i}/`,children:n(a,o)}}),i=e.files.map(e=>({kind:`file`,path:e,name:ZP(e)})),a=e=>e.kind===`file`?e.path:`${e.path}/x`;return[...r.sort((e,t)=>YP(a(e),a(t))),...i.sort((e,t)=>YP(e.path,t.path))]};return n(t,``)},$P=e=>{let[t]=e;return e.length===1&&t?.kind===`directory`?{root:t.label,entries:t.children}:{root:null,entries:e}},eF=e=>e.flatMap(e=>e.kind===`file`?[e.path]:eF(e.children)),tF=(e,t)=>{let n=t.toLowerCase().split(/\s+/).filter(Boolean);return e.filter(e=>{let t=e.path.toLowerCase();return n.every(e=>t.includes(e))})},nF=(e,t)=>[...e].sort((e,n)=>t===`size`&&n.additions+n.deletions-(e.additions+e.deletions)||YP(e.path,n.path)),rF=12,iF=24,aF=({label:e})=>{let t=e.slice(0,-1).lastIndexOf(`/`)+1;return t===0?(0,J.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:e}):(0,J.jsxs)(`span`,{className:`flex min-w-0 flex-1`,children:[(0,J.jsx)(`span`,{className:`min-w-[1.5em] shrink-[999] truncate`,children:e.slice(0,t)}),(0,J.jsx)(`span`,{className:`min-w-0 truncate`,children:e.slice(t)})]})},oF=({files:e,activePath:t,onSelect:n,mode:r=`tree`,order:i=`path`,navigate:a=!1,className:o})=>{let s=(0,q.useRef)(null);(0,q.useEffect)(()=>{let e=s.current?.querySelector(`[data-slot=scroll-area-viewport]`),t=s.current?.querySelector(`[aria-current]`);if(e==null||t==null)return;let n=t.getBoundingClientRect().top-e.getBoundingClientRect().top+e.scrollTop,r=Number(t.dataset.depth??0)*iF;(n<e.scrollTop+r||n>e.scrollTop+e.clientHeight-40)&&(e.scrollTop=Math.max(0,n-e.clientHeight/3))},[t]);let[c,l]=(0,q.useState)(``),[u,d]=(0,q.useState)(new Set),[f,p]=(0,q.useState)(t);if(f!==t){p(t);let e=[...u].filter(e=>t?.startsWith(`${e}/`));e.length>0&&d(new Set([...u].filter(t=>!e.includes(t))))}let m=(0,q.useRef)(null);_k({filterTree:()=>m.current?.focus()});let h=(0,q.useMemo)(()=>tF(e,c),[e,c]),g=(0,q.useMemo)(()=>new Map(e.map(e=>[e.path,e])),[e]),{root:_,entries:v}=(0,q.useMemo)(()=>$P(QP(h.map(e=>e.path))),[h]),y=(0,q.useMemo)(()=>r===`tree`?eF(v):nF(h,i).map(e=>e.path),[r,v,h,i]),b=(0,q.useMemo)(()=>{let e=y.filter(e=>g.get(e)?.points!==void 0);return new Map(e.map((e,t)=>[e,t]))},[y,g]),x=e=>{let r=t===null?-1:y.indexOf(t),i=y[Math.min(y.length-1,Math.max(0,r+e))];i!==void 0&&n(i)};_k({nextFile:()=>x(1),previousFile:()=>x(-1)},a);let S=e=>{let t=new Set(u);t.has(e)?t.delete(e):t.add(e),d(t)},C=(e,r,i,a)=>(0,J.jsx)(`li`,{children:(0,J.jsx)(dF,{entry:e,label:r,depth:i,...a===void 0?{}:{directory:a},active:e.path===t,onSelect:n,...b.has(e.path)?{landing:{at:b.get(e.path)??0,of:b.size}}:{}})},e.path),w=(e,t)=>e.map(e=>{if(e.kind===`file`){let n=g.get(e.path);return n===void 0?null:C(n,e.name,t,e.directory)}let n=c.trim()!==``||!u.has(e.path),r=n?gg:vg,i=t*rF+4;return(0,J.jsxs)(`li`,{children:[(0,J.jsxs)(`button`,{type:`button`,title:`${e.path}/`,"aria-expanded":n,onClick:()=>S(e.path),className:`sticky flex h-6 w-full items-center gap-1.5 rounded-md bg-background pr-2 text-left font-medium hover:bg-accent`,style:{paddingLeft:`${i}px`,top:`${t*iF}px`,zIndex:Math.max(1,30-t)},children:[(0,J.jsx)(Bh,{"aria-hidden":`true`,className:X(`size-3 shrink-0 text-muted-foreground transition-transform duration-(--duration-fast) ease-standard`,!n&&`-rotate-90`)}),(0,J.jsx)(r,{"aria-hidden":`true`,className:`size-3.5 shrink-0 text-muted-foreground`}),(0,J.jsx)(aF,{label:e.label})]}),n&&(0,J.jsxs)(`div`,{className:`relative`,children:[(0,J.jsx)(`span`,{"aria-hidden":`true`,className:`absolute inset-y-0 w-px bg-border`,style:{left:`${i+6}px`}}),(0,J.jsx)(`ul`,{children:w(e.children,t+1)})]})]},e.path)});return(0,J.jsxs)(`nav`,{ref:s,"aria-label":`Changed files`,className:X(`flex min-h-0 flex-col gap-2`,o),children:[(0,J.jsxs)(`div`,{className:`relative px-1`,children:[(0,J.jsx)(nP,{ref:m,type:`search`,value:c,onChange:e=>l(e.target.value),onKeyDown:e=>{e.key===`Escape`&&c!==``&&(e.preventDefault(),l(``))},placeholder:`Filter files`,"aria-label":`Filter files`,className:`h-7 pr-8`}),(0,J.jsx)(bk,{id:`filterTree`,className:`absolute top-1/2 right-3 -translate-y-1/2`})]}),(0,J.jsxs)(`p`,{className:`flex gap-1 px-2 text-caption text-muted-foreground`,"aria-live":`polite`,..._===null||r!==`tree`?{}:{title:_},children:[(0,J.jsxs)(`span`,{className:`shrink-0`,children:[c.trim()===``?`${e.length} files`:`${h.length} of ${e.length} files`,_!==null&&r===`tree`&&` in`]}),` `,_!==null&&r===`tree`&&(0,J.jsx)(`span`,{className:`flex min-w-0 flex-1 font-mono text-code-compact`,children:(0,J.jsx)(aF,{label:_})})]}),h.length===0?(0,J.jsx)(VN,{inline:!0,tone:`muted`,glyph:`∅`,title:`No files match`,body:`Nothing in this PR has “${c.trim()}” in its path.`,actions:[{label:`Clear filter`,onClick:()=>l(``)}]}):(0,J.jsx)(qP,{className:`min-h-0 flex-1`,children:(0,J.jsx)(`ul`,{className:`flex flex-col gap-px px-1 pb-2`,children:r===`tree`?w(v,0):nF(h,i).map(e=>C(e,e.path,0))})})]})},sF=({count:e})=>(0,J.jsxs)(`span`,{"data-slot":`thread-count`,className:`tabular inline-flex items-center gap-0.5 text-caption`,children:[(0,J.jsx)(Kg,{"aria-hidden":`true`,className:`size-3`}),e,(0,J.jsxs)(`span`,{className:`sr-only`,children:[` open `,e===1?`thread`:`threads`]})]}),cF=[`finding`,`risk`,`decision`],lF={finding:`text-review-changes`,risk:`text-risk-contract`,decision:`text-muted-foreground`},uF=({points:e,landing:t})=>(0,J.jsx)(`span`,{"data-land":`drop`,style:vh({"--landing-i":t?.at??0,"--landing-n":t?.of??1}),className:`inline-flex items-center gap-1.5`,children:cF.map(t=>{let n=e[t]??0;if(n===0)return null;let{label:r}=oD[t],i=sD[t];return(0,J.jsxs)(`span`,{"data-slot":`point-count`,"data-kind":t,className:X(`tabular inline-flex items-center gap-0.5 text-caption font-medium`,lF[t]),children:[(0,J.jsx)(i,{"aria-hidden":`true`,className:`size-3`}),n,(0,J.jsxs)(`span`,{className:`sr-only`,children:[` `,r.toLowerCase(),n===1?``:`s`]})]},t)})}),dF=({entry:e,label:t,depth:n=0,active:r=!1,directory:i,landing:a,onSelect:o})=>{let s=e.status===void 0?null:lD[e.status],c=s?.kind===`mark`?s:null;return(0,J.jsxs)(`button`,{type:`button`,"aria-current":r?`location`:void 0,"data-depth":n,title:e.path,onClick:()=>o(e.path),className:X(`flex min-h-6 w-full flex-wrap items-center gap-x-1.5 rounded-md pr-2 text-left hover:bg-surface-row`,r&&`bg-surface-row font-medium shadow-[inset_3px_0_0_var(--primary)]`),style:{paddingLeft:`${n*rF+4}px`},children:[(0,J.jsxs)(`span`,{className:X(`flex items-center gap-1.5`,i===void 0?`min-w-[min(7rem,100%)] flex-1 basis-0`:`max-w-full flex-[1_0_auto]`),children:[(0,J.jsx)(KD,{path:e.path,status:e.status}),(0,J.jsxs)(`span`,{className:`flex min-w-0 flex-1`,children:[i!==void 0&&(0,J.jsx)(`span`,{className:`min-w-[1.5em] shrink-[999] truncate text-muted-foreground [direction:rtl]`,children:(0,J.jsx)(`bdi`,{dir:`ltr`,children:i})}),(0,J.jsxs)(`span`,{className:`relative min-w-0 truncate`,children:[(0,J.jsx)(`span`,{"data-slot":`file-name`,className:c?.name,children:t===e.path?t:ZP(e.path)}),c!==null&&(0,J.jsxs)(`span`,{className:`sr-only`,children:[`, `,c.label]})]})]})]}),(0,J.jsxs)(`span`,{"data-slot":`file-row-counts`,className:`ml-auto flex flex-wrap items-center justify-end gap-x-1.5 whitespace-nowrap`,children:[e.status!==void 0&&(0,J.jsx)(YD,{status:e.status}),e.points!==void 0&&(0,J.jsx)(uF,{points:e.points,...a===void 0?{}:{landing:a}}),e.threads!==void 0&&e.threads>0&&(0,J.jsx)(sF,{count:e.threads}),e.additions!==void 0&&e.deletions!==void 0&&(0,J.jsxs)(`span`,{className:`tabular font-mono text-code-compact`,children:[(0,J.jsxs)(`span`,{className:`text-diff-add-fg`,children:[`+`,e.additions]}),` `,(0,J.jsxs)(`span`,{className:`text-diff-del-fg`,children:[`−`,e.deletions]})]})]})]})},fF=60,pF=3600,mF=24*pF,hF=(e,t)=>{let n=Math.max(0,Math.round((t-Date.parse(e))/1e3));if(n<fF)return`just now`;if(n<pF)return`${Math.floor(n/fF)} min ago`;if(n<mF)return`${Math.floor(n/pF)} h ago`;let r=Math.floor(n/mF);if(r===1)return`yesterday`;if(r<7)return`${r} days ago`;let i=(e,t)=>`${e} ${t}${e===1?``:`s`} ago`;return r<30?i(Math.floor(r/7),`week`):r<365?i(Math.floor(r/30),`month`):i(Math.floor(r/365),`year`)},gF=e=>new Date(e).toLocaleString(`en`,{dateStyle:`full`,timeStyle:`short`}),_F={github:`GitHub`,bitbucket:`Bitbucket`},vF=({repo:e,number:t})=>`${e.owner}/${e.repo} #${t}`,yF=[`bg-avatar-1-bg text-avatar-1-fg`,`bg-avatar-2-bg text-avatar-2-fg`,`bg-avatar-3-bg text-avatar-3-fg`,`bg-avatar-4-bg text-avatar-4-fg`,`bg-avatar-5-bg text-avatar-5-fg`,`bg-avatar-6-bg text-avatar-6-fg`,`bg-avatar-7-bg text-avatar-7-fg`,`bg-avatar-8-bg text-avatar-8-fg`],bF=e=>{let t=0;for(let n of e)t=t*31+(n.codePointAt(0)??0)>>>0;return yF[t%yF.length]??yF[0]},xF=`animate-spin motion-reduce:animate-[spin_3s_linear_infinite]`,SF=(e,t)=>{let n=e.role===`author`?`you`:e.author.name;return`${e.title}. ${vF(e.ref)} by ${n}, updated ${hF(e.updatedAt,t)}, ${_F[e.ref.repo.host]}`},CF=({item:e,nowMs:t,starting:n,tabbable:r,onOpen:i,onFocus:a})=>{let o=_F[e.ref.repo.host],s=e.role===`author`?`you`:e.author.name;return(0,J.jsx)(`li`,{children:(0,J.jsxs)(`a`,{href:E_(e.ref),"data-pr-row":``,tabIndex:r?0:-1,"aria-label":SF(e,t),"aria-busy":n,onClick:e=>{M_(e)&&(e.preventDefault(),n||i())},onFocus:a,className:`group flex min-h-[58px] w-full flex-col items-stretch gap-x-3 gap-y-1 px-4 py-2 text-left text-foreground hover:bg-accent hover:no-underline focus-visible:bg-accent focus-visible:-outline-offset-2 aria-busy:bg-diff-hunk-bg max-sm:items-start sm:flex-row sm:items-center`,children:[(0,J.jsxs)(`span`,{className:`flex min-w-0 flex-1 flex-col gap-1 self-stretch`,children:[(0,J.jsx)(`span`,{className:`truncate font-medium`,children:e.title}),(0,J.jsxs)(`span`,{className:`flex min-w-0 items-center gap-x-1.5 text-caption text-muted-foreground`,children:[(0,J.jsxs)(`span`,{className:`flex min-w-0 gap-[1ch] font-mono text-code-compact`,children:[(0,J.jsxs)(`span`,{className:`min-w-0 truncate`,children:[e.ref.repo.owner,`/`,e.ref.repo.repo]}),(0,J.jsxs)(`span`,{className:`shrink-0`,children:[`#`,e.ref.number]})]}),(0,J.jsx)(`span`,{"aria-hidden":`true`,className:X(`flex size-5 shrink-0 items-center justify-center rounded-full text-[10px] font-medium`,bF(e.author.id)),children:wk(e.author.name)}),(0,J.jsx)(`span`,{className:`max-w-32 shrink-0 truncate`,children:s}),(0,J.jsx)(`time`,{dateTime:e.updatedAt,title:gF(e.updatedAt),className:`shrink-0 whitespace-nowrap`,children:hF(e.updatedAt,t)}),(0,J.jsx)(eO,{variant:`outline`,className:`ml-auto shrink-0 text-muted-foreground @min-[480px]:hidden`,children:o})]})]}),n?(0,J.jsxs)(`span`,{className:`flex shrink-0 items-center gap-2 text-caption`,children:[(0,J.jsx)(Hg,{"aria-hidden":`true`,className:X(`size-4 text-diff-hunk-fg`,xF)}),(0,J.jsx)(`span`,{className:`font-medium text-diff-hunk-fg`,children:`Opening review…`}),(0,J.jsx)(`span`,{className:`text-muted-foreground`,children:`Esc to cancel`})]}):(0,J.jsxs)(`span`,{className:`flex shrink-0 items-center gap-2 @max-[479px]:hidden`,children:[(0,J.jsx)(eO,{variant:`outline`,className:`text-muted-foreground @max-[479px]:hidden`,children:o}),(0,J.jsx)(bk,{id:`openRow`,className:`hidden group-focus-visible:inline-flex`}),(0,J.jsx)(Wh,{"aria-hidden":`true`,className:`size-4 text-muted-foreground opacity-0 group-hover:opacity-100 group-focus-visible:opacity-100 max-sm:hidden`})]})]})})},wF={ArrowDown:(e,t)=>Math.min(t,e+1),ArrowUp:e=>Math.max(0,e-1),Home:()=>0,End:(e,t)=>t},TF=({title:e,word:t,items:n,count:r,loading:i,skeletonRows:a,notes:o,blocked:s,empty:c,nowMs:l,startingUrl:u,onOpen:d})=>{let f=(0,q.useId)(),p=(0,q.useRef)(null),[m,h]=(0,q.useState)(0),g=n??[],_=Math.min(m,Math.max(0,g.length-1)),v=e=>{let t=wF[e.key],n=[...p.current?.querySelectorAll(`[data-pr-row]`)??[]],r=e.target instanceof HTMLElement?n.indexOf(e.target):-1;if(t===void 0||r===-1)return;e.preventDefault();let i=t(r,n.length-1);h(i),n[i]?.focus()},y=c.icon;return(0,J.jsxs)(`section`,{"aria-labelledby":f,className:`@container flex min-w-0 flex-col overflow-hidden rounded-xl border bg-card`,children:[(0,J.jsxs)(`div`,{className:`flex min-h-11 flex-wrap items-center gap-x-2 gap-y-1 border-b px-4 py-2`,children:[(0,J.jsx)(`h2`,{id:f,className:`text-heading font-semibold`,children:e}),r!==null&&(0,J.jsxs)(`span`,{className:`rounded-full bg-muted px-2 text-caption font-medium text-muted-foreground tabular-nums`,children:[(0,J.jsx)(`span`,{"aria-hidden":`true`,children:r}),(0,J.jsx)(`span`,{className:`sr-only`,children:r===`…`?`Loading`:`${r} pull request${r===1?``:`s`}`})]}),(0,J.jsx)(`span`,{className:`text-caption text-muted-foreground`,children:t})]}),(0,J.jsx)(`div`,{className:`flex flex-col gap-2 p-3 empty:hidden`,children:o}),s??(n===null?(0,J.jsxs)(`div`,{"aria-busy":`true`,className:`flex flex-col`,children:[(0,J.jsxs)(`p`,{className:`flex items-center gap-2 px-4 pt-3 text-caption text-muted-foreground`,children:[(0,J.jsx)(Hg,{"aria-hidden":`true`,className:X(`size-4`,`animate-spin motion-reduce:animate-[spin_3s_linear_infinite]`)}),i]}),(0,J.jsx)(`ul`,{"aria-hidden":`true`,className:`flex flex-col gap-3 px-4 py-3`,children:Array.from({length:a},(e,t)=>(0,J.jsxs)(`li`,{className:`flex flex-col gap-1.5`,children:[(0,J.jsx)(zN,{className:`h-4 w-3/4 motion-reduce:animate-none`}),(0,J.jsx)(zN,{className:`h-3 w-1/2 motion-reduce:animate-none`})]},t))})]}):g.length===0?(0,J.jsxs)(`div`,{className:`flex flex-col items-center gap-1 px-6 py-8 text-center`,children:[(0,J.jsx)(y,{"aria-hidden":`true`,className:`mb-1 size-6 text-muted-foreground`}),(0,J.jsx)(`p`,{className:`font-medium`,children:c.title}),(0,J.jsx)(`p`,{className:`max-w-sm text-caption text-muted-foreground`,children:c.text})]}):(0,J.jsx)(`ul`,{ref:p,className:`divide-y`,onKeyDown:v,children:g.map((e,t)=>(0,J.jsx)(CF,{item:e,nowMs:l,starting:u===e.url,tabbable:t===_,onOpen:()=>d(e),onFocus:()=>h(t)},e.url))}))]})},EF=Tc.options,DF=`flex flex-wrap items-baseline gap-x-2 gap-y-1 text-caption`,OF=`h-6 min-w-6 px-1 text-caption`,kF=e=>e.map(e=>_F[e]).join(` and `),AF=(e,t)=>{let n=e===null?[]:EF.filter(t=>e.hosts[t].configured),r=n.filter(t=>e?.hosts[t].error!=null),i=(t?.errors??[]).filter(e=>!r.includes(e.host));return{configured:n,failing:r,listFailed:i,shown:n.filter(e=>!r.includes(e)&&!i.some(t=>t.host===e))}},jF=(e,t)=>(0,J.jsxs)(`div`,{className:`flex flex-col items-center gap-2 px-6 py-8 text-center text-caption text-muted-foreground`,children:[(0,J.jsx)(`p`,{children:e}),t]}),MF=({status:e,list:t,error:n,rowFailure:r,startingUrl:i,nowMs:a,onOpen:o,onRetry:s,onOpenConnections:c,onFix:l})=>{let u=AF(e,t),d=e!==null&&u.configured.length===0,f=t!==null&&u.configured.length>0&&u.shown.length===0,p=u.configured.length>1&&u.shown.length===1&&u.shown[0]!==void 0?`${_F[u.shown[0]]} only`:null,m=e=>n===null?null:(0,J.jsxs)(`p`,{className:X(LN,DF),role:`alert`,children:[(0,J.jsx)(`span`,{className:`font-medium`,children:`Couldn't list pull requests.`}),(0,J.jsx)(`span`,{children:Ap(n)}),e&&(0,J.jsx)($,{variant:`link`,className:`h-6 min-w-6 px-1 text-caption`,onClick:s,children:`Retry`})]}),h=e=>r?.role===e?(0,J.jsxs)(`p`,{className:X(LN,DF),role:`alert`,children:[(0,J.jsx)(`span`,{children:r.message}),(0,J.jsx)($,{variant:`link`,className:OF,onClick:r.onRetry,children:`Try again`})]}):null,g=u.failing.map(e=>(0,J.jsxs)(`p`,{className:X(RN,DF),role:`status`,children:[(0,J.jsxs)(`span`,{children:[_F[e],` pull requests are hidden until `,_F[e],` works again.`]}),(0,J.jsx)($,{variant:`link`,className:OF,onClick:l,children:`Fix…`})]},e)),_=u.listFailed.map(e=>(0,J.jsxs)(`p`,{className:X(LN,DF),role:`alert`,children:[(0,J.jsxs)(`span`,{className:`font-medium`,children:[`Couldn't load `,_F[e.host],` pull requests.`]}),(0,J.jsx)(`span`,{children:e.message}),u.shown.length>0&&(0,J.jsxs)(`span`,{children:[kF(u.shown),` pull requests are shown.`]}),(0,J.jsx)($,{variant:`link`,className:OF,onClick:s,children:`Retry`})]},e.host)),v=u.configured.length===0?`Loading`:`Loading from ${kF(u.configured)}`,y=t?.items.filter(e=>e.role===`reviewer`)??null,b=t?.items.filter(e=>e.role===`author`)??null,x=e=>e===null?n===null?`…`:null:f?null:e.length;return(0,J.jsxs)(`div`,{className:`grid items-start gap-4 lg:grid-cols-[1.55fr_1fr]`,children:[(0,J.jsx)(TF,{title:`To review`,word:p??`Waiting for your review`,items:y,count:x(y),loading:v,skeletonRows:5,notes:(0,J.jsxs)(J.Fragment,{children:[t!==null&&m(!0),g,_,h(`reviewer`)]}),blocked:d?jF(`Connect GitHub or Bitbucket to list pull requests.`,(0,J.jsx)($,{variant:`outline`,size:`sm`,onClick:c,children:`Open Connections`})):t===null&&n!==null?m(!0):!f&&void 0,empty:{icon:Mg,title:`Nothing is waiting for you`,text:`When someone asks for your review on GitHub or Bitbucket, it appears here. To review something else, paste its link above.`},nowMs:a,startingUrl:i,onOpen:o}),(0,J.jsx)(TF,{title:`Your pull requests`,word:p??`Open`,items:b,count:x(b),loading:`Loading`,skeletonRows:3,notes:(0,J.jsxs)(J.Fragment,{children:[t!==null&&m(!1),h(`author`)]}),blocked:d?jF(`Connect GitHub or Bitbucket to list pull requests.`):t===null&&n!==null?m(!1):f?jF(`Couldn't load pull requests.`):void 0,empty:{icon:Og,title:`No open pull requests`,text:`Pull requests you open on GitHub or Bitbucket appear here.`},nowMs:a,startingUrl:i,onOpen:o})]})},NF=(0,q.createContext)(null),PF=()=>{let e=(0,q.useContext)(NF);if(e===null)throw Error(`useConnections needs a ConnectionsProvider`);return e},FF=({children:e,now:t=Date.now})=>{let{status:n,error:r,loading:i,refresh:a}=Sp(),[o,s]=(0,q.useState)(null),[c,l]=(0,q.useState)(null),[u,d]=(0,q.useState)(0),[f,p]=(0,q.useState)(!1),[m,h]=(0,q.useState)(!1);(0,q.useEffect)(()=>{!i&&n!==null&&s(t())},[i,n,t]);let g=(0,q.useCallback)(()=>{a(),d(e=>e+1)},[a]),_=(0,q.useCallback)((e,t)=>{h(e&&t?.focusCheckAgain===!0),p(e)},[]),v=(0,q.useMemo)(()=>({status:n,error:r,checking:i,checkedAtMs:o,listed:c,reportListed:l,checkAgain:g,checks:u,open:f,setOpen:_,focusCheckAgain:m}),[n,r,i,o,c,g,u,f,_,m]);return(0,J.jsx)(NF.Provider,{value:v,children:e})},IF=({pullRequest:e,error:t})=>{let{setOpen:n}=PF(),r=`Couldn't open ${vF(e)}: `;return t.code===`host-not-configured`?(0,J.jsxs)(J.Fragment,{children:[r,_F[e.repo.host],` isn't configured.`,` `,(0,J.jsx)($,{variant:`link`,className:OF,onClick:()=>n(!0),children:`Open Connections`})]}):(0,J.jsx)(J.Fragment,{children:`${r}${Ap(t)}`})},LF=({pullRequest:e})=>{let{client:t}=yp(),[n,r]=(0,q.useState)(0),[i,a]=(0,q.useState)(null),o=vF(e),s=(0,q.useRef)(0);return(0,q.useEffect)(()=>(s.current=n,t.startAnalysis({url:hf(e)}).then(e=>{s.current===n&&(e.ok?j_(D_(e.value.analysisId)):a(e.error))}),()=>{s.current=-1}),[t,e,n]),(0,J.jsxs)(`div`,{className:`mx-auto flex max-w-2xl flex-col gap-3 py-12`,children:[(0,J.jsx)(`h1`,{className:`text-title font-semibold tracking-[-0.01em]`,children:o}),(0,J.jsx)(`p`,{role:`status`,className:`flex flex-wrap items-center gap-x-2 gap-y-1 text-body`,children:i===null?(0,J.jsxs)(J.Fragment,{children:[(0,J.jsxs)(`span`,{className:`flex items-center gap-1.5 text-muted-foreground`,children:[(0,J.jsx)(Hg,{"aria-hidden":`true`,className:X(`size-4`,xF)}),`Fetching `,o,` from `,_F[e.repo.host],`…`]}),(0,J.jsx)($,{variant:`link`,className:OF,onClick:()=>{s.current=-1,j_(`/`)},children:`Cancel`})]}):(0,J.jsxs)(J.Fragment,{children:[(0,J.jsxs)(`span`,{className:`text-destructive`,children:[(0,J.jsx)(v_,{"aria-hidden":`true`,className:`mr-1 inline size-4 align-[-3px]`}),(0,J.jsx)(IF,{pullRequest:e,error:i})]}),(0,J.jsx)($,{variant:`link`,className:OF,onClick:()=>{a(null),r(e=>e+1)},children:`Try again`})]})}),i!==null&&(0,J.jsx)(`p`,{className:`text-body`,children:(0,J.jsx)(N_,{to:`/`,children:`Go to your pull requests`})})]})},RF=q.createContext(void 0);function zF(e){let t=q.useContext(RF);if(t===void 0&&!e)throw Error(Ov(72));return t}var BF={...Cw,disabled:e=>e.disabled,instantType:e=>e.instantType,isInstantPhase:e=>e.isInstantPhase,trackCursorAxis:e=>e.trackCursorAxis,disableHoverablePopup:e=>e.disableHoverablePopup,lastOpenChangeReason:e=>e.openChangeReason,closeOnClick:e=>e.closeOnClick,appliedTriggerProps:(e,t)=>t?e.activeTriggerProps:void 0,closeDelay:e=>e.closeDelay,adaptiveOrigin:e=>e.adaptiveOrigin},VF=class extends mw{constructor(e,t,n){let r=new tw;super(UF(e,r,t,n),WF(r),BF)}setOpen=(e,t)=>{YC(this,e,t,{extraState:{openChangeReason:t.reason}})};cancelPendingOpen(e){this.state.floatingRootContext.dispatchOpenChange(!1,Ab(Nb,e))}};function HF(){let e=new tw,t=new rE(Object.freeze(UF(void 0,e)),Object.freeze(WF(e)),BF);return Object.assign(t,{setOpen:Kv,cancelPendingOpen:Kv})}function UF(e,t,n,r=!1){return{..._w(t,n,r),disabled:!1,instantType:void 0,isInstantPhase:!1,trackCursorAxis:`none`,disableHoverablePopup:!1,openChangeReason:null,closeOnClick:!0,closeDelay:0,adaptiveOrigin:void 0,...e}}function WF(e){return{popupRef:q.createRef(),onOpenChange:void 0,onOpenChangeComplete:void 0,triggerElements:e}}var GF=my(function(e){let{disabled:t=!1,defaultOpen:n=!1,open:r,disableHoverablePopup:i=!1,trackCursorAxis:a=`none`,actionsRef:o,onOpenChange:s,onOpenChangeComplete:c,handle:l,triggerId:u,defaultTriggerId:d=null,children:f}=e,p=UC((e,t)=>new VF({open:n,openProp:r,activeTriggerId:d,triggerIdProp:u},e,t));p.useControlledProp(`openProp`,r),p.useControlledProp(`triggerIdProp`,u),p.useContextCallback(`onOpenChange`,s),p.useContextCallback(`onOpenChangeComplete`,c);let m=p.useState(`open`),h=!t&&m,g=p.useState(`activeTriggerId`),_=p.useState(`mounted`),v=p.useState(`payload`);p.useSyncedValues({trackCursorAxis:a,disableHoverablePopup:i,disabled:t}),ZC(p,{closeOnActiveTriggerUnmount:!0});let{forceUnmount:y,transitionStatus:b}=QC(h,p),x=p.useState(`isInstantPhase`),S=p.useState(`instantType`),C=p.useState(`lastOpenChangeReason`),w=q.useRef(null);Q(()=>{m&&t&&p.setOpen(!1,Ab(Kb))},[m,t,p]),Q(()=>{b===`ending`&&C===`none`||b!==`ending`&&x?(S!==`delay`&&(w.current=S),p.set(`instantType`,`delay`)):w.current!==null&&(p.set(`instantType`,w.current),w.current=null)},[b,x,C,S,p]),Q(()=>{h&&(g??p.set(`payload`,void 0))},[p,g,h]),q.useImperativeHandle(o,()=>({unmount:y,close:()=>p.setOpen(!1,Ab(Yb))}),[y,p]);let T=h||_||!t&&a!==`none`;return(0,J.jsxs)(RF.Provider,{value:p,children:[l&&(0,J.jsx)(WC,{handle:l,store:p}),T&&(0,J.jsx)(KF,{store:p,disabled:t,trackCursorAxis:a}),typeof f==`function`?f({payload:v}):f]})});function KF({store:e,disabled:t,trackCursorAxis:n}){let r=e.useState(`floatingRootContext`),i=bC(r,{enabled:!t,referencePress:()=>e.select(`closeOnClick`)}),a=_C(r,{enabled:!t&&n!==`none`,axis:n===`none`?void 0:n}),o=q.useMemo(()=>mv(a.reference,i.reference),[a.reference,i.reference]);return $C(e,{activeTriggerProps:o,inactiveTriggerProps:o,popupProps:i.floating??Jv}),null}var qF=q.createContext(void 0);function JF(){return q.useContext(qF)}var YF=`data-base-ui-tooltip-trigger`;function XF(e){let t=Wy(e);return z_(t)?t:null}var ZF=hy(function(e,t){let{render:n,className:r,style:i,handle:a,payload:o,disabled:s,delay:c,closeOnClick:l=!0,closeDelay:u,id:d,...f}=e,p=zF(!0),m=ww(a)??p;if(!m)throw Error(Ov(82));let h=gE(d),g=m.useState(`isTriggerActive`,h),_=m.useState(`isOpenedByTrigger`,h),v=m.useState(`floatingRootContext`),y=q.useRef(null),b=u??0,{registerTrigger:x,isMountedByThisTrigger:S}=XC(h,y,m,{payload:o,closeOnClick:l,closeDelay:b}),C=JF(),{activeIdRef:w,delayRef:T,isInstantPhase:E,hasProvider:D}=ex(v,{open:_}),O=Mw(v);m.useSyncedValue(`isInstantPhase`,E);let k=m.useState(`disabled`),A=s??k,j=rx(A),M=m.useState(`trackCursorAxis`),N=m.useState(`disableHoverablePopup`),P=q.useRef(!1),F=by(),I=q.useRef(void 0);function L(){return D&&w.current!=null?0:c??C??600}function R(e){let t=y.current;if(!t||!e)return!1;let n=Uy(e,`[${YF}]`);return n!==null&&n!==t&&Hy(t,n)}function ee(e){let t=R(e);return P.current=t,t&&(O.openChangeTimeout.clear(),O.restTimeout.clear(),O.restTimeoutPending=!1,F.clear()),t}let z=Fw(v,{enabled:!A,mouseOnly:!0,move:!1,handleClose:!N&&M!==`both`?Zw():null,restMs:L,delay(){return u==null&&D?{close:Eb(T.current,`close`)}:{close:b}},triggerElementRef:y,isActiveTrigger:g,isClosing:()=>m.select(`transitionStatus`)===`ending`,shouldOpen(){return!P.current}}),te=Dw(v,{enabled:!A}).reference,B=e=>{let t=P.current,n=XF(e),r=ee(n),i=y.current,a=i&&n&&Hy(i,n);if(r&&m.select(`open`)&&m.select(`lastOpenChangeReason`)===`trigger-hover`)m.setOpen(!1,Ab(Pb,e));else if(t&&!r&&a&&!j.current&&!m.select(`open`)&&i&&zy(I.current)){let t=()=>{!P.current&&!j.current&&!m.select(`open`)&&m.setOpen(!0,Ab(Pb,e,i))},n=L();n===0?(F.clear(),t()):F.start(n,t)}},ne=m.useState(`appliedTriggerProps`,S||M!==`none`);return Qv(`button`,e,{state:{open:_},ref:[t,x,y],props:[z,te,ne,{onMouseOver(e){B(e.nativeEvent)},onFocus(e){R(XF(e.nativeEvent))&&e.preventBaseUIHandler()},onMouseLeave(){P.current=!1,F.clear(),I.current=void 0},onPointerEnter(e){I.current=e.pointerType},onPointerDown(e){I.current=e.pointerType,m.set(`closeOnClick`,l),l&&!m.select(`open`)&&m.cancelPendingOpen(e.nativeEvent)},onClick(e){l&&!m.select(`open`)&&m.cancelPendingOpen(e.nativeEvent)},id:h,[gb]:A?``:void 0,[YF]:A?void 0:``},f],stateAttributesMapping:fb})}),QF=q.createContext(void 0);function $F(){let e=q.useContext(QF);if(e===void 0)throw Error(Ov(70));return e}var eI=q.forwardRef(function(e,t){let{keepMounted:n=!1,...r}=e;return zF().useState(`mounted`)||n?(0,J.jsx)(QF.Provider,{value:n,children:(0,J.jsx)(mE,{ref:t,...r})}):null}),tI=q.createContext(void 0);function nI(){let e=q.useContext(tI);if(e===void 0)throw Error(Ov(71));return e}var rI=q.forwardRef(function(e,t){let{render:n,className:r,anchor:i,positionMethod:a=`absolute`,side:o=`top`,align:s=`center`,sideOffset:c=0,alignOffset:l=0,collisionBoundary:u=`clipping-ancestors`,collisionPadding:d=5,arrowPadding:f=5,sticky:p=!1,disableAnchorTracking:m=!1,collisionAvoidance:h=VS,style:g,..._}=e,v=zF(),y=$F(),b=v.useState(`open`),x=v.useState(`mounted`),S=v.useState(`trackCursorAxis`),C=v.useState(`disableHoverablePopup`),w=v.useState(`floatingRootContext`),T=v.useState(`instantType`),E=v.useState(`transitionStatus`),D=IE({anchor:i,positionMethod:a,floatingRootContext:w,mounted:x,side:o,sideOffset:c,align:s,alignOffset:l,collisionBoundary:u,collisionPadding:d,sticky:p,arrowPadding:f,disableAnchorTracking:m,keepMounted:y,collisionAvoidance:h,adaptiveOrigin:v.useState(`adaptiveOrigin`)}),O=BE(e,q.useMemo(()=>({open:b,side:D.side,align:D.align,anchorHidden:D.anchorHidden,instant:S===`none`?T:`tracking-cursor`}),[b,D.side,D.align,D.anchorHidden,S,T]),{styles:D.positionerStyles,transitionStatus:E,props:_,refs:[t,v.useStateSetter(`positionerElement`)],hidden:!x,inert:!b||S===`both`||C});return(0,J.jsx)(tI.Provider,{value:D,children:O})}),iI=q.forwardRef(function(e,t){let{render:n,className:r,style:i,...a}=e,o=zF(),{side:s,align:c}=nI(),l=o.useState(`open`),u=o.useState(`instantType`),d=o.useState(`transitionStatus`),f=o.useState(`popupProps`),p=o.useState(`floatingRootContext`),m=o.useState(`disabled`),h=o.useState(`closeDelay`);zC({open:l,ref:o.context.popupRef,onComplete(){l&&o.context.onOpenChangeComplete?.(!0)}}),Nw(p,{enabled:!m,closeDelay:h});let g=o.useStateSetter(`popupElement`);return Qv(`div`,e,{state:{open:l,side:s,align:c,instant:u,transitionStatus:d},ref:[t,o.context.popupRef,g],props:[VC,f,zE(d),a],stateAttributesMapping:hb})}),aI=q.forwardRef(function(e,t){let{render:n,className:r,style:i,...a}=e,o=zF(),{arrowRef:s,side:c,align:l,arrowUncentered:u,arrowStyles:d}=nI();return Qv(`div`,e,{state:{open:o.useState(`open`),side:c,align:l,uncentered:u,instant:o.useState(`instantType`)},ref:[t,s],props:[{style:d,"aria-hidden":!0},a],stateAttributesMapping:mb})}),oI=function(e){let{delay:t,closeDelay:n,timeout:r=400}=e,i=q.useMemo(()=>({open:t,close:n}),[t,n]);return(0,J.jsx)(qF.Provider,{value:t,children:(0,J.jsx)($b,{delay:i,timeoutMs:r,children:e.children})})},sI=class extends MC{constructor(){super(HF(),`Tooltip`)}open(e){this.openByTrigger(e)}close(){this.closePopup()}get isOpen(){return this.attachedStore?.select(`open`)??!1}};function cI(){return new sI}function lI({delay:e=0,...t}){return(0,J.jsx)(oI,{"data-slot":`tooltip-provider`,delay:e,...t})}function uI({...e}){return(0,J.jsx)(GF,{"data-slot":`tooltip`,...e})}function dI({...e}){return(0,J.jsx)(ZF,{"data-slot":`tooltip-trigger`,...e})}function fI({className:e,side:t=`top`,sideOffset:n=4,align:r=`center`,alignOffset:i=0,collisionBoundary:a,children:o,shortcut:s,...c}){return(0,J.jsx)(eI,{children:(0,J.jsx)(rI,{collisionBoundary:a,align:r,alignOffset:i,side:t,sideOffset:n,className:`isolate z-50`,children:(0,J.jsxs)(iI,{"data-slot":`tooltip-content`,className:X(`z-50 inline-flex w-fit max-w-xs origin-(--transform-origin) items-center gap-1.5 rounded-md bg-foreground px-3 py-1.5 text-caption text-background has-data-[slot=kbd]:pr-1.5 data-[side=bottom]:slide-in-from-top-2 data-[side=inline-end]:slide-in-from-left-2 data-[side=inline-start]:slide-in-from-right-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 **:data-[slot=kbd]:relative **:data-[slot=kbd]:isolate **:data-[slot=kbd]:z-50 **:data-[slot=kbd]:rounded-sm data-[state=delayed-open]:animate-in data-[state=delayed-open]:fade-in-0 data-[state=delayed-open]:zoom-in-95 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95`,e),...c,children:[o,s!==void 0&&(0,J.jsx)(vk,{children:s}),(0,J.jsx)(aI,{className:`z-50 size-2.5 translate-y-[calc(-50%-2px)] rotate-45 rounded-[2px] bg-foreground fill-foreground data-[side=bottom]:top-1 data-[side=inline-end]:top-1/2! data-[side=inline-end]:-left-1 data-[side=inline-end]:-translate-y-1/2 data-[side=inline-start]:top-1/2! data-[side=inline-start]:-right-1 data-[side=inline-start]:-translate-y-1/2 data-[side=left]:top-1/2! data-[side=left]:-right-1 data-[side=left]:-translate-y-1/2 data-[side=right]:top-1/2! data-[side=right]:-left-1 data-[side=right]:-translate-y-1/2 data-[side=top]:-bottom-2.5`})]})})})}var pI=e=>{if(e===null)return 26;let t=e>=900?e-260-32:e,n=Math.floor((t-32)/24);return Math.min(26,Math.max(8,n))},mI=e=>String(e).padStart(2,`0`),hI=e=>{let t=new Date(e);return`${t.getFullYear()}-${mI(t.getMonth()+1)}-${mI(t.getDate())}`},gI=e=>new Date(`${e}T00:00:00Z`),_I=e=>gI(e).toLocaleDateString(`en`,{month:`short`,day:`numeric`,timeZone:`UTC`}),vI=e=>gI(e).toLocaleDateString(`en`,{weekday:`short`,month:`short`,day:`numeric`,timeZone:`UTC`}),yI=e=>gI(e).toLocaleDateString(`en`,{month:`short`,timeZone:`UTC`}),bI=e=>Number(e.slice(8,10)),xI=e=>{let t=Math.ceil(e.length/7);return Array.from({length:t},(t,n)=>{let r=e.slice(n*7,n*7+7),i=r.find(e=>bI(e.date)===1);if(i!==void 0)return yI(i.date);let a=r[0];return n===0&&a!==void 0&&bI(a.date)<=7?yI(a.date):null})},SI=e=>e===1?`1 PR`:`${e} PRs`,CI=e=>e===1?`1 comment`:`${e} comments`,wI=e=>`${e.pullRequests===0?`No PRs`:SI(e.pullRequests)} reviewed · ${CI(e.comments)}`,TI=(e,t)=>`${_I(e.date)}: ${e.pullRequests===0?`No PRs`:SI(e.pullRequests)} reviewed, ${CI(e.comments)}${e.date===t?` (today)`:``}`,EI=e=>`Busiest day: ${_I(e.date)}, ${SI(e.pullRequests)} and ${CI(e.comments)}.`,DI=(e,t,n)=>{let r={ArrowLeft:t-7,ArrowRight:t+7,ArrowUp:t-1,ArrowDown:t+1,Home:0,End:n}[e];return r===void 0||r<0||r>n?null:r},OI=e=>Ic(e),kI={0:`border-input bg-card`,1:`border-primary bg-activity-1`,2:`border-primary bg-activity-2`,3:`border-primary bg-activity-3`,4:`border-primary bg-primary`},AI=[{level:0,label:`0`},{level:1,label:`1`},{level:2,label:`2`},{level:3,label:`3–4`},{level:4,label:`5+`}],jI=[``,`Mon`,``,`Wed`,``,`Fri`,``],MI=({level:e,className:t})=>(0,J.jsx)(`span`,{className:X(`flex items-center justify-center rounded-[4px] border`,kI[e],t),children:e===4&&(0,J.jsx)(`span`,{className:`size-1.5 rounded-full bg-primary-foreground`})}),NI=e=>{let[t,n]=(0,q.useState)(null);return(0,q.useLayoutEffect)(()=>{let t=e.current;if(t===null)return;let r=t.getBoundingClientRect().width;if(r>0&&n(r),typeof ResizeObserver>`u`)return;let i=new ResizeObserver(([e])=>{e!==void 0&&n(e.contentRect.width)});return i.observe(t),()=>i.disconnect()},[e]),t},PI=cI(),FI=({days:e,today:t,weeks:n})=>{let[r,i]=(0,q.useState)(t),a=(0,q.useRef)(new Map),o=(0,q.useRef)(null),s=e.some(e=>e.date===r)?r:e[0]?.date??t,c=xI(e),l=Math.ceil(e.length/7);return(0,J.jsxs)(`div`,{ref:o,className:`flex min-w-0 flex-col gap-3`,children:[(0,J.jsx)(`div`,{"aria-hidden":`true`,className:`grid pl-8 text-caption text-muted-foreground`,style:{gridTemplateColumns:`repeat(${l}, 24px)`},children:c.map((e,t)=>(0,J.jsx)(`span`,{className:`h-4 overflow-visible whitespace-nowrap`,children:e},t))}),(0,J.jsx)(`div`,{role:`grid`,"aria-label":`Review activity for the last ${n} weeks, one square per day. Use arrow keys to move between days.`,className:`flex flex-col`,onKeyDown:t=>{let n=e.findIndex(e=>e.date===s),r=DI(t.key,n,e.length-1);if(r===null)return;t.preventDefault();let o=e[r];o!==void 0&&(i(o.date),a.current.get(o.date)?.focus())},children:jI.map((n,r)=>(0,J.jsxs)(`div`,{role:`row`,className:`flex items-center`,children:[(0,J.jsx)(`span`,{"aria-hidden":`true`,className:`w-8 shrink-0 text-caption text-muted-foreground`,children:n}),Array.from({length:l},(n,o)=>{let c=e[o*7+r];if(c===void 0||OI(c.date)!==r)return(0,J.jsx)(`span`,{className:`size-6 shrink-0`},o);let l=Bc(c.pullRequests);return(0,J.jsx)(dI,{handle:PI,payload:c,delay:150,render:(0,J.jsx)(`div`,{ref:e=>{e===null?a.current.delete(c.date):a.current.set(c.date,e)},role:`gridcell`,tabIndex:c.date===s?0:-1,"aria-label":TI(c,t),onFocus:()=>i(c.date),className:`group flex size-6 shrink-0 items-center justify-center rounded-md`}),children:(0,J.jsx)(MI,{level:l,className:X(`size-5 group-hover:ring-2 group-hover:ring-foreground`,c.date===t&&`outline-2 outline-offset-1 outline-foreground`)})},c.date)})]},r))}),(0,J.jsx)(GF,{handle:PI,children:({payload:e})=>e===void 0?null:(0,J.jsx)(fI,{collisionBoundary:o.current??void 0,children:(0,J.jsxs)(`span`,{className:`flex flex-col`,children:[(0,J.jsx)(`span`,{className:`font-semibold`,children:vI(e.date)}),(0,J.jsx)(`span`,{children:wI(e)})]})})}),(0,J.jsxs)(`div`,{"aria-hidden":`true`,className:`flex items-start gap-2 pl-8 text-caption text-muted-foreground`,children:[(0,J.jsx)(`span`,{className:`leading-4`,children:`PRs a day`}),AI.map(({level:e,label:t})=>(0,J.jsxs)(`span`,{className:`flex w-6 flex-col items-center gap-0.5`,children:[(0,J.jsx)(MI,{level:e,className:`size-4`}),(0,J.jsx)(`span`,{className:`whitespace-nowrap`,children:t})]},e))]})]})},II=({value:e,label:t})=>(0,J.jsxs)(`div`,{className:`flex flex-col`,children:[(0,J.jsx)(`span`,{className:`text-title font-semibold tabular-nums`,children:e}),(0,J.jsx)(`span`,{className:`text-caption text-muted-foreground`,children:t})]}),LI=({activity:e,error:t,onRetry:n,now:r})=>{let i=(0,q.useId)(),a=(0,q.useRef)(null),o=NI(a),s=pI(o),c=o===null||o>=900,l=hI(r()),u=(0,q.useMemo)(()=>e===null?null:zc(e,{today:l,weeks:s,dayOf:hI}),[e,l,s]),d=(0,q.useMemo)(()=>e===null?null:zc(e,{today:l,weeks:26,dayOf:hI}),[e,l]),f=u===null?null:Vc(u),p=d?.every(e=>e.pullRequests===0&&e.comments===0)===!0;return(0,J.jsxs)(`section`,{"aria-labelledby":i,className:`flex flex-col rounded-xl border bg-card`,children:[(0,J.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-2 gap-y-1 border-b px-4 py-2.5`,children:[(0,J.jsx)(`h2`,{id:i,className:`text-heading font-semibold`,children:`Review activity`}),(0,J.jsxs)(`span`,{className:`text-caption text-muted-foreground`,children:[`Last `,s,` weeks`]}),(0,J.jsxs)(`span`,{className:`flex items-center gap-1.5 text-caption text-muted-foreground max-sm:basis-full sm:ml-auto`,children:[(0,J.jsx)(Ig,{"aria-hidden":`true`,className:`size-3.5 shrink-0`}),`Reviews and comments posted from megareviewer on this machine`]})]}),(0,J.jsx)(`div`,{className:`overflow-hidden px-4 py-4`,children:(0,J.jsx)(`div`,{ref:a,children:u===null||f===null?t===null?(0,J.jsx)(zN,{"aria-label":`Loading review activity`,className:`h-[244px] w-full motion-reduce:animate-none`}):(0,J.jsxs)(`p`,{className:X(LN,`flex flex-wrap items-baseline gap-x-2 text-caption`),children:[(0,J.jsx)(`span`,{className:`font-medium`,children:`Couldn't read your review activity.`}),(0,J.jsx)(`span`,{children:Ap(t)}),(0,J.jsx)($,{variant:`link`,className:`h-6 min-w-6 px-1 text-caption`,onClick:n,children:`Try again`})]}):(0,J.jsxs)(`div`,{className:X(`flex gap-8`,c?`flex-row`:`flex-col`),children:[(0,J.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-3`,children:[(0,J.jsx)(FI,{days:u,today:l,weeks:s}),p&&(0,J.jsxs)(`p`,{className:`rounded-md bg-muted px-3 py-2 text-caption text-muted-foreground`,children:[(0,J.jsx)(`span`,{className:`font-medium text-foreground`,children:`No reviews yet.`}),` Open a pull request above and post your review. Each day you review fills a square here.`]})]}),(0,J.jsxs)(`div`,{className:X(`flex flex-col gap-3`,c&&`w-[260px] shrink-0`),children:[(0,J.jsxs)(`div`,{className:X(`grid gap-x-6 gap-y-3`,c||o!==null&&o<520?`grid-cols-2`:`grid-cols-4`),children:[(0,J.jsx)(II,{value:f.pullRequests,label:`PRs reviewed`}),(0,J.jsx)(II,{value:f.comments,label:`comments posted`}),(0,J.jsx)(II,{value:f.daysWithReviews,label:`days with reviews`}),(0,J.jsx)(II,{value:f.thisWeek,label:`PRs this week`})]}),f.busiest!==null&&(0,J.jsx)(`p`,{className:`border-t pt-3 text-caption text-muted-foreground`,children:EI(f.busiest)})]})]})})})]})},RI=`Paste a pull request link first.`,zI=`That isn't a pull request link. Use github.com/owner/repo/pull/123 or bitbucket.org/workspace/repo/pull-requests/45.`,BI=`h-6 min-w-6 px-1 text-caption`,VI=nk(`openInNewTab`).chords[0]??{key:`Enter`,mod:!0},HI=({inputRef:e,start:t,onSubmit:n,onSubmitInNewTab:r,onEdit:i,initial:a})=>{let[o,s]=(0,q.useState)(a?.url??``),[c,l]=(0,q.useState)(a?.invalid??null),u=(0,q.useId)(),d=t?.state===`starting`,f=()=>{let e=o.trim();if(e===``)return l(RI),null;let t=mf(e);return t.ok||l(zI),t.ok?t.value:null},p=e=>{if(e.preventDefault(),d)return;let t=f();t!==null&&n(o.trim(),t)},m=e=>{e.preventDefault();let t=f();t!==null&&r(t)},h=dk();return(0,J.jsx)(`search`,{children:(0,J.jsxs)(`form`,{"aria-label":`Open a pull request by link`,className:`flex flex-col gap-1.5`,onSubmit:p,noValidate:!0,children:[(0,J.jsxs)(`div`,{className:`flex gap-2 max-sm:flex-col`,children:[(0,J.jsxs)(`div`,{className:`relative flex-1`,children:[(0,J.jsx)(Bg,{"aria-hidden":`true`,className:`pointer-events-none absolute top-1/2 left-2.5 size-4 -translate-y-1/2 text-muted-foreground`}),(0,J.jsx)(`input`,{ref:e,id:`${u}-url`,"aria-label":`Pull request link`,className:X(`h-9 w-full min-w-0 rounded-md border border-input bg-card pr-10 pl-8 placeholder:text-muted-foreground`,c!==null&&`border-destructive`),type:`url`,inputMode:`url`,autoComplete:`off`,spellCheck:!1,placeholder:`Paste a GitHub or Bitbucket pull request link`,value:o,readOnly:d,onKeyDown:e=>{ck(e,VI,h)&&m(e)},onChange:e=>{s(e.target.value),l(null),i()},"aria-invalid":c!==null,"aria-describedby":`${u}-message`}),(0,J.jsx)(bk,{id:`focusLink`,className:`pointer-events-none absolute top-1/2 right-2 -translate-y-1/2`})]}),(0,J.jsx)($,{type:`submit`,size:`lg`,className:`sm:w-28`,"aria-busy":d,onClick:e=>{(e.metaKey||e.ctrlKey||e.shiftKey)&&m(e)},onAuxClick:e=>{e.button===1&&m(e)},children:d?(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(Hg,{"aria-hidden":`true`,className:xF}),`Opening…`]}):`Review`})]}),(0,J.jsx)(`div`,{id:`${u}-message`,role:`status`,className:`flex min-h-0 flex-wrap items-center gap-x-2 text-caption`,children:c===null?t?.state===`starting`?(0,J.jsxs)(J.Fragment,{children:[(0,J.jsxs)(`span`,{className:`flex items-center gap-1.5 text-muted-foreground`,children:[(0,J.jsx)(Hg,{"aria-hidden":`true`,className:X(`size-3.5`,xF)}),t.message]}),(0,J.jsx)($,{type:`button`,variant:`link`,className:BI,onClick:t.onCancel,children:`Cancel`})]}):t?.state===`failed`?(0,J.jsxs)(J.Fragment,{children:[(0,J.jsxs)(`span`,{className:`text-destructive`,children:[(0,J.jsx)(v_,{"aria-hidden":`true`,className:`mr-1 inline size-3.5 align-[-2px]`}),t.message]}),(0,J.jsx)($,{type:`button`,variant:`link`,className:BI,onClick:t.onRetry,children:`Try again`})]}):null:(0,J.jsxs)(`span`,{className:`text-destructive`,children:[(0,J.jsx)(v_,{"aria-hidden":`true`,className:`mr-1 inline size-3.5 align-[-2px]`}),c]})})]})})},UI=Tc.options,WI=({now:e=Date.now})=>{let{client:t}=yp(),{status:n,checks:r,reportListed:i,setOpen:a}=PF(),o=Cp(),s=wp(),[c,l]=(0,q.useState)(null),[u,d]=(0,q.useState)(``),f=(0,q.useRef)(0),p=(0,q.useRef)(null),m=(0,q.useRef)(null),{refresh:h}=o,{refresh:g}=s,_=(0,q.useCallback)(()=>{h(),g()},[h,g]),v=(0,q.useRef)(r);(0,q.useEffect)(()=>{r!==v.current&&(v.current=r,_())},[r,_]),(0,q.useEffect)(()=>{if(o.loading||(m.current=e(),o.pullRequests===null))return;let t=new Set(o.pullRequests.errors.map(e=>e.host)),r={};for(let e of UI)t.has(e)||n?.hosts[e].configured!==!0||(r[e]=o.pullRequests.items.filter(t=>t.ref.repo.host===e).length);i({counts:r,atMs:e()})},[o.loading,o.pullRequests,n,e,i]),(0,q.useEffect)(()=>{let t=()=>{document.visibilityState===`visible`&&m.current!==null&&e()-m.current>12e4&&_()};return document.addEventListener(`visibilitychange`,t),()=>document.removeEventListener(`visibilitychange`,t)},[e,_]),(0,q.useEffect)(()=>{let e=e=>{e.key!==`/`||e.metaKey||e.ctrlKey||e.altKey||lk(e.target)||(e.preventDefault(),p.current?.focus(),p.current?.select())};return document.addEventListener(`keydown`,e),()=>document.removeEventListener(`keydown`,e)},[]);let y=async(e,n,r,i)=>{f.current+=1;let a=f.current;l({from:r,url:e,ref:n,role:i,state:`starting`}),r===`row`&&d(`Opening ${vF(n)}`);let o=await t.startAnalysis({url:e});f.current===a&&(o.ok?A_(D_(o.value.analysisId)):l({from:r,url:e,ref:n,role:i,state:`failed`,error:o.error}))},b=(0,q.useCallback)(e=>{f.current+=1,l(null),e===`form`?p.current?.focus():d(`Cancelled`)},[]),x=c?.state===`starting`&&c.from===`row`;(0,q.useEffect)(()=>{if(!x)return;let e=e=>{e.key!==`Escape`||e.defaultPrevented||e.target instanceof Element&&e.target.closest(`[data-slot=popover-content]`)||b(`row`)};return document.addEventListener(`keydown`,e),()=>document.removeEventListener(`keydown`,e)},[x,b]);let S=e=>(0,J.jsx)(IF,{pullRequest:e.ref,error:e.error}),C=c?.from===`form`?c.state===`starting`?{state:`starting`,message:`Fetching ${vF(c.ref)} from ${_F[c.ref.repo.host]}…`,onCancel:()=>b(`form`)}:{state:`failed`,message:S(c),onRetry:()=>void y(c.url,c.ref,`form`,null)}:null,w=e(),T=c?.state===`starting`&&c.from===`row`?c.url:null,E=c?.state===`failed`&&c.from===`row`&&c.role!==null?{role:c.role,message:S(c),onRetry:()=>void y(c.url,c.ref,`row`,c.role)}:null;return(0,J.jsxs)(`div`,{className:`mx-auto flex max-w-[1240px] flex-col gap-4`,children:[(0,J.jsx)(`h1`,{className:`sr-only`,children:`Pull requests`}),(0,J.jsx)(HI,{inputRef:p,start:C,onSubmit:(e,t)=>void y(e,t,`form`,null),onSubmitInNewTab:e=>window.open(E_(e),`_blank`,`noopener`),onEdit:()=>{c?.from===`form`&&c.state===`failed`&&l(null)}}),(0,J.jsx)(MF,{status:n,list:o.pullRequests,error:o.error,rowFailure:E,startingUrl:T,nowMs:w,onOpen:e=>void y(e.url,e.ref,`row`,e.role),onRetry:_,onOpenConnections:()=>a(!0),onFix:()=>a(!0,{focusCheckAgain:!0})}),(0,J.jsx)(LI,{activity:s.activity,error:s.error,onRetry:g,now:e}),(0,J.jsx)(`span`,{className:`sr-only`,"aria-live":`polite`,children:u})]})},GI=`megareviewer:`,KI=e=>{try{let t=window.localStorage.getItem(GI+e);return t===null?void 0:JSON.parse(t)}catch{return}},qI=(e,t)=>{try{window.localStorage.setItem(GI+e,JSON.stringify(t))}catch{}},JI=(e,t,n)=>{let[r,i]=(0,q.useState)(()=>({key:e,value:n(KI(e))??t}));return[r.key===e?r.value:n(KI(e))??t,(0,q.useCallback)(r=>i(i=>{let a=r(i.key===e?i.value:n(KI(e))??t);return qI(e,a),{key:e,value:a}}),[e,t,n])]},YI=e=>typeof e==`boolean`?e:void 0,XI=e=>typeof e==`string`?e:void 0,ZI=e=>{let t=new Map;for(let n of e){let e=n.available?`${n.provider} ${n.via}`:n.provider,r=t.get(e)??[];r.push(n),t.set(e,r)}return[...t.values()].flatMap(e=>{let[t]=e;return t===void 0?[]:[[t,e]]})},QI=(e,t,n)=>{if(e.length<=6)return e;let r=e.filter(e=>e.id===t?.id||e.id===n);return r.length>0?r:e.slice(0,1)},$I=(e,t,n)=>{let r=n.toLowerCase().split(/\s+/).filter(e=>e!==``);return r.length===0?[]:e.filter(e=>!t.includes(e)&&r.every(t=>`${e.modelName} ${e.model}`.toLowerCase().includes(t)))},eL=e=>e.length===0?`No model is known to megareviewer`:e.some(e=>e.available)?null:ZI(e).map(([e])=>e.reason??`${e.providerName} can't run`).join(`; or `),tL=e=>{let[t,n]=JI(`model-option`,null,XI),r=e?.options??[],i=r.find(e=>e.id===t&&e.available)??r.find(t=>t.id===e?.defaultId)??null,a=(0,q.useCallback)(e=>n(()=>e),[n]);return{options:r,chosen:i,defaultId:e?.defaultId??null,locked:e===null?null:eL(r),choose:a}},nL=(e,t)=>({...e,preferences:e.preferences.some(e=>e.id===t.id)?e.preferences.map(e=>e.id===t.id?t:e):[...e.preferences,t]}),rL=(e,t)=>({...e,preferences:e.preferences.filter(e=>e.id!==t)}),iL=(e,t)=>({...e,proposals:[...e.proposals,...t.filter(t=>!e.proposals.some(e=>e.id===t.id))]}),aL=(e,t)=>({...e,proposals:e.proposals.filter(e=>e.id!==t)}),oL=(e,t,n,r)=>({...e,repositories:e.repositories.map(e=>ru(e.repo,t)&&e.guidelineFiles!==null?{...e,guidelineFiles:e.guidelineFiles.map(e=>e.path===n?{...e,enabled:r}:e)}:e)}),sL=(e,t)=>e.preferences.filter(e=>iu(e.scope,t)),cL=e=>{let t=[...e.repositories];for(let{scope:n}of[...e.preferences,...e.proposals])n.kind!==`repo`||t.some(e=>ru(e.repo,n.repo))||t.push({repo:n.repo,guidelineFiles:null,guidelineNote:`No pull request of this repository has been analyzed yet`});return t},lL=e=>{if(e<1024)return`${e} B`;let t=e/1024;return`${t<10?t.toFixed(1):Math.round(t)} KB`},uL=e=>{let t=e.trim();return t===``||/[.!?]$/.test(t)?t:`${t}.`},dL=e=>e.code===`bad-request`?uL(e.message):Ap(e),fL=(e,t,n=`${t}s`)=>`${e} ${e===1?t:n}`,pL=new Intl.ListFormat(`en`,{type:`disjunction`}).format(Jl),mL=({file:e,repository:t,onSwitch:n})=>{let[r,i]=(0,q.useState)(null);return(0,J.jsxs)(`li`,{"data-slot":`guideline-file`,className:`flex min-h-8 flex-wrap items-center gap-x-3 gap-y-1`,children:[(0,J.jsx)(cg,{"aria-hidden":`true`,className:`size-3.5 shrink-0 text-muted-foreground`}),(0,J.jsx)(`span`,{className:`min-w-0 font-mono text-code-compact break-all`,children:e.path}),(0,J.jsx)(`span`,{className:`tabular shrink-0 text-caption text-muted-foreground`,children:lL(e.bytes)}),e.tooLarge?(0,J.jsxs)(`span`,{className:`text-caption text-muted-foreground`,children:[`too large to send: a guideline file can be `,lL(Xl)]}):(0,J.jsx)(ZN,{checked:e.enabled,"aria-label":`Read ${e.path} in AI reviews of ${t}`,onCheckedChange:async t=>{i(null),i(await n(e.path,t))}}),r!==null&&(0,J.jsxs)(`p`,{role:`alert`,className:`basis-full text-caption text-destructive`,children:[(0,J.jsx)(v_,{"aria-hidden":`true`,className:`mr-1 inline size-3.5 align-[-2px]`}),r]})]})},hL=({files:e,note:t,repository:n,onSwitch:r})=>(0,J.jsxs)(`div`,{"data-slot":`guideline-files`,className:`flex flex-col gap-1 border-t px-4 py-3`,children:[(0,J.jsx)(`h3`,{className:`text-caption font-medium text-muted-foreground`,children:`Guideline files, read at the base commit of the pull request`}),e===null?(0,J.jsx)(`p`,{className:`text-caption text-muted-foreground`,children:uL(t??`Couldn't look for them`)}):e.length===0?(0,J.jsxs)(`p`,{className:`text-caption text-muted-foreground`,children:[`None at the repository's root, where megareviewer looks for `,pL,`.`]}):(0,J.jsx)(`ul`,{className:`flex flex-col`,children:e.map(e=>(0,J.jsx)(mL,{file:e,repository:n,onSwitch:r},e.path))})]}),gL=q.createContext(void 0);function _L(e){let t=q.useContext(gL);if(t===void 0&&!e)throw Error(Ov(33));return t}var vL=q.createContext(void 0);function yL(e){let t=q.useContext(vL);if(t===void 0&&!e)throw Error(Ov(36));return t}var bL=q.createContext(void 0);function xL(e=!0){let t=q.useContext(bL);if(t===void 0&&!e)throw Error(Ov(25));return t}var SL=q.createContext(null);function CL(e=`root`){let t=q.useContext(SL),n=q.useContext(vL);return t===null||n===void 0?null:(e===`submenu-trigger`?n.virtualFocus||n.parentVirtualFocus:n.virtualFocus)?t:null}var wL={visible:!0,ref:null};function TL(){return wL}function EL(e,t,n=`root`){let r=CL(n),i=((n===`submenu-trigger`?r?.useSubmenuTrigger:r?.useItem)??TL)({label:e.label,children:e.children,render:e.render}),a=Lv(t,i.ref);return{visible:i.visible,ref:a,props:i.props}}var DL=q.createContext(void 0);function OL(){let e=q.useContext(DL);if(e===void 0)throw Error(Ov(30));return e}function kL(e){e.preventDefault()}function AL(e){let{closeOnClick:t,highlighted:n,id:r,nodeId:i,store:a,typingRef:o,itemRef:s,itemMetadata:c}=e,l=yL(),u=xL(!0),d=c.type===`submenu-trigger`,f=d?l.parentVirtualFocus:l.virtualFocus,p=(d&&l.parent.type===`menu`?l.parent.store:l.store).useState(`webkitAriaSelected`,n),{events:m}=a.useState(`floatingTreeRoot`),h=a.useState(`open`),g=u!==void 0,_=!f&&h&&n?0:-1;return q.useMemo(()=>({id:r,role:`menuitem`,tabIndex:_,"aria-selected":p,onMouseDown:f?kL:void 0,onKeyDown(e){e.key===` `&&o?.current&&e.preventDefault()},onMouseMove(e){i&&m.emit(`itemhover`,{nodeId:i,target:e.currentTarget})},onClick(e){t&&m.emit(`close`,{domEvent:e.nativeEvent,reason:Lb})},onMouseUp(e){if(u){let t=u.initialCursorPointRef.current;if(u.initialCursorPointRef.current=null,g&&t&&Math.abs(e.clientX-t.x)<=1&&Math.abs(e.clientY-t.y)<=1||g&&!Ay&&e.button===2)return}s.current&&a.context.allowMouseUpTriggerRef.current&&(!g||e.button===2)&&c.type===`regular-item`&&Nv(s.current,e,{detail:1,pointerType:`mouse`})}}),[t,_,r,m,i,a.context.allowMouseUpTriggerRef,o,s,u,g,c.type,p,f])}var jL={type:`regular-item`};function ML(e){let{closeOnClick:t,disabled:n,highlighted:r,id:i,store:a,typingRef:o=a.context.typingRef,nativeButton:s,itemMetadata:c,nodeId:l}=e,u=q.useRef(null),{getButtonProps:d,buttonRef:f}=Pv({disabled:n,focusableWhenDisabled:!0,native:s,composite:!0}),p=AL({closeOnClick:t,highlighted:r,id:i,nodeId:l,store:a,typingRef:o,itemRef:u,itemMetadata:c}),m=q.useCallback(e=>mv(p,{onMouseEnter(e){c.type===`submenu-trigger`&&c.setActive(e.nativeEvent)}},e,d),[p,d,c]),h=Lv(u,f);return q.useMemo(()=>({getItemProps:m,itemRef:h}),[m,h])}var NL=`data-checked`,PL=`data-unchecked`,FL={checked(e){return e?{[NL]:``}:{[PL]:``}},...tb},IL=q.forwardRef(function(e,t){let{render:n,className:r,id:i,label:a,nativeButton:o=!1,disabled:s=!1,closeOnClick:c=!1,checked:l=!1,onCheckedChange:u,style:d,...f}=e,{store:p}=yL(),m=bO({guess:!0,label:a}),h=gE(i),g=p.useState(`disabled`),_=p.useState(`isActive`,m.index),v=p.useState(`floatingNodeId`),y=p.useState(`itemProps`),b=s||g,{getItemProps:x,itemRef:S}=ML({closeOnClick:c,disabled:b,highlighted:_,id:h,store:p,nativeButton:o,nodeId:v,itemMetadata:jL}),C=q.useMemo(()=>({disabled:b,highlighted:_,checked:l}),[b,_,l]);function w(e){let t=Ab(Lb,e.nativeEvent,void 0,{preventUnmountOnClose:Kv});u?.(!l,t)}let T=Qv(`div`,e,{state:C,stateAttributesMapping:FL,props:[y,{role:`menuitemcheckbox`,"aria-checked":l,onClick:w},f,x],ref:[S,t,m.ref]});return(0,J.jsx)(DL.Provider,{value:C,children:T})}),LL=q.forwardRef(function(e,t){let{checked:n,defaultChecked:r,onCheckedChange:i,...a}=e,[o,s]=nO({controlled:n,default:r??!1,name:`MenuCheckboxItem`,state:`checked`}),c=EL(e,t);function l(e,t){i?.(e,t),t.isCanceled||s(e)}return c.visible?(0,J.jsx)(IL,{...a,checked:o,onCheckedChange:l,ref:c.ref}):null}),RL=q.forwardRef(function(e,t){let{render:n,className:r,style:i,keepMounted:a=!1,...o}=e,s=OL(),c=q.useRef(null),{transitionStatus:l,mounted:u,setMounted:d}=PC(s.checked);return zC({batch:!0,enabled:!s.checked,open:s.checked,ref:c,onComplete(){s.checked||d(!1)}}),Qv(`span`,e,{state:{checked:s.checked,disabled:s.disabled,highlighted:s.highlighted,transitionStatus:l},ref:[t,c],stateAttributesMapping:FL,props:{"aria-hidden":!0,...o},enabled:a||u})}),zL=q.createContext(void 0);function BL(){let e=q.useContext(zL);if(e===void 0)throw Error(Ov(31));return e}var VL=q.forwardRef(function(e,t){let{render:n,className:r,style:i,...a}=e,[o,s]=q.useState(void 0),c=Qv(`div`,e,{ref:t,props:{role:`group`,"aria-labelledby":o,...a}});return(0,J.jsx)(zL.Provider,{value:s,children:c})}),HL=q.forwardRef(function(e,t){let n=CL()?.Group??VL;return(0,J.jsx)(n,{...e,ref:t})}),UL=q.forwardRef(function(e,t){let{render:n,className:r,style:i,id:a,...o}=e,s=gE(a),c=BL();return Q(()=>(c(s),()=>{c(e=>e===s?void 0:e)}),[c,s]),Qv(`div`,e,{ref:t,props:{id:s,"aria-hidden":!0,...o}})}),WL=q.forwardRef(function(e,t){let{render:n,className:r,id:i,label:a,nativeButton:o=!1,disabled:s=!1,closeOnClick:c=!0,style:l,...u}=e,{store:d}=yL(),f=bO({guess:!0,label:a}),p=gE(i),m=d.useState(`disabled`),h=d.useState(`isActive`,f.index),g=d.useState(`floatingNodeId`),_=d.useState(`itemProps`),v=s||m,{getItemProps:y,itemRef:b}=ML({closeOnClick:c,disabled:v,highlighted:h,id:p,store:d,nativeButton:o,nodeId:g,itemMetadata:jL});return Qv(`div`,e,{state:{disabled:v,highlighted:h},props:[_,u,y],ref:[b,t,f.ref]})}),GL=q.forwardRef(function(e,t){let n=EL(e,t);return n.visible?(0,J.jsx)(WL,{...e,ref:n.ref}):null}),KL=q.createContext(void 0);function qL(){return q.useContext(KL)}function JL(e,t){let n=ny(e.render);if(q.isValidElement(n)){let e=n.props;if(Object.hasOwn(e,`id`))return e.id??``}return e.id??t}function YL(e,t,n){let r=JL(e,t),i=r===t?void 0:r;return[r,q.useCallback(e=>n?.(e?i:void 0),[i,n])]}function XL(e,t,n){let r=ny(e.render),i=q.isValidElement(r)?r.props:void 0,a=e[`aria-label`]??i?.[`aria-label`],o=e[`aria-labelledby`]??i?.[`aria-labelledby`];return o==null&&!a&&(o=t?t.id||void 0:n||void 0),o}var ZL=q.forwardRef(function(e,t){let{render:n,className:r,style:i,finalFocus:a,id:o,initialFocus:s,...c}=e,{store:l,defaultFloatingId:u,setRenderedFloatingId:d,virtualFocus:f,orientation:p}=yL(),m=qL(),{side:h,align:g}=_L(),_=Rj(!0)!=null,v=l.useState(`open`),y=l.useState(`transitionStatus`),b=l.useState(`popupProps`),x=l.useState(`mounted`),S=l.useState(`instantType`),C=l.useState(`activeTriggerElement`),w=l.useState(`parent`),T=l.useState(`lastOpenChangeReason`),E=l.useState(`rootId`),D=l.useState(`floatingRootContext`),O=l.useState(`floatingTreeRoot`),k=l.useState(`closeDelay`),A=l.useState(`hoverEnabled`),j=l.useState(`disabled`),M=l.useState(`openMethod`),N=l.useState(`activeTriggerId`),P=l.useState(`listElement`),[F,I]=YL(e,u,d),L=XL(e,C,N),R=w.type===`menu`?m:void 0,ee=w.type===`context-menu`,z=s??w.type!==`menu`;s===void 0&&P&&w.type!==`menu`&&(z=()=>l.state.activeIndex===null&&P),zC({open:v,ref:l.context.popupRef,onComplete(){v&&l.context.onOpenChangeComplete?.(!0)}}),q.useEffect(()=>{function e(e){l.setOpen(!1,Ab(e.reason,e.domEvent))}return O.events.on(`close`,e),()=>{O.events.off(`close`,e)}},[O.events,l]),Nw(D,{enabled:A&&!j&&!ee&&w.type!==`menubar`,closeDelay:k});let te=l.useStateSetter(`popupElement`),{parentVirtualFocusRef:B,handleFocus:ne}=(q.useContext(SL)?.useParentHandoff??$L)(l,w,v,f),V=Qv(`div`,e,{state:{transitionStatus:y,side:h,align:g,open:v,nested:w.type===`menu`,instant:S},ref:[t,l.context.popupRef,te,I],stateAttributesMapping:hb,props:[b,{id:F,...P?{role:`presentation`}:{role:`menu`,"aria-orientation":p===`horizontal`?`horizontal`:void 0,"aria-labelledby":L},onKeyDown(e){R?.onPopupKeyDown?.(e),_&&IO.has(e.key)&&e.stopPropagation()},onFocus:ne},zE(y),c,{"data-rootownerid":E}]}),H=w.type===void 0||ee;(C||w.type===`menubar`&&T!==`outside-press`)&&(H=!0);let re=R?.getReturnElement??B;return(0,J.jsx)(pC,{context:D,openInteractionType:M,modal:ee,disabled:!x,returnFocus:a??re??H,explicitReturnFocus:a===void 0&&re?!1:void 0,initialFocus:z,restoreFocus:!0,getInsideElements:w.type===void 0?()=>[l.context.beforeTriggerFocusGuardRef.current]:void 0,externalTree:w.type===`menubar`?void 0:O,previousFocusableElement:C,nextFocusableElement:w.type===void 0?l.context.triggerFocusTargetRef:void 0,beforeContentFocusGuardRef:l.context.beforeContentFocusGuardRef,children:V})}),QL={parentVirtualFocusRef:void 0,handleFocus:void 0};function $L(){return QL}var eR=q.forwardRef(function(e,t){let n=CL()?.Popup??ZL;return(0,J.jsx)(n,{...e,ref:t})}),tR=q.createContext(void 0);function nR(){let e=q.useContext(tR);if(e===void 0)throw Error(Ov(32));return e}var rR=q.forwardRef(function(e,t){let{keepMounted:n=!1,...r}=e,{store:i,parent:a}=yL();if(!(i.useState(`mounted`)||n))return null;let o=a.type===`menu`||a.type===`menubar`?`group`:void 0;return(0,J.jsx)(tR.Provider,{value:n,children:(0,J.jsx)(JS,{ref:t,...r,portalOwnerRole:o})})}),iR=q.forwardRef(function(e,t){let{anchor:n,positionMethod:r=`absolute`,className:i,render:a,side:o,align:s,sideOffset:c=0,alignOffset:l=0,collisionBoundary:u=`clipping-ancestors`,collisionPadding:d=5,arrowPadding:f=5,sticky:p=!1,disableAnchorTracking:m=!1,collisionAvoidance:h=BS,style:g,..._}=e,{store:v,virtualFocus:y,syncHighlightedItem:b}=yL(),x=nR(),S=xL(!0),C=v.useState(`parent`),w=v.useState(`floatingRootContext`),T=v.useState(`floatingTreeRoot`),E=v.useState(`mounted`),D=v.useState(`open`),O=v.useState(`modal`),k=v.useState(`openMethod`),A=v.useState(`activeTriggerElement`),j=v.useState(`transitionStatus`),M=v.useState(`positionerElement`),N=v.useState(`instantType`),P=v.useState(`adaptiveOrigin`),F=v.useState(`lastOpenChangeReason`),I=v.useState(`floatingNodeId`),L=v.useState(`floatingParentNodeId`),R=w.useState(`domReferenceElement`),ee=n,z=c,te=l,B=s,ne=h;C.type===`context-menu`&&(ee=n??C.context?.anchor,B??=`start`,!o&&B!==`center`&&(te=e.alignOffset??2,z=e.sideOffset??-5));let V=o,H=B;C.type===`menu`?(V??=`inline-end`,H??=`start`,ne=e.collisionAvoidance??VS):C.type===`menubar`&&(V??=C.context.orientation===`vertical`?`inline-end`:`bottom`,H??=`start`);let re=C.type===`context-menu`,ie=IE({anchor:ee,floatingRootContext:w,positionMethod:S?`fixed`:r,mounted:E,side:V,sideOffset:z,align:H,alignOffset:te,arrowPadding:re?0:f,collisionBoundary:u,collisionPadding:d,sticky:p,nodeId:I,keepMounted:x,disableAnchorTracking:m,collisionAvoidance:ne,shift:re?{crossAxis:!(`side`in ne&&ne.side===`flip`),rootBoundary:`layoutViewport`}:void 0,externalTree:T,adaptiveOrigin:P,lazyFlip:y?`placement`:!1});q.useEffect(()=>{function e(e){e.open&&(e.parentNodeId===I&&v.set(`hoverEnabled`,!1),e.nodeId!==I&&e.parentNodeId===v.select(`floatingParentNodeId`)&&v.setOpen(!1,Ab(Gb)))}return T.events.on(`menuopenchange`,e),()=>{T.events.off(`menuopenchange`,e)}},[v,T.events,I]),q.useEffect(()=>{if(v.select(`floatingParentNodeId`)==null)return;function e(e){if(e.open||e.nodeId!==v.select(`floatingParentNodeId`))return;let t=e.reason??`sibling-open`;v.setOpen(!1,Ab(t))}return T.events.on(`menuopenchange`,e),()=>{T.events.off(`menuopenchange`,e)}},[T.events,v]);let ae=by();q.useEffect(()=>{D||ae.clear()},[D,ae]),q.useEffect(()=>{function e(e){if(D&&e.nodeId===v.select(`floatingParentNodeId`)){if(e.target&&A&&A!==e.target){let e=v.select(`closeDelay`);e>0?ae.isStarted()||ae.start(e,()=>{v.setOpen(!1,Ab(Gb))}):v.setOpen(!1,Ab(Gb))}else ae.clear()}}return T.events.on(`itemhover`,e),()=>{T.events.off(`itemhover`,e)}},[T.events,D,A,v,ae]),q.useEffect(()=>{let e={open:D,nodeId:I,parentNodeId:L,reason:v.select(`lastOpenChangeReason`)};T.events.emit(`menuopenchange`,e)},[T.events,D,v,I,L]),mM({store:v,domReference:R,positionerElement:M,open:D});let oe={open:D,side:ie.side,align:ie.align,anchorHidden:ie.anchorHidden,nested:C.type===`menu`,instant:N},se=C.type===`menubar`&&C.context.modal;gM(D&&(se||O&&F!==`trigger-hover`),k===`touch`,M,A);let U=BE(e,oe,{styles:ie.positionerStyles,transitionStatus:j,props:_,refs:[t,v.useStateSetter(`positionerElement`)],hidden:!E,inert:!D}),ce=E&&C.type!==`menu`&&(C.type!==`menubar`&&O&&F!==`trigger-hover`||C.type===`menubar`&&C.context.modal),le=null;return C.type===`menubar`?le=C.context.contentElement:C.type===void 0&&(le=A),(0,J.jsxs)(gL.Provider,{value:ie,children:[ce&&(0,J.jsx)(hA,{ref:C.type===`context-menu`||C.type===`nested-context-menu`?C.context.internalBackdropRef:null,inert:UE(!D),cutout:le}),(0,J.jsx)(nC,{id:I,children:(0,J.jsx)(aO,{elementsRef:v.context.itemDomElements,labelsRef:v.context.itemLabels,onMapChange:b,children:U})})]})}),aR=q.createContext(void 0);function oR(){let e=q.useContext(aR);if(e===void 0)throw Error(Ov(34));return e}var sR=q.forwardRef(function(e,t){let{render:n,className:r,value:i,defaultValue:a,onValueChange:o,disabled:s=!1,style:c,"aria-labelledby":l,...u}=e,[d,f]=q.useState(void 0),[p,m]=nO({controlled:i,default:a,name:`MenuRadioGroup`}),h=Z((e,t)=>{o?.(e,t),!t.isCanceled&&m(e)}),g=Qv(`div`,e,{state:{disabled:s},ref:t,props:{role:`group`,"aria-labelledby":l??d,"aria-disabled":s||void 0,...u}}),_=q.useMemo(()=>({value:p,setValue:h,disabled:s}),[p,h,s]);return(0,J.jsx)(zL.Provider,{value:f,children:(0,J.jsx)(aR.Provider,{value:_,children:g})})}),cR=q.memo(q.forwardRef(function(e,t){let n=CL()?.RadioGroup??sR;return(0,J.jsx)(n,{...e,ref:t})})),lR=q.createContext(void 0);function uR(){let e=q.useContext(lR);if(e===void 0)throw Error(Ov(35));return e}var dR=q.forwardRef(function(e,t){let{render:n,className:r,id:i,label:a,nativeButton:o=!1,disabled:s=!1,closeOnClick:c=!1,value:l,style:u,...d}=e,{store:f}=yL(),{value:p,setValue:m,disabled:h}=oR(),g=bO({guess:!0,label:a}),_=gE(i),v=f.useState(`isActive`,g.index),y=f.useState(`floatingNodeId`),b=f.useState(`itemProps`),x=f.useState(`disabled`),S=s||h||x,C=p===l,{getItemProps:w,itemRef:T}=ML({closeOnClick:c,disabled:S,highlighted:v,id:_,store:f,nativeButton:o,nodeId:y,itemMetadata:jL}),E=q.useMemo(()=>({disabled:S,highlighted:v,checked:C}),[S,v,C]);function D(e){let t=Ab(Lb,e.nativeEvent,void 0,{preventUnmountOnClose:Kv});m(l,t)}let O=Qv(`div`,e,{state:E,stateAttributesMapping:FL,props:[b,{role:`menuitemradio`,"aria-checked":C,onClick:D},d,w],ref:[T,t,g.ref]});return(0,J.jsx)(lR.Provider,{value:E,children:O})}),fR=q.forwardRef(function(e,t){let n=EL(e,t);return n.visible?(0,J.jsx)(dR,{...e,ref:n.ref}):null}),pR=q.forwardRef(function(e,t){let{render:n,className:r,style:i,keepMounted:a=!1,...o}=e,s=uR(),c=q.useRef(null),{transitionStatus:l,mounted:u,setMounted:d}=PC(s.checked);return zC({batch:!0,enabled:!s.checked,open:s.checked,ref:c,onComplete(){s.checked||d(!1)}}),Qv(`span`,e,{state:{checked:s.checked,disabled:s.disabled,highlighted:s.highlighted,transitionStatus:l},stateAttributesMapping:FL,ref:[t,c],props:{"aria-hidden":!0,...o},enabled:a||u})}),mR=q.createContext(null);function hR(e){let t=q.useContext(mR);if(t===null&&!e)throw Error(Ov(5));return t}function gR(e){return e==null?Mb:e.type.startsWith(`key`)?Hb:e.type.startsWith(`mouse`)||e.type.startsWith(`pointer`)?Ub:Mb}var _R={...Cw,disabled:e=>e.parent.type===`menubar`&&e.parent.context.disabled||e.disabled,modal:e=>(e.parent.type===void 0||e.parent.type===`context-menu`)&&(e.modal??!0),openMethod:e=>e.openMethod,keyboardOpen:e=>e.keyboardOpen,allowMouseEnter:e=>e.allowMouseEnter,highlightItemOnHover:e=>e.highlightItemOnHover,parent:e=>e.parent,rootId:e=>e.parent.type===`menu`?e.parent.store.select(`rootId`):e.parent.type===void 0?e.rootId:e.parent.context.rootId,activeIndex:e=>e.activeIndex,listElement:e=>e.listElement,triggerControlsId:(e,t)=>{let n=Cw.triggerPopupId(e,t);return n?e.listElement?.id||n:void 0},filterTriggerProps:e=>e.filterTriggerProps,inputProps:e=>e.inputProps,webkitAriaSelected:(e,t)=>My&&e.inputFocused&&t?!0:void 0,highlightedItemId:e=>e.highlightedItem?.id||void 0,isActive:(e,t)=>e.activeIndex===t,hoverEnabled:e=>e.hoverEnabled,instantType:e=>e.instantType===`trigger-change`&&!Cw.open(e)?void 0:e.instantType,lastOpenChangeReason:e=>e.openChangeReason,floatingTreeRoot:e=>e.parent.type===`menu`?e.parent.store.select(`floatingTreeRoot`):e.floatingTreeRoot,floatingNodeId:e=>e.floatingNodeId,floatingParentNodeId:e=>e.floatingParentNodeId,itemProps:e=>e.itemProps,closeDelay:e=>e.closeDelay,adaptiveOrigin:e=>e.adaptiveOrigin,keyboardEventRelay:e=>{if(e.keyboardEventRelay)return e.keyboardEventRelay;if(e.parent.type===`menu`)return e.parent.store.select(`keyboardEventRelay`)}},vR=class extends mw{constructor(e,t,n=!1){let r=new tw,i=bR(r,t,n,e);super(i,yR(r),_R),this.observe(`parent`,e=>{e.type===`menu`?this.context.allowMouseUpTriggerRef=e.store.context.allowMouseUpTriggerRef:e.type!==void 0&&(this.context.allowMouseUpTriggerRef=e.context.allowMouseUpTriggerRef)})}subscribeToParentMenu(){let e=this.state.parent;if(e.type!==`menu`)return;let t=e.store.select(`rootId`),n=e.store.select(`floatingTreeRoot`),r=e.store.select(`keyboardEventRelay`);return e.store.subscribe(()=>{let i=e.store.select(`rootId`),a=e.store.select(`floatingTreeRoot`),o=e.store.select(`keyboardEventRelay`);(t!==i||n!==a||r!==o)&&(t=i,n=a,r=o,this.notifyAll())})}setOpen(e,t){this.state.floatingRootContext.context.events.emit(`setOpen`,{open:e,eventDetails:t})}setActiveIndex(e,t,n){if(this.state.activeIndex!==e){let r=(e===null?void 0:this.context.itemDomElements.current[e])===this.context.reportedItem;this.context.highlightReason=r?`none`:t,this.context.highlightEvent=r?void 0:n}this.set(`activeIndex`,e)}highlightItem(e,t,n){let r=this.context.itemDomElements.current.indexOf(e);r>-1&&this.setActiveIndex(r,t,n)}};function yR(e){return{positionerRef:q.createRef(),popupRef:q.createRef(),typingRef:{current:!1},itemDomElements:{current:[]},itemLabels:{current:[]},highlightReason:`none`,highlightEvent:void 0,reportedItem:void 0,allowMouseUpTriggerRef:{current:!1},virtualFocusRef:void 0,triggerFocusTargetRef:q.createRef(),beforeTriggerFocusGuardRef:q.createRef(),beforeContentFocusGuardRef:q.createRef(),onOpenChangeComplete:void 0,triggerElements:e}}function bR(e,t,n=!1,r){return{..._w(e,t,n),disabled:!1,modal:!0,openMethod:null,keyboardOpen:!1,allowMouseEnter:!1,highlightItemOnHover:!0,parent:{type:void 0},rootId:void 0,activeIndex:null,listElement:null,filterTriggerProps:Jv,inputProps:Jv,inputFocused:!1,highlightedItem:void 0,hoverEnabled:!0,instantType:void 0,openChangeReason:null,floatingTreeRoot:new XS,floatingNodeId:void 0,floatingParentNodeId:null,itemProps:Jv,keyboardEventRelay:void 0,closeDelay:0,adaptiveOrigin:void 0,...r}}var xR=q.createContext(null);function SR(e,t){return(e===`trigger-press`||e===`item-press`)&&t?.detail===0}function CR(e,t){return e===`list-navigation`||SR(e,t)}var wR=my(function(e){let{children:t,open:n,onOpenChange:r,onOpenChangeComplete:i,onItemHighlighted:a,defaultOpen:o=!1,disabled:s=!1,modal:c,loopFocus:l=!0,orientation:u=`vertical`,actionsRef:d,closeParentOnEsc:f=!1,handle:p,triggerId:m,defaultTriggerId:h=null,highlightItemOnHover:g=!0,isSubmenu:_=!1,virtualFocus:v=!1,virtualFocusRef:y,allowEscape:b=!0,resetOnPointerLeave:x=!0}=e,S=xL(!0),C=yL(!0),w=hR(!0),T=C?.store,E=C?.virtualFocus??!1,D=q.useMemo(()=>_&&T?{type:`menu`,store:T}:w?{type:`menubar`,context:w}:S&&!T?{type:`context-menu`,context:S}:{type:void 0},[S,T,w,_]),O=gE(),k=gE(),[A,j]=q.useState(void 0),M=(A??k)||void 0,N=$S(),P=D.type===`menu`?D.store:void 0,F=(n??o)&&P?.state.transitionStatus===`starting`,I=sv(()=>F?P?.state.instantType:void 0).current,L=sv(()=>{let e=new vR({open:o,openProp:n,activeTriggerId:h,triggerIdProp:m,parent:D,disabled:s,highlightItemOnHover:g,modal:D.type===void 0?c:void 0,rootId:O,instantType:I},M,N!=null);return e.context.virtualFocusRef=y,e}).current;L.useControlledProp(`openProp`,n),L.useControlledProp(`triggerIdProp`,m),L.useContextCallback(`onOpenChangeComplete`,i);let R=L.useState(`floatingTreeRoot`),ee=tC(R),z=L.useState(`open`),te=L.useState(`activeTriggerElement`),B=L.useState(`positionerElement`),ne=L.useState(`hoverEnabled`),V=L.useState(`disabled`),H=L.useState(`lastOpenChangeReason`),re=L.useState(`parent`),ie=L.useState(`activeIndex`),ae=L.useState(`keyboardOpen`),oe=L.useState(`payload`),se=L.useState(`floatingParentNodeId`),U=q.useRef(null),ce=q.useRef(re.type!==`context-menu`),le=by(),ue=q.useRef(!0),de=by(),fe=se!=null,{openMethod:pe,triggerProps:me}=zA(z);L.useSyncedValues({disabled:s,highlightItemOnHover:g,modal:re.type===void 0?c:void 0,openMethod:pe,rootId:O}),ZC(L);let{forceUnmount:he,transitionStatus:ge}=QC(z,L,()=>{L.set(`allowMouseEnter`,!1)},F),_e=RC(L.context.popupRef);q.useEffect(()=>{if(I===void 0)return;let e=()=>{L.state.instantType===I&&L.set(`instantType`,void 0)};if(!z){e();return}if(ge!==void 0)return;if(L.context.popupRef.current==null){e();return}let t=new AbortController;return _e(e,t.signal),()=>{t.abort()}},[I,z,ge,_e,L]),Q(()=>{S&&!C?L.update({parent:{type:`context-menu`,context:S},floatingNodeId:ee,floatingParentNodeId:N}):(C||!L.select(`activeTriggerElement`))&&L.update({floatingNodeId:ee,floatingParentNodeId:N})},[S,C,ee,N,te,L]),q.useEffect(()=>{z||(U.current=null),re.type===`context-menu`&&(z?le.start(500,()=>{ce.current=!0}):(le.clear(),ce.current=!1))},[le,z,re.type]),Q(()=>{!z&&!ne&&L.set(`hoverEnabled`,!0)},[z,ne,L]);let ve=Z((e,t)=>{let n=t.reason;if(!e&&!L.select(`open`)||z===e&&t.trigger===te&&H===n)return;let i=JC(t);if(!e&&t.trigger==null&&(t.trigger=te??void 0),r?.(e,t),t.isCanceled)return;L.state.floatingRootContext.dispatchOpenChange(e,t);let a=t.event;if(e===!1&&n!==`item-press`&&a?.type===`click`&&a.pointerType===`touch`&&!ue.current)return;e&&n===`trigger-focus`?(ue.current=!1,de.start(300,()=>{ue.current=!0})):(ue.current=!0,de.clear());let o=!e&&(n===`escape-key`||n==null);U.current=t.event;let s=qC(L.state,e,t.trigger,i());s.openChangeReason=n,s.keyboardOpen=e&&CR(n,a),s.instantType=re.type===`menubar`&&(n===`trigger-focus`||n===`focus-out`||n===`trigger-hover`||n===`list-navigation`||n===`sibling-open`)?`group`:SR(n,a)?`click`:o?`dismiss`:void 0,L.update(s)}),ye=NC({popupStore:L,floatingRootContext:L.state.floatingRootContext,floatingId:M,nested:N!=null,onOpenChange:ve}),be=ye.context.events;Q(()=>{let e=({open:e,eventDetails:t})=>ve(e,t);return be.on(`setOpen`,e),()=>{be?.off(`setOpen`,e)}},[be,ve]),Q(()=>L.subscribeToParentMenu(),[L]);let xe=q.useCallback(()=>{L.setOpen(!1,Ab(Yb))},[L]);q.useImperativeHandle(d,()=>({unmount:he,close:xe}),[he,xe]);let Se;re.type===`context-menu`&&(Se=re.context),q.useImperativeHandle(Se?.positionerRef,()=>B,[B]),q.useImperativeHandle(Se?.actionsRef,()=>({setOpen:ve}),[ve]);let Ce=bC(ye,{enabled:!V,bubbles:{escapeKey:f&&re.type===`menu`},outsidePress(){return re.type!==`context-menu`||U.current?.type===`contextmenu`||ce.current},externalTree:fe?R:void 0}),we=SE(),Te=Hw(ye,{enabled:!V,listRef:L.context.itemDomElements,activeIndex:ie,virtual:v,nested:re.type===`menubar`||!v&&re.type!==void 0,parentOrientation:re.type===`menubar`?re.context.orientation:void 0,loopFocus:l,focusItemOnOpen:v?ae:void 0,allowEscape:v&&l&&b,orientation:u,triggerOrientation:v?`vertical`:u,rtl:we===`rtl`,disabledIndices:qv,onNavigate(e,t){L.setActiveIndex(e,gR(t),t?.nativeEvent)},openOnArrowKeyDown:re.type!==`context-menu`&&!(v&&_),externalTree:!v&&fe?R:void 0,nestedReturnFocusRef:P?.context.virtualFocusRef,focusItemOnHover:g,resetOnPointerLeave:x}),Ee=q.useCallback(e=>{L.context.typingRef.current=e},[L]),De=Uw(ye,{enabled:!V&&!v,listRef:L.context.itemLabels,elementsRef:L.context.itemDomElements,activeIndex:ie,resetMs:500,onMatch:(e,t)=>{z&&e!==ie&&L.setActiveIndex(e,Hb,t.nativeEvent)},onTyping:Ee}),Oe=Z(a),ke=q.useRef(-1),Ae=Z(()=>{let e=L.state.activeIndex,t=e===null?void 0:L.context.itemDomElements.current[e]??void 0;if(t?.isConnected===!1)return;let n=t===void 0?-1:e;if(ke.current===n&&L.context.reportedItem===t)return;ke.current=n,L.context.reportedItem=t,v&&L.set(`highlightedItem`,t);let{highlightReason:r,highlightEvent:i}=L.context;L.context.highlightReason=Mb,L.context.highlightEvent=void 0,a&&Oe(t,jb(r,i,{label:t===void 0?void 0:L.context.itemLabels.current[n]??void 0}))});Q(()=>{Ae()},[ie,Ae]);let je=q.useMemo(()=>{if(!v)return Te.reference;if(!Te.trigger)return Jv;let{onFocus:e,...t}=Te.trigger;return t},[v,Te.reference,Te.trigger]);L.useSyncedValue(`inputProps`,v?Te.reference??Jv:Jv);let Me=q.useMemo(()=>{let e=mv(De.reference,je,Ce.reference,{onMouseMove(){L.set(`allowMouseEnter`,!0)}},me);return e[`aria-haspopup`]=`menu`,e[`aria-expanded`]=z,e},[L,De.reference,je,Ce.reference,me,z]),Ne=q.useMemo(()=>{let e=mv(Te.trigger,Ce.trigger,me);return e[`aria-haspopup`]=`menu`,e[`aria-expanded`]=!1,e},[Te.trigger,Ce.trigger,me]);sv(()=>(L.update({inactiveTriggerProps:Ne}),null)),$C(L,{floatingRootContext:ye,activeTriggerProps:Me,inactiveTriggerProps:Ne,popupProps:q.useMemo(()=>mv(VC,{onMouseMove(){L.set(`allowMouseEnter`,!0),re.type===`menu`&&L.set(`hoverEnabled`,!1)},onClick(){L.select(`hoverEnabled`)&&L.set(`hoverEnabled`,!1)},onKeyDown(e){let t=L.select(`keyboardEventRelay`);t&&!e.isPropagationStopped()&&t(e)}},De.floating,Te.floating,Ce.floating),[re.type,L,De.floating,Te.floating,Ce.floating]),itemProps:Te.item??Jv});let Pe=q.useMemo(()=>({store:L,parent:D,orientation:u,loopFocus:l,allowEscape:b,defaultFloatingId:k,setRenderedFloatingId:j,virtualFocus:v,parentVirtualFocus:E,syncHighlightedItem:Ae}),[L,D,u,l,b,k,v,E,Ae]),Fe=typeof t==`function`?t({payload:oe}):t,Ie=(0,J.jsxs)(vL.Provider,{value:Pe,children:[p&&(0,J.jsx)(WC,{handle:p,store:L}),Fe]});return(re.type===void 0||re.type===`context-menu`)&&(Ie=(0,J.jsx)(rC,{externalTree:R,children:Ie})),Ie});function TR(e){let t=q.useContext(xR);if(t===null)return(0,J.jsx)(wR,{...e});let n=t.Root;return(0,J.jsx)(xR.Provider,{value:null,children:(0,J.jsx)(n,{...t.options,...e})})}var ER=5;function DR(e,t){let n=OR(t);return e.clientX>=n.left-ER&&e.clientX<=n.right+ER&&e.clientY>=n.top-ER&&e.clientY<=n.bottom+ER}function OR(e){let t=e.getBoundingClientRect(),n=I_(e);if(Py)return t;let r=n.getComputedStyle(e,`::before`),i=n.getComputedStyle(e,`::after`);if(r.content===`none`&&i.content===`none`)return t;let a=parseFloat(r.width)||0,o=parseFloat(r.height)||0,s=parseFloat(i.width)||0,c=parseFloat(i.height)||0,l=Math.max(t.width,a,s),u=Math.max(t.height,o,c),d=l-t.width,f=u-t.height;return{left:t.left-d/2,right:t.right+d/2,top:t.top-f/2,bottom:t.bottom+f/2}}function kR(e){if(B_(e)&&e.hasAttribute(`data-rootownerid`))return e.getAttribute(`data-rootownerid`);if(!Q_(e))return kR(tv(e))}function AR(e){let{enabled:t=!0,mouseDownAction:n,open:r}=e,i=q.useRef(!1);return q.useMemo(()=>t?{onMouseDown:e=>{(n===`open`&&!r||n===`close`&&r)&&(i.current=!0,Mv(e.currentTarget).addEventListener(`click`,()=>{i.current=!1},{once:!0}))},onClick:e=>{i.current&&(i.current=!1,e.preventBaseUIHandler())}}:Jv,[t,n,r])}var jR=hy(function(e,t){let{render:n,className:r,style:i,disabled:a=!1,nativeButton:o=!0,id:s,openOnHover:c,delay:l=100,closeDelay:u=0,handle:d,payload:f,...p}=e,m=yL(!0),h=ww(d)??m?.store;if(!h)throw Error(Ov(85));let g=gE(s),_=h.useState(`isTriggerActive`,g),v=h.useState(`floatingRootContext`),y=h.useState(`isOpenedByTrigger`,g),b=h.useState(`triggerControlsId`,g),x=q.useRef(null),S=NR(),C=Av(!0),w=eC(),T=q.useMemo(()=>w??new XS,[w]),{registerTrigger:E,isMountedByThisTrigger:D}=XC(g,x,h,{payload:f,closeDelay:u,parent:S,floatingTreeRoot:T,floatingNodeId:tC(T),floatingParentNodeId:$S(),keyboardEventRelay:C?.relayKeyboardEvent}),O=S.type===`menubar`,k=h.useState(`disabled`),A=a||k||O&&S.context.disabled,{getButtonProps:j,buttonRef:M}=Pv({disabled:A,native:o});q.useEffect(()=>{!y&&S.type===void 0&&(h.context.allowMouseUpTriggerRef.current=!1)},[h,y,S.type]);let N=q.useRef(null),P=by(),F=Z(e=>{if(!N.current)return;P.clear(),h.context.allowMouseUpTriggerRef.current=!1;let t=e.target;Hy(N.current,t)||Hy(h.select(`positionerElement`),t)||t===N.current||(t==null||kR(t)!==h.select(`rootId`))&&(DR(e,N.current)||T.events.emit(`close`,{domEvent:e,reason:Wb}))});q.useEffect(()=>{let e=Mv(N.current);if(y&&h.select(`lastOpenChangeReason`)===`trigger-hover`)return e.addEventListener(`mouseup`,F,{once:!0}),()=>{e.removeEventListener(`mouseup`,F)}},[y,F,h]);let I=O&&S.context.hasSubmenuOpen,L=Fw(v,{enabled:(c??I)&&!A&&(!O||I&&!D),handleClose:Zw({blockPointerEvents:!O}),mouseOnly:!0,move:!1,restMs:S.type===void 0?l:void 0,delay:{close:u},triggerElementRef:x,externalTree:T,isActiveTrigger:_,isClosing:()=>h.select(`transitionStatus`)===`ending`}),R=MR(y,h.select(`lastOpenChangeReason`)),ee=mC(v,{enabled:!A,event:y&&O?`click`:`mousedown`,toggle:!0,ignoreMouse:!1,stickIfOpen:S.type===void 0&&R}),z=Dw(v,{enabled:!A&&I}),te=AR({open:y,enabled:O,mouseDownAction:`open`}),B=q.useMemo(()=>mv(z.reference,ee.reference),[z.reference,ee.reference]),ne=h.useState(`triggerProps`,D),V=h.useState(`filterTriggerProps`),{handlePreFocusGuardFocus:H,handleFocusTargetFocus:re}=sM(h,x),ie={disabled:A,open:y},ae=[N,t,M,E,x],oe=[B,L??Jv,ne,{"aria-haspopup":`menu`,"aria-controls":b,id:g,onMouseDown:e=>{h.select(`open`)||(P.start(200,()=>{h.context.allowMouseUpTriggerRef.current=!0}),Mv(e.currentTarget).addEventListener(`mouseup`,F,{once:!0}))}},V,O?{role:`menuitem`}:{},te,p,j],se=Qv(`button`,e,{enabled:!O,stateAttributesMapping:pb,state:ie,ref:ae,props:oe});return O?(0,J.jsx)(Fj,{tag:`button`,render:n,className:r,style:i,state:ie,refs:ae,props:oe,stateAttributesMapping:pb}):y?(0,J.jsxs)(q.Fragment,{children:[(0,J.jsx)(fx,{ref:h.context.beforeTriggerFocusGuardRef,onFocus:H},`${g}-pre-focus-guard`),(0,J.jsx)(q.Fragment,{children:se},g),(0,J.jsx)(fx,{ref:h.context.triggerFocusTargetRef,onFocus:re},`${g}-post-focus-guard`)]}):(0,J.jsx)(q.Fragment,{children:se},g)});function MR(e,t){let n=by(),[r,i]=q.useState(!1);return Q(()=>{e&&t===`trigger-hover`?(i(!0),n.start(500,()=>{i(!1)})):e||(n.clear(),i(!1))},[e,t,n]),r}function NR(){let e=hR(!0);return q.useMemo(()=>e?{type:`menubar`,context:e}:{type:void 0},[e])}var PR=q.forwardRef(function(e,t){let{className:n,render:r,orientation:i=`horizontal`,style:a,...o}=e;return Qv(`div`,e,{state:{orientation:i},ref:t,props:[{role:`separator`,"aria-orientation":i},o]})});function FR(e){return typeof e==`object`&&!!e&&Array.isArray(e.items)}function IR(e){return FR(e?.[0])}function LR(e){return IR(e)?e.flatMap(e=>e.items):e}function RR(e){if(!Array.isArray(e))return e!=null&&`null`in e;let t=e;if(IR(t)){for(let e of t)for(let t of e.items)if(t&&t.value==null&&t.label!=null)return!0;return!1}for(let e of t)if(e&&e.value==null&&e.label!=null)return!0;return!1}function zR(e,t){if(t&&e!=null)return t(e)??``;if(e&&typeof e==`object`){if(`label`in e&&e.label!=null)return String(e.label);if(`value`in e)return String(e.value)}return NN(e)}function BR(e,t){return t&&e!=null?t(e)??``:e&&typeof e==`object`&&`value`in e&&`label`in e?NN(e.value):NN(e)}function VR(e,t,n){function r(){return zR(e,n)}if(n&&e!=null)return n(e);if(e&&typeof e==`object`&&`label`in e&&e.label!=null)return e.label;if(t&&!Array.isArray(t))return(Object.hasOwn(t,e)?t[e]:void 0)??r();if(Array.isArray(t)){let n=LR(t);if(typeof e!=`object`||!e){let t=n.find(t=>t.value===e);return t&&t.label!=null?t.label:r()}if(`value`in e){let t=n.find(t=>t&&t.value===e.value);if(t&&t.label!=null)return t.label}}return r()}function HR(e,t,n){return e.reduce((e,r,i)=>(i>0&&e.push(`, `),e.push((0,J.jsx)(q.Fragment,{children:VR(r,t,n)},i)),e),[])}function UR({...e}){return(0,J.jsx)(TR,{"data-slot":`dropdown-menu`,...e})}function WR({...e}){return(0,J.jsx)(jR,{"data-slot":`dropdown-menu-trigger`,...e})}function GR({align:e=`start`,alignOffset:t=0,side:n=`bottom`,sideOffset:r=4,className:i,...a}){return(0,J.jsx)(rR,{children:(0,J.jsx)(iR,{className:`isolate z-50 outline-none`,align:e,alignOffset:t,side:n,sideOffset:r,children:(0,J.jsx)(eR,{"data-slot":`dropdown-menu-content`,className:X(`z-50 max-h-(--available-height) w-(--anchor-width) min-w-32 origin-(--transform-origin) overflow-x-hidden overflow-y-auto rounded-xl bg-popover p-1 text-popover-foreground shadow-md ring-1 ring-foreground/10 duration-(--duration-fast) outline-none data-[side=bottom]:slide-in-from-top-2 data-[side=inline-end]:slide-in-from-left-2 data-[side=inline-start]:slide-in-from-right-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:overflow-hidden data-closed:fade-out-0 data-closed:zoom-out-95`,i),...a})})})}function KR({...e}){return(0,J.jsx)(HL,{"data-slot":`dropdown-menu-group`,...e})}function qR({className:e,inset:t,...n}){return(0,J.jsx)(UL,{"data-slot":`dropdown-menu-label`,"data-inset":t,className:X(`px-1.5 py-1 text-caption font-medium text-muted-foreground data-inset:pl-7`,e),...n})}function JR({className:e,inset:t,variant:n=`default`,...r}){return(0,J.jsx)(GL,{"data-slot":`dropdown-menu-item`,"data-inset":t,"data-variant":n,className:X(`group/dropdown-menu-item relative flex cursor-default items-center gap-1.5 rounded-md px-1.5 py-1 text-ui -outline-offset-2 select-none focus:bg-accent focus:text-accent-foreground not-data-[variant=destructive]:focus:**:text-accent-foreground data-inset:pl-7 data-[variant=destructive]:text-destructive data-[variant=destructive]:focus:bg-destructive/10 data-[variant=destructive]:focus:text-destructive data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 data-[variant=destructive]:*:[svg]:text-destructive`,e),...r})}function YR({className:e,children:t,checked:n,inset:r,...i}){return(0,J.jsxs)(LL,{"data-slot":`dropdown-menu-checkbox-item`,"data-inset":r,className:X(`relative flex cursor-default items-center gap-1.5 rounded-md py-1 pr-8 pl-1.5 text-ui -outline-offset-2 select-none focus:bg-accent focus:text-accent-foreground focus:**:text-accent-foreground data-inset:pl-7 data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4`,e),checked:n,...i,children:[(0,J.jsx)(`span`,{className:`pointer-events-none absolute right-2 flex items-center justify-center`,"data-slot":`dropdown-menu-checkbox-item-indicator`,children:(0,J.jsx)(RL,{children:(0,J.jsx)(Rh,{})})}),t]})}function XR({...e}){return(0,J.jsx)(cR,{"data-slot":`dropdown-menu-radio-group`,...e})}function ZR({className:e,children:t,inset:n,...r}){return(0,J.jsxs)(fR,{"data-slot":`dropdown-menu-radio-item`,"data-inset":n,className:X(`relative flex cursor-default items-center gap-1.5 rounded-md py-1 pr-8 pl-1.5 text-ui -outline-offset-2 select-none focus:bg-accent focus:text-accent-foreground focus:**:text-accent-foreground data-inset:pl-7 data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4`,e),...r,children:[(0,J.jsx)(`span`,{className:`pointer-events-none absolute right-2 flex items-center justify-center`,"data-slot":`dropdown-menu-radio-item-indicator`,children:(0,J.jsx)(pR,{children:(0,J.jsx)(Rh,{})})}),t]})}function QR({className:e,...t}){return(0,J.jsx)(PR,{"data-slot":`dropdown-menu-separator`,className:X(`-mx-1 my-1 h-px bg-border`,e),...t})}var $R=({option:e,noteId:t})=>(0,J.jsxs)(ZR,{value:e.id,disabled:!e.available,"aria-describedby":e.available?void 0:t,children:[e.modelName,!e.measured&&(0,J.jsx)(`span`,{className:`rounded-full border px-1.5 text-caption text-muted-foreground`,children:`unmeasured`})]}),ez=e=>{if(e.key===`Escape`||e.key===`Tab`||(e.stopPropagation(),e.key!==`ArrowDown`&&e.key!==`ArrowUp`))return;let t=[...e.currentTarget.closest(`[role="menu"]`)?.querySelectorAll(`[role="menuitemradio"]`)??[]],n=t.findIndex(t=>e.currentTarget.compareDocumentPosition(t)&Node.DOCUMENT_POSITION_FOLLOWING),r=e.key===`ArrowDown`?t[n]:t[(n===-1?t.length:n)-1];r!==void 0&&(e.preventDefault(),r.focus())},tz=({first:e,options:t,separated:n,noteId:r,choice:i})=>{let[a,o]=(0,q.useState)(``),s=QI(t,i.chosen,i.defaultId),c=t.length-s.length,l=$I(t,s,a);return(0,J.jsxs)(KR,{children:[n&&(0,J.jsx)(QR,{}),(0,J.jsxs)(qR,{className:`flex flex-col gap-0.5`,children:[(0,J.jsx)(`span`,{className:`text-foreground`,children:e.available?e.via:e.providerName}),!e.available&&(0,J.jsx)(`span`,{id:r,className:`font-normal`,children:e.reason})]}),s.map(e=>(0,J.jsx)($R,{option:e,noteId:r},e.id)),c>0&&(0,J.jsx)(`div`,{className:`px-1.5 py-1`,children:(0,J.jsx)(nP,{value:a,onChange:e=>o(e.target.value),onKeyDown:ez,placeholder:`Filter ${c} more models`,"aria-label":`Filter ${c} more models through ${e.via}`,className:`h-7`})}),l.map(e=>(0,J.jsx)($R,{option:e,noteId:r},e.id)),c>0&&a.trim()!==``&&l.length===0&&(0,J.jsx)(`p`,{className:`px-2 py-1.5 text-caption text-muted-foreground`,children:`No model matches`})]})},nz=({choice:e,disabled:t,filled:n})=>{let r=(0,q.useId)();return(0,J.jsxs)(UR,{children:[(0,J.jsx)(WR,{render:(0,J.jsx)($,{variant:n?`default`:`outline`,size:`sm`,"data-slot":`model-menu`,disabled:t,"aria-label":e.chosen===null?`Choose a model`:`Model: ${e.chosen.modelName}`,className:X(`w-6 rounded-l-none px-0`,n?`border-l-primary-foreground/30`:`border-l-0`)}),children:(0,J.jsx)(Bh,{"aria-hidden":`true`})}),(0,J.jsx)(GR,{align:`end`,className:`w-80`,children:(0,J.jsx)(XR,{value:e.chosen?.id??null,onValueChange:t=>e.choose(t),children:ZI(e.options).map(([t,n],i)=>(0,J.jsx)(tz,{first:t,options:n,separated:i>0,noteId:`${r}-${i}`,choice:e},t.id))})})]})},rz=e=>`${Math.floor(e/60)}:${String(e%60).padStart(2,`0`)}`,iz=(e,t)=>{let[n,r]=(0,q.useState)(t);return(0,q.useEffect)(()=>{if(e===null)return;r(t());let n=setInterval(()=>r(t()),1e3);return()=>clearInterval(n)},[e,t]),e===null?0:Math.max(0,Math.round((n-e)/1e3))},az=({label:e,running:t,icon:n,variant:r=`outline`,choice:i,what:a=`Runs`,blocked:o=null,idle:s=null,run:c,now:l=Date.now,initial:u})=>{let d=(0,q.useId)(),[f,p]=(0,q.useState)(()=>u===void 0?{is:`idle`}:`runningSince`in u?{is:`running`,since:u.runningSince}:u.ok?{is:`done`,said:u.said}:{is:`failed`,...u}),m=iz(f.is===`running`?f.since:null,l),{chosen:h,locked:g}=i,_=f.is===`running`,v=o??g,y=v??(h===null?null:`${a} ${h.modelName} through ${h.via}`),b=async()=>{p({is:`running`,since:l()});let e=await c(h?.id);p(e.ok?{is:`done`,said:e.said}:{is:`failed`,...e})};return(0,J.jsxs)(`div`,{"data-slot":`model-action`,className:`flex flex-wrap items-center gap-x-3 gap-y-1.5`,children:[(0,J.jsxs)(`span`,{className:`flex shrink-0 items-center`,children:[(0,J.jsxs)(uI,{disabled:y===null,children:[(0,J.jsxs)(dI,{render:(0,J.jsx)($,{variant:r,size:`sm`,disabled:_||v!==null||h===null,focusableWhenDisabled:!0,"aria-busy":_,"aria-describedby":y===null?void 0:`${d}-note`,onClick:()=>void b(),className:`rounded-r-none`}),children:[_?(0,J.jsx)(Hg,{"aria-hidden":`true`,className:xF}):g!==null&&o===null?(0,J.jsx)(Wg,{"aria-hidden":`true`}):n,e]}),(0,J.jsxs)(fI,{side:`bottom`,align:`start`,children:[v!==null&&(0,J.jsx)(Pg,{"aria-hidden":`true`,className:`size-3.5 shrink-0`}),y]})]}),(0,J.jsx)(nz,{choice:i,disabled:_||i.options.length===0,filled:r==="default"&&v===null})]}),y!==null&&(0,J.jsx)(`span`,{id:`${d}-note`,hidden:!0,children:y}),(0,J.jsx)(`span`,{role:f.is===`failed`?`alert`:`status`,className:X(`flex min-w-0 flex-1 basis-56 flex-wrap items-center gap-x-2 text-caption`,f.is===`failed`?`text-destructive`:`text-muted-foreground`),children:f.is===`running`?(0,J.jsxs)(J.Fragment,{children:[t,` `,(0,J.jsx)(`span`,{className:`tabular`,children:rz(m)})]}):f.is===`done`?f.said:f.is===`failed`?(0,J.jsxs)(J.Fragment,{children:[(0,J.jsxs)(`span`,{children:[(0,J.jsx)(v_,{"aria-hidden":`true`,className:`mr-1 inline size-3.5 align-[-2px]`}),f.message]}),(0,J.jsx)($,{variant:`link`,className:`h-6 min-w-6 px-1 text-caption`,onClick:()=>void b(),children:`Try again`})]}):s})]})};function oz(e){let t=q.useRef(!0);t.current&&(t.current=!1,e())}var sz=q.createContext(void 0),cz=q.createContext(void 0);function lz(){let e=q.useContext(sz);if(e===void 0)throw Error(Ov(60));return e}function uz(){let e=q.useContext(cz);if(e===void 0)throw Error(Ov(61));return e}function dz(e,t,n=Object.is){let{length:r}=e;if(r!==t.length)return!1;for(let i=0;i<r;i+=1)if(!n(e[i],t[i]))return!1;return!0}var fz=(e,t)=>Object.is(e,t);function pz(e,t,n){return e==null||t==null?Object.is(e,t):n(e,t)}function mz(e,t,n){return Array.isArray(e)&&Array.isArray(t)?!dz(e,t,(e,t)=>pz(e,t,n)):e!==t}function hz(e,t,n){return e?e.some(e=>e!==void 0&&pz(t,e,n)):!1}function gz(e,t,n){return e?e.findIndex(e=>e!==void 0&&pz(e,t,n)):-1}function _z(e,t){if(t!==fz)return n=>hz(e,n,t);let n=new Set(e);return n.delete(void 0),t=>n.has(t)&&(t!==0||e.some(e=>Object.is(t,e)))}function vz(e,t,n,r){let i=r&&Array.isArray(t)?e.findIndex(_z(t,n)):gz(e,t,n);return i===-1?null:i}function yz(e,t,n,r,i,a){return hz(r,t,i)?a!=null&&e>a&&hz(r,n[a],i)?a:e:e===a?vz(n,r,i,!0):a}function bz(e,t,n){return e.filter(e=>!pz(t,e,n))}var xz={id:e=>e.id,labelId:e=>e.labelId,modal:e=>e.modal,multiple:e=>e.multiple,disabled:e=>e.disabled,readOnly:e=>e.readOnly,required:e=>e.required,highlightItemOnHover:e=>e.highlightItemOnHover,items:e=>e.items,itemToStringLabel:e=>e.itemToStringLabel,isItemEqualToValue:e=>e.isItemEqualToValue,value:e=>e.value,hasSelectedValue:e=>{let{value:t,multiple:n,itemToStringValue:r}=e;return t==null?!1:n&&Array.isArray(t)?t.length>0:BR(t,r)!==``},hasNullItemLabel:(e,t)=>t?RR(e.items):!1,open:e=>e.open,mounted:e=>e.mounted,forceMount:e=>e.forceMount,transitionStatus:e=>e.transitionStatus,openMethod:e=>e.openMethod,activeIndex:e=>e.activeIndex,selectedIndex:e=>e.selectedIndex,isActive:(e,t)=>e.activeIndex===t,isSelected:(e,t)=>{let n=e.isItemEqualToValue,r=e.value;return e.multiple?Array.isArray(r)&&r.some(e=>pz(t,e,n)):pz(t,r,n)},isSelectedByFocus:(e,t)=>e.selectedIndex===t,popupProps:e=>e.popupProps,triggerProps:e=>e.triggerProps,itemRoot:e=>e.itemRoot,triggerElement:e=>e.triggerElement,positionerElement:e=>e.positionerElement,listElement:e=>e.listElement,popupSide:e=>e.popupSide,scrollUpArrowVisible:e=>e.scrollUpArrowVisible,scrollDownArrowVisible:e=>e.scrollDownArrowVisible,hasScrollArrows:e=>e.hasScrollArrows};function Sz(e){let{id:t,value:n,defaultValue:r=null,onValueChange:i,open:a,defaultOpen:o=!1,onOpenChange:s,name:c,form:l,autoComplete:u,disabled:d=!1,readOnly:f=!1,required:p=!1,modal:m=!0,actionsRef:h,inputRef:g,onOpenChangeComplete:_,items:v,multiple:y=!1,itemToStringLabel:b,itemToStringValue:x,isItemEqualToValue:S=fz,highlightItemOnHover:C=!0,children:w}=e,{clearErrors:T}=IN(),{setDirty:E,setTouched:D,setFocused:O,validityData:k,setFilled:A,name:j,disabled:M,validation:N,validationMode:P}=TN(),F=MN({id:t}),I=M||d,L=j??c,[R,ee]=nO({controlled:n,default:y?r??qv:r,name:`Select`,state:`value`}),[z,te]=nO({controlled:a,default:o,name:`Select`,state:`open`}),B=q.useRef([]),ne=q.useRef([]),V=q.useRef(null),H=q.useRef(null),re=q.useRef(0),ie=q.useRef(null),ae=q.useRef([]),oe=q.useRef(!1),se=q.useRef(null),U=q.useRef(null),ce=q.useRef({allowSelectedMouseUp:!1,allowUnselectedMouseUp:!1,dragY:0}),le=q.useRef(!1),ue=q.useRef(R),{openMethod:de,triggerProps:fe}=zA(z),pe=sv(()=>new mw({id:F,labelId:void 0,modal:m,multiple:y,disabled:I,readOnly:f,required:p,highlightItemOnHover:C,itemToStringLabel:b,itemToStringValue:x,isItemEqualToValue:S,value:R,open:z,mounted:z,transitionStatus:void 0,items:v,forceMount:!1,openMethod:null,activeIndex:null,selectedIndex:null,popupProps:Jv,triggerProps:Jv,itemRoot:{props:Jv,multiple:y,disabled:I,readOnly:f,isItemEqualToValue:S},triggerElement:null,positionerElement:null,listElement:null,popupSide:null,scrollUpArrowVisible:!1,scrollDownArrowVisible:!1,hasScrollArrows:!1},{setValue:Kv,setOpen:Kv,handleScrollArrowVisibility:Kv,onOpenChangeComplete:Kv,listRef:B,popupRef:V,scrollHandlerRef:H,scrollArrowsMountedCountRef:re,valueRef:ie,valuesRef:ae,labelsRef:ne,typingRef:oe,selectionRef:ce,firstItemTextRef:se,selectedItemTextRef:U,alignItemWithTriggerActiveRef:le,initialValueRef:ue},xz)).current,[me,he]=q.useState(!1),{mounted:ge,transitionStatus:_e,forceUnmount:ve}=BC({open:z,ref:V,preventUnmountOnClose:me,setPreventUnmountOnClose:he,onUnmount(){pe.update({activeIndex:null,openMethod:null,scrollUpArrowVisible:!1,scrollDownArrowVisible:!1}),_?.(!1)}}),ye=pe.useState(`activeIndex`),be=pe.useState(`selectedIndex`),xe=pe.useState(`triggerElement`),Se=pe.useState(`positionerElement`),Ce=WE(de),we=de??Ce,Te=q.useMemo(()=>y?``:BR(R,x),[y,R,x]),Ee=q.useMemo(()=>y&&Array.isArray(R)?R.map(e=>BR(e,x)):BR(R,x),[y,R,x]);PN(rx(xe),F,R,Z(()=>Ee),!I,c);let De=y?Array.isArray(R)&&R.length>0:R!=null&&Te!==``;Q(()=>{A(De)},[De,A]),Q(function(){let e=vz(ae.current,R,S,y);e===null&&(U.current=null),!z&&pe.set(`selectedIndex`,e)},[y,z,R,S,pe]),LA(R,()=>{T(L),E(mz(R,k.initialValue,S)),N.change(R)});let Oe=Z((e,t)=>{let n=t,r=JC(n);s?.(e,n),!t.isCanceled&&(e||he(r()),te(e),!e&&(t.reason===`focus-out`||t.reason===`outside-press`)&&(D(!0),O(!1),P===`onBlur`&&N.commit(R)))});q.useImperativeHandle(h,()=>({unmount:ve,close:()=>{pe.state.open&&Oe(!1,Ab(Yb))}}),[ve,Oe,pe]);let ke=Z((e,t)=>{i?.(e,t),!t.isCanceled&&ee(e)}),Ae=Z(e=>{let t=DP(e.scrollHeight,e.clientHeight),n=OP(e.scrollTop,t),r=n>0,i=n<t;pe.set(`scrollUpArrowVisible`,r),pe.set(`scrollDownArrowVisible`,i)}),je=Tw({open:z,onOpenChange:Oe,elements:{reference:xe,floating:Se}}),Me=mC(je,{enabled:!I,event:`mousedown`}),Ne=bC(je),Pe=Hw(je,{enabled:!I,listRef:B,activeIndex:ye,selectedIndex:be,disabledIndices:qv,onNavigate(e){(e!==null||z)&&pe.set(`activeIndex`,e)},focusItemOnHover:C}),Fe=Uw(je,{enabled:!I&&(z||!f&&!y),listRef:ne,activeIndex:ye,selectedIndex:be,disabledIndices:e=>jO(B.current[e]),onMatch(e){z?pe.set(`activeIndex`,e):ke(ae.current[e],Ab(Mb))},onTyping(e){oe.current=e}}),Ie=q.useMemo(()=>mv(Fe.reference,Pe.reference,Ne.reference,Me.reference,fe),[Me.reference,Fe.reference,Pe.reference,Ne.reference,fe]),Le=q.useMemo(()=>mv(VC,Fe.floating,Pe.floating,Ne.floating),[Fe.floating,Pe.floating,Ne.floating]),Re=Pe.item??Jv,ze=q.useMemo(()=>({props:Re,multiple:y,disabled:I,readOnly:f,isItemEqualToValue:S}),[Re,y,I,f,S]);pe.useContextCallback(`setValue`,ke),pe.useContextCallback(`setOpen`,Oe),pe.useContextCallback(`handleScrollArrowVisibility`,Ae),pe.useContextCallback(`onOpenChangeComplete`,_),oz(()=>{pe.update({popupProps:Le,triggerProps:Ie,itemRoot:ze})}),pe.useSyncedValues({id:F,modal:m,multiple:y,disabled:I,readOnly:f,required:p,highlightItemOnHover:C,value:R,open:z,mounted:ge,transitionStatus:_e,popupProps:Le,triggerProps:Ie,itemRoot:ze,items:v,itemToStringLabel:b,itemToStringValue:x,isItemEqualToValue:S,openMethod:we});let Be=Lv(g,N.inputRef),Ve=y?void 0:L,He=q.useMemo(()=>!y||!Array.isArray(R)||!L?null:R.map(e=>{let t=BR(e,x);return(0,J.jsx)(`input`,{type:`hidden`,form:l,name:L,value:t,disabled:I},t)}),[y,R,l,L,x,I]);return(0,J.jsxs)(sz.Provider,{value:pe,children:[(0,J.jsx)(cz.Provider,{value:je,children:w}),(0,J.jsx)(`input`,{...N.getValidationProps(I,{onFocus(){pe.state.triggerElement?.focus({focusVisible:!0})},onChange(e){if(e.nativeEvent.defaultPrevented||I||f)return;let t=e.currentTarget.value,n=Ab(Mb,e.nativeEvent);function r(){if(y)return;let e=t.toLowerCase(),r=ae.current.findIndex(t=>BR(t,x).toLowerCase()===e||zR(t,b).toLowerCase()===e);r===-1&&(r=ae.current.findIndex((t,n)=>{let r=ne.current[n];return r!=null&&r.toLowerCase()===e}));let i=ae.current[r];i!=null&&ke(i,n)}pe.set(`forceMount`,!0),queueMicrotask(r)}}),id:F&&Ve==null?`${F}-hidden-input`:void 0,form:l,name:Ve,autoComplete:u,value:Te,disabled:I,required:p&&!(y&&De),readOnly:f,ref:Be,style:L?dx:ux,tabIndex:-1,"aria-hidden":!0,suppressHydrationWarning:!0}),He]})}function Cz(e,t){return e??t}var wz=`data-popup-side`,Tz=400,Ez={...pb,...SN,popupSide:e=>e?{[wz]:e}:null,value:()=>null},Dz=q.forwardRef(function(e,t){let{render:n,className:r,id:i,disabled:a=!1,nativeButton:o=!0,style:s,...c}=e,{setTouched:l,validationMode:u,validation:d,state:f,disabled:p}=TN(),{labelId:m}=ON(),h=lz(),g=h.useState(`readOnly`),_=h.useState(`required`),v=h.useState(`disabled`),y=p||v||a,b=h.useState(`open`),x=h.useState(`mounted`),S=h.useState(`value`),C=h.useState(`triggerProps`),w=h.useState(`positionerElement`),T=h.useState(`listElement`),E=h.useState(`popupSide`),D=h.useState(`id`),O=h.useState(`labelId`),k=h.useState(`hasSelectedValue`),A=x&&w?E:null,j=i??D,M=Cz(m,O);MN({id:i});let N=rx(w),P=q.useRef(null),F=EN(y,P),{getButtonProps:I,buttonRef:L}=Pv({disabled:y,native:o}),R=h.useStateSetter(`triggerElement`),ee=by(),z=by(),te=by();q.useEffect(()=>{if(b)return te.start(Tz,()=>{h.context.selectionRef.current.allowUnselectedMouseUp=!0,h.context.selectionRef.current.allowSelectedMouseUp=!0}),()=>{te.clear()};h.context.selectionRef.current={allowSelectedMouseUp:!1,allowUnselectedMouseUp:!1,dragY:0},z.clear()},[b,h,z,te]);let B=mv(C,{id:j,role:`combobox`,"aria-expanded":b,"aria-haspopup":`listbox`,"aria-controls":b?T?.id??wb(w)?.id:void 0,"aria-labelledby":M,"aria-readonly":g||void 0,"aria-required":_||void 0,tabIndex:y?-1:0,onFocus(e){F(!0),b&&h.context.alignItemWithTriggerActiveRef.current&&h.context.setOpen(!1,Ab(Mb,e.nativeEvent)),ee.start(0,()=>{h.set(`forceMount`,!0)})},onBlur(e){Hy(w,e.relatedTarget)||(l(!0),F(!1),u===`onBlur`&&d.commit(S))},onMouseDown(e){if(b)return;let t=Mv(e.currentTarget);function n(e){if(!P.current)return;let t=e.target;Hy(P.current,t)||Hy(N.current,t)||DR(e,P.current)||h.context.setOpen(!1,Ab(Wb,e))}z.start(0,()=>{t.addEventListener(`mouseup`,n,{once:!0})})}},c,I),ne=d.getValidationProps(y,B);ne.role=`combobox`;let V={...f,open:b,disabled:y,value:S,readOnly:g,popupSide:A,placeholder:!k};return Qv(`button`,e,{ref:[t,P,L,R],state:V,stateAttributesMapping:Ez,props:ne})}),Oz={value:()=>null},kz=q.forwardRef(function(e,t){let{className:n,render:r,children:i,placeholder:a,style:o,...s}=e,c=lz(),l=c.useState(`value`),u=c.useState(`items`),d=c.useState(`itemToStringLabel`),f=c.useState(`hasSelectedValue`),p=!f&&a!=null&&i==null,m=c.useState(`hasNullItemLabel`,p),h={value:l,placeholder:!f},g=null;return g=typeof i==`function`?i(l):i??(p&&!m?a:Array.isArray(l)?HR(l,u,d):VR(l,u,d)),Qv(`span`,e,{state:h,ref:[t,c.context.valueRef],props:[{children:g},s],stateAttributesMapping:Oz})}),Az=q.forwardRef(function(e,t){let{render:n,className:r,style:i,...a}=e;return Qv(`span`,e,{state:{open:lz().useState(`open`)},ref:t,props:[{"aria-hidden":!0,children:`▼`},a],stateAttributesMapping:fb})}),jz=q.forwardRef(function(e,t){let n=lz(),r=n.useState(`mounted`),i=n.useState(`forceMount`);return r||i?(0,J.jsx)(JS,{ref:t,...e}):null}),Mz=q.createContext(void 0);function Nz(){let e=q.useContext(Mz);if(!e)throw Error(Ov(59));return e}function Pz(e,t){e&&Object.assign(e.style,t)}var Fz={position:`relative`,maxHeight:`100%`,overflowX:`hidden`,overflowY:`auto`},Iz={position:`fixed`},Lz=q.forwardRef(function(e,t){let{anchor:n,className:r,render:i,positionMethod:a,side:o,align:s,sideOffset:c,alignOffset:l,collisionBoundary:u=`clipping-ancestors`,collisionPadding:d,arrowPadding:f,sticky:p,disableAnchorTracking:m,alignItemWithTrigger:h=!0,collisionAvoidance:g=BS,style:_,...v}=e,y=lz(),b=uz(),x=y.useState(`open`),S=y.useState(`mounted`),C=y.useState(`modal`),w=y.useState(`value`),T=y.useState(`openMethod`),E=y.useState(`positionerElement`),D=y.useState(`triggerElement`),O=y.useState(`isItemEqualToValue`),k=y.useState(`transitionStatus`),A=q.useRef(null),j=q.useRef(null),[M,N]=q.useState(h),P=S&&M&&T!==`touch`;!S&&M!==h&&N(h),q.useImperativeHandle(y.context.alignItemWithTriggerActiveRef,()=>P),gM((P||C)&&x,T===`touch`,E,D);let F=IE({anchor:n,floatingRootContext:b,positionMethod:a,mounted:S,side:o,sideOffset:c,align:s,alignOffset:l,arrowPadding:f,collisionBoundary:u,collisionPadding:d,sticky:p,disableAnchorTracking:m??P,collisionAvoidance:g,keepMounted:!0}),I=P?`none`:F.side,L=P?Iz:F.positionerStyles,R={open:x,side:I,align:F.align,anchorHidden:F.anchorHidden};Q(()=>{y.set(`popupSide`,F.side)},[y,F.side]);let ee=BE(e,R,{styles:L,transitionStatus:k,props:v,refs:[t,y.useStateSetter(`positionerElement`)],hidden:!S,inert:!x}),z=q.useRef(0),te=Z(e=>{if(y.context.valuesRef.current.length===0)return;let t=z.current;z.current=e.size;let n=Ab(Mb);if(t!==0&&!y.state.multiple&&w!==null&&gz(y.context.valuesRef.current,w,O)===-1){let e=y.context.initialValueRef.current,t=e!=null&&gz(y.context.valuesRef.current,e,O)!==-1?e:null;y.context.setValue(t,n),t===null&&(y.set(`selectedIndex`,null),y.context.selectedItemTextRef.current=null)}if(t!==0&&y.state.multiple&&Array.isArray(w)){let e=w.filter(e=>gz(y.context.valuesRef.current,e,O)!==-1);e.length!==w.length&&(y.context.setValue(e,n),e.length===0&&(y.set(`selectedIndex`,null),y.context.selectedItemTextRef.current=null))}if(x&&P){y.update({scrollUpArrowVisible:!1,scrollDownArrowVisible:!1});let e={height:``};Pz(E,e),Pz(y.context.popupRef.current,e)}}),B=q.useMemo(()=>({...F,side:I,alignItemWithTriggerActive:P,setControlledAlignItemWithTrigger:N,scrollUpArrowRef:A,scrollDownArrowRef:j}),[F,I,P,N]);return(0,J.jsx)(aO,{elementsRef:y.context.listRef,labelsRef:y.context.labelsRef,onMapChange:te,children:(0,J.jsxs)(Mz.Provider,{value:B,children:[S&&C&&(0,J.jsx)(hA,{inert:UE(!x),cutout:D}),ee]})})}),Rz=`--transform-origin`,zz={...mb,...tb},Bz=q.forwardRef(function(e,t){let{render:n,className:r,style:i,finalFocus:a,...o}=e,s=lz(),c=s.useState(`multiple`),l=s.useState(`readOnly`),u=s.useState(`highlightItemOnHover`),d=uz(),{side:f,align:p,alignItemWithTriggerActive:m,isPositioned:h,setControlledAlignItemWithTrigger:g}=Nz(),_=Rj(!0)!=null,v=SE(),{nonce:y,disableStyleElements:b}=DO(),x=s.useState(`id`),S=s.useState(`open`),C=s.useState(`openMethod`),w=s.useState(`mounted`),T=s.useState(`popupProps`),E=s.useState(`transitionStatus`),D=s.useState(`triggerElement`),O=s.useState(`positionerElement`),k=s.useState(`listElement`),A=q.useRef(!1),j=q.useRef(!1),M=q.useRef({}),N=cx(),P=Z(e=>{if(!O||!s.context.popupRef.current||!j.current)return;let t=O.style.top===`0px`,n=O.style.bottom===`0px`;if(A.current||!m||!t&&!n){s.context.handleScrollArrowVisibility(e);return}let r=Uz(O),i=Wz(O.getBoundingClientRect().height,`y`,r),a=Mv(O),o=I_(O),c=o.getComputedStyle(O),l=parseFloat(c.marginTop),u=parseFloat(c.marginBottom),d=Vz(o.getComputedStyle(s.context.popupRef.current)),f=Math.min(a.documentElement.clientHeight-l-u,d),p=e.scrollTop,h=Hz(e),g=null,_=e=>{O.style.height=`${e}px`},v=t?h-p:p,y=Math.min(i+v,f);if(v<=1){let n=TP(v,0,f-i);n>0&&_(i+n),e.scrollTop=t?h:0,f-(i+n)<=1&&(A.current=!0),s.context.handleScrollArrowVisibility(e);return}f-y>1?g=t?1/0:0:n&&p<h&&(g=p-(v-(i+v-f)));let b=Math.ceil(y);if(b!==0&&_(b),g!=null){let t=TP(g,0,Hz(e));Math.abs(e.scrollTop-t)>1&&(e.scrollTop=t)}b>=f-1&&(A.current=!0),s.context.handleScrollArrowVisibility(e)});q.useImperativeHandle(s.context.scrollHandlerRef,()=>P,[P]),zC({open:S,ref:s.context.popupRef,onComplete(){S&&s.context.onOpenChangeComplete(!0)}});let F={open:S,transitionStatus:E,side:f,align:p};Q(()=>{O&&s.context.popupRef.current&&!Object.keys(M.current).length&&(M.current={top:O.style.top||`0`,left:O.style.left||`0`,right:O.style.right,height:O.style.height,bottom:O.style.bottom,minHeight:O.style.minHeight,maxHeight:O.style.maxHeight,marginTop:O.style.marginTop,marginBottom:O.style.marginBottom})},[s,O]),Q(()=>{S||m||(j.current=!1,A.current=!1,Pz(O,M.current))},[S,m,O]),Q(()=>{let e=s.context.popupRef.current;if(!S||!D||!O||!e||m&&!h||s.state.transitionStatus===`ending`)return;if(j.current=!0,e.style.removeProperty(Rz),!m){N.request(()=>s.context.handleScrollArrowVisibility(k||e));return}let t=qz(e);try{let t=s.context.selectedItemTextRef.current;t?.isConnected||(t=!s.select(`hasSelectedValue`)&&s.context.firstItemTextRef.current?.isConnected?s.context.firstItemTextRef.current:null);let n=s.context.valueRef.current,r=I_(O),i=r.getComputedStyle(O),a=r.getComputedStyle(e),o=Mv(D),c=Uz(D),l=Gz(D.getBoundingClientRect(),c),d=Gz(O.getBoundingClientRect(),c),f=l.height,p=k||e,m=p.scrollHeight,h=parseFloat(a.borderBottomWidth),_=parseFloat(i.marginTop)||10,y=parseFloat(i.marginBottom)||10,b=parseFloat(i.minHeight)||100,x=Vz(a),S=o.documentElement.clientHeight-_-y,C=o.documentElement.clientWidth,w=S-l.bottom+f,T,E=v===`rtl`?l.right-d.width:l.left,j=0;if(t&&n){let e=Gz(n.getBoundingClientRect(),c);T=Gz(t.getBoundingClientRect(),c),E=d.left+(v===`rtl`?e.right-T.right:e.left-T.left);let r=e.top-l.top+e.height/2;j=T.top-d.top+T.height/2-r}let N=w+j+y+h,P=Math.min(S,N),F=S-_-y,I=N-P,L=C-5;O.style.left=`${TP(E,5,L-d.width)}px`,O.style.height=`${P}px`,O.style.maxHeight=`none`,O.style.marginTop=`${_}px`,O.style.marginBottom=`${y}px`,e.style.height=`100%`;let R=Hz(p),ee=I>=R-1;ee&&(P=Math.min(S,d.height)-(I-R));let z=l.top<20||l.bottom>S-20||Math.ceil(P)+1<Math.min(m,b),te=(r.visualViewport?.scale??1)!==1&&My;if(z||te){Pz(O,M.current),g(!1);return}let B=Math.max(b,P);if(ee){let e=Math.max(0,S-N);O.style.top=d.height>=F?`0`:`${e}px`,O.style.height=`${P}px`,p.scrollTop=Hz(p)}else O.style.bottom=`0`,p.scrollTop=I;if(T){let t=d.top,n=d.height,r=T.top+T.height/2,i=TP(n>0?(r-t)/n*100:50,0,100);e.style.setProperty(Rz,`50% ${i}%`)}(B===S||P>=x)&&(A.current=!0),s.context.handleScrollArrowVisibility(p),u&&s.state.selectedIndex===null&&s.state.activeIndex===null&&s.context.listRef.current[0]!=null&&s.set(`activeIndex`,0)}finally{t()}},[s,S,O,D,m,g,N,k,u,v,h]),q.useEffect(()=>{if(!m||!O||!S)return;let e=I_(O);function t(e){s.context.setOpen(!1,Ab(Xb,e))}return tx(e,`resize`,t)},[s,m,O,S]);let I={...k?{role:`presentation`}:{role:`listbox`,"aria-multiselectable":c||void 0,"aria-readonly":l||void 0,id:`${x}-list`},onKeyDown(e){_&&IO.has(e.key)&&e.stopPropagation()},onScroll(e){k||P(e.currentTarget)},...m&&{style:k?{height:`100%`}:Fz},className:!k&&m?sP.className:void 0},L=Qv(`div`,e,{ref:[t,s.context.popupRef],state:F,stateAttributesMapping:zz,props:[T,I,zE(E),o]});return(0,J.jsxs)(q.Fragment,{children:[!b&&sP.getElement(y),(0,J.jsx)(pC,{context:d,modal:!1,disabled:!w,openInteractionType:C,returnFocus:a,restoreFocus:!0,children:L})]})});function Vz(e){let t=e.maxHeight;return t.endsWith(`px`)&&parseFloat(t)||1/0}function Hz(e){return DP(e.scrollHeight,e.clientHeight)}function Uz(e){return PT.getScale(e)}function Wz(e,t,n){return e/n[t]}function Gz(e,t){return zx({x:Wz(e.x,`x`,t),y:Wz(e.y,`y`,t),width:Wz(e.width,`x`,t),height:Wz(e.height,`y`,t)})}var Kz=[[`transform`,`none`],[`scale`,`1`],[`translate`,`0 0`]];function qz(e){let{style:t}=e,n={};for(let[e,r]of Kz)n[e]=t.getPropertyValue(e),t.setProperty(e,r,`important`);return()=>{for(let[e]of Kz){let r=n[e];r?t.setProperty(e,r):t.removeProperty(e)}}}var Jz=q.forwardRef(function(e,t){let{render:n,className:r,style:i,...a}=e,o=lz(),s=o.useState(`multiple`),c=o.useState(`readOnly`),{alignItemWithTriggerActive:l}=Nz(),u=o.useState(`hasScrollArrows`),d=o.useState(`openMethod`),f={id:`${o.useState(`id`)}-list`,role:`listbox`,"aria-multiselectable":s||void 0,"aria-readonly":c||void 0,onScroll(e){o.context.scrollHandlerRef.current?.(e.currentTarget)},...l&&{style:Fz},className:u&&d!==`touch`?sP.className:void 0};return Qv(`div`,e,{ref:[t,o.useStateSetter(`listElement`)],props:[f,a]})}),Yz=q.createContext(void 0);function Xz(){let e=q.useContext(Yz);if(!e)throw Error(Ov(57));return e}var Zz=q.memo(q.forwardRef(function(e,t){let{render:n,className:r,style:i,value:a=null,label:o,disabled:s=!1,nativeButton:c=!1,...l}=e,u=q.useRef(null),d=bO({guess:!0,label:o,textRef:u}),f=lz(),{props:p,multiple:m,disabled:h,readOnly:g,isItemEqualToValue:_}=f.useState(`itemRoot`),v=h||s,y=f.useState(`isActive`,d.index),b=f.useState(`open`),x=f.useState(`isSelected`,a),S=f.useState(`isSelectedByFocus`,d.index),C=d.index,w=q.useRef(null);Q(()=>{let e=f.context.valuesRef.current;return e[C]=a,()=>{delete e[C]}},[C,a,f]),Q(()=>{let e=f.state.value,t=f.state.selectedIndex,n=t,r;m&&Array.isArray(e)?(n=yz(C,a,f.context.valuesRef.current,e,_,t),r=n===C,C===t&&!r&&(f.context.selectedItemTextRef.current=null)):(r=e!==void 0&&pz(a,e,_),r&&(n=C)),f.set(`selectedIndex`,n),r&&u.current&&(f.context.selectedItemTextRef.current=u.current)},[C,m,_,f,a]);let T=q.useRef(`mouse`),E=q.useRef(!1),{getButtonProps:D,buttonRef:O}=Pv({disabled:v,focusableWhenDisabled:!0,native:c,composite:!0}),k={disabled:v,selected:x,highlighted:y};function A(e){if(h||g)return;let t=f.state.value;if(m){let n=Array.isArray(t)?t:[],r=x?bz(n,a,_):[...n,a];f.context.setValue(r,Ab(Lb,e))}else f.context.setValue(a,Ab(Lb,e)),f.context.setOpen(!1,Ab(Lb,e))}function j(){f.context.selectionRef.current.dragY=0}let M={role:`option`,"aria-selected":x,tabIndex:b&&y?0:-1,onKeyDown(e){f.set(`activeIndex`,C),e.key===` `&&f.context.typingRef.current&&e.preventDefault()},onClick(e){let t=T.current!==`touch`,n=e.nativeEvent.pointerType,r=t&&Ly(e.nativeEvent)&&(n!==void 0||y),i=t&&!r&&!E.current;E.current=!1,!(v||i)&&A(e.nativeEvent)},onPointerEnter(e){T.current=e.pointerType},onPointerMove(e){if(e.pointerType===`mouse`&&e.buttons===1){let t=f.context.selectionRef.current;t.dragY+=e.movementY,t.dragY**2>=64&&(t.allowUnselectedMouseUp=!0)}},onPointerDown(e){T.current=e.pointerType,E.current=!0,j()},onMouseUp(){if(j(),v||T.current===`touch`||E.current)return;let e=!f.context.selectionRef.current.allowSelectedMouseUp&&x,t=!f.context.selectionRef.current.allowUnselectedMouseUp&&!x;e||t||(E.current=!0,w.current?.click(),E.current=!1)}},N=Qv(`div`,e,{ref:[O,t,d.ref,w],state:k,props:[p,M,l,D]}),P=q.useMemo(()=>({selected:x,index:C,textRef:u,selectedByFocus:S}),[x,C,u,S]);return(0,J.jsx)(Yz.Provider,{value:P,children:N})})),Qz=q.memo(q.forwardRef(function(e,t){let{render:n,className:r,style:i,keepMounted:a,selected:o,...s}=e,c=q.useRef(null),{transitionStatus:l,setMounted:u}=PC(o),d=Qv(`span`,e,{ref:[t,c],state:{selected:o,transitionStatus:l},props:[{"aria-hidden":!0,children:`✔️`},s],stateAttributesMapping:tb});return zC({batch:!0,enabled:!o,open:o,ref:c,onComplete(){o||u(!1)}}),d})),$z=q.forwardRef(function(e,t){let{selected:n}=Xz();return e.keepMounted||n?(0,J.jsx)(Qz,{...e,selected:n,ref:t}):null}),eB=q.memo(q.forwardRef(function(e,t){let{index:n,textRef:r,selectedByFocus:i}=Xz(),a=lz(),{render:o,className:s,style:c,...l}=e;return Qv(`div`,e,{ref:[q.useCallback(e=>{e&&(n===0&&(a.context.firstItemTextRef.current=e),i&&(a.context.selectedItemTextRef.current=e))},[a,n,i]),t,r],props:l})})),tB=q.forwardRef(function(e,t){let{render:n,className:r,style:i,direction:a,keepMounted:o,...s}=e,c=a===`up`,l=lz(),{side:u,scrollDownArrowRef:d,scrollUpArrowRef:f}=Nz(),p=c?`scrollUpArrowVisible`:`scrollDownArrowVisible`,m=l.useState(p),h=l.useState(`openMethod`),g=m&&h!==`touch`,_=by(),v=c?f:d,{mounted:y,transitionStatus:b,setMounted:x}=PC(g);Q(()=>(l.context.scrollArrowsMountedCountRef.current+=1,l.set(`hasScrollArrows`,!0),()=>{l.context.scrollArrowsMountedCountRef.current=Math.max(0,l.context.scrollArrowsMountedCountRef.current-1),l.context.scrollArrowsMountedCountRef.current===0&&l.set(`hasScrollArrows`,!1)}),[l]),zC({open:g,ref:v,onComplete(){g||x(!1)}});let S=Qv(`div`,e,{ref:[t,v],state:{direction:a,visible:g,side:u,transitionStatus:b},props:[{"aria-hidden":!0,children:c?`▲`:`▼`,style:{position:`absolute`},onMouseMove(e){if(e.movementX===0&&e.movementY===0||_.isStarted())return;l.set(`activeIndex`,null);function t(){let e=l.state.listElement??l.context.popupRef.current;if(!e)return;l.set(`activeIndex`,null),l.context.handleScrollArrowVisibility(e);let n=DP(e.scrollHeight,e.clientHeight),r=OP(e.scrollTop,n),i=r===(c?0:n),a=l.context.listRef.current;if(r!==e.scrollTop&&(e.scrollTop=r),i)_.clear();else{if(a.length>0){let t=v.current?.offsetHeight||0;e.scrollTop=nB(a,c,r,e.clientHeight,t,n)}_.start(40,t)}}_.start(40,t)},onMouseLeave(){_.clear()}},s],stateAttributesMapping:tb});return y||o?S:null});function nB(e,t,n,r,i,a){if(t){let t=0,r=n+i-1;for(let n=0;n<e.length;n+=1){let i=e[n];if(i&&i.offsetTop>=r){t=n;break}}let o=Math.max(0,t-1),s=e[o];return o<t&&s?OP(s.offsetTop-i,a):0}let o=e.length-1,s=n+r-i+1;for(let t=0;t<e.length;t+=1){let n=e[t];if(n&&n.offsetTop+n.offsetHeight>s){o=Math.max(0,t-1);break}}let c=Math.min(e.length-1,o+1),l=e[c];return c>o&&l?OP(l.offsetTop+l.offsetHeight-r+i,a):a}var rB=q.forwardRef(function(e,t){return(0,J.jsx)(tB,{...e,ref:t,direction:`down`})}),iB=q.forwardRef(function(e,t){return(0,J.jsx)(tB,{...e,ref:t,direction:`up`})}),aB=Sz;function oB({className:e,...t}){return(0,J.jsx)(kz,{"data-slot":`select-value`,className:X(`flex flex-1 text-left`,e),...t})}function sB({className:e,size:t=`default`,children:n,...r}){return(0,J.jsxs)(Dz,{"data-slot":`select-trigger`,"data-size":t,className:X(`flex w-fit items-center justify-between gap-1.5 rounded-md border border-input bg-transparent py-2 pr-2 pl-2.5 text-ui whitespace-nowrap transition-colors select-none disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 data-placeholder:text-muted-foreground data-[size=default]:h-8 data-[size=sm]:h-7 *:data-[slot=select-value]:line-clamp-1 *:data-[slot=select-value]:flex *:data-[slot=select-value]:items-center *:data-[slot=select-value]:gap-1.5 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4`,e),...r,children:[n,(0,J.jsx)(Az,{render:(0,J.jsx)(Bh,{className:`pointer-events-none size-4 text-muted-foreground`})})]})}function cB({className:e,children:t,side:n=`bottom`,sideOffset:r=4,align:i=`center`,alignOffset:a=0,alignItemWithTrigger:o=!0,...s}){return(0,J.jsx)(jz,{children:(0,J.jsx)(Lz,{side:n,sideOffset:r,align:i,alignOffset:a,alignItemWithTrigger:o,className:`isolate z-50`,children:(0,J.jsxs)(Bz,{"data-slot":`select-content`,"data-align-trigger":o,className:X(`relative isolate z-50 max-h-(--available-height) w-(--anchor-width) min-w-36 origin-(--transform-origin) overflow-x-hidden overflow-y-auto rounded-xl bg-popover text-popover-foreground shadow-md ring-1 ring-foreground/10 duration-(--duration-fast) data-[align-trigger=true]:animate-none data-[side=bottom]:slide-in-from-top-2 data-[side=inline-end]:slide-in-from-left-2 data-[side=inline-start]:slide-in-from-right-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95`,e),...s,children:[(0,J.jsx)(uB,{}),(0,J.jsx)(Jz,{children:t}),(0,J.jsx)(dB,{})]})})})}function lB({className:e,children:t,...n}){return(0,J.jsxs)(Zz,{"data-slot":`select-item`,className:X(`relative flex w-full cursor-default items-center gap-1.5 rounded-md py-1 pr-8 pl-1.5 text-ui -outline-offset-2 select-none focus:bg-accent focus:text-accent-foreground not-data-[variant=destructive]:focus:**:text-accent-foreground data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 *:[span]:last:flex *:[span]:last:items-center *:[span]:last:gap-2`,e),...n,children:[(0,J.jsx)(eB,{className:`flex flex-1 shrink-0 gap-2 whitespace-nowrap`,children:t}),(0,J.jsx)($z,{render:(0,J.jsx)(`span`,{className:`pointer-events-none absolute right-2 flex size-4 items-center justify-center`}),children:(0,J.jsx)(Rh,{className:`pointer-events-none`})})]})}function uB({className:e,...t}){return(0,J.jsx)(iB,{"data-slot":`select-scroll-up-button`,className:X(`top-0 z-10 flex w-full cursor-default items-center justify-center bg-popover py-1 [&_svg:not([class*='size-'])]:size-4`,e),...t,children:(0,J.jsx)(Kh,{})})}function dB({className:e,...t}){return(0,J.jsx)(rB,{"data-slot":`select-scroll-down-button`,className:X(`bottom-0 z-10 flex w-full cursor-default items-center justify-center bg-popover py-1 [&_svg:not([class*='size-'])]:size-4`,e),...t,children:(0,J.jsx)(Bh,{})})}var fB={"look-for":{label:`Look for`,icon:o_,className:`border-diff-hunk-fg/25 bg-diff-hunk-bg text-diff-hunk-fg`},"dont-flag":{label:`Don't flag`,icon:fg,className:`border-border bg-muted text-muted-foreground`}},pB=({kind:e,className:t})=>{let{label:n,icon:r,className:i}=fB[e];return(0,J.jsxs)(`span`,{"data-slot":`preference-kind`,"data-kind":e,className:X(`inline-flex h-5 shrink-0 items-center gap-1 rounded-full border px-2 text-caption font-medium whitespace-nowrap`,i,t),children:[(0,J.jsx)(r,{"aria-hidden":`true`,className:`size-3`}),n]})},mB={written:`written`,learned:`learned`,imported:`imported`},hB={kind:`global`},gB=({owner:e,repo:t})=>`${e}/${t}`,_B=({host:e,owner:t,repo:n})=>`${e}/${t}/${n}`,vB=e=>e.kind===`global`?`global`:_B(e.repo),yB=e=>[{key:vB(hB),label:`Everywhere`,scope:hB},...e.map(t=>{let n=e.some(e=>e!==t&&gB(e)===gB(t));return{key:_B(t),label:n?`${gB(t)} on ${_F[t.host]}`:gB(t),scope:{kind:`repo`,repo:t}}})],bB=e=>{let t=(0,q.useRef)(null),n=(0,q.useRef)(!1);return(0,q.useEffect)(()=>{e?n.current=!0:n.current&&(n.current=!1,t.current?.focus())},[e]),t},xB=`Write the rule first.`,SB=e=>`A preference is one sentence of at most 300 characters: this is ${e} too many.`,CB=[`look-for`,`dont-flag`],wB={"look-for":{label:`What an AI review should look for`,example:`Tenant isolation: every query filters by tenant ID`},"dont-flag":{label:`What an AI review should leave out`,example:`Naming`}},TB=({legend:e,initial:t,scopes:n,kindFixed:r=!1,submit:i,submitting:a,note:o=null,focus:s=!1,onSubmit:c,onCancel:l})=>{let u=(0,q.useId)(),[d,f]=(0,q.useState)(t.kind),[p,m]=(0,q.useState)(t.text),[h,g]=(0,q.useState)(vB(t.scope)),[_,v]=(0,q.useState)(!1),[y,b]=(0,q.useState)(o),x=(0,q.useRef)(null);(0,q.useEffect)(()=>{s&&x.current!==null&&(x.current.focus(),x.current.setSelectionRange(x.current.value.length,x.current.value.length))},[]);let S=n.find(e=>e.key===h)??n[0],C=p.trim().length,w=C-300,T=async e=>{if(e.preventDefault(),_||S===void 0)return;if(C===0)return b(xB);if(w>0)return b(SB(w));v(!0),b(null);let t=await c({kind:d,text:p.trim(),scope:S.scope});v(!1),b(t)};return(0,J.jsxs)(`form`,{"aria-label":e,"data-slot":`preference-form`,className:`flex flex-col gap-2.5`,onSubmit:e=>void T(e),noValidate:!0,children:[(0,J.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-4 gap-y-2`,children:[r?(0,J.jsx)(pB,{kind:d}):(0,J.jsxs)(`fieldset`,{className:`flex items-center gap-1`,children:[(0,J.jsx)(`legend`,{className:`sr-only`,children:`Kind`}),CB.map(e=>{let{label:t,icon:n}=fB[e];return(0,J.jsxs)(Bj,{variant:`outline`,size:`sm`,pressed:d===e,onPressedChange:t=>{t&&f(e)},children:[(0,J.jsx)(n,{"aria-hidden":`true`}),t]},e)})]}),(0,J.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,J.jsx)(`span`,{id:`${u}-scope`,className:`shrink-0 text-caption text-muted-foreground`,children:`Applies to`}),n.length>1&&S!==void 0?(0,J.jsxs)(aB,{value:S.key,items:n.map(e=>({value:e.key,label:e.label})),onValueChange:e=>{typeof e==`string`&&g(e)},children:[(0,J.jsx)(sB,{size:`sm`,className:`max-w-64 min-w-0`,"aria-labelledby":`${u}-scope`,children:(0,J.jsx)(oB,{})}),(0,J.jsx)(cB,{alignItemWithTrigger:!1,align:`start`,children:n.map(e=>(0,J.jsx)(lB,{value:e.key,children:e.label},e.key))})]}):(0,J.jsx)(`span`,{className:`truncate`,children:S?.label.toLowerCase()})]})]}),(0,J.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,J.jsx)(`label`,{htmlFor:`${u}-text`,className:`text-caption font-medium`,children:wB[d].label}),(0,J.jsx)($O,{ref:x,id:`${u}-text`,rows:2,className:`min-h-14 bg-card`,placeholder:wB[d].example,value:p,onChange:e=>{m(e.target.value.replace(/\s*\n\s*/g,` `)),b(null)},onKeyDown:e=>{e.key!==`Enter`||e.shiftKey||e.nativeEvent.isComposing||(e.preventDefault(),e.currentTarget.form?.requestSubmit())},"aria-invalid":y!==null||w>0,"aria-describedby":`${u}-count ${u}-problem`}),(0,J.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-x-3 text-caption`,children:[(0,J.jsx)(`span`,{id:`${u}-problem`,role:`status`,className:`min-w-0 flex-1 text-destructive`,children:y!==null&&(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(v_,{"aria-hidden":`true`,className:`mr-1 inline size-3.5 align-[-2px]`}),y]})}),(0,J.jsxs)(`span`,{id:`${u}-count`,"data-slot":`character-count`,className:X(`tabular shrink-0`,w>0?`text-destructive`:`text-muted-foreground`),children:[C,`/`,300,(0,J.jsx)(`span`,{className:`sr-only`,children:` characters`}),w>0&&`, ${w} too many`]})]})]}),(0,J.jsxs)(`div`,{className:`flex flex-wrap justify-end gap-2`,children:[l!==void 0&&(0,J.jsx)($,{type:`button`,variant:`ghost`,size:`sm`,onClick:l,children:`Cancel`}),(0,J.jsx)($,{type:`submit`,size:`sm`,disabled:_,focusableWhenDisabled:!0,"aria-busy":_,children:_?a:i})]})]})},EB=({title:e,onClose:t,children:n,className:r,returnFocus:i=()=>!0})=>{let a=(0,q.useRef)(null);return(0,J.jsx)(BA,{open:!0,onOpenChange:e=>{e||t()},children:(0,J.jsxs)(UA,{ref:a,className:X(`max-h-[calc(100dvh-2rem)] overflow-y-auto sm:max-w-lg`,r),initialFocus:()=>a.current?.querySelector(`[data-autofocus]`)??!0,finalFocus:()=>i(),children:[(0,J.jsx)(WA,{className:`shrink-0 pr-8`,children:(0,J.jsx)(GA,{children:e})}),n]})})},DB=({preference:e,onDelete:t,onClose:n})=>{let[r,i]=(0,q.useState)(!1),[a,o]=(0,q.useState)(null);return(0,J.jsxs)(EB,{title:`Delete preference`,onClose:n,children:[(0,J.jsxs)(`p`,{className:`flex flex-wrap items-center gap-2`,children:[(0,J.jsx)(pB,{kind:e.kind}),(0,J.jsx)(`span`,{className:`min-w-0 break-words`,children:e.text})]}),(0,J.jsx)(`p`,{className:`text-ui text-muted-foreground`,children:`AI reviews stop using it. A review already made keeps what it says of it.`}),a!==null&&(0,J.jsxs)(`p`,{className:`rounded-lg border border-review-changes/25 bg-review-changes-bg px-3 py-2 text-review-changes`,role:`alert`,children:[`Couldn't delete it. `,a]}),(0,J.jsxs)(`div`,{className:`flex justify-end gap-2`,children:[(0,J.jsx)($,{variant:`outline`,"data-autofocus":!0,onClick:n,children:`Cancel`}),(0,J.jsx)($,{variant:`destructive`,disabled:r,onClick:async()=>{i(!0);let e=await t();i(!1),o(e),e===null&&n()},children:r?`Deleting…`:`Delete`})]})]})},OB=({preference:e,scopes:t,actions:n})=>{let[r,i]=(0,q.useState)(`shown`),[a,o]=(0,q.useState)(null),s=bB(r===`editing`),{id:c,kind:l,text:u,source:d,enabled:f}=e;return r===`editing`?(0,J.jsx)(`li`,{className:`bg-surface-subtle px-4 py-3`,children:(0,J.jsx)(TB,{legend:`Edit: ${u}`,initial:e,scopes:t,submit:`Save`,submitting:`Saving…`,onCancel:()=>i(`shown`),onSubmit:async e=>{let t=await n.onEdit(c,e);return t===null&&i(`shown`),t}})}):(0,J.jsxs)(`li`,{"data-slot":`preference`,"data-enabled":f,className:`flex min-h-11 flex-wrap items-center gap-x-3 gap-y-1 px-4 py-2`,children:[(0,J.jsx)(pB,{kind:l}),(0,J.jsx)(`span`,{className:X(`min-w-0 flex-1 basis-56 break-words`,!f&&`text-muted-foreground`),children:u}),(0,J.jsxs)(`span`,{className:`flex shrink-0 items-center gap-3`,children:[(0,J.jsxs)(`span`,{className:`text-caption text-muted-foreground`,children:[mB[d],!f&&` · off`]}),(0,J.jsx)(ZN,{checked:f,"aria-label":`Use in AI reviews: ${u}`,onCheckedChange:async e=>{o(null),o(await n.onSwitch(c,e))}}),(0,J.jsxs)(UR,{children:[(0,J.jsx)(WR,{render:(0,J.jsx)($,{ref:s,variant:`ghost`,size:`icon-xs`,"aria-label":`More for: ${u}`}),children:(0,J.jsx)(Qh,{"aria-hidden":`true`})}),(0,J.jsxs)(GR,{align:`end`,className:`w-36`,children:[(0,J.jsxs)(JR,{onClick:()=>i(`editing`),children:[(0,J.jsx)(Qg,{"aria-hidden":`true`}),`Edit`]}),(0,J.jsxs)(JR,{variant:`destructive`,onClick:()=>i(`deleting`),children:[(0,J.jsx)(g_,{"aria-hidden":`true`}),`Delete…`]})]})]})]}),a!==null&&(0,J.jsxs)(`p`,{role:`alert`,className:`basis-full text-caption text-destructive`,children:[(0,J.jsx)(v_,{"aria-hidden":`true`,className:`mr-1 inline size-3.5 align-[-2px]`}),a]}),r===`deleting`&&(0,J.jsx)(DB,{preference:e,onDelete:()=>n.onDelete(c),onClose:()=>i(`shown`)})]})},kB=({preferences:e,scopes:t,actions:n,label:r})=>(0,J.jsx)(`ul`,{"aria-label":r,className:`divide-y`,children:e.map(e=>(0,J.jsx)(OB,{preference:e,scopes:t,actions:n},e.id))}),AB=({option:e,title:t,word:n,preferences:r,scopes:i,actions:a,addable:o=!0,adding:s,onAdding:c,onAdd:l,empty:u,children:d})=>{let f=(0,q.useId)(),p=(0,q.useRef)(null),m=()=>{c(!1),p.current?.focus()};return(0,J.jsxs)(`section`,{"aria-labelledby":f,"data-slot":`preference-scope`,className:`flex min-w-0 flex-col overflow-hidden rounded-xl border bg-card`,children:[(0,J.jsxs)(`div`,{className:`flex min-h-11 flex-wrap items-center gap-x-2 gap-y-1 border-b px-4 py-2`,children:[(0,J.jsx)(`h2`,{id:f,className:`flex min-w-0 items-center gap-2 text-heading font-semibold`,children:t}),(0,J.jsxs)(`span`,{className:`rounded-full bg-muted px-2 text-caption font-medium text-muted-foreground tabular-nums`,children:[(0,J.jsx)(`span`,{"aria-hidden":`true`,children:r.length}),(0,J.jsxs)(`span`,{className:`sr-only`,children:[r.length,` `,r.length===1?`preference`:`preferences`]})]}),(0,J.jsx)(`span`,{className:`min-w-0 text-caption text-muted-foreground max-sm:order-last max-sm:basis-full`,children:n}),o&&(0,J.jsxs)($,{ref:p,variant:`outline`,size:`sm`,className:`ml-auto`,"aria-expanded":s,"aria-label":e.scope.kind===`repo`?`Add preference for ${e.label}`:void 0,onClick:()=>c(!s),children:[(0,J.jsx)(e_,{"aria-hidden":`true`}),`Add preference`]})]}),s&&(0,J.jsx)(`div`,{className:`border-b bg-surface-subtle px-4 py-3`,children:(0,J.jsx)(TB,{legend:`Add a preference`,initial:{kind:`look-for`,text:``,scope:e.scope},scopes:i,submit:`Add preference`,submitting:`Adding…`,focus:!0,onCancel:m,onSubmit:async e=>{let t=await l(e);return t===null&&m(),t}})}),r.length===0?u:(0,J.jsx)(kB,{preferences:r,scopes:i,actions:a,label:`Preferences for ${e.label.toLowerCase()}`}),d]})},jB={learned:`from what you did in reviews`,imported:`from your past reviews`},MB=({proposal:e,scopes:t,actions:n})=>{let{id:r,kind:i,text:a,scope:o,evidence:s}=e,c=a.length-300,[l,u]=(0,q.useState)(null),[d,f]=(0,q.useState)(null),[p,m]=(0,q.useState)(null),h=bB(l!==null),g=t.find(e=>e.key===vB(o))?.label??`Everywhere`,_=async e=>{if(d!==null)return;if(e===`accept`&&c>0)return u({note:SB(c)});f(e),m(null);let t=await(e===`accept`?n.onAccept(r,null):n.onReject(r));f(null),m(t)};return l===null?(0,J.jsxs)(`li`,{"data-slot":`proposal`,className:`flex flex-col gap-1.5 px-4 py-3`,children:[(0,J.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-3 gap-y-1`,children:[(0,J.jsx)(pB,{kind:i}),(0,J.jsx)(`span`,{className:`min-w-0 flex-1 basis-56 font-medium break-words`,children:a}),(0,J.jsxs)(`span`,{className:`shrink-0 text-caption text-muted-foreground`,children:[g,`, `,jB[e.source]]})]}),s.length>0&&(0,J.jsxs)(`div`,{className:`flex gap-1.5 text-caption text-muted-foreground`,children:[(0,J.jsx)(`span`,{className:`shrink-0`,children:`Based on:`}),(0,J.jsx)(`ul`,{className:`flex min-w-0 flex-col`,children:[...new Set(s)].map(e=>(0,J.jsx)(`li`,{className:`break-words`,children:e},e))})]}),(0,J.jsxs)(`div`,{className:`flex flex-wrap items-center justify-end gap-2`,children:[p!==null&&(0,J.jsxs)(`span`,{role:`alert`,className:`min-w-0 flex-1 text-caption text-destructive`,children:[(0,J.jsx)(v_,{"aria-hidden":`true`,className:`mr-1 inline size-3.5 align-[-2px]`}),p]}),(0,J.jsx)($,{variant:`ghost`,size:`sm`,"aria-label":`Reject: ${a}`,"aria-busy":d===`reject`,onClick:()=>void _(`reject`),children:d===`reject`?`Rejecting…`:`Reject`}),(0,J.jsx)($,{ref:h,variant:`outline`,size:`sm`,"aria-label":`Edit: ${a}`,onClick:()=>u({note:null}),children:`Edit`}),(0,J.jsx)($,{size:`sm`,"aria-label":`Accept: ${a}`,"aria-busy":d===`accept`,onClick:()=>void _(`accept`),children:d===`accept`?`Accepting…`:`Accept`})]})]}):(0,J.jsx)(`li`,{className:`bg-surface-subtle px-4 py-3`,children:(0,J.jsx)(TB,{legend:`Edit the suggestion: ${a}`,initial:e,scopes:t,submit:`Accept`,submitting:`Accepting…`,note:l.note,onCancel:()=>u(null),onSubmit:e=>n.onAccept(r,e)})})},NB=({proposals:e,scopes:t,actions:n,fallbackFocus:r})=>{let i=(0,q.useId)(),a=(0,q.useRef)(null),o=()=>(e.length>1?a.current:r?.current)?.focus(),s=e=>e.then(e=>(e===null&&o(),e)),c={onAccept:(e,t)=>s(n.onAccept(e,t)),onReject:e=>s(n.onReject(e))};return e.length===0?null:(0,J.jsxs)(`section`,{ref:a,tabIndex:-1,"aria-labelledby":i,"data-slot":`suggested`,className:`flex min-w-0 flex-col overflow-hidden rounded-xl border bg-card`,children:[(0,J.jsxs)(`div`,{className:`flex min-h-11 flex-wrap items-center gap-x-2 gap-y-1 border-b px-4 py-2`,children:[(0,J.jsx)(`h2`,{id:i,className:`text-heading font-semibold`,children:`Suggested`}),(0,J.jsxs)(`span`,{className:`rounded-full bg-muted px-2 text-caption font-medium text-muted-foreground tabular-nums`,children:[(0,J.jsx)(`span`,{"aria-hidden":`true`,children:e.length}),(0,J.jsxs)(`span`,{className:`sr-only`,children:[e.length,` `,e.length===1?`suggestion`:`suggestions`]})]}),(0,J.jsx)(`span`,{className:`text-caption text-muted-foreground`,children:`None is used until you accept it. A rejected one isn't suggested again.`})]}),(0,J.jsx)(`ul`,{className:`divide-y`,children:e.map(e=>(0,J.jsx)(MB,{proposal:e,scopes:t,actions:c},e.id))})]})},PB=`Nothing new to suggest from: megareviewer records the points you dismiss and raise and the comments you post.`,FB=()=>(0,J.jsxs)(`div`,{role:`status`,"aria-busy":`true`,"aria-label":`Loading your preferences`,className:`flex flex-col gap-4`,children:[(0,J.jsx)(zN,{className:`h-7 w-56 motion-reduce:animate-none`}),[3,2].map(e=>(0,J.jsxs)(`div`,{className:`flex flex-col overflow-hidden rounded-xl border bg-card`,children:[(0,J.jsx)(`div`,{className:`flex h-11 items-center border-b px-4`,children:(0,J.jsx)(zN,{className:`h-4 w-32 motion-reduce:animate-none`})}),(0,J.jsx)(`ul`,{"aria-hidden":`true`,className:`flex flex-col gap-3 px-4 py-3`,children:Array.from({length:e},(e,t)=>(0,J.jsxs)(`li`,{className:`flex items-center gap-3`,children:[(0,J.jsx)(zN,{className:`h-5 w-20 rounded-full motion-reduce:animate-none`}),(0,J.jsx)(zN,{className:`h-4 flex-1 motion-reduce:animate-none`}),(0,J.jsx)(zN,{className:`h-4 w-12 motion-reduce:animate-none`})]},t))})]},e))]}),IB=()=>(0,J.jsxs)(`p`,{className:`text-muted-foreground`,children:[`A preference is one rule for AI reviews: something to look for, or something not to flag. For example `,(0,J.jsx)(pB,{kind:`look-for`,className:`align-middle`}),` “Tenant isolation: every query filters by tenant ID”, or `,(0,J.jsx)(pB,{kind:`dont-flag`,className:`align-middle`}),` “Naming”.`]}),LB=({now:e=Date.now})=>{let{client:t}=yp(),n=tL(PF().status?.model??null),r=Tp(),[i,a]=(0,q.useState)(null),[o,s]=(0,q.useState)(null);r.preferences!==i&&(a(r.preferences),s(r.preferences));let[c,l]=(0,q.useState)(null),[u,d]=(0,q.useState)(``),f=(0,q.useRef)(null),p=e=>s(t=>t===null?t:e(t)),m=(e,t,n)=>e.ok?(p(n=>t(n,e.value)),d(n),null):dL(e.error),h=async e=>m(await t.addPreference(e),nL,`Added: ${e.text}`),g={onSwitch:async(e,n)=>m(await t.updatePreference(e,{enabled:n}),nL,n?`Switched on`:`Switched off`),onEdit:async(e,n)=>m(await t.updatePreference(e,n),nL,`Saved: ${n.text}`),onDelete:async e=>m(await t.deletePreference(e),t=>rL(t,e),`Deleted`)},_={onAccept:async(e,n)=>m(await t.decideProposal(e,{decision:`accept`,...n}),(t,{preference:n})=>{let r=aL(t,e);return n===null?r:nL(r,n)},`Accepted`),onReject:async e=>m(await t.decideProposal(e,{decision:`reject`}),t=>aL(t,e),`Rejected`)},v=async e=>{let n=await t.suggestPreferences(e===void 0?{}:{optionId:e});if(!n.ok)return{ok:!1,message:dL(n.error)};let{proposals:r,signals:i}=n.value;return p(e=>({...iL(e,r),signalsSinceSuggestion:0})),{ok:!0,said:r.length===0?`Nothing new to suggest from ${fL(i,`action`)}.`:`${fL(r.length,`suggestion`)} from ${fL(i,`action`)}, above.`}},y=async(e,n)=>{let r=await t.importPreferences({repo:e,...n===void 0?{}:{optionId:n}});if(!r.ok)return{ok:!1,message:dL(r.error)};let{proposals:i,comments:a,pullRequests:o}=r.value;if(p(e=>iL(e,i)),a===0)return{ok:!0,said:o===0?`Found no pull request of this repository that you reviewed.`:`Found no comment of yours on its last ${fL(o,`pull request`)}.`};let s=`Read ${fL(a,`comment`)} from ${fL(o,`pull request`)}`;return{ok:!0,said:i.length===0?`${s}: nothing new to suggest.`:`${s}: ${fL(i.length,`suggestion`)}, above.`}},b=async(e,n,r)=>m(await t.setGuidelineSwitch({repo:e,path:n,enabled:r}),t=>oL(t,e,n,r),r?`${n} switched on`:`${n} switched off`);return(0,J.jsxs)(`div`,{"data-slot":`preferences-page`,className:`mx-auto flex max-w-[960px] flex-col gap-4`,children:[(0,J.jsxs)(`header`,{className:`flex flex-col gap-1`,children:[(0,J.jsx)(`h1`,{ref:f,tabIndex:-1,className:`text-title font-semibold tracking-[-0.01em]`,children:`Preferences`}),(0,J.jsx)(`p`,{className:`text-muted-foreground`,children:`What you want an AI review to look for and to leave out. Used by Request AI review.`})]}),(()=>{if(o===null)return r.loading||r.error===null?(0,J.jsx)(FB,{}):(0,J.jsxs)(`div`,{className:X(LN,`flex flex-wrap items-center justify-between gap-2`),role:`alert`,children:[(0,J.jsxs)(`p`,{children:[`Couldn't read your preferences. `,Ap(r.error)]}),(0,J.jsx)($,{variant:`outline`,size:`sm`,onClick:r.refresh,children:`Try again`})]});let t=cL(o),i=yB(t.map(e=>e.repo)),[a]=i;if(a===void 0)return null;let s=o.preferences.length===0,u=o.signalsSinceSuggestion;return(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(NB,{proposals:o.proposals,scopes:i,actions:_,fallbackFocus:f}),(0,J.jsx)(az,{label:`Suggest from my reviews`,running:`Reading what you did in reviews…`,icon:(0,J.jsx)(f_,{"aria-hidden":`true`}),choice:n,blocked:u===0?PB:null,idle:u===0?PB:`${fL(u,`action`)} recorded since the last suggestions`,run:v,now:e}),(0,J.jsx)(AB,{option:a,title:`Everywhere`,word:`Used on every pull request`,preferences:sL(o,hB),scopes:i,actions:g,addable:!s,adding:!s&&c===a.key,onAdding:e=>l(e?a.key:null),onAdd:h,empty:s?(0,J.jsxs)(`div`,{"data-slot":`no-preferences`,className:`flex flex-col gap-3 px-4 py-4`,children:[(0,J.jsx)(IB,{}),(0,J.jsx)(TB,{legend:`Add a preference`,initial:{kind:`look-for`,text:``,scope:hB},scopes:i,submit:`Add preference`,submitting:`Adding…`,onSubmit:h})]}):(0,J.jsx)(`p`,{className:`px-4 py-3 text-caption text-muted-foreground`,children:`No preference for every repository yet.`})}),t.map(({repo:t,guidelineFiles:r,guidelineNote:s})=>{let u=i.find(e=>e.key===_B(t))??a;return(0,J.jsxs)(AB,{option:u,title:(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(`span`,{className:`min-w-0 truncate`,children:gB(t)}),(0,J.jsx)(eO,{variant:`outline`,className:`font-normal text-muted-foreground`,children:_F[t.host]})]}),word:`Used on its pull requests, after the ones for everywhere`,preferences:sL(o,u.scope),scopes:i,actions:g,adding:c===u.key,onAdding:e=>l(e?u.key:null),onAdd:h,empty:(0,J.jsx)(`p`,{className:`px-4 py-3 text-caption text-muted-foreground`,children:`No preference for this repository yet.`}),children:[(0,J.jsx)(hL,{files:r,note:s,repository:gB(t),onSwitch:(e,n)=>b(t,e,n)}),(0,J.jsx)(`div`,{className:`border-t px-4 py-3`,children:(0,J.jsx)(az,{label:`Import from my past reviews`,running:`Reading your comments on ${gB(t)}…`,icon:(0,J.jsx)(n_,{"aria-hidden":`true`}),choice:n,what:`Reads your own comments on its recent pull requests on ${_F[t.host]}, then runs`,run:e=>y(t,e),now:e})})]},u.key)})]})})(),(0,J.jsx)(`span`,{className:`sr-only`,"aria-live":`polite`,children:u})]})},RB=[`import`,`call`,`type`,`request`],zB=e=>e.slice(e.lastIndexOf(`/`)+1),BB=(e,t)=>e<t?-1:+(e>t),VB=e=>/\.(md|mdx|rst|adoc)$/i.test(e),HB=/(^|[/_.-])(fakes?|mocks?|stubs?|fixtures?|testing|test[_-]?(utils?|helpers?|support))([/_.-]|$)/i,UB=e=>XP(e).split(`/`).slice(0,3).join(`/`),WB=e=>`group:${e}`,GB=e=>{let t=new Map(e.map(e=>[e,e.split(`/`)])),n=(e,n)=>(t.get(e)??[]).slice(-n).join(`/`),r=new Map;for(let i of e){let a=t.get(i)?.length??1,o=1;for(;o<a&&e.some(e=>e!==i&&n(e,o)===n(i,o));)o+=1;r.set(i,n(i,o))}return r},KB=`\0routes`,qB=e=>`${e.method} ${e.path}`,JB=e=>{let[t]=e;return e.length===1&&t!==void 0?`${t.method} ${t.path}`:`${e.length} routes`},YB=(e,t)=>{let n=al(e.parts),r=new Map(e.files.flatMap(e=>ol(e,n).map(({id:t,hunk:n})=>[t,{file:e,hunk:n}]))),i=new Map,a=(e,t)=>{let n=i.get(e)??[];n.includes(t)||i.set(e,[...n,t])},o=new Map;for(let e of t){let t=new Map;for(let n of e.entries){let e=r.get(n)?.file.path;e!==void 0&&t.set(e,[...t.get(e)??[],n])}for(let[n,i]of t){let t=i.flatMap(e=>{let t=r.get(e),n=t===void 0?null:Ku(t.file,t.hunk,[]);return n?.kind===`route`?n.routes:[]});if(t.length>0&&(a(n,KB),o.set(n,[...o.get(n)??[],...t])),!(new Set(t.map(qB)).size===i.length&&t.length>0))for(let t of(e.codeTitle??e.title).split(`; `)){t.startsWith(`Page: `)&&a(n,t);let e=/^Command: (\S+) in (.+)$/.exec(t);e!==null&&e[2]===zB(n)&&a(n,`Command: ${e[1]}`)}}}return new Map([...i].map(([e,t])=>{let n=[...new Map((o.get(e)??[]).map(e=>[qB(e),e])).values()];return[e,t.map(e=>e===KB?JB(n):e)]}))},XB=(e,t)=>{let n=new Map,r=new Map,i=[],a=new Set,o=[],s=0,c=e=>{n.set(e,s),r.set(e,s),s+=1,i.push(e),a.add(e);for(let i of t(e))n.has(i)?a.has(i)&&r.set(e,Math.min(r.get(e)??0,n.get(i)??0)):(c(i),r.set(e,Math.min(r.get(e)??0,r.get(i)??0)));if(r.get(e)!==n.get(e))return;let l=[];for(let t=i.pop();t!==void 0&&(a.delete(t),l.push(t),t!==e);t=i.pop());l.length>1&&o.push(l)};for(let t of e)n.has(t)||c(t);return o},ZB=()=>({uses:new Set,symbols:new Set,pairs:0}),QB=e=>{let t=new Set(e.proofs.flatMap(e=>e.hunkId??[])),n=e.files.filter(e=>e.hunks.some(e=>!t.has(e.id))),r=new Map(n.flatMap(e=>e.hunks.map(t=>[t.id,e.path]))),i=new Set(n.map(e=>e.path)),a=new Map,o=(e,t,n,r)=>{if(e===t||!i.has(e)||!i.has(t))return;let o=a.get(e)??new Map,s=o.get(t)??{...ZB(),pairs:1};s.uses.add(n),r!==void 0&&s.symbols.add(r),o.set(t,s),a.set(e,o)};for(let{from:t,to:n}of e.fileLinks)o(t,n,`import`);for(let t of e.callGraph){let e=r.get(rl(t.fromPartId)),n=r.get(rl(t.toPartId));e!==void 0&&n!==void 0&&o(e,n,t.use,t.symbol)}return{mechanical:t,files:n,pathOfHunk:r,links:a}},$B=(e,t,n=new Set)=>{let{mechanical:r,files:i,pathOfHunk:a,links:o}=QB(e),s=[...new Set(t.flatMap(e=>e.partIds))],c=new Map(s.map((e,t)=>[e,t])),l=e=>c.get(e)??s.length,u=new Set(e.generated),d=new Map(i.map(t=>{let n=t.hunks.flatMap(e=>e.lines),i=ol(t,al(e.parts)).map(e=>e.id).filter(e=>!r.has(rl(e))).sort((e,t)=>l(e)-l(t)),a=t.hunks.every(e=>r.has(e.id))?`mechanical`:`logic`;return[t.path,{added:n.filter(e=>e.kind===`add`).length,deleted:n.filter(e=>e.kind===`del`).length,partIds:i,risk:a,rank:i.reduce((e,t)=>Math.min(e,l(t)),1/0)}]})),f=e=>d.get(e)?.rank??1/0,p=(e,t)=>f(e)-f(t)||BB(e,t),m=i.map(e=>e.path).sort(p),h=e=>[...o.get(e)?.keys()??[]],g=e=>m.filter(t=>o.get(t)?.has(e)===!0),_=new Set(m.filter(ul));for(let e=!0;e;){e=!1;for(let t of m){let n=g(t);!_.has(t)&&HB.test(t)&&n.length>0&&n.every(e=>_.has(e))&&(_.add(t),e=!0)}}let v=m.filter(e=>!_.has(e)&&VB(e)),y=m.filter(e=>!_.has(e)&&!VB(e)),b=new Set(y),x=new Map;for(let e of[..._].sort(p)){let t=[],n=new Set([e]),r=e=>{for(let i of h(e))n.has(i)||(n.add(i),b.has(i)?t.push(i):r(i))};r(e),x.set(e,t)}let S=new Map;for(let[e,t]of x)for(let n of t)S.set(n,[...S.get(n)??[],e]);let C=[..._].filter(e=>(x.get(e)??[]).length===0),w=new Map;for(let e of[...y,...v,...C].sort(YP)){let t=WB(XP(e)),r=n.has(t)?e:t;w.set(r,[...w.get(r)??[],e])}let T=new Map;for(let[e,t]of w)for(let n of t)T.set(n,e);let E=e=>Math.min(...(w.get(e)??[e]).map(f)),D=(e,t)=>E(e)-E(t)||BB(e,t),O=[...w.keys()].sort(D),k=new Map;for(let[e,t]of o)for(let[n,r]of t){let t=T.get(e),i=T.get(n);if(t===void 0||i===void 0||t===i)continue;let a=k.get(t)??new Map,o=a.get(i)??ZB();for(let e of r.uses)o.uses.add(e);for(let e of r.symbols)o.symbols.add(e);o.pairs+=r.pairs,a.set(i,o),k.set(t,a)}let A=new Map;for(let{partId:t,symbol:n,uses:r}of e.unchangedCallers??[]){let e=a.get(rl(t)),i=e===void 0?void 0:T.get(e);if(i!==void 0)for(let e of r){let r=A.get(e.path)??{targets:new Map,uses:0,partIds:new Set},a=r.targets.get(i)??ZB();a.uses.add(e.use),a.symbols.add(n),r.targets.set(i,a),r.uses+=1,r.partIds.add(t),A.set(e.path,r)}}let j=[...A.keys()].sort((e,t)=>Number(ul(e))-Number(ul(t))||BB(e,t)),M=new Map;for(let e of j){let t=j.length>10?`outside:${UB(e)}/`:`outside:${e}`;M.set(t,[...M.get(t)??[],e])}for(let[e,t]of[...M]){let[n]=t;e.endsWith(`/`)&&t.length===1&&n!==void 0&&(M.delete(e),M.set(`outside:${n}`,[n]))}let N=new Map;for(let[e,t]of M){let n=new Map;for(let e of t)for(let[t,r]of A.get(e)?.targets??[]){let e=n.get(t)??ZB();for(let t of r.uses)e.uses.add(t);for(let t of r.symbols)e.symbols.add(t);n.set(t,e)}N.set(e,n)}let P=new Set([...[...k].flatMap(([e,t])=>t.size>0?[e,...t.keys()]:[]),...[...N.values()].flatMap(e=>[...e.keys()])]),F=O.filter(e=>P.has(e)),I=new Set,L=(e,t)=>`${e}\u0000${t}`,R=e=>[...k.get(e)?.keys()??[]].filter(t=>!I.has(L(e,t))),ee=(e,t)=>k.get(e)?.get(t)?.pairs??0;for(let e=XB(F,R);e.length>0;e=XB(F,R))for(let t of e){let[e,n,r]=t;if(e!==void 0&&n!==void 0&&r===void 0&&ee(e,n)!==ee(n,e)){I.add(ee(e,n)<ee(n,e)?L(e,n):L(n,e));continue}let[i]=[...t].sort(D);for(let e of t)i!==void 0&&R(e).includes(i)&&I.add(L(e,i))}let z=new Map(F.map(e=>[e,[]]));for(let e of F)for(let t of R(e))z.get(t)?.push(e);let te=new Map,B=e=>{let t=te.get(e);if(t!==void 0)return t;let n=Math.max(-1,...(z.get(e)??[]).map(B))+1;return te.set(e,n),n},ne=[],V=(e,t)=>{for(;ne.length<=t;)ne.push([]);ne[t]?.push(e)};for(let e of F)V(e,B(e));for(let[e,t]of N){let n=[...t.keys()];z.set(e,n),te.set(e,Math.max(...n.map(B))+1),V(e,te.get(e)??0)}let H=()=>new Map(ne.flatMap(e=>e.map((t,n)=>[t,n-(e.length-1)/2]))),re=e=>R(e),ie=(e,t)=>{for(let n of e){let e=H(),r=n=>{let r=t(n).map(t=>e.get(t)??0);return r.length===0?e.get(n)??0:r.reduce((e,t)=>e+t,0)/r.length},i=new Map(n.map(e=>[e,r(e)]));n.sort((e,t)=>(i.get(e)??0)-(i.get(t)??0)||D(e,t))}},ae=e=>z.get(e)??[];ie(ne.slice(1),ae),ie(ne.slice(0,-1).reverse(),re),ie(ne.slice(1),ae);let oe=GB(m),se=YB(e,t),U=new Map;for(let e of t)if(e.kind===`flow`)for(let t of new Set(e.partIds.flatMap(e=>a.get(rl(e))??[])))U.set(t,[...U.get(t)??[],e.title]);let ce=e=>[...new Set(e)],le=GB(j),ue=(e,t)=>{let n=M.get(e)??[],[r]=n;return{key:e,kind:`outside`,paths:n,label:e.endsWith(`/`)||r===void 0?e.slice(8):le.get(r)??r,added:0,deleted:0,risk:`logic`,generated:!1,entries:[],flows:[],partIds:[...new Set(n.flatMap(e=>[...A.get(e)?.partIds??[]]))],uses:n.reduce((e,t)=>e+(A.get(t)?.uses??0),0),badges:[],row:t}},de=(e,t)=>{if(M.has(e))return ue(e,t);let n=w.get(e)??[e],r=n.flatMap(e=>d.get(e)??[]),i=e.startsWith(`group:`);return{key:e,kind:i?`group`:`file`,paths:n,label:i?`${e.slice(6)||`.`}/`:oe.get(e)??e,added:r.reduce((e,t)=>e+t.added,0),deleted:r.reduce((e,t)=>e+t.deleted,0),risk:r.every(e=>e.risk===`mechanical`)?`mechanical`:`logic`,generated:n.every(e=>u.has(e)),entries:ce(n.flatMap(e=>se.get(e)??[])),flows:ce(n.flatMap(e=>U.get(e)??[])),partIds:r.flatMap(e=>e.partIds).sort((e,t)=>l(e)-l(t)),badges:ce(n.flatMap(e=>S.get(e)??[])).sort(p),uses:0,row:t}},fe=ne.map((e,t)=>e.map(e=>de(e,t))),pe=O.filter(e=>!P.has(e)).map(e=>de(e,-1)),me=new Map;for(let e of[...fe.flat(),...pe])if(e.kind!==`outside`)for(let t of e.paths)me.set(t,e.key);for(let[e,t]of x){let[n]=t,r=n===void 0?void 0:T.get(n);r!==void 0&&me.set(e,r)}return{rows:fe,edges:[...[...k].map(e=>[e,!1]),...[...N].map(e=>[e,!0])].flatMap(([[e,t],n])=>[...t].map(([t,r])=>({from:e,to:t,uses:RB.filter(e=>r.uses.has(e)),symbols:[...r.symbols].sort(BB),back:I.has(L(e,t)),outside:n}))),strip:pe,placeOf:me}},eV=e=>e.kind!==`outside`&&!e.generated&&e.risk!==`mechanical`,tV=e=>e.kind===`group`?e.key.slice(6)||`.`:e.key,nV=e=>{let t=e.rows.map(e=>e.filter(eV)).filter(e=>e.length>0),n=e.strip.filter(eV),r=t.length>0,i=r?t:[n],a=i.flat();if(a.length===0)return null;let o=GB(a.map(tV)),s=8,c=i.map(e=>e.flatMap(e=>s===0?[]:(--s,[{label:o.get(tV(e))??tV(e),entries:e.entries}]))).filter(e=>e.length>0);return{rows:c,linked:r,more:a.length-c.flat().length+(r?n.length:0)}},rV=(e,t)=>{let n=e.flatMap(e=>{let n=t(e.partId);if(n===void 0||ul(n))return[];let r=e.uses.filter(e=>!ul(e.path)).length,i=e.uses.length>r?0:e.more;return r+i===0?[]:[{symbol:e.symbol,uses:r+i}]});return n.length===0?null:{symbols:[...new Set(n.map(e=>e.symbol))],uses:n.reduce((e,t)=>e+t.uses,0)}},iV=e=>e.split(/`([^`\n]+)`/).map((e,t)=>({text:e,code:t%2==1})).filter(e=>e.text!==``),aV=e=>{let[t,n]=(0,q.useState)(()=>Date.now());return(0,q.useEffect)(()=>{if(e===null)return;n(Date.now());let t=setInterval(()=>n(Date.now()),1e3);return()=>clearInterval(t)},[e]),e===null?0:Math.max(0,Math.round((t-e)/1e3))},oV=e=>`${Math.floor(e/60)}:${String(e%60).padStart(2,`0`)}`,sV={finding:[`finding`,`findings`],risk:[`risk`,`risks`],decision:[`decision`,`decisions`]},cV=({kind:e,count:t,words:n,at:r,pressed:i,onPressed:a,label:o})=>{let[s,c]=n,l=e===`thread`?Kg:sD[e];return(0,J.jsxs)(`button`,{type:`button`,"data-slot":`point-chip`,"data-kind":e,"data-land":`rise`,"aria-pressed":i,"aria-label":o,style:vh({"--landing-i":r}),onClick:()=>a(!i),className:X(`flex min-h-6 shrink-0 items-center gap-1.5 rounded-full border px-2 text-caption font-medium aria-pressed:border-current aria-pressed:ring-1 aria-pressed:ring-current`,e===`thread`?`border-border bg-background text-foreground`:oD[e].className),children:[(0,J.jsx)(l,{"aria-hidden":`true`,className:`size-3.5`}),(0,J.jsxs)(`span`,{children:[(0,J.jsx)(`span`,{"data-slot":`count-up`,"aria-hidden":`true`,className:`tabular`,style:vh({"--count":t})}),(0,J.jsx)(`span`,{className:`sr-only`,children:t}),` `,(0,J.jsx)(`span`,{className:`max-xl:sr-only`,children:t===1?s:c})]})]})},lV=({choice:e,starting:t,failed:n,onRun:r})=>{let i=(0,q.useId)(),{chosen:a,locked:o}=e,s=o??(a===null?null:`Runs ${a.modelName} through ${a.via}`),c=(0,J.jsx)($,{variant:n?`outline`:`default`,size:`sm`,"data-slot":`request-review`,disabled:t||o!==null||a===null,focusableWhenDisabled:!0,"aria-describedby":s===null?void 0:i,onClick:r,className:`rounded-r-none`}),l=(0,J.jsxs)(J.Fragment,{children:[o===null?(0,J.jsx)(f_,{"aria-hidden":`true`,className:X(n&&`text-primary`)}):(0,J.jsx)(Wg,{"aria-hidden":`true`}),t?`Starting…`:n?`Try again`:`Request AI review`]});return(0,J.jsxs)(`span`,{className:`flex shrink-0 items-center`,children:[(0,J.jsxs)(uI,{disabled:s===null,children:[(0,J.jsx)(dI,{render:c,children:l}),(0,J.jsxs)(fI,{side:`bottom`,align:`start`,children:[o!==null&&(0,J.jsx)(Pg,{"aria-hidden":`true`,className:`size-3.5 shrink-0`}),s]})]}),s!==null&&(0,J.jsx)(`span`,{id:i,hidden:!0,children:s}),(0,J.jsx)(nz,{choice:e,disabled:t||e.options.length===0,filled:!n&&o===null})]})},uV=e=>{let t=[`intent`,`findings`,`risk`,`decisions`].filter(t=>e.stages[t]!==`done`);return t.length===0||e.modelError===null?null:`${t.join(`, `)} missing: ${e.modelError.message}`},dV=({analysis:e,choice:t,running:n,startedAt:r,starting:i,error:a,points:o,leftOut:s=0,threads:c=null,narrowed:l,onNarrow:u,onRun:d,children:f})=>{let p=aV(n?r:null),m=Rl(e.modelOption??t.chosen),h=f!=null&&f!==!1,g=e=>(0,J.jsxs)(`span`,{className:`flex min-w-0 items-center gap-2`,children:[e,h&&(0,J.jsx)(`span`,{className:X(`flex min-w-0 items-center`,e!==null&&`border-l pl-1.5`),children:f})]});if(n)return g((0,J.jsxs)(`span`,{"data-slot":`claude-running`,role:`status`,className:`flex shrink-0 items-center gap-2 whitespace-nowrap text-muted-foreground`,children:[(0,J.jsx)(f_,{"aria-hidden":`true`,className:`size-3.5`}),m,` is reading this PR`,(0,J.jsx)(`span`,{className:`tabular text-caption`,children:oV(p)})]}));let _=[`finding`,`risk`,`decision`].map(e=>[e,o.filter(t=>t.kind===e).length]).filter(([,e])=>e>0),v=uV(e),y=_.length+(c===null?0:1),b=e=>({"data-land":`rise`,style:vh({"--landing-i":y+e})});if(o.length>0)return(0,J.jsxs)(`span`,{"data-slot":`claude-receipt`,className:`flex min-w-0 items-center gap-1.5`,children:[_.map(([e,t],n)=>(0,J.jsx)(cV,{kind:e,count:t,words:sV[e],at:n,pressed:l===e,onPressed:t=>u(t?e:null)},e)),c!==null&&(0,J.jsx)(cV,{kind:`thread`,count:c.count,words:c.words,label:c.label,at:_.length,pressed:l===`thread`,onPressed:e=>u(e?`thread`:null)}),(0,J.jsx)(`span`,{...b(0),className:`ml-1 flex min-w-0 items-center border-l pl-1.5`,children:f}),(a??v)!==null&&(0,J.jsx)(`span`,{...b(1),role:`alert`,title:a??v??void 0,className:`min-w-0 truncate text-caption text-destructive`,children:a??v}),Vu(e)&&(0,J.jsx)(`span`,{...b(1),children:(0,J.jsx)($,{variant:`ghost`,size:`xs`,disabled:i,onClick:d,children:i?`Starting…`:`Try again`})})]});if(!Vu(e))return g(e.stages.findings===`done`?(0,J.jsxs)(`span`,{"data-slot":`claude-receipt`,"data-land":`fade`,className:`shrink-0 whitespace-nowrap text-muted-foreground`,children:[(0,J.jsx)(`span`,{"aria-hidden":`true`,children:`✓ `}),m,` found nothing to raise`,s>0&&`, and left out ${s} by your preferences`]}):null);let x=e.modelError;return g((0,J.jsxs)(`span`,{className:`flex min-w-0 items-center gap-2`,children:[(0,J.jsx)(lV,{choice:t,starting:i,failed:x!==null,onRun:d}),(a??x)!==null&&(0,J.jsx)(`span`,{role:`alert`,title:a??`${m} couldn't finish: ${x?.message}`,className:`min-w-0 truncate text-caption text-destructive`,children:a??`${m} couldn't finish: ${x?.message}`})]}))},fV=e=>`call-${e.partId}-${e.line}-${e.column}`,pV=(e,t,n)=>{let r=new Map;for(let i of e){let e=t.items(i.toPartIds).map(({id:e,hunk:t,file:n})=>({id:e,hunk:t,file:n}));if(e.length===0||!t.parts.has(i.partId))continue;let a={symbol:i.symbol,targets:e},o=fV(i),s=r.get(i.partId)??new Map,c=s.get(i.line)??[];c.some(e=>e.start===i.column)||(c.push({start:i.column,end:i.column+i.length,render:e=>(0,J.jsx)(Oj,{handle:n,payload:a,id:o,children:e})}),s.set(i.line,c),r.set(i.partId,s))}return r},mV=(e,t)=>{let n=e.checkedBy;if(n===void 0)return null;let{hunkId:r,startLine:i}=n.lines,a=t.items(t.partsOf(r)),o=a.filter(({hunk:e})=>e.lines.some(e=>e.kind!==`del`&&e.newLine===i)),s=(o.length>0?o:a).map(({id:e,hunk:t,file:n})=>({id:e,hunk:t,file:n}));return s.length===0?null:{symbol:n.test,targets:s,label:`Test ${n.test}`}},hV=e=>`hunk-${e}`,gV=e=>e===void 0?{}:{marks:e},_V=({id:e,deps:t})=>{let[n]=t.index.items([e]);if(n===void 0)return null;let{hunk:r,file:i,risk:a,proofs:o=[]}=n;return o.length>0?(0,J.jsx)(`div`,{className:vj,children:(0,J.jsx)(Gj,{hunk:r,file:i,risk:a,proofs:o,onFocus:t.onFocusHunk})}):(0,J.jsx)(Tj,{id:e,hunk:r,file:i,risk:a,highlighted:t.highlighted.has(e),onFocus:t.onFocusHunk,unchanged:t.unchangedOf(e),inFile:!0,comments:t.commentsOf(e),openComment:t.openComment?.partId===e?t.openComment.place:null,onOpenComment:t.onOpenComment,...t.onCancelComment===void 0?{}:{onCancelComment:t.onCancelComment},onComment:t.onComment,...t.onCommentNow===void 0?{}:{onCommentNow:t.onCommentNow},afterHeader:t.pointsOn(e),...t.pointLinesOf(e)===void 0?{}:{pointLines:t.pointLinesOf(e)},threadsAt:n=>t.threadsAt(e,n),pointsAt:n=>t.pointsAt(e,n),pointsAtEnd:n=>t.pointsAtEnd(e,n),...t.flaggedOf(e)===void 0?{}:{flagged:t.flaggedOf(e)},...t.rangeNote===void 0?{}:{rangeNote:t.rangeNote},...gV(t.marksOf(e))})},vV=/^#{1,6}\s+/,yV=e=>e.replace(/!?(\[([^\]]+)\])\([^)]*\)/g,`$2`).replace(/(`+)(.*?)\1/g,`$2`).replace(/(\*\*|__|~~)(.*?)\1/g,`$2`).replace(/(^|\s)[*_]([^*_]+)[*_](?=\s|[.,!?]|$)/g,`$1$2`).replace(/^\s*(?:>\s*|[-*+]\s+|\d+[.)]\s+)/,``).replace(/\\([\\`*_{}[\]()#+.!>-])/g,`$1`),bV=e=>{let t=e.split(`
|
|
84
|
-
`).map(e=>e.trim()).filter(e=>e!==``);return
|
|
85
|
-
`)[0]]},e.sha))})]})]})},
|
|
86
|
-
`);return t.at(-1)===``&&t.pop(),t.map(e=>e.endsWith(`\r`)?e.slice(0,-1):e)},YV=(e,t)=>{let{client:n}=yp(),[r,i]=(0,q.useState)({status:`idle`}),a=(0,q.useRef)(`idle`);return{text:r,load:(0,q.useCallback)(()=>{if(a.current===`loading`||a.current===`ready`)return;let r=e=>{a.current=e.status,i(e)};r({status:`loading`}),n.getFileContent(e,`head`,t).then(e=>r(e.ok?e.value.content===null?{status:`error`,message:`The file isn't at the pull request's head commit.`}:{status:`ready`,lines:JV(e.value.content)}:{status:`error`,message:Ap(e.error)}))},[n,e,t])}},XV=()=>(0,J.jsx)(`svg`,{"data-slot":`unfold-icon`,className:`shrink-0`,viewBox:`0 0 16 16`,width:`16`,height:`16`,"aria-hidden":`true`,focusable:`false`,children:(0,J.jsx)(`path`,{d:`M8 1.5v4M5.5 3.5 8 1l2.5 2.5M8 14.5v-4M5.5 12.5 8 15l2.5-2.5M2 8h12`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.5`,strokeLinecap:`round`,strokeLinejoin:`round`})}),ZV=e=>`${e} ${e===1?`line`:`lines`}`,QV=(e,t,n,r)=>e.map(e=>({oldNo:e+t.offset,newNo:e,text:n[e-1]??``,tokens:r?.[e-1]??null})),$V=({fold:e,file:t,hunkId:n,opened:r,text:i,onOpen:a,above:o,below:s})=>{let c=i.status===`ready`?i.lines:null,l=Qk(c,t),u=VV(e,c?.length??null);if(u===0)return null;if(r&&c!==null)return(0,J.jsx)(`div`,{"data-slot":`file-fold`,children:(0,J.jsx)(Xj,{hunkId:n,lines:QV(qV(e,c.length),e,c,l)})});let d=r&&i.status===`loading`,f=u===null?`Unchanged lines below`:`${ZV(u)} unchanged`;return(0,J.jsxs)(`div`,{"data-slot":`file-gap`,className:X(`flex flex-wrap items-center bg-surface-subtle text-muted-foreground`,vj,o&&`border-t`,s?`border-b`:`rounded-b-lg`),children:[(0,J.jsxs)(`button`,{type:`button`,"data-slot":`fold-open`,"aria-busy":d||void 0,disabled:d,onClick:a,className:X(`flex min-h-8 flex-1 items-center gap-2 px-3 cursor-pointer text-left -outline-offset-2 hover:bg-accent hover:text-foreground disabled:cursor-wait disabled:hover:bg-transparent`,!s&&`rounded-b-lg`),children:[(0,J.jsx)(XV,{}),d?(0,J.jsxs)(`span`,{role:`status`,className:`flex items-center gap-1.5`,children:[(0,J.jsx)(`span`,{"aria-hidden":`true`,className:`size-3 animate-spin rounded-full border-2 border-muted-foreground border-t-transparent`}),`Opening `,u===null?`unchanged lines below`:f]}):(0,J.jsx)(`span`,{children:f})]}),r&&i.status===`error`&&(0,J.jsx)(`span`,{role:`alert`,className:`px-3 text-destructive`,children:i.message})]})},eH=e=>e===`map`?`map`:e===`overview`||e===`tree`?`overview`:void 0,tH=(e,t)=>YP(e.path,t.path),nH=`Not classified yet.`,rH=e=>{let t=al(e.parts),n=new Map,r=new Map;for(let i of e.files){for(let e of i.hunks){let n=t.get(e.id)??[],i=n.map(e=>e.id);r.set(e.id,n.length>0?i:[e.id])}for(let e of ol(i,t)){let r=t.get(e.hunk.id)??[],a=r.findIndex(t=>t.id===e.id),o=r[a];n.set(e.id,{hunk:e.hunk,file:i,place:o===void 0?null:{n:a+1,of:r.length,definitions:o.definitions,siblings:r.map(e=>e.id)}})}}let i=new Map(e.risk.map(e=>[e.hunkId,e])),a=new Map;for(let t of e.proofs)t.hunkId!==null&&a.set(t.hunkId,[...a.get(t.hunkId)??[],t]);let o=new Set(a.keys()),s=e=>{let t=rl(e);return i.get(t)??{hunkId:t,riskClass:`logic`,reason:nH,source:`fallback`,lines:null,guidance:null}},c=e=>e.flatMap(e=>{let t=n.get(e);return t===void 0?[]:[{...t,id:e,hunkId:rl(e),risk:s(e),proofs:a.get(e)??[]}]}),l=e=>r.get(e)??[];return{parts:n,mechanical:o,items:c,partsOf:l,partsInFile:e=>e.hunks.flatMap(e=>l(e.id))}},iH=(e,t)=>[...e.files].sort(tH).flatMap(e=>e.hunks.flatMap(e=>t.partsOf(e.id))).filter(e=>!t.mechanical.has(e)),aH=(e,t)=>{let n=e.tour?.steps??[],r=new Set(n.flatMap(e=>e.partIds)),i=iH(e,t).filter(e=>!r.has(e));return i.length===0?n:[...n,{id:yu.parse(`s${n.length+1}`),title:`Changes the tour left out`,explanation:`The tour didn't include these changes, so they're shown here in file order.`,partIds:i,kind:`supporting`,via:[],entries:[],codeTitle:null,merged:[]}]},oH=(e,t)=>[...e.files].sort((e,t)=>YP(e.path,t.path)).flatMap(e=>{let n=t.partsInFile(e);return n.every(e=>t.mechanical.has(e))?[]:[{file:e,partIds:n}]}),sH=(e,t,n)=>{let r=n.parts.get(e),i=n.parts.get(t);if(r===void 0||i===void 0||r.file!==i.file)return null;let a=r.file.status===`deleted`?`old`:`new`,o=e=>a===`old`?{start:e.oldStart,count:e.oldLines}:{start:e.newStart,count:e.newLines},s=o(r.hunk),c=o(i.hunk),l=s.count===0?s.start:s.start+s.count-1,u=c.count===0?c.start+1:c.start;return Math.max(u-l-1,0)},cH=(e,t,n)=>{let r=new Map(t.map((e,t)=>[e,t])),i=new Map,a=new Map,o=new Map,s=[],c=(e,t,n)=>e.set(t,[...e.get(t)??[],n]);for(let t of e){let e=[...new Set(t.hunkIds)].flatMap(n.partsOf).filter(e=>r.has(e)&&!n.mechanical.has(e)).sort((e,t)=>(r.get(e)??0)-(r.get(t)??0)),l=t.lines===null?void 0:lH(t.lines,e,n),[u=l,...d]=l===void 0?e:[l,...e.filter(e=>e!==l)];if(u===void 0){s.push(t);continue}c(i,u,t),o.set(t.id,u);let f=l===void 0?null:rl(u);for(let e of d)rl(e)!==f&&c(a,e,t)}return{cards:i,mentions:a,cardPart:o,unplaced:s}},lH=(e,t,n)=>t.find(t=>n.parts.get(t)?.hunk.lines.some(t=>{let n=_j(t);return n!==null&&n.side===e.side&&n.line===e.startLine})),uH=e=>{let t=new Set,n=0;for(let r of e)r.hunkId===null?n+=1:t.add(r.hunkId);return t.size+n},dH=(e,t)=>{let n=new Set([...t.parts].flatMap(([e,{file:n}])=>t.mechanical.has(e)?[]:[n.path]));return e.proofs.filter(e=>e.hunkId===null||!n.has(e.path))},fH=(e,t)=>{let n=new Map;for(let r of e){let e=t.partsOf(r.hunkId).find(e=>t.parts.get(e)?.hunk.lines.some(e=>{let t=_j(e);return t!==null&&t.side===r.side&&t.line===r.line}));e!==void 0&&n.set(e,[...n.get(e)??[],r])}return n},pH=e=>({files:e.length,additions:e.reduce((e,t)=>e+t.additions,0),deletions:e.reduce((e,t)=>e+t.deletions,0)}),mH=e=>({threads:e.length,unresolved:e.filter(e=>!e.resolved).length}),hH=`mechanical-changes`,gH=e=>`file-${e}`,_H=(0,q.memo)(function({render:e}){return e()},(e,t)=>e.signature===t.signature),vH=({id:e,joined:t,deps:n,signatureOf:r})=>(0,J.jsx)(`div`,{id:hV(e),className:X(`scroll-mt-24`,!t&&`border-t first:border-t-0`),"data-hunk-id":e,children:(0,J.jsx)(_H,{signature:r(e),render:()=>(0,J.jsx)(_V,{id:e,deps:n})})}),yH=({lines:e})=>e===0?null:(0,J.jsx)(`div`,{"data-slot":`file-gap`,className:X(`flex h-8 items-center gap-2 border-t bg-surface-subtle px-3 text-muted-foreground`,vj),children:(0,J.jsxs)(`span`,{children:[e,` `,e===1?`line`:`lines`,` unchanged`]})}),bH=({analysisId:e,group:t,deps:n,signatureOf:r})=>{let i=n.index.items(t.partIds),a=i.reduce((e,t)=>e+Nk(t.hunk).added,0),o=i.reduce((e,t)=>e+Nk(t.hunk).deleted,0),s=n.openThreads(t.file.path),c=n.earlierThreads(t.file.path),{text:l,load:u}=YV(e,t.file.path),[d,f]=(0,q.useState)(new Set),p=(0,q.useMemo)(()=>GV(t.file)?KV(t.partIds,n.index):[],[t,n.index]),m=e=>`${e.after??``}>${e.before??``}`,h=e=>{let r=m(e),i=e.before??e.after,a=i===null?void 0:n.index.parts.get(i);return a===void 0?null:(0,J.jsx)($V,{fold:e,file:t.file,hunkId:a.hunk.id,opened:d.has(r),text:l,above:e.after!==null,below:e.before!==null,onOpen:()=>{u(),f(e=>new Set(e).add(r))}},r)};return(0,J.jsxs)(`section`,{id:gH(t.file.path),"data-slot":`file-card`,className:`scroll-mt-2 rounded-lg border bg-card -outline-offset-2`,"aria-label":t.file.path,"data-path":t.file.path,tabIndex:-1,children:[(0,J.jsxs)(`header`,{"data-slot":`file-card-header`,className:`sticky top-[var(--review-bar-h,0px)] z-10 flex flex-wrap items-center gap-x-3 gap-y-1 rounded-t-lg border-b bg-card px-3 py-2`,children:[(0,J.jsx)(JD,{file:t.file,status:t.file.status,className:`min-w-0 flex-1`}),(0,J.jsx)(YD,{status:t.file.status}),(0,J.jsxs)(`span`,{className:`tabular flex flex-wrap items-center gap-x-1.5 text-caption`,children:[s>0&&(0,J.jsxs)(`span`,{"data-slot":`count-threads`,className:`inline-flex items-center gap-1.5 font-medium`,children:[(0,J.jsx)(sF,{count:s}),(0,J.jsx)(`span`,{"aria-hidden":`true`,children:`·`})]}),(0,J.jsxs)(`span`,{className:`font-mono text-code-compact`,children:[(0,J.jsxs)(`span`,{className:`text-diff-add-fg`,children:[`+`,a]}),` `,(0,J.jsxs)(`span`,{className:`text-diff-del-fg`,children:[`−`,o]})]})]})]}),(0,J.jsx)(`div`,{"data-slot":`file-lines`,className:`@container overflow-x-auto rounded-b-lg`,children:(0,J.jsxs)(`div`,{className:`w-max min-w-full`,children:[t.partIds.map((e,i)=>{let a=t.partIds[i-1],o=a===void 0?null:sH(a,e,n.index),s=p.find(t=>t.before===e);return(0,J.jsxs)(q.Fragment,{children:[s===void 0?o!==null&&(0,J.jsx)(yH,{lines:o}):h(s),(0,J.jsx)(vH,{id:e,joined:o===0||s!==void 0,deps:n,signatureOf:r})]},e)}),p.filter(e=>e.before===null).map(h)]})}),c!==null&&(0,J.jsxs)(`section`,{"data-slot":`earlier-comments`,"aria-label":`Earlier comments on ${t.file.path}`,className:`flex flex-col gap-2 border-t bg-surface-subtle px-3 py-2`,children:[(0,J.jsx)(`h3`,{className:`text-caption font-medium text-muted-foreground`,children:`Earlier comments`}),c]})]})},xH=({analysis:e,files:t,deps:n,before:r,after:i,trailingProofs:a,mechanicalCount:o,scrollRequest:s,signatureOf:c})=>((0,q.useEffect)(()=>{if(s===null)return;let e=document.getElementById(s.id);if(e===null)return;let t=(e.dataset.hunkId===void 0?null:e.querySelector(`[data-slot=hunk-card], [data-slot=mechanical-toggle]`))??e,n=e.dataset.slot===`decision`;e.scrollIntoView({block:n?`center`:`start`}),t.focus({preventScroll:!0})},[s]),(0,J.jsxs)(`section`,{className:`flex min-w-0 flex-col gap-4`,"aria-label":`Changes`,children:[r,t.map(t=>(0,J.jsx)(bH,{analysisId:e.id,group:t,deps:n,signatureOf:c},t.file.path)),i,(0,J.jsxs)(`div`,{id:hH,className:`flex scroll-mt-2 flex-col gap-4 -outline-offset-2`,tabIndex:-1,children:[o===0&&e.stages.prep===`done`&&(0,J.jsx)(`p`,{className:`text-muted-foreground`,children:`No mechanical changes in this pull request.`}),(0,J.jsx)(Kj,{files:e.files,proofs:a,risk:e.risk}),(0,J.jsx)(Yj,{files:e.files})]})]})),SH={intent:`Intent`,findings:`Findings`,risk:`Risk`,decisions:`Decisions`},CH=e=>e>=1e6?`${(e/1e6).toFixed(1)}M`:e>=1e3?`${Math.round(e/1e3)}k`:`${e}`,wH=e=>`$${e.toFixed(2)}`,TH=e=>e===void 0?`—`:`${(e/1e3).toFixed(1)} s`,EH=e=>e===null?null:`${e.modelName} through ${e.providerName}`,DH=new Intl.ListFormat(`en`,{type:`conjunction`}),OH=e=>{if(e===null)return null;let t=e.preferences.length,n=[...t===0?[]:[`${t} ${t===1?`preference`:`preferences`}`],...e.guidelines.map(e=>e.path)];return n.length===0?null:DH.format(n)},kH=(e,t)=>{let n=EH(e),r=OH(t);return r===null?n:n===null?`With ${r}`:`${n} with ${r}`},AH=e=>e===null?`—`:wH(e),jH=(e,t,n=`Claude`)=>{let r=e.filter(e=>e!==null),i=e.length-r.length,a=t?`on your ${n} plan`:null;if(r.length===0)return a??`cost unknown`;let o=wH(r.reduce((e,t)=>e+t,0)),s=i===0?``:`, cost unknown for ${i} ${i===1?`call`:`calls`}`;return a===null?`${o}${s}`:`≈ ${o} at API prices${s}, ${a}`},MH=e=>e.inputTokens+e.cacheWriteTokens,NH=({usage:e,option:t=null,guidance:n=null})=>{let r=(0,q.useId)();if(e.length===0)return null;let i=t=>e.reduce((e,n)=>e+t(n),0),a=e.some(e=>e.billing===`plan`),o=e.some(e=>e.durationMs!==void 0);return(0,J.jsxs)(`div`,{className:`group relative flex justify-end`,children:[(0,J.jsxs)(`button`,{type:`button`,className:`peer tabular min-h-6 rounded-sm text-caption text-muted-foreground hover:text-foreground`,"aria-describedby":`${r}-breakdown`,children:[kH(t,n)===null?``:`${kH(t,n)} · `,`Usage: `,CH(i(MH)),` tokens in ·`,` `,CH(i(e=>e.cacheReadTokens)),` cache read ·`,` `,CH(i(e=>e.outputTokens)),` out ·`,` `,jH(e.map(e=>e.costUsd),a,Pl(t))]}),(0,J.jsxs)(`table`,{id:`${r}-breakdown`,role:`tooltip`,className:`tabular absolute right-0 bottom-full mb-2 hidden rounded-xl bg-popover p-3 text-caption text-popover-foreground shadow-md ring-1 ring-foreground/10 group-hover:table peer-focus-visible:table [&_td]:px-2 [&_td]:text-right [&_th]:px-2 [&_th]:text-left [&_thead_th]:font-medium [&_thead_th]:text-muted-foreground`,children:[(0,J.jsx)(`thead`,{children:(0,J.jsxs)(`tr`,{children:[(0,J.jsx)(`th`,{scope:`col`,children:`Pass`}),(0,J.jsx)(`th`,{scope:`col`,children:`In`}),(0,J.jsx)(`th`,{scope:`col`,children:`Cache read`}),(0,J.jsx)(`th`,{scope:`col`,children:`Out`}),(0,J.jsx)(`th`,{scope:`col`,children:a?`At API prices`:`Cost`}),o&&(0,J.jsx)(`th`,{scope:`col`,children:`Time`})]})}),(0,J.jsx)(`tbody`,{children:e.map(e=>(0,J.jsxs)(`tr`,{children:[(0,J.jsx)(`th`,{scope:`row`,children:SH[e.pass]}),(0,J.jsx)(`td`,{children:CH(MH(e))}),(0,J.jsx)(`td`,{children:CH(e.cacheReadTokens)}),(0,J.jsx)(`td`,{children:CH(e.outputTokens)}),(0,J.jsx)(`td`,{children:AH(e.costUsd)}),o&&(0,J.jsx)(`td`,{children:TH(e.durationMs)})]},e.pass))})]})]})},PH={intent:`Intent`,findings:`Findings`,risk:`Risk`,decisions:`Decisions`},FH=e=>{let t=Math.round(e/1e3);return`+${Math.floor(t/60)}:${String(t%60).padStart(2,`0`)}`},IH=e=>{if(e.outcome===`ok`)return`✓ Answered`;if(e.outcome===`failed`)return`✕ Failed: ${e.error?.kind??`unknown`}`;let t=e.problems.length;return`⚠ ${t} ${t===1?`problem`:`problems`}`},LH=e=>[...e].sort((e,t)=>Date.parse(e.startedAt)-Date.parse(t.startedAt)||e.attempt-t.attempt),RH=({guidance:e,leftOut:t})=>{let n=OH(e);return n===null?null:(0,J.jsxs)(`section`,{"aria-label":`What the run read beside the code`,className:`flex flex-col gap-1.5`,children:[(0,J.jsx)(`h3`,{className:`font-medium`,children:`Read beside the code`}),(0,J.jsxs)(`p`,{className:`text-ui text-muted-foreground`,children:[n,`, as they were when the run started.`,` `,t===0?`No point was left out by them.`:`${t} ${t===1?`point was`:`points were`} left out by them, folded where ${t===1?`its card`:`their cards`} would be.`,` `,(0,J.jsx)(N_,{to:S_,className:`underline`,children:`Preferences`})]}),(0,J.jsxs)(`ul`,{className:`flex flex-col gap-1 text-ui`,children:[e.preferences.map(e=>(0,J.jsxs)(`li`,{className:`flex flex-wrap items-center gap-x-2 gap-y-0.5`,children:[(0,J.jsx)(pB,{kind:e.kind}),(0,J.jsx)(`span`,{className:`min-w-0 flex-1 basis-56 break-words`,children:e.text}),(0,J.jsx)(`span`,{className:`text-caption text-muted-foreground`,children:e.scope.kind===`global`?`Everywhere`:gB(e.scope.repo)})]},e.ref)),e.guidelines.map(e=>(0,J.jsxs)(`li`,{className:`flex items-center gap-2`,children:[(0,J.jsx)(cg,{"aria-hidden":`true`,className:`size-3.5 shrink-0 text-muted-foreground`}),(0,J.jsx)(`span`,{className:`font-mono text-code-compact break-all`,children:e.path}),(0,J.jsx)(`span`,{className:`tabular text-caption text-muted-foreground`,children:lL(e.bytes)})]},e.ref))]})]})},zH=({calls:e,option:t,guidance:n=null,leftOut:r=0})=>{let[i,a]=(0,q.useState)(!1),o=LH(e),s=o[0];if(s===void 0)return null;let c=Date.parse(s.startedAt),l=Math.max(...o.map(e=>Date.parse(e.startedAt)+e.durationMs));return(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)($,{variant:`ghost`,size:`xs`,onClick:()=>a(!0),children:`Run details…`}),i&&(0,J.jsxs)(EB,{title:`${Rl(t)}'s calls`,onClose:()=>a(!1),className:`sm:max-w-3xl`,children:[(0,J.jsxs)(`p`,{className:`text-ui text-muted-foreground`,children:[EH(t)===null?``:`On ${EH(t)}. `,TH(l-c),` from the first call to the end of the last. A call whose answer has problems runs once more, told what they are.`]}),(0,J.jsxs)(`table`,{className:`tabular w-full text-ui [&_td]:px-2 [&_td]:py-1 [&_td]:align-top [&_th]:px-2 [&_th]:py-1 [&_th]:text-left [&_th]:align-top [&_th]:font-normal [&_thead_th]:font-medium [&_thead_th]:text-muted-foreground`,children:[(0,J.jsx)(`thead`,{children:(0,J.jsxs)(`tr`,{children:[(0,J.jsx)(`th`,{scope:`col`,children:`Pass`}),(0,J.jsx)(`th`,{scope:`col`,children:`Started`}),(0,J.jsx)(`th`,{scope:`col`,children:`Time`}),(0,J.jsx)(`th`,{scope:`col`,children:`Outcome`})]})}),(0,J.jsx)(`tbody`,{children:o.map(e=>{let t=e.error===null?e.problems:[e.error.message];return(0,J.jsxs)(`tr`,{children:[(0,J.jsxs)(`th`,{scope:`row`,children:[PH[e.pass],e.attempt>1&&(0,J.jsx)(`span`,{className:`text-muted-foreground`,children:` · again`})]}),(0,J.jsx)(`td`,{children:FH(Date.parse(e.startedAt)-c)}),(0,J.jsx)(`td`,{children:TH(e.durationMs)}),(0,J.jsxs)(`td`,{children:[(0,J.jsx)(`span`,{className:e.outcome===`failed`?`text-destructive`:void 0,children:IH(e)}),t.length>0&&(0,J.jsx)(`ul`,{className:`mt-1 list-disc pl-4 text-muted-foreground`,children:t.map(e=>(0,J.jsx)(`li`,{children:e},e))})]})]},`${e.pass}/${e.attempt}/${e.startedAt}`)})})]}),n!==null&&(0,J.jsx)(RH,{guidance:n,leftOut:r})]})]})},BH={logic:`border-risk-logic-solid bg-risk-logic-bg text-risk-logic`,mechanical:`border-risk-mechanical-solid bg-risk-mechanical-bg text-risk-mechanical`},VH=`border-dashed border-input bg-surface-subtle text-muted-foreground`,HH={call:``,import:`[stroke-dasharray:6_4]`,request:`stroke-muted-foreground [stroke-dasharray:12_4_3_4] [stroke-width:2.5]`,type:`[stroke-dasharray:1.5_3] [stroke-linecap:round]`,outside:`[stroke-dasharray:4_4] opacity-60`},UH=56,WH=24,GH=16,KH=120,qH=300,JH=8.6,YH=6.6,XH=6.7,ZH=32,QH=24,$H=20,eU=380,tU=e=>e.slice(e.lastIndexOf(`/`)+1),nU=e=>e===1?`1 use`:`${e} uses`,rU=e=>e===1?`1 file`:`${e} files`,iU=e=>e.kind===`outside`?`${e.paths.length>1?`${rU(e.paths.length)} · `:``}outside the PR · ${nU(e.uses)}`:[e.kind===`group`?rU(e.paths.length):`+${e.added} −${e.deleted}`,...e.entries].join(` · `),aU=e=>{let t=e.badges.reduce((e,t)=>e+tU(t).length*XH+14,0),n=Math.min(Math.max(e.label.length*JH+ZH+(e.kind===`group`&&e.paths.length>1?QH:0),iU(e).length*YH+$H,t+$H),eU),r=KH+Math.sqrt(e.added+e.deleted)*9;return Math.round(Math.max(n,Math.min(r,qH)))},oU=72,sU=(e,t)=>{let n=e.map(e=>e.reduce((e,t,n)=>e+aU(t)+(n>0?WH:0),0)),r=Math.max(0,...n)+32,i=r+(t?oU:0),a=new Map;return e.forEach((e,t)=>{let i=(r-(n[t]??0))/2;for(let n of e){let e=aU(n);a.set(n.key,{x:i,y:GH+t*120,width:e}),i+=e+WH}}),{boxes:a,width:i,height:e.length===0?0:32+e.length*64+(e.length-1)*UH}},cU=e=>e.outside?`outside`:e.uses.includes(`request`)?`request`:e.uses.includes(`call`)?`call`:e.uses.every(e=>e===`import`)?`import`:`type`,lU=(e,t)=>{let n=e=>{let n=t.get(e);return n===void 0?0:n.x+n.width/2},r=(e,r,i)=>{let a=t.get(r),o=[...e].sort((e,t)=>n(i(e))-n(i(t)));return new Map(o.map((e,t)=>[e,a===void 0?0:a.x+a.width*(.5+(o.length===1?0:(t/(o.length-1)-.5)*.5))]))},i=e.filter(e=>!e.back&&!e.outside),a=new Map,o=new Map;for(let e of t.keys()){for(let[t,n]of r(i.filter(t=>t.from===e),e,e=>e.to))a.set(t,n);for(let[t,n]of r(i.filter(t=>t.to===e),e,e=>e.from))o.set(t,n)}return{out:a,into:o}},uU=(e,t,n,r,i=e.x+e.width/2,a=t.x+t.width/2)=>{if(n){let n=e.x+e.width,i=t.x+t.width,a=e.y+32,o=t.y+32,s=r-oU/2;return`M ${n} ${a} C ${s} ${a} ${s} ${o} ${i} ${o}`}if(e.y>t.y){let n=e.y,r=t.y+64,o=Math.max(UH/2,(n-r)/2);return`M ${i} ${n} C ${i} ${n-o} ${a} ${r+o} ${a} ${r}`}let o=e.y+64,s=t.y,c=Math.max(UH/2,(s-o)/2);return`M ${i} ${o} C ${i} ${o+c} ${a} ${s-c} ${a} ${s}`},dU={import:`imports`,call:`calls`,type:`uses types from`,request:`sends requests to`},fU=(e,t)=>{let n=e.uses.map(e=>dU[e]).join(`, `),r=e.symbols.length>0?`: ${e.symbols.join(`, `)}`:``;return`${t(e.from)} ${n} ${t(e.to)}${r}`},pU=({node:e,box:t,active:n,current:r,onOpen:i,onExpand:a,onFocus:o})=>{let s=e.kind===`group`,c=e.kind===`outside`,l=(c?[e.label,iU(e)]:[e.label,s?rU(e.paths.length):null,...e.entries,e.risk,e.generated?`generated`:null,r?`in view in the code`:null]).filter(e=>e!==null).join(`, `);return(0,J.jsxs)(`div`,{"data-slot":`overview-node-box`,className:X(`grid`,t===void 0?`relative`:`absolute`),style:t===void 0?{width:aU(e)}:{left:t.x,top:t.y,width:t.width,height:64},children:[(0,J.jsxs)(`button`,{type:`button`,"data-slot":`overview-node`,"data-risk":c?`outside`:e.risk,"data-generated":e.generated||void 0,"data-active":n||void 0,"data-current":r||void 0,className:X(`grid h-full w-full content-start gap-0.5 overflow-hidden rounded-md border px-2 py-1 text-left text-caption`,c?VH:BH[e.risk],e.generated&&`border-dashed`,n&&`border-primary`,r&&`shadow-[0_0_0_2px_var(--background),0_0_0_4px_var(--primary)]`),"data-key":e.key,"aria-label":l,"aria-current":r?`location`:void 0,title:s?e.label:e.paths.length===1?e.paths[0]:void 0,onClick:()=>i(e),onFocus:()=>o(e),onMouseEnter:()=>o(e),onMouseLeave:()=>o(null),children:[(0,J.jsx)(`span`,{className:X(`flex min-w-0 items-baseline gap-2`,s&&`pr-6`),children:(0,J.jsx)(`span`,{"data-slot":`overview-label`,className:`min-w-0 truncate font-mono text-code-compact font-semibold`,children:e.label})}),(0,J.jsx)(`span`,{className:`truncate`,children:iU(e)}),e.badges.length>0&&(0,J.jsx)(`span`,{className:`flex gap-1 overflow-hidden`,children:e.badges.map(e=>(0,J.jsx)(`span`,{className:`shrink-0 rounded-sm border border-current px-1 font-mono text-kbd`,children:tU(e)},e))})]}),s&&e.paths.length>1&&(0,J.jsx)($,{variant:`ghost`,size:`icon-xs`,className:`absolute top-1 right-1 text-current`,"aria-label":`Show the files of ${e.label}`,title:`Show its files`,onClick:()=>a(e),children:(0,J.jsx)(Rg,{"aria-hidden":`true`})})]})},mU=({overview:e,focusKey:t,currentPath:n,onOpen:r,onExpand:i,onCollapse:a,expandedGroups:o,onFocusNode:s})=>{let c=(0,q.useId)(),l=(0,q.useRef)(null),[u,d]=(0,q.useState)(null),{boxes:f,width:p,height:m}=(0,q.useMemo)(()=>sU(e.rows,e.edges.some(e=>e.back)),[e]),h=(0,q.useMemo)(()=>lU(e.edges,f),[e.edges,f]),g=(0,q.useMemo)(()=>new Map([...e.rows.flat(),...e.strip].map(e=>[e.key,e.label])),[e]),_=e=>g.get(e)??e,v=(0,q.useMemo)(()=>[...e.rows,e.strip].filter(e=>e.length>0),[e]);(0,q.useEffect)(()=>d(null),[e]);let y=(0,q.useRef)(-1);(0,q.useEffect)(()=>{if(t===null||y.current===t.n)return;let n=e.placeOf.get(t.key)??t.key,r=l.current?.querySelector(`[data-key="${CSS.escape(n)}"]`);r!=null&&(y.current=t.n,r.focus(),r.scrollIntoView?.({block:`nearest`,inline:`nearest`}))},[t,e]);let b=e=>l.current?.querySelector(`[data-key="${CSS.escape(e)}"]`)?.focus(),x=e=>{let t=e.target.dataset.key;if(t===void 0)return;let n=v.findIndex(e=>e.some(e=>e.key===t)),r=v[n]?.findIndex(e=>e.key===t)??-1,i=e=>{let t=l.current?.querySelector(`[data-key="${CSS.escape(e.key)}"]`)?.getBoundingClientRect();return t===void 0?0:t.left+t.width/2},a;if(e.key===`ArrowRight`)a=v[n]?.[r+1];else if(e.key===`ArrowLeft`)a=v[n]?.[r-1];else if(e.key===`ArrowDown`||e.key===`ArrowUp`){let t=v[n+(e.key===`ArrowDown`?1:-1)]??[],o=v[n]?.[r],s=o===void 0?0:i(o);a=[...t].sort((e,t)=>Math.abs(i(e)-s)-Math.abs(i(t)-s))[0]}else return;e.preventDefault(),a!==void 0&&b(a.key)},S=u?.kind===`node`?u.node.key:null,C=e=>e.from===S||e.to===S,w=e=>{e!==null&&s(e.key),d(e===null?null:{kind:`node`,node:e})},T=n===null?null:e.placeOf.get(n)??null,E=e=>({node:e,active:S===e.key,current:T===e.key,onOpen:r,onExpand:e=>i(e.key),onFocus:w});return(0,J.jsxs)(`section`,{className:`flex min-w-0 flex-col gap-3`,"aria-label":`Overview of the changed files`,ref:l,onKeyDown:x,children:[(0,J.jsxs)(`p`,{"data-slot":`overview-legend`,className:`text-muted-foreground`,children:[`Each box is a directory. Directories that nothing in the pull request calls are on top; each sits below its callers. Solid lines are calls, dash-dot ones HTTP requests to a route, dashed ones imports, dotted ones types. Tests show on the directories they call. The outlined box holds the file last in view in the code.`,e.edges.some(e=>e.outside)&&` Faded files are outside the pull request, under the code whose changes they use.`]}),o.length>0&&(0,J.jsx)(`p`,{className:`flex flex-wrap gap-2`,children:o.map(e=>(0,J.jsxs)($,{variant:`outline`,size:`sm`,onClick:()=>a(e),children:[`Collapse `,e.slice(6),`/`]},e))}),e.rows.length>0?(0,J.jsx)(`div`,{"data-slot":`overview-scroll`,className:`overflow-x-auto rounded-lg border bg-surface-subtle`,children:(0,J.jsxs)(`div`,{"data-slot":`overview-diagram`,className:`relative mx-auto`,style:{width:p,height:m},children:[(0,J.jsxs)(`svg`,{className:`absolute inset-0 overflow-visible`,width:p,height:m,"aria-hidden":`true`,children:[(0,J.jsx)(`defs`,{children:(0,J.jsx)(`marker`,{id:`${c}-arrow`,viewBox:`0 0 8 8`,refX:`7`,refY:`4`,markerWidth:`7`,markerHeight:`7`,orient:`auto-start-reverse`,children:(0,J.jsx)(`path`,{d:`M 0 0 L 8 4 L 0 8 z`,className:`fill-input`})})}),e.edges.map(e=>{let t=f.get(e.from),n=f.get(e.to);if(t===void 0||n===void 0)return null;let r=uU(t,n,e.back,p,h.out.get(e),h.into.get(e)),i=C(e)||u?.kind===`edge`&&u.edge===e,a=u!==null&&!i;return(0,J.jsxs)(`g`,{"data-slot":`overview-edge`,"data-style":cU(e),"data-lit":i||void 0,"data-dim":a||void 0,className:X(a&&`opacity-30`),onMouseEnter:()=>d({kind:`edge`,edge:e}),onMouseLeave:()=>d(null),children:[(0,J.jsx)(`path`,{d:r,className:`fill-none stroke-transparent [stroke-width:10]`}),(0,J.jsx)(`path`,{d:r,className:X(`fill-none stroke-input [stroke-width:1.5]`,HH[cU(e)],i&&`stroke-primary [stroke-width:2]`),markerEnd:`url(#${c}-arrow)`}),(0,J.jsx)(`title`,{children:fU(e,_)})]},`${e.from}>${e.to}`)})]}),e.rows.flat().map(e=>(0,J.jsx)(pU,{box:f.get(e.key),...E(e)},e.key))]})}):(0,J.jsx)(`p`,{className:`text-muted-foreground`,children:`No changed file calls or imports another.`}),e.strip.length>0&&(0,J.jsxs)(`section`,{"aria-label":`Not linked`,className:`flex flex-col gap-2`,children:[(0,J.jsx)(`h3`,{className:`text-caption font-medium text-muted-foreground`,children:`Not linked`}),(0,J.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:e.strip.map(e=>(0,J.jsx)(pU,{...E(e)},e.key))})]}),(0,J.jsx)(`p`,{"data-slot":`overview-detail`,className:`min-h-5 text-muted-foreground`,"aria-live":`polite`,children:u===null?`Hover or focus a directory to see its files, flows and tests.`:u.kind===`edge`?fU(u.edge,_):hU(u.node,e.edges,_)})]})},hU=(e,t,n)=>{let r=t.filter(t=>t.from===e.key).map(e=>{let t=e.symbols.length>0?` (${e.symbols.join(`, `)})`:``;return`${n(e.to)}${t}`});return e.kind===`outside`?`${e.paths.length>1?`${e.label}: ${e.paths.length} files`:e.paths[0]} · outside the pull request · uses ${r.join(`, `)}.`:`${[e.kind===`group`?`${e.label}: ${e.paths.map(tU).join(`, `)}`:e.paths[0],e.flows.length>0?`read in ${e.flows.join(`; `)}`:`in no flow`,...r.length>0?[`reaches ${r.join(`, `)}`]:[],...e.badges.length>0?[`tested in ${e.badges.map(tU).join(`, `)}`]:[]].join(` · `)}.`},gU=e=>`point-${e}`,_U={contradicts:`Contradicts what was asked`,missing:`Asked for, not done`,unrequested:`Done, not asked for`},vU={finding:`text-review-changes`,risk:`text-risk-contract`,decision:`text-muted-foreground`},yU=({kind:e})=>{let t=sD[e];return(0,J.jsxs)(`span`,{className:X(`inline-flex items-center gap-1 font-medium`,vU[e]),children:[(0,J.jsx)(t,{"aria-hidden":`true`,className:`size-3.5`}),oD[e].label]})},bU=({point:e,state:t,current:n,note:r,action:i,className:a,leftOut:o=!1})=>{let s=sD[e.kind];return(0,J.jsxs)(`article`,{id:gU(e.id),"data-slot":`point`,"data-kind":e.kind,"data-state":t,"data-left-out":o||void 0,"data-current":n||void 0,"aria-label":e.title,className:X(`flex scroll-mt-24 flex-wrap items-center gap-x-2 gap-y-0.5 text-muted-foreground`,a,n&&MU),children:[(0,J.jsx)(s,{"aria-hidden":`true`,className:`size-3.5 shrink-0`}),(0,J.jsxs)(`span`,{className:`sr-only`,children:[oD[e.kind].label,`: `]}),(0,J.jsx)(`span`,{className:X(`min-w-0 flex-1 basis-40 truncate`,t===`dismissed`&&`line-through`),children:e.title}),(0,J.jsx)(`span`,{className:`max-w-full min-w-0 truncate text-caption`,children:r}),i]})},xU=({effect:e,preferenceId:t})=>{let n=t===null?``:` your preference:`;return e===`raised`?`From${n}`:`Left out by${n}`},SU=({guidance:e,className:t})=>{let n=e.preferenceId===null?cg:u_;return(0,J.jsxs)(`p`,{"data-slot":`point-guidance`,"data-effect":e.effect,className:X(`flex items-start gap-1.5 text-caption text-muted-foreground`,t),children:[(0,J.jsx)(n,{"aria-hidden":`true`,className:`mt-0.5 size-3.5 shrink-0`}),(0,J.jsxs)(`span`,{className:`min-w-0`,children:[xU(e),` `,(0,J.jsx)(N_,{to:S_,className:X(`underline`,e.preferenceId===null&&`font-mono text-code-compact`),children:e.label})]})]})},CU=({point:e,guidance:t,state:n,current:r,onShow:i})=>(0,J.jsx)(bU,{point:e,state:n,current:r,leftOut:!0,note:`${xU(t)} ${t.label}`,className:FU,action:(0,J.jsx)($,{variant:`ghost`,size:`xs`,"aria-label":`Show: ${e.title}`,onClick:i,children:`Show`})}),wU=(e,t,n)=>{let r=(0,q.useRef)(null),i=(0,q.useRef)(!1);return(0,q.useEffect)(()=>{!e&&i.current&&(i.current=!1,r.current?.focus())},[e]),{card:r,show:()=>{i.current=!0,t(n)}}},TU=({point:e,size:t,disabled:n,onDismiss:r,onRule:i})=>(0,J.jsxs)(`span`,{className:`flex items-center`,children:[(0,J.jsxs)($,{variant:`ghost`,size:t,disabled:n,"aria-label":`Dismiss: ${e.title}`,className:`rounded-r-none`,onClick:r,children:[t===`sm`&&(0,J.jsx)(b_,{"aria-hidden":`true`}),`Dismiss`]}),(0,J.jsxs)(UR,{children:[(0,J.jsx)(WR,{render:(0,J.jsx)($,{variant:`ghost`,size:t,"data-slot":`dismiss-menu`,disabled:n,"aria-label":`More ways to dismiss: ${e.title}`,className:`w-6 rounded-l-none px-0`}),children:(0,J.jsx)(Bh,{"aria-hidden":`true`})}),(0,J.jsx)(GR,{align:`end`,className:`w-64`,children:(0,J.jsxs)(JR,{onClick:i,children:[(0,J.jsx)(fg,{"aria-hidden":`true`}),`Don't flag things like this…`]})})]})]}),EU=({point:e,scopes:t,onSave:n,onCancel:r})=>{let[i]=t;return i===void 0?null:(0,J.jsxs)(`div`,{"data-slot":`point-rule`,className:`flex flex-col gap-2 rounded-md border bg-card p-3`,children:[(0,J.jsx)(`p`,{className:`text-caption text-muted-foreground`,children:`Word it as a rule. It's saved to your preferences, and AI reviews leave out what it describes, folded to a line you can open.`}),(0,J.jsx)(TB,{legend:`Don't flag things like: ${e.title}`,initial:{kind:`dont-flag`,text:e.title,scope:i.scope},scopes:t,kindFixed:!0,submit:`Save and dismiss`,submitting:`Saving…`,focus:!0,onCancel:r,onSubmit:n})]})},DU=(e,t)=>{let[n,r]=(0,q.useState)(!1),[i,a]=(0,q.useState)(!1);return{writing:n,setWriting:r,saved:i,save:async n=>{let i=await t(e,n);return i===null&&(a(!0),r(!1)),i}}},OU=e=>e?(0,J.jsxs)(J.Fragment,{children:[`Dismissed, and saved to your`,` `,(0,J.jsx)(N_,{to:S_,className:`underline`,children:`preferences`})]}):`Dismissed`,kU={blocking:{glyph:`■`,className:`text-severity-blocker bg-review-changes-bg border-severity-blocker/25`},major:{glyph:`▲`,className:`text-severity-major bg-severity-major-bg border-severity-major/25`},minor:{glyph:`●`,className:`text-severity-minor bg-review-pending-bg border-severity-minor/25`}},AU=({severity:e})=>(0,J.jsxs)(`span`,{"data-slot":`severity`,className:X(ij,kU[e].className),children:[(0,J.jsx)(`span`,{"aria-hidden":`true`,children:kU[e].glyph}),e]}),jU=`animate-in duration-(--duration-slow) fade-in-0 slide-in-from-top-1`,MU=`shadow-[inset_0_0_0_2px_var(--ring)]`,NU=`relative max-w-3xl rounded-lg border bg-thread-bg`,PU=`scroll-mt-[calc(6rem+var(--lines-above)*var(--text-code--line-height))] -outline-offset-2`,FU=X(NU,`px-3 py-1.5`),IU={finding:`bg-review-changes`,risk:`bg-risk-contract-solid`},LU=({kind:e})=>(0,J.jsx)(`span`,{"aria-hidden":`true`,className:X(`absolute top-2 bottom-2 left-1.5 w-[3px] rounded-full`,IU[e])}),RU=(0,q.memo)(function({point:e,state:t,saving:n,readOnly:r,current:i,onRaise:a,onState:o,leftOut:s,onShow:c,ruleScopes:l,onRule:u,inReview:d,removed:f,language:p,linesAbove:m=0}){let h=(0,q.useId)(),{card:g,show:_}=wU(s,c,e.id),v=DU(e,u);if(t===`dismissed`)return(0,J.jsx)(bU,{point:e,state:t,current:i,note:OU(v.saved),className:FU,action:(0,J.jsx)($,{variant:`ghost`,size:`xs`,disabled:r,onClick:()=>o(e.id,`open`),children:`Undo`})});if(t===`raised`&&d)return(0,J.jsx)(bU,{point:e,state:t,current:i,note:`In your review, below`,className:`max-w-3xl px-1`,action:(0,J.jsx)(`span`,{"aria-hidden":`true`,children:`✓`})});if(s&&e.guidance!==void 0)return(0,J.jsx)(CU,{point:e,guidance:e.guidance,state:t,current:i,onShow:_});let y=r||n;return(0,J.jsxs)(`article`,{ref:g,id:gU(e.id),"data-slot":`point`,"data-kind":`finding`,"data-state":t,"data-current":i||void 0,"aria-labelledby":`${h}-title`,tabIndex:-1,style:vh({"--lines-above":m}),className:X(NU,PU,`flex flex-col gap-2 py-2.5 pr-4 pl-5`,i&&MU),children:[(0,J.jsx)(LU,{kind:`finding`}),(0,J.jsxs)(`header`,{className:`flex flex-wrap items-center gap-2`,children:[(0,J.jsx)(yU,{kind:`finding`}),e.severity!==null&&(0,J.jsx)(AU,{severity:e.severity}),(0,J.jsx)(`span`,{className:X(ij,`border-review-pending/25 bg-review-pending-bg text-review-pending`),children:`Draft`}),e.lines!==null&&(0,J.jsxs)(`span`,{className:`flex items-center gap-1 text-caption text-muted-foreground`,children:[`on`,` `,(0,J.jsx)(jk,{children:Ak(e.lines.side,e.lines.startLine,e.lines.line)})]}),(0,J.jsxs)(`span`,{className:`ml-auto flex items-center gap-1 text-caption text-muted-foreground`,children:[(0,J.jsx)(eg,{"aria-hidden":`true`,className:`size-3.5`}),`Only you see this`]})]}),(0,J.jsx)(`h3`,{id:`${h}-title`,className:`font-semibold`,children:e.title}),e.explanation!==``&&(0,J.jsx)(rj,{blocks:Vd(e.explanation).blocks,suggestion:()=>null}),e.mismatch!==null&&(0,J.jsxs)(`p`,{className:`text-caption text-muted-foreground`,children:[(0,J.jsxs)(`span`,{className:`font-medium text-foreground`,children:[_U[e.mismatch.kind],`:`]}),` `,e.mismatch.description]}),e.guidance!==void 0&&(0,J.jsx)(SU,{guidance:e.guidance}),e.suggestion!==null&&(0,J.jsx)(rA,{title:`Suggested change`,removed:f,added:e.suggestion,language:p}),v.writing?(0,J.jsx)(EU,{point:e,scopes:l,onSave:v.save,onCancel:()=>{v.setWriting(!1),g.current?.focus()}}):(0,J.jsxs)(`div`,{className:`flex flex-wrap items-center justify-end gap-2`,children:[(0,J.jsx)(TU,{point:e,size:`sm`,disabled:y,onDismiss:()=>o(e.id,`dismissed`),onRule:()=>v.setWriting(!0)}),e.lines!==null&&(0,J.jsxs)(J.Fragment,{children:[(0,J.jsxs)($,{variant:`outline`,size:`sm`,disabled:y,"aria-label":`Edit: ${e.title}`,onClick:()=>a(e,!1),children:[(0,J.jsx)(Qg,{"aria-hidden":`true`}),`Edit`]}),(0,J.jsx)($,{size:`sm`,disabled:y,"aria-label":`Add to review: ${e.title}`,onClick:()=>a(e,!0),children:`Add to review`})]})]})]})}),zU=e=>e.slice(e.lastIndexOf(`/`)+1),BU=({checkedBy:e,peek:t,id:n})=>{let r=(0,J.jsx)(`span`,{className:`font-mono text-code-compact`,children:e.test});return(0,J.jsxs)(`p`,{"data-slot":`checked-by`,className:`flex items-start gap-1.5 pb-0.5 text-muted-foreground`,children:[(0,J.jsx)(mg,{"aria-hidden":`true`,className:`mt-0.5 size-3.5 shrink-0`}),(0,J.jsxs)(`span`,{className:`min-w-0`,children:[(0,J.jsx)(`span`,{className:`font-medium text-foreground`,children:`Checked by`}),` `,t===null?r:(0,J.jsx)(Oj,{handle:t.handle,payload:t.payload,id:n,render:(0,J.jsx)(`button`,{type:`button`,className:`text-left text-foreground`}),children:r}),` `,`in `,zU(e.path),`, which asserts: `,e.checks]})]})},VU=(0,q.memo)(function({point:e,state:t,saving:n,readOnly:r,current:i,onRaise:a,onState:o,leftOut:s,onShow:c,ruleScopes:l,onRule:u,linesAbove:d=0,test:f=null}){let p=(0,q.useId)(),{card:m,show:h}=wU(s,c,e.id),g=DU(e,u);if(t===`dismissed`)return(0,J.jsx)(bU,{point:e,state:t,current:i,note:OU(g.saved),className:FU,action:(0,J.jsx)($,{variant:`ghost`,size:`xs`,disabled:r,onClick:()=>o(e.id,`open`),children:`Undo`})});if(s&&e.guidance!==void 0)return(0,J.jsx)(CU,{point:e,guidance:e.guidance,state:t,current:i,onShow:h});let _=r||n;return(0,J.jsxs)(`article`,{ref:m,id:gU(e.id),"data-slot":`point`,"data-kind":`risk`,"data-state":t,"data-current":i||void 0,"aria-labelledby":`${p}-title`,tabIndex:-1,style:vh({"--lines-above":d}),className:X(NU,PU,`flex flex-col gap-0.5 py-1.5 pr-2 pl-5`,i&&MU),children:[(0,J.jsx)(LU,{kind:`risk`}),(0,J.jsxs)(`header`,{className:`flex flex-wrap items-center gap-2`,children:[(0,J.jsx)(yU,{kind:`risk`}),e.lines!==null&&(0,J.jsx)(jk,{children:Ak(e.lines.side,e.lines.startLine,e.lines.line)}),t===`raised`&&(0,J.jsxs)(`span`,{className:`text-caption text-muted-foreground`,children:[(0,J.jsx)(`span`,{"aria-hidden":`true`,children:`✓ `}),`Commented`]}),(0,J.jsxs)(`span`,{className:`ml-auto flex items-center gap-1`,children:[(0,J.jsx)($,{variant:`ghost`,size:`xs`,disabled:_||e.lines===null,"aria-label":`Comment: ${e.title}`,onClick:()=>a(e,!1),children:`Comment`}),(0,J.jsx)(TU,{point:e,size:`xs`,disabled:_,onDismiss:()=>o(e.id,`dismissed`),onRule:()=>g.setWriting(!0)})]})]}),(0,J.jsx)(`h3`,{id:`${p}-title`,className:`pb-0.5 font-normal`,children:e.title}),e.checkedBy!==void 0&&(0,J.jsx)(BU,{checkedBy:e.checkedBy,peek:f,id:`${gU(e.id)}-test`}),e.guidance!==void 0&&(0,J.jsx)(SU,{guidance:e.guidance,className:`pb-0.5`}),g.writing&&(0,J.jsx)(`div`,{className:`py-1.5 pr-2`,children:(0,J.jsx)(EU,{point:e,scopes:l,onSave:g.save,onCancel:()=>{g.setWriting(!1),m.current?.focus()}})})]})}),HU=({point:e,state:t,open:n,current:r,onToggle:i})=>{let a=sD.decision;return(0,J.jsxs)(`button`,{type:`button`,id:gU(e.id),"data-slot":`decision-chip`,"data-inline-target":!0,"data-state":t,"data-current":r||void 0,"aria-expanded":n,"aria-label":`Decision: ${e.title}`,className:X(`ml-3 inline-flex min-h-5 scroll-mt-24 items-center gap-1 rounded-full border bg-background px-2 align-middle font-sans text-caption text-muted-foreground hover:text-foreground`,t===`dismissed`&&`line-through`,r&&MU),onClick:t=>{t.stopPropagation(),i(e.id)},children:[(0,J.jsx)(a,{"aria-hidden":`true`,className:`size-3`}),e.title]})},UU=({point:e,state:t,saving:n,readOnly:r,onRaise:i,onState:a})=>{let o=r||n;return(0,J.jsxs)(`article`,{"data-slot":`decision-note`,"data-state":t,"aria-label":e.title,className:X(`flex max-w-3xl flex-wrap items-baseline gap-x-2 border-l pl-3 text-caption`,jU),children:[(0,J.jsxs)(`p`,{className:`min-w-0 flex-1 basis-80 text-muted-foreground`,children:[(0,J.jsxs)(`span`,{className:`font-medium text-foreground`,children:[e.title,`.`]}),` `,e.explanation]}),(0,J.jsx)(`span`,{className:`flex items-center gap-1`,children:t===`dismissed`?(0,J.jsx)($,{variant:`ghost`,size:`xs`,disabled:r,onClick:()=>a(e.id,`open`),children:`Show again`}):(0,J.jsxs)(J.Fragment,{children:[t===`raised`&&(0,J.jsxs)(`span`,{className:`text-muted-foreground`,children:[(0,J.jsx)(`span`,{"aria-hidden":`true`,children:`✓ `}),`Commented`]}),(0,J.jsx)($,{variant:`ghost`,size:`xs`,disabled:o||e.lines===null,"aria-label":`Comment: ${e.title}`,onClick:()=>i(e,!1),children:`Comment`}),(0,J.jsx)($,{variant:`ghost`,size:`xs`,disabled:o,"aria-label":`Hide: ${e.title}`,onClick:()=>a(e.id,`dismissed`),children:`Hide`})]})})]})},WU=({point:e,onGo:t})=>{let n=sD[e.kind];return(0,J.jsxs)(`p`,{"data-slot":`point-mention`,className:`flex items-center gap-1.5 text-muted-foreground`,children:[(0,J.jsx)(n,{"aria-hidden":`true`,className:`size-3.5 shrink-0`}),oD[e.kind].label,`:`,` `,(0,J.jsx)(`button`,{type:`button`,className:`min-h-6 rounded-sm text-left whitespace-pre-line text-primary underline-offset-2 hover:underline`,onClick:()=>t(e.id),children:e.title})]})},GU=({pointId:e,fresh:t,at:n,row:r=!1,className:i,bodyClassName:a,children:o})=>(0,J.jsx)(`div`,{role:r?`row`:void 0,"data-slot":`point-fold`,"data-point-id":e,"data-fresh":t||void 0,"data-unfold":n!==void 0||void 0,style:n===void 0?void 0:vh({"--landing-i":n}),className:i,children:(0,J.jsx)(`div`,{role:r?`cell`:void 0,children:(0,J.jsx)(`div`,{className:a,children:o})})}),KU={finding:[`finding`,`findings`],risk:[`risk`,`risks`],decision:[`decision`,`decisions`]},qU=({points:e,kind:t,stateOf:n,onGo:r,onClose:i,family:a=`Claude`})=>{let o=t===null?e:e.filter(e=>e.kind===t),s=(0,q.useRef)(!1),[c,l]=t===null?[`point`,`points`]:KU[t];return(0,J.jsx)(EB,{title:`${o.length} ${o.length===1?c:l} from ${a}`,onClose:i,returnFocus:()=>!s.current,className:`sm:max-w-2xl`,children:(0,J.jsx)(`ul`,{className:`flex min-w-0 flex-col gap-1`,"aria-label":`Points`,children:o.map(e=>{let{label:t}=oD[e.kind],i=sD[e.kind],a=n(e.id);return(0,J.jsx)(`li`,{children:(0,J.jsxs)(`button`,{type:`button`,"data-slot":`point-row`,"data-kind":e.kind,className:`flex min-h-7 w-full items-center gap-2 rounded-md px-2 py-1 text-left hover:bg-accent`,onClick:()=>{s.current=!0,r(e.id)},children:[(0,J.jsx)(i,{"aria-hidden":`true`,className:`size-3.5 shrink-0`}),(0,J.jsxs)(`span`,{className:`sr-only`,children:[t,`: `]}),(0,J.jsx)(`span`,{className:X(`min-w-0 flex-1 truncate`,a===`dismissed`&&`line-through`),children:e.title}),a!==`open`&&(0,J.jsx)(`span`,{className:`text-caption text-muted-foreground`,children:a===`raised`?`Raised`:`Dismissed`}),e.path!==null&&(0,J.jsx)(`span`,{className:`truncate font-mono text-code-compact text-muted-foreground`,children:e.path})]})},e.id)})})})},JU=(e,t,n)=>{let r=t===null?e:e.filter(e=>e.kind===t),i=r.findIndex(e=>e.id===n);return{steps:r,at:i===-1?null:i}},YU=(e,t)=>{let{steps:n,at:r}=e;return n.length===0?null:n[r===null?t===1?0:n.length-1:(r+t+n.length)%n.length]?.id??null},XU=(e,t,n)=>{if(t===null)return null;let r=JU(e,t,n);return r.at===null?r.steps[0]?.id??null:null},ZU={finding:`findings`,risk:`risks`,decision:`decisions`},QU={finding:`text-review-changes`,risk:`text-risk-contract`,decision:`text-muted-foreground`},$U=({kind:e})=>{let t=sD[e];return(0,J.jsx)(t,{"aria-hidden":`true`,className:X(`size-3.5 shrink-0`,QU[e])})},eW=({slot:e,noun:t,total:n,at:r,count:i,title:a,status:o,onStep:s,onOpenList:c})=>{let l=r===null?i:`${r+1} of ${n}`,u=`${t.charAt(0).toUpperCase()}${t.slice(1)}`;return(0,J.jsxs)(`span`,{"data-slot":e,className:`flex min-w-0 items-center gap-0.5`,children:[(0,J.jsx)($,{variant:`ghost`,size:`icon-xs`,"aria-label":`Previous ${t}`,disabled:n===0,onClick:()=>s(-1),children:(0,J.jsx)(Hh,{"aria-hidden":`true`})}),(0,J.jsx)($,{variant:`ghost`,size:`xs`,className:`tabular`,"aria-label":r===null?`${i}, show all`:`${u} ${l}, show all`,onClick:c,children:l}),(0,J.jsx)($,{variant:`ghost`,size:`icon-xs`,"aria-label":`Next ${t}`,disabled:n===0,onClick:()=>s(1),children:(0,J.jsx)(Wh,{"aria-hidden":`true`})}),a,(0,J.jsx)(`span`,{role:`status`,className:`sr-only`,children:o})]})},tW=({points:e,current:t,stateOf:n,kind:r,onGo:i,onOpenList:a})=>{let o=JU(e,r,t),{steps:s,at:c}=o,l=c===null?void 0:s[c],u=r===null||s.length===1?`${s.length} ${s.length===1?`point`:`points`}`:`${s.length} ${ZU[r]}`,d=l!==void 0&&n(l.id)===`dismissed`;return(0,J.jsx)(eW,{slot:`point-stepper`,noun:`point`,total:s.length,at:c,count:u,onStep:e=>{let t=YU(o,e);t!==null&&i(t)},onOpenList:a,title:l!==void 0&&(0,J.jsxs)(`button`,{type:`button`,"data-slot":`stepper-title`,"data-kind":l.kind,className:`ml-1 flex h-6 min-w-0 items-center gap-1.5 rounded-md px-1 text-left max-sm:hidden hover:bg-muted`,"aria-label":`Go to ${oD[l.kind].label.toLowerCase()}: ${l.title}`,onClick:()=>i(l.id),children:[(0,J.jsx)($U,{kind:l.kind}),(0,J.jsx)(`span`,{className:X(`min-w-0 truncate`,d&&`text-muted-foreground line-through`),children:l.title})]}),status:l===void 0||c===null?``:`${oD[l.kind].label} ${c+1} of ${s.length}: ${l.title}${d?` (dismissed)`:``}`})},nW={collect:`Collect`,prep:`Prepare`,intent:`Intent`,findings:`Findings`,risk:`Risk`,decisions:`Decisions`},rW={pending:`waiting`,running:`running`,done:`done`,failed:`failed`,skipped:`skipped`},iW={pending:`text-muted-foreground`,running:`text-primary font-medium`,done:`text-review-approved`,failed:`text-destructive font-medium`,skipped:`text-muted-foreground`},aW={pending:`○`,running:`◐`,done:`●`,failed:`✗`,skipped:`–`},oW=({stages:e,shown:t,filesFetched:n})=>(0,J.jsx)(`ol`,{className:`flex flex-wrap gap-x-4 gap-y-1 rounded-lg border bg-surface-subtle px-3 py-2`,"aria-label":`Analysis progress`,children:t.map(t=>{let r=e[t];return(0,J.jsxs)(`li`,{"data-status":r,className:iW[r],children:[(0,J.jsx)(`span`,{"aria-hidden":`true`,children:aW[r]}),` `,nW[t],(0,J.jsxs)(`span`,{className:`sr-only`,children:[`: `,rW[r]]}),t===`collect`&&r===`running`&&n!==null&&(0,J.jsxs)(`span`,{className:`tabular text-muted-foreground`,children:[` `,`· `,n.done,` of `,n.total,` files`]})]},t)})}),sW=e=>nW[e],cW=xu.options.filter(e=>!zu.includes(e)),lW=({legend:e,options:t,value:n,onChange:r})=>(0,J.jsxs)(`fieldset`,{className:`flex items-center gap-1`,children:[(0,J.jsx)(`legend`,{className:`sr-only`,children:e}),t.map(e=>(0,J.jsx)(Bj,{variant:`outline`,size:`sm`,pressed:n===e.value,disabled:e.disabled===!0,onPressedChange:t=>{t&&r(e.value)},children:e.label},e.value))]}),uW=[{value:`comment`,label:`Comment`},{value:`approve`,label:`Approve`},{value:`request_changes`,label:`Request changes`}],dW=`whitespace-pre-wrap wrap-anywhere`,fW=(e,t)=>{let n=t===0?``:` ${t} ${t===1?`comment`:`comments`}`;return e===`comment`?n===``?`Publish the summary`:`Publish${n}`:`Publish${n} and ${e===`approve`?`approve`:`request changes`}`},pW=({analysisId:e,hunkComments:t,isAuthor:n,published:r,onClose:i,onPublished:a})=>{let{client:o}=yp(),s=(0,q.useId)(),[c,l]=(0,q.useState)(``),[u,d]=(0,q.useState)(`comment`),[f,p]=(0,q.useState)(null),[m,h]=(0,q.useState)(null),[g,_]=(0,q.useState)(!1),[v,y]=(0,q.useState)(!1),[b]=(0,q.useState)(()=>qd.parse(crypto.randomUUID())),x=Dp(o.publish);(0,q.useEffect)(()=>{let n=!0;return o.previewPublication(e,{summary:``,hunkComments:t}).then(e=>{n&&(p(e.ok?e.value:null),h(e.ok?null:e.error))}),()=>{n=!1}},[e,o,t]);let S=n?`comment`:u,C=fW(S,f?.comments.length??t.length),w=f!==null&&Jd({...f,verdict:S,summary:c}),T=async n=>{y(n),_(!1);let r=await x.run(e,{publicationId:b,summary:c,allowStale:n,hunkComments:t,verdict:S});r.ok?a(r.value):r.error.code===`stale-analysis`&&(x.reset(),_(!0))};return(0,J.jsxs)(EB,{title:`Publish review`,onClose:i,className:`flex flex-col sm:max-w-2xl`,children:[r&&(0,J.jsx)(`p`,{className:`shrink-0 text-muted-foreground`,children:`Your earlier review is on the pull request. This one posts as another, with its own verdict.`}),m===null?f===null?(0,J.jsx)(`p`,{className:`text-muted-foreground`,children:`Reading the comments…`}):f.comments.length>0&&(0,J.jsx)(`section`,{"data-slot":`publish-comments`,"aria-label":`Comments to post`,tabIndex:0,className:`-mx-4 min-h-12 overflow-y-auto overscroll-contain border-y px-4 py-3 -outline-offset-2`,children:(0,J.jsx)(`ul`,{"aria-label":`Comments`,className:`flex flex-col gap-1.5`,children:f.comments.map(e=>(0,J.jsxs)(`li`,{className:`min-w-0 border-l-2 border-l-review-pending py-0.5 pl-2.5`,children:[(0,J.jsxs)(`code`,{className:`font-mono text-code-compact text-muted-foreground`,children:[e.path,`:`,e.startLine===void 0?e.line:`${e.startLine}–${e.line}`,e.side===`old`?` (old side)`:``]}),(0,J.jsx)(`p`,{className:dW,children:e.body})]},e.key))})}):(0,J.jsxs)(`p`,{className:LN,role:`alert`,children:[`Couldn't read what will be posted. `,Ap(m)]}),(0,J.jsxs)(`div`,{className:`flex shrink-0 flex-col gap-4`,children:[(0,J.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,J.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,J.jsx)(`span`,{className:`text-caption text-muted-foreground`,children:`Verdict`}),(0,J.jsx)(lW,{legend:`Verdict`,options:uW.map(e=>({...e,disabled:n&&e.value!==`comment`})),value:S,onChange:d})]}),n&&(0,J.jsx)(`p`,{className:`text-caption text-muted-foreground`,children:`You opened this pull request, and its author can't approve it or request changes, so your review comments.`})]}),(0,J.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,J.jsx)(`label`,{htmlFor:`${s}-summary`,className:`sr-only`,children:`Summary`}),(0,J.jsx)($O,{id:`${s}-summary`,rows:2,"data-autofocus":!0,placeholder:`Summary (optional)`,value:c,onChange:e=>l(e.target.value)})]}),g?(0,J.jsxs)(`div`,{className:X(RN,`flex flex-col gap-2`),role:`alert`,children:[(0,J.jsx)(`p`,{children:`This PR changed since the analysis. Publish anyway?`}),(0,J.jsxs)(`div`,{className:`flex justify-end gap-2`,children:[(0,J.jsx)($,{variant:`outline`,onClick:()=>_(!1),children:`Cancel`}),(0,J.jsx)($,{onClick:()=>void T(!0),children:`Publish anyway`})]})]}):(0,J.jsxs)(J.Fragment,{children:[x.error!==null&&(0,J.jsxs)(`div`,{className:`rounded-lg border border-review-changes/25 bg-review-changes-bg px-3 py-2 text-review-changes`,role:`alert`,children:[(0,J.jsxs)(`p`,{children:[`Couldn't publish. `,Ap(x.error)]}),(0,J.jsx)(`p`,{className:`text-muted-foreground`,children:`Retrying is safe: comments that were already posted aren't posted again.`})]}),(0,J.jsxs)(`div`,{className:`flex flex-wrap items-center justify-end gap-2`,children:[w&&(0,J.jsx)(`p`,{id:`${s}-nothing`,className:`mr-auto text-caption text-muted-foreground`,children:`Nothing to post yet: write a summary, or approve or request changes.`}),(0,J.jsx)($,{variant:`outline`,onClick:i,children:`Cancel`}),(0,J.jsx)($,{disabled:x.pending||f===null||w,"aria-describedby":w?`${s}-nothing`:void 0,onClick:()=>void T(v),children:x.pending?`Publishing…`:x.error===null?C:`Retry`})]})]})]})]})},mW=({children:e})=>(0,J.jsx)(`aside`,{id:`review-tree-rail`,"aria-label":`Files`,className:`sticky top-[var(--review-bar-h,0px)] -ml-1 flex h-[calc(100vh-var(--review-bar-h,0px))] min-h-0 flex-col gap-2 self-start overflow-hidden p-1`,children:e}),hW=({analysisId:e,family:t,onRemoved:n})=>{let{client:r}=yp(),i=Dp(r.removeModelRun),[a,o]=(0,q.useState)(!1);return(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)($,{variant:`ghost`,size:`xs`,onClick:()=>o(!0),children:`Remove AI review…`}),a&&(0,J.jsxs)(EB,{title:`Remove AI review`,onClose:()=>{o(!1),i.reset()},children:[(0,J.jsxs)(`p`,{className:`text-ui`,children:[t,`'s intent, findings, risks and decisions go, with what you did with them, and the code's analysis is back as it was. Your comments stay. Request AI review runs a model again, the same or another.`]}),i.error!==null&&(0,J.jsxs)(`p`,{className:`rounded-lg border border-review-changes/25 bg-review-changes-bg px-3 py-2 text-review-changes`,role:`alert`,children:[`Couldn't remove it. `,Ap(i.error)]}),(0,J.jsxs)(`div`,{className:`flex justify-end gap-2`,children:[(0,J.jsx)($,{variant:`outline`,"data-autofocus":!0,onClick:()=>o(!1),children:`Cancel`}),(0,J.jsx)($,{variant:`destructive`,disabled:i.pending,onClick:async()=>{let t=await i.run(e);t.ok&&(o(!1),n(t.value))},children:i.pending?`Removing…`:`Remove`})]})]})]})},gW=()=>{let e=(0,q.useRef)(null),[t,n]=(0,q.useState)(!1);return(0,q.useEffect)(()=>{let t=e.current;if(t===null||typeof IntersectionObserver>`u`)return;let r=new IntersectionObserver(([e])=>{e!==void 0&&n(e.intersectionRatio<1&&e.boundingClientRect.top<=0)},{rootMargin:`-1px 0px 0px 0px`,threshold:1});return r.observe(t),()=>r.disconnect()},[]),{bar:e,stuck:t}},_W=({title:e,claude:t,tools:n,publish:r,publication:i,hairline:a,stuck:o})=>{let s=gW(),c=o??s.stuck;return(0,J.jsxs)(`div`,{ref:s.bar,"data-slot":`review-bar`,"data-stuck":c||void 0,className:`sticky top-0 z-20 flex h-(--review-bar-h) min-w-0 items-center gap-3 border-b bg-background`,children:[a!==null&&(0,J.jsx)(`span`,{"data-slot":`model-hairline`,"data-state":a,"aria-hidden":`true`,children:(0,J.jsx)(`span`,{})}),c&&e!==null&&(0,J.jsx)(`span`,{"aria-hidden":`true`,className:`max-w-72 shrink truncate font-semibold max-xl:hidden`,title:e,children:e}),(0,J.jsx)(`div`,{"data-slot":`claude-slot`,className:`flex min-w-0 flex-1 items-center`,children:t}),(0,J.jsx)(`div`,{className:`flex shrink-0 items-center gap-2`,children:n}),i!==null&&(0,J.jsxs)(`p`,{role:`status`,className:`flex shrink-0 items-center gap-1 font-medium text-review-approved`,children:[(0,J.jsx)(`span`,{"aria-hidden":`true`,children:`✓`}),` `,i.url===null?`Published`:(0,J.jsx)(`a`,{href:i.url,target:`_blank`,rel:`noreferrer`,className:`text-review-approved`,children:`Published`})]}),r]})},vW=2,yW=(e,t,n)=>`${e} ${e===1?t:n}`,bW=()=>(0,J.jsx)(`span`,{"aria-hidden":`true`,className:`h-4 w-px shrink-0 bg-border`}),xW=({error:e,onRetry:t})=>(0,J.jsxs)(SM,{children:[(0,J.jsx)(CM,{render:(0,J.jsx)($,{variant:`ghost`,size:`xs`,className:`h-6 px-1.5 font-normal text-muted-foreground`,"data-slot":`status-unavailable`,children:`Status unavailable`})}),(0,J.jsxs)(wM,{align:`end`,children:[(0,J.jsx)(TM,{children:`The PR's status couldn't be read`}),(0,J.jsx)(`p`,{className:`text-muted-foreground`,children:Ap(e)}),(0,J.jsx)($,{variant:`outline`,size:`sm`,className:`self-start`,onClick:t,children:`Try again`})]})]}),SW=({name:e})=>(0,J.jsx)(`code`,{className:`rounded-sm bg-muted px-1 font-mono text-code-compact text-foreground`,children:e}),CW=({view:e,intent:t,totals:n,threads:r,status:i,statusError:a,onRetryStatus:o,now:s,reanalyzing:c,reanalyzeError:l,onReanalyze:u})=>{let{analysis:d,stale:f}=e,{pullRequest:p,warnings:m}=d,{ref:h}=d.key;return(0,J.jsxs)(`header`,{className:`flex flex-col gap-1.5`,children:[(0,J.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-x-4 gap-y-1`,children:[(0,J.jsxs)(`a`,{className:`font-mono text-code-compact`,href:p?.url??hf(h),target:`_blank`,rel:`noreferrer`,children:[h.repo.repo,` #`,h.number]}),(0,J.jsx)(`div`,{"data-slot":`pr-standing`,className:`flex flex-wrap items-center gap-x-3 gap-y-1`,children:[r!==null&&r.threads>0&&(0,J.jsxs)(`span`,{"data-slot":`thread-totals`,className:`tabular text-caption text-muted-foreground`,children:[yW(r.threads,`thread`,`threads`),r.unresolved>0&&` · ${r.unresolved} unresolved`]},`threads`),i===null&&a!==null&&(0,J.jsx)(xW,{error:a,onRetry:o},`unavailable`),i!==null&&(i.checks===null||i.checks.length>0)&&(0,J.jsx)(NM,{checks:i.checks,unreadable:i.checksUnreadable,head:d.key.headSha},`ci`),i!==null&&i.reviewers.length>0&&(0,J.jsx)(zM,{reviewers:i.reviewers},`reviewers`)].filter(e=>e!==!1).flatMap((e,t)=>t===0?[e]:[(0,J.jsx)(bW,{},`before-${e.key}`),e])})]}),(0,J.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-3 gap-y-1`,children:[(0,J.jsx)(`h1`,{className:`min-w-0 text-title font-semibold tracking-[-0.01em] whitespace-pre-line`,children:p?.title??`Collecting the pull request…`}),i!==null&&(0,J.jsxs)(`span`,{className:`flex items-center gap-2`,children:[(0,J.jsx)(DM,{state:i.state}),(0,J.jsx)(OM,{status:i.reviewStatus})]})]}),p!==null&&(0,J.jsxs)(`p`,{"data-slot":`pr-byline`,className:`flex flex-wrap items-center gap-x-1.5 gap-y-1 text-muted-foreground`,children:[(0,J.jsxs)(`span`,{children:[p.author.name,` wants to merge `,(0,J.jsx)(SW,{name:p.sourceBranch}),` `,(0,J.jsx)(`span`,{"aria-hidden":`true`,children:`→`}),` `,(0,J.jsx)(`span`,{className:`sr-only`,children:`into`}),` `,(0,J.jsx)(SW,{name:p.targetBranch})]}),` `,(0,J.jsx)(`span`,{"aria-hidden":`true`,children:`·`}),` `,(0,J.jsxs)(`span`,{children:[`updated `,Ok(p.updatedAt,s)]}),` `,d.stages.prep===`done`&&(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(`span`,{"aria-hidden":`true`,children:`·`}),` `,(0,J.jsxs)(`span`,{className:`tabular`,children:[yW(n.files,`file`,`files`),` `,(0,J.jsxs)(`span`,{className:`font-mono text-code-compact`,children:[(0,J.jsxs)(`span`,{"aria-hidden":`true`,children:[(0,J.jsxs)(`span`,{className:`text-diff-add-fg`,children:[`+`,n.additions]}),` `,(0,J.jsxs)(`span`,{className:`text-diff-del-fg`,children:[`−`,n.deletions]})]}),(0,J.jsxs)(`span`,{className:`sr-only`,children:[`, `,n.additions,` lines added, `,n.deletions,` removed`]})]})]})]})]}),(0,J.jsx)(`div`,{className:`mt-1.5`,children:t}),f&&(0,J.jsxs)(`div`,{role:`status`,className:X(`rounded-lg border border-review-pending/25 bg-review-pending-bg px-3 py-2 text-review-pending`,`flex flex-wrap items-center gap-3`),children:[(0,J.jsx)(`span`,{children:`This PR has new commits since the analysis.`}),(0,J.jsx)($,{variant:`outline`,size:`sm`,disabled:c,onClick:u,children:c?`Starting…`:`Re-analyze`}),l!==null&&(0,J.jsx)(`span`,{className:`text-destructive`,role:`alert`,children:Ap(l)})]}),m.length>0&&m.length<=vW&&(0,J.jsx)(`ul`,{className:`flex flex-col gap-2`,"aria-label":`Warnings`,children:m.map(e=>(0,J.jsxs)(`li`,{className:`rounded-lg border border-review-pending/25 bg-review-pending-bg px-3 py-2 text-review-pending`,children:[(0,J.jsx)(`span`,{"aria-hidden":`true`,children:`⚠ `}),e]},e))}),m.length>vW&&(0,J.jsxs)(`details`,{className:`rounded-lg border border-review-pending/25 bg-review-pending-bg px-3 py-2 text-review-pending`,children:[(0,J.jsxs)(`summary`,{className:`cursor-pointer`,children:[(0,J.jsx)(`span`,{"aria-hidden":`true`,children:`⚠ `}),m.length,` warnings`]}),(0,J.jsx)(`ul`,{className:`mt-1 list-disc pl-5`,children:m.map(e=>(0,J.jsx)(`li`,{children:e},e))})]})]})},wW=e=>`thread-${e}`,TW=e=>`${e.side}:${e.line}`,EW={onLine:new Map,earlier:new Map,elsewhere:[],open:new Map},DW=(e,t,n)=>e.set(t,[...e.get(t)??[],n]),OW=(e,t,n)=>{if(e===null||e.length===0)return EW;let r=new Map(t.map(e=>[e.file.path,e])),i=new Map,a=new Map,o=[],s=new Map;for(let t of e){t.resolved||s.set(t.path,(s.get(t.path)??0)+1);let e=r.get(t.path);if(e===void 0){o.push(t);continue}let{line:c}=t,l=t.outdated||c===null?void 0:e.partIds.find(e=>n.parts.get(e)?.hunk.lines.some(e=>{let n=_j(e);return n!==null&&n.side===t.side&&n.line===c}));if(l===void 0||c===null){DW(a,t.path,t);continue}let u=i.get(l)??new Map;DW(u,TW({side:t.side,line:c}),t),i.set(l,u)}return{onLine:i,earlier:a,elsewhere:o,open:s}},kW=(e,t,n)=>{let r=new Map(e.lines.flatMap(e=>e.kind!==`del`&&e.newLine!==null?[[e.newLine,e.text]]:[])),i=[];for(let e=t;e<=n;e+=1){let t=r.get(e);if(t===void 0)return null;i.push(t)}return i},AW=(e,t,n)=>{let r=[];for(let i of t){for(let t of i.partIds){let i=e.onLine.get(t),a=n.parts.get(t)?.hunk;if(i===void 0||a===void 0)continue;let o=new Set;for(let e of a.lines){let t=_j(e);if(t===null)continue;let n=TW(t);o.has(n)||(o.add(n),r.push(...i.get(n)??[]))}}r.push(...e.earlier.get(i.file.path)??[])}return r.push(...e.elsewhere),r},jW=(e,t,n)=>t===`all`?e:e.filter(e=>!e.resolved||n.has(e.id)),MW=(e,t,n)=>e===null?jW(t,`unresolved`,n).length>0?`unresolved`:`all`:e,NW=(e,t,n,r)=>{if(t.length===0)return null;let i=new Set(t.map(e=>e.id)),a=n===null?-1:e.findIndex(e=>e.id===n);if(a===-1)return(r===1?t[0]:t.at(-1))?.id??null;for(let t=1;t<=e.length;t+=1){let n=e[(a+r*t+e.length*t)%e.length];if(n!==void 0&&i.has(n.id))return n.id}return null},PW=(e,t,n)=>`${e} ${e===1?t:n}`,FW=e=>(e.line??e.originalLine)===null?`the file`:sj(e.outdated?{...e,line:null}:e),IW=e=>{let[t]=e.comments;if(t===void 0)return FW(e);let n=Td(t.body);return`${t.author.name}: ${n===``?`Suggested change`:n}`},LW=(e,t)=>e===`unresolved`?`${t} unresolved`:PW(t,`thread`,`threads`),RW=(e,t,n)=>{if(e.length===0)return null;let r=jW(e,t,n).length;return t===`unresolved`?{count:r,words:[`unresolved`,`unresolved`],label:PW(r,`unresolved thread`,`unresolved threads`)}:{count:r,words:[`thread`,`threads`],label:PW(r,`thread`,`threads`)}},zW=({resolved:e})=>e?(0,J.jsx)(Rh,{"aria-hidden":`true`,className:`size-3.5 shrink-0 text-review-approved`}):(0,J.jsx)(Kg,{"aria-hidden":`true`,className:`size-3.5 shrink-0 text-muted-foreground`}),BW=({ordered:e,scope:t,resolvedHere:n,current:r,onGo:i,onOpenList:a})=>{let o=jW(e,t,n),s=o.findIndex(e=>e.id===r),c=s===-1?null:s,l=c===null?void 0:o[c],u=l===void 0?``:IW(l);return(0,J.jsx)(eW,{slot:`thread-stepper`,noun:`thread`,total:o.length,at:c,count:LW(t,o.length),onStep:t=>{let n=NW(e,o,r,t);n!==null&&i(n)},onOpenList:a,title:l!==void 0&&(0,J.jsxs)(`button`,{type:`button`,"data-slot":`stepper-title`,"data-kind":`thread`,className:`ml-1 flex h-6 min-w-0 items-center gap-1.5 rounded-md px-1 text-left max-sm:hidden hover:bg-muted`,title:`${l.path}, ${FW(l)}`,"aria-label":`Go to thread: ${u}`,onClick:()=>i(l.id),children:[(0,J.jsx)(zW,{resolved:l.resolved}),(0,J.jsx)(`span`,{className:X(`min-w-0 truncate`,l.resolved&&`text-muted-foreground`),children:u})]}),status:l===void 0||c===null?``:`Thread ${c+1} of ${o.length}, ${l.path} ${FW(l)}${l.resolved?`, resolved`:l.outdated?`, outdated`:``}: ${u}`})},VW=({ordered:e,scope:t,onScope:n,onGo:r,onClose:i})=>{let a=e.filter(e=>!e.resolved).length,o=(0,q.useRef)(!1),s=[];for(let t of e){let e=s.at(-1);e?.path===t.path?e.threads.push(t):s.push({path:t.path,threads:[t]})}return(0,J.jsxs)(EB,{title:`${PW(e.length,`thread`,`threads`)}, ${a} unresolved`,onClose:i,returnFocus:()=>!o.current,className:`sm:max-w-2xl`,children:[a>0&&a<e.length&&(0,J.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 text-caption text-muted-foreground`,children:[(0,J.jsx)(`span`,{"aria-hidden":`true`,children:`Previous and Next go round`}),(0,J.jsx)(lW,{legend:`Previous and Next go round`,options:[{value:`unresolved`,label:`Unresolved (${a})`},{value:`all`,label:`All (${e.length})`}],value:t,onChange:n})]}),(0,J.jsx)(`div`,{className:`flex min-w-0 flex-col gap-3`,children:s.map(({path:e,threads:t})=>(0,J.jsxs)(`section`,{"aria-label":e,className:`flex flex-col gap-1`,children:[(0,J.jsx)(`h3`,{className:`truncate px-2 font-mono text-code-compact text-muted-foreground`,children:e}),(0,J.jsx)(`ul`,{className:`flex flex-col gap-1`,children:t.map(e=>(0,J.jsx)(`li`,{children:(0,J.jsxs)(`button`,{type:`button`,"data-slot":`thread-row`,"data-resolved":e.resolved||void 0,className:`flex min-h-7 w-full items-center gap-2 rounded-md px-2 py-1 text-left hover:bg-accent`,onClick:()=>{o.current=!0,r(e.id)},children:[(0,J.jsx)(zW,{resolved:e.resolved}),(0,J.jsx)(`span`,{className:X(`min-w-0 flex-1 truncate`,e.resolved&&`text-muted-foreground`),children:IW(e)}),(e.resolved||e.outdated)&&(0,J.jsx)(`span`,{className:`text-caption text-muted-foreground`,children:e.resolved?`Resolved`:`Outdated`}),(0,J.jsx)(`span`,{className:`shrink-0 text-caption text-muted-foreground`,children:FW(e)})]})},e.id))})]},t[0]?.id??e))})]})},HW=.25,UW=(e,t,n)=>{let r=n?t-1:t*HW;return(e.findLast(e=>e.top<=r)??e[0])?.path??null},WW=()=>{let e=[...document.querySelectorAll(`[aria-label=Changes] [data-slot=file-card][data-path]`)],t=e.map(e=>e.getBoundingClientRect());return t.every(e=>e.height===0)?null:e.map((e,n)=>({path:e.dataset.path??``,top:t[n]?.top??0}))},GW=(e,t)=>{let[n,r]=(0,q.useState)(null),i=e.join(`\0`);return(0,q.useEffect)(()=>{if(!t)return;let e=0,n=()=>{e=0;let t=document.documentElement,n=window.scrollY+window.innerHeight>=t.scrollHeight-2,i=WW();if(i===null)return;let a=UW(i,window.innerHeight,n&&window.scrollY>0);a!==null&&r(a)},i=()=>{e===0&&(e=requestAnimationFrame(n))};return n(),window.addEventListener(`scroll`,i,{passive:!0}),window.addEventListener(`resize`,i),()=>{window.removeEventListener(`scroll`,i),window.removeEventListener(`resize`,i),e!==0&&cancelAnimationFrame(e)}},[i,t]),n},KW=1,qW=240,JW=6,YW=()=>{},XW=e=>{let t=e.left+e.width/2;for(let e=KW;e<Math.min(window.innerHeight,qW);e+=JW){let n=document.elementFromPoint(t,e);if(n===null||n.closest(`[data-slot=file-card-header]`)!==null)continue;let r=n.closest(`[role=row]`);if(r!==null)return r}return null},ZW=e=>{let t=document.querySelector(e)?.getBoundingClientRect();if(window.scrollY<=KW||t===void 0||t.top>=0||typeof document.elementFromPoint!=`function`)return YW;let n=XW(t);if(n===null)return YW;let r=n.getBoundingClientRect().top;return()=>{if(!n.isConnected)return;let e=n.getBoundingClientRect().top-r;e!==0&&window.scrollBy({top:e,behavior:`instant`})}},QW=`[aria-label=Changes]`,$W=e=>{let t=getComputedStyle(document.documentElement).getPropertyValue(e).trim(),n=Number.parseFloat(t);return Number.isFinite(n)?t.endsWith(`ms`)?n:t.endsWith(`s`)?n*1e3:n:0},eG=e=>`✓ ${e} is done`,tG=new Set,nG=new Map,rG=(e,t,n=`Claude`)=>{let[r,i]=(0,q.useState)({running:e,before:tG}),[a,o]=(0,q.useState)(`done`),[s,c]=(0,q.useState)(nG),[l,u]=(0,q.useState)(0);e!==r.running&&(i({running:e,before:e?new Set(t):r.before}),o(e?`done`:`measure`),c(nG),e||u(l+1)),(0,q.useEffect)(()=>{if(l===0||!document.hidden)return;let e=document.title;document.title=`${eG(n)} · ${e}`;let t=()=>{document.hidden||(document.title=e)};return document.addEventListener(`visibilitychange`,t),()=>{document.removeEventListener(`visibilitychange`,t),document.title=e}},[l,n]);let d=(0,q.useRef)(null);(0,q.useLayoutEffect)(()=>{if(a!==`measure`)return;if(d.current=ZW(QW),$W(`--landing-total`)===0){o(`done`);return}let e=new Map;for(let t of document.querySelectorAll(`[data-slot=point-fold][data-fresh]`)){let{top:n}=t.getBoundingClientRect(),r=uu.safeParse(t.dataset.pointId);r.success&&n>=0&&n<window.innerHeight&&e.set(r.data,e.size)}c(e),o(`landing`)},[a]),(0,q.useLayoutEffect)(()=>{a!==`measure`&&d.current!==null&&(d.current(),d.current=null)},[a]),(0,q.useEffect)(()=>{if(a!==`landing`)return;let e=Math.max(0,s.size-1)*$W(`--landing-step-code`),t=setTimeout(()=>o(`done`),$W(`--landing-total`)+e);return()=>clearTimeout(t)},[a,s]);let{before:f}=r,p=(0,q.useCallback)(e=>a!==`done`&&!f.has(e),[a,f]);return{phase:a,running:e||a===`measure`,fresh:p,inView:a===`landing`?s:nG}},iG=(e,t)=>{let{client:n}=yp(),[r,i]=(0,q.useState)(new Map),[a,o]=(0,q.useState)(new Set),[s,c]=(0,q.useState)(null),l=(0,q.useRef)(new Map),u=(0,q.useMemo)(()=>{let e=new Map(t.map(e=>[e.pointId,e.state]));for(let[t,n]of r)e.set(t,n);return e},[t,r]);return{stateOf:(0,q.useCallback)(e=>u.get(e)??`open`,[u]),setState:(0,q.useCallback)(async(t,r)=>{i(e=>new Map(e).set(t,r)),o(e=>new Set(e).add(t));let a=(l.current.get(t)??0)+1;l.current.set(t,a);let s=await n.putPointState(e,t,{state:r});l.current.get(t)===a&&(o(e=>{let n=new Set(e);return n.delete(t),n}),s.ok?c(e=>e?.pointId===t?null:e):(i(e=>{let n=new Map(e);return n.delete(t),n}),c({pointId:t,message:Ap(s.error)})))},[e,n]),isSaving:e=>a.has(e),failure:s,dismissFailure:()=>c(null)}},aG=6e4,oG=e=>{let{client:t}=yp(),[n,r]=(0,q.useState)(null),[i,a]=(0,q.useState)(null),o=(0,q.useRef)(0),s=(0,q.useCallback)(()=>{o.current+=1;let n=o.current;t.getPullRequestStatus(e).then(e=>{n===o.current&&(e.ok?(r(e.value),a(null)):a(e.error))})},[t,e]);(0,q.useEffect)(()=>(s(),window.addEventListener(`focus`,s),()=>window.removeEventListener(`focus`,s)),[s]);let c=n?.checks?.some(e=>e.state===`running`)===!0;return(0,q.useEffect)(()=>{if(!c)return;let e=setInterval(()=>{document.visibilityState===`visible`&&s()},aG);return()=>clearInterval(e)},[c,s]),{status:n,error:i,reload:s}},sG=(e,t)=>{let{client:n}=yp(),[r,i]=(0,q.useState)(null),[a,o]=(0,q.useState)(null),s=(0,q.useRef)(0),c=(0,q.useCallback)(()=>{s.current+=1;let t=s.current;n.getThreads(e).then(e=>{t===s.current&&(e.ok?(i(e.value),o(null)):o(e.error))})},[n,e]);return(0,q.useEffect)(()=>{t&&c()},[t,c]),{list:r,error:a,reload:c,reply:(0,q.useCallback)(async(t,r)=>{let i=await n.replyToThread(e,t,{body:r});return i.ok?(c(),null):Ap(i.error)},[n,e,c]),resolve:(0,q.useCallback)(async(t,r)=>{let i=await n.resolveThread(e,t,{resolved:r});return i.ok?(c(),null):Ap(i.error)},[n,e,c]),post:(0,q.useCallback)(async t=>{let r=await n.postComment(e,t);return r.ok?(c(),null):Ap(r.error)},[n,e,c])}},cG=[],lG=e=>Wd.array().safeParse(e).data,uG=({analysisId:e})=>{let[t,n]=(0,q.useState)({count:0,seed:null}),r=(0,q.useCallback)((e=null)=>n(({count:t})=>({count:t+1,seed:e})),[]);return(0,J.jsx)(dG,{analysisId:e,seed:t.seed,restart:r},`${e}/${t.count}`)},dG=({analysisId:e,seed:t,restart:n})=>{let{view:r,error:i,refetch:a,follow:o}=Ep(e,t);return r===null?i?.code===`not-found`?(0,J.jsxs)(`div`,{className:`mx-auto flex max-w-2xl flex-col gap-3 py-12`,children:[(0,J.jsx)(`h1`,{className:`text-title font-semibold tracking-[-0.01em]`,children:`Analysis not found`}),(0,J.jsx)(`p`,{className:`text-body`,children:Ap(i)}),(0,J.jsx)(`p`,{children:(0,J.jsx)(N_,{to:`/`,children:`Pick a pull request to review`})})]}):i===null?(0,J.jsx)(fG,{}):(0,J.jsxs)(`div`,{className:`mx-auto flex max-w-2xl flex-col items-start gap-3 py-12`,children:[(0,J.jsxs)(`p`,{className:LN,role:`alert`,children:[`Couldn't load the analysis. `,Ap(i)]}),(0,J.jsx)($,{variant:`outline`,onClick:()=>void a(),children:`Try again`})]}):(0,J.jsx)(TG,{view:r,refetch:a,follow:o,restart:n})},fG=()=>(0,J.jsxs)(`div`,{className:`mx-auto flex max-w-[1600px] flex-col gap-4`,role:`status`,"aria-busy":`true`,"aria-label":`Loading the analysis`,children:[(0,J.jsx)(zN,{className:`h-7 w-2/3`}),(0,J.jsx)(zN,{className:`h-4 w-1/2`}),(0,J.jsxs)(`div`,{className:pG,children:[(0,J.jsx)(UN,{}),(0,J.jsx)(HN,{})]})]}),pG=`grid items-start gap-5 lg:grid-cols-[17rem_minmax(0,1fr)]`,mG=[],hG=[{value:`map`,label:`Map`},{value:`overview`,label:`Overview`}],gG=[`nextFile`,`previousFile`,`comment`,`openCall`,`moveFile`,`openFile`,`toggleLayout`,`openReview`,`close`,`help`],_G=({analysis:e})=>{let{checkout:t,pullRequest:n}=e;if(t===`read`||n===null)return null;let{ref:r,headSha:i}=n;return(0,J.jsxs)(`p`,{"data-slot":`checkout-note`,className:`text-muted-foreground`,children:[`Code outside the pull request that calls what it changes isn't shown:`,` `,t===`missing-commit`?(0,J.jsxs)(J.Fragment,{children:[`the local checkout doesn't have the head commit`,` `,(0,J.jsx)(`code`,{className:`rounded-sm bg-muted px-1 font-mono text-code-compact`,children:i.slice(0,7)}),`. Run`,` `,(0,J.jsx)(`code`,{className:`rounded-sm bg-muted px-1 font-mono text-code-compact`,children:`git fetch`}),` in it`,r.repo.host===`github`&&(0,J.jsxs)(J.Fragment,{children:[`, or`,` `,(0,J.jsxs)(`code`,{className:`rounded-sm bg-muted px-1 font-mono text-code-compact`,children:[`git fetch origin pull/`,r.number,`/head`]}),` `,`for a pull request from a fork`]}),`, then open the pull request again.`]}):(0,J.jsxs)(J.Fragment,{children:[`megareviewer didn't run in a checkout of `,r.repo.owner,`/`,r.repo.repo,`. Start it in one, or pass`,` `,(0,J.jsx)(`code`,{className:`rounded-sm bg-muted px-1 font-mono text-code-compact`,children:`--checkout <dir>`}),`, then open the pull request again.`]})]})},vG=[],yG=(e,t)=>{let[n,r]=(0,q.useState)(e);return!t&&n!==e&&r(e),t?n:e},bG=(e,t)=>{let{lines:n}=e;if(n===null)return null;let r=null,i=null;for(let[e,a]of t.lines.entries()){let t=_j(a);t!==null&&t.side===n.side&&(t.line<n.startLine||t.line>n.line||(r??=e,(i===null||t.line>i.line)&&(i={line:t.line,at:e})))}return r===null||i===null?null:{key:`${n.side}:${i.line}`,rows:i.at-r+1}},xG={github:void 0,bitbucket:`Bitbucket can't anchor a range, so the comment goes on the last line and names them.`},SG=new WeakMap,CG=0,wG=e=>{let t=SG.get(e);return t===void 0?(CG+=1,SG.set(e,CG),CG):t},TG=({view:e,refetch:t,follow:n,restart:r})=>{let{client:i}=yp(),a=tL(Sp().status?.model??null),{analysis:o,publication:s}=e,c=o.id,l=o.status===`complete`,u=l&&Bu(o),d=yG(o,u),f=Dp(i.runModel),p=s!==null||!l,m=(0,q.useMemo)(()=>rH(d),[d]),h=(0,q.useMemo)(()=>aH(d,m),[d,m]),g=(0,q.useMemo)(()=>oH(d,m),[d,m]),_=(0,q.useMemo)(()=>g.flatMap(e=>e.partIds),[g]),v=(0,q.useMemo)(()=>dH(d,m),[d,m]),y=uH(v),[b,x]=JI(`decisions`,!1,YI),S=(0,q.useMemo)(()=>hu(d).filter(e=>b||e.kind!==`decision`),[d,b]),C=(0,q.useMemo)(()=>S.map(e=>e.id),[S]),w=iG(c,e.pointReviews),[T,E]=(0,q.useState)(new Set),{stateOf:D}=w,O=(0,q.useMemo)(()=>new Set(S.filter(e=>e.guidance?.effect===`left-out`&&D(e.id)===`open`&&!T.has(e.id)).map(e=>e.id)),[S,D,T]),k=(0,q.useMemo)(()=>S.filter(e=>!O.has(e.id)),[S,O]),A=(0,q.useCallback)(e=>E(t=>new Set(t).add(e)),[]),j=Rl(o.modelOption??a.chosen),M=rG(u,C,j),N=(0,q.useMemo)(()=>cH(S,_,m),[S,_,m]),P=(0,q.useMemo)(()=>{let e=new Map,t=new Map,n=new Map,r=new Map,i=(e,t,n,r)=>{let i=e.get(t)??new Map;i.set(n,[...i.get(n)??[],r]),e.set(t,i)};for(let[a,o]of N.cards){let s=m.parts.get(a);for(let c of o){let o=s===void 0?null:bG(c,s.hunk);o===null?n.set(a,[...n.get(a)??[],c]):c.kind===`decision`?i(t,a,o.key,c):(i(e,a,o.key,c),r.set(c.id,o.rows))}}for(let t of e.values())for(let[e,n]of t)t.set(e,[...n.filter(e=>e.kind===`finding`),...n.filter(e=>e.kind!==`finding`)]);return{underLine:e,atLineEnd:t,underHeader:n,rowsAbove:r}},[N,m]),F=(0,q.useMemo)(()=>{let e=new Map,t=t=>{let[n]=t;for(let r of t)n!==void 0&&e.set(r.id,n.id)};for(let e of P.underLine.values())for(let n of e.values())t(n);for(let[e,n]of P.underHeader)t([...n,...N.mentions.get(e)??mG]);for(let[e,n]of N.mentions)P.underHeader.has(e)||t(n);return t(N.unplaced),e},[P,N]),{inView:I}=M,L=(0,q.useCallback)(e=>I.get(F.get(e)??e),[I,F]),R=(0,q.useMemo)(()=>{let e=new Map;for(let[t,n]of N.cards){let r=m.parts.get(t)?.file.path;if(r===void 0)continue;let i=n.filter(e=>!O.has(e.id));if(i.length===0)continue;let a=e.get(r)??{};for(let e of i)a[e.kind]=(a[e.kind]??0)+1;e.set(r,a)}return e},[N,m,O]),ee=(0,q.useMemo)(()=>g.map(({file:e})=>({path:e.path,status:e.status,additions:e.additions,deletions:e.deletions,...R.has(e.path)?{points:R.get(e.path)}:{}})),[g,R]),[z,te]=(0,q.useState)([]),B=(0,q.useMemo)(()=>$B(d,h,new Set(z)),[d,h,z]),ne=(0,q.useMemo)(()=>d.stages.prep===`done`?nV($B(d,h)):null,[d,h]),[V,H]=JI(`review-layout`,`map`,eH),re=GW((0,q.useMemo)(()=>g.map(e=>e.file.path),[g]),V===`map`&&d.stages.prep===`done`),[ie,ae]=(0,q.useState)(!1),oe=(0,q.useMemo)(()=>{let e=new Map;for(let t of d.unchangedCallers)e.set(t.partId,[...e.get(t.partId)??[],t]);return e},[d.unchangedCallers]),se=(0,q.useCallback)(e=>oe.get(e)??vG,[oe]),[U]=(0,q.useState)(Dj),ce=(0,q.useMemo)(()=>pV(d.callSites,m,U),[d.callSites,m,U]),le=(0,q.useCallback)(e=>ce.get(e),[ce]),ue=(0,q.useMemo)(()=>new Map(S.flatMap(e=>{let t=mV(e,m);return t===null?[]:[[e.id,{handle:U,payload:t}]]})),[S,m,U]),[de,fe]=(0,q.useState)(null),[pe,me]=(0,q.useState)(null),he=(0,q.useRef)(null),[ge,_e]=(0,q.useState)(null),[ve,ye]=(0,q.useState)(null),[be,xe]=(0,q.useState)(null),[Se,Ce]=(0,q.useState)(null),[we,Te]=(0,q.useState)(null),[Ee,De]=(0,q.useState)(new Set),[Oe,ke]=(0,q.useState)(!1),Ae=be===`thread`||k.length===0,je=Ae?null:ve,[Me,Ne]=(0,q.useState)(!1),[Pe,Fe]=(0,q.useState)(new Set),Ie=(0,q.useCallback)(e=>Fe(t=>{let n=new Set(t);return n.delete(e)||n.add(e),n}),[]),[Le,Re]=(0,q.useState)(null),[ze,Be]=(0,q.useState)(new Set),[Ve,He]=(0,q.useState)(null),[W,Ue]=(0,q.useState)(!1),[We,Ge]=(0,q.useState)(!1),Ke=(0,q.useRef)(!0),[qe,Je]=(0,q.useState)(!1),[Ye,Xe]=JI(`hunk-comments:${c}`,cG,lG),[Ze,Qe]=(0,q.useState)(null),$e=(0,q.useRef)(null),et=(0,q.useMemo)(()=>fH(Ye,m),[Ye,m]),tt=(0,q.useCallback)(e=>et.get(e)??cG,[et]),nt=(0,q.useCallback)((e,t)=>Xe(n=>{let r=rl(e),i=e=>e.hunkId===r&&e.side===t.side&&e.line===t.line,a={hunkId:r,...t},o=t.body===``&&t.suggestion===void 0;return n.some(i)?o?n.filter(e=>!i(e)):n.map(e=>i(e)?a:e):o?n:[...n,a]}),[Xe]),rt=(0,q.useCallback)((e,t)=>{$e.current=null,Qe(n=>{if(t?.startLine!==void 0&&n!==null&&n.partId===e){let r=rl(e),i=n.place;Xe(e=>e.map(e=>e.hunkId===r&&e.side===i.side&&e.line===i.line?{...e,line:t.line,startLine:t.startLine}:e))}return t===null?null:{partId:e,place:t}})},[Xe]),{setState:it}=w,at=(0,q.useCallback)((e,t)=>{let n=$e.current;$e.current=null,n!==null&&n.partId===e&&n.place.side===t.side&&n.place.line===t.line&&(nt(e,n.before??{...n.place,body:``}),n.state!==`raised`&&it(n.pointId,n.state))},[nt,it]),ot=sG(c,d.stages.prep===`done`),st=oG(c),{post:ct}=ot,lt=(0,q.useCallback)((e,t)=>ct({hunkId:rl(e),...t}),[ct]),ut=(0,q.useMemo)(()=>OW(ot.list?.threads??null,g,m),[ot.list,g,m]),dt=(0,q.useMemo)(()=>AW(ut,g,m),[ut,g,m]),ft=MW(we,dt,Ee),pt=Ae?Se:null,{resolve:mt}=ot,ht=(0,q.useCallback)(async(e,t)=>{let n=await mt(e,t);return n===null&&t&&De(t=>new Set(t).add(e)),n},[mt]),gt=d.pullRequest?.author.id??null,_t=(e,t)=>(0,J.jsx)(lj,{thread:e,authorId:gt,now:Date.now(),language:TD({path:e.path,language:null}),covered:t,mediaUrl:e=>i.attachmentUrl(c,e),onReply:t=>ot.reply(e.id,t),onResolve:t=>ht(e.id,t),current:pt===e.id,anchorId:wW(e.id),linesAbove:t?.length??0},e.id),vt=(e,t)=>{let n=ut.onLine.get(e)?.get(TW(t));if(n===void 0)return null;let r=m.parts.get(e)?.hunk;return n.map(e=>{let n=e.startLine??t.line;return _t(e,r===void 0?null:kW(r,Math.min(n,t.line),t.line))})},yt=e=>{let t=ut.earlier.get(e);return t===void 0?null:t.map(e=>(0,J.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,J.jsx)(`span`,{className:`text-caption text-muted-foreground`,children:e.outdated?`Was on ${e.side===`old`?`old `:``}line ${e.originalLine??`?`}; the code has changed since`:`On ${sj(e)}, which the diff doesn't show`}),_t(e,null)]},e.id))},bt=e=>ut.open.get(e)??0,xt=(0,q.useMemo)(()=>ee.map(e=>({...e,threads:ut.open.get(e.path)??0})),[ee,ut]),St=e=>He(t=>({id:e,n:(t?.n??0)+1})),Ct=()=>V===`overview`?null:de,wt=(0,q.useCallback)(e=>fe(e),[]),Tt=e=>{B.placeOf.has(e)&&me(t=>({key:e,n:(t?.n??0)+1}))},Et=(e,t=V)=>{if(t===`overview`){let t=m.parts.get(e)?.file.path;t!==void 0&&Tt(t)}else St(_.includes(e)?hV(e):hH)},Dt=e=>{let t=S.find(t=>t.id===e),n=N.cardPart.get(e);t?.kind===`decision`&&Fe(t=>new Set([...t,e])),O.has(e)&&A(e),be===`thread`&&xe(null),Be(new Set((t?.hunkIds??[]).flatMap(m.partsOf))),V===`overview`?n!==void 0&&Et(n):St(gU(e)),ye(e)},Ot=e=>{xe(`thread`),Ce(e),Be(new Set),V===`overview`&&H(()=>`map`),St(wW(e))},kt=e=>{if(xe(e),e===`thread`){let e=jW(dt,ft,Ee),[t]=e;t!==void 0&&!e.some(e=>e.id===Se)&&Ot(t.id);return}let t=XU(k,e,ve);t!==null&&Dt(t)},At=e=>{let t=uu.parse(`m${e+1}`),n=d.findings.find(t=>t.mismatch===`m${e+1}`);Dt(S.some(e=>e.id===t)||n===void 0?t:uu.parse(n.id))},jt=()=>{let e=(document.activeElement?.closest(`[aria-label=Changes] [data-slot=file-card]`))?.dataset.path??re;H(()=>`overview`),_e(null),e!==null&&Tt(e)},Mt=e=>{let[t]=e.kind===`outside`?[]:e.paths,n=t===void 0?e.partIds[0]:g.find(e=>e.file.path===t)?.partIds[0];n!==void 0&&(H(()=>`map`),_e(e.key),fe(n),t===void 0?Et(n,`map`):St(gH(t)))},Nt=()=>{if(V===`map`)return jt();let e=[...B.rows.flat(),...B.strip].find(e=>e.key===he.current);if(e!==void 0&&e.kind!==`outside`)return Mt(e);H(()=>`map`)};Ip({label:`Layout`,options:hG,value:V,onChange:e=>{e!==V&&Nt()},toggle:{label:`Decisions`,checked:b,onChange:e=>x(()=>e)}});let Pt=e=>{let t=[...document.querySelectorAll(`[aria-label=Changes] [data-slot=file-card]`)],n=t.findIndex(e=>e.contains(document.activeElement)),r=n===-1?e===1?t.find(e=>e.getBoundingClientRect().top>1):t.findLast(e=>e.getBoundingClientRect().top<-1):t[n+e];r!==void 0&&St(r.id)},Ft=(e,t=!1)=>{let n=N.cardPart.get(e.id),r=n===void 0?void 0:m.parts.get(n);if(p||n===void 0||r===void 0)return;let i=e.lines===null?null:{side:e.lines.side,line:e.lines.line,...e.lines.startLine===e.lines.line?{}:{startLine:e.lines.startLine}},a=r.hunk.lines.find(e=>e.kind!==`context`),o=i??(a===void 0?null:_j(a));if(o===null)return;let s=e.explanation===``?e.title:`${e.title}\n\n${e.explanation}`,c=rl(n),l=Ye.find(e=>e.hunkId===c&&e.side===o.side&&e.line===o.line),u={...e.suggestion===null?{}:{suggestion:e.suggestion}};l===void 0?nt(n,{...o,body:s,...u}):w.stateOf(e.id)!==`raised`&&!l.body.includes(s)&&nt(n,{...u,...l,body:l.body===``?s:`${l.body}\n\n${s}`}),ye(e.id);let d=w.stateOf(e.id);if(w.setState(e.id,`raised`),t)return;let{startLine:f}=l??o,h={side:o.side,line:o.line,...f===void 0?{}:{startLine:f}};Qe({partId:n,place:h}),$e.current={partId:n,place:h,before:l,pointId:e.id,state:d},St(hV(n))},It=()=>{let e=Ct(),t=e===null?void 0:m.parts.get(e),n=t?.hunk.lines.find(e=>e.kind!==`context`);if(!l||t===void 0||n===void 0)return;let r=_j(n);r!==null&&e!==null&&($e.current=null,Qe({partId:e,place:r}))},Lt=()=>{let e=document.activeElement;if(!(e instanceof HTMLElement))return;let t=[...(e.closest(`[role=row]`)??e.closest(`[data-slot=hunk-card]`)??e.closest(`[data-slot=file-card]`))?.querySelectorAll(`[data-slot=call]`)??[]],n=t[(t.findIndex(e=>e.hasAttribute(`data-popup-open`))+1)%t.length];n!==void 0&&U.open(n.id)},Rt=()=>{if(ze.size>0)return Be(new Set);V===`map`&&ge!==null&&(H(()=>`overview`),me(e=>({key:ge,n:(e?.n??0)+1})),_e(null))},zt=l;_k({...V===`map`?{nextFile:()=>Pt(1),previousFile:()=>Pt(-1),comment:It,openCall:Lt,close:Rt}:{},toggleLayout:()=>Nt(),openReview:()=>{zt&&Wt()},help:()=>Ge(!0)},!W&&!We&&!qe);let Bt=d.pullRequest?.url??hf(d.key.ref),Vt=Dp(i.startAnalysis),Ht=Dp(i.retryAnalysis),Ut=e=>{e===c?r():A_(D_(e))},Wt=()=>Ue(!0),Gt=Ye.length,Kt=(0,q.useMemo)(()=>pH(d.files),[d.files]),qt=w.failure===null?``:S.find(e=>e.id===w.failure?.pointId)?.title??``,Jt=async(e,t)=>{let n=await i.addPreference({...t,source:`learned`});return n.ok?(w.setState(e.id,`dismissed`),null):dL(n.error)},Yt=e=>({state:w.stateOf(e.id),saving:w.isSaving(e.id),readOnly:p,current:je===e.id,onRaise:ln.raisePoint,onState:ln.setPointState,leftOut:O.has(e.id),onShow:A,ruleScopes:dn,onRule:ln.saveRule}),Xt=(e,t)=>{let n=t===null?void 0:m.parts.get(t),r=e.lines,i=t!==null&&r!==null&&tt(t).some(e=>e.side===r.side&&e.line===r.line);return(0,J.jsx)(RU,{point:e,...Yt(e),linesAbove:P.rowsAbove.get(e.id)??0,inReview:i,removed:n===void 0||r===null||r.side===`old`?null:kW(n.hunk,r.startLine,r.line),language:n===void 0?null:TD(n.file)},e.id)},Zt=e=>(0,J.jsx)(VU,{point:e,...Yt(e),linesAbove:P.rowsAbove.get(e.id)??0,test:ue.get(e.id)??null},e.id),Qt=e=>(0,J.jsx)(UU,{point:e,...Yt(e)},e.id),$t=(e,t=null)=>e.kind===`finding`?Xt(e,t):e.kind===`risk`?Zt(e):Qt(e),en=(0,q.useMemo)(()=>{let e={finding:0,risk:1,decision:2},t=new Map;for(let[n,r]of N.cards){let i=new Map;for(let t of r){if(t.lines===null||t.kind===`decision`||O.has(t.id))continue;let{side:n,startLine:r,line:a}=t.lines,o=L(t.id);for(let s=r;s<=a;s+=1){let c=`${n}:${s}`,l=i.get(c);l!==void 0&&e[t.kind]>=e[l.kind]||i.set(c,{kind:t.kind,...o===void 0?{}:{landing:{at:o,line:s-r,lines:a-r+1}}})}}i.size>0&&t.set(n,i)}return t},[N,L,O]),tn=(0,q.useCallback)(e=>en.get(e),[en]),nn=(e,t,n)=>{let[r]=e;return r===void 0?null:(0,J.jsx)(GU,{pointId:r.id,fresh:e.some(e=>M.fresh(e.id)),at:L(r.id),...t,children:n},r.id)},rn=e=>{let t=P.underHeader.get(e)??mG,n=N.mentions.get(e)??mG;return nn([...t,...n],{bodyClassName:`flex flex-col gap-2 border-b bg-surface-subtle p-3`},(0,J.jsxs)(J.Fragment,{children:[t.map(t=>$t(t,e)),n.map(e=>(0,J.jsx)(WU,{point:e,onGo:ln.goToPoint},e.id))]}))},an=(e,t)=>{let n=TW(t),r=P.underLine.get(e)?.get(n)??mG,i=(P.atLineEnd.get(e)?.get(n)??mG).filter(e=>Pe.has(e.id));return(0,J.jsxs)(J.Fragment,{children:[nn(r,{row:!0,className:vj,bodyClassName:`flex max-w-3xl flex-col gap-2 py-2 pr-3 pl-29 font-sans`},r.map(t=>$t(t,e))),i.length>0&&(0,J.jsx)(bj,{inset:!0,children:(0,J.jsx)(`div`,{className:`flex flex-col gap-1`,children:i.map(Qt)})})]})},on=(e,t)=>{let n=P.atLineEnd.get(e)?.get(TW(t));return n===void 0?null:n.map(e=>(0,J.jsx)(HU,{point:e,state:w.stateOf(e.id),open:Pe.has(e.id),current:je===e.id,onToggle:Ie},e.id))},sn=(0,q.useCallback)(e=>{let t=P.underLine.get(e);if(t===void 0)return;let n=[...t].filter(([,e])=>e.some(e=>e.kind===`finding`&&!O.has(e.id)));return new Set(n.map(([e])=>e))},[P,O]),cn=(0,q.useRef)({goToPoint:Dt,raisePoint:Ft,saveRule:Jt});cn.current={goToPoint:Dt,raisePoint:Ft,saveRule:Jt};let ln=(0,q.useMemo)(()=>({goToPoint:e=>cn.current.goToPoint(e),raisePoint:(e,t)=>cn.current.raisePoint(e,t),saveRule:(e,t)=>cn.current.saveRule(e,t),setPointState:w.setState}),[w.setState]),un=d.key.ref.repo,dn=(0,q.useMemo)(()=>yB([un]).reverse(),[un]),fn=e=>{let t=[wG(d),p,ze.has(e),Ze?.partId===e?`${Ze.place.side}${Ze.place.line}`:``,...tt(e).map(e=>JSON.stringify(e))];ut.onLine.has(e)&&t.push(wG(ut),pt??``);let n=N.cards.get(e)??mG,r=N.mentions.get(e)??mG;for(let e of n)t.push(e.id,w.stateOf(e.id),w.isSaving(e.id)),t.push(je===e.id,O.has(e.id)),e.kind===`decision`&&t.push(Pe.has(e.id));for(let e of r)t.push(e.id);for(let e of[...n,...r])t.push(M.fresh(e.id),L(e.id)??``);return t.join(`\0`)},pn={index:m,unchangedOf:se,highlighted:ze,commentsOf:tt,openComment:Ze,onOpenComment:rt,onCancelComment:at,onComment:l?nt:void 0,...l?{onCommentNow:lt}:{},onFocusHunk:wt,marksOf:le,pointsOn:rn,pointsAt:an,pointsAtEnd:on,flaggedOf:sn,pointLinesOf:tn,threadsAt:vt,earlierThreads:yt,openThreads:bt,...xG[d.key.ref.repo.host]===void 0?{}:{rangeNote:xG[d.key.ref.repo.host]}},mn=(0,J.jsx)(J.Fragment,{children:N.unplaced.length>0&&(0,J.jsx)(`section`,{"aria-label":`Points on no change shown here`,children:nn(N.unplaced,{bodyClassName:`flex flex-col gap-2`},N.unplaced.map(e=>$t(e)))})});return(0,J.jsxs)(`div`,{"data-slot":`review-page`,"data-layout":V,"data-landing":M.phase,className:`mx-auto flex max-w-[1600px] flex-col gap-4`,children:[(0,J.jsx)(CW,{view:e,intent:(0,J.jsx)(OV,{analysis:o,through:ne,running:M.running,onDetails:()=>{Ke.current=!0,Je(!0)}}),totals:Kt,threads:ot.list===null?null:mH(ot.list.threads),status:st.status,statusError:st.error,onRetryStatus:st.reload,now:Date.now(),reanalyzing:Vt.pending,reanalyzeError:Vt.error,onReanalyze:async()=>{let e=await Vt.run({url:Bt});e.ok&&Ut(e.value.analysisId)}}),(0,J.jsx)(_W,{title:o.pullRequest?.title??null,claude:(0,J.jsx)(dV,{analysis:o,choice:a,running:M.running,startedAt:Le,starting:f.pending,error:f.error===null?null:Ap(f.error),points:k,leftOut:O.size,threads:RW(dt,ft,Ee),narrowed:be,onNarrow:kt,onRun:async()=>{let e=a.chosen?.id;(await f.run(c,e===void 0?{}:{optionId:e})).ok&&(Re(Date.now()),n())},children:Ae?dt.length>0&&(0,J.jsx)(BW,{ordered:dt,scope:ft,resolvedHere:Ee,current:Se,onGo:Ot,onOpenList:()=>ke(!0)}):(0,J.jsx)(tW,{points:k,current:ve,stateOf:w.stateOf,kind:be,onGo:Dt,onOpenList:()=>Ne(!0)})}),tools:V===`map`&&(0,J.jsx)($,{variant:`outline`,size:`sm`,className:`lg:hidden`,"aria-expanded":ie,"aria-controls":`review-tree-rail`,onClick:()=>ae(!ie),children:ie?`Hide files`:`Show files`}),publish:zt&&(0,J.jsxs)($,{size:`sm`,"data-slot":`publish-button`,className:`shrink-0`,onClick:()=>void Wt(),children:[`Publish review…`,Gt>0&&(0,J.jsxs)(`span`,{className:`tabular rounded-full bg-primary-foreground px-1.5 text-caption text-primary`,children:[Gt,(0,J.jsx)(`span`,{className:`sr-only`,children:` to post`})]})]}),publication:s,hairline:M.running?`running`:M.phase===`landing`?`finishing`:null}),!l&&(0,J.jsx)(oW,{stages:o.stages,shown:cW,filesFetched:o.filesFetched}),o.error!==null&&(0,J.jsxs)(`div`,{className:X(`rounded-lg border border-review-changes/25 bg-review-changes-bg px-3 py-2 text-review-changes`,`flex flex-col items-start gap-2`),role:`alert`,children:[(0,J.jsxs)(`p`,{children:[`The analysis failed at the `,sW(o.error.stage).toLowerCase(),` stage:`,` `,o.error.message]}),Ht.error!==null&&(0,J.jsxs)(`p`,{children:[`Couldn't retry. `,Ap(Ht.error)]}),(0,J.jsx)($,{variant:`outline`,size:`sm`,disabled:Ht.pending,onClick:async()=>{let e=await Ht.run(c);e.ok&&Ut(e.value.analysisId)},children:Ht.pending?`Retrying…`:`Retry`})]}),w.failure!==null&&(0,J.jsxs)(`div`,{className:X(`rounded-lg border border-review-changes/25 bg-review-changes-bg px-3 py-2 text-review-changes`,`flex flex-wrap items-center justify-between gap-2`),role:`alert`,children:[(0,J.jsxs)(`p`,{children:[`Couldn't save what you did with “`,qt,`”. `,w.failure.message]}),(0,J.jsx)($,{variant:`ghost`,size:`sm`,onClick:w.dismissFailure,children:`Dismiss`})]}),ot.error!==null&&(0,J.jsxs)(`div`,{role:`status`,className:X(`rounded-lg border border-review-pending/25 bg-review-pending-bg px-3 py-2 text-review-pending`,`flex flex-wrap items-center gap-3`),children:[(0,J.jsxs)(`span`,{children:[(0,J.jsx)(`span`,{"aria-hidden":`true`,children:`⚠ `}),`Couldn't read the comments on the pull request. `,Ap(ot.error)]}),(0,J.jsx)($,{variant:`outline`,size:`sm`,onClick:ot.reload,children:`Try again`})]}),d.stages.prep===`done`?V===`map`?(0,J.jsxs)(`div`,{className:X(pG,`[&>aside]:hidden lg:[&>aside]:flex`,ie&&`[&>aside]:flex`),children:[(0,J.jsx)(mW,{children:(0,J.jsx)(oF,{files:xt,activePath:re,onSelect:e=>St(gH(e)),className:`min-h-0 flex-1`})}),(0,J.jsx)(xH,{analysis:d,files:g,deps:pn,before:mn,after:ut.elsewhere.length>0&&(0,J.jsxs)(`section`,{"aria-label":`Comments on other files`,className:`flex flex-col gap-2 rounded-lg border bg-surface-subtle p-3`,children:[(0,J.jsx)(`h2`,{className:`text-caption font-medium text-muted-foreground`,children:`Comments on files without a card here`}),ut.elsewhere.map(e=>(0,J.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,J.jsx)(`span`,{className:`font-mono text-code-compact`,children:e.path}),_t(e,null)]},e.id))]}),trailingProofs:v,mechanicalCount:y,scrollRequest:Ve,signatureOf:fn})]}):(0,J.jsx)(`div`,{children:(0,J.jsx)(mU,{overview:B,focusKey:pe,currentPath:re,onOpen:Mt,onExpand:e=>te(t=>[...t,e]),expandedGroups:z,onCollapse:e=>te(t=>t.filter(t=>t!==e)),onFocusNode:e=>{he.current=e}})}):(0,J.jsx)(`section`,{"aria-busy":d.status===`running`,children:(0,J.jsx)(`p`,{className:`text-muted-foreground`,children:d.status===`running`?`Reading the diff…`:`The diff couldn't be read, so there are no changes to show.`})}),(0,J.jsxs)(`footer`,{className:`flex items-center justify-end gap-3`,children:[(0,J.jsx)(zH,{calls:o.modelCalls,option:o.modelOption,guidance:o.guidance,leftOut:S.filter(e=>e.guidance?.effect===`left-out`).length}),l&&!u&&Hu(o)&&(0,J.jsx)(hW,{analysisId:c,family:j,onRemoved:t=>r({...e,...t})}),(0,J.jsx)(NH,{usage:o.usage,option:o.modelOption,guidance:o.guidance})]}),W&&(0,J.jsx)(pW,{analysisId:c,hunkComments:Ye,isAuthor:e.isAuthor,published:s!==null,onClose:()=>Ue(!1),onPublished:()=>{Ue(!1),Xe(()=>[]),ot.reload(),st.reload(),t()}}),Oe&&(0,J.jsx)(VW,{ordered:dt,scope:ft,onScope:Te,onGo:e=>{ke(!1),Ot(e)},onClose:()=>ke(!1)}),Me&&(0,J.jsx)(qU,{points:k,family:j,kind:be===`thread`?null:be,stateOf:w.stateOf,onGo:e=>{Ne(!1),Dt(e)},onClose:()=>Ne(!1)}),(0,J.jsx)($N,{open:We,onOpenChange:Ge,ids:gG}),(0,J.jsx)(kj,{handle:U,onGoTo:e=>St(hV(e))}),qe&&(0,J.jsxs)(EB,{title:d.intent===null?`What was asked`:`Intent`,onClose:()=>Je(!1),className:`sm:max-w-4xl`,returnFocus:()=>Ke.current,children:[d.intent===null?d.pullRequest!==null&&(0,J.jsx)(AV,{pullRequest:d.pullRequest,tickets:d.tickets,missingTicketKeys:d.missingTicketKeys}):(0,J.jsx)(zV,{intent:d.intent,tickets:d.tickets,missingTicketKeys:d.missingTicketKeys,onSelectMismatch:e=>{Ke.current=!1,Je(!1),At(e)}}),(0,J.jsx)(_G,{analysis:d})]}),(0,J.jsxs)(`p`,{className:`flex items-center gap-1.5 text-caption text-muted-foreground`,children:[`Press `,(0,J.jsx)(bk,{id:`help`}),` for keyboard shortcuts.`]})]})},EG={theme:`megareviewer:theme`,diffPalette:`megareviewer:diffPalette`},DG=`(prefers-color-scheme: dark)`,OG=e=>e===`light`||e===`dark`?e:`system`,kG=e=>e===`cb`?`cb`:`default`,AG=(e,t)=>e===`system`?t?`dark`:`light`:e,jG=(e,t,n)=>{e.classList.toggle(`dark`,t===`dark`),n===`cb`?e.dataset.diffPalette=`cb`:delete e.dataset.diffPalette},MG=e=>{try{let t=window.localStorage.getItem(e);return t===null?void 0:JSON.parse(t)}catch{return}},NG=(e,t)=>{try{window.localStorage.setItem(e,JSON.stringify(t))}catch{}},PG=new Set,FG=()=>{for(let e of PG)e()},IG=e=>{PG.add(e);let t=window.matchMedia(DG);return t.addEventListener(`change`,e),window.addEventListener(`storage`,e),()=>{PG.delete(e),t.removeEventListener(`change`,e),window.removeEventListener(`storage`,e)}},LG=()=>`${OG(MG(EG.theme))} ${kG(MG(EG.diffPalette))} ${window.matchMedia(DG).matches}`,RG=()=>{let[e=`system`,t=`default`,n]=(0,q.useSyncExternalStore)(IG,LG).split(` `),r=OG(e),i=kG(t),a=AG(r,n===`true`);return(0,q.useEffect)(()=>{jG(document.documentElement,a,i)},[a,i]),{theme:r,resolvedTheme:a,diffPalette:i,setTheme:(0,q.useCallback)(e=>{NG(EG.theme,e),FG()},[]),setDiffPalette:(0,q.useCallback)(e=>{NG(EG.diffPalette,e),FG()},[])}},zG={"--normal-bg":`var(--popover)`,"--normal-text":`var(--popover-foreground)`,"--normal-border":`var(--border)`,"--border-radius":`var(--radius-xl)`},BG=({...e})=>{let{resolvedTheme:t}=RG();return(0,J.jsx)(gN,{theme:t,className:`toaster group`,icons:{success:(0,J.jsx)(Jh,{className:`size-4`}),info:(0,J.jsx)(Pg,{className:`size-4`}),warning:(0,J.jsx)(v_,{className:`size-4`}),error:(0,J.jsx)(Jg,{className:`size-4`}),loading:(0,J.jsx)(Hg,{className:`size-4 animate-spin`})},style:zG,toastOptions:{classNames:{toast:`cn-toast`}},...e})},VG={github:`GitHub`,bitbucket:`Bitbucket`},HG=`then restart megareviewer.`,UG={github:{connect:`Set GITHUB_TOKEN or run \`gh auth login\`, ${HG}`,adds:`Lists and opens GitHub pull requests.`},bitbucket:{connect:`Set BITBUCKET_EMAIL and BITBUCKET_API_TOKEN, and BITBUCKET_WORKSPACE to list its pull requests, ${HG}`,adds:`Lists and opens Bitbucket pull requests.`}},WG=e=>e===1?`1 pull request`:`${e} pull requests`,GG=(e,t,n,r,i)=>{let a=VG[e],{connect:o,adds:s}=UG[e];if(!t.configured)return n.configured?{kind:e,name:a,state:`optional`,detail:s,fix:o}:{kind:e,name:a,state:`not-connected`,detail:`${a} isn't configured.`,fix:o};if(t.user===null)return{kind:e,name:a,state:`failing`,detail:t.error??`Couldn't read the signed-in ${a} user.`,fix:`Check the token, ${HG} A network failure needs only Check again.`};let c=r?.counts[e];return{kind:e,name:a,state:`working`,detail:c===void 0||r===null?t.user.name:`${t.user.name} · ${WG(c)} listed ${hF(new Date(r.atMs).toISOString(),i)}`,fix:null}},KG={claude:{name:`Claude`,providers:[`claude-code`,`anthropic-api`],adds:`Adds intent, findings, risks and decisions with Request AI review.`,connect:"Run `claude` and sign in, or set ANTHROPIC_API_KEY."},codex:{name:`Codex`,providers:[`codex`],adds:`Adds OpenAI's GPT models to Request AI review, on your ChatGPT plan.`,connect:"Install the Codex CLI and run `codex login`."},opencode:{name:`opencode`,providers:[`opencode`],adds:`Adds the models of the providers you connected in opencode to Request AI review.`,connect:"Install opencode (https://opencode.ai) and connect a provider with `opencode auth login`."}},qG=e=>e.length<=1?e[0]??``:`${e.slice(0,-1).join(`, `)} and ${e.at(-1)??``}`,JG=(e,t,n)=>{if(e===`claude`){let e=t.find(e=>e.id===n)??t[0];return e===void 0?``:`${e.modelName} through ${e.via}`}if(e===`codex`)return`${qG(t.map(e=>e.modelName))} through ${t[0]?.via??`Codex`}`;let r=[...new Set(t.map(e=>e.via.replace(/^opencode, on /,``)))];return`${t.length===1?`1 model`:`${t.length} models`} through ${qG(r)}`},YG=(e,{options:t,defaultId:n})=>{let{name:r,providers:i,adds:a,connect:o}=KG[e],s=t.filter(e=>i.includes(e.provider)),c=s.filter(e=>e.available);if(c.length>0)return{kind:e,name:r,state:`working`,detail:JG(e,c,n),fix:null};let l=[...new Set(s.flatMap(e=>e.reason??[]))];return{kind:e,name:r,state:`optional`,detail:a,fix:l.length>0?l.join(`; or `):`${o.slice(0,-1)}, ${HG}`}},XG=e=>e?{kind:`jira`,name:`Jira`,state:`working`,detail:`Links tickets`,fix:null}:{kind:`jira`,name:`Jira`,state:`optional`,detail:`Reads the tickets a pull request names.`,fix:`Set JIRA_BASE_URL, JIRA_EMAIL and JIRA_API_TOKEN, ${HG}`},ZG={failing:0,"not-connected":1,working:2,optional:2,checking:2},QG=(e,t)=>e===1?`1 ${t}`:`${e} ${t}s`,$G=[[`github`,`GitHub`],[`bitbucket`,`Bitbucket`],[`claude`,`Claude`],[`codex`,`Codex`],[`opencode`,`opencode`],[`jira`,`Jira`]],eK=e=>{let{status:t,error:n,checking:r,checkedAtMs:i,listed:a,nowMs:o}=e;if(n!==null&&!r)return{rows:[],button:{label:`Disconnected`,tone:`danger`,name:`Connections: megareviewer's server isn't answering. Open for details.`},summary:`megareviewer's server isn't answering`,disconnected:Ap(n)};if(t===null)return{rows:$G.map(([e,t])=>({kind:e,name:t,state:`checking`,detail:``,fix:null})),button:{label:`Checking…`,tone:`checking`,name:`Connections: checking. Open for details.`},summary:`Checking ${$G.length} connections…`,disconnected:null};let{github:s,bitbucket:c}=t.hosts,l=[GG(`github`,s,c,a,o),GG(`bitbucket`,c,s,a,o),YG(`claude`,t.model),YG(`codex`,t.model),YG(`opencode`,t.model),XG(t.jira.configured)].sort((e,t)=>ZG[e.state]-ZG[t.state]),u=e=>l.filter(t=>t.state===e).length,d=u(`failing`),f=u(`not-connected`),p=u(`working`),m=u(`optional`),h=d+f,g=[...d>0?[`${d} failing`]:[],...f>0?[`${f} not connected`]:[],...p>0?[`${p} working`]:[],...m>0&&h===0?[`${m} optional`]:[]],_=i===null?``:` · checked ${hF(new Date(i).toISOString(),o)}`,v=h>0?g.join(` · `):p===l.length?`All ${p} working${_}`:`${g.join(` · `)}${_}`,y=`Connections: ${g.join(` · `)}. ${h>0?`Open to fix.`:`Open for details.`}`;return r?{rows:l.map(e=>({...e,state:`checking`})),button:{label:`Checking…`,tone:`checking`,name:`Connections: checking. Open for details.`},summary:`Checking ${l.length} connections…`,disconnected:null}:{rows:l,button:{...h>0?{label:QG(h,`issue`),tone:d>0?`danger`:`warning`}:p===l.length?{label:`All connected`,tone:`ok`}:{label:`${p} of ${l.length} connected`,tone:`ok`},name:y},summary:v,disconnected:null}},tK={checking:`text-muted-foreground`,ok:``,warning:`border-review-pending bg-review-pending-bg text-review-pending hover:bg-review-pending-bg hover:text-review-pending aria-expanded:bg-review-pending-bg aria-expanded:text-review-pending`,danger:`border-destructive bg-review-changes-bg text-destructive hover:bg-review-changes-bg hover:text-destructive aria-expanded:bg-review-changes-bg aria-expanded:text-destructive`},nK={github:Og,bitbucket:Og,claude:f_,codex:f_,opencode:f_,jira:m_},rK={working:{label:`Connected`,icon:Rh,tone:`text-ci-success`,row:``},failing:{label:`Failing`,icon:v_,tone:`text-destructive`,row:`border-l-3 border-l-destructive bg-review-changes-bg`},"not-connected":{label:`Not connected`,icon:Xh,tone:`text-review-pending`,row:`border-l-3 border-l-review-pending bg-review-pending-bg`},optional:{label:`Not connected · Optional`,icon:Xh,tone:`text-muted-foreground`,row:``},checking:{label:`Checking…`,icon:Hg,tone:`text-muted-foreground`,row:``}},iK=new Set([`claude`,`codex`,`opencode`]),aK=({className:e})=>(0,J.jsx)(Hg,{"aria-hidden":`true`,className:X(`animate-spin motion-reduce:animate-[spin_3s_linear_infinite]`,e)}),oK=({tone:e})=>e===`checking`?(0,J.jsx)(aK,{}):e===`ok`?(0,J.jsx)(Rh,{"aria-hidden":`true`,className:`text-ci-success`}):(0,J.jsx)(v_,{"aria-hidden":`true`}),sK=({row:e})=>{let t=rK[e.state],n=e.state===`optional`&&iK.has(e.kind)?`Not connected`:t.label,r=nK[e.kind],i=t.icon;return(0,J.jsxs)(`li`,{"data-state":e.state,className:X(`flex flex-col gap-0.5 rounded-md px-2.5 py-2`,t.row,e.state===`optional`&&`text-muted-foreground`),children:[(0,J.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,J.jsx)(r,{"aria-hidden":`true`,className:`size-4 shrink-0`}),(0,J.jsx)(`span`,{className:`font-medium`,children:e.name}),(0,J.jsxs)(`span`,{className:X(`ml-auto flex items-center gap-1 text-caption`,t.tone),children:[(0,J.jsx)(i,{"aria-hidden":`true`,className:X(`size-3.5`,e.state===`checking`&&`animate-spin motion-reduce:animate-[spin_3s_linear_infinite]`)}),n]})]}),e.detail!==``&&(0,J.jsx)(`p`,{className:`text-caption`,children:e.detail}),e.fix!==null&&(0,J.jsx)(`p`,{className:`text-caption`,children:e.fix})]})},cK=({connections:e,version:t,checking:n,onCheckAgain:r,checkAgainRef:i})=>(0,J.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,J.jsxs)(`div`,{className:`flex flex-col gap-0.5 px-1`,children:[(0,J.jsx)(TM,{className:`text-heading font-semibold`,children:`Connections`}),(0,J.jsx)(`p`,{className:`text-caption text-muted-foreground`,children:e.summary})]}),e.disconnected===null?(0,J.jsx)(`ul`,{className:`flex flex-col gap-1`,children:e.rows.map(e=>(0,J.jsx)(sK,{row:e},e.kind))}):(0,J.jsx)(`p`,{className:`rounded-md border-l-3 border-l-destructive bg-review-changes-bg px-2.5 py-2 text-caption`,children:e.disconnected}),(0,J.jsxs)(`div`,{className:`flex items-center justify-between gap-2 border-t px-1 pt-2`,children:[(0,J.jsxs)($,{ref:i,variant:`outline`,size:`sm`,onClick:r,"aria-busy":n,"aria-disabled":n,children:[n&&(0,J.jsx)(aK,{}),`Check again`]}),t!==null&&(0,J.jsxs)(`span`,{className:`text-caption text-muted-foreground`,children:[`megareviewer `,t]})]})]}),lK=({connections:e,version:t,checking:n,open:r,onOpenChange:i,onCheckAgain:a,focusCheckAgain:o=!1})=>{let s=(0,q.useCallback)(e=>{e!==null&&o&&e.focus()},[o]),{label:c,tone:l,name:u}=e.button;return(0,J.jsxs)(SM,{...r===void 0?{}:{open:r},...i===void 0?{}:{onOpenChange:e=>i(e)},children:[(0,J.jsxs)(CM,{render:(0,J.jsx)($,{variant:`outline`,size:`sm`,className:tK[l],"data-tone":l,"aria-label":u}),children:[(0,J.jsx)(oK,{tone:l}),c]}),(0,J.jsx)(wM,{align:`end`,className:`w-[min(340px,calc(100vw-24px))] p-2`,initialFocus:!1,children:(0,J.jsx)(cK,{connections:e,version:t,checking:n,onCheckAgain:()=>{n||a()},checkAgainRef:s})})]})},uK=({now:e=Date.now})=>{let t=PF(),{status:n,error:r,checking:i,checkedAtMs:a,listed:o,open:s,setOpen:c,focusCheckAgain:l}=t,u=eK({status:n,error:r,checking:i,checkedAtMs:a,listed:o,nowMs:e()}),{label:d,tone:f}=u.button,[p,m]=(0,q.useState)(``),h=(0,q.useRef)(!0);return(0,q.useEffect)(()=>{f!==`checking`&&(h.current?h.current=!1:m(`Connections: ${d}`))},[d,f]),(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(lK,{connections:u,version:n?.version??null,checking:i,open:s,onOpenChange:e=>c(e),onCheckAgain:t.checkAgain,focusCheckAgain:l}),(0,J.jsx)(`span`,{className:`sr-only`,"aria-live":`polite`,children:p})]})},dK=[{value:`light`,label:`Light`},{value:`dark`,label:`Dark`},{value:`system`,label:`System`}],fK=()=>{let{theme:e,diffPalette:t,setTheme:n,setDiffPalette:r}=RG(),i=Fp(),a=(0,q.useRef)(!1);return(0,J.jsxs)(UR,{children:[(0,J.jsx)(WR,{render:(0,J.jsx)($,{variant:`ghost`,size:`sm`,className:`max-sm:px-1.5`}),children:`Display`}),(0,J.jsxs)(GR,{align:`end`,className:`w-56`,finalFocus:()=>{let e=a.current;return a.current=!1,!e},children:[i!==null&&(0,J.jsxs)(J.Fragment,{children:[(0,J.jsxs)(KR,{children:[(0,J.jsx)(qR,{children:i.label}),(0,J.jsx)(XR,{value:i.value,onValueChange:e=>{a.current=!0,i.onChange(e)},children:i.options.map(e=>(0,J.jsx)(ZR,{value:e.value,closeOnClick:!0,children:e.label},e.value))})]}),(0,J.jsx)(QR,{}),i.toggle!==void 0&&(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(YR,{checked:i.toggle.checked,onCheckedChange:i.toggle.onChange,children:i.toggle.label}),(0,J.jsx)(QR,{})]})]}),(0,J.jsxs)(KR,{children:[(0,J.jsx)(qR,{children:`Theme`}),(0,J.jsx)(XR,{value:e,onValueChange:e=>{let t=dK.find(t=>t.value===e);t!==void 0&&n(t.value)},children:dK.map(e=>(0,J.jsx)(ZR,{value:e.value,children:e.label},e.value))})]}),(0,J.jsx)(QR,{}),(0,J.jsx)(YR,{checked:t===`cb`,onCheckedChange:e=>r(e?`cb`:`default`),children:`Color-blind safe diff`})]})]})},pK=({current:e})=>(0,J.jsxs)(N_,{to:S_,"aria-current":e?`page`:void 0,className:X(ly({variant:`ghost`,size:`sm`}),`min-w-7 text-foreground hover:no-underline aria-[current=page]:bg-muted max-sm:px-0`),children:[(0,J.jsx)(u_,{"aria-hidden":`true`,className:`sm:hidden`}),(0,J.jsx)(`span`,{className:`max-sm:sr-only`,children:`Preferences`})]}),mK=()=>{let e=T_(k_());return(0,J.jsxs)(`header`,{className:`flex h-12 items-center justify-between gap-4 border-b bg-background px-4 max-sm:gap-2 sm:px-6`,children:[(0,J.jsx)(N_,{to:`/`,className:`text-heading font-semibold text-foreground hover:no-underline`,children:`megareviewer`}),(0,J.jsxs)(`div`,{className:`flex items-center gap-2 max-sm:gap-1`,children:[(0,J.jsx)(uK,{}),(0,J.jsx)(pK,{current:e.page===`preferences`}),(0,J.jsx)(fK,{})]})]})},hK=()=>(0,J.jsxs)(`div`,{className:`mx-auto flex max-w-2xl flex-col gap-3 py-12`,children:[(0,J.jsx)(`h1`,{className:`text-title font-semibold tracking-[-0.01em]`,children:`Page not found`}),(0,J.jsxs)(`p`,{className:`text-body`,children:[`There's nothing at this address. `,(0,J.jsx)(N_,{to:`/`,children:`Go to your pull requests`}),`.`]})]}),gK=({reason:e})=>(0,J.jsxs)(`main`,{className:`mx-auto flex max-w-2xl flex-col gap-3 px-4 py-12`,children:[(0,J.jsx)(`h1`,{className:`text-title font-semibold tracking-[-0.01em]`,children:`Open megareviewer from your terminal`}),e===`missing`?(0,J.jsxs)(`p`,{className:`text-body`,children:[`This page needs the link megareviewer printed when it started. It looks like`,` `,(0,J.jsx)(`code`,{className:`rounded-sm bg-muted px-1 font-mono text-code-compact`,children:`http://127.0.0.1:4823/?token=…`}),`. Copy it from your terminal and open it once; other tabs in this browser then work without it.`]}):(0,J.jsx)(`p`,{className:`text-body`,children:`This page's session has ended, usually because megareviewer was restarted. Open the new link printed in your terminal.`}),(0,J.jsxs)(`p`,{className:`text-muted-foreground`,children:[`Not running? Start it with`,` `,(0,J.jsx)(`code`,{className:`rounded-sm bg-muted px-1 font-mono text-code-compact`,children:`npx megareviewer`}),`.`]})]}),_K=({token:e,fetch:t,openEventStream:n})=>{let[r,i]=(0,q.useState)(!1),[a,o]=(0,q.useState)(e.value),s=(0,q.useMemo)(()=>a===null?null:{client:hp({fetch:t,token:a,onUnauthorized:()=>{let t=e.reject(a);t===null?i(!0):o(t)}}),subscribe:(e,t)=>_p(e,a,t,n)},[t,n,e,a]);return r?(0,J.jsx)(gK,{reason:`ended`}):s===null?(0,J.jsx)(gK,{reason:`missing`}):(0,J.jsx)(vp.Provider,{value:s,children:(0,J.jsx)(vK,{},a)})},vK=()=>{let e=T_(k_());return(0,J.jsx)(lI,{children:(0,J.jsx)(Pp,{children:(0,J.jsxs)(FF,{children:[(0,J.jsx)(mK,{}),(0,J.jsx)(`main`,{className:X(`px-4 py-5 sm:px-6`,(e.page===`picker`||e.page===`preferences`)&&`min-h-[calc(100dvh-3rem)] bg-surface-subtle`),children:e.page===`picker`?(0,J.jsx)(WI,{}):e.page===`preferences`?(0,J.jsx)(LB,{}):e.page===`review`?(0,J.jsx)(uG,{analysisId:e.analysisId}):e.page===`open`?(0,J.jsx)(LF,{pullRequest:e.ref},E_(e.ref)):(0,J.jsx)(hK,{})}),(0,J.jsx)(BG,{})]})})})},yK=class extends q.Component{state={error:null};static getDerivedStateFromError(e){return{error:e instanceof Error?e:Error(String(e))}}render(){let{error:e}=this.state;if(e===null)return this.props.children;let t=this.props.onReload??(()=>window.location.reload());return(0,J.jsxs)(`main`,{className:`mx-auto flex max-w-2xl flex-col items-start gap-3 px-4 py-12`,role:`alert`,children:[(0,J.jsx)(`h1`,{className:`text-title font-semibold tracking-[-0.01em]`,children:`Something went wrong`}),(0,J.jsx)(`p`,{className:`text-body`,children:`megareviewer hit a bug while showing this page.`}),(0,J.jsx)(`pre`,{className:`w-full overflow-x-auto rounded-md border bg-muted p-3 font-mono text-code-compact whitespace-pre-wrap`,children:String(e)}),(0,J.jsx)($,{onClick:t,children:`Reload`})]})}},bK=`token`,xK=`megareviewer.token`,SK=e=>{let t=(()=>{try{return e.localStorage}catch{return null}})(),n=e=>{try{return t===null?null:e(t)}catch{return null}},r=new URL(e.location.href),i=r.searchParams.get(bK),a;return i!==null&&i!==``?(a=i,n(e=>e.setItem(xK,i))):a=n(e=>e.getItem(xK)),r.searchParams.has(bK)&&(r.searchParams.delete(bK),e.history.replaceState(e.history.state,``,`${r.pathname}${r.search}${r.hash}`)),{get value(){return a},reject(e){let t=n(e=>e.getItem(xK));return t===e&&n(e=>e.removeItem(xK)),a=t!==null&&t!==e?t:null,a}}},CK=document.getElementById(`root`);if(CK===null)throw Error(`index.html has no #root`);(0,xc.createRoot)(CK).render((0,J.jsx)(q.StrictMode,{children:(0,J.jsx)(yK,{children:(0,J.jsx)(_K,{token:SK(window),fetch:window.fetch.bind(window)})})}));export{s as t};
|
|
74
|
+
`),0).read(),Vd=e=>({blocks:Bd(e)}),Hd=Ks([`approve`,`request_changes`,`comment`]),Ud=G().regex(/^(summary|decision:d[1-9][0-9]*|hunk:h_[0-9a-f]{16}(-[2-9]|-[1-9][0-9]+)?:(new|old):[1-9][0-9]*)$/).brand(),Wd=K({hunkId:Hc,side:Ks([`new`,`old`]),line:Ts().int().positive(),startLine:Ts().int().positive().optional(),body:G(),suggestion:Fs(G()).readonly().optional()}).readonly().refine(e=>e.startLine===void 0||e.startLine<e.line,{message:`startLine must come before line`}),Gd=K({key:Ud,path:G().min(1),line:Ts().int().positive(),startLine:Ts().int().positive().optional(),side:Ks([`new`,`old`]),body:G().min(1)}).readonly(),Kd=K({verdict:Hd,summary:G(),comments:Fs(Gd).readonly()}).readonly(),qd=os().brand(),Jd=e=>e.verdict===`comment`&&e.summary.trim()===``&&e.comments.length===0,Yd=K({url:wc.nullable(),publishedAt:Sc,postedCommentIds:Ws(Ud,G().min(1)).readonly()}).readonly(),Xd=Ks([`open`,`draft`,`merged`,`closed`]),Zd=Ks([`approved`,`changes-requested`,`commented`]),Qd=K({id:G().min(1),name:G(),team:ks(),verdict:Zd.nullable()}).readonly(),$d=Ks([`approved`,`changes-requested`]),ef=Ks([`passed`,`failed`,`running`,`skipped`]),tf=K({name:G().min(1),state:ef,url:wc.nullable()}).readonly(),nf=K({state:Xd,reviewStatus:$d.nullable(),reviewers:Fs(Qd).readonly(),checks:Fs(tf).readonly().nullable(),checksUnreadable:G().nullable()}).readonly(),rf={"changes-requested":0,approved:1,commented:2,none:3},af=e=>[...e].sort((e,t)=>rf[e.verdict??`none`]-rf[t.verdict??`none`]),of={failed:0,running:1,passed:2,skipped:3},sf=e=>[...e].sort((e,t)=>of[e.state]-of[t.state]||e.name.localeCompare(t.name)),cf=e=>{let t=t=>e.filter(e=>e.state===t).length,n=t(`passed`),r=t(`failed`),i=t(`running`),a=t(`skipped`);return{state:r>0?`failed`:i>0?`running`:n>0?`passed`:a>0?`skipped`:null,total:n+r+i,passed:n,failed:r,running:i,skipped:a}},lf={"github.com":{kind:`github`,pullSegment:`pull`},"bitbucket.org":{kind:`bitbucket`,pullSegment:`pull-requests`}},uf=/^[A-Za-z0-9._-]+$/,df=/^[1-9][0-9]*$/,ff=e=>e!==void 0&&uf.test(e)&&e!==`.`&&e!==`..`,pf=e=>/^(github\.com|bitbucket\.org)\//i.test(e)?`https://${e}`:e,mf=e=>{let t;try{t=new URL(pf(e.trim()))}catch{return vl(`unsupported-url`)}let n=lf[t.hostname];if(n===void 0||t.protocol!==`https:`||t.port!==``||t.username!==``||t.password!==``)return vl(`unsupported-url`);let[r,i,a,o,s]=t.pathname.split(`/`);return r!==``||!ff(i)||!ff(a)||o!==n.pullSegment||s===void 0||!df.test(s)||!Number.isSafeInteger(Number(s))?vl(`unsupported-url`):_l({repo:{host:n.kind,owner:i.toLowerCase(),repo:a.toLowerCase()},number:Number(s)})},hf=e=>{let{host:t,owner:n,repo:r}=e.repo;switch(t){case`github`:return`https://github.com/${n}/${r}/pull/${e.number}`;case`bitbucket`:return`https://bitbucket.org/${n}/${r}/pull-requests/${e.number}`}},gf=G().regex(/^[A-Za-z0-9_-]{1,200}$/),_f=K({id:G().regex(/^[A-Za-z0-9_-]{1,200}$/),author:Oc,body:G(),createdAt:Sc,originalCommit:Cc.nullable()}).readonly(),vf=K({reply:ks(),resolve:ks()}).readonly(),yf=K({threads:Fs(K({id:gf,path:G().min(1),side:Ks([`new`,`old`]),line:Ts().int().positive().nullable(),startLine:Ts().int().positive().nullable(),originalLine:Ts().int().positive().nullable(),resolved:ks(),resolvedBy:Oc.nullable(),outdated:ks(),can:vf,comments:Fs(_f).min(1).readonly()}).readonly()).readonly()}).readonly();K({kind:Ks([`missing`,`duplicate`,`unknown`]),id:Uc}).readonly();var bf=`x-megareviewer-token`,xf=`token`,Sf=K({configured:ks(),user:Oc.nullable(),error:G().nullable()}).readonly(),Cf=K({version:G(),hosts:K({github:Sf,bitbucket:Sf}).readonly(),jira:K({configured:ks()}).readonly(),model:Ll}).readonly(),wf=K({items:Fs(jc).readonly(),errors:Fs(K({host:Tc,message:G()}).readonly()).readonly()}).readonly(),Tf=K({url:G().min(1)}).readonly(),Ef=K({optionId:Fl.optional()}).readonly().optional(),Df=K({analysisId:Cu}).readonly(),Of=K({analysis:Ru,pointReviews:Fs(fu).readonly(),publication:Yd.nullable(),isAuthor:ks(),stale:ks()}).readonly(),kf=K({analysis:Ru,pointReviews:Fs(fu).readonly()}).readonly(),Af=K({state:du}).readonly(),jf={hunkComments:Fs(Wd).readonly().optional(),verdict:Hd.nullable().optional()},Mf=K({summary:G(),...jf}).readonly(),Nf=K({publicationId:qd,summary:G(),allowStale:ks(),...jf}).readonly(),Pf=K({stage:xu,status:Su}).readonly(),Ff=K({}).readonly(),If=K({content:G().nullable()}).readonly(),Lf=yf,Rf=K({body:G().trim().min(1)}).readonly(),zf=K({}).readonly(),Bf=K({resolved:ks()}).readonly(),Vf=Bf,Hf=K({repo:Ec,guidelineFiles:Fs(Zl).readonly().nullable(),guidelineNote:G().nullable()}).readonly(),Uf=K({preferences:Fs(Kl).readonly(),proposals:Fs(ql).readonly(),repositories:Fs(Hf).readonly(),signalsSinceSuggestion:Ts().int().nonnegative()}).readonly(),Wf=K({kind:Hl,text:Gl,scope:Ul,source:Ks([`written`,`learned`]).optional()}).readonly(),Gf=K({kind:Hl.optional(),text:Gl.optional(),scope:Ul.optional(),enabled:ks().optional()}).readonly(),Kf=K({}).readonly(),qf=Ef,Jf=K({proposals:Fs(ql).readonly(),signals:Ts().int().nonnegative()}).readonly(),Yf=K({repo:Ec,optionId:Fl.optional()}).readonly(),Xf=K({proposals:Fs(ql).readonly(),comments:Ts().int().nonnegative(),pullRequests:Ts().int().nonnegative()}).readonly(),Zf=K({decision:Ks([`accept`,`reject`]),kind:Hl.optional(),text:Gl.optional(),scope:Ul.optional()}).readonly(),Qf=K({preference:Kl.nullable()}).readonly(),$f=K({repo:Ec,path:Yl,enabled:ks()}).readonly(),ep=K({}).readonly(),tp=K({error:K({code:Ks([`bad-request`,`unsupported-url`,`host-not-configured`,`unauthorized`,`not-found`,`stale-analysis`,`analysis-not-complete`,`host-error`,`model-error`,`model-unavailable`,`internal`]),message:G()}).readonly()}).readonly(),np=K({id:Cu}).readonly(),rp=K({id:Cu,pointId:uu}).readonly(),ip=K({id:Cu,side:Ks([`base`,`head`]),path:G().min(1)}).readonly(),ap=K({id:Cu,threadId:gf}).readonly(),op=K({preferenceId:Bl}).readonly(),sp=K({proposalId:Vl}).readonly(),cp=K({}).readonly(),lp={getStatus:{method:`GET`,path:`/api/status`,params:cp,request:null,response:Cf},listPullRequests:{method:`GET`,path:`/api/pull-requests`,params:cp,request:null,response:wf},getReviewActivity:{method:`GET`,path:`/api/review-activity`,params:cp,request:null,response:Mc},startAnalysis:{method:`POST`,path:`/api/analyses`,params:cp,request:Tf,response:Df},getAnalysis:{method:`GET`,path:`/api/analyses/:id`,params:np,request:null,response:Of},getFileContent:{method:`GET`,path:`/api/analyses/:id/files/:side/:path`,params:ip,request:null,response:If},retryAnalysis:{method:`POST`,path:`/api/analyses/:id/retry`,params:np,request:null,response:Df},runModel:{method:`POST`,path:`/api/analyses/:id/model`,params:np,request:Ef,response:Df},removeModelRun:{method:`DELETE`,path:`/api/analyses/:id/model`,params:np,request:null,response:kf},putPointState:{method:`PUT`,path:`/api/analyses/:id/points/:pointId`,params:rp,request:Af,response:fu},previewPublication:{method:`POST`,path:`/api/analyses/:id/publication/preview`,params:np,request:Mf,response:Kd},publish:{method:`POST`,path:`/api/analyses/:id/publication`,params:np,request:Nf,response:Yd},getThreads:{method:`GET`,path:`/api/analyses/:id/threads`,params:np,request:null,response:Lf},getPullRequestStatus:{method:`GET`,path:`/api/analyses/:id/pull-request-status`,params:np,request:null,response:nf},replyToThread:{method:`POST`,path:`/api/analyses/:id/threads/:threadId/replies`,params:ap,request:Rf,response:_f},postComment:{method:`POST`,path:`/api/analyses/:id/comments`,params:np,request:Wd,response:zf},resolveThread:{method:`PUT`,path:`/api/analyses/:id/threads/:threadId/resolved`,params:ap,request:Bf,response:Vf},getPreferences:{method:`GET`,path:`/api/preferences`,params:cp,request:null,response:Uf},addPreference:{method:`POST`,path:`/api/preferences`,params:cp,request:Wf,response:Kl},suggestPreferences:{method:`POST`,path:`/api/preferences/suggestions`,params:cp,request:qf,response:Jf},importPreferences:{method:`POST`,path:`/api/preferences/imports`,params:cp,request:Yf,response:Xf},setGuidelineSwitch:{method:`PUT`,path:`/api/preferences/guidelines`,params:cp,request:$f,response:ep},decideProposal:{method:`PUT`,path:`/api/preferences/proposals/:proposalId`,params:sp,request:Zf,response:Qf},updatePreference:{method:`PUT`,path:`/api/preferences/:preferenceId`,params:op,request:Gf,response:Kl},deletePreference:{method:`DELETE`,path:`/api/preferences/:preferenceId`,params:op,request:null,response:Kf}},up={method:`GET`,path:`/api/analyses/:id/events`,params:np,events:{updated:Pf,done:Ff}},dp={method:`GET`,path:`/api/analyses/:id/attachment`,params:np,query:K({url:cs({protocol:/^https$/})}).readonly()},fp=(e,t)=>e.replace(/:([A-Za-z]+)/g,(n,r)=>{let i=t[r];if(i===void 0)throw Error(`missing path param ${r} for ${e}`);return encodeURIComponent(i)}),pp=`The server sent a response this page doesn't understand, so the server and the UI may be different versions. Reload the page.`,mp=`Can't reach megareviewer. Check that it's still running in your terminal.`,hp=e=>{let t=async(t,n,r)=>{let i;try{i=await e.fetch(fp(t.path,n),{method:t.method,headers:{[bf]:e.token,...r===void 0?{}:{"content-type":`application/json`}},...r===void 0?{}:{body:JSON.stringify(r)}})}catch{return vl({code:`unreachable`,message:mp})}let a=await i.json().catch(()=>void 0);if(!i.ok){i.status===401&&e.onUnauthorized();let t=tp.safeParse(a);return t.success?vl(t.data.error):vl({code:i.status>=500?`unreachable`:`internal`,message:i.status>=500?mp:pp})}let o=t.response.safeParse(a);return o.success?_l(o.data):vl({code:`internal`,message:pp})};return{getStatus:()=>t(lp.getStatus,{}),listPullRequests:()=>t(lp.listPullRequests,{}),getReviewActivity:()=>t(lp.getReviewActivity,{}),startAnalysis:e=>t(lp.startAnalysis,{},e),getAnalysis:e=>t(lp.getAnalysis,{id:e}),getFileContent:(e,n,r)=>t(lp.getFileContent,{id:e,side:n,path:r}),retryAnalysis:e=>t(lp.retryAnalysis,{id:e}),runModel:(e,n={})=>t(lp.runModel,{id:e},n),removeModelRun:e=>t(lp.removeModelRun,{id:e}),putPointState:(e,n,r)=>t(lp.putPointState,{id:e,pointId:n},r),previewPublication:(e,n)=>t(lp.previewPublication,{id:e},n),publish:(e,n)=>t(lp.publish,{id:e},n),getThreads:e=>t(lp.getThreads,{id:e}),getPullRequestStatus:e=>t(lp.getPullRequestStatus,{id:e}),replyToThread:(e,n,r)=>t(lp.replyToThread,{id:e,threadId:n},r),resolveThread:(e,n,r)=>t(lp.resolveThread,{id:e,threadId:n},r),postComment:(e,n)=>t(lp.postComment,{id:e},n),getPreferences:()=>t(lp.getPreferences,{}),addPreference:e=>t(lp.addPreference,{},e),suggestPreferences:(e={})=>t(lp.suggestPreferences,{},e),importPreferences:e=>t(lp.importPreferences,{},e),setGuidelineSwitch:e=>t(lp.setGuidelineSwitch,{},e),decideProposal:(e,n)=>t(lp.decideProposal,{proposalId:e},n),updatePreference:(e,n)=>t(lp.updatePreference,{preferenceId:e},n),deletePreference:e=>t(lp.deletePreference,{preferenceId:e}),attachmentUrl:(t,n)=>`${fp(dp.path,{id:t})}?${new URLSearchParams({url:n,[xf]:e.token})}`}},gp=2,_p=(e,t,n,r=e=>new EventSource(e))=>{let i=new URLSearchParams({[xf]:t}),a=r(`${fp(up.path,{id:e})}?${i}`),o=!1,s=!1,c=()=>{s=!0,a.close()};return a.addEventListener(`open`,()=>{o&&(o=!1,n({type:`changed`}))}),a.addEventListener(`error`,()=>{o=!0,!(s||a.readyState!==gp)&&(s=!0,n({type:`closed`}))}),a.addEventListener(`updated`,()=>n({type:`changed`})),a.addEventListener(`done`,()=>{c(),n({type:`done`})}),()=>{s||c()}},vp=(0,q.createContext)(null),yp=()=>{let e=(0,q.useContext)(vp);if(e===null)throw Error(`useApi needs an ApiContext provider`);return e},bp={data:null,error:null,loading:!0},xp=e=>{let[t,n]=(0,q.useState)(bp),[r,i]=(0,q.useState)(0);(0,q.useEffect)(()=>{let t=!0;return n(e=>({...e,loading:!0})),e().then(e=>{t&&n(t=>e.ok?{data:e.value,error:null,loading:!1}:{data:t.data,error:e.error,loading:!1})}),()=>{t=!1}},[e,r]);let a=(0,q.useCallback)(()=>i(e=>e+1),[]);return{...t,refresh:a}},Sp=()=>{let{client:e}=yp(),{data:t,...n}=xp((0,q.useCallback)(()=>e.getStatus(),[e]));return{status:t,...n}},Cp=()=>{let{client:e}=yp(),{data:t,...n}=xp((0,q.useCallback)(()=>e.listPullRequests(),[e]));return{pullRequests:t,...n}},wp=()=>{let{client:e}=yp(),{data:t,...n}=xp((0,q.useCallback)(()=>e.getReviewActivity(),[e]));return{activity:t,...n}},Tp=()=>{let{client:e}=yp(),{data:t,...n}=xp((0,q.useCallback)(()=>e.getPreferences(),[e]));return{preferences:t,...n}},Ep=(e,t=null)=>{let{client:n,subscribe:r}=yp(),[i,a]=(0,q.useState)({view:t,error:null,loading:t===null}),o=(0,q.useRef)(0),s=(0,q.useRef)(t),c=(0,q.useRef)(t!==null&&!Bu(t.analysis)?t.analysis.id:null),[l,u]=(0,q.useState)(0),d=(0,q.useRef)(null),f=(0,q.useCallback)(async()=>{o.current+=1;let t=o.current,r=await n.getAnalysis(e);t===o.current&&(r.ok&&(s.current=r.value),a(e=>r.ok?{view:r.value,error:null,loading:!1}:{view:e.view,error:r.error,loading:!1}))},[n,e]);(0,q.useEffect)(()=>{if(l===0&&c.current===e){d.current=e;return}d.current!==e&&(d.current=e,s.current=null,a({view:null,error:null,loading:!0})),f();let t,n=r(e,e=>{if(clearTimeout(t),e.type===`changed`){t=setTimeout(()=>void f(),100);return}let n=s.current;(n===null||Bu(n.analysis))&&f()});return()=>{clearTimeout(t),n(),o.current+=1}},[e,f,r,l]);let p=(0,q.useCallback)(()=>u(e=>e+1),[]);return{...i,refetch:f,follow:p}},Dp=e=>{let[t,n]=(0,q.useState)({pending:!1,error:null}),r=(0,q.useCallback)(async(...t)=>{n({pending:!0,error:null});let r=await e(...t);return n({pending:!1,error:r.ok?null:r.error}),r},[e]),i=(0,q.useCallback)(()=>n({pending:!1,error:null}),[]);return{...t,run:r,reset:i}},Op=e=>{let t=e.trim();return t===``||/[.!?]$/.test(t)?t:`${t}.`},kp={"bad-request":e=>`megareviewer rejected the request: ${Op(e)}`,"unsupported-url":()=>`Only github.com and bitbucket.org pull request links are supported.`,"host-not-configured":e=>`${Op(e)} Run npx megareviewer doctor to see how to set it up.`,unauthorized:()=>`This session has ended. Open megareviewer from the link printed in your terminal.`,"not-found":e=>Op(e),"stale-analysis":()=>`The pull request has new commits since this analysis.`,"analysis-not-complete":()=>`The analysis isn't complete yet.`,"host-error":e=>`The git host returned an error: ${Op(e)}`,"model-error":e=>`The model call failed: ${Op(e)}`,"model-unavailable":e=>Op(e),internal:e=>Op(e)||`Something went wrong.`,unreachable:e=>Op(e)},Ap=e=>kp[e.code](e.message),jp=o((e=>{var t=Symbol.for(`react.transitional.element`),n=Symbol.for(`react.fragment`);function r(e,n,r){var i=null;if(r!==void 0&&(i=``+r),n.key!==void 0&&(i=``+n.key),`key`in n)for(var a in r={},n)a!==`key`&&(r[a]=n[a]);else r=n;return n=r.ref,{$$typeof:t,type:e,key:i,ref:n===void 0?null:n,props:r}}e.Fragment=n,e.jsx=r,e.jsxs=r})),J=o(((e,t)=>{t.exports=jp()}))(),Mp=(0,q.createContext)(null),Np=(0,q.createContext)(()=>{}),Pp=({children:e})=>{let[t,n]=(0,q.useState)(null);return(0,J.jsx)(Np.Provider,{value:n,children:(0,J.jsx)(Mp.Provider,{value:t,children:e})})},Fp=()=>(0,q.useContext)(Mp),Ip=e=>{let t=(0,q.useContext)(Np),n=(0,q.useRef)(e.onChange);n.current=e.onChange;let r=(0,q.useRef)(e.toggle?.onChange);r.current=e.toggle?.onChange;let{label:i,options:a,value:o}=e,s=e.toggle?.label,c=e.toggle?.checked??!1,l=(0,q.useMemo)(()=>({label:i,options:a,value:o,onChange:e=>n.current(e),...s===void 0?{}:{toggle:{label:s,checked:c,onChange:e=>r.current?.(e)}}}),[i,a,o,s,c]);(0,q.useEffect)(()=>t(l),[t,l]),(0,q.useEffect)(()=>()=>t(null),[t])};function Lp(e){var t,n,r=``;if(typeof e==`string`||typeof e==`number`)r+=e;else if(typeof e==`object`){if(Array.isArray(e)){var i=e.length;for(t=0;t<i;t++)e[t]&&(n=Lp(e[t]))&&(r&&(r+=` `),r+=n)}else for(n in e)e[n]&&(r&&(r+=` `),r+=n)}return r}function Rp(){for(var e,t,n=0,r=``,i=arguments.length;n<i;n++)(e=arguments[n])&&(t=Lp(e))&&(r&&(r+=` `),r+=t);return r}var zp=(e,t)=>{let n=Array(e.length+t.length);for(let t=0;t<e.length;t++)n[t]=e[t];for(let r=0;r<t.length;r++)n[e.length+r]=t[r];return n},Bp=(e,t)=>({classGroupId:e,validator:t}),Vp=(e=new Map,t=null,n)=>({nextPart:e,validators:t,classGroupId:n}),Hp=`-`,Up=[],Wp=`arbitrary..`,Gp=e=>{let t=Jp(e),{conflictingClassGroups:n,conflictingClassGroupModifiers:r}=e;return{getClassGroupId:e=>{if(e.startsWith(`[`)&&e.endsWith(`]`))return qp(e);let n=e.split(Hp);return Kp(n,+(n[0]===``&&n.length>1),t)},getConflictingClassGroupIds:(e,t)=>{if(t){let t=r[e],i=n[e];return t?i?zp(i,t):t:i||Up}return n[e]||Up}}},Kp=(e,t,n)=>{if(e.length-t===0)return n.classGroupId;let r=e[t],i=n.nextPart.get(r);if(i){let n=Kp(e,t+1,i);if(n)return n}let a=n.validators;if(a===null)return;let o=t===0?e.join(Hp):e.slice(t).join(Hp),s=a.length;for(let e=0;e<s;e++){let t=a[e];if(t.validator(o))return t.classGroupId}},qp=e=>e.slice(1,-1).indexOf(`:`)===-1?void 0:(()=>{let t=e.slice(1,-1),n=t.indexOf(`:`),r=t.slice(0,n);return r?Wp+r:void 0})(),Jp=e=>{let{theme:t,classGroups:n}=e;return Yp(n,t)},Yp=(e,t)=>{let n=Vp();for(let r in e){let i=e[r];Xp(i,n,r,t)}return n},Xp=(e,t,n,r)=>{let i=e.length;for(let a=0;a<i;a++){let i=e[a];Zp(i,t,n,r)}},Zp=(e,t,n,r)=>{typeof e==`string`?Qp(e,t,n):typeof e==`function`?$p(e,t,n,r):em(e,t,n,r)},Qp=(e,t,n)=>{let r=e===``?t:tm(t,e);r.classGroupId=n},$p=(e,t,n,r)=>{nm(e)?Xp(e(r),t,n,r):(t.validators===null&&(t.validators=[]),t.validators.push(Bp(n,e)))},em=(e,t,n,r)=>{let i=Object.entries(e),a=i.length;for(let e=0;e<a;e++){let[a,o]=i[e];Xp(o,tm(t,a),n,r)}},tm=(e,t)=>{let n=e,r=t.split(Hp),i=r.length;for(let e=0;e<i;e++){let t=r[e],i=n.nextPart.get(t);i||(i=Vp(),n.nextPart.set(t,i)),n=i}return n},nm=e=>`isThemeGetter`in e&&e.isThemeGetter===!0,rm=e=>{if(e<1)return{get:()=>void 0,set:()=>{}};let t=0,n=Object.create(null),r=Object.create(null),i=(i,a)=>{n[i]=a,t++,t>e&&(t=0,r=n,n=Object.create(null))};return{get(e){let t=n[e];if(t!==void 0)return t;if((t=r[e])!==void 0)return i(e,t),t},set(e,t){e in n?n[e]=t:i(e,t)}}},im=`!`,am=`:`,om=[],sm=(e,t,n,r,i)=>({modifiers:e,hasImportantModifier:t,baseClassName:n,maybePostfixModifierPosition:r,isExternal:i}),cm=e=>{let{prefix:t,experimentalParseClassName:n}=e,r=e=>{let t=[],n=0,r=0,i=0,a,o=e.length;for(let s=0;s<o;s++){let o=e[s];if(n===0&&r===0){if(o===am){t.push(e.slice(i,s)),i=s+1;continue}if(o===`/`){a=s;continue}}o===`[`?n++:o===`]`?n--:o===`(`?r++:o===`)`&&r--}let s=t.length===0?e:e.slice(i),c=s,l=!1;s.endsWith(im)?(c=s.slice(0,-1),l=!0):s.startsWith(im)&&(c=s.slice(1),l=!0);let u=a&&a>i?a-i:void 0;return sm(t,l,c,u)};if(t){let e=t+am,n=r;r=t=>t.startsWith(e)?n(t.slice(e.length)):sm(om,!1,t,void 0,!0)}if(n){let e=r;r=t=>n({className:t,parseClassName:e})}return r},lm=e=>{let t=new Map;return e.orderSensitiveModifiers.forEach((e,n)=>{t.set(e,1e6+n)}),e=>{let n=[],r=[];for(let i=0;i<e.length;i++){let a=e[i],o=a[0]===`[`,s=t.has(a);o||s?(r.length>0&&(r.sort(),n.push(...r),r=[]),n.push(a)):r.push(a)}return r.length>0&&(r.sort(),n.push(...r)),n}},um=e=>({cache:rm(e.cacheSize),parseClassName:cm(e),sortModifiers:lm(e),postfixLookupClassGroupIds:dm(e),...Gp(e)}),dm=e=>{let t=Object.create(null),n=e.postfixLookupClassGroups;if(n)for(let e=0;e<n.length;e++)t[n[e]]=!0;return t},fm=/\s+/,pm=(e,t)=>{let{parseClassName:n,getClassGroupId:r,getConflictingClassGroupIds:i,sortModifiers:a,postfixLookupClassGroupIds:o}=t,s=[],c=e.trim().split(fm),l=``;for(let e=c.length-1;e>=0;--e){let t=c[e],{isExternal:u,modifiers:d,hasImportantModifier:f,baseClassName:p,maybePostfixModifierPosition:m}=n(t);if(u){l=t+(l.length>0?` `+l:l);continue}let h=!!m,g;if(h){g=r(p.substring(0,m));let e=g&&o[g]?r(p):void 0;e&&e!==g&&(g=e,h=!1)}else g=r(p);if(!g){if(!h||(g=r(p),!g)){l=t+(l.length>0?` `+l:l);continue}h=!1}let _=d.length===0?``:d.length===1?d[0]:a(d).join(`:`),v=f?_+im:_,y=v+g;if(s.indexOf(y)>-1)continue;s.push(y);let b=i(g,h);for(let e=0;e<b.length;++e){let t=b[e];s.push(v+t)}l=t+(l.length>0?` `+l:l)}return l},mm=(...e)=>{let t=0,n,r,i=``;for(;t<e.length;)(n=e[t++])&&(r=hm(n))&&(i&&(i+=` `),i+=r);return i},hm=e=>{if(typeof e==`string`)return e;let t,n=``;for(let r=0;r<e.length;r++)e[r]&&(t=hm(e[r]))&&(n&&(n+=` `),n+=t);return n},gm=(e,...t)=>{let n,r,i,a,o=o=>(n=um(t.reduce((e,t)=>t(e),e())),r=n.cache.get,i=n.cache.set,a=s,s(o)),s=e=>{let t=r(e);if(t)return t;let a=pm(e,n);return i(e,a),a};return a=o,(...e)=>a(mm(...e))},_m=[],vm=e=>{let t=t=>t[e]||_m;return t.isThemeGetter=!0,t.themeKey=e,t},ym=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,bm=/^\((?:(\w[\w-]*):)?(.+)\)$/i,xm=/^\d+(?:\.\d+)?\/\d+(?:\.\d+)?$/,Sm=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,Cm=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,wm=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix|color|light-dark)\(.+\)$/,Tm=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,Em=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,Dm=e=>xm.test(e),Om=e=>!!e&&!Number.isNaN(Number(e)),km=e=>!!e&&Number.isInteger(Number(e)),Am=e=>e.endsWith(`%`)&&Om(e.slice(0,-1)),jm=e=>Sm.test(e),Mm=()=>!0,Nm=e=>Cm.test(e)&&!wm.test(e),Pm=()=>!1,Fm=e=>Tm.test(e),Im=e=>Em.test(e),Lm=e=>!Y(e)&&!qm(e),Rm=e=>e.startsWith(`@container`)&&(e[10]===`/`&&e[11]!==void 0||e[11]===`s`&&e[16]!==void 0&&e.startsWith(`-size/`,10)||e[11]===`n`&&e[18]!==void 0&&e.startsWith(`-normal/`,10)),zm=e=>th(e,ah,Pm),Y=e=>ym.test(e),Bm=e=>th(e,oh,Nm),Vm=e=>th(e,sh,Om),Hm=e=>th(e,lh,Mm),Um=e=>th(e,ch,Pm),Wm=e=>th(e,rh,Pm),Gm=e=>th(e,ih,Im),Km=e=>th(e,uh,Fm),qm=e=>bm.test(e),Jm=e=>nh(e,oh),Ym=e=>nh(e,ch),Xm=e=>nh(e,rh),Zm=e=>nh(e,ah),Qm=e=>nh(e,ih),$m=e=>nh(e,uh,!0),eh=e=>nh(e,lh,!0),th=(e,t,n)=>{let r=ym.exec(e);return r?r[1]?t(r[1]):n(r[2]):!1},nh=(e,t,n=!1)=>{let r=bm.exec(e);return r?r[1]?t(r[1]):n:!1},rh=e=>e===`position`||e===`percentage`,ih=e=>e===`image`||e===`url`,ah=e=>e===`length`||e===`size`||e===`bg-size`,oh=e=>e===`length`,sh=e=>e===`number`,ch=e=>e===`family-name`,lh=e=>e===`number`||e===`weight`,uh=e=>e===`shadow`,dh=()=>{let e=vm(`color`),t=vm(`font`),n=vm(`text`),r=vm(`font-weight`),i=vm(`tracking`),a=vm(`leading`),o=vm(`breakpoint`),s=vm(`container`),c=vm(`spacing`),l=vm(`radius`),u=vm(`shadow`),d=vm(`inset-shadow`),f=vm(`text-shadow`),p=vm(`drop-shadow`),m=vm(`blur`),h=vm(`perspective`),g=vm(`aspect`),_=vm(`ease`),v=vm(`animate`),y=()=>[`auto`,`avoid`,`all`,`avoid-page`,`page`,`left`,`right`,`column`],b=()=>[`center`,`top`,`bottom`,`left`,`right`,`top-left`,`left-top`,`top-right`,`right-top`,`bottom-right`,`right-bottom`,`bottom-left`,`left-bottom`],x=()=>[...b(),qm,Y],S=()=>[`auto`,`hidden`,`clip`,`visible`,`scroll`],C=()=>[`auto`,`contain`,`none`],w=()=>[qm,Y,c],T=()=>[Dm,`full`,`auto`,...w()],E=()=>[km,`none`,`subgrid`,qm,Y],D=()=>[`auto`,{span:[`full`,km,qm,Y]},km,qm,Y],O=()=>[km,`auto`,qm,Y],k=()=>[`auto`,`min`,`max`,`fr`,qm,Y],A=()=>[`start`,`end`,`center`,`between`,`around`,`evenly`,`stretch`,`baseline`,`center-safe`,`end-safe`],j=()=>[`start`,`end`,`center`,`stretch`,`center-safe`,`end-safe`],M=()=>[`auto`,...w()],N=()=>[Dm,`auto`,`full`,`dvw`,`dvh`,`lvw`,`lvh`,`svw`,`svh`,`min`,`max`,`fit`,...w()],P=()=>[s,Dm,`screen`,`full`,`dvw`,`lvw`,`svw`,`min`,`max`,`fit`,...w()],F=()=>[Dm,`screen`,`full`,`lh`,`dvh`,`lvh`,`svh`,`min`,`max`,`fit`,...w()],I=()=>[e,qm,Y],L=()=>[...b(),Xm,Wm,{position:[qm,Y]}],R=()=>[`no-repeat`,{repeat:[``,`x`,`y`,`space`,`round`]}],ee=()=>[`auto`,`cover`,`contain`,Zm,zm,{size:[qm,Y]}],z=()=>[Am,Jm,Bm],te=()=>[``,`none`,`full`,l,qm,Y],B=()=>[``,Om,Jm,Bm],ne=()=>[`solid`,`dashed`,`dotted`,`double`],V=()=>[`normal`,`multiply`,`screen`,`overlay`,`darken`,`lighten`,`color-dodge`,`color-burn`,`hard-light`,`soft-light`,`difference`,`exclusion`,`hue`,`saturation`,`color`,`luminosity`],H=()=>[Om,Am,Xm,Wm],re=()=>[``,`none`,m,qm,Y],ie=()=>[`none`,Om,qm,Y],ae=()=>[`none`,Om,qm,Y],oe=()=>[Om,qm,Y],se=()=>[Dm,`full`,...w()];return{cacheSize:500,theme:{animate:[`spin`,`ping`,`pulse`,`bounce`],aspect:[`video`],blur:[jm],breakpoint:[jm],color:[Mm],container:[jm],"drop-shadow":[jm],ease:[`in`,`out`,`in-out`],font:[Lm],"font-weight":[`thin`,`extralight`,`light`,`normal`,`medium`,`semibold`,`bold`,`extrabold`,`black`],"inset-shadow":[jm],leading:[`none`,`tight`,`snug`,`normal`,`relaxed`,`loose`],perspective:[`dramatic`,`near`,`normal`,`midrange`,`distant`,`none`],radius:[jm],shadow:[jm],spacing:[`px`,Om],text:[jm],"text-shadow":[jm],tracking:[`tighter`,`tight`,`normal`,`wide`,`wider`,`widest`]},classGroups:{aspect:[{aspect:[`auto`,`square`,Dm,Y,qm,g]}],container:[`container`],"container-type":[{"@container":[``,`normal`,`size`,qm,Y]}],"container-named":[Rm],columns:[{columns:[Om,`auto`,Y,qm,s]}],"break-after":[{"break-after":y()}],"break-before":[{"break-before":y()}],"break-inside":[{"break-inside":[`auto`,`avoid`,`avoid-page`,`avoid-column`]}],"box-decoration":[{"box-decoration":[`slice`,`clone`]}],box:[{box:[`border`,`content`]}],display:[`block`,`inline-block`,`inline`,`flex`,`inline-flex`,`table`,`inline-table`,`table-caption`,`table-cell`,`table-column`,`table-column-group`,`table-footer-group`,`table-header-group`,`table-row-group`,`table-row`,`flow-root`,`grid`,`inline-grid`,`contents`,`list-item`,`hidden`],sr:[`sr-only`,`not-sr-only`],float:[{float:[`right`,`left`,`none`,`start`,`end`]}],clear:[{clear:[`left`,`right`,`both`,`none`,`start`,`end`]}],isolation:[`isolate`,`isolation-auto`],"object-fit":[{object:[`contain`,`cover`,`fill`,`none`,`scale-down`]}],"object-position":[{object:x()}],overflow:[{overflow:S()}],"overflow-x":[{"overflow-x":S()}],"overflow-y":[{"overflow-y":S()}],overscroll:[{overscroll:C()}],"overscroll-x":[{"overscroll-x":C()}],"overscroll-y":[{"overscroll-y":C()}],position:[`static`,`fixed`,`absolute`,`relative`,`sticky`],inset:[{inset:T()}],"inset-x":[{"inset-x":T()}],"inset-y":[{"inset-y":T()}],start:[{"inset-s":T(),start:T()}],end:[{"inset-e":T(),end:T()}],"inset-bs":[{"inset-bs":T()}],"inset-be":[{"inset-be":T()}],top:[{top:T()}],right:[{right:T()}],bottom:[{bottom:T()}],left:[{left:T()}],visibility:[`visible`,`invisible`,`collapse`],z:[{z:[km,`auto`,qm,Y]}],basis:[{basis:[Dm,`full`,`auto`,s,...w()]}],"flex-direction":[{flex:[`row`,`row-reverse`,`col`,`col-reverse`]}],"flex-wrap":[{flex:[`nowrap`,`wrap`,`wrap-reverse`]}],flex:[{flex:[Om,Dm,`auto`,`initial`,`none`,Y]}],grow:[{grow:[``,Om,qm,Y]}],shrink:[{shrink:[``,Om,qm,Y]}],order:[{order:[km,`first`,`last`,`none`,qm,Y]}],"grid-cols":[{"grid-cols":E()}],"col-start-end":[{col:D()}],"col-start":[{"col-start":O()}],"col-end":[{"col-end":O()}],"grid-rows":[{"grid-rows":E()}],"row-start-end":[{row:D()}],"row-start":[{"row-start":O()}],"row-end":[{"row-end":O()}],"grid-flow":[{"grid-flow":[`row`,`col`,`dense`,`row-dense`,`col-dense`]}],"auto-cols":[{"auto-cols":k()}],"auto-rows":[{"auto-rows":k()}],gap:[{gap:w()}],"gap-x":[{"gap-x":w()}],"gap-y":[{"gap-y":w()}],"justify-content":[{justify:[...A(),`normal`]}],"justify-items":[{"justify-items":[...j(),`normal`]}],"justify-self":[{"justify-self":[`auto`,...j()]}],"align-content":[{content:[`normal`,...A()]}],"align-items":[{items:[...j(),{baseline:[``,`last`]}]}],"align-self":[{self:[`auto`,...j(),{baseline:[``,`last`]}]}],"place-content":[{"place-content":A()}],"place-items":[{"place-items":[...j(),`baseline`]}],"place-self":[{"place-self":[`auto`,...j()]}],p:[{p:w()}],px:[{px:w()}],py:[{py:w()}],ps:[{ps:w()}],pe:[{pe:w()}],pbs:[{pbs:w()}],pbe:[{pbe:w()}],pt:[{pt:w()}],pr:[{pr:w()}],pb:[{pb:w()}],pl:[{pl:w()}],m:[{m:M()}],mx:[{mx:M()}],my:[{my:M()}],ms:[{ms:M()}],me:[{me:M()}],mbs:[{mbs:M()}],mbe:[{mbe:M()}],mt:[{mt:M()}],mr:[{mr:M()}],mb:[{mb:M()}],ml:[{ml:M()}],"space-x":[{"space-x":w()}],"space-x-reverse":[`space-x-reverse`],"space-y":[{"space-y":w()}],"space-y-reverse":[`space-y-reverse`],size:[{size:N()}],"inline-size":[{inline:[`auto`,...P()]}],"min-inline-size":[{"min-inline":[`auto`,...P()]}],"max-inline-size":[{"max-inline":[`none`,...P()]}],"block-size":[{block:[`auto`,...F()]}],"min-block-size":[{"min-block":[`auto`,...F()]}],"max-block-size":[{"max-block":[`none`,...F()]}],w:[{w:[s,`screen`,...N()]}],"min-w":[{"min-w":[s,`screen`,`none`,...N()]}],"max-w":[{"max-w":[s,`screen`,`none`,`prose`,{screen:[o]},...N()]}],h:[{h:[`screen`,`lh`,...N()]}],"min-h":[{"min-h":[`screen`,`lh`,`none`,...N()]}],"max-h":[{"max-h":[`screen`,`lh`,`none`,...N()]}],"font-size":[{text:[`base`,n,Jm,Bm]}],"font-smoothing":[`antialiased`,`subpixel-antialiased`],"font-style":[`italic`,`not-italic`],"font-weight":[{font:[r,eh,Hm]}],"font-stretch":[{"font-stretch":[`ultra-condensed`,`extra-condensed`,`condensed`,`semi-condensed`,`normal`,`semi-expanded`,`expanded`,`extra-expanded`,`ultra-expanded`,Am,Y]}],"font-family":[{font:[Ym,Um,t]}],"font-features":[{"font-features":[Y]}],"fvn-normal":[`normal-nums`],"fvn-ordinal":[`ordinal`],"fvn-slashed-zero":[`slashed-zero`],"fvn-figure":[`lining-nums`,`oldstyle-nums`],"fvn-spacing":[`proportional-nums`,`tabular-nums`],"fvn-fraction":[`diagonal-fractions`,`stacked-fractions`],tracking:[{tracking:[i,qm,Y]}],"line-clamp":[{"line-clamp":[Om,`none`,qm,Vm]}],leading:[{leading:[`none`,a,...w()]}],"list-image":[{"list-image":[`none`,qm,Y]}],"list-style-position":[{list:[`inside`,`outside`]}],"list-style-type":[{list:[`disc`,`decimal`,`none`,qm,Y]}],"text-alignment":[{text:[`left`,`center`,`right`,`justify`,`start`,`end`]}],"placeholder-color":[{placeholder:I()}],"text-color":[{text:I()}],"text-decoration":[`underline`,`overline`,`line-through`,`no-underline`],"text-decoration-style":[{decoration:[...ne(),`wavy`]}],"text-decoration-thickness":[{decoration:[Om,`from-font`,`auto`,qm,Bm]}],"text-decoration-color":[{decoration:I()}],"underline-offset":[{"underline-offset":[Om,`auto`,qm,Y]}],"text-transform":[`uppercase`,`lowercase`,`capitalize`,`normal-case`],"text-overflow":[`truncate`,`text-ellipsis`,`text-clip`],"text-wrap":[{text:[`wrap`,`nowrap`,`balance`,`pretty`]}],indent:[{indent:w()}],"tab-size":[{tab:[km,qm,Y]}],"vertical-align":[{align:[`baseline`,`top`,`middle`,`bottom`,`text-top`,`text-bottom`,`sub`,`super`,qm,Y]}],whitespace:[{whitespace:[`normal`,`nowrap`,`pre`,`pre-line`,`pre-wrap`,`break-spaces`]}],break:[{break:[`normal`,`words`,`all`,`keep`]}],wrap:[{wrap:[`break-word`,`anywhere`,`normal`]}],hyphens:[{hyphens:[`none`,`manual`,`auto`]}],content:[{content:[`none`,qm,Y]}],"bg-attachment":[{bg:[`fixed`,`local`,`scroll`]}],"bg-clip":[{"bg-clip":[`border`,`padding`,`content`,`text`]}],"bg-origin":[{"bg-origin":[`border`,`padding`,`content`]}],"bg-position":[{bg:L()}],"bg-repeat":[{bg:R()}],"bg-size":[{bg:ee()}],"bg-image":[{bg:[`none`,{linear:[{to:[`t`,`tr`,`r`,`br`,`b`,`bl`,`l`,`tl`]},km,qm,Y],radial:[``,qm,Y],conic:[``,km,qm,Y]},Qm,Gm]}],"bg-color":[{bg:I()}],"gradient-from-pos":[{from:z()}],"gradient-via-pos":[{via:z()}],"gradient-to-pos":[{to:z()}],"gradient-from":[{from:I()}],"gradient-via":[{via:I()}],"gradient-to":[{to:I()}],rounded:[{rounded:te()}],"rounded-s":[{"rounded-s":te()}],"rounded-e":[{"rounded-e":te()}],"rounded-t":[{"rounded-t":te()}],"rounded-r":[{"rounded-r":te()}],"rounded-b":[{"rounded-b":te()}],"rounded-l":[{"rounded-l":te()}],"rounded-ss":[{"rounded-ss":te()}],"rounded-se":[{"rounded-se":te()}],"rounded-ee":[{"rounded-ee":te()}],"rounded-es":[{"rounded-es":te()}],"rounded-tl":[{"rounded-tl":te()}],"rounded-tr":[{"rounded-tr":te()}],"rounded-br":[{"rounded-br":te()}],"rounded-bl":[{"rounded-bl":te()}],"border-w":[{border:B()}],"border-w-x":[{"border-x":B()}],"border-w-y":[{"border-y":B()}],"border-w-s":[{"border-s":B()}],"border-w-e":[{"border-e":B()}],"border-w-bs":[{"border-bs":B()}],"border-w-be":[{"border-be":B()}],"border-w-t":[{"border-t":B()}],"border-w-r":[{"border-r":B()}],"border-w-b":[{"border-b":B()}],"border-w-l":[{"border-l":B()}],"divide-x":[{"divide-x":B()}],"divide-x-reverse":[`divide-x-reverse`],"divide-y":[{"divide-y":B()}],"divide-y-reverse":[`divide-y-reverse`],"border-style":[{border:[...ne(),`hidden`,`none`]}],"divide-style":[{divide:[...ne(),`hidden`,`none`]}],"border-color":[{border:I()}],"border-color-x":[{"border-x":I()}],"border-color-y":[{"border-y":I()}],"border-color-s":[{"border-s":I()}],"border-color-e":[{"border-e":I()}],"border-color-bs":[{"border-bs":I()}],"border-color-be":[{"border-be":I()}],"border-color-t":[{"border-t":I()}],"border-color-r":[{"border-r":I()}],"border-color-b":[{"border-b":I()}],"border-color-l":[{"border-l":I()}],"divide-color":[{divide:I()}],"outline-style":[{outline:[...ne(),`none`,`hidden`]}],"outline-offset":[{"outline-offset":[Om,qm,Y]}],"outline-w":[{outline:[``,Om,Jm,Bm]}],"outline-color":[{outline:I()}],shadow:[{shadow:[``,`inner`,`none`,u,$m,Km]}],"shadow-color":[{shadow:I()}],"inset-shadow":[{"inset-shadow":[`none`,d,$m,Km]}],"inset-shadow-color":[{"inset-shadow":I()}],"ring-w":[{ring:B()}],"ring-w-inset":[`ring-inset`],"ring-color":[{ring:I()}],"ring-offset-w":[{"ring-offset":[Om,Bm]}],"ring-offset-color":[{"ring-offset":I()}],"inset-ring-w":[{"inset-ring":B()}],"inset-ring-color":[{"inset-ring":I()}],"text-shadow":[{"text-shadow":[`none`,f,$m,Km]}],"text-shadow-color":[{"text-shadow":I()}],opacity:[{opacity:[Om,qm,Y]}],"mix-blend":[{"mix-blend":[...V(),`plus-darker`,`plus-lighter`]}],"bg-blend":[{"bg-blend":V()}],"mask-clip":[{"mask-clip":[`border`,`padding`,`content`,`fill`,`stroke`,`view`]},`mask-no-clip`],"mask-composite":[{mask:[`add`,`subtract`,`intersect`,`exclude`]}],"mask-image-linear-pos":[{"mask-linear":[Om]}],"mask-image-linear-from-pos":[{"mask-linear-from":H()}],"mask-image-linear-to-pos":[{"mask-linear-to":H()}],"mask-image-linear-from-color":[{"mask-linear-from":I()}],"mask-image-linear-to-color":[{"mask-linear-to":I()}],"mask-image-t-from-pos":[{"mask-t-from":H()}],"mask-image-t-to-pos":[{"mask-t-to":H()}],"mask-image-t-from-color":[{"mask-t-from":I()}],"mask-image-t-to-color":[{"mask-t-to":I()}],"mask-image-r-from-pos":[{"mask-r-from":H()}],"mask-image-r-to-pos":[{"mask-r-to":H()}],"mask-image-r-from-color":[{"mask-r-from":I()}],"mask-image-r-to-color":[{"mask-r-to":I()}],"mask-image-b-from-pos":[{"mask-b-from":H()}],"mask-image-b-to-pos":[{"mask-b-to":H()}],"mask-image-b-from-color":[{"mask-b-from":I()}],"mask-image-b-to-color":[{"mask-b-to":I()}],"mask-image-l-from-pos":[{"mask-l-from":H()}],"mask-image-l-to-pos":[{"mask-l-to":H()}],"mask-image-l-from-color":[{"mask-l-from":I()}],"mask-image-l-to-color":[{"mask-l-to":I()}],"mask-image-x-from-pos":[{"mask-x-from":H()}],"mask-image-x-to-pos":[{"mask-x-to":H()}],"mask-image-x-from-color":[{"mask-x-from":I()}],"mask-image-x-to-color":[{"mask-x-to":I()}],"mask-image-y-from-pos":[{"mask-y-from":H()}],"mask-image-y-to-pos":[{"mask-y-to":H()}],"mask-image-y-from-color":[{"mask-y-from":I()}],"mask-image-y-to-color":[{"mask-y-to":I()}],"mask-image-radial":[{"mask-radial":[qm,Y]}],"mask-image-radial-from-pos":[{"mask-radial-from":H()}],"mask-image-radial-to-pos":[{"mask-radial-to":H()}],"mask-image-radial-from-color":[{"mask-radial-from":I()}],"mask-image-radial-to-color":[{"mask-radial-to":I()}],"mask-image-radial-shape":[{"mask-radial":[`circle`,`ellipse`]}],"mask-image-radial-size":[{"mask-radial":[{closest:[`side`,`corner`],farthest:[`side`,`corner`]}]}],"mask-image-radial-pos":[{"mask-radial-at":b()}],"mask-image-conic-pos":[{"mask-conic":[Om]}],"mask-image-conic-from-pos":[{"mask-conic-from":H()}],"mask-image-conic-to-pos":[{"mask-conic-to":H()}],"mask-image-conic-from-color":[{"mask-conic-from":I()}],"mask-image-conic-to-color":[{"mask-conic-to":I()}],"mask-mode":[{mask:[`alpha`,`luminance`,`match`]}],"mask-origin":[{"mask-origin":[`border`,`padding`,`content`,`fill`,`stroke`,`view`]}],"mask-position":[{mask:L()}],"mask-repeat":[{mask:R()}],"mask-size":[{mask:ee()}],"mask-type":[{"mask-type":[`alpha`,`luminance`]}],"mask-image":[{mask:[`none`,qm,Y]}],filter:[{filter:[``,`none`,qm,Y]}],blur:[{blur:re()}],brightness:[{brightness:[Om,qm,Y]}],contrast:[{contrast:[Om,qm,Y]}],"drop-shadow":[{"drop-shadow":[``,`none`,p,$m,Km]}],"drop-shadow-color":[{"drop-shadow":I()}],grayscale:[{grayscale:[``,Om,qm,Y]}],"hue-rotate":[{"hue-rotate":[Om,qm,Y]}],invert:[{invert:[``,Om,qm,Y]}],saturate:[{saturate:[Om,qm,Y]}],sepia:[{sepia:[``,Om,qm,Y]}],"backdrop-filter":[{"backdrop-filter":[``,`none`,qm,Y]}],"backdrop-blur":[{"backdrop-blur":re()}],"backdrop-brightness":[{"backdrop-brightness":[Om,qm,Y]}],"backdrop-contrast":[{"backdrop-contrast":[Om,qm,Y]}],"backdrop-grayscale":[{"backdrop-grayscale":[``,Om,qm,Y]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[Om,qm,Y]}],"backdrop-invert":[{"backdrop-invert":[``,Om,qm,Y]}],"backdrop-opacity":[{"backdrop-opacity":[Om,qm,Y]}],"backdrop-saturate":[{"backdrop-saturate":[Om,qm,Y]}],"backdrop-sepia":[{"backdrop-sepia":[``,Om,qm,Y]}],"border-collapse":[{border:[`collapse`,`separate`]}],"border-spacing":[{"border-spacing":w()}],"border-spacing-x":[{"border-spacing-x":w()}],"border-spacing-y":[{"border-spacing-y":w()}],"table-layout":[{table:[`auto`,`fixed`]}],caption:[{caption:[`top`,`bottom`]}],transition:[{transition:[``,`all`,`colors`,`opacity`,`shadow`,`transform`,`none`,qm,Y]}],"transition-behavior":[{transition:[`normal`,`discrete`]}],duration:[{duration:[Om,`initial`,qm,Y]}],ease:[{ease:[`linear`,`initial`,_,qm,Y]}],delay:[{delay:[Om,qm,Y]}],animate:[{animate:[`none`,v,qm,Y]}],backface:[{backface:[`hidden`,`visible`]}],perspective:[{perspective:[h,qm,Y]}],"perspective-origin":[{"perspective-origin":x()}],rotate:[{rotate:ie()}],"rotate-x":[{"rotate-x":ie()}],"rotate-y":[{"rotate-y":ie()}],"rotate-z":[{"rotate-z":ie()}],scale:[{scale:ae()}],"scale-x":[{"scale-x":ae()}],"scale-y":[{"scale-y":ae()}],"scale-z":[{"scale-z":ae()}],"scale-3d":[`scale-3d`],skew:[{skew:oe()}],"skew-x":[{"skew-x":oe()}],"skew-y":[{"skew-y":oe()}],transform:[{transform:[qm,Y,``,`none`,`gpu`,`cpu`]}],"transform-origin":[{origin:x()}],"transform-style":[{transform:[`3d`,`flat`]}],translate:[{translate:se()}],"translate-x":[{"translate-x":se()}],"translate-y":[{"translate-y":se()}],"translate-z":[{"translate-z":se()}],"translate-none":[`translate-none`],zoom:[{zoom:[km,qm,Y]}],accent:[{accent:I()}],appearance:[{appearance:[`none`,`auto`]}],"caret-color":[{caret:I()}],"color-scheme":[{scheme:[`normal`,`dark`,`light`,`light-dark`,`only-dark`,`only-light`]}],cursor:[{cursor:[`auto`,`default`,`pointer`,`wait`,`text`,`move`,`help`,`not-allowed`,`none`,`context-menu`,`progress`,`cell`,`crosshair`,`vertical-text`,`alias`,`copy`,`no-drop`,`grab`,`grabbing`,`all-scroll`,`col-resize`,`row-resize`,`n-resize`,`e-resize`,`s-resize`,`w-resize`,`ne-resize`,`nw-resize`,`se-resize`,`sw-resize`,`ew-resize`,`ns-resize`,`nesw-resize`,`nwse-resize`,`zoom-in`,`zoom-out`,qm,Y]}],"field-sizing":[{"field-sizing":[`fixed`,`content`]}],"pointer-events":[{"pointer-events":[`auto`,`none`]}],resize:[{resize:[`none`,``,`y`,`x`]}],"scroll-behavior":[{scroll:[`auto`,`smooth`]}],"scrollbar-thumb-color":[{"scrollbar-thumb":I()}],"scrollbar-track-color":[{"scrollbar-track":I()}],"scrollbar-gutter":[{"scrollbar-gutter":[`auto`,`stable`,`both`]}],"scrollbar-w":[{scrollbar:[`auto`,`thin`,`none`]}],"scroll-m":[{"scroll-m":w()}],"scroll-mx":[{"scroll-mx":w()}],"scroll-my":[{"scroll-my":w()}],"scroll-ms":[{"scroll-ms":w()}],"scroll-me":[{"scroll-me":w()}],"scroll-mbs":[{"scroll-mbs":w()}],"scroll-mbe":[{"scroll-mbe":w()}],"scroll-mt":[{"scroll-mt":w()}],"scroll-mr":[{"scroll-mr":w()}],"scroll-mb":[{"scroll-mb":w()}],"scroll-ml":[{"scroll-ml":w()}],"scroll-p":[{"scroll-p":w()}],"scroll-px":[{"scroll-px":w()}],"scroll-py":[{"scroll-py":w()}],"scroll-ps":[{"scroll-ps":w()}],"scroll-pe":[{"scroll-pe":w()}],"scroll-pbs":[{"scroll-pbs":w()}],"scroll-pbe":[{"scroll-pbe":w()}],"scroll-pt":[{"scroll-pt":w()}],"scroll-pr":[{"scroll-pr":w()}],"scroll-pb":[{"scroll-pb":w()}],"scroll-pl":[{"scroll-pl":w()}],"snap-align":[{snap:[`start`,`end`,`center`,`align-none`]}],"snap-stop":[{snap:[`normal`,`always`]}],"snap-type":[{snap:[`none`,`x`,`y`,`both`]}],"snap-strictness":[{snap:[`mandatory`,`proximity`]}],touch:[{touch:[`auto`,`none`,`manipulation`]}],"touch-x":[{"touch-pan":[`x`,`left`,`right`]}],"touch-y":[{"touch-pan":[`y`,`up`,`down`]}],"touch-pz":[`touch-pinch-zoom`],select:[{select:[`none`,`text`,`all`,`auto`]}],"will-change":[{"will-change":[`auto`,`scroll`,`contents`,`transform`,qm,Y]}],fill:[{fill:[`none`,...I()]}],"stroke-w":[{stroke:[Om,Jm,Bm,Vm]}],stroke:[{stroke:[`none`,...I()]}],"forced-color-adjust":[{"forced-color-adjust":[`auto`,`none`]}]},conflictingClassGroups:{"container-named":[`container-type`],overflow:[`overflow-x`,`overflow-y`],overscroll:[`overscroll-x`,`overscroll-y`],inset:[`inset-x`,`inset-y`,`inset-bs`,`inset-be`,`start`,`end`,`top`,`right`,`bottom`,`left`],"inset-x":[`start`,`end`,`right`,`left`],"inset-y":[`inset-bs`,`inset-be`,`top`,`bottom`],flex:[`basis`,`grow`,`shrink`],gap:[`gap-x`,`gap-y`],p:[`px`,`py`,`ps`,`pe`,`pbs`,`pbe`,`pt`,`pr`,`pb`,`pl`],px:[`ps`,`pe`,`pr`,`pl`],py:[`pbs`,`pbe`,`pt`,`pb`],m:[`mx`,`my`,`ms`,`me`,`mbs`,`mbe`,`mt`,`mr`,`mb`,`ml`],mx:[`ms`,`me`,`mr`,`ml`],my:[`mbs`,`mbe`,`mt`,`mb`],size:[`w`,`h`],"font-size":[`leading`],"fvn-normal":[`fvn-ordinal`,`fvn-slashed-zero`,`fvn-figure`,`fvn-spacing`,`fvn-fraction`],"fvn-ordinal":[`fvn-normal`],"fvn-slashed-zero":[`fvn-normal`],"fvn-figure":[`fvn-normal`],"fvn-spacing":[`fvn-normal`],"fvn-fraction":[`fvn-normal`],"line-clamp":[`display`,`overflow`],rounded:[`rounded-s`,`rounded-e`,`rounded-t`,`rounded-r`,`rounded-b`,`rounded-l`,`rounded-ss`,`rounded-se`,`rounded-ee`,`rounded-es`,`rounded-tl`,`rounded-tr`,`rounded-br`,`rounded-bl`],"rounded-s":[`rounded-ss`,`rounded-es`],"rounded-e":[`rounded-se`,`rounded-ee`],"rounded-t":[`rounded-tl`,`rounded-tr`],"rounded-r":[`rounded-tr`,`rounded-br`],"rounded-b":[`rounded-br`,`rounded-bl`],"rounded-l":[`rounded-tl`,`rounded-bl`],"border-spacing":[`border-spacing-x`,`border-spacing-y`],"border-w":[`border-w-x`,`border-w-y`,`border-w-s`,`border-w-e`,`border-w-bs`,`border-w-be`,`border-w-t`,`border-w-r`,`border-w-b`,`border-w-l`],"border-w-x":[`border-w-s`,`border-w-e`,`border-w-r`,`border-w-l`],"border-w-y":[`border-w-bs`,`border-w-be`,`border-w-t`,`border-w-b`],"border-color":[`border-color-x`,`border-color-y`,`border-color-s`,`border-color-e`,`border-color-bs`,`border-color-be`,`border-color-t`,`border-color-r`,`border-color-b`,`border-color-l`],"border-color-x":[`border-color-s`,`border-color-e`,`border-color-r`,`border-color-l`],"border-color-y":[`border-color-bs`,`border-color-be`,`border-color-t`,`border-color-b`],translate:[`translate-x`,`translate-y`,`translate-none`],"translate-none":[`translate`,`translate-x`,`translate-y`,`translate-z`],"scroll-m":[`scroll-mx`,`scroll-my`,`scroll-ms`,`scroll-me`,`scroll-mbs`,`scroll-mbe`,`scroll-mt`,`scroll-mr`,`scroll-mb`,`scroll-ml`],"scroll-mx":[`scroll-ms`,`scroll-me`,`scroll-mr`,`scroll-ml`],"scroll-my":[`scroll-mbs`,`scroll-mbe`,`scroll-mt`,`scroll-mb`],"scroll-p":[`scroll-px`,`scroll-py`,`scroll-ps`,`scroll-pe`,`scroll-pbs`,`scroll-pbe`,`scroll-pt`,`scroll-pr`,`scroll-pb`,`scroll-pl`],"scroll-px":[`scroll-ps`,`scroll-pe`,`scroll-pr`,`scroll-pl`],"scroll-py":[`scroll-pbs`,`scroll-pbe`,`scroll-pt`,`scroll-pb`],touch:[`touch-x`,`touch-y`,`touch-pz`],"touch-x":[`touch`],"touch-y":[`touch`],"touch-pz":[`touch`]},conflictingClassGroupModifiers:{"font-size":[`leading`]},postfixLookupClassGroups:[`container-type`],orderSensitiveModifiers:[`*`,`**`,`after`,`backdrop`,`before`,`details-content`,`file`,`first-letter`,`first-line`,`marker`,`placeholder`,`selection`]}},fh=(e,{cacheSize:t,prefix:n,experimentalParseClassName:r,extend:i={},override:a={}})=>(ph(e,`cacheSize`,t),ph(e,`prefix`,n),ph(e,`experimentalParseClassName`,r),mh(e.theme,a.theme),mh(e.classGroups,a.classGroups),mh(e.conflictingClassGroups,a.conflictingClassGroups),mh(e.conflictingClassGroupModifiers,a.conflictingClassGroupModifiers),ph(e,`postfixLookupClassGroups`,a.postfixLookupClassGroups),ph(e,`orderSensitiveModifiers`,a.orderSensitiveModifiers),hh(e.theme,i.theme),hh(e.classGroups,i.classGroups),hh(e.conflictingClassGroups,i.conflictingClassGroups),hh(e.conflictingClassGroupModifiers,i.conflictingClassGroupModifiers),gh(e,i,`postfixLookupClassGroups`),gh(e,i,`orderSensitiveModifiers`),e),ph=(e,t,n)=>{n!==void 0&&(e[t]=n)},mh=(e,t)=>{if(t)for(let n in t)ph(e,n,t[n])},hh=(e,t)=>{if(t)for(let n in t)gh(e,t,n)},gh=(e,t,n)=>{let r=t[n];r!==void 0&&(e[n]=e[n]?e[n].concat(r):r)},_h=((e,...t)=>typeof e==`function`?gm(dh,e,...t):gm(()=>fh(dh(),e),...t))({extend:{theme:{text:[`title`,`heading`,`body`,`ui`,`caption`,`code`,`code-compact`,`code-comfy`,`kbd`]}}}),X=(...e)=>_h(Rp(e)),vh=e=>e,yh=e=>e?.replace(/([a-z0-9])([A-Z])/g,`$1-$2`).toLowerCase();function bh(e,t,n=[]){if(t==null)throw Error(`[lucide]: iconNode is required when icon name is used`);return{name:yh(e),size:24,node:t,...n.length>0?{aliases:n}:{}}}var xh=e=>{let t=``,n=!1;for(let r of e)r===`-`||r===`_`||r<=` `?n=t.length>0:(t.length===0?t+=r.toLowerCase():t+=n?r.toUpperCase():r,n=!1);return t},Sh=e=>{let t=xh(e);return t.charAt(0).toUpperCase()+t.slice(1)},Ch=(...e)=>e.filter((e,t,n)=>!!e&&e.trim()!==``&&n.indexOf(e)===t).join(` `).trim(),wh={xmlns:`http://www.w3.org/2000/svg`,width:24,height:24,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":2,"stroke-linecap":`round`,"stroke-linejoin":`round`};function Th(e){return e!=null}function Eh(e,t={}){let n=t.attributeNames??{},r=e=>n[e]??e,i=e.size??e.width??wh.width,a=e.size??e.height??wh.height,o=e.aliases?.filter(e=>typeof e==`string`&&e.trim()!==``).map(e=>`lucide-${e}`)??[],s=[...e.name?[`lucide-${e.name}`]:[],...o],c=t.className?.split(` `).filter(Boolean)??[],l=t.includeDefaultClasses===!1?Ch(...c):Ch(`lucide`,...s,...c),u=t.absoluteStrokeWidth?Number(t.strokeWidth??wh[`stroke-width`])*Number(e.size??e.width??wh.width)/Number(t.size??t.width??wh.width):t.strokeWidth??wh[`stroke-width`];return[`svg`,{...Object.entries(wh).reduce((e,[t,n])=>(e[r(t)]=n,e),{}),...`color`in t&&t.color&&{[r(`stroke`)]:t.color},...`size`in t&&Th(t.size)&&{[r(`width`)]:t.size,[r(`height`)]:t.size},...`width`in t&&Th(t.width)&&{[r(`width`)]:t.width},...`height`in t&&Th(t.height)&&{[r(`height`)]:t.height},[r(`stroke-width`)]:u,...l&&{[r(`class`)]:l},[r(`viewBox`)]:`0 0 ${i} ${a}`,...t.hasA11yProp===!1?{[r(`aria-hidden`)]:`true`}:{},...`attributes`in t&&t.attributes},e.node.map(e=>{let[n,i,a]=e,o=t.nonScalingStroke?{[r(`vector-effect`)]:`non-scaling-stroke`,...i}:i;return a?[n,o,a]:[n,o]})]}function Dh(e,t={}){return Eh(e,{...t,attributeNames:{...t.attributeNames,class:`className`,"stroke-width":`strokeWidth`,"stroke-linecap":`strokeLinecap`,"stroke-linejoin":`strokeLinejoin`,"vector-effect":`vectorEffect`}})}var Oh=e=>{for(let t in e)if(t.startsWith(`aria-`)||t===`role`||t===`title`)return!0;return!1},kh=(0,q.createContext)({}),Ah=()=>(0,q.useContext)(kh),jh=(0,q.forwardRef)(({color:e,size:t,width:n,height:r,strokeWidth:i,absoluteStrokeWidth:a,nonScalingStroke:o,className:s=``,children:c,iconNode:l=[],icon:u={node:l,aliases:[],size:24},...d},f)=>{let{size:p=24,strokeWidth:m=2,absoluteStrokeWidth:h=!1,nonScalingStroke:g=!1,color:_=`currentColor`,className:v=``}=Ah()??{},y=!!c||Oh(d),[b,x,S=[]]=Dh(u,{color:e??_,width:n??t??p,height:r??t??p,strokeWidth:i??m,absoluteStrokeWidth:a??h,nonScalingStroke:o??g,className:Ch(v,s),hasA11yProp:y,attributes:d});return(0,q.createElement)(b,{ref:f,...x},[...S.map(([e,t])=>(0,q.createElement)(e,t)),...Array.isArray(c)?c:[c]])});function Mh(e,t=[],n=[]){let r=typeof e==`string`?bh(e,t,n):e,i=(0,q.forwardRef)(({className:e,...t},n)=>(0,q.createElement)(jh,{ref:n,icon:r,className:e,...t}));return r.name&&(i.displayName=Sh(r.name)),i}var Nh={name:`bug`,size:24,node:[[`path`,{d:`M12 20v-9`,key:`1qisl0`}],[`path`,{d:`M14 7a4 4 0 0 1 4 4v3a6 6 0 0 1-12 0v-3a4 4 0 0 1 4-4z`,key:`uouzyp`}],[`path`,{d:`M14.12 3.88 16 2`,key:`qol33r`}],[`path`,{d:`M21 21a4 4 0 0 0-3.81-4`,key:`1b0z45`}],[`path`,{d:`M21 5a4 4 0 0 1-3.55 3.97`,key:`5cxbf6`}],[`path`,{d:`M22 13h-4`,key:`1jl80f`}],[`path`,{d:`M3 21a4 4 0 0 1 3.81-4`,key:`1fjd4g`}],[`path`,{d:`M3 5a4 4 0 0 0 3.55 3.97`,key:`1d7oge`}],[`path`,{d:`M6 13H2`,key:`82j7cp`}],[`path`,{d:`m8 2 1.88 1.88`,key:`fmnt4t`}],[`path`,{d:`M9 7.13V6a3 3 0 1 1 6 0v1.13`,key:`1vgav8`}]]};Nh.node;var Ph=Mh(Nh),Fh={name:`check`,size:24,node:[[`path`,{d:`M20 6 9 17l-5-5`,key:`1gmf2c`}]]};Fh.node;var Ih=Mh(Fh),Lh={name:`chevron-down`,size:24,node:[[`path`,{d:`m6 9 6 6 6-6`,key:`qrunsl`}]]};Lh.node;var Rh=Mh(Lh),zh={name:`chevron-left`,size:24,node:[[`path`,{d:`m15 18-6-6 6-6`,key:`1wnfg3`}]]};zh.node;var Bh=Mh(zh),Vh={name:`chevron-right`,size:24,node:[[`path`,{d:`m9 18 6-6-6-6`,key:`mthhwq`}]]};Vh.node;var Hh=Mh(Vh),Uh={name:`chevron-up`,size:24,node:[[`path`,{d:`m18 15-6-6-6 6`,key:`153udz`}]]};Uh.node;var Wh=Mh(Uh),Gh={name:`circle-check`,size:24,node:[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`m16 9-5.5 5.5L8 12`,key:`xofnsj`}]],aliases:[`check-circle-2`]};Gh.node;var Kh=Mh(Gh),qh={name:`circle-dashed`,size:24,node:[[`path`,{d:`M10.1 2.182a10 10 0 0 1 3.8 0`,key:`5ilxe3`}],[`path`,{d:`M13.9 21.818a10 10 0 0 1-3.8 0`,key:`11zvb9`}],[`path`,{d:`M17.609 3.721a10 10 0 0 1 2.69 2.7`,key:`1iw5b2`}],[`path`,{d:`M2.182 13.9a10 10 0 0 1 0-3.8`,key:`c0bmvh`}],[`path`,{d:`M20.279 17.609a10 10 0 0 1-2.7 2.69`,key:`1ruxm7`}],[`path`,{d:`M21.818 10.1a10 10 0 0 1 0 3.8`,key:`qkgqxc`}],[`path`,{d:`M3.721 6.391a10 10 0 0 1 2.7-2.69`,key:`1mcia2`}],[`path`,{d:`M6.391 20.279a10 10 0 0 1-2.69-2.7`,key:`1fvljs`}]]};qh.node;var Jh=Mh(qh),Yh={name:`ellipsis`,size:24,node:[[`circle`,{cx:`12`,cy:`12`,r:`1`,key:`41hilf`}],[`circle`,{cx:`19`,cy:`12`,r:`1`,key:`1wjl8i`}],[`circle`,{cx:`5`,cy:`12`,r:`1`,key:`1pcz8c`}]],aliases:[`more-horizontal`]};Yh.node;var Xh=Mh(Yh),Zh={name:`eye-off`,size:24,node:[[`path`,{d:`M10.733 5.076a10.744 10.744 0 0 1 11.205 6.575 1 1 0 0 1 0 .696 10.747 10.747 0 0 1-1.444 2.49`,key:`ct8e1f`}],[`path`,{d:`M14.084 14.158a3 3 0 0 1-4.242-4.242`,key:`151rxh`}],[`path`,{d:`M17.479 17.499a10.75 10.75 0 0 1-15.417-5.151 1 1 0 0 1 0-.696 10.75 10.75 0 0 1 4.446-5.143`,key:`13bj9a`}],[`path`,{d:`m2 2 20 20`,key:`1ooewy`}]]};Zh.node;var Qh=Mh(Zh),$h={name:`file-text`,size:24,node:[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,key:`1oefj6`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`path`,{d:`M10 9H8`,key:`b1mrlr`}],[`path`,{d:`M16 13H8`,key:`t4e002`}],[`path`,{d:`M16 17H8`,key:`z1uh3a`}]]};$h.node;var eg=Mh($h),tg={name:`flag-off`,size:24,node:[[`path`,{d:`M16 16c-3 0-5-2-8-2a6 6 0 0 0-4 1.528`,key:`1q158e`}],[`path`,{d:`m2 2 20 20`,key:`1ooewy`}],[`path`,{d:`M4 22V4`,key:`1plyxx`}],[`path`,{d:`M7.656 2H8c3 0 5 2 7.333 2q2 0 3.067-.8A1 1 0 0 1 20 4v10.347`,key:`xj1b71`}]]};tg.node;var ng=Mh(tg),rg={name:`flask-conical`,size:24,node:[[`path`,{d:`M14 2v6a2 2 0 0 0 .245.96l5.51 10.08A2 2 0 0 1 18 22H6a2 2 0 0 1-1.755-2.96l5.51-10.08A2 2 0 0 0 10 8V2`,key:`18mbvz`}],[`path`,{d:`M6.453 15h11.094`,key:`3shlmq`}],[`path`,{d:`M8.5 2h7`,key:`csnxdl`}]]};rg.node;var ig=Mh(rg),ag={name:`git-merge`,size:24,node:[[`circle`,{cx:`18`,cy:`18`,r:`3`,key:`1xkwt0`}],[`circle`,{cx:`6`,cy:`6`,r:`3`,key:`1lh9wr`}],[`path`,{d:`M6 21V9a9 9 0 0 0 9 9`,key:`7kw0sc`}]]};ag.node;var og=Mh(ag),sg={name:`git-pull-request-arrow`,size:24,node:[[`circle`,{cx:`5`,cy:`6`,r:`3`,key:`1qnov2`}],[`path`,{d:`M5 9v12`,key:`ih889a`}],[`circle`,{cx:`19`,cy:`18`,r:`3`,key:`1qljk2`}],[`path`,{d:`m15 9-3-3 3-3`,key:`1lwv8l`}],[`path`,{d:`M12 6h5a2 2 0 0 1 2 2v7`,key:`1yj91y`}]]};sg.node;var cg=Mh(sg),lg={name:`git-pull-request-closed`,size:24,node:[[`path`,{d:`m15.5 3.5 5 5`,key:`1kmx7t`}],[`path`,{d:`m15.5 8.5 5-5`,key:`saftza`}],[`path`,{d:`M18 11.62V15`,key:`1greaj`}],[`path`,{d:`M6 9v12`,key:`1sc30k`}],[`circle`,{cx:`18`,cy:`18`,r:`3`,key:`1xkwt0`}],[`circle`,{cx:`6`,cy:`6`,r:`3`,key:`1lh9wr`}]]};lg.node;var ug=Mh(lg),dg={name:`git-pull-request-draft`,size:24,node:[[`circle`,{cx:`18`,cy:`18`,r:`3`,key:`1xkwt0`}],[`circle`,{cx:`6`,cy:`6`,r:`3`,key:`1lh9wr`}],[`path`,{d:`M18 6V5`,key:`1oao2s`}],[`path`,{d:`M18 11v-1`,key:`11c8tz`}],[`line`,{x1:`6`,x2:`6`,y1:`9`,y2:`21`,key:`rroup`}]]};dg.node;var fg=Mh(dg),pg={name:`git-pull-request`,size:24,node:[[`circle`,{cx:`18`,cy:`18`,r:`3`,key:`1xkwt0`}],[`circle`,{cx:`6`,cy:`6`,r:`3`,key:`1lh9wr`}],[`path`,{d:`M13 6h3a2 2 0 0 1 2 2v7`,key:`1yeb86`}],[`line`,{x1:`6`,x2:`6`,y1:`9`,y2:`21`,key:`rroup`}]]};pg.node;var mg=Mh(pg),hg={name:`image`,size:24,node:[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,ry:`2`,key:`1m3agn`}],[`circle`,{cx:`9`,cy:`9`,r:`2`,key:`af1f0g`}],[`path`,{d:`m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21`,key:`1xmnt7`}]]};hg.node;var gg=Mh(hg),_g={name:`inbox`,size:24,node:[[`polyline`,{points:`22 12 16 12 14 15 10 15 8 12 2 12`,key:`o97t9d`}],[`path`,{d:`M5.45 5.11 2 12v6a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-6l-3.45-6.89A2 2 0 0 0 16.76 4H7.24a2 2 0 0 0-1.79 1.11z`,key:`oot6mr`}]]};_g.node;var vg=Mh(_g),yg={name:`info`,size:24,node:[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M12 16v-4`,key:`1dtifu`}],[`path`,{d:`M12 8h.01`,key:`e9boi3`}]]};yg.node;var bg=Mh(yg),xg={name:`laptop`,size:24,node:[[`path`,{d:`M18 5a2 2 0 0 1 2 2v8.526a2 2 0 0 0 .212.897l1.068 2.127a1 1 0 0 1-.9 1.45H3.62a1 1 0 0 1-.9-1.45l1.068-2.127A2 2 0 0 0 4 15.526V7a2 2 0 0 1 2-2z`,key:`1pdavp`}],[`path`,{d:`M20.054 15.987H3.946`,key:`14rxg9`}]]};xg.node;var Sg=Mh(xg),Cg={name:`layout-grid`,size:24,node:[[`rect`,{width:`7`,height:`7`,x:`3`,y:`3`,rx:`1`,key:`1g98yp`}],[`rect`,{width:`7`,height:`7`,x:`14`,y:`3`,rx:`1`,key:`6d4xhi`}],[`rect`,{width:`7`,height:`7`,x:`14`,y:`14`,rx:`1`,key:`nxv5o0`}],[`rect`,{width:`7`,height:`7`,x:`3`,y:`14`,rx:`1`,key:`1bb6yr`}]]};Cg.node;var wg=Mh(Cg),Tg={name:`link`,size:24,node:[[`path`,{d:`M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71`,key:`1cjeqo`}],[`path`,{d:`M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71`,key:`19qd67`}]]};Tg.node;var Eg=Mh(Tg),Dg={name:`loader-circle`,size:24,node:[[`path`,{d:`M21 12a9 9 0 1 1-6.219-8.56`,key:`13zald`}]],aliases:[`loader-2`]};Dg.node;var Og=Mh(Dg),kg={name:`lock`,size:24,node:[[`rect`,{width:`18`,height:`11`,x:`3`,y:`11`,rx:`2`,ry:`2`,key:`1w4ew1`}],[`path`,{d:`M7 11V7a5 5 0 0 1 10 0v4`,key:`fwvmzm`}]]};kg.node;var Ag=Mh(kg),jg={name:`message-square`,size:24,node:[[`path`,{d:`M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z`,key:`18887p`}]]};jg.node;var Mg=Mh(jg),Ng={name:`octagon-x`,size:24,node:[[`path`,{d:`m15 9-6 6`,key:`1uzhvr`}],[`path`,{d:`M2.586 16.726A2 2 0 0 1 2 15.312V8.688a2 2 0 0 1 .586-1.414l4.688-4.688A2 2 0 0 1 8.688 2h6.624a2 2 0 0 1 1.414.586l4.688 4.688A2 2 0 0 1 22 8.688v6.624a2 2 0 0 1-.586 1.414l-4.688 4.688a2 2 0 0 1-1.414.586H8.688a2 2 0 0 1-1.414-.586z`,key:`2d38gg`}],[`path`,{d:`m9 9 6 6`,key:`z0biqf`}]],aliases:[`x-octagon`]};Ng.node;var Pg=Mh(Ng),Fg={name:`pencil`,size:24,node:[[`path`,{d:`M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z`,key:`1a8usu`}],[`path`,{d:`m15 5 4 4`,key:`1mk7zo`}]]};Fg.node;var Ig=Mh(Fg),Lg={name:`plus`,size:24,node:[[`path`,{d:`M5 12h14`,key:`1ays0h`}],[`path`,{d:`M12 5v14`,key:`s699le`}]]};Lg.node;var Rg=Mh(Lg),zg={name:`rotate-ccw-clock`,size:24,node:[[`path`,{d:`M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8`,key:`1357e3`}],[`path`,{d:`M3 3v5h5`,key:`1xhq8a`}],[`path`,{d:`M12 7v5l4 2`,key:`1fdv2h`}]],aliases:[`history`]};zg.node;var Bg=Mh(zg),Vg={name:`scan-eye`,size:24,node:[[`path`,{d:`M3 7V5a2 2 0 0 1 2-2h2`,key:`aa7l1z`}],[`path`,{d:`M17 3h2a2 2 0 0 1 2 2v2`,key:`4qcy5o`}],[`path`,{d:`M21 17v2a2 2 0 0 1-2 2h-2`,key:`6vwrx8`}],[`path`,{d:`M7 21H5a2 2 0 0 1-2-2v-2`,key:`ioqczr`}],[`circle`,{cx:`12`,cy:`12`,r:`1`,key:`41hilf`}],[`path`,{d:`M18.944 12.33a1 1 0 0 0 0-.66 7.5 7.5 0 0 0-13.888 0 1 1 0 0 0 0 .66 7.5 7.5 0 0 0 13.888 0`,key:`11ak4c`}]]};Vg.node;var Hg=Mh(Vg),Ug={name:`search`,size:24,node:[[`path`,{d:`m21 21-4.34-4.34`,key:`14j7rj`}],[`circle`,{cx:`11`,cy:`11`,r:`8`,key:`4ej97u`}]]};Ug.node;var Wg=Mh(Ug),Gg={name:`signpost`,size:24,node:[[`path`,{d:`M12 13v8`,key:`1l5pq0`}],[`path`,{d:`M12 3v3`,key:`1n5kay`}],[`path`,{d:`M2.354 10.354a1.207 1.207 0 0 1 0-1.708l2.06-2.06A2 2 0 0 1 5.828 6h12.344a2 2 0 0 1 1.414.586l2.06 2.06a1.207 1.207 0 0 1 0 1.708l-2.06 2.06a2 2 0 0 1-1.414.586H5.828a2 2 0 0 1-1.414-.586z`,key:`1tm261`}]]};Gg.node;var Kg=Mh(Gg),qg={name:`sliders-horizontal`,size:24,node:[[`path`,{d:`M10 5H3`,key:`1qgfaw`}],[`path`,{d:`M12 19H3`,key:`yhmn1j`}],[`path`,{d:`M14 3v4`,key:`1sua03`}],[`path`,{d:`M16 17v4`,key:`1q0r14`}],[`path`,{d:`M21 12h-9`,key:`1o4lsq`}],[`path`,{d:`M21 19h-5`,key:`1rlt1p`}],[`path`,{d:`M21 5h-7`,key:`1oszz2`}],[`path`,{d:`M8 10v4`,key:`tgpxqk`}],[`path`,{d:`M8 12H3`,key:`a7s4jb`}]]};qg.node;var Jg=Mh(qg),Yg={name:`sparkles`,size:24,node:[[`path`,{d:`M11.017 2.814a1 1 0 0 1 1.966 0l1.051 5.558a2 2 0 0 0 1.594 1.594l5.558 1.051a1 1 0 0 1 0 1.966l-5.558 1.051a2 2 0 0 0-1.594 1.594l-1.051 5.558a1 1 0 0 1-1.966 0l-1.051-5.558a2 2 0 0 0-1.594-1.594l-5.558-1.051a1 1 0 0 1 0-1.966l5.558-1.051a2 2 0 0 0 1.594-1.594z`,key:`1s2grr`}],[`path`,{d:`M20 2v4`,key:`1rf3ol`}],[`path`,{d:`M22 4h-4`,key:`gwowj6`}],[`circle`,{cx:`4`,cy:`20`,r:`2`,key:`6kqj1y`}]],aliases:[`stars`]};Yg.node;var Xg=Mh(Yg),Zg={name:`ticket`,size:24,node:[[`path`,{d:`M2 9a3 3 0 0 1 0 6v2a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-2a3 3 0 0 1 0-6V7a2 2 0 0 0-2-2H4a2 2 0 0 0-2 2Z`,key:`qn84l0`}],[`path`,{d:`M13 5v2`,key:`dyzc3o`}],[`path`,{d:`M13 17v2`,key:`1ont0d`}],[`path`,{d:`M13 11v2`,key:`1wjjxi`}]]};Zg.node;var Qg=Mh(Zg),$g={name:`trash`,size:24,node:[[`path`,{d:`M10 11v6`,key:`nco0om`}],[`path`,{d:`M14 11v6`,key:`outv1u`}],[`path`,{d:`M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6`,key:`miytrc`}],[`path`,{d:`M3 6h18`,key:`d0wm0j`}],[`path`,{d:`M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2`,key:`e791ji`}]],aliases:[`trash-2`]};$g.node;var e_=Mh($g),t_={name:`triangle-alert`,size:24,node:[[`path`,{d:`m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3`,key:`wmoenq`}],[`path`,{d:`M12 9v4`,key:`juzpu7`}],[`path`,{d:`M12 17h.01`,key:`p32p05`}]],aliases:[`alert-triangle`]};t_.node;var n_=Mh(t_),r_={name:`x`,size:24,node:[[`path`,{d:`M18 6 6 18`,key:`1bl5f8`}],[`path`,{d:`m6 6 12 12`,key:`d8bk6v`}]]};r_.node;var i_=Mh(r_),a_={page:`not-found`},o_=`/preferences`,s_=e=>{if(e===void 0)return null;try{return decodeURIComponent(e)}catch{return null}},c_=(e,t)=>s_(RegExp(`^/${t}/([^/]+)/?$`).exec(e)?.[1]),l_=e=>{if(e===`/`)return{page:`picker`};if(e===`/preferences`||e===`/preferences/`)return{page:`preferences`};let t=c_(e,`review`);if(t!==null){let e=Cu.safeParse(t);return e.success?{page:`review`,analysisId:e.data}:a_}let n=/^\/pr\/([^/]+)\/([^/]+)\/([^/]+)\/([^/]+)\/?$/.exec(e);if(n!==null){let e=Tc.safeParse(n[1]),t=s_(n[2]),r=s_(n[3]),i=s_(n[4]);if(!e.success||t===null||r===null||i===null)return a_;let a=mf(hf({repo:{host:e.data,owner:t,repo:r},number:Number(i)}));return a.ok&&String(a.value.number)===i?{page:`open`,ref:a.value}:a_}return a_},u_=({repo:e,number:t})=>`/pr/${e.host}/${[e.owner,e.repo].map(encodeURIComponent).join(`/`)}/${t}`,d_=e=>`/review/${encodeURIComponent(e)}`,f_=e=>(window.addEventListener(`popstate`,e),()=>window.removeEventListener(`popstate`,e)),p_=()=>(0,q.useSyncExternalStore)(f_,()=>window.location.pathname),m_=e=>{window.history.pushState(null,``,e),window.dispatchEvent(new PopStateEvent(`popstate`))},h_=e=>{window.history.replaceState(null,``,e),window.dispatchEvent(new PopStateEvent(`popstate`))},g_=e=>!e.defaultPrevented&&e.button===0&&!(e.metaKey||e.ctrlKey||e.shiftKey||e.altKey),__=({to:e,onClick:t,...n})=>(0,J.jsx)(`a`,{href:e,onClick:n=>{t?.(n),g_(n)&&(n.preventDefault(),m_(e))},...n});function v_(){return typeof window<`u`}function y_(e){return S_(e)?(e.nodeName||``).toLowerCase():`#document`}function b_(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function x_(e){return((S_(e)?e.ownerDocument:e.document)||window.document)?.documentElement}function S_(e){return v_()?e instanceof Node||e instanceof b_(e).Node:!1}function C_(e){return v_()?e instanceof Element||e instanceof b_(e).Element:!1}function w_(e){return v_()?e instanceof HTMLElement||e instanceof b_(e).HTMLElement:!1}function T_(e){return!v_()||typeof ShadowRoot>`u`?!1:e instanceof ShadowRoot||e instanceof b_(e).ShadowRoot}function E_(e){let{overflow:t,overflowX:n,overflowY:r,display:i}=L_(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&i!==`inline`&&i!==`contents`}function D_(e){return/^(table|td|th)$/.test(y_(e))}function O_(e){try{if(e.matches(`:popover-open`))return!0}catch{}try{return e.matches(`:modal`)}catch{return!1}}var k_=/transform|translate|scale|rotate|perspective|filter/,A_=/paint|layout|strict|content/,j_=e=>!!e&&e!==`none`,M_;function N_(e){let t=C_(e)?L_(e):e;return j_(t.transform)||j_(t.translate)||j_(t.scale)||j_(t.rotate)||j_(t.perspective)||!F_()&&(j_(t.backdropFilter)||j_(t.filter))||k_.test(t.willChange||``)||A_.test(t.contain||``)}function P_(e){let t=z_(e);for(;w_(t)&&!I_(t);){if(N_(t))return t;if(O_(t))return null;t=z_(t)}return null}function F_(){return M_??=typeof CSS<`u`&&CSS.supports&&CSS.supports(`-webkit-backdrop-filter`,`none`),M_}function I_(e){return/^(html|body|#document)$/.test(y_(e))}function L_(e){return b_(e).getComputedStyle(e)}function R_(e){return C_(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function z_(e){if(y_(e)===`html`)return e;let t=e.assignedSlot||e.parentNode||T_(e)&&e.host||x_(e);return T_(t)?t.host:t}function B_(e){let t=z_(e);return I_(t)?(e.ownerDocument||e).body:w_(t)&&E_(t)?t:B_(t)}function V_(e,t,n){t===void 0&&(t=[]),n===void 0&&(n=!0);let r=B_(e),i=r===e.ownerDocument?.body,a=b_(r);if(i){let e=H_(a);return t.concat(a,a.visualViewport||[],E_(r)?r:[],e&&n?V_(e):[])}return t.concat(r,V_(r,[],n))}function H_(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}var U_={...q},W_={};function G_(e,t){let n=q.useRef(W_);return n.current===W_&&(n.current=e(t)),n}var K_=U_.useInsertionEffect,q_=K_&&K_!==U_.useLayoutEffect?K_:e=>e();function Z(e){let t=G_(J_).current;return t.next=e,q_(t.effect),t.trampoline}function J_(){let e={next:void 0,callback:Y_,trampoline:(...t)=>e.callback?.(...t),effect:()=>{e.callback=e.next}};return e}function Y_(){}var Q=typeof document<`u`?q.useLayoutEffect:()=>{};function X_(e,t){if(e&&!t)return e;if(!e&&t)return t;if(e||t)return{...e,...t}}var Z_={};function Q_(e,t,n,r,i){if(!n&&!r&&!i&&!e)return ev(t);let a=ev(e);return t&&(a=tv(a,t)),n&&(a=tv(a,n)),r&&(a=tv(a,r)),i&&(a=tv(a,i)),a}function $_(e){if(e.length===0)return Z_;if(e.length===1)return ev(e[0]);let t=ev(e[0]);for(let n=1;n<e.length;n+=1)t=tv(t,e[n]);return t}function ev(e){return av(e)?{...e(Z_)}:nv(e)}function tv(e,t){return av(t)?t(e):rv(e,t)}function nv(e){let t={...e};for(let e in t){let n=t[e];iv(e,n)&&(t[e]=sv(n))}return t}function rv(e,t){if(!t)return e;for(let n in t){let r=t[n];switch(n){case`style`:e[n]=X_(e.style,r);break;case`className`:e[n]=lv(e.className,r);break;default:e[n]=iv(n,r)?ov(e[n],r):r}}return e}function iv(e,t){let n=e.charCodeAt(0),r=e.charCodeAt(1),i=e.charCodeAt(2);return n===111&&r===110&&i>=65&&i<=90&&(typeof t==`function`||t===void 0)}function av(e){return typeof e==`function`}function ov(e,t){return t?e?(...n)=>{let r=n[0];if(uv(r)){let i=r;cv(i);let a=t(...n);return i.baseUIHandlerPrevented||e?.(...n),a}let i=t(...n);return e?.(...n),i}:sv(t):e}function sv(e){return e&&((...t)=>{let n=t[0];return uv(n)&&cv(n),e(...t)})}function cv(e){return e.preventBaseUIHandler=()=>{e.baseUIHandlerPrevented=!0},e}function lv(e,t){return t?e?t+` `+e:t:e}function uv(e){return typeof e==`object`&&!!e&&`nativeEvent`in e}function dv(e,t){return function(n,...r){let i=new URL(e);return i.searchParams.set(`code`,n.toString()),r.forEach(e=>i.searchParams.append(`args[]`,e)),`${t} error #${n}; visit ${i} for the full message.`}}var fv=dv(`https://base-ui.com/production-error`,`Base UI`),pv=q.createContext(void 0);function mv(e=!1){let t=q.useContext(pv);if(t===void 0&&!e)throw Error(fv(16));return t}function hv(e){let{focusableWhenDisabled:t,disabled:n,composite:r=!1,tabIndex:i=0,isNativeButton:a}=e,o=r&&t!==!1,s=r&&t===!1;return{props:q.useMemo(()=>{let e={onKeyDown(e){n&&t&&e.key!==`Tab`&&e.preventDefault()}};return r||(e.tabIndex=i,!a&&n&&(e.tabIndex=t?i:-1)),(a&&(t||o)||!a&&n)&&(e[`aria-disabled`]=n),a&&(!t||s)&&(e.disabled=n),e},[r,n,t,o,s,a,i])}}function gv(e){return e?.ownerDocument||document}function _v(e,t,{detail:n=0,pointerType:r=``}={}){e.dispatchEvent(new(b_(e)).PointerEvent(`click`,{bubbles:!0,cancelable:!0,composed:!0,detail:n,pointerType:r,shiftKey:t.shiftKey,ctrlKey:t.ctrlKey,altKey:t.altKey,metaKey:t.metaKey}))}function vv(e={}){let{disabled:t=!1,focusableWhenDisabled:n,tabIndex:r=0,native:i=!0,composite:a}=e,o=q.useRef(null),s=mv(!0),c=a??s!==void 0,{props:l}=hv({focusableWhenDisabled:n,disabled:t,composite:c,tabIndex:r,isNativeButton:i}),u=q.useCallback(()=>{let e=o.current;yv(e)&&c&&t&&l.disabled===void 0&&e.disabled&&(e.disabled=!1)},[t,l.disabled,c]);return Q(u,[u]),{getButtonProps:q.useCallback((e={})=>{let{onClick:n,onMouseDown:r,onKeyUp:a,onKeyDown:o,onPointerDown:s,...u}=e;return Q_({onClick(e){t?e.preventDefault():n?.(e)},onMouseDown(e){t||r?.(e)},onKeyDown(e){if(t||(cv(e),o?.(e),e.baseUIHandlerPrevented))return;let n=e.target===e.currentTarget,r=e.currentTarget,a=yv(r),s=!i&&bv(r),l=n&&(i?a:!s),u=e.key===`Enter`,d=e.key===` `,f=r.getAttribute(`role`),p=f?.startsWith(`menuitem`)||f===`option`||f===`gridcell`;if(n&&c&&d){if(e.defaultPrevented&&p)return;e.preventDefault(),(!i||a)&&(e.preventBaseUIHandler(),_v(r,e))}else!l||i||!d&&!u?n&&s&&d&&e.preventDefault():e.defaultPrevented||(e.preventDefault(),u&&(e.preventBaseUIHandler(),_v(r,e)))},onKeyUp(e){t||(cv(e),a?.(e),e.target===e.currentTarget&&i&&c&&yv(e.currentTarget)&&e.key===` `?e.preventDefault():e.baseUIHandlerPrevented||e.target===e.currentTarget&&!i&&!c&&!e.defaultPrevented&&e.key===` `&&(e.preventBaseUIHandler(),_v(e.currentTarget,e)))},onPointerDown(e){t?e.preventDefault():s?.(e)}},i?{type:`button`}:{role:`button`},l,u)},[t,l,c,i]),buttonRef:Z(e=>{o.current=e,u()})}}function yv(e){return w_(e)&&e.tagName===`BUTTON`}function bv(e){return w_(e)&&e.tagName===`A`&&!!e.href}function xv(e,t,n,r){let i=G_(Cv).current;return wv(i,e,t,n,r)&&Ev(i,[e,t,n,r]),i.callback}function Sv(e){let t=G_(Cv).current;return Tv(t,e)&&Ev(t,e),t.callback}function Cv(){return{callback:null,cleanup:null,refs:[]}}function wv(e,t,n,r,i){return e.refs[0]!==t||e.refs[1]!==n||e.refs[2]!==r||e.refs[3]!==i}function Tv(e,t){return e.refs.length!==t.length||e.refs.some((e,n)=>e!==t[n])}function Ev(e,t){e.refs=t,e.callback=t.every(e=>e==null)?null:n=>{if(e.cleanup&&=(e.cleanup(),null),n!=null){let r=Array(t.length).fill(null);for(let e=0;e<t.length;e+=1){let i=t[e];if(i!=null)switch(typeof i){case`function`:{let t=i(n);typeof t==`function`&&(r[e]=t);break}case`object`:i.current=n}}e.cleanup=()=>{for(let e=0;e<t.length;e+=1){let n=t[e];if(n!=null)switch(typeof n){case`function`:{let t=r[e];typeof t==`function`?t():n(null);break}case`object`:n.current=null}}}}}}var Dv=19;function Ov(e){return Dv>=e}function kv(e){if(!q.isValidElement(e))return null;let t=e,n=t.props;return(Ov(19)?n?.ref:t.ref)??null}function Av(){}var jv=Object.freeze([]),Mv=Object.freeze({});function Nv(e,t){let n={};for(let r in e){let i=e[r];if(t?.hasOwnProperty(r)){let e=t[r](i);e!=null&&Object.assign(n,e)}else i===!0?n[`data-${r.toLowerCase()}`]=``:i&&(n[`data-${r.toLowerCase()}`]=i.toString())}return n}function Pv(e,t){return typeof e==`function`?e(t):e}function Fv(e,t){return typeof e==`function`?e(t):e}function Iv(e,t,n={}){let r=t.render;n.enabled!==!1&&(r=Bv(r));let i=Lv(t,n,r);if(n.enabled===!1)return null;let a=n.state??Mv;return Vv(e,r,i,a)}function Lv(e,t,n){let{className:r,style:i}=e,{state:a=Mv,ref:o,props:s,stateAttributesMapping:c,enabled:l=!0}=t,u=l?Pv(r,a):void 0,d=l?Fv(i,a):void 0,f=l?Nv(a,c):Mv,p=l&&s?Rv(s):void 0,m=l?X_(f,p)??{}:Mv;return typeof document<`u`&&(l?m.ref=Array.isArray(o)?Sv([m.ref,kv(n),...o]):xv(m.ref,kv(n),o):xv(null,null)),l?(u!==void 0&&(m.className=lv(m.className,u)),d!==void 0&&(m.style=X_(m.style,d)),m):Mv}function Rv(e){return Array.isArray(e)?$_(e):Q_(void 0,e)}var zv=Symbol.for(`react.lazy`);function Bv(e){if(e?.$$typeof!==zv)return e;let t=q.Children.toArray(e)[0];return q.isValidElement(t)?t:e}function Vv(e,t,n,r){if(t){if(typeof t==`function`)return t(n,r);let e=Q_(n,t.props);return e.ref=n.ref,q.cloneElement(t,e)}return Hv(e,n)}function Hv(e,t){return e===`button`?(0,q.createElement)(`button`,{type:`button`,...t,key:t.key}):e===`img`?(0,q.createElement)(`img`,{alt:``,...t,key:t.key}):q.createElement(e,t)}var Uv=q.forwardRef(function(e,t){let{render:n,className:r,disabled:i=!1,focusableWhenDisabled:a=!1,nativeButton:o=!0,style:s,...c}=e,{getButtonProps:l,buttonRef:u}=vv({disabled:i,focusableWhenDisabled:a,native:o});return Iv(`button`,e,{state:{disabled:i},ref:[t,u],props:[c,l]})}),Wv=e=>typeof e==`boolean`?`${e}`:e===0?`0`:e,Gv=Rp,Kv=(e,t)=>n=>{if(t?.variants==null)return Gv(e,n?.class,n?.className);let{variants:r,defaultVariants:i}=t,a=Object.keys(r).map(e=>{let t=n?.[e],a=i?.[e];if(t===null)return null;let o=Wv(t)||Wv(a);return r[e][o]}),o=n&&Object.entries(n).reduce((e,t)=>{let[n,r]=t;return r===void 0||(e[n]=r),e},{});return Gv(e,a,t?.compoundVariants?.reduce((e,t)=>{let{class:n,className:r,...a}=t;return Object.entries(a).every(e=>{let[t,n]=e;return Array.isArray(n)?n.includes({...i,...o}[t]):{...i,...o}[t]===n})?[...e,n,r]:e},[]),n?.class,n?.className)},qv=Kv(`group/button inline-flex shrink-0 items-center justify-center rounded-md border border-transparent bg-clip-padding text-ui font-medium whitespace-nowrap transition-all select-none active:not-aria-[haspopup]:not-aria-disabled:translate-y-px disabled:pointer-events-none disabled:opacity-50 aria-disabled:cursor-not-allowed aria-disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4`,{variants:{variant:{default:`bg-primary text-primary-foreground hover:bg-primary/80 aria-disabled:hover:bg-primary`,outline:`border-border bg-background hover:bg-muted hover:text-foreground aria-expanded:bg-muted aria-expanded:text-foreground aria-disabled:hover:bg-background`,secondary:`bg-secondary text-secondary-foreground hover:bg-[color-mix(in_oklch,var(--secondary),var(--foreground)_5%)] aria-expanded:bg-secondary aria-expanded:text-secondary-foreground`,ghost:`hover:bg-muted hover:text-foreground aria-expanded:bg-muted aria-expanded:text-foreground`,destructive:`bg-destructive/10 text-destructive hover:bg-destructive/20 focus-visible:border-destructive/40 focus-visible:ring-destructive/20`,link:`text-primary underline-offset-4 hover:underline`},size:{default:`h-8 gap-1.5 px-2.5 has-data-[icon=inline-end]:pr-2 has-data-[icon=inline-start]:pl-2`,xs:`h-6 gap-1 rounded-md px-2 text-caption in-data-[slot=button-group]:rounded-md has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 [&_svg:not([class*='size-'])]:size-3`,sm:`h-7 gap-1 rounded-md px-2.5 text-ui in-data-[slot=button-group]:rounded-md has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 [&_svg:not([class*='size-'])]:size-3.5`,lg:`h-9 gap-1.5 px-2.5 has-data-[icon=inline-end]:pr-2 has-data-[icon=inline-start]:pl-2`,icon:`size-8`,"icon-xs":`size-6 rounded-md in-data-[slot=button-group]:rounded-md [&_svg:not([class*='size-'])]:size-3`,"icon-sm":`size-7 rounded-md in-data-[slot=button-group]:rounded-md`,"icon-lg":`size-9`}},defaultVariants:{variant:`default`,size:`default`}});function $({className:e,variant:t=`default`,size:n=`default`,...r}){return(0,J.jsx)(Uv,{"data-slot":`button`,className:X(qv({variant:t,size:n,className:e})),...r})}var Jv=[],Yv=void 0;function Xv(){return Yv}function Zv(e){Jv.push(e)}function Qv(e){let t=(t,n)=>{let r=G_(ey).current,i;try{Yv=r;for(let e of Jv)e.before(r);i=e(t,n);for(let e of Jv)e.after(r);r.didInitialize=!0}finally{Yv=void 0}return i};return t.displayName=e.displayName||e.name,t}function $v(e){return q.forwardRef(Qv(e))}function ey(){return{didInitialize:!1}}function ty(e){q.useEffect(e,jv)}var ny=0,ry=class e{static create(){return new e}currentId=ny;start(e,t){this.clear(),this.currentId=setTimeout(()=>{this.currentId=ny,t()},e)}isStarted(){return this.currentId!==ny}clear=()=>{this.currentId!==ny&&(clearTimeout(this.currentId),this.currentId=ny)};disposeEffect=()=>this.clear};function iy(){let e=G_(ry.create).current;return ty(e.disposeEffect),e}function ay(){return typeof navigator>`u`?{userAgent:``,platform:``,maxTouchPoints:0}:{userAgent:navigator.userAgent,platform:navigator.platform??``,maxTouchPoints:navigator.maxTouchPoints??0}}var{userAgent:oy,platform:sy,maxTouchPoints:cy}=ay(),ly=oy.toLowerCase(),uy=sy.toLowerCase(),dy=/^i(os$|p)/.test(uy)||uy===`macintel`&&cy>1,fy=`android`,py=uy===fy||ly.includes(fy),my=!dy&&uy.startsWith(`mac`);uy.startsWith(`win`),!py&&/^(linux|chrome os)/.test(uy);var hy=my||dy,gy=typeof CSS<`u`&&!!CSS.supports?.(`-webkit-backdrop-filter:none`);!gy&&ly.includes(`firefox`),!gy&&ly.includes(`chrom`);var _y=hy,vy=/jsdom|happydom/.test(ly);function yy(e){e.preventDefault(),e.stopPropagation()}function by(e){return`nativeEvent`in e}function xy(e){return e.pointerType===``&&e.isTrusted?!0:py&&e.pointerType?e.type===`click`&&e.buttons===1:e.detail===0&&!e.pointerType}function Sy(e){return vy?!1:!py&&e.width===0&&e.height===0||e.type===`pointerdown`&&e.width===1&&e.height===1&&e.pressure===0&&e.detail===0&&e.pointerType===`mouse`&&(py||e.buttons===0)||e.width<1&&e.height<1&&e.pressure===0&&e.detail===0&&e.pointerType===`touch`}function Cy(e,t){let n=[`mouse`,`pen`];return t||n.push(``,void 0),n.includes(e)}function wy(e){let t=e.type;return t===`click`||t===`mousedown`||t===`keydown`||t===`keyup`}function Ty(e){let t=e.activeElement;for(;t?.shadowRoot?.activeElement!=null;)t=t.shadowRoot.activeElement;return t}function Ey(e,t){if(!e||!t)return!1;let n=t.getRootNode?.();if(e.contains(t))return!0;if(n&&T_(n)){let n=t;for(;n;){if(e===n)return!0;n=n.parentNode||n.host}}return!1}function Dy(e,t){let n=e;for(;n;){if(C_(n)&&n.matches(t))return n;n=n.assignedSlot??n.parentNode??(T_(n)?n.host:null)}return null}function Oy(e){return`composedPath`in e?e.composedPath()[0]??e.target:e.target}var ky=`data-base-ui-focusable`,Ay=`input:not([type='hidden']):not([disabled]),[contenteditable]:not([contenteditable='false']),textarea:not([disabled])`,jy=`ArrowLeft`,My=`ArrowRight`,Ny=`ArrowUp`,Py=`ArrowDown`,Fy=`data-starting-style`,Iy=`data-ending-style`,Ly={[Fy]:``},Ry={[Iy]:``},zy={transitionStatus(e){return e===`starting`?Ly:e===`ending`?Ry:null}},By=`data-open`,Vy=`data-closed`,Hy=`data-anchor-hidden`,Uy=`data-popup-open`,Wy=`data-pressed`,Gy={[Uy]:``},Ky={[Uy]:``,[Wy]:``},qy={[By]:``},Jy={[Vy]:``},Yy={[Hy]:``},Xy={open(e){return e?Gy:null}},Zy={open(e){return e?Ky:null}},Qy={open(e){return e?qy:Jy},anchorHidden(e){return e?Yy:null}},$y={...Qy,...zy},eb=`data-trigger-disabled`;function tb(e,t){if(!C_(e))return!1;let n=e;if(t.hasElement(n))return!n.hasAttribute(eb);for(let[,e]of t.entries())if(Ey(e,n))return!e.hasAttribute(eb);return!1}function nb(e,t){if(t==null)return!1;if(`composedPath`in e)return e.composedPath().includes(t);let n=e;return n.target!=null&&t.contains(n.target)}function rb(e){return e.matches(`html,body`)}function ib(e){return w_(e)&&e.matches(`input:not([type='hidden']):not([disabled]),[contenteditable]:not([contenteditable='false']),textarea:not([disabled])`)}function ab(e){return Dy(e,`button,a[href],[role="button"],select,[tabindex]:not([tabindex="-1"]),${Ay}`)!=null}function ob(e){return e?e.getAttribute(`role`)===`combobox`&&ib(e):!1}function sb(e){if(!e||vy)return!0;try{return e.matches(`:focus-visible`)}catch{return!0}}function cb(e){return e?e.hasAttribute(`data-base-ui-focusable`)?e:e.querySelector(`[data-base-ui-focusable]`)||e:null}function lb(e,t){return t!=null&&!Cy(t)?0:typeof e==`function`?e():e}function ub(e,t,n){let r=lb(e,n);return typeof r==`number`?r:r?.[t]}function db(e){return typeof e==`function`?e():e}function fb(e,t){return t||e===`click`||e===`mousedown`}function pb(e){return e?.includes(`mouse`)&&e!==`mousedown`}function mb(e,t,n,r){let i=!1,a=!1,o=r??Mv;return{reason:e,event:t??new Event(`base-ui`),cancel(){i=!0},allowPropagation(){a=!0},get isCanceled(){return i},get isPropagationAllowed(){return a},trigger:n,...o}}function hb(e,t,n){let r=n??Mv;return{reason:e,event:t??new Event(`base-ui`),...r}}var gb=`none`,_b=`trigger-press`,vb=`trigger-hover`,yb=`trigger-focus`,bb=`outside-press`,xb=`item-press`,Sb=`close-press`,Cb=`focus-out`,wb=`escape-key`,Tb=`list-navigation`,Eb=`keyboard`,Db=`pointer`,Ob=`cancel-open`,kb=`sibling-open`,Ab=`disabled`,jb=`missing`,Mb=`initial`,Nb=`imperative-action`,Pb=`window-resize`,Fb=q.createContext({hasProvider:!1,timeoutMs:0,delayRef:{current:0},initialDelayRef:{current:0},timeout:new ry,currentIdRef:{current:null},currentContextRef:{current:null}});function Ib(e,t){e.current=t.current}function Lb(e){let{children:t,delay:n,timeoutMs:r=0}=e,i=q.useRef(n),a=q.useRef(n),o=q.useRef(null),s=q.useRef(null),c=iy();return Q(()=>{a.current=n,o.current?i.current={open:ub(i.current,`open`),close:ub(n,`close`)}:i.current=n},[n,o,i,a]),(0,J.jsx)(Fb.Provider,{value:q.useMemo(()=>({hasProvider:!0,delayRef:i,initialDelayRef:a,currentIdRef:o,timeoutMs:r,currentContextRef:s,timeout:c}),[r,c]),children:t})}function Rb(e,t={open:!1}){let{open:n}=t,r=e.useState(`floatingId`),{currentIdRef:i,delayRef:a,timeoutMs:o,initialDelayRef:s,currentContextRef:c,hasProvider:l,timeout:u}=q.useContext(Fb),[d,f]=q.useState(!1),p=q.useRef(n);return Q(()=>{p.current=n},[n]),Q(()=>{function t(){c.current?.setIsInstantPhase(!1),i.current=null,c.current=null,a.current=s.current,u.clear()}if(i.current&&!n&&i.current===r){if(f(!1),o){let n=r;return u.start(o,()=>{e.select(`open`)||i.current&&i.current!==n||t()}),()=>{(p.current||i.current!==n)&&u.clear()}}t()}},[n,r,i,a,o,s,c,u,e]),Q(()=>{if(!n)return;let t=c.current,o=i.current;u.clear(),c.current={onOpenChange:e.setOpen,setIsInstantPhase:f},i.current=r,a.current={open:0,close:ub(s.current,`close`)},o!==null&&o!==r?(f(!0),t?.setIsInstantPhase(!0),t?.onOpenChange(!1,mb(gb))):(f(!1),t?.setIsInstantPhase(!1))},[n,r,e,i,a,s,c,u]),Q(()=>()=>{if(i.current===r){if(c.current=null,!p.current)return;i.current=null,Ib(a,s),u.clear()}},[c,i,a,r,s,u]),q.useMemo(()=>({activeIdRef:i,hasProvider:l,delayRef:a,isInstantPhase:d}),[i,l,a,d])}function zb(e,t,n,r){return e.addEventListener(t,n,r),()=>{e.removeEventListener(t,n,r)}}function Bb(...e){return()=>{for(let t=0;t<e.length;t+=1){let n=e[t];n&&n()}}}function Vb(e){let t=G_(Hb,e).current;return t.next=e,Q(t.effect),t}function Hb(e){let t={current:e,next:e,effect:()=>{t.current=t.next}};return t}var Ub=null;globalThis.requestAnimationFrame;var Wb=new class{callbacks=[];callbacksCount=0;nextId=1;startId=1;isScheduled=!1;tick=e=>{this.isScheduled=!1;let t=this.callbacks,n=this.callbacksCount;if(this.callbacks=[],this.callbacksCount=0,this.startId=this.nextId,n>0)for(let n=0;n<t.length;n+=1)t[n]?.(e)};request(e){let t=this.nextId;return this.nextId+=1,this.callbacks.push(e),this.callbacksCount+=1,this.isScheduled||=(requestAnimationFrame(this.tick),!0),t}cancel(e){let t=e-this.startId;t<0||t>=this.callbacks.length||this.callbacks[t]!==null&&(this.callbacks[t]=null,--this.callbacksCount)}},Gb=class e{static create(){return new e}static request(e){return Wb.request(e)}static cancel(e){return Wb.cancel(e)}currentId=Ub;request(e){this.cancel(),this.currentId=Wb.request(()=>{this.currentId=Ub,e()})}cancel=()=>{this.currentId!==Ub&&(Wb.cancel(this.currentId),this.currentId=Ub)};disposeEffect=()=>this.cancel};function Kb(){let e=G_(Gb.create).current;return ty(e.disposeEffect),e}var qb={clipPath:`inset(50%)`,overflow:`hidden`,whiteSpace:`nowrap`,border:0,padding:0,width:1,height:1,margin:-1},Jb={...qb,position:`fixed`,margin:0,top:0,left:0},Yb={...qb,position:`absolute`},Xb=q.forwardRef(function(e,t){let[n,r]=q.useState();Q(()=>{_y&&gy&&r(`button`)},[]);let i={tabIndex:0,role:n};return(0,J.jsx)(`span`,{...e,ref:t,style:Jb,"aria-hidden":!n||void 0,...i,"data-base-ui-focus-guard":``})}),Zb=Math.min,Qb=Math.max,$b=Math.round,ex=Math.floor,tx=e=>({x:e,y:e}),nx={left:`right`,right:`left`,bottom:`top`,top:`bottom`};function rx(e,t,n){return Qb(e,Zb(t,n))}function ix(e,t){return typeof e==`function`?e(t):e}function ax(e){return e.split(`-`)[0]}function ox(e){return e.split(`-`)[1]}function sx(e){return e===`x`?`y`:`x`}function cx(e){return e===`y`?`height`:`width`}function lx(e){let t=e[0];return t===`t`||t===`b`?`y`:`x`}function ux(e){return sx(lx(e))}function dx(e,t,n){n===void 0&&(n=!1);let r=ox(e),i=ux(e),a=cx(i),o=i===`x`?r===(n?`end`:`start`)?`right`:`left`:r===`start`?`bottom`:`top`;return t.reference[a]>t.floating[a]&&(o=bx(o)),[o,bx(o)]}function fx(e){let t=bx(e);return[px(e),t,px(t)]}function px(e){return e.includes(`start`)?e.replace(`start`,`end`):e.replace(`end`,`start`)}var mx=[`left`,`right`],hx=[`right`,`left`],gx=[`top`,`bottom`],_x=[`bottom`,`top`];function vx(e,t,n){switch(e){case`top`:case`bottom`:return n?t?hx:mx:t?mx:hx;case`left`:case`right`:return t?gx:_x;default:return[]}}function yx(e,t,n,r){let i=ox(e),a=vx(ax(e),n===`start`,r);return i&&(a=a.map(e=>e+`-`+i),t&&(a=a.concat(a.map(px)))),a}function bx(e){let t=ax(e);return nx[t]+e.slice(t.length)}function xx(e){return{top:e.top??0,right:e.right??0,bottom:e.bottom??0,left:e.left??0}}function Sx(e){return typeof e==`number`?{top:e,right:e,bottom:e,left:e}:xx(e)}function Cx(e){let{x:t,y:n,width:r,height:i}=e;return{width:r,height:i,top:n,left:t,right:t+r,bottom:n+i,x:t,y:n}}function wx(e,t){return t<0||t>=e.length}function Tx(e,t){return Ox(e.current,{disabledIndices:t})}function Ex(e,t){return Ox(e.current,{decrement:!0,startingIndex:e.current.length,disabledIndices:t})}function Dx(e,t,n){let{decrement:r,loopFocus:i,allowEscape:a,disabledIndices:o,minIndex:s,maxIndex:c}=n,l=()=>Ox(e,{startingIndex:t,decrement:r,disabledIndices:o}),u,d=!1;if(!i)u=r?Math.max(s,l()):Math.min(c,l());else if(r?t<=s:t>=c){let n=r?-1:e.length;a&&t!==n?u=-1:(u=r?c:s,d=!0)}else u=l();return{index:wx(e,u)?-1:u,wrapped:d}}function Ox(e,{startingIndex:t=-1,decrement:n=!1,disabledIndices:r,amount:i=1}={}){let a=t;do a+=n?-i:i;while(a>=0&&a<=e.length-1&&kx(e,a,r));return a}function kx(e,t,n){if(typeof n==`function`?n(t):n?.includes(t)??!1)return!0;let r=e[t];return r?!jx(r)||r.matches(`:disabled`)?!0:!n&&(r.hasAttribute(`disabled`)||r.getAttribute(`aria-disabled`)===`true`):!1}function Ax(e){return e.visibility===`hidden`||e.visibility===`collapse`}function jx(e,t=e?L_(e):null){return!e||!e.isConnected||!t||Ax(t)?!1:typeof e.checkVisibility==`function`?e.checkVisibility():t.display!==`none`&&t.display!==`contents`}var Mx=`a[href],button,input,select,textarea,summary,details,iframe,object,embed,[tabindex],[contenteditable]:not([contenteditable="false"]),audio[controls],video[controls]`;function Nx(e){let t=e.assignedSlot;if(t)return t;if(e.parentElement)return e.parentElement;let n=e.getRootNode();return T_(n)?n.host:null}function Px(e){for(let t of Array.from(e.children))if(y_(t)===`summary`)return t;return null}function Fx(e,t){let n=Px(t);return!!n&&(e===n||Ey(n,e))}function Ix(e){let t=e?y_(e):``;return e!=null&&e.matches(Mx)&&(t!==`summary`||e.parentElement!=null&&y_(e.parentElement)===`details`&&Px(e.parentElement)===e)&&(t!==`details`||Px(e)==null)&&(t!==`input`||e.type!==`hidden`)}function Lx(e){if(!Ix(e)||!e.isConnected||e.matches(`:disabled`))return!1;for(let t=e;t;t=Nx(t)){let n=t!==e,r=y_(t)===`slot`;if(t.hasAttribute(`inert`)||n&&y_(t)===`details`&&!t.open&&!Fx(e,t)||t.hasAttribute(`hidden`)||!r&&!Rx(t,n))return!1}return!0}function Rx(e,t){let n=L_(e);return t?n.display!==`none`:jx(e,n)}function zx(e){let t=e.tabIndex;if(t<0){let t=y_(e);if(t===`details`||t===`audio`||t===`video`||w_(e)&&e.isContentEditable)return 0}return t}function Bx(e){if(y_(e)!==`input`)return null;let t=e;return t.type===`radio`&&t.name!==``?t:null}function Vx(e,t){let n=Bx(e);if(!n)return!0;let r=t.find(e=>{let t=Bx(e);return t?.name===n.name&&t.form===n.form&&t.checked});return r?r===n:t.find(e=>{let t=Bx(e);return t?.name===n.name&&t.form===n.form})===n}function Hx(e){if(w_(e)&&y_(e)===`slot`){let t=e.assignedElements({flatten:!0});if(t.length>0)return t}return w_(e)&&e.shadowRoot?Array.from(e.shadowRoot.children):Array.from(e.children)}function Ux(e,t){Hx(e).forEach(e=>{Ix(e)&&t.push(e),Ux(e,t)})}function Wx(e,t,n){Hx(e).forEach(e=>{w_(e)&&e.matches(t)&&n.push(e),Wx(e,t,n)})}function Gx(e){return Lx(e)&&zx(e)>=0}function Kx(e){let t=[];return Ux(e,t),t.filter(Lx)}function qx(e){let t=Kx(e);return t.filter(e=>zx(e)>=0&&Vx(e,t))}function Jx(e,t){let n=qx(e),r=n.length;if(r===0)return;let i=Ty(gv(e)),a=n.indexOf(i);return n[a===-1?t===1?0:r-1:a+t]}function Yx(e){return Jx(gv(e).body,1)||e}function Xx(e){return Jx(gv(e).body,-1)||e}function Zx(e,t,n){if(!e)return null;let r=[];Ux(gv(e).body,r);let i=r.indexOf(e);if(i===-1)return null;let a=r.filter(Lx);for(let e=1;e<r.length;e+=1){let o=r[(i+t*e+r.length)%r.length];if(!Ey(n,o)&&Gx(o)&&Vx(o,a))return o}return r[i]}function Qx(e,t){let n=t||e.currentTarget,r=e.relatedTarget;return!r||!Ey(n,r)}function $x(e){qx(e).forEach(e=>{e.dataset.tabindex=e.getAttribute(`tabindex`)||``,e.setAttribute(`tabindex`,`-1`)})}function eS(e){let t=[];Wx(e,`[data-tabindex]`,t),t.forEach(e=>{let t=e.dataset.tabindex;delete e.dataset.tabindex,t?e.setAttribute(`tabindex`,t):e.removeAttribute(`tabindex`)})}function tS(e,t,n=!0){return e.filter(e=>e.parentId===t).flatMap(t=>[...!n||t.context?.open?[t]:[],...tS(e,t.id,n)])}function nS(e,t){let n=[],r=e.find(e=>e.id===t)?.parentId;for(;r;){let t=e.find(e=>e.id===r);r=t?.parentId,t&&(n=n.concat(t))}return n}function rS(e){return`data-base-ui-${e}`}var iS=0;function aS(e,t={}){let{preventScroll:n=!1,sync:r=!1,shouldFocus:i}=t;cancelAnimationFrame(iS);function a(){(!i||i())&&e?.focus({preventScroll:n})}if(r)return a(),Av;let o=requestAnimationFrame(a);return iS=o,()=>{iS===o&&(cancelAnimationFrame(o),iS=0)}}var oS=`data-base-ui-inert`,sS=new WeakMap,cS=new WeakSet,lS=new WeakMap,uS=0;function dS(e){return e?T_(e)?e.host:dS(e.parentNode):null}var fS=(e,t)=>t.map(t=>{if(e.contains(t))return t;let n=dS(t);return e.contains(n)?n:null}).filter(e=>e!=null),pS=e=>{let t=new Set;return e.forEach(e=>{let n=e;for(;n&&!t.has(n);)t.add(n),n=n.parentNode}),t},mS=(e,t,n)=>{let r=[],i=e=>{e&&!n.has(e)&&Array.from(e.children).forEach(e=>{y_(e)!==`script`&&(t.has(e)?i(e):r.push(e))})};return i(e),r};function hS(e,t,n,{mark:r=!0}){let i=fS(t,e),a=r?mS(t,pS(i),new Set(i)):[],o=[],s=[];if(n){let e=fS(t,Array.from(t.querySelectorAll(`[aria-live]`))),n=i.concat(e);mS(t,pS(n),new Set(n)).forEach(e=>{let t=e.getAttribute(`aria-hidden`),n=t!==null&&t!==`false`,r=(sS.get(e)||0)+1;sS.set(e,r),o.push(e),r===1&&n&&cS.add(e),n||e.setAttribute(`aria-hidden`,`true`)})}return r&&a.forEach(e=>{let t=(lS.get(e)||0)+1;lS.set(e,t),s.push(e),t===1&&e.setAttribute(oS,``)}),uS+=1,()=>{o.forEach(e=>{let t=(sS.get(e)||0)-1;sS.set(e,t),t||(cS.has(e)||e.removeAttribute(`aria-hidden`),cS.delete(e))}),r&&s.forEach(e=>{let t=(lS.get(e)||0)-1;lS.set(e,t),t||e.removeAttribute(oS)}),--uS,uS||(sS=new WeakMap,cS=new WeakSet,lS=new WeakMap)}}function gS(e,t={}){let{ariaHidden:n=!1,mark:r=!0}=t,i=gv(e[0]).body;return hS(e,i,n,{mark:r})}function _S(){let[,e]=q.useState({});return q.useCallback(()=>{e({})},[])}var vS=0;function yS(e,t=`mui`){let n=q.useRef(void 0),r=_S(),i=e??n.current;return q.useEffect(()=>{n.current??(vS+=1,n.current=`${t}-${vS}`,e??r())},[e,t,r]),i}var bS=U_.useId;function xS(e,t){if(bS!==void 0){let n=bS();return e??(t?`${t}-${n}`:n)}return yS(e,t)}var SS={style:{transition:`none`}},CS=`data-base-ui-click-trigger`,wS={fallbackAxisSide:`none`},TS={fallbackAxisSide:`end`},ES={clipPath:`inset(50%)`,position:`fixed`,top:0,left:0},DS=l(h(),1),OS=q.createContext(null),kS=()=>q.useContext(OS),AS=rS(`portal`);function jS(e={}){let{ref:t,container:n,componentProps:r=Mv,elementProps:i}=e,a=xS(),o=kS()?.portalNode,[s,c]=q.useState(null),[l,u]=q.useState(null),d=Z(e=>{e!==null&&u(e)}),f=q.useRef(null);Q(()=>{if(n===null){f.current&&(f.current=null,u(null),c(null));return}let e=(n&&(S_(n)?n:n.current))??o??document.body;e==null?f.current&&(f.current=null,u(null),c(null)):f.current!==e&&(f.current=e,u(null),c(e))},[n,o]);let p=Iv(`div`,r,{ref:[t,d],props:[{id:a,[AS]:``},i]}),m=s&&p?DS.createPortal(p,s):null;return{node:l,nodeId:q.isValidElement(p)?p.props.id:void 0,subtree:m}}var MS=q.forwardRef(function(e,t){let{render:n,className:r,style:i,children:a,container:o,portalOwnerRole:s,...c}=e,{node:l,nodeId:u,subtree:d}=jS({container:o,ref:t,componentProps:e,elementProps:c}),f=q.useRef(null),p=q.useRef(null),m=q.useRef(null),h=q.useRef(null),[g,_]=q.useState(null),v=q.useRef(!1),y=g?.modal,b=g?.open,x=!!g&&!g.modal&&g.open&&!!l;q.useEffect(()=>{if(!l||y)return;function e(e){l&&e.relatedTarget&&Qx(e)&&(e.type===`focusin`?v.current&&=(eS(l),!1):($x(l),v.current=!0))}return Bb(zb(l,`focusin`,e,!0),zb(l,`focusout`,e,!0))},[l,y]),Q(()=>{l&&b===!0&&v.current&&(eS(l),v.current=!1)},[b,l]);let S=q.useMemo(()=>({beforeOutsideRef:f,afterOutsideRef:p,beforeInsideRef:m,afterInsideRef:h,portalNode:l,setFocusManagerState:_}),[l]);return(0,J.jsxs)(q.Fragment,{children:[d,(0,J.jsxs)(OS.Provider,{value:S,children:[x&&l&&(0,J.jsx)(Xb,{"data-type":`outside`,ref:f,onFocus:e=>{Qx(e,l)?m.current?.focus():Xx(g?g.domReference:null)?.focus()}}),x&&l&&(0,J.jsx)(`span`,{role:s,"aria-owns":u,style:ES}),l&&DS.createPortal(a,l),x&&l&&(0,J.jsx)(Xb,{"data-type":`outside`,ref:p,onFocus:e=>{Qx(e,l)?h.current?.focus():(Yx(g?g.domReference:null)?.focus(),g?.closeOnFocusOut&&g?.onOpenChange(!1,mb(`focus-out`,e.nativeEvent)))}})]})]})});function NS(){let e=new Map;return{emit(t,n){e.get(t)?.forEach(e=>e(n))},on(t,n){e.has(t)||e.set(t,new Set),e.get(t).add(n)},off(t,n){e.get(t)?.delete(n)}}}var PS=class{nodesRef={current:[]};events=NS();addNode(e){this.nodesRef.current.push(e)}removeNode(e){let t=this.nodesRef.current.findIndex(t=>t===e);t!==-1&&this.nodesRef.current.splice(t,1)}},FS=q.createContext(null),IS=q.createContext(null),LS=()=>q.useContext(FS)?.id||null,RS=e=>{let t=q.useContext(IS);return e??t};function zS(e){let t=xS(),n=RS(e),r=LS();return Q(()=>{if(!t)return;let e={id:t,parentId:r};return n?.addNode(e),()=>{n?.removeNode(e)}},[n,t,r]),t}function BS(e){let{children:t,id:n}=e,r=LS();return(0,J.jsx)(FS.Provider,{value:q.useMemo(()=>({id:n,parentId:r}),[n,r]),children:t})}function VS(e){let{children:t,externalTree:n}=e,r=G_(()=>n??new PS).current;return(0,J.jsx)(IS.Provider,{value:r,children:t})}function HS(e){return e==null?e:`current`in e?e.current:e}function US(e,t){let n=b_(Oy(e));return e instanceof n.KeyboardEvent?`keyboard`:e instanceof n.FocusEvent?t||`keyboard`:`pointerType`in e?e.pointerType||(xy(e)?`keyboard`:t||`mouse`):`touches`in e?`touch`:e instanceof n.MouseEvent?t||(e.detail===0?`keyboard`:`mouse`):``}var WS=20,GS=[];function KS(){GS=GS.filter(e=>e.deref()?.isConnected)}function qS(e){KS(),e&&y_(e)!==`body`&&(GS.push(new WeakRef(e)),GS.length>WS&&(GS=GS.slice(-20)))}function JS(){return KS(),GS[GS.length-1]?.deref()}function YS(e){return e?Gx(e)?e:qx(e)[0]||e:null}function XS(e){if(e.hasAttribute(`tabindex`)&&!e.hasAttribute(`data-tabindex`)||!e.getAttribute(`role`)?.includes(`dialog`))return;let t=Kx(e).filter(e=>{let t=e.getAttribute(`data-tabindex`)||``;return Gx(e)||e.hasAttribute(`data-tabindex`)&&!t.startsWith(`-`)}),n=e.getAttribute(`tabindex`);t.length===0?n!==`0`&&(e.setAttribute(`tabindex`,`0`),e.setAttribute(`data-tabindex`,`0`)):(n!==`-1`||e.hasAttribute(`data-tabindex`)&&e.getAttribute(`data-tabindex`)!==`-1`)&&(e.setAttribute(`tabindex`,`-1`),e.setAttribute(`data-tabindex`,`-1`))}function ZS(e){let{context:t,children:n,disabled:r=!1,initialFocus:i=!0,returnFocus:a=!0,explicitReturnFocus:o,restoreFocus:s=!1,modal:c=!0,closeOnFocusOut:l=!0,openInteractionType:u=``,nextFocusableElement:d,previousFocusableElement:f,beforeContentFocusGuardRef:p,externalTree:m,getInsideElements:h}=e,g=t.useState(`open`),_=t.useState(`domReferenceElement`),v=t.useState(`floatingElement`),{events:y,dataRef:b}=t.context,x=Z(()=>b.current.floatingContext?.nodeId),S=i===!1,C=ob(_)&&S,w=Vb(i),T=Vb(a),E=Vb(o),D=Vb(u),O=Vb(g),k=RS(m),A=kS(),j=q.useRef(!1),M=q.useRef(!1),N=q.useRef(!1),P=q.useRef(null),F=q.useRef(``),I=q.useRef(``),L=q.useRef(null),R=q.useRef(null),ee=xv(L,p,A?.beforeInsideRef),z=xv(R,A?.afterInsideRef),te=iy(),B=iy(),ne=Kb(),V=A!=null,H=cb(v),re=Z((e=H)=>e?qx(e):[]),ie=Z(()=>h?.().filter(e=>e!=null)??[]);q.useEffect(()=>{if(r||!c)return;function e(e){e.key===`Tab`&&Ey(H,Ty(gv(H)))&&re().length===0&&!C&&yy(e)}return zb(gv(H),`keydown`,e)},[r,H,c,C,re]),q.useEffect(()=>{if(r||!g)return;let e=gv(H);function t(){N.current=!1}function n(e){let t=Oy(e),n=ie(),r=Ey(v,t)||Ey(_,t)||Ey(A?.portalNode,t)||n.some(e=>e===t||Ey(e,t));N.current=!r,I.current=e.pointerType||`keyboard`,Dy(t,`[data-base-ui-click-trigger]`)&&(M.current=!0,B.start(0,()=>{M.current=!1}))}function i(){I.current=`keyboard`}return Bb(zb(e,`pointerdown`,n,!0),zb(e,`pointerup`,t,!0),zb(e,`pointercancel`,t,!0),zb(e,`keydown`,i,!0),t)},[r,v,_,H,g,A,B,ie]),q.useEffect(()=>{if(r||!l)return;let e=gv(H);function n(){M.current=!0,B.start(0,()=>{M.current=!1})}function i(e){let t=Oy(e);Gx(t)&&(P.current=t)}function a(n){let r=n.relatedTarget,i=n.currentTarget,a=Oy(n);c&&r==null&&a!=null&&Ey(v,a)&&qS(a),queueMicrotask(()=>{let o=x(),l=t.context.triggerElements,u=ie(),p=r?.hasAttribute(rS(`focus-guard`))&&[L.current,R.current,A?.beforeInsideRef.current,A?.afterInsideRef.current,A?.beforeOutsideRef.current,A?.afterOutsideRef.current,HS(f),HS(d)].includes(r),m=!(Ey(_,r)||Ey(v,r)||Ey(r,v)||Ey(A?.portalNode,r)||u.some(e=>e===r||Ey(e,r))||l.hasMatchingElement(e=>Ey(e,r))||p||k&&(tS(k.nodesRef.current,o).find(e=>Ey(e.context?.elements.floating,r)||Ey(e.context?.elements.domReference,r))||nS(k.nodesRef.current,o).find(e=>[e.context?.elements.floating,cb(e.context?.elements.floating)].includes(r)||e.context?.elements.domReference===r)));if(i===_&&H&&XS(H),s&&i!==_&&!jx(a)&&Ty(e)===e.body){if(w_(H)&&(H.focus(),s===`popup`)){ne.request(()=>{H.focus()});return}let e=re(),t=P.current,n=(t&&e.includes(t)?t:null)||e[e.length-1]||H;w_(n)&&n.focus()}b.current.insideReactTree?b.current.insideReactTree=!1:(C||!c)&&r&&m&&!M.current&&(C||r!==JS())&&(j.current=!0,t.setOpen(!1,mb(Cb,n)))})}function o(){N.current||(b.current.insideReactTree=!0,te.start(0,()=>{b.current.insideReactTree=!1}))}let u=w_(_)?_:null;if(v||u)return Bb(u&&zb(u,`focusout`,a),u&&zb(u,`pointerdown`,n),v&&zb(v,`focusin`,i),v&&zb(v,`focusout`,a),v&&A&&zb(v,`focusout`,o,!0))},[r,_,v,H,c,k,A,t,l,s,re,C,x,b,te,B,ne,d,f,ie]),q.useEffect(()=>{if(r||!v||!g)return;let e=Array.from(A?.portalNode?.querySelectorAll(`[${rS(`portal`)}]`)||[]),t=(k?nS(k.nodesRef.current,x()):[]).find(e=>ob(e.context?.elements.domReference||null))?.context?.elements.domReference,n=gS([v,...e,L.current,R.current,A?.beforeOutsideRef.current,A?.afterOutsideRef.current,...ie(),t,HS(f),HS(d),C?_:null].filter(e=>e!=null),{ariaHidden:c||C,mark:!1}),i=gS([v,...e].filter(e=>e!=null));return()=>{i(),n()}},[g,r,_,v,c,A,C,k,x,d,f,ie]),Q(()=>{if(!g||r||!w_(H))return;F.current=``,I.current=``;let e=gv(H),t=Ty(e);queueMicrotask(()=>{let n=w.current,r=typeof n==`function`?n(D.current||``):n;if(r===void 0||r===!1||Ey(H,t))return;let i=null,a=()=>(i??=re(H),i[0]||H),o;o=r===!0||r===null?a():HS(r),o||=a();let s=Ey(H,Ty(e)),c=b.current.openEvent,l=c?.type===`mousedown`&&xy(c);aS(o,{sync:l,preventScroll:o===H,shouldFocus(){if(!O.current)return!1;if(s)return!0;let t=Ty(e);return!(t!==o&&Ey(H,t))}})})},[r,g,H,re,w,D,O,b]);let ae=q.useRef(null);Q(()=>{if(r||!H){ae.current=null;return}ae.current&&=(ae.current.cancelled=!0,null);let e=gv(H),t=Ty(e),n=D.current==null;qS(t);function i(e){if(e.open||(F.current=US(e.nativeEvent,I.current)),(e.reason===`focus-out`&&e.triggerElement?.hasAttribute(rS(`focus-guard`))||e.reason===`trigger-hover`&&e.nativeEvent.type===`mouseleave`)&&(j.current=!0),e.reason===`outside-press`){if(e.nested)j.current=!1;else if(xy(e.nativeEvent)||Sy(e.nativeEvent))j.current=!1;else{let e=!1;gv(H).createElement(`div`).focus({get preventScroll(){return e=!0,!1}}),e?j.current=!1:j.current=!0}}}y.on(`openchange`,i);function a(e){let r=T.current,i=typeof r==`function`?r(e):r;if(i===void 0||i===!1)return null;i===null&&(i=!0);let a=_?.isConnected?_:null,o=t?.isConnected&&y_(t)!==`body`?t:null,s=n?o||a:a||o;return s||=JS()||null,typeof i==`boolean`?s:HS(i)||s||null}return()=>{y.off(`openchange`,i);let t=Ty(e),n=ie(),r=Ey(v,t)||n.some(e=>e===t||Ey(e,t))||k&&tS(k.nodesRef.current,x(),!1).some(e=>Ey(e.context?.elements.floating,t)),o=T.current,s=F.current,c=a(s),l={cancelled:!1};ae.current=l,queueMicrotask(()=>{ae.current===l&&(ae.current=null);let n=YS(c),i=E.current??typeof o!=`boolean`;if(!l.cancelled&&o&&!j.current&&w_(n)&&(i||n===t||t===e.body||r)){let e={preventScroll:!0};s===`keyboard`&&(e.focusVisible=!0),n.focus(e)}j.current=!1})}},[r,v,H,T,E,D,y,k,_,x,ie]),Q(()=>{if(!gy||g||!v)return;let e=Ty(gv(v));w_(e)&&ib(e)&&Ey(v,e)&&e.blur()},[g,v]),Q(()=>{if(!r&&A)return A.setFocusManagerState({modal:c,closeOnFocusOut:l,open:g,onOpenChange:t.setOpen,domReference:_}),()=>{A.setFocusManagerState(null)}},[r,A,c,g,t,l,_]),Q(()=>{if(!r&&H)return XS(H),()=>{queueMicrotask(KS)}},[r,H]);let oe=!r&&(!c||!C)&&(V||c);return(0,J.jsxs)(q.Fragment,{children:[oe&&(0,J.jsx)(Xb,{"data-type":`inside`,ref:ee,onFocus:e=>{if(c){let e=re();aS(e[e.length-1])}else A?.portalNode&&(j.current=!1,Qx(e,A.portalNode)?Yx(_)?.focus():HS(f??A.beforeOutsideRef)?.focus())}}),n,oe&&(0,J.jsx)(Xb,{"data-type":`inside`,ref:z,onFocus:e=>{c?aS(re()[0]):A?.portalNode&&(l&&(j.current=!0),Qx(e,A.portalNode)?Xx(_)?.focus():HS(d??A.afterOutsideRef)?.focus())}})]})}function QS(e,t={}){let{enabled:n=!0,event:r=`click`,toggle:i=!0,ignoreMouse:a=!1,stickIfOpen:o=!0,touchOpenDelay:s=0,reason:c=_b}=t,l=e.context.dataRef,u=q.useRef(void 0),d=Kb(),f=iy(),p=q.useMemo(()=>{function t(t,n,r,i){let a=mb(c,n,r);t&&i===`touch`&&s>0?f.start(s,()=>{e.setOpen(!0,a)}):e.setOpen(t,a)}function n(t,n,r){let a=l.current.openEvent,s=e.select(`domReferenceElement`)!==n;return t&&s||!t||!i?!0:a&&(typeof o==`function`?o():o)?!r(a.type):!1}return{onPointerDown(e){u.current=Cy(e.pointerType,!0)&&Sy(e.nativeEvent)?`virtual`:e.pointerType},onMouseDown(i){let o=u.current,s=i.nativeEvent,c=e.select(`open`);if(i.button!==0||r===`click`||Cy(o,!0)&&a)return;let l=n(c,i.currentTarget,e=>e===`click`||e===`mousedown`),f=Oy(s),p=ib(f);if(p||o===`virtual`){t(l,s,p?f:i.currentTarget,o);return}let m=i.currentTarget;d.request(()=>{t(l,s,m,o)})},onClick(i){if(r===`mousedown-only`)return;let o=u.current;r===`mousedown`&&o?u.current=void 0:Cy(o,!0)&&a||t(n(e.select(`open`),i.currentTarget,e=>e===`click`||e===`mousedown`||e===`keydown`||e===`keyup`),i.nativeEvent,i.currentTarget,o)},onKeyDown(){u.current=void 0}}},[l,r,a,c,e,o,i,d,f,s]);return q.useMemo(()=>n?{reference:p}:Mv,[n,p])}function $S(e,t){let n=null,r=null,i=!1;return{contextElement:e||void 0,getBoundingClientRect(){let a=e?.getBoundingClientRect()||{width:0,height:0,x:0,y:0},o=t.axis===`x`||t.axis===`both`,s=t.axis===`y`||t.axis===`both`,c=[`mouseenter`,`mousemove`].includes(t.dataRef.current.openEvent?.type||``)&&t.pointerType!==`touch`,l=t.axis===`y`?a.width:0,u=t.axis===`x`?a.height:0,d=a.x,f=a.y;return n==null&&t.x&&o&&(n=a.x-t.x),r==null&&t.y&&s&&(r=a.y-t.y),d-=n||0,f-=r||0,(!i||c)&&(d=o&&t.x!=null?t.x:d,f=s&&t.y!=null?t.y:f),i=!0,{width:l,height:u,x:d,y:f,top:f,right:d+l,bottom:f+u,left:d}}}}function eC(e){return e!=null&&e.clientX!=null}function tC(e,t={}){let{enabled:n=!0,axis:r=`both`}=t,i=e.useState(`open`),a=e.useState(`floatingElement`),o=e.useState(`domReferenceElement`),s=e.context.dataRef,c=q.useRef(!1),l=q.useRef(null),[u,d]=q.useState(),[f,p]=q.useState([]),m=Z(t=>{e.set(`positionReference`,t)}),h=Z((t,n,i)=>{c.current||(!s.current.openEvent||eC(s.current.openEvent))&&e.set(`positionReference`,$S(i??o,{x:t,y:n,axis:r,dataRef:s,pointerType:u}))}),g=Z(e=>{i?l.current||(h(e.clientX,e.clientY,e.currentTarget),p([])):h(e.clientX,e.clientY,e.currentTarget)}),_=Cy(u)?a:i;q.useEffect(()=>{if(!n){m(o);return}if(!_)return;function e(){l.current?.(),l.current=null}let t=b_(a);function r(t){let n=Oy(t);Ey(a,n)?e():h(t.clientX,t.clientY)}return!s.current.openEvent||eC(s.current.openEvent)?l.current=zb(t,`mousemove`,r):m(o),e},[_,n,a,s,o,e,h,m,f]),q.useEffect(()=>()=>{e.set(`positionReference`,null)},[e]),q.useEffect(()=>{n&&!a&&(c.current=!1)},[n,a]),q.useEffect(()=>{!n&&i&&(c.current=!0)},[n,i]);let v=q.useMemo(()=>{function e(e){d(e.pointerType)}return{onPointerDown:e,onPointerEnter:e,onMouseMove:g,onMouseEnter:g}},[g]);return q.useMemo(()=>n?{reference:v,trigger:v}:{},[n,v])}function nC(){return!1}function rC(e){return{escapeKey:typeof e==`boolean`?e:e?.escapeKey??!1,outsidePress:typeof e==`boolean`?e:e?.outsidePress??!0}}function iC(e,t={}){let{enabled:n=!0,escapeKey:r=!0,outsidePress:i=!0,outsidePressEvent:a=`sloppy`,referencePress:o=nC,bubbles:s,externalTree:c}=t,l=e.useState(`open`),u=e.useState(`floatingElement`),{dataRef:d,events:f}=e.context,p=RS(c),m=Z(typeof i==`function`?i:()=>!1),h=typeof i==`function`?m:i,g=h!==!1,_=Z(()=>a),{escapeKey:v,outsidePress:y}=rC(s),b=q.useRef(!1),x=q.useRef(!1),S=q.useRef(!1),C=q.useRef(!1),w=q.useRef(!1),T=q.useRef(``),E=q.useRef(null),D=iy(),O=iy(),k=iy(),A=Z(()=>{O.clear(),d.current.insideReactTree=!1}),j=Z(e=>{let t=d.current.floatingContext?.nodeId;return(p?tS(p.nodesRef.current,t):[]).some(t=>t.context?.open&&!t.context.dataRef.current[e])}),M=Z(t=>nb(t,e.select(`floatingElement`))||nb(t,e.select(`domReferenceElement`))),N=Z(t=>{o()&&e.setOpen(!1,mb(_b,t.nativeEvent))}),P=Z(t=>{if(!l||!n||!r||t.key!==`Escape`)return;let i=by(t)?t.nativeEvent:t;if(w.current||i.isComposing||!v&&j(`__escapeKeyBubbles`))return;let a=mb(wb,i);e.setOpen(!1,a),a.isCanceled||t.preventDefault(),!v&&!a.isPropagationAllowed&&t.stopPropagation()}),F=Z(()=>{d.current.insideReactTree=!0,O.start(0,A)}),I=Z(t=>{if(!l||!n||t.button!==0)return;let r=Oy(t.nativeEvent);Ey(e.select(`floatingElement`),r)&&(b.current||(b.current=!0,x.current=!1))}),L=Z(e=>{l&&n&&(e.defaultPrevented||e.nativeEvent.defaultPrevented)&&b.current&&(x.current=!0)});q.useEffect(()=>{function e(e){e.open||(C.current=!1)}return f.on(`openchange`,e),()=>{f.off(`openchange`,e)}},[f]),q.useEffect(()=>A,[A]),q.useEffect(()=>{if(!l||!n)return l||(C.current=!1,w.current=!1,T.current=``,E.current=null),A;d.current.__escapeKeyBubbles=v,d.current.__outsidePressBubbles=y;let t=new ry,i=gv(u);function a(){k.clear(),w.current=!0}function o(){w.current=!0,k.start(gy?5:0,()=>{w.current=!1})}function s(){S.current=!0,t.start(0,()=>{S.current=!1})}function c(){b.current=!1,x.current=!1}function f(){let e=T.current,t=e===`pen`||!e?`mouse`:e,n=_(),r=typeof n==`function`?n():n;return typeof r==`string`?r:r[t]}function m(e){let t=f();return t===`intentional`&&e.type!==`click`||t===`sloppy`&&e.type===`click`}function O(e){let t=d.current.floatingContext?.nodeId,n=p&&tS(p.nodesRef.current,t).some(t=>nb(e,t.context?.elements.floating));return M(e)||n}function N(n){if(m(n)){n.type!==`click`&&!M(n)&&(t.clear(),S.current=!1),A();return}if(d.current.insideReactTree){A();return}let r=Oy(n),i=`[${rS(`inert`)}]`,a=C_(r)?r.getRootNode():null,o=Array.from((T_(a)?a:gv(e.select(`floatingElement`))).querySelectorAll(i)),s=e.context.triggerElements;if(r&&(s.hasElement(r)||s.hasMatchingElement(e=>Ey(e,r))))return;let c=C_(r)?r:null;for(;c&&!I_(c);){let e=z_(c);if(I_(e)||!C_(e))break;c=e}if(!(o.length&&C_(r)&&!rb(r)&&!Ey(r,e.select(`floatingElement`))&&o.every(e=>!Ey(c,e)))){if(w_(r)&&!(`touches`in n)){let e=I_(r),t=L_(r),i=/auto|scroll/,a=e||i.test(t.overflowX),o=e||i.test(t.overflowY),s=a&&r.clientWidth>0&&r.scrollWidth>r.clientWidth,c=o&&r.clientHeight>0&&r.scrollHeight>r.clientHeight,l=t.direction===`rtl`,u=c&&(l?n.offsetX<=r.offsetWidth-r.clientWidth:n.offsetX>r.clientWidth),d=s&&n.offsetY>r.clientHeight;if(u||d)return}if(!O(n)){if(f()===`intentional`){if(n.detail!==0&&!xy(n)&&!C.current)return;if(S.current){t.clear(),S.current=!1;return}}(typeof h!=`function`||h(n))&&(j(`__outsidePressBubbles`)||(e.setOpen(!1,mb(bb,n)),A()))}}}function F(t){f()===`sloppy`&&t.pointerType!==`touch`&&e.select(`open`)&&n&&!M(t)&&N(t)}function I(t){if(f()!==`sloppy`||!e.select(`open`)||!n||M(t))return;let r=t.touches[0];r&&(E.current={startTime:Date.now(),startX:r.clientX,startY:r.clientY,dismissOnTouchEnd:!1,dismissOnMouseDown:!0},D.start(1e3,()=>{E.current&&(E.current.dismissOnTouchEnd=!1,E.current.dismissOnMouseDown=!1)}))}function L(e,t){let n=Oy(e);if(!n)return;let r=zb(n,e.type,()=>{t(e),r()})}function R(e){T.current=`touch`,L(e,I)}function ee(e){D.clear(),e.type===`pointerdown`&&(e.button===0&&(C.current=!0),T.current=e.pointerType),(e.type!==`mousedown`||!E.current||E.current.dismissOnMouseDown)&&L(e,e=>{e.type===`pointerdown`?F(e):N(e)})}function z(e){if(e.type===`pointercancel`&&(C.current=!1),!b.current)return;let n=x.current;c(),f()===`intentional`&&(e.type===`pointercancel`?n&&s():O(e)||(n?s():(typeof h!=`function`||h(e))&&(t.clear(),S.current=!0,A())))}function te(e){if(f()!==`sloppy`||!E.current||M(e))return;let t=e.touches[0];if(!t)return;let n=Math.abs(t.clientX-E.current.startX),r=Math.abs(t.clientY-E.current.startY),i=Math.sqrt(n*n+r*r);i>5&&(E.current.dismissOnTouchEnd=!0),i>10&&(N(e),D.clear(),E.current=null)}function B(e){L(e,te)}function ne(e){f()===`sloppy`&&E.current&&!M(e)&&(E.current.dismissOnTouchEnd&&N(e),D.clear(),E.current=null)}function V(e){L(e,ne)}let H=Bb(r&&Bb(zb(i,`keydown`,P),zb(i,`compositionstart`,a),zb(i,`compositionend`,o)),g&&Bb(zb(i,`click`,ee,!0),zb(i,`pointerdown`,ee,!0),zb(i,`pointerup`,z,!0),zb(i,`pointercancel`,z,!0),zb(i,`mousedown`,ee,!0),zb(i,`mouseup`,z,!0),zb(i,`touchstart`,R,{capture:!0,passive:!0}),zb(i,`touchmove`,B,{capture:!0,passive:!0}),zb(i,`touchend`,V,{capture:!0,passive:!0})));return()=>{H(),t.clear(),c(),S.current=!1}},[d,u,r,g,h,l,n,v,y,P,A,_,j,M,p,e,D,k]);let R=q.useMemo(()=>({onKeyDown:P,onPointerDown:N,onClick:N}),[P,N]),ee=q.useMemo(()=>({onKeyDown:P,onPointerDown:L,onMouseDown:L,onClickCapture:F,onMouseDownCapture(e){F(),I(e)},onPointerDownCapture(e){F(),I(e)},onMouseUpCapture:F,onTouchEndCapture:F,onTouchMoveCapture:F}),[P,F,I,L]);return q.useMemo(()=>n?{reference:R,floating:ee,trigger:R}:{},[n,R,ee])}function aC(e,t,n,r){return{left:e,top:t,right:n,bottom:r,x:e,y:t,width:n-e,height:r-t}}function oC(e){return{left:e.left,top:e.top,right:e.right,bottom:e.bottom,width:e.width,height:e.height}}function sC(e){let t=[],n,r=1/0,i=1/0,a=-1/0,o=-1/0;for(let s of Array.from(e).sort((e,t)=>e.top-t.top)){if(r=Math.min(r,s.left),i=Math.min(i,s.top),a=Math.max(a,s.right),o=Math.max(o,s.bottom),!n||s.top-n.top>n.height/2)t.push(oC(s));else{let e=t[t.length-1];e.left=Math.min(e.left,s.left),e.right=Math.max(e.right,s.right),e.bottom=Math.max(e.bottom,s.bottom),e.width=e.right-e.left,e.height=e.bottom-e.top}n=s}return{lines:t,fallback:aC(r,i,a,o)}}function cC(e,t,n){return e.findIndex(e=>t>e.left-2&&t<e.right+2&&n>e.top-2&&n<e.bottom+2)}function lC(e){return aC(e.left,e.top,e.right,e.bottom)}function uC(e,t,n){let{lines:r}=sC(e.getClientRects());if(r.length<2)return;let i=cC(r,t,n);return{x:t,y:n,lineIndex:i===-1?void 0:i,element:e}}function dC(e,t,n){let{lines:r,fallback:i}=sC(e.getClientRects());if(r.length<2)return null;let a=n?.x,o=n?.y,s=t[0];if(n?.lineIndex!=null&&r[n.lineIndex])return lC(r[n.lineIndex]);if(a!=null&&o!=null){let e=cC(r,a,o);if(e!==-1)return lC(r[e])}if(r.length===2&&r[0].left>r[1].right&&a!=null&&o!=null)return i;if(s===`t`||s===`b`){let e=r[0],t=r[r.length-1],n=s===`t`?e:t;return aC(n.left,e.top,n.right,t.bottom)}let c=s===`l`,l=r[0].left,u=r[0].right,d=c?1/0:-1/0,f=r[0],p=r[0];for(let e of r){l=Math.min(l,e.left),u=Math.max(u,e.right);let t=c?e.left:e.right;c&&t<d||!c&&t>d?(d=t,f=e,p=e):t===d&&(p=e)}return aC(l,f.top,u,p.bottom)}function fC(e){return`contextElement`in e&&e.contextElement?e.contextElement:C_(e)?e:void 0}function pC(e,t){function n(t){mC(e,t.currentTarget,t.clientX,t.clientY)}function r(e){t||n(e)}return{onFocus(){e.current=void 0},onMouseEnter:r,onMouseMove:r}}function mC(e,t,n,r){let i=uC(t,n,r);return e.current=i,i}function hC(e){return{name:`inline`,async fn(t){let n=t.elements.reference;if(typeof n?.getClientRects!=`function`)return{};let r=fC(n),i=e.current,a=i?.element===n||i?.element===r?i:void 0,o=dC(n,t.placement,a);if(!o||typeof t.platform.getElementRects!=`function`)return{};let s=await t.platform.getElementRects({reference:{contextElement:r,getBoundingClientRect(){return o}},floating:t.elements.floating,strategy:t.strategy});return t.rects.reference.x===s.reference.x&&t.rects.reference.y===s.reference.y&&t.rects.reference.width===s.reference.width&&t.rects.reference.height===s.reference.height?{}:{reset:{rects:s}}}}}var gC=class{attachedStores=[];attachedStoreValue=null;storeListeners=new Set;constructor(e,t,n=!0){this.fallbackStore=e,this.componentName=t,this.throwOnMissingTrigger=n}get attachedStore(){return this.attachedStoreValue}get store(){return this.attachedStoreValue??this.fallbackStore}get serverStore(){return this.fallbackStore}subscribeStore(e){return this.storeListeners.add(e),()=>{this.storeListeners.delete(e)}}attachStore(e){return this.attachedStores.push(e),this.setActiveStore(e),()=>{let t=this.attachedStores.lastIndexOf(e);t!==-1&&this.attachedStores.splice(t,1),this.setActiveStore(this.attachedStores[this.attachedStores.length-1]??null)}}setActiveStore(e){this.attachedStoreValue!==e&&(this.attachedStoreValue=e,this.storeListeners.forEach(e=>{e()}))}openByTrigger(e){let t=this.attachedStore;if(t===null)return;let n;if(e){for(let t=this.attachedStores.length-1;t>=0&&!n;--t)n=this.attachedStores[t].context.triggerElements.getById(e);n??=this.fallbackStore.context.triggerElements.getById(e)}if(e&&!n&&this.throwOnMissingTrigger)throw Error(fv(99,this.componentName,e,this.componentName));t.setOpen(!0,mb(Nb,void 0,n))}closePopup(){let e=this.attachedStore;e!==null&&e.setOpen(!1,mb(Nb))}};function _C(e){let{popupStore:t,treatPopupAsFloatingElement:n=!1,floatingRootContext:r,floatingId:i,nested:a,onOpenChange:o}=e,s=t.useState(`open`),c=t.useState(`activeTriggerElement`),l=t.useState(n?`popupElement`:`positionerElement`),u=o;return t.useSyncedValue(`floatingId`,i),Q(()=>{let e={open:s,floatingId:i,referenceElement:c,floatingElement:l};C_(c)&&(e.domReferenceElement=c),r.state.positionReference===r.state.referenceElement&&(e.positionReference=c),r.update(e)},[s,i,c,l,r]),r.context.onOpenChange=u,r.context.nested=a,r}function vC(e,t=!1,n=!1,r=!1){let[i,a]=q.useState(e&&t?`idle`:void 0),[o,s]=q.useState(e&&!r);return e&&!o&&(s(!0),a(`starting`)),!e&&o&&i!==`ending`&&!n&&a(`ending`),!e&&!o&&i===`ending`&&a(void 0),Q(()=>{if(!e&&o&&i!==`ending`&&n){let e=Gb.request(()=>{a(`ending`)});return()=>{Gb.cancel(e)}}},[e,o,i,n]),Q(()=>{if(!e||t||i===void 0)return;let n=Gb.request(()=>{a(void 0)});return()=>{Gb.cancel(n)}},[t,e,i]),Q(()=>{if(!e||!t)return;e&&o&&i!==`idle`&&a(`starting`);let n=Gb.request(()=>{a(`idle`)});return()=>{Gb.cancel(n)}},[t,e,o,i]),{mounted:o,setMounted:s,transitionStatus:i}}function yC(e,t){return e.getAnimations(t).filter(e=>{let t=e.effect?.getTiming();return t?.duration!==1/0&&t?.iterations!==1/0})}var bC=null;function xC(e){if(!bC){let e=[];bC=e,queueMicrotask(()=>{bC=null,DS.flushSync(()=>{for(let t of e)t()})})}bC.push(e)}function SC(e,t=!1,n=!1){let r=Kb();return Z((i,a=null)=>{r.cancel();let o=HS(e);if(o==null)return;let s=o,c=()=>{n?xC(()=>{a?.aborted||i()}):DS.flushSync(i)};if(typeof s.getAnimations!=`function`||globalThis.BASE_UI_ANIMATIONS_DISABLED){i();return}function l(){Promise.all(yC(s).map(e=>e.finished.then(Av))).then(()=>{a?.aborted||c()},()=>{a?.aborted||(yC(s).some(e=>e.pending||e.playState!==`finished`)?l():c())})}if(t){let e=Fy;if(!s.hasAttribute(e)){r.request(l);return}let t=new MutationObserver(()=>{s.hasAttribute(e)||(t.disconnect(),l())});t.observe(s,{attributes:!0,attributeFilter:[e]}),a?.addEventListener(`abort`,()=>t.disconnect(),{once:!0})}else r.request(l)})}function CC(e){let{enabled:t=!0,open:n,ref:r,batch:i=!1,onComplete:a}=e,o=Z(a),s=SC(r,n,i);q.useEffect(()=>{if(!t)return;let e=new AbortController;return s(o,e.signal),()=>{e.abort()}},[t,n,o,s])}function wC(e){let{open:t,ref:n,preventUnmountOnClose:r,setPreventUnmountOnClose:i,onUnmount:a,animateInitialOpen:o}=e,s=Z(i),{mounted:c,setMounted:l,transitionStatus:u}=vC(t,!1,!1,o),d=!t&&r;Q(()=>{t&&s(!1)},[t,s]);let f=q.useRef(c),p=q.useRef(!1),m=_S(),h=()=>{f.current=!1,l(!1),a()};Q(()=>{f.current=c,p.current&&(p.current=!1,!t&&c&&h())});let g=Z(()=>{f.current&&(t?(p.current=!0,m()):h())});return CC({enabled:c&&!t&&!d,open:t,ref:n,onComplete(){t||g()}}),{mounted:c,transitionStatus:u,preventUnmountingOnClose:d,forceUnmount:g}}var TC={tabIndex:-1,[ky]:``};function EC(e){return t=>t!==`touch`||e.current}function DC(e,t=!1){let n=xS(),r=LS()!=null,i=G_(()=>e(n,r)).current;return _C({popupStore:i,treatPopupAsFloatingElement:t,floatingRootContext:i.state.floatingRootContext,floatingId:n,nested:r,onOpenChange:i.setOpen}),i}function OC({handle:e,store:t}){return Q(()=>e.attachStore(t),[e,t]),null}function kC(e){let t=e.context.triggerElements.size;e.select(`open`)&&e.state.triggerCount!==t&&e.set(`triggerCount`,t)}function AC(e,t){let n=q.useRef(null);return Z(r=>{let i=n.current;if(i!==null){if(i.element===r&&i.store===t&&i.id===e)return;n.current=null;let a=i.store;a.context.triggerElements.getById(i.id)===i.element&&(a.context.triggerElements.delete(i.id),kC(a))}r!==null&&e!==void 0&&(n.current={store:t,id:e,element:r},t.context.triggerElements.add(e,r),kC(t))})}function jC(e,t,n,r=!1){let i=e.preventUnmountingOnClose;t?i=!1:r&&(i=!0);let a=n?.id??null,o=e.activeTriggerId,s=e.activeTriggerElement;return(a||t)&&(o=a,s=n??null),{open:t,preventUnmountingOnClose:i,activeTriggerId:o,activeTriggerElement:s,openedWithoutTrigger:t?n==null:e.openedWithoutTrigger}}function MC(e){let t=!1;return e.preventUnmountOnClose=()=>{t=!0},()=>t}function NC(e,t,n,r={}){let i=n.reason,a=i===vb,o=t&&i===`trigger-focus`,s=!t&&(i===`trigger-press`||i===`escape-key`),c=MC(n);if(e.context.onOpenChange?.(t,n),n.isCanceled)return;r.onBeforeDispatch?.(),e.state.floatingRootContext.dispatchOpenChange(t,n);let l=()=>{let i=jC(e.state,t,n.trigger,c()),l={...r.extraState,...i};o?l.instantType=`focus`:s?l.instantType=`dismiss`:a&&(l.instantType=void 0),e.update(l)};a?DS.flushSync(l):l()}function PC(e,t,n,r){let i=n.useState(`isMountedByTrigger`,e),a=AC(e,n),o=Z(t=>{let i=n.select(`open`),a=n.select(`activeTriggerId`);if(a===e){let e={activeTriggerElement:t,...i?r:null};n.update(e)}else if(a==null&&i&&!n.state.openedWithoutTrigger){let i={activeTriggerId:e??null,activeTriggerElement:t,...r};n.update(i)}}),s=Z(e=>{a(e),e&&o(e)});return Q(()=>(s(t.current),()=>s(null)),[s,t,n,e]),Q(()=>{if(i){let e={activeTriggerElement:t.current,...r};n.update(e)}},[i,n,t,...Object.values(r)]),{registerTrigger:s,isMountedByThisTrigger:i}}function FC(e,t={}){let{closeOnActiveTriggerUnmount:n=!1}=t,r=q.useRef(null),i=e.useState(`open`);Q(()=>{if(!i){r.current=null,e.state.triggerCount!==0&&e.set(`triggerCount`,0),e.state.openedWithoutTrigger&&e.set(`openedWithoutTrigger`,!1);return}let t=e.context.triggerElements.size,a={};e.state.triggerCount!==t&&(a.triggerCount=t);let o=e.select(`activeTriggerId`),s=null;if(o){let t=e.context.triggerElements.getById(o);if(t)r.current=o,t!==e.state.activeTriggerElement&&(a.activeTriggerElement=t);else{for(let[t,n]of e.context.triggerElements.entries())if(n===e.state.activeTriggerElement){a.activeTriggerId=t,a.activeTriggerElement=n,r.current=t;break}a.activeTriggerId===void 0&&(r.current===o?s=o:r.current=null)}}else r.current=null;if(!s&&!o&&!e.state.openedWithoutTrigger&&t===1){let t=e.context.triggerElements.entries().next();if(!t.done){let[e,n]=t.value;a.activeTriggerId=e,a.activeTriggerElement=n,r.current=e}}(a.triggerCount!==void 0||a.activeTriggerId!==void 0||a.activeTriggerElement!==void 0)&&e.update(a),s&&n&&queueMicrotask(()=>{if(e.select(`open`)&&e.select(`activeTriggerId`)===s&&!e.context.triggerElements.getById(s)){let t=mb(gb);e.setOpen(!1,t),t.isCanceled||e.update({activeTriggerId:null,activeTriggerElement:null})}})},[i,e,e.useState(`triggerCount`),e.useState(`activeTriggerId`),e.useState(`activeTriggerElement`),n])}function IC(e,t,n,r){let{mounted:i,transitionStatus:a,forceUnmount:o}=wC({open:e,ref:t.context.popupRef,preventUnmountOnClose:t.useState(`preventUnmountingOnClose`),setPreventUnmountOnClose:e=>t.set(`preventUnmountingOnClose`,e),animateInitialOpen:r,onUnmount(){t.update({activeTriggerId:null,activeTriggerElement:null,mounted:!1,preventUnmountingOnClose:!1}),n?.(),t.context.onOpenChangeComplete?.(!1)}});return G_(()=>(t.set(`mounted`,i),null)),t.useSyncedValues({mounted:i,transitionStatus:a}),{forceUnmount:o,transitionStatus:a}}function LC(e,t){e.useSyncedValues(t),Q(()=>()=>{e.update({activeTriggerProps:Mv,inactiveTriggerProps:Mv,popupProps:Mv})},[e])}function RC(e,t){Q(()=>{!t&&e.state.openMethod!==null&&e.set(`openMethod`,null)},[t,e]),Q(()=>()=>{e.state.openMethod!==null&&e.set(`openMethod`,null)},[e])}var zC=class{idMap=new Map;add(e,t){this.idMap.set(e,t)}delete(e){this.idMap.delete(e)}hasElement(e){for(let t of this.idMap.values())if(t===e)return!0;return!1}hasMatchingElement(e){for(let t of this.idMap.values())if(e(t))return!0;return!1}getById(e){return this.idMap.get(e)}entries(){return this.idMap.entries()}elements(){return this.idMap.values()}get size(){return this.idMap.size}},BC=o((e=>{var t=d();function n(e,t){return e===t&&(e!==0||1/e==1/t)||e!==e&&t!==t}var r=typeof Object.is==`function`?Object.is:n,i=t.useState,a=t.useEffect,o=t.useLayoutEffect,s=t.useDebugValue;function c(e,t){var n=t(),r=i({inst:{value:n,getSnapshot:t}}),c=r[0].inst,u=r[1];return o(function(){c.value=n,c.getSnapshot=t,l(c)&&u({inst:c})},[e,n,t]),a(function(){return l(c)&&u({inst:c}),e(function(){l(c)&&u({inst:c})})},[e]),s(n),n}function l(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!r(e,n)}catch{return!0}}function u(e,t){return t()}var f=typeof window>`u`||window.document===void 0||window.document.createElement===void 0?u:c;e.useSyncExternalStore=t.useSyncExternalStore===void 0?f:t.useSyncExternalStore})),VC=o(((e,t)=>{t.exports=BC()})),HC=o((e=>{var t=d(),n=VC();function r(e,t){return e===t&&(e!==0||1/e==1/t)||e!==e&&t!==t}var i=typeof Object.is==`function`?Object.is:r,a=n.useSyncExternalStore,o=t.useRef,s=t.useEffect,c=t.useMemo,l=t.useDebugValue;e.useSyncExternalStoreWithSelector=function(e,t,n,r,u){var d=o(null);if(d.current===null){var f={hasValue:!1,value:null};d.current=f}else f=d.current;d=c(function(){function e(e){if(!a){if(a=!0,o=e,e=r(e),u!==void 0&&f.hasValue){var t=f.value;if(u(t,e))return s=t}return s=e}if(t=s,i(o,e))return t;var n=r(e);return u!==void 0&&u(t,n)?(o=e,t):(o=e,s=n)}var a=!1,o,s,c=n===void 0?null:n;return[function(){return e(t())},c===null?void 0:function(){return e(c())}]},[t,n,r,u]);var p=a(e,d[0],d[1]);return s(function(){f.hasValue=!0,f.value=p},[p]),l(p),p}})),UC=o(((e,t)=>{t.exports=HC()})),WC=VC(),GC=UC(),KC=Ov(19)?YC:XC;function qC(e,t,n,r,i){return KC(e,t,n,r,i)}function JC(e,t,n,r,i){let a=q.useCallback(()=>t(e.getSnapshot(),n,r,i),[e,t,n,r,i]);return(0,WC.useSyncExternalStore)(e.subscribe,a,a)}Zv({before(e){e.syncIndex=0,e.didInitialize||(e.syncTick=1,e.syncHooks=[],e.didChangeStore=!0,e.getSnapshot=()=>{let t=!1;for(let n=0;n<e.syncHooks.length;n+=1){let r=e.syncHooks[n],i=r.selector(r.store.state,r.a1,r.a2,r.a3);Object.is(r.value,i)||(t=!0,r.value=i)}return t&&(e.syncTick+=1),e.syncTick})},after(e){e.syncHooks.length>0&&(e.didChangeStore&&(e.didChangeStore=!1,e.subscribe=t=>{let n=new Set;for(let t of e.syncHooks)n.add(t.store);let r=[];for(let e of n)r.push(e.subscribe(t));return()=>{for(let e of r)e()}}),(0,WC.useSyncExternalStore)(e.subscribe,e.getSnapshot,e.getSnapshot))}});function YC(e,t,n,r,i){let a=Xv();if(!a)return JC(e,t,n,r,i);let o=a.syncIndex;a.syncIndex+=1;let s;return a.didInitialize?(s=a.syncHooks[o],(s.store!==e||s.selector!==t||!Object.is(s.a1,n)||!Object.is(s.a2,r)||!Object.is(s.a3,i))&&(s.store!==e&&(a.didChangeStore=!0),s.store=e,s.selector=t,s.a1=n,s.a2=r,s.a3=i,s.value=t(e.getSnapshot(),n,r,i))):(s={store:e,selector:t,a1:n,a2:r,a3:i,value:t(e.getSnapshot(),n,r,i)},a.syncHooks.push(s)),s.value}function XC(e,t,n,r,i){return(0,GC.useSyncExternalStoreWithSelector)(e.subscribe,e.getSnapshot,e.getSnapshot,e=>t(e,n,r,i))}var ZC=class{static create(e){return new this(e)}constructor(e){this.state=e,this.listeners=new Set,this.updateTick=0}subscribe=e=>(this.listeners.add(e),()=>{this.listeners.delete(e)});getSnapshot=()=>this.state;setState(e){if(this.state===e)return;this.state=e,this.updateTick+=1;let t=this.updateTick;for(let n of this.listeners){if(t!==this.updateTick)return;n(e)}}update(e){for(let t in e)if(!Object.is(this.state[t],e[t])){this.setState({...this.state,...e});return}}set(e,t){Object.is(this.state[e],t)||this.setState({...this.state,[e]:t})}notifyAll(){let e={...this.state};this.setState(e)}use(e,t,n,r){return qC(this,e,t,n,r)}},QC=class extends ZC{constructor(e,t={},n){super(e),this.context=t,this.selectors=n}useSyncedValue(e,t){q.useDebugValue(e);let n=this;Q(()=>{n.state[e]!==t&&n.set(e,t)},[n,e,t])}useSyncedValueWithCleanup(e,t){let n=this;Q(()=>(n.state[e]!==t&&n.set(e,t),()=>{n.set(e,void 0)}),[n,e,t])}useSyncedValues(e){let t=this;Q(()=>{t.update(e)},[t,...Object.values(e)])}useControlledProp(e,t){q.useDebugValue(e);let n=this,r=t!==void 0;Q(()=>{r&&!Object.is(n.state[e],t)&&n.setState({...n.state,[e]:t})},[n,e,t,r])}select(e,t,n,r){let i=this.selectors[e];return i(this.state,t,n,r)}useState(e,t,n,r){return q.useDebugValue(e),qC(this,this.selectors[e],t,n,r)}useContextCallback(e,t){q.useDebugValue(e);let n=Z(t??Av);this.context[e]=n}useStateSetter(e){let t=q.useRef(void 0);return t.current===void 0&&(t.current=t=>{this.set(e,t)}),t.current}observe(e,t){let n;n=typeof e==`function`?e:this.selectors[e];let r=n(this.state);return t(r,r,this),this.subscribe(e=>{let i=n(e);if(!Object.is(r,i)){let e=r;r=i,t(i,e,this)}})}},$C={open:e=>e.open,transitionStatus:e=>e.transitionStatus,domReferenceElement:e=>e.domReferenceElement,referenceElement:e=>e.positionReference??e.referenceElement,floatingElement:e=>e.floatingElement,floatingId:e=>e.floatingId},ew=class extends QC{constructor(e){let{syncOnly:t,nested:n,onOpenChange:r,triggerElements:i,...a}=e;super({...a,positionReference:a.referenceElement,domReferenceElement:a.referenceElement},{onOpenChange:r,dataRef:{current:{}},events:NS(),nested:n,triggerElements:i},$C),this.syncOnly=t}syncOpenEvent=(e,t)=>{(!e||!this.state.open||t!=null&&wy(t))&&(this.context.dataRef.current.openEvent=e?t:void 0)};dispatchOpenChange=(e,t)=>{this.syncOpenEvent(e,t.event);let n={open:e,reason:t.reason,nativeEvent:t.event,nested:this.context.nested,triggerElement:t.trigger};this.context.events.emit(`openchange`,n)};setOpen=(e,t)=>{this.syncOnly||this.dispatchOpenChange(e,t),this.context.onOpenChange?.(e,t)}};function tw(e,t,n=!1){return{open:!1,openProp:void 0,mounted:!1,transitionStatus:void 0,floatingRootContext:new ew({open:!1,transitionStatus:void 0,floatingElement:null,referenceElement:null,triggerElements:e,floatingId:t,syncOnly:!0,nested:n,onOpenChange:void 0}),floatingId:t,triggerCount:0,preventUnmountingOnClose:!1,payload:void 0,activeTriggerId:null,activeTriggerElement:null,openedWithoutTrigger:!1,triggerIdProp:void 0,popupElement:null,positionerElement:null,activeTriggerProps:Mv,inactiveTriggerProps:Mv,popupProps:Mv}}var nw=e=>e.triggerIdProp??e.activeTriggerId,rw=e=>e.openProp??e.open,iw=e=>(e.popupElement?.id??e.floatingId)||void 0;function aw(e,t){return t!==void 0&&rw(e)&&nw(e)===t}function ow(e,t){return aw(e,t)?!0:t!==void 0&&rw(e)&&nw(e)==null&&!e.openedWithoutTrigger&&e.triggerCount===1}var sw={open:rw,mounted:e=>e.mounted,transitionStatus:e=>rw(e)&&!e.mounted?`starting`:e.transitionStatus,floatingRootContext:e=>e.floatingRootContext,triggerCount:e=>e.triggerCount,preventUnmountingOnClose:e=>e.preventUnmountingOnClose,payload:e=>e.payload,activeTriggerId:nw,activeTriggerElement:e=>e.mounted?e.activeTriggerElement:null,popupId:iw,isTriggerActive:(e,t)=>t!==void 0&&nw(e)===t,isOpenedByTrigger:(e,t)=>aw(e,t),isMountedByTrigger:(e,t)=>t!==void 0&&nw(e)===t&&e.mounted,triggerProps:(e,t)=>t?e.activeTriggerProps:e.inactiveTriggerProps,triggerPopupId:(e,t)=>ow(e,t)?iw(e):void 0,popupProps:e=>e.popupProps,popupElement:e=>e.popupElement,positionerElement:e=>e.positionerElement};function cw(e){let t=q.useCallback(t=>e===void 0?Av:e.subscribeStore(t),[e]),n=q.useCallback(()=>e===void 0?void 0:e.store,[e]);return(0,WC.useSyncExternalStore)(t,n,()=>e?.serverStore)}function lw(e){let{open:t=!1,onOpenChange:n,elements:r={}}=e,i=xS(),a=LS()!=null,o=G_(()=>new ew({open:t,transitionStatus:void 0,onOpenChange:n,referenceElement:r.reference??null,floatingElement:r.floating??null,triggerElements:new zC,floatingId:i,syncOnly:!1,nested:a})).current;return Q(()=>{let e={open:t,floatingId:i};r.reference!==void 0&&(e.referenceElement=r.reference,e.domReferenceElement=C_(r.reference)?r.reference:null),r.floating!==void 0&&(e.floatingElement=r.floating),o.update(e)},[t,i,r.reference,r.floating,o]),o.context.onOpenChange=n,o.context.nested=a,o}var uw=my&&gy;function dw(e,t={}){let{enabled:n=!0,delay:r}=t,{events:i,dataRef:a}=e.context,o=q.useRef(!1),s=q.useRef(null),c=q.useRef(!0),l=iy();q.useEffect(()=>{let t=e.select(`domReferenceElement`);if(!n)return;let r=b_(t);function i(){let t=e.select(`domReferenceElement`);!e.select(`open`)&&w_(t)&&t===Ty(gv(t))&&(o.current=!0,s.current=t)}function a(){c.current=!0}function l(){c.current=!1}return Bb(zb(r,`blur`,i),uw&&zb(r,`keydown`,a,!0),uw&&zb(r,`pointerdown`,l,!0))},[e,n]),q.useEffect(()=>{if(!n)return;function t(t){if(t.reason===`trigger-press`||t.reason===`escape-key`){let t=e.select(`domReferenceElement`);C_(t)&&(s.current=t,o.current=!0)}}return i.on(`openchange`,t),()=>{i.off(`openchange`,t)}},[i,n,e]);let u=q.useMemo(()=>{function t(){o.current=!1,s.current=null}return{onMouseLeave(){t()},onFocus(n){let i=n.currentTarget;if(o.current){if(s.current===i)return;t()}let a=Oy(n.nativeEvent);if(C_(a)){if(uw&&!n.relatedTarget){if(!c.current&&!ib(a))return}else if(!sb(a))return}let u=tb(n.relatedTarget,e.context.triggerElements),{nativeEvent:d,currentTarget:f}=n;e.select(`open`)&&u||!r?e.setOpen(!0,mb(yb,d,f)):l.start(r,()=>{o.current||e.setOpen(!0,mb(yb,d,f))})},onBlur(n){t();let r=n.relatedTarget,i=n.nativeEvent,o=C_(r)&&r.hasAttribute(rS(`focus-guard`))&&r.getAttribute(`data-type`)===`outside`;l.start(0,()=>{let t=e.select(`domReferenceElement`),n=Ty(gv(t));(r||n!==t)&&(Ey(a.current.floatingContext?.refs.floating.current,n)||Ey(t,n)||o||tb(r??n,e.context.triggerElements)||e.setOpen(!1,mb(yb,i)))})}}},[a,r,e,l]);return q.useMemo(()=>n?{reference:u,trigger:u}:{},[n,u])}var fw=class e{pointerType=void 0;interactedInside=!1;handler=void 0;blockMouseMove=!0;performedPointerEventsMutation=!1;pointerEventsScopeElement=null;pointerEventsReferenceElement=null;pointerEventsFloatingElement=null;restTimeoutPending=!1;openChangeTimeout=new ry;restTimeout=new ry;handleCloseOptions=void 0;static create(){return new e}dispose=()=>{this.openChangeTimeout.clear(),this.restTimeout.clear()};disposeEffect=()=>this.dispose},pw=new WeakMap;function mw(e){if(!e.performedPointerEventsMutation)return;let t=e.pointerEventsScopeElement;t&&pw.get(t)===e&&(e.pointerEventsScopeElement?.style.removeProperty(`pointer-events`),e.pointerEventsReferenceElement?.style.removeProperty(`pointer-events`),e.pointerEventsFloatingElement?.style.removeProperty(`pointer-events`),pw.delete(t)),e.performedPointerEventsMutation=!1,e.pointerEventsScopeElement=null,e.pointerEventsReferenceElement=null,e.pointerEventsFloatingElement=null}function hw(e,t){let{scopeElement:n,referenceElement:r,floatingElement:i}=t,a=pw.get(n);a&&a!==e&&mw(a),mw(e),e.performedPointerEventsMutation=!0,e.pointerEventsScopeElement=n,e.pointerEventsReferenceElement=r,e.pointerEventsFloatingElement=i,pw.set(n,e),n.style.pointerEvents=`none`,r.style.pointerEvents=`auto`,i.style.pointerEvents=`auto`}function gw(e){let t=e.context.dataRef.current,n=G_(()=>t.hoverInteractionState??fw.create()).current;return t.hoverInteractionState||=n,ty(t.hoverInteractionState.disposeEffect),t.hoverInteractionState}function _w(e,t={}){let{enabled:n=!0,closeDelay:r=0,nodeId:i}=t,a=e.useState(`open`),o=e.useState(`floatingElement`),s=e.useState(`domReferenceElement`),{dataRef:c}=e.context,l=RS(),u=LS(),d=gw(e),f=iy(),p=Z(()=>fb(c.current.openEvent?.type,d.interactedInside)),m=Z(()=>pb(c.current.openEvent?.type)),h=Z(()=>{mw(d)});Q(()=>{a||(d.pointerType=void 0,d.restTimeoutPending=!1,d.interactedInside=!1,h())},[a,d,h]),q.useEffect(()=>h,[h]),Q(()=>{if(n&&a&&d.handleCloseOptions?.blockPointerEvents&&m()&&C_(s)&&o){let e=s,t=o,n=gv(o),r=l?.nodesRef.current.find(e=>e.id===u)?.context?.elements.floating;r&&(r.style.pointerEvents=``);let i=d.pointerEventsScopeElement===t?null:d.pointerEventsScopeElement,a=r===t?null:r,c=d.handleCloseOptions?.getScope?.()??i??a??Dy(e,`[data-rootownerid]`)??n.body;return hw(d,{scopeElement:c,referenceElement:e,floatingElement:t}),()=>{h()}}},[n,a,s,o,d,m,l,u,h]),q.useEffect(()=>{if(!n)return;function t(){return!!(l&&u&&tS(l.nodesRef.current,u).length>0)}function a(t){let n=ub(r,`close`,d.pointerType),i=()=>{e.setOpen(!1,mb(vb,t)),l?.events.emit(`floating.closed`,t)};n?d.openChangeTimeout.start(n,i):(d.openChangeTimeout.clear(),i())}function s(e){let t=Oy(e);ab(t)?d.interactedInside=Dy(t,`[aria-haspopup]`)!=null:d.interactedInside=!1}function g(){d.openChangeTimeout.clear(),f.clear(),l?.events.off(`floating.closed`,v),h()}function _(n){if(t()&&l){l.events.on(`floating.closed`,v);return}if(tb(n.relatedTarget,e.context.triggerElements))return;let r=c.current.floatingContext?.nodeId??i,o=n.relatedTarget;l&&r&&C_(o)&&tS(l.nodesRef.current,r,!1).some(e=>Ey(e.context?.elements.floating,o))||(d.handler?d.handler(n):(h(),m()&&!p()&&a(n)))}function v(n){l&&u&&!t()&&f.start(0,()=>{l.events.off(`floating.closed`,v),e.setOpen(!1,mb(vb,n)),l.events.emit(`floating.closed`,n)})}let y=o;return Bb(y&&zb(y,`mouseenter`,g),y&&zb(y,`mouseleave`,_),y&&zb(y,`pointerdown`,s,!0),()=>{l?.events.off(`floating.closed`,v)})},[n,o,e,c,r,i,m,p,h,d,l,u,f])}var vw={current:null};function yw(e,t={}){let{enabled:n=!0,delay:r=0,handleClose:i=null,mouseOnly:a=!1,restMs:o=0,move:s=!0,triggerElementRef:c=vw,externalTree:l,isActiveTrigger:u=!0,getHandleCloseContext:d,isClosing:f,shouldOpen:p,guardStaleOpen:m=!1}=t,{dataRef:h,events:g}=e.context,_=RS(l),v=gw(e),y=q.useRef(!1),b=Vb(i),x=Vb(r),S=Vb(o),C=Vb(n),w=Vb(p),T=Vb(f),E=Z(()=>fb(h.current.openEvent?.type,v.interactedInside)),D=Z(()=>w.current?.()!==!1),O=Z((t,n,r)=>{let i=e.context.triggerElements;if(i.hasElement(n))return!t||!Ey(t,n);if(!C_(r))return!1;let a=r;return i.hasMatchingElement(e=>Ey(e,a))&&(!t||!Ey(t,a))}),k=Z(()=>{v.handler&&=(gv(e.select(`domReferenceElement`)).removeEventListener(`mousemove`,v.handler),void 0)}),A=Z(()=>{mw(v)});return u&&(v.handleCloseOptions=i?.__options),q.useEffect(()=>k,[k]),q.useEffect(()=>{if(!n)return;function e(e){e.open?y.current=!1:(y.current=e.reason===vb,k(),v.openChangeTimeout.clear(),v.restTimeout.clear(),v.blockMouseMove=!0,v.restTimeoutPending=!1)}return g.on(`openchange`,e),()=>{g.off(`openchange`,e)}},[n,g,v,k]),q.useEffect(()=>{if(!n)return;function t(t,n=!0){let r=ub(x.current,`close`,v.pointerType);r?v.openChangeTimeout.start(r,()=>{e.setOpen(!1,mb(vb,t)),_?.events.emit(`floating.closed`,t)}):n&&(v.openChangeTimeout.clear(),e.setOpen(!1,mb(vb,t)),_?.events.emit(`floating.closed`,t))}let r=c.current??(u?e.select(`domReferenceElement`):null);if(!C_(r))return;function i(t){if(v.openChangeTimeout.clear(),v.blockMouseMove=!1,a&&!Cy(v.pointerType))return;let n=db(S.current),r=ub(x.current,`open`,v.pointerType),i=Oy(t),o=t.currentTarget??null,s=e.select(`domReferenceElement`),c=o;if(C_(i)&&!e.context.triggerElements.hasElement(i)){for(let t of e.context.triggerElements.elements())if(Ey(t,i)){c=t;break}}C_(o)&&C_(s)&&!e.context.triggerElements.hasElement(o)&&Ey(o,s)&&(c=s);let l=c!=null&&O(s,c,i),u=e.select(`open`),d=T.current?.()??e.select(`transitionStatus`)===`ending`,f=!u&&d&&y.current,p=!l&&C_(c)&&C_(s)&&Ey(s,c)&&f,m=n>0&&!r,h=l&&(u||f)||p,g=!u||l;h?D()&&e.setOpen(!0,mb(vb,t,c)):m||(r?v.openChangeTimeout.start(r,()=>{g&&D()&&e.setOpen(!0,mb(vb,t,c))}):g&&D()&&e.setOpen(!0,mb(vb,t,c)))}function o(n){if(E()){A();return}k();let r=gv(e.select(`domReferenceElement`));v.restTimeout.clear(),v.restTimeoutPending=!1;let i=h.current.floatingContext??d?.();if(!tb(n.relatedTarget,e.context.triggerElements)){if(b.current&&i){e.select(`open`)||v.openChangeTimeout.clear();let a=c.current;v.handler=b.current({...i,tree:_,x:n.clientX,y:n.clientY,onClose(){A(),k(),C.current&&!E()&&a===e.select(`domReferenceElement`)&&t(n,!0)}}),r.addEventListener(`mousemove`,v.handler),v.handler(n)}else(v.pointerType!==`touch`||!Ey(e.select(`floatingElement`),n.relatedTarget))&&t(n)}}function l(e){Ey(r,e.relatedTarget)||(v.openChangeTimeout.clear(),v.restTimeout.clear(),v.restTimeoutPending=!1)}let f=m?zb(r,`mouseout`,l):void 0;return s?Bb(zb(r,`mousemove`,i,{once:!0}),zb(r,`mouseenter`,i),zb(r,`mouseleave`,o),f):Bb(zb(r,`mouseenter`,i),zb(r,`mouseleave`,o),f)},[k,A,h,x,e,n,b,v,u,O,E,a,s,S,c,_,C,d,T,D,m]),q.useMemo(()=>{if(!n)return;function t(e){v.pointerType=e.pointerType}return{onPointerDown:t,onPointerEnter:t,onMouseMove(t){let{nativeEvent:n}=t,r=t.currentTarget,i=e.select(`domReferenceElement`),o=e.select(`open`),s=O(i,r,t.target);if(a&&!Cy(v.pointerType))return;if(o&&s&&v.handleCloseOptions?.blockPointerEvents){let t=e.select(`floatingElement`);if(t){let e=v.handleCloseOptions?.getScope?.()??r.ownerDocument.body;hw(v,{scopeElement:e,referenceElement:r,floatingElement:t})}}let c=db(S.current);if(o&&!s||c===0||!s&&v.restTimeoutPending&&t.movementX**2+t.movementY**2<2)return;v.restTimeout.clear();function l(){if(v.restTimeoutPending=!1,E())return;let t=e.select(`open`);!v.blockMouseMove&&(!t||s)&&D()&&e.setOpen(!0,mb(vb,n,r))}v.pointerType===`touch`?DS.flushSync(()=>{l()}):s&&o?l():(v.restTimeoutPending=!0,v.restTimeout.start(c,l))}}},[n,v,E,O,a,e,S,D])}function bw(e){return gy&&e.movementX===0&&e.movementY===0}function xw(e,t,n){switch(e){case`vertical`:return t;case`horizontal`:return n;default:return t||n}}function Sw(e,t){return xw(t,e===`ArrowUp`||e===`ArrowDown`,e===`ArrowLeft`||e===`ArrowRight`)}function Cw(e,t,n){return xw(t,e===`ArrowDown`,n?e===`ArrowLeft`:e===`ArrowRight`)||e===`Enter`||e===` `||e===``}function ww(e,t,n){return xw(t,n?e===jy:e===My,e===Py)}function Tw(e,t,n,r){return t===`both`||t===`horizontal`&&r?e===`Escape`:xw(t,n?e===My:e===jy,e===Ny)}function Ew(e,t){let{listRef:n,activeIndex:r,onNavigate:i=()=>{},enabled:a=!0,selectedIndex:o=null,allowEscape:s=!1,loopFocus:c=!1,nested:l=!1,rtl:u=!1,virtual:d=!1,focusItemOnOpen:f=`auto`,focusItemOnHover:p=!0,openOnArrowKeyDown:m=!0,disabledIndices:h=void 0,orientation:g=`vertical`,triggerOrientation:_=g,parentOrientation:v,id:y,resetOnPointerLeave:b=!0,externalTree:x,nestedReturnFocusRef:S,grid:C}=t,w=C!=null,T=e.useState(`open`),E=e.useState(`floatingElement`),D=e.useState(`domReferenceElement`),O=e.context.dataRef,k=cb(E),A=ob(D),j=Vb(k),M=LS(),N=RS(x),P=q.useRef(f),F=q.useRef(o??-1),I=q.useRef(null),L=q.useRef(!0),R=Z(e=>{i(F.current===-1?null:F.current,e)}),ee=q.useRef(!!E),z=q.useRef(T),te=q.useRef(!1),B=q.useRef(!1),ne=q.useRef(null),V=Vb(h),H=Vb(T),re=Vb(o),ie=Vb(b),ae=Kb(),oe=Kb(),se=Z(()=>{ae.cancel();function e(e){d||(ne.current=aS(e,{sync:te.current,preventScroll:!0}))}let t=n.current[F.current],r=B.current;t&&e(t),(te.current?e=>e():e=>ae.request(e))(()=>{let i=n.current[F.current]||t;i&&(t||e(i),fe&&(r||!L.current)&&i.scrollIntoView?.({block:`nearest`,inline:`nearest`}))})});Q(()=>{O.current.orientation=g},[O,g]),Q(()=>{T||(I.current=null),(!T||f!==`auto`)&&(P.current=f)},[T,f]),Q(()=>{a&&(T&&E?(F.current=o??-1,P.current&&o!=null&&(B.current=!0,R())):ee.current&&(F.current=-1,R()))},[a,T,E,o,R]),Q(()=>{if(a){if(!T)te.current=!1;else if(E){if(r==null){if(te.current=!1,re.current!=null)return;if(ee.current&&(F.current=-1,se()),(!z.current||!ee.current)&&P.current&&(I.current!=null||P.current===!0&&I.current==null)){let e=0,t=()=>{n.current[0]==null?(e<2&&(e?e=>oe.request(e):queueMicrotask)(t),e+=1):(F.current=I.current==null||Cw(I.current,_,u)||l?Tx(n):Ex(n),I.current=null,R())};t()}}else wx(n.current,r)||(F.current=r,se(),B.current=!1)}}},[a,T,E,r,re,l,n,_,u,R,se,oe]),Q(()=>{if(!a||E||!N||d||!ee.current)return;let e=N.nodesRef.current,t=e.find(e=>e.id===M)?.context?.elements.floating,n=Ty(gv(D??t??null)),r=e.some(e=>e.context&&Ey(e.context.elements.floating,n));t&&!r&&L.current&&t.focus({preventScroll:!0})},[a,E,D,N,M,d]),Q(()=>{z.current=T,ee.current=!!E});let U=r!=null,ce=Z(e=>{if(!H.current)return;let t=n.current.indexOf(e.currentTarget);t!==-1&&(F.current!==t||r!==t)&&(F.current=t,R(e))}),le=Z(()=>v??N?.nodesRef.current.find(e=>e.id===M)?.context?.dataRef?.current.orientation),ue=Z(()=>Tx(n,V.current)),de=Z(t=>{if(L.current=!1,te.current=!0,t.which===229||!H.current&&t.currentTarget===j.current)return;if(l&&Tw(t.key,g,u,w)){Sw(t.key,le())||yy(t),e.setOpen(!1,mb(Tb,t.nativeEvent));let n=S?.current??D;w_(n)&&n.focus();return}r!=null&&r!==F.current&&!wx(n.current,r)&&(F.current=r);let i=F.current,a=Tx(n,h),o=Ex(n,h);if(A||(t.key===`Home`&&(yy(t),F.current=a,R(t)),t.key===`End`&&(yy(t),F.current=o,R(t))),C!=null){let e=C(t,F.current,n,g,c,u,h,a,o);if(e!=null&&e!==F.current&&(F.current=e,R(t)),g===`both`)return}if(Sw(t.key,g)){yy(t);let e=Ty(t.currentTarget.ownerDocument);if(T&&!d&&Ey(t.currentTarget,e)&&!n.current.some(t=>t!=null&&Ey(t,e))){F.current=Cw(t.key,g,u)?a:o,R(t),r===F.current&&se();return}let{index:l,wrapped:f}=Dx(n.current,i,{decrement:!Cw(t.key,g,u),loopFocus:c,allowEscape:s,disabledIndices:h,minIndex:a,maxIndex:o});f&&(te.current=!1),F.current=l,R(t)}}),fe=q.useMemo(()=>({onFocus(e){te.current=!0,ce(e)},onClick({currentTarget:e}){d||e.focus({preventScroll:!0})},onMouseMove(e){bw(e)||(te.current=!0,B.current=!1,p&&ce(e))},onPointerLeave(e){if(!H.current||!L.current||e.pointerType===`touch`)return;te.current=!0;let t=e.relatedTarget;if(p&&!n.current.includes(t)&&ie.current&&(ne.current?.(),ne.current=null,F.current=-1,R(e),!d)){let e=j.current,t=Ty(gv(e));e&&Ey(e,t)&&e.focus({preventScroll:!0})}}}),[ce,H,j,p,n,R,ie,d]),pe=q.useMemo(()=>d&&T&&U&&{"aria-activedescendant":`${y}-${r}`},[d,T,U,y,r]),me=q.useMemo(()=>({...A?{}:pe,onKeyDown(t){if(t.key===`Tab`&&t.shiftKey&&T&&!d){let n=Oy(t.nativeEvent);if(n&&!Ey(j.current,n))return;yy(t);let r=mb(Cb,t.nativeEvent);e.setOpen(!1,r);let i=S?.current??D;!r.isCanceled&&w_(i)&&i.focus()}else de(t)},onPointerMove(e){bw(e)||(L.current=!0)}}),[pe,de,j,A,e,T,d,D,S]),he=q.useMemo(()=>{function t(t){e.setOpen(!0,mb(Tb,t.nativeEvent,t.currentTarget))}function n(e){f===`auto`&&xy(e.nativeEvent)&&(P.current=!d)}function r(e){P.current=f,f===`auto`&&Sy(e.nativeEvent)&&(P.current=!0)}return{onKeyDown(n){let r=e.select(`open`);L.current=!1;let i=n.key.startsWith(`Arrow`),a=ww(n.key,le(),u),o=Sw(n.key,r?g:_),s=(l?a:o)||n.key===`Enter`||n.key.trim()===``;if(d&&r&&(!l||ib(n.currentTarget)))return de(n);if(r||m||!i){if(s){let e=Sw(n.key,le());I.current=l&&e?null:n.key}l?a&&(yy(n),r?(F.current=ue(),R(n),d&&j.current?.focus()):t(n)):o&&(re.current!=null&&(F.current=re.current),yy(n),!r&&m?t(n):de(n),r&&R(n))}},onFocus(t){t.target===t.currentTarget&&e.select(`open`)&&!d&&(F.current=-1,R(t))},onPointerDown:r,onPointerEnter:r,onMouseDown:n,onClick:n}},[de,f,ue,l,R,e,m,g,_,le,u,re,d,j]),ge=q.useMemo(()=>({...pe,...he}),[pe,he]);return q.useMemo(()=>a?{reference:ge,floating:me,item:fe,trigger:he}:{},[a,ge,me,he,fe])}function Dw(e,t){let{listRef:n,elementsRef:r,activeIndex:i,onMatch:a,disabledIndices:o,onTyping:s,enabled:c=!0,resetMs:l=750,selectedIndex:u=null}=t,d=Z(s),f=e.useState(`open`),p=iy(),m=q.useRef(``),h=q.useRef(u??i??-1),g=q.useRef(null),_=Z(e=>{function t(e){return r?.current[e]}function s(e){let n=t(e);return n&&!jx(n)||n?.matches(`:disabled`)?!1:o==null||!kx(jv,e,o)}function c(e,t,n=0){if(e.length===0)return-1;let r=(n%e.length+e.length)%e.length,i=t.toLowerCase();for(let t=0;t<e.length;t+=1){let n=(r+t)%e.length;if(e[n]?.toLowerCase().startsWith(i)&&s(n))return n}return-1}let _=n.current;if(m.current.length>0&&e.key===` `&&(yy(e),d?.(!0)),m.current.length>0&&m.current[0]!==` `&&c(_,m.current)===-1&&e.key!==` `&&d?.(!1),_==null||e.key.length!==1||e.ctrlKey||e.metaKey||e.altKey)return;f&&e.key!==` `&&(yy(e),d?.(!0));let v=m.current===``;v&&(h.current=u??i??-1),_.every((e,t)=>e&&s(t)?e[0]?.toLowerCase()!==e[1]?.toLowerCase():!0)&&m.current===e.key&&(m.current=``,h.current=g.current),m.current+=e.key,p.start(l,()=>{m.current=``,h.current=g.current,d?.(!1)});let y=((v?u??i??-1:h.current)??0)+1,b=c(_,m.current,y);b===-1?e.key!==` `&&(m.current=``,d?.(!1)):(a?.(b,e),g.current=b)}),v=Z(t=>{let n=t.relatedTarget,r=e.select(`domReferenceElement`),i=e.select(`floatingElement`);Ey(r,n)||Ey(i,n)||(p.clear(),m.current=``,h.current=g.current,d?.(!1))});Q(()=>{(f||u===null)&&(p.clear(),g.current=null,m.current!==``&&(m.current=``,d?.(!1)))},[f,u,p,d]);let y=q.useMemo(()=>({onKeyDown:_,onBlur:v}),[_,v]);return q.useMemo(()=>c?{reference:y,floating:y}:{},[c,y])}var Ow=.1,kw=Ow*Ow,Aw=.5;function jw(e,t,n,r,i,a){return r>=t!=a>=t&&e<=(i-n)*(t-r)/(a-r)+n}function Mw(e,t,n,r,i,a,o,s,c,l){let u=!1;return jw(e,t,n,r,i,a)&&(u=!u),jw(e,t,i,a,o,s)&&(u=!u),jw(e,t,o,s,c,l)&&(u=!u),jw(e,t,c,l,n,r)&&(u=!u),u}function Nw(e,t,n){return e>=n.x&&e<=n.x+n.width&&t>=n.y&&t<=n.y+n.height}function Pw(e,t,n,r,i,a){return e>=Math.min(n,i)&&e<=Math.max(n,i)&&t>=Math.min(r,a)&&t<=Math.max(r,a)}function Fw(e={}){let{blockPointerEvents:t=!1}=e,n=new ry,r=({x:e,y:t,placement:r,elements:i,onClose:a,nodeId:o,tree:s})=>{let c=r?.split(`-`)[0],l=!1,u=null,d=null,f=typeof performance<`u`?performance.now():0;function p(e,t){let n=performance.now(),r=n-f;if(u===null||d===null||r===0)return u=e,d=t,f=n,!1;let i=e-u,a=t-d,o=i*i+a*a,s=r*r*kw;return u=e,d=t,f=n,o<s}function m(){n.clear(),a()}return function(r){n.clear();let a=i.domReference,u=i.floating;if(!a||!u||c==null||e==null||t==null)return;let{clientX:d,clientY:f}=r,h=Oy(r),g=r.type===`mouseleave`,_=Ey(u,h),v=Ey(a,h);if(_&&(l=!0,!g))return;if(v&&(l=!1,!g)){l=!0;return}if(g&&C_(r.relatedTarget)&&Ey(u,r.relatedTarget))return;function y(){return!!(s&&tS(s.nodesRef.current,o).length>0)}function b(){y()||m()}if(y())return;let x=a.getBoundingClientRect(),S=u.getBoundingClientRect(),C=e>S.right-S.width/2,w=t>S.bottom-S.height/2,T=S.width>x.width,E=S.height>x.height,D=(T?x:S).left,O=(T?x:S).right,k=(E?x:S).top,A=(E?x:S).bottom;if(c===`top`&&t>=x.bottom-1||c===`bottom`&&t<=x.top+1||c===`left`&&e>=x.right-1||c===`right`&&e<=x.left+1){b();return}let j=!1;switch(c){case`top`:j=Pw(d,f,D,x.top+1,O,S.bottom-1);break;case`bottom`:j=Pw(d,f,D,S.top+1,O,x.bottom-1);break;case`left`:j=Pw(d,f,S.right-1,A,x.left+1,k);break;case`right`:j=Pw(d,f,x.right-1,A,S.left+1,k)}if(j)return;if(l&&!Nw(d,f,x)||!g&&p(d,f)){b();return}let M=!1;switch(c){case`top`:{let n=T?Aw/2:Aw*4,r=T||C?e+n:e-n,i=T?e-n:C?e+n:e-n,a=t+Aw+1,o=C||T?S.bottom-Aw:S.top,s=C?T?S.bottom-Aw:S.top:S.bottom-Aw;M=Mw(d,f,r,a,i,a,S.left,o,S.right,s);break}case`bottom`:{let n=T?Aw/2:Aw*4,r=T||C?e+n:e-n,i=T?e-n:C?e+n:e-n,a=t-Aw,o=C||T?S.top+Aw:S.bottom,s=C?T?S.top+Aw:S.bottom:S.top+Aw;M=Mw(d,f,r,a,i,a,S.left,o,S.right,s);break}case`left`:{let n=E?Aw/2:Aw*4,r=E||w?t+n:t-n,i=E?t-n:w?t+n:t-n,a=e+Aw+1,o=w||E?S.right-Aw:S.left,s=w?E?S.right-Aw:S.left:S.right-Aw;M=Mw(d,f,o,S.top,s,S.bottom,a,r,a,i);break}case`right`:{let n=E?Aw/2:Aw*4,r=E||w?t+n:t-n,i=E?t-n:w?t+n:t-n,a=e-Aw,o=w||E?S.left+Aw:S.right,s=w?E?S.left+Aw:S.right:S.left+Aw;M=Mw(d,f,a,r,a,i,o,S.top,s,S.bottom);break}}M?l||n.start(40,b):b()}};return r.__options={...e,blockPointerEvents:t},r}function Iw(e,t,n){let{reference:r,floating:i}=e,a=lx(t),o=ux(t),s=cx(o),c=ax(t),l=a===`y`,u=r.x+r.width/2-i.width/2,d=r.y+r.height/2-i.height/2,f=r[s]/2-i[s]/2,p;switch(c){case`top`:p={x:u,y:r.y-i.height};break;case`bottom`:p={x:u,y:r.y+r.height};break;case`right`:p={x:r.x+r.width,y:d};break;case`left`:p={x:r.x-i.width,y:d};break;default:p={x:r.x,y:r.y}}let m=ox(t);return m&&(p[o]+=f*(m===`end`?1:-1)*(n&&l?-1:1)),p}async function Lw(e,t){t===void 0&&(t={});let{x:n,y:r,platform:i,rects:a,elements:o,strategy:s}=e,{boundary:c=`clippingAncestors`,rootBoundary:l=`viewport`,elementContext:u=`floating`,altBoundary:d=!1,padding:f=0}=ix(t,e),p=Sx(f),m=o[d?u===`floating`?`reference`:`floating`:u],h=Cx(await i.getClippingRect({element:await(i.isElement==null?void 0:i.isElement(m))??!0?m:m.contextElement||await(i.getDocumentElement==null?void 0:i.getDocumentElement(o.floating)),boundary:c,rootBoundary:l,strategy:s})),g=u===`floating`?{x:n,y:r,width:a.floating.width,height:a.floating.height}:a.reference,_=await(i.getOffsetParent==null?void 0:i.getOffsetParent(o.floating)),v=await(i.isElement==null?void 0:i.isElement(_))&&await(i.getScale==null?void 0:i.getScale(_))||{x:1,y:1},y=Cx(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({elements:o,rect:g,offsetParent:_,strategy:s}):g);return{top:(h.top-y.top+p.top)/v.y,bottom:(y.bottom-h.bottom+p.bottom)/v.y,left:(h.left-y.left+p.left)/v.x,right:(y.right-h.right+p.right)/v.x}}var Rw=50,zw=async(e,t,n)=>{let{placement:r=`bottom`,strategy:i=`absolute`,middleware:a=[],platform:o}=n,s=o.detectOverflow?o:{...o,detectOverflow:Lw},c=await(o.isRTL==null?void 0:o.isRTL(t)),l=await o.getElementRects({reference:e,floating:t,strategy:i}),{x:u,y:d}=Iw(l,r,c),f=r,p=0,m={};for(let n=0;n<a.length;n++){let h=a[n];if(!h)continue;let{name:g,fn:_}=h,{x:v,y,data:b,reset:x}=await _({x:u,y:d,initialPlacement:r,placement:f,strategy:i,middlewareData:m,rects:l,platform:s,elements:{reference:e,floating:t}});u=v??u,d=y??d,m[g]={...m[g],...b},x&&p<Rw&&(p++,typeof x==`object`&&(x.placement&&(f=x.placement),x.rects&&(l=x.rects===!0?await o.getElementRects({reference:e,floating:t,strategy:i}):x.rects),{x:u,y:d}=Iw(l,f,c)),n=-1)}return{x:u,y:d,placement:f,strategy:i,middlewareData:m}},Bw=function(e){return e===void 0&&(e={}),{name:`flip`,options:e,async fn(t){var n;let{placement:r,middlewareData:i,rects:a,initialPlacement:o,platform:s,elements:c}=t,{mainAxis:l=!0,crossAxis:u=!0,fallbackPlacements:d,fallbackStrategy:f=`bestFit`,fallbackAxisSideDirection:p=`none`,flipAlignment:m=!0,...h}=ix(e,t);if((n=i.arrow)!=null&&n.alignmentOffset)return{};let g=ax(r),_=lx(o),v=ax(o)===o,y=await(s.isRTL==null?void 0:s.isRTL(c.floating)),b=d||(v||!m?[bx(o)]:fx(o)),x=p!==`none`;!d&&x&&b.push(...yx(o,m,p,y));let S=[o,...b],C=await s.detectOverflow(t,h),w=[],T=i.flip?.overflows||[];if(l&&w.push(C[g]),u){let e=dx(r,a,y);w.push(C[e[0]],C[e[1]])}if(T=[...T,{placement:r,overflows:w}],!w.every(e=>e<=0)){let e=(i.flip?.index||0)+1,t=S[e];if(t&&(u!==`alignment`||_===lx(t)||T.every(e=>lx(e.placement)!==_||e.overflows[0]>0)))return{data:{index:e,overflows:T},reset:{placement:t}};let n=T.filter(e=>e.overflows[0]<=0).sort((e,t)=>e.overflows[1]-t.overflows[1])[0]?.placement;if(!n)switch(f){case`bestFit`:{let e=T.filter(e=>{if(x){let t=lx(e.placement);return t===_||t===`y`}return!0}).map(e=>[e.placement,e.overflows.filter(e=>e>0).reduce((e,t)=>e+t,0)]).sort((e,t)=>e[1]-t[1])[0]?.[0];e&&(n=e);break}case`initialPlacement`:n=o}if(r!==n)return{reset:{placement:n}}}return{}}}},Vw=new Set([`left`,`top`]);async function Hw(e,t){let{placement:n,platform:r,elements:i}=e,a=await(r.isRTL==null?void 0:r.isRTL(i.floating)),o=ax(n),s=ox(n),c=lx(n)===`y`,l=Vw.has(o)?-1:1,u=a&&c?-1:1,d=ix(t,e),{mainAxis:f,crossAxis:p,alignmentAxis:m}=typeof d==`number`?{mainAxis:d,crossAxis:0,alignmentAxis:null}:{mainAxis:d.mainAxis||0,crossAxis:d.crossAxis||0,alignmentAxis:d.alignmentAxis};return s&&typeof m==`number`&&(p=s===`end`?m*-1:m),c?{x:p*u,y:f*l}:{x:f*l,y:p*u}}var Uw=function(e){return e===void 0&&(e=0),{name:`offset`,options:e,async fn(t){var n;let{x:r,y:i,placement:a,middlewareData:o}=t,s=await Hw(t,e);return a===o.offset?.placement&&(n=o.arrow)!=null&&n.alignmentOffset?{}:{x:r+s.x,y:i+s.y,data:{...s,placement:a}}}}},Ww=function(e){return e===void 0&&(e={}),{name:`shift`,options:e,async fn(t){let{x:n,y:r,placement:i,platform:a}=t,{mainAxis:o=!0,crossAxis:s=!1,limiter:c={fn:e=>{let{x:t,y:n}=e;return{x:t,y:n}}},...l}=ix(e,t),u={x:n,y:r},d=await a.detectOverflow(t,l),f=lx(i),p=sx(f),m=u[p],h=u[f],g=(e,t)=>rx(t+d[e===`y`?`top`:`left`],t,t-d[e===`y`?`bottom`:`right`]);o&&(m=g(p,m)),s&&(h=g(f,h));let _=c.fn({...t,[p]:m,[f]:h});return{..._,data:{x:_.x-n,y:_.y-r,enabled:{[p]:o,[f]:s}}}}}},Gw=function(e){return e===void 0&&(e={}),{options:e,fn(t){let{x:n,y:r,placement:i,rects:a,middlewareData:o}=t,{offset:s=0,mainAxis:c=!0,crossAxis:l=!0}=ix(e,t),u={x:n,y:r},d=lx(i),f=sx(d),p=u[f],m=u[d],h=ix(s,t),g=typeof h==`number`?{mainAxis:h,crossAxis:0}:{mainAxis:h.mainAxis??0,crossAxis:h.crossAxis??0};if(c){let e=f===`y`?`height`:`width`,t=a.reference[f]-a.floating[e]+g.mainAxis,n=a.reference[f]+a.reference[e]-g.mainAxis;p<t?p=t:p>n&&(p=n)}if(l){let e=f===`y`?`width`:`height`,t=Vw.has(ax(i)),n=a.reference[d]-a.floating[e]+(t&&o.offset?.[d]||0)+(t?0:g.crossAxis),r=a.reference[d]+a.reference[e]+(t?0:o.offset?.[d]||0)-(t?g.crossAxis:0);m<n?m=n:m>r&&(m=r)}return{[f]:p,[d]:m}}}},Kw=function(e){return e===void 0&&(e={}),{name:`size`,options:e,async fn(t){let{placement:n,rects:r,platform:i,elements:a}=t,{apply:o=()=>{},...s}=ix(e,t),c=await i.detectOverflow(t,s),l=ax(n),u=ox(n),d=lx(n)===`y`,{width:f,height:p}=r.floating,m,h;l===`top`||l===`bottom`?(m=l,h=u===(await(i.isRTL==null?void 0:i.isRTL(a.floating))?`start`:`end`)?`left`:`right`):(h=l,m=u===`end`?`top`:`bottom`);let g=p-c.top-c.bottom,_=f-c.left-c.right,v=Zb(p-c[m],g),y=Zb(f-c[h],_),b=t.middlewareData.shift,x=!b,S=v,C=y;b!=null&&b.enabled.x&&(C=_),b!=null&&b.enabled.y&&(S=g),x&&!u&&(d?C=f-2*Qb(c.left,c.right):S=p-2*Qb(c.top,c.bottom)),await o({...t,availableWidth:C,availableHeight:S});let w=await i.getDimensions(a.floating);return f!==w.width||p!==w.height?{reset:{rects:!0}}:{}}}};function qw(e){let t=L_(e),n=parseFloat(t.width)||0,r=parseFloat(t.height)||0,i=w_(e),a=i?e.offsetWidth:n,o=i?e.offsetHeight:r,s=$b(n)!==a||$b(r)!==o;return s&&(n=a,r=o),{width:n,height:r,$:s}}function Jw(e){return C_(e)?e:e.contextElement}function Yw(e){let t=Jw(e);if(!w_(t))return tx(1);let n=t.getBoundingClientRect(),{width:r,height:i,$:a}=qw(t),o=(a?$b(n.width):n.width)/r,s=(a?$b(n.height):n.height)/i;return(!o||!Number.isFinite(o))&&(o=1),(!s||!Number.isFinite(s))&&(s=1),{x:o,y:s}}var Xw=tx(0);function Zw(e){let t=b_(e);return!F_()||!t.visualViewport?Xw:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function Qw(e,t,n){return t===void 0&&(t=!1),!!n&&t&&n===b_(e)}function $w(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);let i=e.getBoundingClientRect(),a=Jw(e),o=tx(1);t&&(r?C_(r)&&(o=Yw(r)):o=Yw(e));let s=Qw(a,n,r)?Zw(a):tx(0),c=(i.left+s.x)/o.x,l=(i.top+s.y)/o.y,u=i.width/o.x,d=i.height/o.y;if(a&&r){let e=b_(a),t=C_(r)?b_(r):r,n=e,i=H_(n);for(;i&&t!==n;){let e=Yw(i),t=i.getBoundingClientRect(),r=L_(i),a=t.left+(i.clientLeft+parseFloat(r.paddingLeft))*e.x,o=t.top+(i.clientTop+parseFloat(r.paddingTop))*e.y;c*=e.x,l*=e.y,u*=e.x,d*=e.y,c+=a,l+=o,n=b_(i),i=H_(n)}}return Cx({width:u,height:d,x:c,y:l})}function eT(e,t){let n=R_(e).scrollLeft;return t?t.left+n:$w(x_(e)).left+n}function tT(e,t){let n=e.getBoundingClientRect();return{x:n.left+t.scrollLeft-eT(e,n),y:n.top+t.scrollTop}}function nT(e){let{elements:t,rect:n,offsetParent:r,strategy:i}=e,a=i===`fixed`,o=x_(r),s=t?O_(t.floating):!1;if(r===o||s&&a)return n;let c={scrollLeft:0,scrollTop:0},l=tx(1),u=tx(0),d=w_(r);if((d||!a)&&((y_(r)!==`body`||E_(o))&&(c=R_(r)),d)){let e=$w(r);l=Yw(r),u.x=e.x+r.clientLeft,u.y=e.y+r.clientTop}let f=o&&!d&&!a?tT(o,c):tx(0);return{width:n.width*l.x,height:n.height*l.y,x:n.x*l.x-c.scrollLeft*l.x+u.x+f.x,y:n.y*l.y-c.scrollTop*l.y+u.y+f.y}}function rT(e){return e.getClientRects?Array.from(e.getClientRects()):[]}function iT(e){let t=R_(e),n=e.ownerDocument.body,r=Qb(e.scrollWidth,e.clientWidth,n.scrollWidth,n.clientWidth),i=Qb(e.scrollHeight,e.clientHeight,n.scrollHeight,n.clientHeight),a=-t.scrollLeft+eT(e),o=-t.scrollTop;return L_(n).direction===`rtl`&&(a+=Qb(e.clientWidth,n.clientWidth)-r),{width:r,height:i,x:a,y:o}}var aT=25;function oT(e,t,n){n===void 0&&(n=`viewport`);let r=n===`layoutViewport`,i=b_(e),a=x_(e),o=i.visualViewport,s=a.clientWidth,c=a.clientHeight,l=0,u=0;if(o){let e=!F_()||t===`fixed`;r?e||(l=-o.offsetLeft,u=-o.offsetTop):(s=o.width,c=o.height,e&&(l=o.offsetLeft,u=o.offsetTop))}if(eT(a)<=0){let e=a.ownerDocument,t=e.body,n=getComputedStyle(t),r=e.compatMode===`CSS1Compat`&&parseFloat(n.marginLeft)+parseFloat(n.marginRight)||0,i=Math.abs(a.clientWidth-t.clientWidth-r),o=getComputedStyle(a).scrollbarGutter===`stable both-edges`?i/2:i;o<=aT&&(s-=o)}return{width:s,height:c,x:l,y:u}}function sT(e,t){let n=$w(e,!0,t===`fixed`),r=n.top+e.clientTop,i=n.left+e.clientLeft,a=Yw(e);return{width:e.clientWidth*a.x,height:e.clientHeight*a.y,x:i*a.x,y:r*a.y}}function cT(e,t,n){let r;if(t===`viewport`||t===`layoutViewport`)r=oT(e,n,t);else if(t===`document`)r=iT(x_(e));else if(C_(t))r=sT(t,n);else{let n=Zw(e);r={x:t.x-n.x,y:t.y-n.y,width:t.width,height:t.height}}return Cx(r)}function lT(e,t){let n=t.get(e);if(n)return n;let r=V_(e,[],!1).filter(e=>C_(e)&&y_(e)!==`body`),i=null,a=L_(e).position===`fixed`,o=a?z_(e):e;for(;C_(o)&&!I_(o);){let e=L_(o),t=N_(o),n=i?i.position:a?`fixed`:``;!t&&(n===`fixed`||n===`absolute`&&e.position===`static`)?r=r.filter(e=>e!==o):i=e,o=z_(o)}return t.set(e,r),r}function uT(e){let{element:t,boundary:n,rootBoundary:r,strategy:i}=e,a=[...n===`clippingAncestors`?O_(t)?[]:lT(t,this._c):[].concat(n),r],o=cT(t,a[0],i),s=o.top,c=o.right,l=o.bottom,u=o.left;for(let e=1;e<a.length;e++){let n=cT(t,a[e],i);s=Qb(n.top,s),c=Zb(n.right,c),l=Zb(n.bottom,l),u=Qb(n.left,u)}return{width:c-u,height:l-s,x:u,y:s}}function dT(e){let{width:t,height:n}=qw(e);return{width:t,height:n}}function fT(e,t,n){let r=w_(t),i=x_(t),a=n===`fixed`,o=$w(e,!0,a,t),s={scrollLeft:0,scrollTop:0},c=tx(0);if((r||!a)&&((y_(t)!==`body`||E_(i))&&(s=R_(t)),r)){let e=$w(t,!0,a,t);c.x=e.x+t.clientLeft,c.y=e.y+t.clientTop}!r&&i&&(c.x=eT(i));let l=i&&!r&&!a?tT(i,s):tx(0);return{x:o.left+s.scrollLeft-c.x-l.x,y:o.top+s.scrollTop-c.y-l.y,width:o.width,height:o.height}}function pT(e){return L_(e).position===`static`}function mT(e,t){if(!w_(e)||L_(e).position===`fixed`)return null;if(t)return t(e);let n=e.offsetParent;return x_(e)===n&&(n=n.ownerDocument.body),n}function hT(e,t){let n=b_(e);if(O_(e))return n;if(!w_(e)){let t=z_(e);for(;t&&!I_(t);){if(C_(t)&&!pT(t))return t;t=z_(t)}return n}let r=mT(e,t);for(;r&&D_(r)&&pT(r);)r=mT(r,t);return r&&I_(r)&&pT(r)&&!N_(r)?n:r||P_(e)||n}var gT=async function(e){let t=this.getOffsetParent||hT,n=this.getDimensions,r=await n(e.floating);return{reference:fT(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function _T(e){return L_(e).direction===`rtl`}var vT={convertOffsetParentRelativeRectToViewportRelativeRect:nT,getDocumentElement:x_,getClippingRect:uT,getOffsetParent:hT,getElementRects:gT,getClientRects:rT,getDimensions:dT,getScale:Yw,isElement:C_,isRTL:_T};function yT(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function bT(e,t,n){let r=null,i,a=x_(e);function o(){var e;clearTimeout(i),(e=r)==null||e.disconnect(),r=null}function s(n,c){n===void 0&&(n=!1),c===void 0&&(c=1),o();let l=e.getBoundingClientRect(),{left:u,top:d,width:f,height:p}=l;if(n||t(),!f||!p)return;let m=ex(d),h=ex(a.clientWidth-(u+f)),g=ex(a.clientHeight-(d+p)),_=ex(u),v={rootMargin:-m+`px `+-h+`px `+-g+`px `+-_+`px`,threshold:Qb(0,Zb(1,c))||1},y=!0;function b(t){let n=t[0].intersectionRatio;if(!yT(l,e.getBoundingClientRect()))return s();if(n!==c){if(!y)return s();n?s(!1,n):i=setTimeout(()=>{s(!1,1e-7)},1e3)}y=!1}try{r=new IntersectionObserver(b,{...v,root:a.ownerDocument})}catch{r=new IntersectionObserver(b,v)}r.observe(e)}let c=b_(e),l=()=>s(n);return c.addEventListener(`resize`,l),s(!0),()=>{c.removeEventListener(`resize`,l),o()}}function xT(e,t,n,r){r===void 0&&(r={});let{ancestorScroll:i=!0,ancestorResize:a=!0,elementResize:o=typeof ResizeObserver==`function`,layoutShift:s=typeof IntersectionObserver==`function`,animationFrame:c=!1}=r,l=Jw(e),u=i||a?[...l?V_(l):[],...t?V_(t):[]]:[];u.forEach(e=>{i&&e.addEventListener(`scroll`,n),a&&e.addEventListener(`resize`,n)});let d=l&&s?bT(l,n,a):null,f=-1,p=null;o&&(p=new ResizeObserver(e=>{let[r]=e;r&&r.target===l&&p&&t&&(p.unobserve(t),cancelAnimationFrame(f),f=requestAnimationFrame(()=>{var e;(e=p)==null||e.observe(t)})),n()}),l&&!c&&p.observe(l),t&&p.observe(t));let m,h=c?$w(e):null;c&&g();function g(){let t=$w(e);h&&!yT(h,t)&&n(),h=t,m=requestAnimationFrame(g)}return n(),()=>{var e;u.forEach(e=>{i&&e.removeEventListener(`scroll`,n),a&&e.removeEventListener(`resize`,n)}),d?.(),(e=p)==null||e.disconnect(),p=null,c&&cancelAnimationFrame(m)}}var ST=Uw,CT=Ww,wT=Bw,TT=Kw,ET=Gw,DT=(e,t,n)=>{let r=new Map,i=n??{},a={...vT,...i.platform,_c:r};return zw(e,t,{...i,platform:a})},OT=typeof document<`u`?q.useLayoutEffect:function(){};function kT(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(typeof e==`function`&&e.toString()===t.toString())return!0;let n,r,i;if(e&&t&&typeof e==`object`){if(Array.isArray(e)){if(n=e.length,n!==t.length)return!1;for(r=n;r--!==0;)if(!kT(e[r],t[r]))return!1;return!0}if(i=Object.keys(e),n=i.length,n!==Object.keys(t).length)return!1;for(r=n;r--!==0;)if(!{}.hasOwnProperty.call(t,i[r]))return!1;for(r=n;r--!==0;){let n=i[r];if(!(n===`_owner`&&e.$$typeof)&&!kT(e[n],t[n]))return!1}return!0}return e!==e&&t!==t}function AT(e){return typeof window>`u`?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function jT(e,t){let n=AT(e);return Math.round(t*n)/n}function MT(e){let t=q.useRef(e);return OT(()=>{t.current=e}),t}function NT(e){e===void 0&&(e={});let{placement:t=`bottom`,strategy:n=`absolute`,middleware:r=[],platform:i,elements:{reference:a,floating:o}={},transform:s=!0,whileElementsMounted:c,open:l}=e,[u,d]=q.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[f,p]=q.useState(r);kT(f,r)||p(r);let[m,h]=q.useState(null),[g,_]=q.useState(null),v=q.useCallback(e=>{e!==S.current&&(S.current=e,h(e))},[]),y=q.useCallback(e=>{e!==C.current&&(C.current=e,_(e))},[]),b=a||m,x=o||g,S=q.useRef(null),C=q.useRef(null),w=q.useRef(u),T=c!=null,E=MT(c),D=MT(i),O=MT(l),k=q.useCallback(()=>{if(!S.current||!C.current)return;let e={placement:t,strategy:n,middleware:f};D.current&&(e.platform=D.current),DT(S.current,C.current,e).then(e=>{let t={...e,isPositioned:O.current!==!1};A.current&&!kT(w.current,t)&&(w.current=t,DS.flushSync(()=>{d(t)}))})},[f,t,n,D,O]);OT(()=>{l===!1&&w.current.isPositioned&&(w.current.isPositioned=!1,d(e=>({...e,isPositioned:!1})))},[l]);let A=q.useRef(!1);OT(()=>(A.current=!0,()=>{A.current=!1}),[]),OT(()=>{if(b&&(S.current=b),x&&(C.current=x),b&&x){if(E.current)return E.current(b,x,k);k()}},[b,x,k,E,T]);let j=q.useMemo(()=>({reference:S,floating:C,setReference:v,setFloating:y}),[v,y]),M=q.useMemo(()=>({reference:b,floating:x}),[b,x]),N=q.useMemo(()=>{let e={position:n,left:0,top:0};if(!M.floating)return e;let t=jT(M.floating,u.x),r=jT(M.floating,u.y);return s?{...e,transform:`translate(`+t+`px, `+r+`px)`,...AT(M.floating)>=1.5&&{willChange:`transform`}}:{position:n,left:t,top:r}},[n,s,M.floating,u.x,u.y]);return q.useMemo(()=>({...u,update:k,refs:j,elements:M,floatingStyles:N}),[u,k,j,M,N])}var PT=(e,t)=>{let n=ST(e);return{name:n.name,fn:n.fn,options:[e,t]}},FT=(e,t)=>{let n=CT(e);return{name:n.name,fn:n.fn,options:[e,t]}},IT=(e,t)=>({fn:ET(e).fn,options:[e,t]}),LT=(e,t)=>{let n=wT(e);return{name:n.name,fn:n.fn,options:[e,t]}},RT=(e,t)=>{let n=TT(e);return{name:n.name,fn:n.fn,options:[e,t]}},zT=q.createContext(void 0);function BT(e){let t=q.useContext(zT);if(t===void 0&&!e)throw Error(fv(50));return t}var VT=class extends QC{setState(e){}update(e){}set(e,t){}notifyAll(){}},HT={...sw,instantType:e=>e.instantType,adaptiveOrigin:e=>e.adaptiveOrigin,closeDelay:e=>e.closeDelay},UT=class extends QC{constructor(e,t,n){let r=new zC;super(GT(e,r,t,n),KT(r),HT)}setOpen=(e,t)=>{let{inlineRectCoordsRef:n}=this.context;NC(this,e,t,{onBeforeDispatch(){let r=t.event;e&&t.reason===`trigger-hover`&&t.trigger&&`clientX`in r&&`clientY`in r&&n.current?.element!==t.trigger&&mC(n,t.trigger,r.clientX,r.clientY)}})}};function WT(){let e=new zC;return new VT(Object.freeze(GT(void 0,e)),Object.freeze(KT(e)),HT)}function GT(e,t,n,r=!1){return{...tw(t,n,r),instantType:void 0,adaptiveOrigin:void 0,closeDelay:300,...e}}function KT(e){return{popupRef:q.createRef(),onOpenChange:void 0,onOpenChangeComplete:void 0,triggerElements:e,inlineRectCoordsRef:{current:void 0}}}function qT(e){let{open:t,defaultOpen:n=!1,onOpenChange:r,onOpenChangeComplete:i,actionsRef:a,handle:o,triggerId:s,defaultTriggerId:c=null,children:l}=e,u=DC((e,r)=>new UT({open:n,openProp:t,activeTriggerId:c,triggerIdProp:s},e,r));u.useControlledProp(`openProp`,t),u.useControlledProp(`triggerIdProp`,s),u.useContextCallback(`onOpenChange`,r),u.useContextCallback(`onOpenChangeComplete`,i);let d=u.useState(`open`),f=u.useState(`activeTriggerId`),p=u.useState(`mounted`),m=u.useState(`payload`);FC(u,{closeOnActiveTriggerUnmount:!0});let{forceUnmount:h}=IC(d,u,()=>{u.context.inlineRectCoordsRef.current=void 0});Q(()=>{d&&(f??u.set(`payload`,void 0))},[u,f,d]),q.useImperativeHandle(a,()=>({unmount:h,close:()=>u.setOpen(!1,mb(Nb))}),[h,u]);let g=d||p||o!=null;return(0,J.jsxs)(zT.Provider,{value:u,children:[o&&(0,J.jsx)(OC,{handle:o,store:u}),g&&(0,J.jsx)(JT,{store:u}),typeof l==`function`?l({payload:m}):l]})}function JT({store:e}){let t=iC(e.useState(`floatingRootContext`));return LC(e,{activeTriggerProps:t.reference,inactiveTriggerProps:t.trigger,popupProps:t.floating}),null}var YT=Qv(function(e){return BT(!0)?(0,J.jsx)(qT,{...e}):(0,J.jsx)(VS,{children:(0,J.jsx)(qT,{...e})})}),XT=q.createContext(void 0);function ZT(){let e=q.useContext(XT);if(e===void 0)throw Error(fv(48));return e}var QT=q.forwardRef(function(e,t){let{children:n,container:r,className:i,render:a,style:o,...s}=e,{node:c,subtree:l}=jS({container:r,ref:t,componentProps:e,elementProps:s});return!l&&!c?null:(0,J.jsxs)(q.Fragment,{children:[l,c&&DS.createPortal(n,c)]})}),$T=q.forwardRef(function(e,t){let{keepMounted:n=!1,...r}=e;return BT().useState(`mounted`)||n?(0,J.jsx)(XT.Provider,{value:n,children:(0,J.jsx)(QT,{ref:t,...r})}):null});function eE(e){return xS(e,`base-ui`)}var tE=$v(function(e,t){let{render:n,className:r,delay:i,closeDelay:a,id:o,payload:s,handle:c,style:l,...u}=e,d=BT(!0),f=cw(c)??d;if(!f)throw Error(fv(89));let p=eE(o),m=f.useState(`isTriggerActive`,p),h=f.useState(`isOpenedByTrigger`,p),g=f.useState(`floatingRootContext`),_=f.context.inlineRectCoordsRef,v=q.useRef(null),y=i??600,b=a??300,{registerTrigger:x,isMountedByThisTrigger:S}=PC(p,v,f,{payload:s,closeDelay:b}),C=yw(g,{mouseOnly:!0,move:!1,handleClose:Fw(),delay:()=>({open:y,close:b}),triggerElementRef:v,isActiveTrigger:m,isClosing:()=>f.select(`transitionStatus`)===`ending`}),w=dw(g,{delay:y}),T={open:h},E=f.useState(`triggerProps`,S),D=pC(_,h);return Iv(`a`,e,{state:T,ref:[t,x,v],props:[C,w.reference,E,D,{id:p},u],stateAttributesMapping:Xy})}),nE=q.createContext(void 0);function rE(){let e=q.useContext(nE);if(e===void 0)throw Error(fv(49));return e}function iE(e){let{nodeId:t,externalTree:n,rootContext:r}=e,i=r.useState(`referenceElement`),a=r.useState(`floatingElement`),o=r.useState(`domReferenceElement`),s=r.useState(`open`),c=r.useState(`floatingId`),[l,u]=q.useState(null),d=q.useRef(null),f=RS(n),p=q.useMemo(()=>({reference:i,floating:a,domReference:o}),[i,a,o]),m=NT({...e,elements:{...p,...l&&{reference:l}}}),h=q.useCallback(e=>{let t=C_(e)?{getBoundingClientRect:()=>e.getBoundingClientRect(),getClientRects:()=>e.getClientRects(),contextElement:e}:e;u(t),m.refs.setReference(t)},[m.refs]),g=q.useMemo(()=>({...m.refs,setPositionReference:h,domReference:d}),[m.refs,h]),_=q.useMemo(()=>({...m.elements,domReference:o}),[m.elements,o]),v=q.useMemo(()=>({...m,dataRef:r.context.dataRef,open:s,onOpenChange:r.setOpen,events:r.context.events,floatingId:c,refs:g,elements:_,nodeId:t,rootStore:r}),[m,g,_,t,r,s,c]);return Q(()=>{o&&(d.current=o)},[o]),Q(()=>{r.context.dataRef.current.floatingContext=v;let e=f?.nodesRef.current.find(e=>e.id===t);e&&(e.context=v)}),q.useMemo(()=>({...m,context:v,refs:g,elements:_,rootStore:r}),[m,g,_,v,r])}var aE=q.createContext(void 0);function oE(){return q.useContext(aE)?.direction??`ltr`}var sE=e=>({name:`arrow`,options:e,async fn(t){let{x:n,y:r,placement:i,rects:a,platform:o,elements:s,middlewareData:c}=t,{element:l,padding:u=0}=ix(e,t)||{};if(l==null)return{};let d=Sx(u),f={x:n,y:r},p=ux(i),m=cx(p),h=await o.getDimensions(l),g=p===`y`,_=g?`top`:`left`,v=g?`bottom`:`right`,y=g?`clientHeight`:`clientWidth`,b=a.reference[m]+a.reference[p]-f[p]-a.floating[m],x=f[p]-a.reference[p],S=s.floating[y]||a.floating[m],C=b/2-x/2,w=S/2-h[m]/2-1,T=Math.min(d[_],w),E=Math.min(d[v],w),D=T,O=S-h[m]-E,k=S/2-h[m]/2+C,A=rx(D,k,O),j=!c.arrow&&ox(i)!=null&&k!==A&&a.reference[m]/2-(k<D?T:E)-h[m]/2<0,M=j?k<D?k-D:k-O:0;return{[p]:f[p]+M,data:{[p]:A,centerOffset:k-A-M,...j&&{alignmentOffset:M}},reset:j}}}),cE=(e,t)=>{let{name:n,fn:r}=sE(e);return{name:n,fn:r,options:[e,t]}},lE={name:`hide`,async fn(e){let{width:t,height:n,x:r,y:i}=e.rects.reference,a=t===0&&n===0&&r===0&&i===0,o=await e.platform.detectOverflow(e,{elementContext:`reference`});return{data:{referenceHidden:o.top-n>=0||o.right-t>=0||o.bottom-n>=0||o.left-t>=0||a}}}},uE={sideX:`left`,sideY:`top`},dE=`--available-width`,fE=`--available-height`,pE=`--anchor-width`,mE=`--anchor-height`,hE=`--transform-origin`,gE=dE,_E=fE;function vE(e,t,n){let r=e===`inline-start`||e===`inline-end`;return{top:`top`,right:r?n?`inline-start`:`inline-end`:`right`,bottom:`bottom`,left:r?n?`inline-end`:`inline-start`:`left`}[t]}function yE(e,t,n){let{rects:r,placement:i}=e;return{side:vE(t,ax(i),n),align:ox(i)||`center`,anchor:{width:r.reference.width,height:r.reference.height},positioner:{width:r.floating.width,height:r.floating.height}}}function bE(e){return xE(e,iE)}function xE(e,t){let{anchor:n,positionMethod:r=`absolute`,side:i=`bottom`,sideOffset:a=0,align:o=`center`,alignOffset:s=0,collisionBoundary:c,collisionPadding:l=5,sticky:u=!1,arrowPadding:d=5,disableAnchorTracking:f=!1,inline:p,keepMounted:m=!1,floatingRootContext:h,mounted:g,collisionAvoidance:_,shift:v,nodeId:y,adaptiveOrigin:b,lazyFlip:x=!1,externalTree:S}=e,C=_.side||`flip`,w=_.align||`flip`,T=_.fallbackAxisSide||`end`,E=v?.crossAxis??!1,D=v?.rootBoundary,O=typeof n==`function`?n:void 0,k=Z(O),A=O?k:n,j=Vb(n),M=Vb(g),N=oE()===`rtl`,[P,F]=q.useState(null);!g&&P!==null&&F(null);let I=x===`placement`,L=P?ax(P):null,R=P&&I?ox(P)||`center`:null,ee=L||{top:`top`,right:`right`,bottom:`bottom`,left:`left`,"inline-end":N?`left`:`right`,"inline-start":N?`right`:`left`}[i],z=R||o,te=z===`center`?ee:`${ee}-${z}`,B=l;typeof B==`number`?B={top:B,right:B,bottom:B,left:B}:B&&={top:B.top||0,right:B.right||0,bottom:B.bottom||0,left:B.left||0};let ne=+(i===`bottom`),V=+(i===`top`),H=+(i===`right`),re=+(i===`left`),ie={boundary:c===`clipping-ancestors`?`clippingAncestors`:c,padding:B},ae=q.useRef(null),oe=Vb(a),se=Vb(s),U=typeof a==`function`?0:a,ce=typeof s==`function`?0:s,le=[];p&&le.push(p),le.push(PT(e=>{let t=yE(e,i,N),n=typeof oe.current==`function`?oe.current(t):oe.current,r=typeof se.current==`function`?se.current(t):se.current;return{mainAxis:n,crossAxis:r,alignmentAxis:r}},[U,ce,N,i]));let ue=w===`none`&&C!==`shift`,de=!ue&&(u||E||C===`shift`),fe=C===`none`?null:LT({...ie,padding:{top:B.top+1+ne,right:B.right+1+re,bottom:B.bottom+1+V,left:B.left+1+H},mainAxis:!E&&C===`flip`,crossAxis:w===`flip`&&`alignment`,fallbackAxisSideDirection:T}),pe=ue?null:FT({...ie,rootBoundary:D,mainAxis:w!==`none`,crossAxis:de,limiter:u||E?void 0:IT(e=>{if(!ae.current)return{};let{width:t,height:n}=ae.current.getBoundingClientRect(),r=lx(ax(e.placement)),i=r===`y`?t:n,a=r===`y`?B.left+B.right:B.top+B.bottom;return{offset:i/2+a/2}})},[ie,u,E,D,B,w]);C===`shift`||w===`shift`||z===`center`?le.push(pe,fe):le.push(fe,pe),le.push(RT({...ie,apply({elements:{floating:e},availableWidth:t,availableHeight:n,rects:r}){if(!M.current)return;let i=e.style;i.setProperty(gE,`${t}px`),i.setProperty(_E,`${n}px`);let a=b_(e).devicePixelRatio||1,{x:o,y:s,width:c,height:l}=r.reference,u=(Math.round((o+c)*a)-Math.round(o*a))/a,d=(Math.round((s+l)*a)-Math.round(s*a))/a;i.setProperty(pE,`${u}px`),i.setProperty(mE,`${d}px`)}}),cE(e=>({element:ae.current||gv(e.elements.floating).createElement(`div`),padding:ae.current?d:0}),[d]),{name:`transformOrigin`,fn(e){let{elements:{floating:t},middlewareData:n,placement:r,platform:o,rects:s,y:c}=e,l=ax(r),u=ox(r),d=lx(l)===`y`,f=ae.current,p=typeof a==`function`?a(yE(e,i,N)):a,m;m=!f&&u&&Math.abs(d?n.shift?.x||0:n.shift?.y||0)<=1?u===`start`===(d&&o.isRTL?.(t)===!0)?`100%`:`0%`:`${(d?n.arrow?.x||0:n.arrow?.y||0)+(d?f?.clientWidth||0:f?.clientHeight||0)/2}px`;let h=l===`top`||l===`left`?`calc(100% + ${p}px)`:`${-p}px`;return de&&d&&Math.abs(n.shift?.y||0)>p&&(h=`${s.reference.y+s.reference.height/2-c}px`),t.style.setProperty(hE,d?`${m} ${h}`:`${h} ${m}`),{}}},lE,b),Q(()=>{!g&&h&&h.update({referenceElement:null,floatingElement:null,domReferenceElement:null,positionReference:null})},[g,h]);let me=q.useMemo(()=>({ancestorScroll:!f,elementResize:!f&&typeof ResizeObserver<`u`,layoutShift:!f&&typeof IntersectionObserver<`u`}),[f]),{refs:he,elements:ge,x:_e,y:ve,middlewareData:ye,update:be,placement:xe,context:Se,isPositioned:Ce,floatingStyles:we}=t({rootContext:h,open:m?g:void 0,placement:te,middleware:le,strategy:r,whileElementsMounted:m?void 0:(...e)=>xT(...e,me),nodeId:y,externalTree:S}),{sideX:Te,sideY:Ee}=ye.adaptiveOrigin||uE,De=Ce?r:`fixed`,Oe=q.useMemo(()=>{let e;return e=Ce?b?{position:De,[Te]:_e,[Ee]:ve}:{...we,position:De}:{position:De,top:0,left:0},e[gE]=`100vw`,e[_E]=`100vh`,Ce||(e.opacity=0),e},[b,De,Te,_e,Ee,ve,we,Ce]),ke=q.useRef(null);Q(()=>{if(!g)return;let e=j.current,t=typeof e==`function`?e():e,n=(SE(t)?t.current:t)||null;n!==ke.current&&(he.setPositionReference(n),ke.current=n)},[g,he,A,j]),q.useEffect(()=>{if(!g)return;let e=j.current;typeof e!=`function`&&SE(e)&&e.current!==ke.current&&(he.setPositionReference(e.current),ke.current=e.current)},[g,he,A,j]),q.useEffect(()=>{if(m&&g&&ge.reference&&ge.floating)return xT(ge.reference,ge.floating,be,me)},[m,g,ge,be,me]);let Ae=ax(xe),je=vE(i,Ae,N),Me=ox(xe)||`center`,Ne=!!ye.hide?.referenceHidden;Q(()=>{x&&g&&Ce&&(Ae!==ee||I&&Me!==z)&&F(xe)},[x,I,g,Ce,xe,Ae,Me,ee,z]);let Pe=q.useMemo(()=>({position:`absolute`,top:ye.arrow?.y,left:ye.arrow?.x}),[ye.arrow]),Fe=ye.arrow?.centerOffset!==0;return q.useMemo(()=>({positionerStyles:Oe,arrowStyles:Pe,arrowRef:ae,arrowUncentered:Fe,side:je,align:Me,physicalSide:Ae,anchorHidden:Ne,refs:he,context:Se,isPositioned:Ce,update:be}),[Oe,Pe,ae,Fe,je,Me,Ae,Ne,he,Se,Ce,be])}function SE(e){return e!=null&&`current`in e}function CE(e){return e===`starting`?SS:Mv}function wE(e,t,{styles:n,transitionStatus:r,props:i,refs:a,hidden:o,inert:s=!1}){let c={...n};return s&&(c.pointerEvents=`none`),Iv(`div`,e,{state:t,ref:a,props:[{role:`presentation`,hidden:o,style:c},CE(r),i],stateAttributesMapping:Qy})}var TE=q.forwardRef(function(e,t){let{render:n,className:r,anchor:i,positionMethod:a=`absolute`,side:o=`bottom`,align:s=`center`,sideOffset:c=0,alignOffset:l=0,collisionBoundary:u=`clipping-ancestors`,collisionPadding:d=5,arrowPadding:f=5,sticky:p=!1,disableAnchorTracking:m=!1,collisionAvoidance:h=TS,style:g,..._}=e,v=BT(),y=ZT(),b=zS(),x=v.useState(`open`),S=v.useState(`mounted`),C=v.useState(`floatingRootContext`),w=v.useState(`instantType`),T=v.useState(`transitionStatus`),E=v.useState(`adaptiveOrigin`),D=v.context.inlineRectCoordsRef,O=bE({anchor:i,floatingRootContext:C,positionMethod:a,mounted:S,side:o,sideOffset:c,align:s,alignOffset:l,arrowPadding:f,collisionBoundary:u,collisionPadding:d,sticky:p,disableAnchorTracking:m,keepMounted:y,nodeId:b,collisionAvoidance:h,adaptiveOrigin:E,inline:hC(D)}),k=O.update;Q(()=>{x&&S&&k()},[x,S,k]);let A=wE(e,{open:x,side:O.side,align:O.align,anchorHidden:O.anchorHidden,instant:w},{styles:O.positionerStyles,transitionStatus:T,props:_,refs:[t,v.useStateSetter(`positionerElement`)],hidden:!S,inert:!x});return(0,J.jsx)(nE.Provider,{value:O,children:(0,J.jsx)(BS,{id:b,children:A})})}),EE=q.forwardRef(function(e,t){let{className:n,render:r,style:i,...a}=e,o=BT(),{side:s,align:c}=rE(),l=o.useState(`open`),u=o.useState(`instantType`),d=o.useState(`transitionStatus`),f=o.useState(`popupProps`),p=o.useState(`floatingRootContext`),m=o.useState(`closeDelay`);return CC({open:l,ref:o.context.popupRef,onComplete(){l&&o.context.onOpenChangeComplete?.(!0)}}),_w(p,{closeDelay:m}),Iv(`div`,e,{state:{open:l,side:s,align:c,instant:u,transitionStatus:d},ref:[t,o.context.popupRef,o.useStateSetter(`popupElement`)],props:[TC,f,CE(d),a],stateAttributesMapping:$y})});function DE(e){return Ov(19)?e:e?`true`:void 0}function OE(e){let[t,n]=q.useState({current:e,previous:null});return Object.is(e,t.current)||n({current:e,previous:t.current}),t.previous}var kE=class extends gC{constructor(){super(WT(),`PreviewCard`)}open(e){this.openByTrigger(e)}close(){this.closePopup()}get isOpen(){return this.attachedStore?.select(`open`)??!1}};function AE(){return new kE}function jE({...e}){return(0,J.jsx)(YT,{"data-slot":`hover-card`,...e})}function ME({...e}){return(0,J.jsx)(tE,{"data-slot":`hover-card-trigger`,...e})}var NE=()=>AE();function PE({className:e,side:t=`bottom`,sideOffset:n=4,align:r=`center`,alignOffset:i=4,...a}){return(0,J.jsx)($T,{"data-slot":`hover-card-portal`,children:(0,J.jsx)(TE,{align:r,alignOffset:i,side:t,sideOffset:n,className:`isolate z-50`,children:(0,J.jsx)(EE,{"data-slot":`hover-card-content`,className:X(`z-50 w-64 origin-(--transform-origin) rounded-xl bg-popover p-2.5 text-ui text-popover-foreground shadow-md ring-1 ring-foreground/10 outline-hidden duration-(--duration-fast) data-[side=bottom]:slide-in-from-top-2 data-[side=inline-end]:slide-in-from-left-2 data-[side=inline-start]:slide-in-from-right-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95`,e),...a})})})}var FE={compact:`text-code-compact`,default:`text-code`,comfy:`text-code-comfy`},IE={add:{row:`bg-diff-add-bg`,gutter:`bg-diff-add-gutter text-diff-add-fg`,word:`bg-diff-add-word`,marker:`+`,label:`added`},del:{row:`bg-diff-del-bg`,gutter:`bg-diff-del-gutter text-diff-del-fg`,word:`bg-diff-del-word`,marker:`−`,label:`removed`},context:{row:`bg-background`,gutter:`bg-diff-gutter-bg text-diff-gutter-fg`,word:``,marker:` `,label:`unchanged`}},LE={keyword:`text-syntax-keyword`,string:`text-syntax-string`,function:`text-syntax-function`,comment:`text-syntax-comment`,number:`text-syntax-number`},RE=(e,t,n,r=[])=>{let i=[],a=0;for(let o of t??[{text:e,type:null}]){let t=a+o.text.length,s=new Set([a,t]);for(let e of[...n,...r])e.start>a&&e.start<t&&s.add(e.start),e.end>a&&e.end<t&&s.add(e.end);let c=[...s].sort((e,t)=>e-t);for(let r=0;r+1<c.length;r++){let s=c[r]??a,l=c[r+1]??t;i.push({text:e.slice(s,l),type:o.type,changed:n.some(e=>e.start<=s&&l<=e.end),start:s})}a=t}return i},zE={finding:`isolate font-medium text-review-changes before:absolute before:inset-0 before:-z-1 before:bg-review-changes-bg before:shadow-[inset_-3px_0_0_var(--review-changes)]`,risk:`isolate font-medium text-risk-contract before:absolute before:inset-0 before:-z-1 before:bg-risk-contract-bg before:shadow-[inset_-3px_0_0_var(--risk-contract-solid)]`,decision:``},BE=(0,q.memo)(function({line:e,id:t,layout:n=`unified`,density:r=`default`,wrap:i=!1,focused:a=!1,selected:o=!1,marked:s=!1,pointKind:c=null,pointLanding:l,onComment:u,onGutterClick:d,numberButton:f,onRowClick:p,cellRole:m=`gridcell`,marks:h=VE,flagged:g=!1,end:_}){let v=IE[e.kind],y=e.newNo??e.oldNo,b=n===`split-old`?`old`:`new`,x=(t,n)=>(0,J.jsxs)(`span`,{role:m,onClick:d===void 0?void 0:t=>d(e,t),"data-point-mark":c!==null&&c!==`decision`&&n===b?c:void 0,className:X(`tabular relative w-12 shrink-0 select-none text-right`,f?.side===n&&t!==null?`pr-0`:`pr-2`,v.gutter,c!==null&&n===b&&zE[c],d!==void 0&&`cursor-pointer hover:text-foreground`),children:[f?.side===n&&t!==null?(0,J.jsx)(`button`,{type:`button`,"aria-label":f.label,onClick:f.onClick,"data-inline-target":!0,className:X(`h-full w-full pr-2 text-right hover:bg-primary hover:text-primary-foreground focus-visible:-outline-offset-2`,p!==void 0&&`group-hover/line:bg-primary group-hover/line:text-primary-foreground focus-visible:bg-primary focus-visible:text-primary-foreground`,p!==void 0&&t<1e4&&`before:mr-1 before:content-none group-hover/line:before:content-['+'] focus-visible:before:content-['+']`),children:t}):t??``,n===`new`&&g&&t!==null&&t<1e3&&(0,J.jsx)(Ph,{"aria-hidden":`true`,"data-slot":`finding-flag`,className:`pointer-events-none absolute top-1/2 left-1 size-3 -translate-y-1/2 text-review-changes group-hover/line:hidden`}),n===`new`&&u!==void 0&&f===void 0&&(0,J.jsx)(`button`,{type:`button`,tabIndex:-1,"aria-label":`Comment on line ${y??``}`,onClick:t=>{t.stopPropagation(),u(e)},className:`absolute top-0 left-0 hidden h-full w-5 items-center justify-center rounded-sm bg-primary text-primary-foreground group-hover/line:flex group-data-focused/line:flex`,children:(0,J.jsx)(`span`,{"aria-hidden":`true`,children:`+`})})]});return(0,J.jsxs)(`div`,{role:`row`,id:t,onClick:p,"aria-selected":o||void 0,"data-line":e.key,"data-kind":e.kind,"data-focused":a||void 0,"data-marked":s||void 0,"data-point":c??void 0,"data-point-line":l===void 0?void 0:l.line,style:l===void 0?void 0:vh({"--landing-i":l.at,"--point-line":l.line,"--point-lines":l.lines}),className:X(`group/line relative flex min-w-full font-mono`,p!==void 0&&`cursor-pointer`,FE[r],v.row,o&&`before:pointer-events-none before:absolute before:inset-0 before:z-[1] before:bg-primary/15`,!o&&p!==void 0&&`hover:before:pointer-events-none hover:before:absolute hover:before:inset-0 hover:before:z-[1] hover:before:bg-primary/8`,(a||s)&&`after:pointer-events-none after:absolute after:inset-y-0 after:left-0 after:z-[1] after:w-[3px] after:bg-ring`),children:[n!==`split-new`&&x(e.oldNo,`old`),n!==`split-old`&&x(e.newNo,`new`),(0,J.jsx)(`span`,{"aria-hidden":`true`,className:X(`w-5 shrink-0 select-none text-center font-semibold`,e.kind===`add`&&`text-diff-add-fg`,e.kind===`del`&&`text-diff-del-fg`),children:v.marker}),(0,J.jsxs)(`span`,{role:m,className:X(`pr-4`,i?`min-w-0 flex-1 whitespace-pre-wrap break-all`:`whitespace-pre`),children:[(0,J.jsx)(`span`,{className:`sr-only`,children:`${v.label} line ${y??``}: `}),HE(RE(e.text,e.tokens,e.wordRanges,h).map(e=>({start:e.start,element:(0,J.jsx)(`span`,{"data-changed":e.changed||void 0,className:X(e.type!==null&&LE[e.type],e.changed&&X(v.word,`rounded-sm`)),children:e.text},e.start)})),h),e.notes.map(e=>(0,J.jsx)(`span`,{className:`ml-2 rounded-sm border px-1 align-middle font-sans text-caption text-muted-foreground`,children:e},e)),_]})]})}),VE=[],HE=(e,t)=>{if(t.length===0)return e.map(({element:e})=>e);let n=[];for(let{start:r,element:i}of e){let e=t.find(e=>r>=e.start&&r<e.end)??null,a=n.at(-1);e!==null&&a?.mark===e?a.code.push(i):n.push({mark:e,code:[i]})}return n.flatMap(({mark:e,code:t})=>e===null?t:[(0,J.jsx)(q.Fragment,{children:e.render(t)},`mark-${e.start}`)])},UE=({kind:e,className:t})=>(0,J.jsx)(`div`,{"aria-hidden":`true`,"data-slot":`line-end`,"data-kind":e,className:X(`flex min-w-full`,IE[e].row,t),children:(0,J.jsx)(`span`,{className:X(`w-12 shrink-0`,IE[e].gutter)})}),WE={finding:{label:`Finding`,glyph:`⚠`,className:`text-review-changes bg-review-changes-bg border-review-changes/25`},risk:{label:`Risk`,glyph:`▲`,className:`text-risk-contract bg-risk-contract-bg border-risk-contract-border`},decision:{label:`Decision`,glyph:`◇`,className:`text-muted-foreground bg-muted border-border`}},GE={finding:Ph,risk:Hg,decision:Kg},KE={contract:{label:`Contract`,glyph:`▲`,className:`text-risk-contract bg-risk-contract-bg border-risk-contract-border`},logic:{label:`Logic`,glyph:`●`,className:`text-risk-logic bg-risk-logic-bg border-risk-logic-border`},mechanical:{label:`Mechanical`,glyph:`○`,className:`text-risk-mechanical bg-risk-mechanical-bg border-risk-mechanical-border`}},qE={added:{kind:`mark`,label:`new`,tone:`text-diff-add-fg`,name:`text-diff-add-fg`},modified:null,deleted:{kind:`mark`,label:`deleted`,tone:`text-diff-del-fg`,name:`text-diff-del-fg line-through`},renamed:{kind:`chip`,label:`renamed`,className:`text-diff-hunk-fg bg-diff-hunk-bg border-diff-hunk-fg/25`}},JE={open:{label:`Open`,className:`text-pr-open bg-pr-open-bg border-pr-open/25`},draft:{label:`Draft`,className:`text-muted-foreground bg-muted border-border`},merged:{label:`Merged`,className:`text-pr-merged bg-pr-merged-bg border-pr-merged/25`},closed:{label:`Closed`,className:`text-review-changes bg-review-changes-bg border-review-changes/25`}},YE={approved:{label:`Approved`,glyph:`✓`,className:`text-review-approved bg-review-approved-bg border-review-approved/25`},"changes-requested":{label:`Changes requested`,glyph:`✕`,className:`text-review-changes bg-review-changes-bg border-review-changes/25`}},XE={passed:{label:`Passed`,glyph:`✓`,tone:`text-ci-success`},failed:{label:`Failed`,glyph:`✕`,tone:`text-ci-failure`},running:{label:`Running`,glyph:`◌`,tone:`text-ci-running`},skipped:{label:`Skipped`,glyph:`–`,tone:`text-ci-skipped`}},ZE={"changes-requested":{label:`Requested changes`,tone:`text-review-changes`},approved:{label:`Approved`,tone:`text-review-approved`},commented:{label:`Commented`,tone:`text-review-commented`},waiting:{label:`Not reviewed yet`,tone:`text-muted-foreground`}},QE=`data:image/svg+xml,%3c!--%20Copyright%202000-2022%20JetBrains%20s.r.o.%20and%20contributors.%20Use%20of%20this%20source%20code%20is%20governed%20by%20the%20Apache%202.0%20license.%20--%3e%3csvg%20width='16'%20height='16'%20viewBox='0%200%2016%2016'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3ccircle%20cx='8'%20cy='8'%20r='6.5'%20fill='%23E7EFFD'%20stroke='%233574F0'/%3e%3cpath%20d='M8.13295%2011.5C9.61223%2011.5%2010.8836%2010.6105%2011.2075%209.33909H10.2213C9.90229%2010.0739%209.11914%2010.6057%208.13295%2010.6057C6.77936%2010.6057%205.80284%209.51796%205.80284%208C5.80284%206.48204%206.77936%205.39434%208.13295%205.39434C9.11914%205.39434%209.90229%205.92611%2010.2213%206.66091H11.2075C10.8836%205.3895%209.61223%204.5%208.13295%204.5C6.21859%204.5%204.79248%205.99378%204.79248%208C4.79248%2010.0062%206.21859%2011.5%208.13295%2011.5Z'%20fill='%233574F0'/%3e%3c/svg%3e`,$E=`data:image/svg+xml,%3c!--%20Copyright%202000-2022%20JetBrains%20s.r.o.%20and%20contributors.%20Use%20of%20this%20source%20code%20is%20governed%20by%20the%20Apache%202.0%20license.%20--%3e%3csvg%20width='16'%20height='16'%20viewBox='0%200%2016%2016'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='M12.9497%203.05025C15.6834%205.78392%2015.6834%2010.2161%2012.9497%2012.9497C10.216%2015.6834%205.78388%2015.6834%203.05021%2012.9497C0.316541%2010.2161%200.316541%205.78392%203.05021%203.05025C5.78388%200.316583%2010.216%200.316583%2012.9497%203.05025Z'%20fill='%23E7EFFD'/%3e%3cpath%20fill-rule='evenodd'%20clip-rule='evenodd'%20d='M14.9143%206.90481L13.9264%207.06045C13.7359%205.85124%2013.1755%204.69027%2012.2426%203.75736C11.3097%202.82445%2010.1487%202.26404%208.93951%202.07352L9.09515%201.0857C10.5062%201.30802%2011.8623%201.96287%2012.9497%203.05025C14.0371%204.13763%2014.6919%205.49375%2014.9143%206.90481ZM6.90477%201.0857L7.06041%202.07352C5.8512%202.26404%204.69023%202.82445%203.75732%203.75736C2.82441%204.69027%202.26399%205.85124%202.07348%207.06045L1.08566%206.90481C1.30798%205.49375%201.96283%204.13763%203.05021%203.05025C4.13759%201.96287%205.49371%201.30802%206.90477%201.0857ZM1.08566%209.09519C1.30798%2010.5063%201.96283%2011.8624%203.05021%2012.9497C4.13759%2014.0371%205.49371%2014.692%206.90477%2014.9143L7.0604%2013.9265C5.8512%2013.736%204.69023%2013.1755%203.75732%2012.2426C2.82441%2011.3097%202.26399%2010.1488%202.07348%208.93955L1.08566%209.09519ZM9.09515%2014.9143L8.93951%2013.9265C10.1487%2013.736%2011.3097%2013.1755%2012.2426%2012.2426C13.1755%2011.3097%2013.7359%2010.1488%2013.9264%208.93955L14.9143%209.09519C14.6919%2010.5063%2014.0371%2011.8624%2012.9497%2012.9497C11.8623%2014.0371%2010.5062%2014.692%209.09515%2014.9143Z'%20fill='%233574F0'/%3e%3cpath%20d='M8.13295%2011.5C9.61223%2011.5%2010.8836%2010.6105%2011.2075%209.33909H10.2213C9.90229%2010.0739%209.11914%2010.6057%208.13295%2010.6057C6.77936%2010.6057%205.80284%209.51796%205.80284%208C5.80284%206.48204%206.77936%205.39434%208.13295%205.39434C9.11914%205.39434%209.90229%205.92611%2010.2213%206.66091H11.2075C10.8836%205.3895%209.61223%204.5%208.13295%204.5C6.21859%204.5%204.79248%205.99378%204.79248%208C4.79248%2010.0062%206.21859%2011.5%208.13295%2011.5Z'%20fill='%233574F0'/%3e%3c/svg%3e`,eD=`data:image/svg+xml,%3c!--%20Copyright%202000-2022%20JetBrains%20s.r.o.%20and%20contributors.%20Use%20of%20this%20source%20code%20is%20governed%20by%20the%20Apache%202.0%20license.%20--%3e%3csvg%20width='16'%20height='16'%20viewBox='0%200%2016%2016'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='M12.9497%203.05025C15.6834%205.78392%2015.6834%2010.2161%2012.9497%2012.9497C10.216%2015.6834%205.78388%2015.6834%203.05021%2012.9497C0.316541%2010.2161%200.316541%205.78392%203.05021%203.05025C5.78388%200.316583%2010.216%200.316583%2012.9497%203.05025Z'%20fill='%2325324D'/%3e%3cpath%20fill-rule='evenodd'%20clip-rule='evenodd'%20d='M14.9143%206.90481L13.9264%207.06045C13.7359%205.85124%2013.1755%204.69027%2012.2426%203.75736C11.3097%202.82445%2010.1487%202.26404%208.93951%202.07352L9.09515%201.0857C10.5062%201.30802%2011.8623%201.96287%2012.9497%203.05025C14.0371%204.13763%2014.6919%205.49375%2014.9143%206.90481ZM6.90477%201.0857L7.06041%202.07352C5.8512%202.26404%204.69023%202.82445%203.75732%203.75736C2.82441%204.69027%202.26399%205.85124%202.07348%207.06045L1.08566%206.90481C1.30798%205.49375%201.96283%204.13763%203.05021%203.05025C4.13759%201.96287%205.49371%201.30802%206.90477%201.0857ZM1.08566%209.09519C1.30798%2010.5063%201.96283%2011.8624%203.05021%2012.9497C4.13759%2014.0371%205.49371%2014.692%206.90477%2014.9143L7.0604%2013.9265C5.8512%2013.736%204.69023%2013.1755%203.75732%2012.2426C2.82441%2011.3097%202.26399%2010.1488%202.07348%208.93955L1.08566%209.09519ZM9.09515%2014.9143L8.93951%2013.9265C10.1487%2013.736%2011.3097%2013.1755%2012.2426%2012.2426C13.1755%2011.3097%2013.7359%2010.1488%2013.9264%208.93955L14.9143%209.09519C14.6919%2010.5063%2014.0371%2011.8624%2012.9497%2012.9497C11.8623%2014.0371%2010.5062%2014.692%209.09515%2014.9143Z'%20fill='%23548AF7'/%3e%3cpath%20d='M8.13295%2011.5C9.61223%2011.5%2010.8836%2010.6105%2011.2075%209.33909H10.2213C9.90229%2010.0739%209.11914%2010.6057%208.13295%2010.6057C6.77936%2010.6057%205.80284%209.51796%205.80284%208C5.80284%206.48204%206.77936%205.39434%208.13295%205.39434C9.11914%205.39434%209.90229%205.92611%2010.2213%206.66091H11.2075C10.8836%205.3895%209.61223%204.5%208.13295%204.5C6.21859%204.5%204.79248%205.99378%204.79248%208C4.79248%2010.0062%206.21859%2011.5%208.13295%2011.5Z'%20fill='%23548AF7'/%3e%3c/svg%3e`,tD=`data:image/svg+xml,%3c!--%20Copyright%202000-2022%20JetBrains%20s.r.o.%20and%20contributors.%20Use%20of%20this%20source%20code%20is%20governed%20by%20the%20Apache%202.0%20license.%20--%3e%3csvg%20width='16'%20height='16'%20viewBox='0%200%2016%2016'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3ccircle%20cx='8'%20cy='8'%20r='6.5'%20fill='%2325324D'%20stroke='%23548AF7'/%3e%3cpath%20d='M8.13295%2011.5C9.61223%2011.5%2010.8836%2010.6105%2011.2075%209.33909H10.2213C9.90229%2010.0739%209.11914%2010.6057%208.13295%2010.6057C6.77936%2010.6057%205.80284%209.51796%205.80284%208C5.80284%206.48204%206.77936%205.39434%208.13295%205.39434C9.11914%205.39434%209.90229%205.92611%2010.2213%206.66091H11.2075C10.8836%205.3895%209.61223%204.5%208.13295%204.5C6.21859%204.5%204.79248%205.99378%204.79248%208C4.79248%2010.0062%206.21859%2011.5%208.13295%2011.5Z'%20fill='%23548AF7'/%3e%3c/svg%3e`,nD=`data:image/svg+xml,%3c!--%20Copyright%202000-2022%20JetBrains%20s.r.o.%20and%20contributors.%20Use%20of%20this%20source%20code%20is%20governed%20by%20the%20Apache%202.0%20license.%20--%3e%3csvg%20width='16'%20height='16'%20viewBox='0%200%2016%2016'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3ccircle%20cx='8'%20cy='8'%20r='6.5'%20fill='%23FAF5FF'%20stroke='%23834DF0'/%3e%3cpath%20d='M5.49023%2011.5H10.5102V10.585H6.48023V8.435H10.0702V7.515H6.48023V5.415H10.4102V4.5H5.49023V11.5Z'%20fill='%23834DF0'/%3e%3c/svg%3e`,rD=`data:image/svg+xml,%3c!--%20Copyright%202000-2022%20JetBrains%20s.r.o.%20and%20contributors.%20Use%20of%20this%20source%20code%20is%20governed%20by%20the%20Apache%202.0%20license.%20--%3e%3csvg%20width='16'%20height='16'%20viewBox='0%200%2016%2016'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3ccircle%20cx='8'%20cy='8'%20r='6.5'%20fill='%232F2936'%20stroke='%23A571E6'/%3e%3cpath%20d='M5.49023%2011.5H10.5102V10.585H6.48023V8.435H10.0702V7.515H6.48023V5.415H10.4102V4.5H5.49023V11.5Z'%20fill='%23A571E6'/%3e%3c/svg%3e`,iD=`data:image/svg+xml,%3c!--%20Copyright%202000-2022%20JetBrains%20s.r.o.%20and%20contributors.%20Use%20of%20this%20source%20code%20is%20governed%20by%20the%20Apache%202.0%20license.%20--%3e%3csvg%20width='16'%20height='16'%20viewBox='0%200%2016%2016'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='M8.10584%204.34613L8.25344%204.5H8.46667H13C13.8284%204.5%2014.5%205.17157%2014.5%206V12.1333C14.5%2012.9529%2013.932%2013.5%2013.3667%2013.5H2.63333C2.06804%2013.5%201.5%2012.9529%201.5%2012.1333V3.86667C1.5%203.04707%202.06804%202.5%202.63333%202.5H6.1217C6.25792%202.5%206.38824%202.55557%206.48253%202.65387L8.10584%204.34613Z'%20fill='%23EBECF0'%20stroke='%236C707E'/%3e%3c/svg%3e`,aD=`data:image/svg+xml,%3c!--%20Copyright%202000-2022%20JetBrains%20s.r.o.%20and%20contributors.%20Use%20of%20this%20source%20code%20is%20governed%20by%20the%20Apache%202.0%20license.%20--%3e%3csvg%20width='16'%20height='16'%20viewBox='0%200%2016%2016'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='M8.10584%204.34613L8.25344%204.5H8.46667H13C13.8284%204.5%2014.5%205.17157%2014.5%206V12.1333C14.5%2012.9529%2013.932%2013.5%2013.3667%2013.5H2.63333C2.06804%2013.5%201.5%2012.9529%201.5%2012.1333V3.86667C1.5%203.04707%202.06804%202.5%202.63333%202.5H6.1217C6.25792%202.5%206.38824%202.55557%206.48253%202.65387L8.10584%204.34613Z'%20fill='%2343454A'%20stroke='%23CED0D6'/%3e%3c/svg%3e`,oD=`data:image/svg+xml,%3c!--%20Copyright%202000-2023%20JetBrains%20s.r.o.%20and%20contributors.%20Use%20of%20this%20source%20code%20is%20governed%20by%20the%20Apache%202.0%20license.%20--%3e%3csvg%20width='16'%20height='16'%20viewBox='0%200%2016%2016'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3ccircle%20cx='8'%20cy='8'%20r='6.5'%20fill='%23F2FCF3'%20stroke='%23208A3C'/%3e%3cpath%20fill-rule='evenodd'%20clip-rule='evenodd'%20d='M10%204.5V5.5L8.5%205.5V10.5H10V11.5L8.5%2011.5H7.5L6%2011.5V10.5H7.5V5.5L6%205.5V4.5H7.5H8.5H10Z'%20fill='%23208A3C'/%3e%3c/svg%3e`,sD=`data:image/svg+xml,%3c!--%20Copyright%202000-2022%20JetBrains%20s.r.o.%20and%20contributors.%20Use%20of%20this%20source%20code%20is%20governed%20by%20the%20Apache%202.0%20license.%20--%3e%3csvg%20width='16'%20height='16'%20viewBox='0%200%2016%2016'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3ccircle%20cx='8'%20cy='8'%20r='6.5'%20fill='%23253627'%20stroke='%2357965C'/%3e%3cpath%20fill-rule='evenodd'%20clip-rule='evenodd'%20d='M10%204.5V5.5L8.5%205.5V10.5H10V11.5L8.5%2011.5H7.5L6%2011.5V10.5H7.5V5.5L6%205.5V4.5H7.5H8.5H10Z'%20fill='%2357965C'/%3e%3c/svg%3e`,cD=`data:image/svg+xml,%3c!--%20Copyright%202000-2023%20JetBrains%20s.r.o.%20and%20contributors.%20Use%20of%20this%20source%20code%20is%20governed%20by%20the%20Apache%202.0%20license.%20--%3e%3csvg%20width='16'%20height='16'%20viewBox='0%200%2016%2016'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3crect%20x='2'%20y='13'%20width='12'%20height='1'%20rx='0.5'%20fill='%23E66D17'/%3e%3cpath%20d='M2.5%203.6C2.5%203.31172%202.50039%203.12559%202.51196%202.98392C2.52306%202.84809%202.5419%202.79773%202.5545%202.773C2.60243%202.67892%202.67892%202.60243%202.773%202.5545C2.79773%202.5419%202.84809%202.52306%202.98392%202.51196C3.12559%202.50039%203.31172%202.5%203.6%202.5H11.4C11.6883%202.5%2011.8744%202.50039%2012.0161%202.51196C12.1519%202.52306%2012.2023%202.5419%2012.227%202.5545C12.3211%202.60243%2012.3976%202.67892%2012.4455%202.773L12.8864%202.54834L12.4455%202.773C12.4581%202.79773%2012.4769%202.84809%2012.488%202.98392C12.4996%203.12559%2012.5%203.31172%2012.5%203.6V6.5C12.5%207.93194%2012.4946%208.53707%2012.3493%209.016C12.01%2010.1346%2011.1346%2011.01%2010.016%2011.3493C9.53707%2011.4946%208.93194%2011.5%207.5%2011.5C6.06806%2011.5%205.46293%2011.4946%204.984%2011.3493C3.8654%2011.01%202.99003%2010.1346%202.65071%209.016C2.50543%208.53707%202.5%207.93194%202.5%206.5V3.6Z'%20fill='%23FFF4EB'%20stroke='%23E66D17'/%3e%3cpath%20d='M12.5%202.5H14.5C14.7761%202.5%2015%202.72386%2015%203V4.18121C15%204.78125%2014.6424%205.32356%2014.0909%205.55993L12.5%206.24173V2.5Z'%20stroke='%23E66D17'/%3e%3c/svg%3e`,lD=`data:image/svg+xml,%3c!--%20Copyright%202000-2023%20JetBrains%20s.r.o.%20and%20contributors.%20Use%20of%20this%20source%20code%20is%20governed%20by%20the%20Apache%202.0%20license.%20--%3e%3csvg%20width='16'%20height='16'%20viewBox='0%200%2016%2016'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='M14%204C14%202.89543%2013.1046%202%2012%202H4C2.89543%202%202%202.89543%202%204V12C2%2013.1046%202.89543%2014%204%2014H12C13.1046%2014%2014%2013.1046%2014%2012V4Z'%20fill='%23FFAF0F'/%3e%3cpath%20d='M9.55434%2011.8593C9.88209%2012.0132%2010.2583%2012.0901%2010.6829%2012.0901C11.1047%2012.0901%2011.4795%2012.0117%2011.8073%2011.855C12.135%2011.6982%2012.3901%2011.4831%2012.5725%2011.2095C12.7549%2010.933%2012.8461%2010.6238%2012.8461%2010.2818C12.8461%209.99963%2012.7834%209.73315%2012.658%209.48235C12.5326%209.23155%2012.3545%209.02208%2012.1236%208.85393C11.8956%208.68578%2011.6348%208.57605%2011.3413%208.52475L10.3452%208.3623C10.1429%208.3281%209.97899%208.24118%209.85359%208.10153C9.72819%207.95903%209.66549%207.79088%209.66549%207.59708C9.66549%207.43178%209.70824%207.28643%209.79374%207.16103C9.87924%207.03563%209.99894%206.93873%2010.1528%206.87033C10.3067%206.80193%2010.4849%206.76773%2010.6872%206.76773C10.8896%206.76773%2011.0677%206.80335%2011.2216%206.8746C11.3755%206.94585%2011.4952%207.04703%2011.5807%207.17813C11.6662%207.30638%2011.7089%207.45173%2011.7089%207.61418H12.7221C12.7193%207.28073%2012.6309%206.98433%2012.4571%206.72498C12.2832%206.46563%2012.041%206.26328%2011.7303%206.11793C11.4225%205.97258%2011.0705%205.8999%2010.6744%205.8999C10.2868%205.8999%209.93909%205.97543%209.63129%206.12648C9.32349%206.27468%209.08266%206.4813%208.90881%206.74635C8.73781%207.00855%208.65231%207.30495%208.65231%207.63555C8.65231%207.912%208.70931%208.16708%208.82331%208.40078C8.94016%208.63163%209.10546%208.824%209.31921%208.9779C9.53296%209.1318%209.78519%209.2344%2010.0759%209.2857L11.0891%209.4567C11.3114%209.49375%2011.4895%209.5935%2011.6234%209.75595C11.7574%209.91555%2011.8244%2010.1065%2011.8244%2010.3288C11.8244%2010.5055%2011.7773%2010.6623%2011.6833%2010.7991C11.5921%2010.933%2011.461%2011.037%2011.29%2011.1111C11.119%2011.1852%2010.9209%2011.2223%2010.6958%2011.2223C10.4649%2011.2223%2010.2597%2011.1824%2010.0802%2011.1026C9.90346%2011.0199%209.76524%2010.9045%209.66549%2010.7563C9.56574%2010.6081%209.51586%2010.44%209.51586%2010.2519H8.50269C8.50554%2010.611%208.59959%2010.9302%208.78484%2011.2095C8.97009%2011.4859%209.22659%2011.7025%209.55434%2011.8593Z'%20fill='black'/%3e%3cpath%20d='M5.22179%2011H4.21289V12H5.32012C5.64787%2012%205.93857%2011.9316%206.19222%2011.7948C6.44587%2011.6551%206.64394%2011.4613%206.78644%2011.2134C6.92894%2010.9654%207.00019%2010.6804%207.00019%2010.3584L7.00024%206H5.99989L5.99984%2010.222C5.99984%2010.3759%205.96707%2010.5127%205.90152%2010.6324C5.83882%2010.7492%205.74762%2010.8404%205.62792%2010.906C5.51107%2010.9687%205.37569%2011%205.22179%2011Z'%20fill='black'/%3e%3c/svg%3e`,uD=`data:image/svg+xml,%3c!--%20Copyright%202000-2023%20JetBrains%20s.r.o.%20and%20contributors.%20Use%20of%20this%20source%20code%20is%20governed%20by%20the%20Apache%202.0%20license.%20--%3e%3csvg%20width='16'%20height='16'%20viewBox='0%200%2016%2016'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='M14%204C14%202.89543%2013.1046%202%2012%202H4C2.89543%202%202%202.89543%202%204V12C2%2013.1046%202.89543%2014%204%2014H12C13.1046%2014%2014%2013.1046%2014%2012V4Z'%20fill='%23F2C55C'/%3e%3cpath%20d='M9.55434%2011.8593C9.88209%2012.0132%2010.2583%2012.0901%2010.6829%2012.0901C11.1047%2012.0901%2011.4795%2012.0117%2011.8073%2011.855C12.135%2011.6982%2012.3901%2011.4831%2012.5725%2011.2095C12.7549%2010.933%2012.8461%2010.6238%2012.8461%2010.2818C12.8461%209.99963%2012.7834%209.73315%2012.658%209.48235C12.5326%209.23155%2012.3545%209.02208%2012.1236%208.85393C11.8956%208.68578%2011.6348%208.57605%2011.3413%208.52475L10.3452%208.3623C10.1429%208.3281%209.97899%208.24118%209.85359%208.10153C9.72819%207.95903%209.66549%207.79088%209.66549%207.59708C9.66549%207.43178%209.70824%207.28643%209.79374%207.16103C9.87924%207.03563%209.99894%206.93873%2010.1528%206.87033C10.3067%206.80193%2010.4849%206.76773%2010.6872%206.76773C10.8896%206.76773%2011.0677%206.80335%2011.2216%206.8746C11.3755%206.94585%2011.4952%207.04703%2011.5807%207.17813C11.6662%207.30638%2011.7089%207.45173%2011.7089%207.61418H12.7221C12.7193%207.28073%2012.6309%206.98433%2012.4571%206.72498C12.2832%206.46563%2012.041%206.26328%2011.7303%206.11793C11.4225%205.97258%2011.0705%205.8999%2010.6744%205.8999C10.2868%205.8999%209.93909%205.97543%209.63129%206.12648C9.32349%206.27468%209.08266%206.4813%208.90881%206.74635C8.73781%207.00855%208.65231%207.30495%208.65231%207.63555C8.65231%207.912%208.70931%208.16708%208.82331%208.40078C8.94016%208.63163%209.10546%208.824%209.31921%208.9779C9.53296%209.1318%209.78519%209.2344%2010.0759%209.2857L11.0891%209.4567C11.3114%209.49375%2011.4895%209.5935%2011.6234%209.75595C11.7574%209.91555%2011.8244%2010.1065%2011.8244%2010.3288C11.8244%2010.5055%2011.7773%2010.6623%2011.6833%2010.7991C11.5921%2010.933%2011.461%2011.037%2011.29%2011.1111C11.119%2011.1852%2010.9209%2011.2223%2010.6958%2011.2223C10.4649%2011.2223%2010.2597%2011.1824%2010.0802%2011.1026C9.90346%2011.0199%209.76524%2010.9045%209.66549%2010.7563C9.56574%2010.6081%209.51586%2010.44%209.51586%2010.2519H8.50269C8.50554%2010.611%208.59959%2010.9302%208.78484%2011.2095C8.97009%2011.4859%209.22659%2011.7025%209.55434%2011.8593Z'%20fill='%231E1F22'/%3e%3cpath%20d='M5.22179%2011H4.21289V12H5.32012C5.64787%2012%205.93857%2011.9316%206.19222%2011.7948C6.44587%2011.6551%206.64394%2011.4613%206.78644%2011.2134C6.92894%2010.9654%207.00019%2010.6804%207.00019%2010.3584L7.00024%206H5.99989L5.99984%2010.222C5.99984%2010.3759%205.96707%2010.5127%205.90152%2010.6324C5.83882%2010.7492%205.74762%2010.8404%205.62792%2010.906C5.51107%2010.9687%205.37569%2011%205.22179%2011Z'%20fill='%231E1F22'/%3e%3c/svg%3e`,dD=`data:image/svg+xml,%3c!--%20Copyright%202000-2023%20JetBrains%20s.r.o.%20and%20contributors.%20Use%20of%20this%20source%20code%20is%20governed%20by%20the%20Apache%202.0%20license.%20--%3e%3csvg%20width='16'%20height='16'%20viewBox='0%200%2016%2016'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3crect%20x='2'%20y='13'%20width='12'%20height='1'%20rx='0.5'%20fill='%23C77D55'/%3e%3cpath%20d='M2.5%203C2.5%202.72386%202.72386%202.5%203%202.5H12C12.2761%202.5%2012.5%202.72386%2012.5%203V8C12.5%209.933%2010.933%2011.5%209%2011.5H6C4.067%2011.5%202.5%209.933%202.5%208V3Z'%20fill='%2345322B'%20stroke='%23C77D55'/%3e%3cpath%20d='M12.5%202.5H14.5C14.7761%202.5%2015%202.72386%2015%203V4.18121C15%204.78125%2014.6424%205.32356%2014.0909%205.55993L12.5%206.24173V2.5Z'%20stroke='%23C77D55'/%3e%3c/svg%3e`,fD=`data:image/svg+xml,%3c!--%20Copyright%202000-2023%20JetBrains%20s.r.o.%20and%20contributors.%20Use%20of%20this%20source%20code%20is%20governed%20by%20the%20Apache%202.0%20license.%20--%3e%3csvg%20width='16'%20height='16'%20viewBox='0%200%2016%2016'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='M3.98755%209.77751C3.99755%209.39251%203.87005%209.08501%203.60505%208.85501C3.34005%208.62501%202.98255%208.51001%202.53255%208.51001H2V7.43001H2.53255C2.98255%207.43001%203.34005%207.31501%203.60505%207.08501C3.87005%206.85501%203.99755%206.54751%203.98755%206.16251L3.95755%204.58C3.94755%204.06%204.05505%203.605%204.28005%203.215C4.51005%202.825%204.83755%202.525%205.26255%202.315C5.68755%202.105%206.18755%202%206.76255%202H7.5V3.005H6.77005C6.25005%203.005%205.83755%203.15%205.53255%203.44C5.23255%203.725%205.08505%204.1125%205.09005%204.6025L5.12005%206.17001C5.13005%206.68001%204.99255%207.09751%204.70755%207.42251C4.42255%207.74251%204.03755%207.92001%203.55255%207.95501C4.03755%208.04501%204.42255%208.25501%204.70755%208.58501C4.99255%208.91001%205.13005%209.30501%205.12005%209.77001L5.09005%2011.5475C5.08005%2011.9875%205.21255%2012.3375%205.48755%2012.5975C5.76755%2012.8625%206.14505%2012.995%206.62005%2012.995H7.5V14H6.61255C6.07755%2014%205.60755%2013.9%205.20255%2013.7C4.80255%2013.505%204.49255%2013.2225%204.27255%2012.8525C4.05755%2012.4875%203.95255%2012.06%203.95755%2011.57L3.98755%209.77751Z'%20fill='%23834DF0'/%3e%3cpath%20d='M12.0145%209.77751C12.0045%209.39251%2012.132%209.08501%2012.397%208.85501C12.662%208.62501%2013.0195%208.51001%2013.4695%208.51001H14V7.43001H13.4695C13.0195%207.43001%2012.662%207.31501%2012.397%207.08501C12.132%206.85501%2012.0045%206.54751%2012.0145%206.16251L12.0445%204.58C12.0545%204.06%2011.9445%203.605%2011.7145%203.215C11.4895%202.825%2011.1645%202.525%2010.7395%202.315C10.3145%202.105%209.81455%202%209.23955%202H8.5V3.005H9.23205C9.75205%203.005%2010.162%203.15%2010.462%203.44C10.767%203.725%2010.917%204.1125%2010.912%204.6025L10.882%206.17001C10.872%206.68001%2011.0095%207.09751%2011.2945%207.42251C11.5795%207.74251%2011.9645%207.92001%2012.4495%207.95501C11.9645%208.04501%2011.5795%208.25501%2011.2945%208.58501C11.0095%208.91001%2010.872%209.30501%2010.882%209.77001L10.912%2011.5475C10.922%2011.9875%2010.787%2012.3375%2010.507%2012.5975C10.232%2012.8625%209.85705%2012.995%209.38205%2012.995H8.5V14H9.38955C9.92455%2014%2010.392%2013.9%2010.792%2013.7C11.197%2013.505%2011.507%2013.2225%2011.722%2012.8525C11.942%2012.4875%2012.0495%2012.06%2012.0445%2011.57L12.0145%209.77751Z'%20fill='%23834DF0'/%3e%3c/svg%3e`,pD=`data:image/svg+xml,%3c!--%20Copyright%202000-2023%20JetBrains%20s.r.o.%20and%20contributors.%20Use%20of%20this%20source%20code%20is%20governed%20by%20the%20Apache%202.0%20license.%20--%3e%3csvg%20width='16'%20height='16'%20viewBox='0%200%2016%2016'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='M3.98755%209.77751C3.99755%209.39251%203.87005%209.08501%203.60505%208.85501C3.34005%208.62501%202.98255%208.51001%202.53255%208.51001H2V7.43001H2.53255C2.98255%207.43001%203.34005%207.31501%203.60505%207.08501C3.87005%206.85501%203.99755%206.54751%203.98755%206.16251L3.95755%204.58C3.94755%204.06%204.05505%203.605%204.28005%203.215C4.51005%202.825%204.83755%202.525%205.26255%202.315C5.68755%202.105%206.18755%202%206.76255%202H7.5V3.005H6.77005C6.25005%203.005%205.83755%203.15%205.53255%203.44C5.23255%203.725%205.08505%204.1125%205.09005%204.6025L5.12005%206.17001C5.13005%206.68001%204.99255%207.09751%204.70755%207.42251C4.42255%207.74251%204.03755%207.92001%203.55255%207.95501C4.03755%208.04501%204.42255%208.25501%204.70755%208.58501C4.99255%208.91001%205.13005%209.30501%205.12005%209.77001L5.09005%2011.5475C5.08005%2011.9875%205.21255%2012.3375%205.48755%2012.5975C5.76755%2012.8625%206.14505%2012.995%206.62005%2012.995H7.5V14H6.61255C6.07755%2014%205.60755%2013.9%205.20255%2013.7C4.80255%2013.505%204.49255%2013.2225%204.27255%2012.8525C4.05755%2012.4875%203.95255%2012.06%203.95755%2011.57L3.98755%209.77751Z'%20fill='%23B589EC'/%3e%3cpath%20d='M12.0145%209.77751C12.0045%209.39251%2012.132%209.08501%2012.397%208.85501C12.662%208.62501%2013.0195%208.51001%2013.4695%208.51001H14V7.43001H13.4695C13.0195%207.43001%2012.662%207.31501%2012.397%207.08501C12.132%206.85501%2012.0045%206.54751%2012.0145%206.16251L12.0445%204.58C12.0545%204.06%2011.9445%203.605%2011.7145%203.215C11.4895%202.825%2011.1645%202.525%2010.7395%202.315C10.3145%202.105%209.81455%202%209.23955%202H8.5V3.005H9.23205C9.75205%203.005%2010.162%203.15%2010.462%203.44C10.767%203.725%2010.917%204.1125%2010.912%204.6025L10.882%206.17001C10.872%206.68001%2011.0095%207.09751%2011.2945%207.42251C11.5795%207.74251%2011.9645%207.92001%2012.4495%207.95501C11.9645%208.04501%2011.5795%208.25501%2011.2945%208.58501C11.0095%208.91001%2010.872%209.30501%2010.882%209.77001L10.912%2011.5475C10.922%2011.9875%2010.787%2012.3375%2010.507%2012.5975C10.232%2012.8625%209.85705%2012.995%209.38205%2012.995H8.5V14H9.38955C9.92455%2014%2010.392%2013.9%2010.792%2013.7C11.197%2013.505%2011.507%2013.2225%2011.722%2012.8525C11.942%2012.4875%2012.0495%2012.06%2012.0445%2011.57L12.0145%209.77751Z'%20fill='%23B589EC'/%3e%3c/svg%3e`,mD=`data:image/svg+xml,%3c!--%20Copyright%202000-2024%20JetBrains%20s.r.o.%20and%20contributors.%20Use%20of%20this%20source%20code%20is%20governed%20by%20the%20Apache%202.0%20license.%20--%3e%3csvg%20width='16'%20height='16'%20viewBox='0%200%2016%2016'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20fill-rule='evenodd'%20clip-rule='evenodd'%20d='M15.3798%202.71174C15.5435%202.86906%2015.5436%203.13098%2015.3799%203.2884L12.6774%205.8876C12.4232%206.13204%2012%205.95194%2012%205.59934L12%200.403813C12%200.0513186%2012.423%20-0.128819%2012.6772%200.115408L15.3798%202.71174Z'%20fill='%2355A76A'/%3e%3cpath%20fill-rule='evenodd'%20clip-rule='evenodd'%20d='M7.62255%203.28826C7.45909%203.13088%207.45916%202.8692%207.62271%202.71191L10.3216%200.116292C10.5757%20-0.128147%2010.9989%200.0519476%2010.9989%200.404547V5.59865C10.9989%205.95135%2010.5755%206.1314%2010.3214%205.88675L7.62255%203.28826Z'%20fill='%23E55765'/%3e%3c/svg%3e`,hD=`data:image/svg+xml,%3c!--%20Copyright%202000-2024%20JetBrains%20s.r.o.%20and%20contributors.%20Use%20of%20this%20source%20code%20is%20governed%20by%20the%20Apache%202.0%20license.%20--%3e%3csvg%20width='16'%20height='16'%20viewBox='0%200%2016%2016'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20fill-rule='evenodd'%20clip-rule='evenodd'%20d='M15.3798%202.71174C15.5435%202.86906%2015.5436%203.13098%2015.3799%203.2884L12.6774%205.8876C12.4232%206.13204%2012%205.95194%2012%205.59934L12%200.403813C12%200.0513186%2012.423%20-0.128819%2012.6772%200.115408L15.3798%202.71174Z'%20fill='%2357965C'/%3e%3cpath%20fill-rule='evenodd'%20clip-rule='evenodd'%20d='M7.62255%203.28826C7.45909%203.13088%207.45916%202.8692%207.62271%202.71191L10.3216%200.116292C10.5757%20-0.128147%2010.9989%200.0519476%2010.9989%200.404547V5.59865C10.9989%205.95135%2010.5755%206.1314%2010.3214%205.88675L7.62255%203.28826Z'%20fill='%23DB5C5C'/%3e%3c/svg%3e`,gD=`data:image/svg+xml,%3c!--%20Copyright%202000-2024%20JetBrains%20s.r.o.%20and%20contributors.%20Use%20of%20this%20source%20code%20is%20governed%20by%20the%20Apache%202.0%20license.%20--%3e%3csvg%20width='16'%20height='16'%20viewBox='0%200%2016%2016'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='M13.3337%2012.6314C13.6699%2012.9396%2013.4519%2013.5%2012.9958%2013.5H3C2.72386%2013.5%202.5%2013.2761%202.5%2013V3C2.5%202.72386%202.72386%202.5%203%202.5H12.9958C13.4519%202.5%2013.6699%203.06044%2013.3337%203.36858L8.68333%207.63142C8.46715%207.82959%208.46715%208.17041%208.68333%208.36858L13.3337%2012.6314Z'%20fill='%23FAF5FF'/%3e%3cpath%20fill-rule='evenodd'%20clip-rule='evenodd'%20d='M2%203C2%202.44772%202.44771%202%203%202H12.9958C13.9079%202%2014.3439%203.12089%2013.6716%203.73715L9.0212%208L13.6716%2012.2628C14.3439%2012.8791%2013.9079%2014%2012.9958%2014H3C2.44771%2014%202%2013.5523%202%2013V3ZM12.9958%203L3%203V13H12.9958L8.34547%208.73715C7.91311%208.34082%207.9131%207.65918%208.34547%207.26285L12.9958%203Z'%20fill='%23834DF0'/%3e%3c/svg%3e`,_D=`data:image/svg+xml,%3c!--%20Copyright%202000-2024%20JetBrains%20s.r.o.%20and%20contributors.%20Use%20of%20this%20source%20code%20is%20governed%20by%20the%20Apache%202.0%20license.%20--%3e%3csvg%20width='16'%20height='16'%20viewBox='0%200%2016%2016'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='M13.3337%2012.6314C13.6699%2012.9396%2013.4519%2013.5%2012.9958%2013.5H3C2.72386%2013.5%202.5%2013.2761%202.5%2013V3C2.5%202.72386%202.72386%202.5%203%202.5H12.9958C13.4519%202.5%2013.6699%203.06044%2013.3337%203.36858L8.68333%207.63142C8.46715%207.82959%208.46715%208.17041%208.68333%208.36858L13.3337%2012.6314Z'%20fill='%232F2936'/%3e%3cpath%20fill-rule='evenodd'%20clip-rule='evenodd'%20d='M2%203C2%202.44772%202.44771%202%203%202H12.9958C13.9079%202%2014.3439%203.12089%2013.6716%203.73715L9.0212%208L13.6716%2012.2628C14.3439%2012.8791%2013.9079%2014%2012.9958%2014H3C2.44771%2014%202%2013.5523%202%2013V3ZM12.9958%203L3%203V13H12.9958L8.34547%208.73715C7.91311%208.34082%207.9131%207.65918%208.34547%207.26285L12.9958%203Z'%20fill='%23A571E6'/%3e%3c/svg%3e`,vD=`data:image/svg+xml,%3c!--%20Copyright%202000-2022%20JetBrains%20s.r.o.%20and%20contributors.%20Use%20of%20this%20source%20code%20is%20governed%20by%20the%20Apache%202.0%20license.%20--%3e%3csvg%20width='16'%20height='16'%20viewBox='0%200%2016%2016'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20fill-rule='evenodd'%20clip-rule='evenodd'%20d='M12.5929%209.9438L12.5929%204.70001L13.7929%204.70002L13.7929%209.94379L15.0763%208.66037L15.9248%209.5089L13.1929%2012.2409L10.4609%209.5089L11.3095%208.66037L12.5929%209.9438Z'%20fill='%233574F0'/%3e%3cpath%20d='M0.5%204.70001H2.94558L4.65385%209.14463L4.76288%209.60155L4.85635%209.14463L6.51269%204.70001H8.98423V11.9692H7.14096V7.59732L7.17212%207.12482L5.34442%2011.9692H4.08269L2.31212%207.17155L2.34327%207.59732V11.9692H0.5V4.70001Z'%20fill='%233574F0'/%3e%3c/svg%3e`,yD=`data:image/svg+xml,%3c!--%20Copyright%202000-2022%20JetBrains%20s.r.o.%20and%20contributors.%20Use%20of%20this%20source%20code%20is%20governed%20by%20the%20Apache%202.0%20license.%20--%3e%3csvg%20width='16'%20height='16'%20viewBox='0%200%2016%2016'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20fill-rule='evenodd'%20clip-rule='evenodd'%20d='M12.5929%209.9438L12.5929%204.70001L13.7929%204.70002L13.7929%209.94379L15.0763%208.66037L15.9248%209.5089L13.1929%2012.2409L10.4609%209.5089L11.3095%208.66037L12.5929%209.9438Z'%20fill='%23548AF7'/%3e%3cpath%20d='M0.5%204.70001H2.94558L4.65385%209.14463L4.76288%209.60155L4.85635%209.14463L6.51269%204.70001H8.98423V11.9692H7.14096V7.59732L7.17212%207.12482L5.34442%2011.9692H4.08269L2.31212%207.17155L2.34327%207.59732V11.9692H0.5V4.70001Z'%20fill='%23548AF7'/%3e%3c/svg%3e`,bD=`data:image/svg+xml,%3c!--%20Copyright%202000-2022%20JetBrains%20s.r.o.%20and%20contributors.%20Use%20of%20this%20source%20code%20is%20governed%20by%20the%20Apache%202.0%20license.%20--%3e%3csvg%20width='16'%20height='16'%20viewBox='0%200%2016%2016'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3crect%20x='9.5'%20y='9.5'%20width='6'%20height='6'%20rx='1.5'%20fill='%23E7EFFD'%20stroke='%233574F0'/%3e%3cpath%20fill-rule='evenodd'%20clip-rule='evenodd'%20d='M1%203.86667C1%202.83574%201.7835%202%202.75%202H6.03823C6.29871%202%206.5489%202.10163%206.73559%202.28327L8.5%204L13%204C14.1046%204%2015%204.89543%2015%206V8.17071C14.6872%208.06015%2014.3506%208%2014%208H11C9.34315%208%208%209.34315%208%2011V14H2.75C1.7835%2014%201%2013.1643%201%2012.1333V3.86667Z'%20fill='%23EBECF0'/%3e%3cpath%20fill-rule='evenodd'%20clip-rule='evenodd'%20d='M7.80265%204.71673L8.09379%205H8.5H13C13.5523%205%2014%205.44772%2014%206V8C14.3506%208%2014.6872%208.06015%2015%208.17071V6C15%204.89543%2014.1046%204%2013%204L8.5%204L6.73559%202.28327C6.5489%202.10163%206.29871%202%206.03823%202H2.75C1.7835%202%201%202.83574%201%203.86667V12.1333C1%2013.1643%201.7835%2014%202.75%2014H8V13H2.75C2.3956%2013%202%2012.6738%202%2012.1333V3.86667C2%203.32624%202.3956%203%202.75%203H6.03823L7.80265%204.71673Z'%20fill='%236C707E'/%3e%3c/svg%3e`,xD=`data:image/svg+xml,%3c!--%20Copyright%202000-2022%20JetBrains%20s.r.o.%20and%20contributors.%20Use%20of%20this%20source%20code%20is%20governed%20by%20the%20Apache%202.0%20license.%20--%3e%3csvg%20width='16'%20height='16'%20viewBox='0%200%2016%2016'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3crect%20x='9.5'%20y='9.5'%20width='6'%20height='6'%20rx='1.5'%20fill='%2325324D'%20stroke='%23548AF7'/%3e%3cpath%20fill-rule='evenodd'%20clip-rule='evenodd'%20d='M1%203.86667C1%202.83574%201.7835%202%202.75%202H6.03823C6.29871%202%206.5489%202.10163%206.73559%202.28327L8.5%204L13%204C14.1046%204%2015%204.89543%2015%206V8.17071C14.6872%208.06015%2014.3506%208%2014%208H11C9.34315%208%208%209.34315%208%2011V14H2.75C1.7835%2014%201%2013.1643%201%2012.1333V3.86667Z'%20fill='%2343454A'/%3e%3cpath%20fill-rule='evenodd'%20clip-rule='evenodd'%20d='M7.80265%204.71673L8.09379%205H8.5H13C13.5523%205%2014%205.44772%2014%206V8C14.3506%208%2014.6872%208.06015%2015%208.17071V6C15%204.89543%2014.1046%204%2013%204L8.5%204L6.73559%202.28327C6.5489%202.10163%206.29871%202%206.03823%202H2.75C1.7835%202%201%202.83574%201%203.86667V12.1333C1%2013.1643%201.7835%2014%202.75%2014H8V13H2.75C2.3956%2013%202%2012.6738%202%2012.1333V3.86667C2%203.32624%202.3956%203%202.75%203H6.03823L7.80265%204.71673Z'%20fill='%23CED0D6'/%3e%3c/svg%3e`,SD=`data:image/svg+xml,%3c!--%20Copyright%202000-2022%20JetBrains%20s.r.o.%20and%20contributors.%20Use%20of%20this%20source%20code%20is%20governed%20by%20the%20Apache%202.0%20license.%20--%3e%3csvg%20width='16'%20height='16'%20viewBox='0%200%2016%2016'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20fill-rule='evenodd'%20clip-rule='evenodd'%20d='M1%203.86667C1%202.83574%201.73127%202%202.63333%202H6.1217C6.39413%202%206.65477%202.11115%206.84336%202.30775L8.46667%204H13C14.1046%204%2015%204.89543%2015%206V12.1333C15%2013.1643%2014.2687%2014%2013.3667%2014H2.63333C1.73127%2014%201%2013.1643%201%2012.1333V3.86667ZM6%2010C6.55228%2010%207%209.55228%207%209C7%208.44772%206.55228%208%206%208C5.44772%208%205%208.44772%205%209C5%209.55228%205.44772%2010%206%2010Z'%20fill='%23EBECF0'/%3e%3cpath%20fill-rule='evenodd'%20clip-rule='evenodd'%20d='M8.04022%205L6.1217%203H2.63333C2.40481%203%202%203.25841%202%203.86667V12.1333C2%2012.7416%202.40481%2013%202.63333%2013H13.3667C13.5952%2013%2014%2012.7416%2014%2012.1333V6C14%205.44771%2013.5523%205%2013%205H8.04022ZM8.46667%204L6.84336%202.30775C6.65477%202.11115%206.39413%202%206.1217%202H2.63333C1.73127%202%201%202.83574%201%203.86667V12.1333C1%2013.1643%201.73127%2014%202.63333%2014H13.3667C14.2687%2014%2015%2013.1643%2015%2012.1333V6C15%204.89543%2014.1046%204%2013%204H8.46667ZM4%209C4%207.89543%204.89543%207%206%207C7.10457%207%208%207.89543%208%209C8%2010.1046%207.10457%2011%206%2011C4.89543%2011%204%2010.1046%204%209ZM7%209C7%209.55228%206.55228%2010%206%2010C5.44772%2010%205%209.55228%205%209C5%208.44772%205.44772%208%206%208C6.55228%208%207%208.44772%207%209Z'%20fill='%236C707E'/%3e%3c/svg%3e`,CD=`data:image/svg+xml,%3c!--%20Copyright%202000-2022%20JetBrains%20s.r.o.%20and%20contributors.%20Use%20of%20this%20source%20code%20is%20governed%20by%20the%20Apache%202.0%20license.%20--%3e%3csvg%20width='16'%20height='16'%20viewBox='0%200%2016%2016'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20fill-rule='evenodd'%20clip-rule='evenodd'%20d='M1%203.86667C1%202.83574%201.73127%202%202.63333%202H6.1217C6.39413%202%206.65477%202.11115%206.84336%202.30775L8.46667%204H13C14.1046%204%2015%204.89543%2015%206V12.1333C15%2013.1643%2014.2687%2014%2013.3667%2014H2.63333C1.73127%2014%201%2013.1643%201%2012.1333V3.86667ZM6%2010C6.55228%2010%207%209.55228%207%209C7%208.44772%206.55228%208%206%208C5.44772%208%205%208.44772%205%209C5%209.55228%205.44772%2010%206%2010Z'%20fill='%2343454A'/%3e%3cpath%20fill-rule='evenodd'%20clip-rule='evenodd'%20d='M8.04022%205L6.1217%203H2.63333C2.40481%203%202%203.25841%202%203.86667V12.1333C2%2012.7416%202.40481%2013%202.63333%2013H13.3667C13.5952%2013%2014%2012.7416%2014%2012.1333V6C14%205.44771%2013.5523%205%2013%205H8.04022ZM8.46667%204L6.84336%202.30775C6.65477%202.11115%206.39413%202%206.1217%202H2.63333C1.73127%202%201%202.83574%201%203.86667V12.1333C1%2013.1643%201.73127%2014%202.63333%2014H13.3667C14.2687%2014%2015%2013.1643%2015%2012.1333V6C15%204.89543%2014.1046%204%2013%204H8.46667ZM4%209C4%207.89543%204.89543%207%206%207C7.10457%207%208%207.89543%208%209C8%2010.1046%207.10457%2011%206%2011C4.89543%2011%204%2010.1046%204%209ZM7%209C7%209.55228%206.55228%2010%206%2010C5.44772%2010%205%209.55228%205%209C5%208.44772%205.44772%208%206%208C6.55228%208%207%208.44772%207%209Z'%20fill='%23CED0D6'/%3e%3c/svg%3e`,wD=`/assets/properties-B3r0DjE7.svg`,TD=`/assets/properties_dark-DnHs7phT.svg`,ED=`data:image/svg+xml,%3c!--%20Copyright%202000-2024%20JetBrains%20s.r.o.%20and%20contributors.%20Use%20of%20this%20source%20code%20is%20governed%20by%20the%20Apache%202.0%20license.%20--%3e%3csvg%20width='16'%20height='16'%20viewBox='0%200%2016%2016'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20fill-rule='evenodd'%20clip-rule='evenodd'%20d='M8.00001%201C11%201%2011%202%2011%204L11%206.5C11%207.32843%2010.3284%208%209.5%208H6.5C5.11929%208%204%209.11929%204%2010.5V11C2%2011%201%2011%201%207.99999C1%204.99999%202%204.99998%204%204.99998L7.5%205C7.77614%205%208%204.77614%208%204.5C8%204.22386%207.77614%204%207.5%204H5.00001C5.00001%202%205.00001%201%208.00001%201ZM6.5%203C6.77614%203%207%202.77614%207%202.5C7%202.22386%206.77614%202%206.5%202C6.22386%202%206%202.22386%206%202.5C6%202.77614%206.22386%203%206.5%203Z'%20fill='%234682FA'/%3e%3cpath%20fill-rule='evenodd'%20clip-rule='evenodd'%20d='M12%205V6.5C12%207.88071%2010.8807%209%209.5%209H6.5C5.67157%209%205%209.67157%205%2010.5L5.00001%2012C4.99946%2014%205.00001%2015%208.00001%2015C11%2015%2011%2014%2011%2012L8.5%2012C8.22386%2012%208%2011.7761%208%2011.5C8%2011.2239%208.22386%2011%208.5%2011L12%2011C14%2011.0005%2015%2011%2015%207.99999C15%205.00002%2014%205.00001%2012%205ZM9.5%2014C9.77614%2014%2010%2013.7761%2010%2013.5C10%2013.2239%209.77614%2013%209.5%2013C9.22386%2013%209%2013.2239%209%2013.5C9%2013.7761%209.22386%2014%209.5%2014Z'%20fill='%23FFAF0F'/%3e%3c/svg%3e`,DD=`data:image/svg+xml,%3c!--%20Copyright%202000-2024%20JetBrains%20s.r.o.%20and%20contributors.%20Use%20of%20this%20source%20code%20is%20governed%20by%20the%20Apache%202.0%20license.%20--%3e%3csvg%20width='16'%20height='16'%20viewBox='0%200%2016%2016'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20fill-rule='evenodd'%20clip-rule='evenodd'%20d='M8.00001%201C11%201%2011%202%2011%204L11%206.5C11%207.32843%2010.3284%208%209.5%208H6.5C5.11929%208%204%209.11929%204%2010.5V11C2%2011%201%2011%201%207.99999C1%204.99999%202%204.99998%204%204.99998L7.5%205C7.77614%205%208%204.77614%208%204.5C8%204.22386%207.77614%204%207.5%204H5.00001C5.00001%202%205.00001%201%208.00001%201ZM6.5%203C6.77614%203%207%202.77614%207%202.5C7%202.22386%206.77614%202%206.5%202C6.22386%202%206%202.22386%206%202.5C6%202.77614%206.22386%203%206.5%203Z'%20fill='%23548AF7'/%3e%3cpath%20fill-rule='evenodd'%20clip-rule='evenodd'%20d='M12%205V6.5C12%207.88071%2010.8807%209%209.5%209H6.5C5.67157%209%205%209.67157%205%2010.5L5.00001%2012C4.99946%2014%205.00001%2015%208.00001%2015C11%2015%2011%2014%2011%2012L8.5%2012C8.22386%2012%208%2011.7761%208%2011.5C8%2011.2239%208.22386%2011%208.5%2011L12%2011C14%2011.0005%2015%2011%2015%207.99999C15%205.00002%2014%205.00001%2012%205ZM9.5%2014C9.77614%2014%2010%2013.7761%2010%2013.5C10%2013.2239%209.77614%2013%209.5%2013C9.22386%2013%209%2013.2239%209%2013.5C9%2013.7761%209.22386%2014%209.5%2014Z'%20fill='%23F2C55C'/%3e%3c/svg%3e`,OD=`data:image/svg+xml,%3c!--%20Copyright%202000-2022%20JetBrains%20s.r.o.%20and%20contributors.%20Use%20of%20this%20source%20code%20is%20governed%20by%20the%20Apache%202.0%20license.%20--%3e%3csvg%20width='16'%20height='16'%20viewBox='0%200%2016%2016'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3ccircle%20cx='8'%20cy='8'%20r='6.5'%20fill='%23E7EFFD'%20stroke='%233574F0'/%3e%3cpath%20d='M7.92995%208.405H9.02495L10.925%2011.5H9.77495L7.92995%208.405ZM5.69995%204.5H8.58495C9.04828%204.5%209.45328%204.58667%209.79995%204.76C10.15%204.93%2010.42%205.17167%2010.61%205.485C10.8%205.795%2010.895%206.15833%2010.895%206.575C10.895%206.98833%2010.7983%207.35333%2010.605%207.67C10.4116%207.98667%2010.1383%208.23167%209.78495%208.405C9.43162%208.575%209.01828%208.66%208.54495%208.66H6.69995V11.5H5.69995V4.5ZM8.55995%207.77C8.81995%207.77%209.04662%207.72167%209.23995%207.625C9.43328%207.52833%209.58328%207.39%209.68995%207.21C9.79662%207.03%209.84995%206.81833%209.84995%206.575C9.84995%206.335%209.79662%206.12667%209.68995%205.95C9.58328%205.77%209.43328%205.63167%209.23995%205.535C9.04662%205.43833%208.81995%205.39%208.55995%205.39H6.69995V7.77H8.55995Z'%20fill='%233574F0'/%3e%3c/svg%3e`,kD=`data:image/svg+xml,%3c!--%20Copyright%202000-2022%20JetBrains%20s.r.o.%20and%20contributors.%20Use%20of%20this%20source%20code%20is%20governed%20by%20the%20Apache%202.0%20license.%20--%3e%3csvg%20width='16'%20height='16'%20viewBox='0%200%2016%2016'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3ccircle%20cx='8'%20cy='8'%20r='6.5'%20fill='%2325324D'%20stroke='%23548AF7'/%3e%3cpath%20d='M7.92995%208.405H9.02495L10.925%2011.5H9.77495L7.92995%208.405ZM5.69995%204.5H8.58495C9.04828%204.5%209.45328%204.58667%209.79995%204.76C10.15%204.93%2010.42%205.17167%2010.61%205.485C10.8%205.795%2010.895%206.15833%2010.895%206.575C10.895%206.98833%2010.7983%207.35333%2010.605%207.67C10.4116%207.98667%2010.1383%208.23167%209.78495%208.405C9.43162%208.575%209.01828%208.66%208.54495%208.66H6.69995V11.5H5.69995V4.5ZM8.55995%207.77C8.81995%207.77%209.04662%207.72167%209.23995%207.625C9.43328%207.52833%209.58328%207.39%209.68995%207.21C9.79662%207.03%209.84995%206.81833%209.84995%206.575C9.84995%206.335%209.79662%206.12667%209.68995%205.95C9.58328%205.77%209.43328%205.63167%209.23995%205.535C9.04662%205.43833%208.81995%205.39%208.55995%205.39H6.69995V7.77H8.55995Z'%20fill='%23548AF7'/%3e%3c/svg%3e`,AD=`data:image/svg+xml,%3c!--%20Copyright%202000-2022%20JetBrains%20s.r.o.%20and%20contributors.%20Use%20of%20this%20source%20code%20is%20governed%20by%20the%20Apache%202.0%20license.%20--%3e%3csvg%20width='16'%20height='16'%20viewBox='0%200%2016%2016'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3crect%20x='1.5'%20y='2.5'%20width='13'%20height='11'%20rx='1.5'%20fill='%23EBECF0'%20stroke='%236C707E'/%3e%3cpath%20d='M4%206L6%208L4%2010'%20stroke='%236C707E'%20stroke-width='1.2'/%3e%3cpath%20d='M7.5%2010.5H11.5'%20stroke='%236C707E'%20stroke-width='1.2'/%3e%3c/svg%3e`,jD=`data:image/svg+xml,%3c!--%20Copyright%202000-2022%20JetBrains%20s.r.o.%20and%20contributors.%20Use%20of%20this%20source%20code%20is%20governed%20by%20the%20Apache%202.0%20license.%20--%3e%3csvg%20width='16'%20height='16'%20viewBox='0%200%2016%2016'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3crect%20x='1.5'%20y='2.5'%20width='13'%20height='11'%20rx='1.5'%20fill='%2343454A'%20stroke='%23CED0D6'/%3e%3cpath%20d='M4%206L6%208L4%2010'%20stroke='%23CED0D6'%20stroke-width='1.2'/%3e%3cpath%20d='M7.5%2010.5H11.5'%20stroke='%23CED0D6'%20stroke-width='1.2'/%3e%3c/svg%3e`,MD=`data:image/svg+xml,%3c!--%20Copyright%202000-2022%20JetBrains%20s.r.o.%20and%20contributors.%20Use%20of%20this%20source%20code%20is%20governed%20by%20the%20Apache%202.0%20license.%20--%3e%3csvg%20width='16'%20height='16'%20viewBox='0%200%2016%2016'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3crect%20x='2'%20y='12'%20width='8'%20height='1'%20rx='0.5'%20fill='%236C707E'/%3e%3crect%20x='2'%20y='6'%20width='8'%20height='1'%20rx='0.5'%20fill='%236C707E'/%3e%3crect%20x='2'%20y='9'%20width='12'%20height='1'%20rx='0.5'%20fill='%236C707E'/%3e%3crect%20x='2'%20y='3'%20width='12'%20height='1'%20rx='0.5'%20fill='%236C707E'/%3e%3c/svg%3e`,ND=`data:image/svg+xml,%3c!--%20Copyright%202000-2022%20JetBrains%20s.r.o.%20and%20contributors.%20Use%20of%20this%20source%20code%20is%20governed%20by%20the%20Apache%202.0%20license.%20--%3e%3csvg%20width='16'%20height='16'%20viewBox='0%200%2016%2016'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3crect%20x='2'%20y='12'%20width='8'%20height='1'%20rx='0.5'%20fill='%23CED0D6'/%3e%3crect%20x='2'%20y='6'%20width='8'%20height='1'%20rx='0.5'%20fill='%23CED0D6'/%3e%3crect%20x='2'%20y='9'%20width='12'%20height='1'%20rx='0.5'%20fill='%23CED0D6'/%3e%3crect%20x='2'%20y='3'%20width='12'%20height='1'%20rx='0.5'%20fill='%23CED0D6'/%3e%3c/svg%3e`,PD=`data:image/svg+xml,%3c!--%20Copyright%202000-2023%20JetBrains%20s.r.o.%20and%20contributors.%20Use%20of%20this%20source%20code%20is%20governed%20by%20the%20Apache%202.0%20license.%20--%3e%3csvg%20width='16'%20height='16'%20viewBox='0%200%2016%2016'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='M14%204C14%202.89543%2013.1046%202%2012%202H4C2.89543%202%202%202.89543%202%204V12C2%2013.1046%202.89543%2014%204%2014H12C13.1046%2014%2014%2013.1046%2014%2012V4Z'%20fill='%233574F0'/%3e%3cpath%20d='M3.13501%205.99999H7.87171V6.99999H6V12H5V6.99999H3.13501V5.99999Z'%20fill='white'/%3e%3cpath%20d='M10.6833%2012.0902C10.2587%2012.0902%209.8825%2012.0133%209.55475%2011.8594C9.227%2011.7026%208.9705%2011.486%208.78525%2011.2096C8.6%2010.9303%208.50595%2010.6111%208.5031%2010.252H9.51627C9.51627%2010.4401%209.56615%2010.6082%209.6659%2010.7564C9.76565%2010.9046%209.90387%2011.02%2010.0806%2011.1027C10.2601%2011.1825%2010.4653%2011.2224%2010.6962%2011.2224C10.9213%2011.2224%2011.1194%2011.1853%2011.2904%2011.1112C11.4614%2011.0371%2011.5925%2010.9331%2011.6837%2010.7992C11.7777%2010.6624%2011.8248%2010.5056%2011.8248%2010.3289C11.8248%2010.1066%2011.7578%209.91567%2011.6238%209.75607C11.4899%209.59362%2011.3118%209.49387%2011.0895%209.45682L10.0763%209.28582C9.7856%209.23452%209.53337%209.13192%209.31962%208.97802C9.10587%208.82412%208.94057%208.63175%208.82372%208.4009C8.70972%208.1672%208.65272%207.91212%208.65272%207.63567C8.65272%207.30507%208.73822%207.00867%208.90922%206.74647C9.08307%206.48142%209.3239%206.2748%209.6317%206.1266C9.9395%205.97555%2010.2872%205.90002%2010.6748%205.90002C11.0709%205.90002%2011.4229%205.9727%2011.7307%206.11805C12.0414%206.2634%2012.2836%206.46575%2012.4575%206.7251C12.6313%206.98445%2012.7197%207.28085%2012.7225%207.6143H11.7093C11.7093%207.45185%2011.6666%207.3065%2011.5811%207.17825C11.4956%207.04715%2011.3759%206.94597%2011.222%206.87472C11.0681%206.80347%2010.89%206.76785%2010.6876%206.76785C10.4853%206.76785%2010.3071%206.80205%2010.1532%206.87045C9.99935%206.93885%209.87965%207.03575%209.79415%207.16115C9.70865%207.28655%209.6659%207.4319%209.6659%207.5972C9.6659%207.791%209.7286%207.95915%209.854%208.10165C9.9794%208.2413%2010.1433%208.32822%2010.3456%208.36242L11.3417%208.52487C11.6352%208.57617%2011.896%208.6859%2012.124%208.85405C12.3549%209.0222%2012.533%209.23167%2012.6584%209.48247C12.7838%209.73327%2012.8465%209.99975%2012.8465%2010.2819C12.8465%2010.6239%2012.7553%2010.9331%2012.5729%2011.2096C12.3905%2011.4832%2012.1354%2011.6983%2011.8077%2011.8551C11.4799%2012.0118%2011.1051%2012.0902%2010.6833%2012.0902Z'%20fill='white'/%3e%3c/svg%3e`,FD=`data:image/svg+xml,%3c!--%20Copyright%202000-2023%20JetBrains%20s.r.o.%20and%20contributors.%20Use%20of%20this%20source%20code%20is%20governed%20by%20the%20Apache%202.0%20license.%20--%3e%3csvg%20width='16'%20height='16'%20viewBox='0%200%2016%2016'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='M14%204C14%202.89543%2013.1046%202%2012%202H4C2.89543%202%202%202.89543%202%204V12C2%2013.1046%202.89543%2014%204%2014H12C13.1046%2014%2014%2013.1046%2014%2012V4Z'%20fill='%23548AF7'/%3e%3cpath%20d='M3.13501%205.99999H7.87171V6.99999H6V12H5V6.99999H3.13501V5.99999Z'%20fill='white'/%3e%3cpath%20d='M10.6833%2012.0902C10.2587%2012.0902%209.8825%2012.0133%209.55475%2011.8594C9.227%2011.7026%208.9705%2011.486%208.78525%2011.2096C8.6%2010.9303%208.50595%2010.6111%208.5031%2010.252H9.51627C9.51627%2010.4401%209.56615%2010.6082%209.6659%2010.7564C9.76565%2010.9046%209.90387%2011.02%2010.0806%2011.1027C10.2601%2011.1825%2010.4653%2011.2224%2010.6962%2011.2224C10.9213%2011.2224%2011.1194%2011.1853%2011.2904%2011.1112C11.4614%2011.0371%2011.5925%2010.9331%2011.6837%2010.7992C11.7777%2010.6624%2011.8248%2010.5056%2011.8248%2010.3289C11.8248%2010.1066%2011.7578%209.91567%2011.6238%209.75607C11.4899%209.59362%2011.3118%209.49387%2011.0895%209.45682L10.0763%209.28582C9.7856%209.23452%209.53337%209.13192%209.31962%208.97802C9.10587%208.82412%208.94057%208.63175%208.82372%208.4009C8.70972%208.1672%208.65272%207.91212%208.65272%207.63567C8.65272%207.30507%208.73822%207.00867%208.90922%206.74647C9.08307%206.48142%209.3239%206.2748%209.6317%206.1266C9.9395%205.97555%2010.2872%205.90002%2010.6748%205.90002C11.0709%205.90002%2011.4229%205.9727%2011.7307%206.11805C12.0414%206.2634%2012.2836%206.46575%2012.4575%206.7251C12.6313%206.98445%2012.7197%207.28085%2012.7225%207.6143H11.7093C11.7093%207.45185%2011.6666%207.3065%2011.5811%207.17825C11.4956%207.04715%2011.3759%206.94597%2011.222%206.87472C11.0681%206.80347%2010.89%206.76785%2010.6876%206.76785C10.4853%206.76785%2010.3071%206.80205%2010.1532%206.87045C9.99935%206.93885%209.87965%207.03575%209.79415%207.16115C9.70865%207.28655%209.6659%207.4319%209.6659%207.5972C9.6659%207.791%209.7286%207.95915%209.854%208.10165C9.9794%208.2413%2010.1433%208.32822%2010.3456%208.36242L11.3417%208.52487C11.6352%208.57617%2011.896%208.6859%2012.124%208.85405C12.3549%209.0222%2012.533%209.23167%2012.6584%209.48247C12.7838%209.73327%2012.8465%209.99975%2012.8465%2010.2819C12.8465%2010.6239%2012.7553%2010.9331%2012.5729%2011.2096C12.3905%2011.4832%2012.1354%2011.6983%2011.8077%2011.8551C11.4799%2012.0118%2011.1051%2012.0902%2010.6833%2012.0902Z'%20fill='white'/%3e%3c/svg%3e`,ID=`data:image/svg+xml,%3c!--%20Copyright%202000-2022%20JetBrains%20s.r.o.%20and%20contributors.%20Use%20of%20this%20source%20code%20is%20governed%20by%20the%20Apache%202.0%20license.%20--%3e%3csvg%20width='16'%20height='16'%20viewBox='0%200%2016%2016'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3crect%20x='2.5'%20y='2.5'%20width='11'%20height='11'%20rx='1.5'%20fill='%23EBECF0'%20stroke='%236C707E'/%3e%3cpath%20d='M7.32546%209.03C7.32546%208.80334%207.3638%208.605%207.44046%208.435C7.52046%208.26167%207.61546%208.115%207.72546%207.995C7.8388%207.87167%207.98546%207.73167%208.16546%207.575C8.32546%207.435%208.45046%207.31834%208.54046%207.225C8.6338%207.12834%208.71046%207.01667%208.77046%206.89C8.8338%206.76334%208.86546%206.62167%208.86546%206.465C8.86546%206.215%208.7888%206.01167%208.63546%205.855C8.48213%205.695%208.2788%205.615%208.02546%205.615C7.74546%205.615%207.52046%205.705%207.35046%205.885C7.1838%206.065%207.10213%206.3%207.10546%206.59H5.72546C5.72546%206.13%205.8188%205.735%206.00546%205.405C6.19213%205.07167%206.4588%204.81834%206.80546%204.645C7.15546%204.46834%207.56713%204.38%208.04046%204.38C8.49713%204.38%208.8938%204.46167%209.23046%204.625C9.56713%204.78834%209.82546%205.02%2010.0055%205.32C10.1855%205.61667%2010.2738%205.96667%2010.2705%206.37C10.2705%206.67334%2010.2221%206.935%2010.1255%207.155C10.0288%207.375%209.9138%207.555%209.78046%207.695C9.64713%207.835%209.47213%207.99334%209.25546%208.17C9.10546%208.29%208.98713%208.39%208.90046%208.47001C8.81713%208.55%208.74713%208.64167%208.69046%208.74501C8.63713%208.84501%208.61046%208.95667%208.61046%209.08V9.255H7.32546V9.03ZM8.74046%2011.5H7.24046V10H8.74046V11.5Z'%20fill='%236C707E'/%3e%3c/svg%3e`,LD=`data:image/svg+xml,%3c!--%20Copyright%202000-2022%20JetBrains%20s.r.o.%20and%20contributors.%20Use%20of%20this%20source%20code%20is%20governed%20by%20the%20Apache%202.0%20license.%20--%3e%3csvg%20width='16'%20height='16'%20viewBox='0%200%2016%2016'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3crect%20x='2.5'%20y='2.5'%20width='11'%20height='11'%20rx='1.5'%20fill='%2343454A'%20stroke='%23CED0D6'/%3e%3cpath%20d='M7.32546%209.03C7.32546%208.80334%207.3638%208.605%207.44046%208.435C7.52046%208.26167%207.61546%208.115%207.72546%207.995C7.8388%207.87167%207.98546%207.73167%208.16546%207.575C8.32546%207.435%208.45046%207.31834%208.54046%207.225C8.6338%207.12834%208.71046%207.01667%208.77046%206.89C8.8338%206.76334%208.86546%206.62167%208.86546%206.465C8.86546%206.215%208.7888%206.01167%208.63546%205.855C8.48213%205.695%208.2788%205.615%208.02546%205.615C7.74546%205.615%207.52046%205.705%207.35046%205.885C7.1838%206.065%207.10213%206.3%207.10546%206.59H5.72546C5.72546%206.13%205.8188%205.735%206.00546%205.405C6.19213%205.07167%206.4588%204.81834%206.80546%204.645C7.15546%204.46834%207.56713%204.38%208.04046%204.38C8.49713%204.38%208.8938%204.46167%209.23046%204.625C9.56713%204.78834%209.82546%205.02%2010.0055%205.32C10.1855%205.61667%2010.2738%205.96667%2010.2705%206.37C10.2705%206.67334%2010.2221%206.935%2010.1255%207.155C10.0288%207.375%209.9138%207.555%209.78046%207.695C9.64713%207.835%209.47213%207.99334%209.25546%208.17C9.10546%208.29%208.98713%208.39%208.90046%208.47001C8.81713%208.55%208.74713%208.64167%208.69046%208.74501C8.63713%208.84501%208.61046%208.95667%208.61046%209.08V9.255H7.32546V9.03ZM8.74046%2011.5H7.24046V10H8.74046V11.5Z'%20fill='%23CED0D6'/%3e%3c/svg%3e`,RD=`data:image/svg+xml,%3c!--%20Copyright%202000-2023%20JetBrains%20s.r.o.%20and%20contributors.%20Use%20of%20this%20source%20code%20is%20governed%20by%20the%20Apache%202.0%20license.%20--%3e%3csvg%20width='16'%20height='16'%20viewBox='0%200%2016%2016'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20fill-rule='evenodd'%20clip-rule='evenodd'%20d='M10.0775%202.44037C10.1656%202.12093%209.97809%201.79054%209.65866%201.70242C9.33922%201.6143%209.00882%201.80182%208.9207%202.12126L5.76529%2013.5596C5.67717%2013.8791%205.86469%2014.2095%206.18412%2014.2976C6.50356%2014.3857%206.83396%2014.1982%206.92208%2013.8788L10.0775%202.44037ZM5.41281%204.66699C5.61982%204.92575%205.57786%205.30332%205.31911%205.51033L1.96049%208.19723L5.31911%2010.8841C5.57786%2011.0911%205.61982%2011.4687%205.41281%2011.7275C5.20581%2011.9862%204.82823%2012.0282%204.56947%2011.8212L0.625202%208.66575L0.0395508%208.19723L0.625202%207.7287L4.56947%204.57329C4.82823%204.36628%205.20581%204.40823%205.41281%204.66699ZM10.5872%2011.7275C10.3802%2011.4687%2010.4222%2011.0911%2010.6809%2010.8841L14.0395%208.19725L10.6809%205.51035C10.4222%205.30334%2010.3802%204.92577%2010.5872%204.66701C10.7942%204.40825%2011.1718%204.3663%2011.4305%204.57331L15.3748%207.72872L15.9605%208.19725L15.3748%208.66577L11.4305%2011.8212C11.1718%2012.0282%2010.7942%2011.9862%2010.5872%2011.7275Z'%20fill='%23E66D17'/%3e%3c/svg%3e`,zD=`data:image/svg+xml,%3c!--%20Copyright%202000-2023%20JetBrains%20s.r.o.%20and%20contributors.%20Use%20of%20this%20source%20code%20is%20governed%20by%20the%20Apache%202.0%20license.%20--%3e%3csvg%20width='16'%20height='16'%20viewBox='0%200%2016%2016'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20fill-rule='evenodd'%20clip-rule='evenodd'%20d='M10.0775%202.44037C10.1656%202.12093%209.97809%201.79054%209.65866%201.70242C9.33922%201.6143%209.00882%201.80182%208.9207%202.12126L5.76529%2013.5596C5.67717%2013.8791%205.86469%2014.2095%206.18412%2014.2976C6.50356%2014.3857%206.83396%2014.1982%206.92208%2013.8788L10.0775%202.44037ZM5.41281%204.66699C5.61982%204.92575%205.57786%205.30332%205.31911%205.51033L1.96049%208.19723L5.31911%2010.8841C5.57786%2011.0911%205.61982%2011.4687%205.41281%2011.7275C5.20581%2011.9862%204.82823%2012.0282%204.56947%2011.8212L0.625202%208.66575L0.0395508%208.19723L0.625202%207.7287L4.56947%204.57329C4.82823%204.36628%205.20581%204.40823%205.41281%204.66699ZM10.5872%2011.7275C10.3802%2011.4687%2010.4222%2011.0911%2010.6809%2010.8841L14.0395%208.19725L10.6809%205.51035C10.4222%205.30334%2010.3802%204.92577%2010.5872%204.66701C10.7942%204.40825%2011.1718%204.3663%2011.4305%204.57331L15.3748%207.72872L15.9605%208.19725L15.3748%208.66577L11.4305%2011.8212C11.1718%2012.0282%2010.7942%2011.9862%2010.5872%2011.7275Z'%20fill='%23C77D55'/%3e%3c/svg%3e`,BD=`data:image/svg+xml,%3c!--%20Copyright%202000-2025%20JetBrains%20s.r.o.%20and%20contributors.%20Use%20of%20this%20source%20code%20is%20governed%20by%20the%20Apache%202.0%20license.%20--%3e%3csvg%20width='16'%20height='16'%20viewBox='0%200%2016%2016'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='M11%202C11.5523%202%2012%202.44772%2012%203V9H11C10.4477%209%2010%209.44772%2010%2010V14H5C4.44772%2014%204%2013.5523%204%2013V6H6C7.10457%206%208%205.10457%208%204V2H11Z'%20fill='%23FFF7F7'/%3e%3cpath%20d='M7%204C7%204.06893%206.99277%204.13617%206.97949%204.20117C6.88625%204.65686%206.48325%205%206%205H4.41406L7%202.41406V4Z'%20fill='%23FFF7F7'/%3e%3cpath%20fill-rule='evenodd'%20clip-rule='evenodd'%20d='M11%201C12.1046%201%2013%201.89543%2013%203V9H12V3C12%202.44772%2011.5523%202%2011%202H8V4C8%205.10457%207.10457%206%206%206H4V13C4%2013.5523%204.44772%2014%205%2014H10V15H5C3.89543%2015%203%2014.1046%203%2013V5.41406C3.00004%205.1489%203.10547%204.89453%203.29297%204.70703L6.70703%201.29297C6.89453%201.10547%207.1489%201.00004%207.41406%201H11ZM4.41406%205H6C6.55228%205%207%204.55228%207%204V2.41406L4.41406%205Z'%20fill='%23DB3B4B'/%3e%3cpath%20d='M12.4018%2016V13.827L10.647%2010.014H11.7212L12.656%2012.0886C12.727%2012.2526%2012.7872%2012.4139%2012.8364%2012.5724C12.8856%2012.7309%2012.9184%2012.8539%2012.9348%2012.9414C12.9566%2012.8539%2012.9894%2012.7309%2013.0332%2012.5724C13.0824%2012.4139%2013.1425%2012.2526%2013.2136%2012.0886L14.1238%2010.014H15.1898L13.435%2013.827V16H12.4018Z'%20fill='%236C707E'/%3e%3c/svg%3e`,VD=`data:image/svg+xml,%3c!--%20Copyright%202000-2025%20JetBrains%20s.r.o.%20and%20contributors.%20Use%20of%20this%20source%20code%20is%20governed%20by%20the%20Apache%202.0%20license.%20--%3e%3csvg%20width='16'%20height='16'%20viewBox='0%200%2016%2016'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='M11%202C11.5523%202%2012%202.44772%2012%203V9H11C10.4477%209%2010%209.44772%2010%2010V14H5C4.44772%2014%204%2013.5523%204%2013V6H6C7.10457%206%208%205.10457%208%204V2H11Z'%20fill='%23402929'/%3e%3cpath%20d='M7%204C7%204.06893%206.99277%204.13617%206.97949%204.20117C6.88625%204.65686%206.48325%205%206%205H4.41406L7%202.41406V4Z'%20fill='%23402929'/%3e%3cpath%20fill-rule='evenodd'%20clip-rule='evenodd'%20d='M11%201C12.1046%201%2013%201.89543%2013%203V9H12V3C12%202.44772%2011.5523%202%2011%202H8V4C8%205.10457%207.10457%206%206%206H4V13C4%2013.5523%204.44772%2014%205%2014H10V15H5C3.89543%2015%203%2014.1046%203%2013V5.41406C3.00004%205.1489%203.10547%204.89453%203.29297%204.70703L6.70703%201.29297C6.89453%201.10547%207.1489%201.00004%207.41406%201H11ZM4.41406%205H6C6.55228%205%207%204.55228%207%204V2.41406L4.41406%205Z'%20fill='%23DB5C5C'/%3e%3cpath%20d='M12.4018%2016V13.827L10.647%2010.014H11.7212L12.656%2012.0886C12.727%2012.2526%2012.7872%2012.4139%2012.8364%2012.5724C12.8856%2012.7309%2012.9184%2012.8539%2012.9348%2012.9414C12.9566%2012.8539%2012.9894%2012.7309%2013.0332%2012.5724C13.0824%2012.4139%2013.1425%2012.2526%2013.2136%2012.0886L14.1238%2010.014H15.1898L13.435%2013.827V16H12.4018Z'%20fill='%23CED0D6'/%3e%3c/svg%3e`,HD={kt:[`kotlin`,`Kotlin`],kts:[`kotlin`,`Kotlin`],ts:[`typeScript`,`TypeScript`],tsx:[`typeScript`,`TypeScript`],mts:[`typeScript`,`TypeScript`],cts:[`typeScript`,`TypeScript`],js:[`javaScript`,`JavaScript`],jsx:[`javaScript`,`JavaScript`],mjs:[`javaScript`,`JavaScript`],cjs:[`javaScript`,`JavaScript`],json:[`json`,`JSON`],jsonc:[`json`,`JSON`],yml:[`yaml`,`YAML`],yaml:[`yaml`,`YAML`],md:[`markdown`,`Markdown`],xml:[`xml`,`XML`],properties:[`properties`,`Properties`],sh:[`shell`,`Shell script`],bash:[`shell`,`Shell script`],py:[`python`,`Python`],pyi:[`python`,`Python`],txt:[`text`,`Text`]},UD=(e,t)=>{let n=e.slice(e.lastIndexOf(`/`)+1).toLowerCase();if(n.endsWith(`.java`))return t===`deleted`?{icon:`java`,testMark:!1,label:`Java file`}:ul(e)?{icon:`class`,testMark:!0,label:`Java test class`}:{icon:`class`,testMark:!1,label:`Java class`};if(/\/meta-inf\/services\//i.test(`/${e}`))return{icon:`text`,testMark:!1,label:`Text`};let[r,i]=HD[/\.([a-z0-9]+)$/.exec(n)?.[1]??``]??[`unknown`,`File`];return{icon:r,testMark:!1,label:i}},WD=/^[a-z][a-z0-9_]*(\.[a-z][a-z0-9_]*)+$/,GD=/(^|\/)src\/(main|test)\/(java|kotlin)\/./,KD=(e,t)=>{if(/(^|\/)META-INF(\/|$)/.test(e))return`folder`;let n=e.split(`/`),r=e=>{let r=`${n.slice(0,e+1).join(`/`)}/src/`;return WD.test(n[e]??``)&&t.some(e=>e.startsWith(r))};return r(n.length-1)?`module`:GD.test(e)||n.slice(0,-1).some((e,t)=>r(t))?`package`:`folder`},qD=Object.assign({"./icons/class.svg":QE,"./icons/classAbstract.svg":$E,"./icons/classAbstract_dark.svg":eD,"./icons/class_dark.svg":tD,"./icons/enum.svg":nD,"./icons/enum_dark.svg":rD,"./icons/folder.svg":iD,"./icons/folder_dark.svg":aD,"./icons/interface.svg":oD,"./icons/interface_dark.svg":sD,"./icons/java.svg":cD,"./icons/javaScript.svg":lD,"./icons/javaScript_dark.svg":uD,"./icons/java_dark.svg":dD,"./icons/json.svg":fD,"./icons/json_dark.svg":pD,"./icons/junitTestMark.svg":mD,"./icons/junitTestMark_dark.svg":hD,"./icons/kotlin.svg":gD,"./icons/kotlin_dark.svg":_D,"./icons/markdown.svg":vD,"./icons/markdown_dark.svg":yD,"./icons/module.svg":bD,"./icons/module_dark.svg":xD,"./icons/package.svg":SD,"./icons/package_dark.svg":CD,"./icons/properties.svg":wD,"./icons/properties_dark.svg":TD,"./icons/python.svg":ED,"./icons/python_dark.svg":DD,"./icons/record.svg":OD,"./icons/record_dark.svg":kD,"./icons/shell.svg":AD,"./icons/shell_dark.svg":jD,"./icons/text.svg":MD,"./icons/text_dark.svg":ND,"./icons/typeScript.svg":PD,"./icons/typeScript_dark.svg":FD,"./icons/unknown.svg":ID,"./icons/unknown_dark.svg":LD,"./icons/xml.svg":RD,"./icons/xml_dark.svg":zD,"./icons/yaml.svg":BD,"./icons/yaml_dark.svg":VD}),JD=(e,t)=>qD[`./icons/${e}${t?`_dark`:``}.svg`]??``,YD=({name:e,className:t})=>(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(`img`,{src:JD(e,!1),alt:``,draggable:!1,className:X(`block size-4 dark:hidden`,t)}),(0,J.jsx)(`img`,{src:JD(e,!0),alt:``,draggable:!1,className:X(`hidden size-4 dark:block`,t)})]}),XD=({path:e,status:t,className:n})=>{let r=UD(e,t);return(0,J.jsxs)(`span`,{"aria-hidden":`true`,"data-icon":r.icon,...r.testMark?{"data-test-mark":``}:{},className:X(`relative inline-block size-4 shrink-0`,n),children:[(0,J.jsx)(YD,{name:r.icon}),r.testMark&&(0,J.jsx)(YD,{name:`junitTestMark`,className:`absolute inset-0`})]})},ZD=({kind:e})=>(0,J.jsx)(`span`,{"aria-hidden":`true`,"data-icon":e,className:`inline-block size-4 shrink-0`,children:(0,J.jsx)(YD,{name:e})}),QD=({path:e,name:t})=>{let n=e.lastIndexOf(`/`)+1;return(0,J.jsxs)(J.Fragment,{children:[n>0&&(0,J.jsx)(`span`,{className:`text-muted-foreground`,children:e.slice(0,n)}),(0,J.jsx)(`span`,{"data-slot":`file-name`,className:X(`font-medium`,t),children:e.slice(n)})]})},$D=({file:e,status:t,className:n})=>{let r=t===void 0?null:qE[t],i=r?.kind===`mark`?r:null;return(0,J.jsxs)(`span`,{"data-slot":`file-path`,className:X(`min-w-0 break-all font-mono text-code`,n),children:[t!==void 0&&(0,J.jsx)(XD,{path:e.path,status:t,className:`mr-1 align-[-3px]`}),e.oldPath!==null&&e.oldPath!==e.path?(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(`span`,{className:`text-muted-foreground`,children:e.oldPath}),` `,(0,J.jsx)(`span`,{"aria-hidden":`true`,children:`→`}),(0,J.jsx)(`span`,{className:`sr-only`,children:`renamed to`}),` `,(0,J.jsx)(QD,{path:e.path,name:i?.name})]}):(0,J.jsx)(QD,{path:e.path,name:i?.name}),i!==null&&(0,J.jsxs)(`span`,{className:`sr-only`,children:[`, `,i.label]})]})},eO=({status:e})=>{let t=qE[e];return t?.kind===`chip`?(0,J.jsx)(`span`,{"data-slot":`file-status`,className:X(`shrink-0 rounded-full border px-1.5 text-caption font-medium leading-4`,t.className),children:t.label}):null},tO=(e,t)=>`${e} ${t}${e===1?``:`s`}`,nO=({callers:e,named:t})=>{let[n,r]=(0,q.useState)(!1),i=(0,q.useId)(),{uses:a,more:o}=e,s=a.filter(e=>ul(e.path)).length,c=a.length-s,l=`${[...c>0?[tO(c,`place`)]:[],...s>0?[tO(s,`test`)]:[]].join(` and `)}${o>0?`, and ${o} more`:``}`;return(0,J.jsxs)(`div`,{"data-slot":`unchanged-uses`,className:`border-b bg-surface-subtle px-3 py-1.5`,children:[(0,J.jsx)(`p`,{children:(0,J.jsxs)(`button`,{type:`button`,"aria-expanded":n,"aria-controls":i,onClick:()=>r(!n),className:`min-h-6 rounded-sm text-primary underline-offset-2 hover:underline`,children:[t&&(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(`code`,{className:`font-mono text-code-compact`,children:e.symbol}),` `]}),t?`used`:`Used`,` unchanged in `,l]})}),n&&(0,J.jsxs)(`ul`,{id:i,className:`mt-1.5 flex flex-col gap-2`,children:[a.map(e=>(0,J.jsxs)(`li`,{"data-slot":`unchanged-use`,children:[(0,J.jsxs)(`p`,{"data-slot":`unchanged-place`,className:`font-mono text-code-compact text-muted-foreground`,children:[(0,J.jsx)(`span`,{className:`text-foreground`,children:e.path}),`:`,e.line,e.use===`type`&&(0,J.jsx)(`span`,{children:` type`})]}),(0,J.jsx)(`pre`,{className:`overflow-x-auto rounded-md border bg-background py-1 font-mono text-code-compact`,children:e.excerpt.lines.map((t,n)=>{let r=e.excerpt.start+n,i=r===e.line;return(0,J.jsxs)(`span`,{"data-slot":`unchanged-line`,"data-used":i||void 0,className:X(`block pr-3`,i&&`bg-diff-hunk-bg text-diff-hunk-fg`),children:[(0,J.jsx)(`span`,{className:`tabular inline-block w-12 select-none pr-3 text-right text-diff-gutter-fg`,children:r}),t]},r)})})]},`${e.path}:${e.line}`)),o>0&&(0,J.jsxs)(`li`,{className:`text-muted-foreground`,children:[`and `,o,` more`]})]})]})};function rO(e){return Iv(e.defaultTagName??`div`,e,e)}var iO=Kv(`group/badge inline-flex h-5 w-fit shrink-0 items-center justify-center gap-1 overflow-hidden rounded-full border border-transparent px-2 py-0.5 text-caption font-medium whitespace-nowrap transition-all has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 aria-invalid:border-destructive aria-invalid:ring-destructive/20 [&>svg]:pointer-events-none [&>svg]:size-3!`,{variants:{variant:{default:`bg-primary text-primary-foreground [a]:hover:bg-primary/80`,secondary:`bg-secondary text-secondary-foreground [a]:hover:bg-secondary/80`,destructive:`bg-destructive/10 text-destructive focus-visible:ring-destructive/20 [a]:hover:bg-destructive/20`,outline:`border-border text-foreground [a]:hover:bg-muted [a]:hover:text-muted-foreground`,ghost:`hover:bg-muted hover:text-muted-foreground`,link:`text-primary underline-offset-4 hover:underline`}},defaultVariants:{variant:`default`}});function aO({className:e,variant:t=`default`,render:n,...r}){return rO({defaultTagName:`span`,props:Q_({className:X(iO({variant:t}),e)},r),render:n,state:{slot:`badge`,variant:t}})}function oO({status:e,label:t=e.label,className:n}){return(0,J.jsxs)(aO,{variant:`outline`,className:X(e.className,n),children:[(0,J.jsx)(`span`,{"aria-hidden":`true`,children:e.glyph}),t]})}function sO({controlled:e,default:t,name:n,state:r=`value`}){let{current:i}=q.useRef(e!==void 0),[a,o]=q.useState(()=>t);return[i&&e!==void 0?e:a,q.useCallback(e=>{i||o(e)},[])]}var cO=q.createContext({register:()=>{},unregister:()=>{},subscribeMapChange:()=>()=>{},nextIndexRef:{current:0}});function lO(){return q.useContext(cO)}function uO(e){let{children:t,elementsRef:n,labelsRef:r,onMapChange:i}=e,a=Z(i),[,o]=q.useState(0),s=G_(fO).current,c=G_(dO).current,l=q.useRef(0),u=q.useRef(!0),d=q.useRef(null),f=q.useRef(null),p=Z(()=>{u.current||(u.current=!0,o(e=>e+1))}),m=Z((e,t)=>{c.set(e,t),p()}),h=Z(e=>{c.delete(e),p()}),g=Z(e=>{let t=new Map;return n.current.length=0,r&&(r.current.length=0),e.forEach(e=>{t.set(e.element,{...e.registration.metadata??{},index:e.index}),n.current[e.index]=e.element,r&&(r.current[e.index]=e.registration.label===void 0?e.registration.textRef?.current?.textContent??e.element.textContent:e.registration.label)}),l.current=n.current.length,t});function _(e){if(f.current?.disconnect(),f.current=null,typeof MutationObserver!=`function`||e.length<2)return;let t=new MutationObserver(n=>{if(!hO(n))return;let r=null;for(let n of e)if(n.isConnected){if(r&&gO(r,n)>0){t.disconnect(),p();return}r=n}});f.current=t;let n=new Set;for(let t=1;t<e.length;t+=1){let r=mO(e[t-1],e[t]);r&&n.add(r)}n.forEach(e=>t.observe(e,{childList:!0}))}let v=Z(()=>{let[e,t]=pO(c),n=g(e),r=d.current,i=!r||r.length!==e.length||e.some((e,t)=>{let n=r[t];return e.index!==n.index||e.element!==n.element||e.registration.index!==n.registration.index||e.registration.metadata!==n.registration.metadata});_(t),d.current=e,u.current=!1,i&&(s.forEach(e=>e(n)),a(n))});Q(()=>(!u.current&&d.current&&g(d.current),()=>{n.current=[],r&&(r.current=[])}),[n,r,g]),Q(()=>{u.current&&v()}),Q(()=>()=>{f.current?.disconnect(),u.current=!0},[]);let y=Z(e=>(s.add(e),()=>{s.delete(e)})),b=q.useMemo(()=>({register:m,unregister:h,subscribeMapChange:y,nextIndexRef:l}),[m,h,y,l]);return(0,J.jsx)(cO.Provider,{value:b,children:t})}function dO(){return new Map}function fO(){return new Set}function pO(e){let t=new Set,n=[],r=[];e.forEach((e,i)=>{if(!i.isConnected)return;let a=e.index,o={index:a??-1,element:i,registration:e};a===null?r.push(o):a>=0&&(t.add(a),n.push(o))});let i=0;return r.sort((e,t)=>gO(e.element,t.element)),r.forEach(e=>{for(;t.has(i);)i+=1;e.index=i,n.push(e),i+=1}),t.size>0&&n.sort((e,t)=>e.index-t.index),[n,r.map(e=>e.element)]}function mO(e,t){let n=e.parentElement;for(;n&&!n.contains(t);)n=n.parentElement;return n}function hO(e){for(let t of e)for(let e=0;e<t.removedNodes.length;e+=1)if(t.removedNodes[e].isConnected)return!0;return!1}function gO(e,t){return e.nextElementSibling===t?-1:t.nextElementSibling===e?1:e.compareDocumentPosition(t)&Node.DOCUMENT_POSITION_FOLLOWING?-1:1}var _O=q.createContext(void 0);function vO(){let e=q.useContext(_O);if(e===void 0)throw Error(fv(64));return e}var yO=`data-activation-direction`,bO={tabActivationDirection:e=>({[yO]:e})},xO=q.forwardRef(function(e,t){let{className:n,defaultValue:r=0,onValueChange:i,orientation:a=`horizontal`,render:o,value:s,style:c,...l}=e,u=e.defaultValue!==void 0,d=q.useRef([]),[f,p]=q.useState(()=>new Map),[m,h]=sO({controlled:s,default:r,name:`Tabs`,state:`value`}),g=s!==void 0,[_,v]=q.useState(()=>new Map),y=q.useRef(void 0),b=q.useCallback(e=>SO(_,e),[_]),[x,S]=q.useState(()=>({previousValue:m,tabActivationDirection:`none`})),{previousValue:C,tabActivationDirection:w}=x,T=w,E=!1;C!==m&&(T=CO(C,m,a,_),E=C!=null&&m!=null&&b(m)==null);let D=E?C:m,O=C!==D||w!==T;Q(()=>{O&&S({previousValue:D,tabActivationDirection:T})},[D,O,T]);let k=Z((e,t)=>{t.activationDirection=CO(m,e,a,_),i?.(e,t),!t.isCanceled&&h(()=>e)}),A=Z((e,t)=>{i?.(e,mb(t,void 0,void 0,{activationDirection:`none`}))}),j=Z((e,t)=>(p(n=>{let r=new Map(n);return r.set(e,t),r}),()=>{p(n=>{if(n.get(e)!==t)return n;let r=new Map(n);return r.delete(e),r})})),M=q.useCallback(e=>f.get(e),[f]),N=q.useCallback(e=>{for(let t of _.values())if(e===t.value)return t.id},[_]),P=q.useMemo(()=>({getTabElementBySelectedValue:b,getTabIdByPanelValue:N,getTabPanelIdByValue:M,onValueChange:k,orientation:a,registerMountedTabPanel:j,setTabMap:v,tabActivationDirection:T,value:m}),[b,N,M,k,a,j,v,T,m]),F=q.useMemo(()=>{for(let e of _.values())if(e.value===m)return e},[_,m]),I=q.useMemo(()=>{for(let e of _.values())if(!e.disabled)return e.value},[_]),L=q.useRef(!u),R=q.useRef(r),ee=q.useRef(u),z=q.useRef(!1);Q(()=>{if(g)return;function e(e,t){h(()=>e),S({previousValue:e,tabActivationDirection:`none`}),A(e,t),L.current=!1}if(_.size===0){z.current&&m!==null&&!y.current?.isConnected&&e(null,jb);return}z.current=!0,y.current=_.keys().next().value;let t=F?.disabled,n=F==null&&m!==null;if(!t&&m===R.current&&(ee.current=!1),ee.current&&t&&m===R.current)return;let r=L.current;if(t||n){let n=I??null;if(m===n){L.current=!1;return}let i=jb;r?i=Mb:t&&(i=Ab),e(n,i)}else r&&F!=null&&(A(m,Mb),L.current=!1)},[I,g,A,F,h,_,m]);let te=Iv(`div`,e,{state:{orientation:a,tabActivationDirection:T},ref:t,props:l,stateAttributesMapping:bO});return(0,J.jsx)(_O.Provider,{value:P,children:(0,J.jsx)(uO,{elementsRef:d,children:te})})});function SO(e,t){for(let[n,r]of e.entries())if(t===r.value)return n;return null}function CO(e,t,n,r){if(e==null||t==null)return`none`;let[i,a,o]=n===`horizontal`?[`left`,`left`,`right`]:[`top`,`up`,`down`],s=SO(r,e),c=SO(r,t);if(s==null||c==null)return s!==c&&(typeof e==`number`||typeof e==`string`)&&typeof e==typeof t?t>e?o:a:`none`;let l=s.getBoundingClientRect()[i],u=c.getBoundingClientRect()[i];return u<l?a:u>l?o:`none`}var wO=`data-composite-item-active`;function TO(e={}){let{guess:t,label:n,metadata:r,textRef:i,index:a}=e,{register:o,unregister:s,subscribeMapChange:c,nextIndexRef:l}=lO(),u=q.useRef(-1),[d,f]=q.useState(a==null&&t?()=>{if(u.current===-1){let e=l.current;l.current+=1,u.current=e}return u.current}:-1),p=a??d,m=q.useRef(null),h=q.useCallback(e=>{let t=m.current;t&&s(t),m.current=e,e&&o(e,{metadata:r??null,index:a??null,label:n,textRef:i})},[a,o,s,r,n,i]);return Q(()=>{if(a==null)return c(e=>{let t=m.current?e.get(m.current)?.index:null;t!=null&&f(t)})},[a,c]),{ref:h,index:p}}function EO(e={}){let{highlightItemOnHover:t,highlightedIndex:n,onHighlightedIndexChange:r}=mv(),{ref:i,index:a}=TO(e),o=n===a,s=q.useRef(null),c=xv(i,s);return{compositeProps:{tabIndex:o?0:-1,onFocus(){r(a)},onMouseMove(){let e=s.current;if(!t||!e)return;let n=e.hasAttribute(`disabled`)||e.ariaDisabled===`true`;!o&&!n&&e.focus()}},compositeRef:c,index:a}}var DO=q.createContext(void 0);function OO(){let e=q.useContext(DO);if(e===void 0)throw Error(fv(65));return e}var kO=q.forwardRef(function(e,t){let{className:n,disabled:r=!1,render:i,value:a,id:o,nativeButton:s=!0,style:c,...l}=e,{value:u,getTabPanelIdByValue:d,onValueChange:f,orientation:p,tabActivationDirection:m}=vO(),{activateOnFocus:h,registerTabResizeObserverElement:g,tabsListElement:_}=OO(),{highlightedIndex:v,onHighlightedIndexChange:y}=mv(),b=eE(o),{compositeProps:x,compositeRef:S,index:C}=EO({metadata:q.useMemo(()=>({disabled:r,id:b,value:a}),[r,b,a])}),w=a===u,T=q.useRef(!1),E=q.useRef(null),D=Z(e=>{E.current?.(),E.current=e?g(e):null});Q(()=>{if(T.current){T.current=!1;return}if(!(w&&C>-1&&v!==C))return;let e=_;if(e!=null){let t=Ty(gv(e));if(t&&Ey(e,t))return}r||y(C)},[w,C,v,y,r,_]);let{getButtonProps:O,buttonRef:k}=vv({disabled:r,native:s,focusableWhenDisabled:!0}),A=d(a),j=q.useRef(!1),M=q.useRef(!1);function N(e){f(a,mb(gb,e.nativeEvent,void 0,{activationDirection:`none`}))}function P(e){w||r||N(e)}function F(e){w||r||h&&(!j.current||M.current)&&N(e)}function I(e){if(w||r)return;j.current=!0,M.current=e.button===0;let t=gv(e.currentTarget);function n(){j.current=!1,M.current=!1,t.removeEventListener(`pointerup`,n),t.removeEventListener(`pointercancel`,n)}t.addEventListener(`pointerup`,n),t.addEventListener(`pointercancel`,n)}return Iv(`button`,e,{state:{disabled:r,active:w,orientation:p,tabActivationDirection:m},ref:[t,k,S,D],props:[x,{role:`tab`,"aria-controls":A,"aria-selected":w,id:b,onClick:P,onFocus:F,onPointerDown:I,[wO]:w?``:void 0,onKeyDownCapture(){T.current=!0}},l,O],stateAttributesMapping:bO})}),AO=q.createContext(void 0),jO={disableStyleElements:!1};function MO(){return q.useContext(AO)??jO}var NO=`data-index`,PO={...bO,...zy},FO=q.forwardRef(function(e,t){let{className:n,value:r,render:i,keepMounted:a=!1,style:o,...s}=e,{value:c,getTabIdByPanelValue:l,orientation:u,tabActivationDirection:d,registerMountedTabPanel:f}=vO(),p=eE(),{ref:m,index:h}=TO(),g=r===c,{mounted:_,transitionStatus:v,setMounted:y}=vC(g),b=!_,x=l(r),S={hidden:b,orientation:u,tabActivationDirection:d,transitionStatus:v},C=q.useRef(null),w=Iv(`div`,e,{state:S,ref:[t,m,C],props:[{"aria-labelledby":x,hidden:b,id:p,role:`tabpanel`,tabIndex:g?0:-1,inert:DE(!g),[NO]:h},s],stateAttributesMapping:PO});return CC({open:g,ref:C,onComplete(){g||y(!1)}}),Q(()=>{if(!(p==null||b&&!a))return f(r,p)},[b,a,r,p,f]),a||_?w:null});function IO(e){return e==null||e.hasAttribute(`disabled`)||e.getAttribute(`aria-disabled`)===`true`}var LO=`ArrowUp`,RO=`ArrowDown`,zO=`ArrowLeft`,BO=`ArrowRight`,VO=new Set([LO,RO,zO,BO,`Home`,`End`]),HO=[`Shift`,`Control`,`Alt`,`Meta`];function UO(e){return w_(e)&&e.tagName===`INPUT`}function WO(e){return!!(UO(e)&&e.selectionStart!=null||w_(e)&&e.tagName===`TEXTAREA`)}function GO(e,t,n,r){if(!e||!t||!t.scrollTo)return;let i=e.scrollLeft,a=e.scrollTop,o=e.clientWidth<e.scrollWidth,s=e.clientHeight<e.scrollHeight;if(o&&r!==`vertical`){let r=KO(e,t,`left`),a=qO(e),o=qO(t);n===`ltr`&&(r+t.offsetWidth+o.scrollMarginRight>e.scrollLeft+e.clientWidth-a.scrollPaddingRight?i=r+t.offsetWidth+o.scrollMarginRight-e.clientWidth+a.scrollPaddingRight:r-o.scrollMarginLeft<e.scrollLeft+a.scrollPaddingLeft&&(i=r-o.scrollMarginLeft-a.scrollPaddingLeft)),n===`rtl`&&(r-o.scrollMarginLeft<e.scrollLeft+a.scrollPaddingLeft?i=r-o.scrollMarginLeft-a.scrollPaddingLeft:r+t.offsetWidth+o.scrollMarginRight>e.scrollLeft+e.clientWidth-a.scrollPaddingRight&&(i=r+t.offsetWidth+o.scrollMarginRight-e.clientWidth+a.scrollPaddingRight))}if(s&&r!==`horizontal`){let n=KO(e,t,`top`),r=qO(e),i=qO(t);n-i.scrollMarginTop<e.scrollTop+r.scrollPaddingTop?a=n-i.scrollMarginTop-r.scrollPaddingTop:n+t.offsetHeight+i.scrollMarginBottom>e.scrollTop+e.clientHeight-r.scrollPaddingBottom&&(a=n+t.offsetHeight+i.scrollMarginBottom-e.clientHeight+r.scrollPaddingBottom)}e.scrollTo({left:i,top:a,behavior:`auto`})}function KO(e,t,n){let r=n===`left`?`offsetLeft`:`offsetTop`,i=0;for(;t.offsetParent&&(i+=t[r],t.offsetParent!==e);)t=t.offsetParent;return i}function qO(e){let t=getComputedStyle(e);return{scrollMarginTop:parseFloat(t.scrollMarginTop)||0,scrollMarginRight:parseFloat(t.scrollMarginRight)||0,scrollMarginBottom:parseFloat(t.scrollMarginBottom)||0,scrollMarginLeft:parseFloat(t.scrollMarginLeft)||0,scrollPaddingTop:parseFloat(t.scrollPaddingTop)||0,scrollPaddingRight:parseFloat(t.scrollPaddingRight)||0,scrollPaddingBottom:parseFloat(t.scrollPaddingBottom)||0,scrollPaddingLeft:parseFloat(t.scrollPaddingLeft)||0}}function JO(e){let{loopFocus:t=!0,orientation:n=`both`,grid:r,onLoop:i,direction:a,highlightedIndex:o,onHighlightedIndexChange:s,rootRef:c,enableHomeAndEndKeys:l=!1,stopEventPropagation:u,disabledIndices:d,modifierKeys:f=jv}=e,[p,m]=q.useState(0),h=r!=null,g=q.useRef(null),_=xv(g,c),v=q.useRef([]),y=q.useRef(!1),b=q.useRef(null),x=o??p,S=Z((e,t=!1)=>{if(b.current=v.current[e]??null,(s??m)(e),t){let t=v.current[e];GO(g.current,t,a,n)}}),C=Z(e=>{if(e.size===0)return;if(y.current){let e=v.current,t=e.indexOf(b.current);if(t===-1){let t=e[x];!t||kx(e,x,d)?S(YO(e,d)):b.current=t}else t!==x&&S(t);return}y.current=!0;let t=Array.from(e.keys()),r=t.find(e=>e?.hasAttribute(`data-composite-item-active`))??null,i=r?e.get(r)?.index??-1:-1;if(i!==-1)S(i);else if(kx(t,x,d)){let e=Ox(t,{disabledIndices:d});wx(t,e)||S(e)}GO(g.current,r,a,n)});Q(()=>{if(d==null||o!=null||!y.current)return;let e=v.current;if(kx(e,x,d)){let t=Ox(e,{disabledIndices:d});wx(e,t)||S(t)}},[d,o,x,v,S]);let w=Z((e,t,n)=>i?i(e,t,n,v):n),T=Z(e=>{let o=e.key===`Home`||e.key===`End`;if(!VO.has(e.key)||!l&&o||XO(e,f)||!g.current)return;let s=a===`rtl`,c=s?zO:BO,p=s?BO:zO,m=n===`vertical`?RO:c,_=n===`vertical`?LO:p,y=Oy(e.nativeEvent);if(y!=null&&WO(y)&&!IO(y)){let t=y.selectionStart,n=y.selectionEnd,r=y.value;if(t==null||e.shiftKey||t!==n||e.key!==_&&t<r.length||e.key!==m&&t>0)return}let b=x,C=Tx(v,d),T=Ex(v,d);r!=null&&(b=r({disabledIndices:d,elementsRef:v,event:e,highlightedIndex:x,loopFocus:t,maxIndex:T,minIndex:C,onLoop:w,orientation:n,rtl:s}));let E=n!==`vertical`&&e.key===c||n!==`horizontal`&&e.key===`ArrowDown`,D=n!==`vertical`&&e.key===p||n!==`horizontal`&&e.key===`ArrowUp`;l&&(e.key===`Home`?b=C:e.key===`End`&&(b=T)),b===x&&(E||D)&&(t&&b===T&&E?(b=C,i&&(b=i(e,x,b,v))):t&&b===C&&D?(b=T,i&&(b=i(e,x,b,v))):b=Ox(v.current,{startingIndex:b,decrement:D,disabledIndices:d})),b!==x&&!wx(v.current,b)&&(u&&e.stopPropagation(),(h||o||E||D)&&e.preventDefault(),S(b,!0),queueMicrotask(()=>{v.current[b]?.focus()}))});return{props:{ref:_,onFocus(e){let t=g.current,n=Oy(e.nativeEvent);t&&n!=null&&WO(n)&&n.setSelectionRange(0,n.value.length)},onKeyDown:T},highlightedIndex:x,onHighlightedIndexChange:S,elementsRef:v,onMapChange:C,relayKeyboardEvent:T}}function YO(e,t){let n=-1;for(let r=0;r<e.length;r+=1){let i=e[r];if(i&&!kx(e,r,t)){if(i.hasAttribute(`data-composite-item-active`))return r;n===-1&&(n=r)}}return Math.max(n,0)}function XO(e,t){for(let n of HO)if(!t.includes(n)&&e.getModifierState(n))return!0;return!1}function ZO(e){let{render:t,className:n,style:r,refs:i=jv,props:a=jv,state:o=Mv,stateAttributesMapping:s,highlightedIndex:c,onHighlightedIndexChange:l,orientation:u,grid:d,loopFocus:f,onLoop:p,enableHomeAndEndKeys:m,onMapChange:h,stopEventPropagation:g=!0,rootRef:_,disabledIndices:v,modifierKeys:y,highlightItemOnHover:b=!1,tag:x=`div`,...S}=e,{props:C,highlightedIndex:w,onHighlightedIndexChange:T,elementsRef:E,onMapChange:D,relayKeyboardEvent:O}=JO({grid:d,loopFocus:f,onLoop:p,orientation:u,highlightedIndex:c,onHighlightedIndexChange:l,rootRef:_,stopEventPropagation:g,enableHomeAndEndKeys:m,direction:oE(),disabledIndices:v,modifierKeys:y}),k=Iv(x,e,{state:o,ref:i,props:[C,...a,S],stateAttributesMapping:s}),A=q.useMemo(()=>({highlightedIndex:w,onHighlightedIndexChange:T,highlightItemOnHover:b,relayKeyboardEvent:O}),[w,T,b,O]);return(0,J.jsx)(pv.Provider,{value:A,children:(0,J.jsx)(uO,{elementsRef:E,onMapChange:e=>{h?.(e),D(e)},children:k})})}var QO=q.forwardRef(function(e,t){let{activateOnFocus:n=!1,className:r,loopFocus:i=!0,render:a,style:o,...s}=e,{orientation:c,setTabMap:l,tabActivationDirection:u}=vO(),[d,f]=q.useState(0),[p,m]=q.useState(null),h=q.useRef(new Set),g=q.useRef(new Set),_=q.useRef(null);Q(()=>{if(typeof ResizeObserver>`u`)return;let e=new ResizeObserver(()=>{h.current.forEach(e=>{e()})});return _.current=e,p&&e.observe(p),g.current.forEach(t=>{e.observe(t)}),()=>{e.disconnect(),_.current=null}},[p]);let v=Z(e=>(h.current.add(e),()=>{h.current.delete(e)})),y=Z(e=>(g.current.add(e),_.current?.observe(e),()=>{g.current.delete(e),_.current?.unobserve(e)})),b={orientation:c,tabActivationDirection:u},x={"aria-orientation":c===`vertical`?`vertical`:void 0,role:`tablist`},S=q.useMemo(()=>({activateOnFocus:n,registerIndicatorUpdateListener:v,registerTabResizeObserverElement:y,tabsListElement:p}),[n,v,y,p]);return(0,J.jsx)(DO.Provider,{value:S,children:(0,J.jsx)(ZO,{render:a,className:r,style:o,state:b,refs:[t,m],props:[x,s],stateAttributesMapping:bO,highlightedIndex:d,enableHomeAndEndKeys:!0,loopFocus:i,orientation:c,onHighlightedIndexChange:f,onMapChange:l,disabledIndices:jv})})});function $O({className:e,orientation:t=`horizontal`,...n}){return(0,J.jsx)(xO,{"data-slot":`tabs`,"data-orientation":t,className:X(`group/tabs flex gap-2 data-horizontal:flex-col`,e),...n})}var ek=Kv(`group/tabs-list inline-flex w-fit items-center justify-center rounded-md p-[3px] text-muted-foreground group-data-horizontal/tabs:h-8 group-data-vertical/tabs:h-fit group-data-vertical/tabs:flex-col data-[variant=underline]:rounded-none`,{variants:{variant:{default:`bg-muted`,underline:`gap-1 bg-transparent`}},defaultVariants:{variant:`default`}});function tk({className:e,variant:t=`default`,...n}){return(0,J.jsx)(QO,{"data-slot":`tabs-list`,"data-variant":t,className:X(ek({variant:t}),e),...n})}function nk({className:e,...t}){return(0,J.jsx)(kO,{"data-slot":`tabs-trigger`,className:X(`relative inline-flex h-[calc(100%-1px)] flex-1 items-center justify-center gap-1.5 rounded-md border border-transparent px-1.5 py-0.5 text-ui font-medium whitespace-nowrap text-foreground/60 transition-all group-data-vertical/tabs:w-full group-data-vertical/tabs:justify-start hover:text-foreground disabled:pointer-events-none disabled:opacity-50 has-data-[icon=inline-end]:pr-1 has-data-[icon=inline-start]:pl-1 aria-disabled:pointer-events-none aria-disabled:opacity-50 group-data-[variant=default]/tabs-list:data-active:shadow-sm group-data-[variant=underline]/tabs-list:data-active:shadow-none [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4`,`group-data-[variant=underline]/tabs-list:bg-transparent group-data-[variant=underline]/tabs-list:data-active:bg-transparent`,`data-active:bg-background data-active:text-foreground group-data-[variant=default]/tabs-list:data-active:ring-1 group-data-[variant=default]/tabs-list:data-active:ring-muted-foreground`,`after:absolute after:bg-primary after:opacity-0 after:transition-opacity group-data-horizontal/tabs:after:inset-x-0 group-data-horizontal/tabs:after:bottom-[-5px] group-data-horizontal/tabs:after:h-0.5 group-data-vertical/tabs:after:inset-y-0 group-data-vertical/tabs:after:-right-1 group-data-vertical/tabs:after:w-0.5 group-data-[variant=underline]/tabs-list:data-active:after:opacity-100`,e),...t})}function rk({className:e,...t}){return(0,J.jsx)(FO,{"data-slot":`tabs-content`,className:X(`flex-1 text-ui -outline-offset-2`,e),...t})}function ik({className:e,onSubmitShortcut:t,onKeyDown:n,...r}){return(0,J.jsx)(`textarea`,{"data-slot":`textarea`,onKeyDown:e=>{n?.(e),t!==void 0&&!e.defaultPrevented&&e.key===`Enter`&&(e.metaKey||e.ctrlKey)&&(e.preventDefault(),t())},className:X(`flex field-sizing-content min-h-16 w-full rounded-md border border-input bg-transparent px-2.5 py-2 text-ui transition-colors placeholder:text-muted-foreground disabled:cursor-not-allowed disabled:bg-input/50 disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20`,e),...r})}var ak=[{id:`nextFile`,chords:[{key:`n`}],action:`Next file`,scope:`diff`},{id:`previousFile`,chords:[{key:`p`}],action:`Previous file`,scope:`diff`},{id:`lineDown`,chords:[{key:`ArrowDown`}],action:`Focus the next line`,scope:`diff`},{id:`lineUp`,chords:[{key:`ArrowUp`}],action:`Focus the previous line`,scope:`diff`},{id:`extendDown`,chords:[{key:`ArrowDown`,shift:!0}],action:`Extend the selection down`,scope:`diff`},{id:`extendUp`,chords:[{key:`ArrowUp`,shift:!0}],action:`Extend the selection up`,scope:`diff`},{id:`comment`,chords:[{key:`c`}],action:`Comment on the selected decision, or on the focused change`,scope:`diff`},{id:`openCall`,chords:[{key:`o`}],action:`Show the code a call on the focused line runs; again for the next call`,scope:`diff`},{id:`toggleSplit`,chords:[{key:`u`}],action:`Unified or split diff`,scope:`diff`},{id:`toggleLayout`,chords:[{key:`v`}],action:`Map or overview`,scope:`global`},{id:`moveFile`,chords:[{key:`ArrowLeft`},{key:`ArrowRight`},{key:`ArrowUp`},{key:`ArrowDown`}],action:`Move between files`,scope:`overview`},{id:`openFile`,chords:[{key:`Enter`}],action:`Open the file's code in the map, or a group of files in place`,scope:`overview`},{id:`filterTree`,chords:[{key:`/`}],action:`Filter the files`,scope:`tree`},{id:`openReview`,chords:[{key:`R`,shift:!0}],action:`Open the review to publish`,scope:`global`},{id:`submit`,chords:[{key:`Enter`,mod:!0}],action:`Send the comment or review`,scope:`composer`},{id:`close`,chords:[{key:`Escape`}],action:`Close, clear the highlight, or go back to the overview`,scope:`global`},{id:`help`,chords:[{key:`?`,shift:!0}],action:`Show all shortcuts`,scope:`global`},{id:`focusLink`,chords:[{key:`/`}],action:`Paste a pull request link`,scope:`picker`},{id:`moveRow`,chords:[{key:`ArrowUp`},{key:`ArrowDown`},{key:`ArrowLeft`},{key:`ArrowRight`},{key:`Home`},{key:`End`}],action:`Move between a list's pull requests, or the activity calendar's days`,scope:`picker`},{id:`openRow`,chords:[{key:`Enter`}],action:`Open the pull request`,scope:`picker`},{id:`openInNewTab`,chords:[{key:`Enter`,mod:!0}],action:`Open the pull request or the link in a new tab`,scope:`picker`},{id:`cancelOpening`,chords:[{key:`Escape`}],action:`Stop waiting for a review to open`,scope:`picker`}],ok=new Map(ak.map(e=>[e.id,e])),sk=e=>{let t=ok.get(e);if(t===void 0)throw Error(`No shortcut ${e}`);return t},ck=new Set([`Escape`]),lk=e=>e.mod!==!0&&!ck.has(e.key),uk=e=>e.mod!==!0&&e.key.length===1,dk={ArrowDown:`↓`,ArrowUp:`↑`,ArrowLeft:`←`,ArrowRight:`→`,Enter:`↵`,Escape:`Esc`,Home:`Home`,End:`End`},fk=(e,t)=>{let n=[];return e.mod===!0&&n.push(t?`⌘`:`Ctrl`),e.shift===!0&&e.key!==`?`&&n.push(`⇧`),n.push(dk[e.key]??e.key),n},pk=(e,t,n)=>{let r=n?e.metaKey:e.ctrlKey,i=n?e.ctrlKey:e.metaKey;return e.altKey||i||r!==(t.mod===!0)||t.key.length>1&&e.shiftKey!==(t.shift===!0)?!1:e.key===t.key},mk=e=>e instanceof HTMLElement?e.isContentEditable||e instanceof HTMLTextAreaElement||e instanceof HTMLSelectElement?!0:e instanceof HTMLInputElement&&![`checkbox`,`radio`,`button`,`submit`,`reset`,`range`,`color`,`file`].includes(e.type):!1,hk=(e,t,n)=>{let r=mk(e.target);for(let i of t)for(let t of sk(i).chords)if(pk(e,t,n.mac)&&!(lk(t)&&r)&&(!uk(t)||n.singleKeys))return i;return null},gk=()=>typeof navigator<`u`&&/Mac|iPhone|iPad/.test(navigator.platform),_k=`megareviewer:singleKeyShortcuts`,vk=new Set,yk=()=>{try{return window.localStorage.getItem(_k)!==`false`}catch{return!0}},bk=e=>(vk.add(e),window.addEventListener(`storage`,e),()=>{vk.delete(e),window.removeEventListener(`storage`,e)}),xk=()=>[(0,q.useSyncExternalStore)(bk,yk),(0,q.useCallback)(e=>{try{window.localStorage.setItem(_k,String(e))}catch{}for(let e of vk)e()},[])],Sk=(e,t=!0)=>{let[n]=xk(),r=(0,q.useRef)(e);r.current=e,(0,q.useEffect)(()=>{if(!t)return;let e=gk(),i=t=>{if(t.defaultPrevented)return;let i=hk(t,ak.filter(e=>r.current[e.id]!==void 0).map(e=>e.id),{mac:e,singleKeys:n});i!==null&&(t.preventDefault(),r.current[i]?.(t))};return window.addEventListener(`keydown`,i),()=>window.removeEventListener(`keydown`,i)},[t,n])};function Ck({className:e,...t}){return(0,J.jsx)(`kbd`,{"data-slot":`kbd`,className:X(`pointer-events-none inline-flex h-5 w-fit min-w-5 items-center justify-center gap-1 rounded-sm border-b-2 border-border bg-muted px-1 font-mono text-kbd font-medium text-muted-foreground select-none in-data-[slot=tooltip-content]:bg-background/20 in-data-[slot=tooltip-content]:text-background [&_svg:not([class*='size-'])]:size-3`,e),...t})}function wk({className:e,...t}){return(0,J.jsx)(`kbd`,{"data-slot":`kbd-group`,className:X(`inline-flex items-center gap-1`,e),...t})}var Tk=({id:e,className:t})=>{let[n]=xk(),r=(0,q.useMemo)(gk,[]),[i]=sk(e).chords;return i===void 0||!n&&uk(i)?null:(0,J.jsx)(wk,{"aria-hidden":`true`,className:X(`shrink-0`,t),children:fk(i,r).map(e=>(0,J.jsx)(Ck,{children:e},e))})},Ek=({hints:e,className:t})=>(0,J.jsx)(`p`,{"aria-hidden":`true`,"data-slot":`key-hint-line`,className:X(`flex flex-wrap items-center gap-x-1.5 gap-y-1 text-caption text-muted-foreground`,t),children:e.map(({id:e,action:t},n)=>(0,J.jsxs)(q.Fragment,{children:[n>0&&(0,J.jsx)(`span`,{children:`·`}),(0,J.jsx)(Tk,{id:e}),(0,J.jsx)(`span`,{children:t})]},e))}),Dk={draft:`bg-review-pending`,open:`bg-thread-marker`,resolved:`bg-review-approved`,outdated:`bg-muted-foreground`},Ok=({as:e=`div`,state:t,className:n,children:r,...i})=>(0,J.jsxs)(e,{"data-slot":`comment-card`,"data-state":t,className:X(`relative rounded-lg border bg-thread-bg py-2.5 pr-4 pl-5 font-sans`,`[&_:is(textarea,input):focus-visible]:-outline-offset-1`,n),...i,children:[(0,J.jsx)(`span`,{"aria-hidden":`true`,"data-slot":`comment-bar`,className:X(`absolute top-2 bottom-2 left-1.5 w-[3px] rounded-full`,Dk[t])}),r]}),kk=e=>{let t=e.trim().split(/[\s._-]+/).filter(Boolean),n=(t.length===1?[...t[0]??``].slice(0,2):t.slice(0,2).map(e=>[...e][0]??``)).join(``).toUpperCase();return n===``?`?`:n},Ak=6e4,jk=60*Ak,Mk=24*jk,Nk=(e,t)=>{let n=Math.max(0,t-Date.parse(e));if(n<Ak)return`just now`;if(n<jk)return`${Math.floor(n/Ak)}m ago`;if(n<Mk)return`${Math.floor(n/jk)}h ago`;let r=Math.floor(n/Mk);return r<30?r===1?`yesterday`:`${r} days ago`:new Date(e).toLocaleDateString(void 0,{year:`numeric`,month:`short`,day:`numeric`})},Pk=e=>new Date(e).toLocaleString(void 0,{dateStyle:`medium`,timeStyle:`short`}),Fk=(e,t,n)=>`${e===`old`?`L`:`R`}${t===null||t===n?n:`${t}–${n}`}`,Ik=({children:e})=>(0,J.jsx)(`code`,{className:`rounded-sm bg-diff-hunk-bg px-1 font-mono text-code-compact text-diff-hunk-fg`,children:e}),Lk=`modulepreload`,Rk=function(e){return`/`+e},zk={},Bk=function(e){return e.pathname.endsWith(`.css`)},Vk=function(e,t,n){if(t in e)return e[t];let r=n();if(!r){e[t]=void 0;return}let i=r.then(()=>{e[t]=void 0},n=>{throw e[t]=void 0,n});return e[t]=i,i},Hk=function(e,t,n){let r=Promise.resolve();if(t&&t.length>0){let e,i=document.querySelector(`meta[property=csp-nonce]`),a=i?.nonce||i?.getAttribute(`nonce`);function o(e){return Promise.all(e.map(e=>Promise.resolve(e).then(e=>({status:`fulfilled`,value:e}),e=>({status:`rejected`,reason:e}))))}function s(e){return import.meta.resolve?new URL(import.meta.resolve(e)):new URL(e,import.meta.url)}r=o(t.map(t=>{t=Rk(t,n);let r=s(t),i=Bk(r);return Vk(zk,r.href,()=>{if(e===void 0){e={all:new Set,styles:new Set};let t=document.getElementsByTagName(`link`);for(let n=t.length-1;n>=0;n--){let r=t[n];e.all.add(r.href),r.rel===`stylesheet`&&e.styles.add(r.href)}}if((i?e.styles:e.all).has(r.href))return;let t=document.createElement(`link`);if(t.rel=i?`stylesheet`:Lk,i||(t.as=`script`),t.crossOrigin=``,t.href=r.href,a&&t.setAttribute(`nonce`,a),document.head.appendChild(t),i)return new Promise((e,n)=>{t.addEventListener(`load`,e),t.addEventListener(`error`,()=>n(Error(`Unable to preload CSS for ${r}`)))})})}).filter(e=>e!==void 0))}function i(e){let t=new Event(`vite:preloadError`,{cancelable:!0});if(t.payload=e,window.dispatchEvent(t),!t.defaultPrevented)throw e}return r.then(t=>{for(let e of t||[])e.status===`rejected`&&i(e.reason);return e().catch(i)})},Uk={name:`java-constants`,scopeName:`source.java.constants`,injectTo:[`source.java`],injectionSelector:`L:source.java -comment -string -meta.import -meta.package`,repository:{},patterns:[{match:`(?<![\\w$])[A-Z][A-Z0-9_]*[A-Z0-9](?![\\w$])`,name:`variable.other.constant.java`},{match:`(\\.)\\s*([A-Z][A-Z0-9_]*[A-Z0-9])(?![\\w$]|\\s*\\()`,captures:{1:{name:`punctuation.separator.period.java`},2:{name:`variable.other.constant.java`}}}]},Wk={c:()=>Hk(()=>import(`./c-Cz4nF6n_.js`),__vite__mapDeps([0,1])),cpp:()=>Hk(()=>import(`./cpp-DzjeI0uH.js`),__vite__mapDeps([2,3,1])),csharp:()=>Hk(()=>import(`./csharp-dmMxLVLW.js`),[]),css:()=>Hk(()=>import(`./css-DgaLhXQH.js`),__vite__mapDeps([4,5])),diff:()=>Hk(()=>import(`./diff-woXpYk--.js`),[]),docker:()=>Hk(()=>import(`./docker-IyjqRm3v.js`),[]),go:()=>Hk(()=>import(`./go-rLFTqkRN.js`),[]),graphql:()=>Hk(()=>import(`./graphql-BHtseKAV.js`),__vite__mapDeps([6,7,8,9,10,11])),html:()=>Hk(()=>import(`./html-BWDvXlHg.js`),__vite__mapDeps([12,13,5,8])),ini:()=>Hk(()=>import(`./ini-B5eOa1yu.js`),[]),java:async()=>({default:[...(await Hk(async()=>{let{default:e}=await import(`./java-_ATy9zCa.js`);return{default:e}},__vite__mapDeps([14,15]))).default,Uk]}),javascript:()=>Hk(()=>import(`./javascript-CpIGwZ_Y.js`),__vite__mapDeps([16,8])),json:()=>Hk(()=>import(`./json-C3WlssX3.js`),__vite__mapDeps([17,18])),jsonc:()=>Hk(()=>import(`./jsonc-CYpm1nAK.js`),[]),jsx:()=>Hk(()=>import(`./jsx-C4yDKi0A.js`),__vite__mapDeps([19,10])),kotlin:()=>Hk(()=>import(`./kotlin-DhhofPvG.js`),[]),make:()=>Hk(()=>import(`./make-Dixweg8N.js`),[]),markdown:()=>Hk(()=>import(`./markdown-BYOwaDjH.js`),[]),php:()=>Hk(()=>import(`./php-CUj1wjLQ.js`),__vite__mapDeps([20,5,8,13,18,21,15,22])),python:()=>Hk(()=>import(`./python-gzcpVVnB.js`),[]),ruby:()=>Hk(()=>import(`./ruby-DAHFNlv9.js`),__vite__mapDeps([23,1,3,5,8,7,9,10,11,13,21,15,22,24,25])),rust:()=>Hk(()=>import(`./rust-DpiIf5JO.js`),[]),scss:()=>Hk(()=>import(`./scss-8bKmll0B.js`),__vite__mapDeps([26,5])),shellscript:()=>Hk(()=>import(`./shellscript-CVTB3cr6.js`),__vite__mapDeps([27,24])),sql:()=>Hk(()=>import(`./sql-CfM2IJm3.js`),__vite__mapDeps([28,22])),svelte:()=>Hk(()=>import(`./svelte-DAcAPYhA.js`),__vite__mapDeps([29,5,8,9])),swift:()=>Hk(()=>import(`./swift-CyEgAFGc.js`),[]),toml:()=>Hk(()=>import(`./toml-CcmNWLt0.js`),[]),tsx:()=>Hk(()=>import(`./tsx-CGosfAUg.js`),__vite__mapDeps([30,11])),typescript:()=>Hk(()=>import(`./typescript-Bb1J8qyy.js`),__vite__mapDeps([31,9])),vue:()=>Hk(()=>import(`./vue-DfeOw4hL.js`),__vite__mapDeps([32,5,8,9,13,18])),xml:()=>Hk(()=>import(`./xml-DuKfbPI6.js`),__vite__mapDeps([33,21,15])),yaml:()=>Hk(()=>import(`./yaml-DDA_XMNu.js`),__vite__mapDeps([34,25]))},Gk={c_sharp:`csharp`},Kk={bash:`shellscript`,c:`c`,cc:`cpp`,cjs:`javascript`,cpp:`cpp`,cs:`csharp`,css:`css`,cts:`typescript`,cxx:`cpp`,diff:`diff`,go:`go`,gql:`graphql`,graphql:`graphql`,h:`c`,hh:`cpp`,hpp:`cpp`,htm:`html`,html:`html`,ini:`ini`,java:`java`,js:`javascript`,json:`json`,jsonc:`jsonc`,jsx:`jsx`,kt:`kotlin`,kts:`kotlin`,md:`markdown`,mjs:`javascript`,mts:`typescript`,patch:`diff`,php:`php`,py:`python`,pyi:`python`,rb:`ruby`,rs:`rust`,scss:`scss`,sh:`shellscript`,sql:`sql`,svelte:`svelte`,swift:`swift`,toml:`toml`,ts:`typescript`,tsx:`tsx`,vue:`vue`,xml:`xml`,yaml:`yaml`,yml:`yaml`,zsh:`shellscript`},qk={Dockerfile:`docker`,GNUmakefile:`make`,Makefile:`make`},Jk=e=>{let t=e.language===null?null:Gk[e.language]??e.language;if(t!==null&&t in Wk)return t;let n=e.path.slice(e.path.lastIndexOf(`/`)+1),r=n.lastIndexOf(`.`),i=r>0?n.slice(r+1).toLowerCase():``;return qk[n]??Kk[i]??null},Yk=e=>({old:Xk(e,`add`),new:Xk(e,`del`)}),Xk=(e,t)=>e.filter(({line:e})=>e.kind!==t).map(({text:e})=>e).join(`
|
|
75
|
+
`),Zk=e=>`class _ {
|
|
76
|
+
`.repeat(e),Qk=e=>`class _ {\nvoid _() {\n${`{
|
|
77
|
+
`.repeat(e-2)}`,$k=/^(?:@\w|(?:public|protected|private|abstract|static|native|transient|volatile)\b)/,eA=/^(?:[}\])]|default\s*(?:->|:)|(?:if|else|for|while|do|switch|case|return|throw|try|catch|finally|yield|break|continue|var|this|super|assert|new)\b|[\w$.]+(?:\[[^\]]*\])?\s*(?:[-+*/%&|^]?=(?!=)|\+\+|--|\())/,tA=/^\*/,nA=(e,t)=>{if(t!==`java`)return``;let n=e.split(`
|
|
78
|
+
`).filter(e=>e.trim()!==``),r=n[0];if(r===void 0)return``;let i=tA.test(r.trim()),a=n.find(e=>!/^(?:\*|\/\*|\/\/)/.test(e.trim())),o=i?`/*
|
|
79
|
+
`:``;if(a===void 0)return o;let s=rA(a,n),c=a.trim();return(s===0?``:$k.test(c)||s===1&&!eA.test(c)?Zk(s):Qk(Math.max(s,2)))+o},rA=(e,t)=>{let n=/^[ \t]*/.exec(e)?.[0]??``,r=n.split(` `).length-1;if(r>0)return r+Math.floor((n.length-r)/4);let i=t.some(e=>(/^ */.exec(e)?.[0].length??0)%4==2&&!tA.test(e.trim()));return Math.floor(n.length/(i?2:4))},iA=e=>{let t=e.map(e=>e.text.endsWith(`\r`)),n=t.includes(!0)&&t.includes(!1);return e.map((e,r)=>({line:e,text:t[r]?e.text.slice(0,-1):e.text,carriageReturn:n&&t[r]===!0}))},aA=e=>({added:e.lines.filter(e=>e.kind===`add`).length,deleted:e.lines.filter(e=>e.kind===`del`).length}),oA=(e,t)=>t<=1?`${e}`:`${e}–${e+t-1}`,sA=e=>e.newLines>0?`lines ${oA(e.newStart,e.newLines)}`:`deleted lines ${oA(e.oldStart,e.oldLines)}`,cA={"token-keyword":`keyword`,"token-string":`string`,"token-string-expression":`string`,"token-function":`function`,"token-comment":`comment`,"token-constant":`number`},lA=e=>{let t=/^var\(--shiki-([\w-]+)/.exec(e??``)?.[1];return t===void 0?null:cA[t]??null},uA=e=>{let t=[];for(let{content:n,color:r}of e){let e=lA(r),i=t.at(-1);i!==void 0&&i.type===e?t[t.length-1]={text:i.text+n,type:e}:t.push({text:n,type:e})}return t},dA=(e,t,n)=>{let r=0,i=0;return iA(e.lines).map(({line:e,text:a})=>{let o=e.kind===`del`?t?.[r]:n?.[i];return e.kind!==`add`&&r++,e.kind!==`del`&&i++,o!==void 0&&o.map(e=>e.text).join(``)===a?o:null})},fA=e=>`var(--shiki-${e})`,pA=[{scope:[`storage.type.annotation.java`,`punctuation.definition.annotation.java`,`variable.language.java`],color:fA(`token-constant`)},{scope:[`storage.type.primitive.java`,`storage.type.primitive.array.java`,`keyword.operator.instanceof.java`],color:fA(`token-keyword`)},{scope:[`storage.type.java`,`storage.type.generic.java`,`storage.type.object.array.java`,`storage.type.generic.wildcard.java`,`entity.other.inherited-class.java`,`meta.function-call.java`,`storage.modifier.package.java`,`storage.modifier.import.java`,`variable.other.object.java`,`variable.other.object.property.java`,`source.java keyword.operator`,`keyword.control.ternary.java`],color:fA(`foreground`)}],mA=1e3,hA=(0,q.createContext)((()=>{let e=null,t=new Map,n=new Map,r=(e,t,r)=>{let i=`${r}\0${t}`,a=n.get(i)??e.getLastGrammarState(t,{lang:r,theme:`hunk`});return n.set(i,a),a},i=async()=>{let[{createHighlighterCore:e,createCssVariablesTheme:t},{createJavaScriptRegexEngine:n}]=await Promise.all([Hk(()=>import(`./core-a5EcSd0Y.js`),[]),Hk(()=>import(`./engine-javascript-D-6se_EF.js`),[])]),r=t({name:`hunk`,variablePrefix:`--shiki-`});return e({themes:[{...r,tokenColors:[...r.tokenColors??[],...pA.map(({scope:e,color:t})=>({scope:[...e],settings:{foreground:t}}))]}],langs:[],engine:n()})},a=(e,n)=>{let r=t.get(n)??(async()=>{let t=Wk[n];return t!==void 0&&(await e.loadLanguage(...(await t()).default),!0)})();return t.set(n,r),r};return{async highlight(t,n){if(Wk[n]===void 0)return null;e??=i();let o=await e;if(!await a(o,n))return null;let s=nA(t,n);return o.codeToTokensBase(t,{lang:n,theme:`hunk`,tokenizeMaxLineLength:mA,...s===``?{}:{grammarState:r(o,s,n)}}).map(e=>uA(e))}}})()),gA=new WeakMap,_A=(e,t,n)=>{let r=gA.get(e)??new Map;gA.set(e,r);let i=`${n}\0${t.id}\0${t.oldStart},${t.newStart},${t.lines.length}`,a=r.get(i);if(a!==void 0)return a;let o=iA(t.lines),s=Yk(o),c=(t,r)=>r?e.highlight(t,n):Promise.resolve(null),l={promise:Promise.all([c(s.old,o.some(({line:e})=>e.kind!==`add`)),c(s.new,o.some(({line:e})=>e.kind!==`del`))]).then(([e,n])=>{let r=dA(t,e,n);return l.value=r,r}),value:null};return r.set(i,l),l},vA=`1200px 0px`,yA=null,bA=new Map,xA=(e,t)=>(yA??=new IntersectionObserver(e=>{for(let t of e)t.isIntersecting&&(bA.get(t.target)?.(),bA.delete(t.target),yA?.unobserve(t.target))},{rootMargin:vA}),bA.set(e,t),yA.observe(e),()=>{bA.delete(e),yA?.unobserve(e)}),SA=e=>{let[t,n]=(0,q.useState)(()=>typeof IntersectionObserver>`u`);return(0,q.useEffect)(()=>{let r=e.current;if(!(t||r===null))return xA(r,()=>n(!0))},[e,t]),t},CA=(e,t,n=!0)=>{let r=(0,q.useContext)(hA),i=Jk(t),a=i===null||!n?null:_A(r,e,i),[o,s]=(0,q.useState)();return(0,q.useEffect)(()=>{if(a===null)return;let e=!0;return a.promise.then(t=>{e&&s(e=>e?.entry===a?e:{entry:a,tokens:t})}),()=>{e=!1}},[a]),a?.value??(o?.entry===a?o.tokens:null)},wA=(e,t)=>{let n=(0,q.useContext)(hA),r=Jk(t),[i,a]=(0,q.useState)(null);return(0,q.useEffect)(()=>{if(r===null||e===null)return;let t=!0;return n.highlight(e.join(`
|
|
80
|
+
`),r).then(n=>{t&&n!==null&&a({lines:e,tokens:e.map((e,t)=>{let r=n[t];return r!==void 0&&r.map(e=>e.text).join(``)===e?r:null})})}),()=>{t=!1}},[n,r,e]),i?.lines===e?i.tokens:null},TA={keyword:`text-syntax-keyword`,string:`text-syntax-string`,function:`text-syntax-function`,comment:`text-syntax-comment`,number:`text-syntax-number`},EA=(e,t)=>{let n=(0,q.useContext)(hA),[r,i]=(0,q.useState)(null),a=`${t??``}\0${e}`;return(0,q.useEffect)(()=>{if(t===null)return;let r=!0;return n.highlight(e,t).then(e=>{r&&i({key:a,lines:e})}),()=>{r=!1}},[n,e,t,a]),r?.key===a?r.lines:null},DA=({text:e,tokens:t})=>t!=null&&t.map(e=>e.text).join(``)===e?t.map((e,t)=>(0,J.jsx)(`span`,{className:X(e.type!==null&&TA[e.type]),children:e.text},t)):e,OA=({kind:e,text:t,tokens:n})=>(0,J.jsxs)(`div`,{"data-kind":e,className:X(`flex min-h-5 whitespace-pre`,e===`add`?`bg-diff-add-bg`:`bg-diff-del-bg`),children:[(0,J.jsx)(`span`,{"aria-hidden":`true`,className:X(`w-5 shrink-0 select-none text-center`,e===`add`?`bg-diff-add-gutter text-diff-add-fg`:`bg-diff-del-gutter text-diff-del-fg`),children:e===`add`?`+`:`−`}),(0,J.jsx)(`span`,{className:`sr-only`,children:e===`add`?`added line `:`removed line `}),(0,J.jsx)(`span`,{className:`px-2`,children:(0,J.jsx)(DA,{text:t,tokens:n})})]}),kA=({removed:e,added:t,language:n,title:r})=>{let i=EA((e??[]).join(`
|
|
81
|
+
`),e===null?null:n),a=EA(t.join(`
|
|
82
|
+
`),n);return(0,J.jsxs)(`div`,{"data-slot":`suggestion-diff`,className:`overflow-x-auto rounded-md border font-mono text-code-compact`,children:[r!==void 0&&(0,J.jsx)(`p`,{className:`border-b px-2 py-1 font-sans text-caption font-medium text-primary`,children:r}),(e??[]).map((e,t)=>(0,J.jsx)(OA,{kind:`del`,text:e,tokens:i?.[t]},`del:${t}`)),t.map((e,t)=>(0,J.jsx)(OA,{kind:`add`,text:e,tokens:a?.[t]},`add:${t}`)),t.length===0&&(0,J.jsxs)(`p`,{className:`px-2 py-1 font-sans text-caption text-muted-foreground`,children:[`Deletes`,` `,e===null?`the lines`:e.length===1?`the line`:`the ${e.length} lines`,`.`]})]})},AA=q.createContext(void 0);function jA(e){let t=q.useContext(AA);if(!e&&t===void 0)throw Error(fv(27));return t}var MA=q.forwardRef(function(e,t){let{render:n,className:r,style:i,forceRender:a=!1,...o}=e,s=jA(),c=s.useState(`open`),l=s.useState(`nested`),u=s.useState(`mounted`);return Iv(`div`,e,{state:{open:c,transitionStatus:s.useState(`transitionStatus`)},ref:[s.context.backdropRef,t],stateAttributesMapping:$y,props:[{role:`presentation`,hidden:!u,style:{userSelect:`none`,WebkitUserSelect:`none`}},o],enabled:a||!l})}),NA=q.forwardRef(function(e,t){let{render:n,className:r,style:i,disabled:a=!1,nativeButton:o=!0,...s}=e,c=jA(),l=c.useState(`open`),{getButtonProps:u,buttonRef:d}=vv({disabled:a,native:o}),f={disabled:a};function p(e){l&&c.setOpen(!1,mb(Sb,e.nativeEvent))}return Iv(`button`,e,{state:f,ref:[t,d],props:[{onClick:p},s,u]})}),PA=q.forwardRef(function(e,t){let{render:n,className:r,style:i,id:a,...o}=e,s=jA(),c=eE(a);return s.useSyncedValueWithCleanup(`descriptionElementId`,c),Iv(`p`,e,{ref:t,props:[{id:c},o]})}),FA=q.createContext(void 0);function IA(){let e=q.useContext(FA);if(e===void 0)throw Error(fv(26));return e}var LA=`--nested-dialogs`,RA=`data-nested-dialog-open`,zA={...Qy,...zy,nestedDialogOpen(e){return e?{[RA]:``}:null}},BA=q.forwardRef(function(e,t){let{render:n,className:r,style:i,finalFocus:a,initialFocus:o,...s}=e,c=jA(),l=c.useState(`descriptionElementId`),u=c.useState(`disablePointerDismissal`),d=c.useState(`floatingRootContext`),f=c.useState(`popupProps`),p=c.useState(`modal`),m=c.useState(`mounted`),h=c.useState(`nested`),g=c.useState(`nestedOpenDialogCount`),_=c.useState(`open`),v=c.useState(`openMethod`),y=c.useState(`titleElementId`),b=c.useState(`transitionStatus`),x=c.useState(`role`),S=d.useState(`floatingId`);IA(),CC({open:_,ref:c.context.popupRef,onComplete(){_&&c.context.onOpenChangeComplete?.(!0)}});let C=o===void 0?EC(c.context.popupRef):o,w=g>0,T=c.useStateSetter(`popupElement`),E=Iv(`div`,e,{state:{open:_,nested:h,transitionStatus:b,nestedDialogOpen:w},props:[f,{id:S,"aria-labelledby":y,"aria-describedby":l,role:x,...TC,hidden:!m,onKeyDown(e){VO.has(e.key)&&e.stopPropagation()},style:{[LA]:g}},s],ref:[t,c.context.popupRef,T],stateAttributesMapping:zA});return(0,J.jsx)(ZS,{context:d,openInteractionType:v,disabled:!m,closeOnFocusOut:!u,initialFocus:C,returnFocus:a,modal:p!==!1,restoreFocus:`popup`,children:E})}),VA=q.forwardRef(function(e,t){let{cutout:n,...r}=e,i;if(n){let e=n.getBoundingClientRect();i=`polygon(0% 0%,100% 0%,100% 100%,0% 100%,0% 0%,${e.left}px ${e.top}px,${e.left}px ${e.bottom}px,${e.right}px ${e.bottom}px,${e.right}px ${e.top}px,${e.left}px ${e.top}px)`}return(0,J.jsx)(`div`,{ref:t,role:`presentation`,"data-base-ui-inert":``,...r,style:{position:`fixed`,inset:0,userSelect:`none`,WebkitUserSelect:`none`,clipPath:i}})}),HA=q.forwardRef(function(e,t){let{keepMounted:n=!1,...r}=e,i=jA(),a=i.useState(`mounted`),o=i.useState(`modal`),s=i.useState(`open`);return a||n?(0,J.jsx)(FA.Provider,{value:n,children:(0,J.jsxs)(MS,{ref:t,...r,children:[a&&o===!0&&(0,J.jsx)(VA,{ref:i.context.internalBackdropRef,inert:DE(!s)}),e.children]})}):null}),UA={},WA={},GA=``;function KA(e,t){return E_(e)?e:t}function qA(e,t,n){return/hidden|clip/.test(e.getComputedStyle(KA(t,n)).overflowY)}function JA(e){if(typeof document>`u`)return!1;let t=gv(e);return b_(t).innerWidth-t.documentElement.clientWidth>0}function YA(e){if(!(typeof CSS<`u`&&CSS.supports&&CSS.supports(`scrollbar-gutter`,`stable`))||typeof document>`u`)return!1;let t=gv(e),n=t.documentElement,r=t.body,i=KA(n,r),a=i.style.overflowY,o=n.style.scrollbarGutter;n.style.scrollbarGutter=`stable`,i.style.overflowY=`scroll`;let s=i.offsetWidth;i.style.overflowY=`hidden`;let c=i.offsetWidth;return i.style.overflowY=a,n.style.scrollbarGutter=o,s===c}function XA(e){let t=gv(e),n=t.documentElement,r=t.body,i=KA(n,r),a={overflowY:i.style.overflowY,overflowX:i.style.overflowX};return Object.assign(i.style,{overflowY:`hidden`,overflowX:`hidden`}),()=>{Object.assign(i.style,a)}}function ZA(e){let t=gv(e),n=t.documentElement,r=t.body,i=b_(n),a=0,o=0,s=!1,c=Gb.create();if(gy&&(i.visualViewport?.scale??1)!==1)return()=>{};function l(){let t=i.getComputedStyle(n),c=i.getComputedStyle(r),l=(t.scrollbarGutter||``).includes(`both-edges`)?`stable both-edges`:`stable`;a=n.scrollTop,o=n.scrollLeft,UA={scrollbarGutter:n.style.scrollbarGutter,overflowY:n.style.overflowY,overflowX:n.style.overflowX},GA=n.style.scrollBehavior,WA={position:r.style.position,height:r.style.height,width:r.style.width,boxSizing:r.style.boxSizing,overflowY:r.style.overflowY,overflowX:r.style.overflowX,scrollBehavior:r.style.scrollBehavior};let u=n.scrollHeight>n.clientHeight,d=n.scrollWidth>n.clientWidth,f=t.overflowY===`scroll`||c.overflowY===`scroll`,p=t.overflowX===`scroll`||c.overflowX===`scroll`,m=Math.max(0,i.innerWidth-r.clientWidth),h=Math.max(0,i.innerHeight-r.clientHeight),g=parseFloat(c.marginTop)+parseFloat(c.marginBottom),_=parseFloat(c.marginLeft)+parseFloat(c.marginRight),v=KA(n,r);s=YA(e),s?(n.style.scrollbarGutter=l,v.style.overflowY=`hidden`,v.style.overflowX=`hidden`):(Object.assign(n.style,{scrollbarGutter:l,overflowY:`hidden`,overflowX:`hidden`}),(u||f)&&(n.style.overflowY=`scroll`),(d||p)&&(n.style.overflowX=`scroll`),Object.assign(r.style,{position:`relative`,height:g||h?`calc(100dvh - ${g+h}px)`:`100dvh`,width:_||m?`calc(100vw - ${_+m}px)`:`100vw`,boxSizing:`border-box`,overflowY:`hidden`,overflowX:`hidden`,scrollBehavior:`unset`}),r.scrollTop=a,r.scrollLeft=o,n.setAttribute(`data-base-ui-scroll-locked`,``),n.style.scrollBehavior=`unset`)}function u(){Object.assign(n.style,UA),Object.assign(r.style,WA),s||(n.scrollTop=a,n.scrollLeft=o,n.removeAttribute(`data-base-ui-scroll-locked`),n.style.scrollBehavior=GA)}function d(){u(),c.request(l)}l();let f=zb(i,`resize`,d);return()=>{c.cancel(),u(),typeof i.removeEventListener==`function`&&f()}}var QA=new class{lockCount=0;restore=null;timeoutLock=ry.create();timeoutUnlock=ry.create();acquire(e){return this.lockCount+=1,this.lockCount===1&&this.restore===null&&this.timeoutLock.start(0,()=>this.lock(e)),this.release}release=()=>{--this.lockCount,this.lockCount===0&&this.restore&&this.timeoutUnlock.start(0,this.unlock)};unlock=()=>{this.lockCount===0&&this.restore&&(this.restore?.(),this.restore=null)};lock(e){if(this.lockCount===0||this.restore!==null)return;let t=gv(e),n=t.documentElement,r=t.body,i=b_(n);if(qA(i,n,r)){let t=new i.MutationObserver(()=>{qA(i,n,r)||(t.disconnect(),this.restore=null,this.lock(e))}),a={attributes:!0};t.observe(n,a),t.observe(r,a),this.restore=()=>t.disconnect();return}let a=dy||!JA(e);this.restore=a?XA(e):ZA(e)}};function $A(e=!0,t=null){Q(()=>{if(e)return QA.acquire(t)},[e,t])}function ej({store:e,parentContext:t,isDrawer:n}){let r=e.useState(`open`),i=e.useState(`mounted`),a=e.useState(`disablePointerDismissal`),o=e.useState(`modal`),s=e.useState(`popupElement`),c=e.useState(`floatingRootContext`),[l,u]=q.useState(0),[d,f]=q.useState(0),p=l===0,m=iC(c,{outsidePressEvent(){return e.context.internalBackdropRef.current||e.context.backdropRef.current?`intentional`:{mouse:o===`trap-focus`?`sloppy`:`intentional`,touch:`sloppy`}},outsidePress(t){if(!e.context.outsidePressEnabledRef.current||`button`in t&&t.button!==0)return!1;if(`touches`in t){if(t.type===`touchend`){if(t.changedTouches.length!==1||t.touches.length!==0)return!1}else if(t.touches.length!==1)return!1}let n=Oy(t);if(p&&!a){if(o){let t=e.context.internalBackdropRef.current,r=e.context.backdropRef.current;return t||r?t===n||r===n||Ey(n,s)&&!n?.hasAttribute(`data-base-ui-portal`):!0}return!0}return!1},escapeKey:p});return $A(r&&o===!0,s),e.useContextCallback(`onNestedDialogOpen`,(t,n)=>{(e.select(`open`)||e.select(`mounted`))&&(u(t),f(n))}),Q(()=>{!r&&!i&&(u(0),f(0))},[r,i]),Q(()=>(t?.onNestedDialogOpen&&r&&t.onNestedDialogOpen(l+1,d+ +!!n),()=>{t?.onNestedDialogOpen&&r&&t.onNestedDialogOpen(0,0)}),[n,r,l,d,t]),LC(e,{activeTriggerProps:m.reference,inactiveTriggerProps:m.trigger,popupProps:m.floating,nestedOpenDialogCount:l,nestedOpenDrawerCount:d}),null}var tj={...sw,modal:e=>e.modal,nested:e=>e.nested,nestedOpenDialogCount:e=>e.nestedOpenDialogCount,nestedOpenDrawerCount:e=>e.nestedOpenDrawerCount,disablePointerDismissal:e=>e.disablePointerDismissal,openMethod:e=>e.openMethod,descriptionElementId:e=>e.descriptionElementId,titleElementId:e=>e.titleElementId,viewportElement:e=>e.viewportElement,role:e=>e.role},nj=class extends QC{constructor(e,t,n){let r=new zC,i=rj(e,r,t,n);super(i,ij(r),tj)}setOpen=(e,t)=>{t.preventUnmountOnClose=()=>{this.set(`preventUnmountingOnClose`,!0)},!e&&t.trigger==null&&this.state.activeTriggerId!=null&&(t.trigger=this.state.activeTriggerElement??void 0),this.context.onOpenChange?.(e,t),!t.isCanceled&&(this.state.floatingRootContext.dispatchOpenChange(e,t),this.update(jC(this.state,e,t.trigger)))}};function rj(e,t,n,r=!1){return{...tw(t,n,r),modal:!0,disablePointerDismissal:!1,viewportElement:null,descriptionElementId:void 0,titleElementId:void 0,openMethod:null,nested:!1,nestedOpenDialogCount:0,nestedOpenDrawerCount:0,role:`dialog`,...e}}function ij(e){return{popupRef:q.createRef(),backdropRef:q.createRef(),internalBackdropRef:q.createRef(),outsidePressEnabledRef:{current:!0},triggerElements:e,onOpenChange:void 0,onOpenChangeComplete:void 0}}function aj(e,t){let{children:n,open:r,defaultOpen:i=!1,onOpenChange:a,onOpenChangeComplete:o,disablePointerDismissal:s=!1,modal:c=!0,actionsRef:l,handle:u,triggerId:d,defaultTriggerId:f=null}=t,p=e===`drawer`,m=e===`alert-dialog`,h=m?!0:c,g=m||s,_=m?`alertdialog`:`dialog`,v=jA(!0),y={modal:h,disablePointerDismissal:g,nested:v!=null,role:_},b=DC((e,t)=>new nj({open:i,openProp:r,activeTriggerId:f,triggerIdProp:d,...y},e,t),!0);b.useControlledProp(`openProp`,r),b.useControlledProp(`triggerIdProp`,d),b.useSyncedValues(y),b.useContextCallback(`onOpenChange`,a),b.useContextCallback(`onOpenChangeComplete`,o);let x=b.useState(`open`),S=b.useState(`mounted`),C=b.useState(`payload`);RC(b,x),FC(b);let{forceUnmount:w}=IC(x,b);q.useImperativeHandle(l,()=>({unmount:w,close:()=>b.setOpen(!1,mb(Nb))}),[w,b]);let T=x||S||u!=null;return(0,J.jsxs)(AA.Provider,{value:b,children:[u&&(0,J.jsx)(OC,{handle:u,store:b}),T&&(0,J.jsx)(ej,{store:b,parentContext:v?.context,isDrawer:p}),typeof n==`function`?n({payload:C}):n]})}var oj=Qv(function(e){return aj(`dialog`,e)}),sj=q.forwardRef(function(e,t){let{render:n,className:r,style:i,id:a,...o}=e,s=jA(),c=eE(a);return s.useSyncedValueWithCleanup(`titleElementId`,c),Iv(`h2`,e,{ref:t,props:[{id:c},o]})});function cj(e){let t=q.useRef(``),n=q.useCallback(n=>{n.defaultPrevented||(t.current=n.pointerType,e(n,n.pointerType))},[e]);return{onClick:q.useCallback(n=>{n.detail===0?e(n,`keyboard`):(`pointerType`in n?e(n,n.pointerType):e(n,t.current),t.current=``)},[e]),onPointerDown:n}}function lj(e,t){let n=q.useRef(e),r=Z(t);Q(()=>{n.current!==e&&r(n.current),n.current=e},[e,r])}function uj(e,t){let{onClick:n,onPointerDown:r}=cj(Z((n,r)=>{(typeof e==`function`?e():e)||t(r||(dy?`touch`:``))}));return q.useMemo(()=>({onClick:n,onPointerDown:r}),[n,r])}function dj(e){let[t,n]=q.useState(null),r=uj(e,n);return lj(e,t=>{t&&!e&&n(null)}),q.useMemo(()=>({openMethod:t,triggerProps:r}),[t,r])}function fj({...e}){return(0,J.jsx)(oj,{"data-slot":`dialog`,...e})}function pj({...e}){return(0,J.jsx)(HA,{"data-slot":`dialog-portal`,...e})}function mj({className:e,...t}){return(0,J.jsx)(MA,{"data-slot":`dialog-overlay`,className:X(`fixed inset-0 isolate z-50 bg-background/70 duration-(--duration-fast) supports-backdrop-filter:backdrop-blur-xs data-open:animate-in data-open:fade-in-0 data-closed:animate-out data-closed:fade-out-0`,e),...t})}function hj({className:e,children:t,showCloseButton:n=!0,...r}){return(0,J.jsxs)(pj,{children:[(0,J.jsx)(mj,{}),(0,J.jsxs)(BA,{"data-slot":`dialog-content`,className:X(`fixed top-1/2 left-1/2 z-50 grid w-full max-w-[calc(100%-2rem)] -translate-x-1/2 -translate-y-1/2 gap-4 rounded-xl bg-popover p-4 text-ui text-popover-foreground ring-1 ring-foreground/10 duration-(--duration-fast) outline-none sm:max-w-sm data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95`,e),...r,children:[t,n&&(0,J.jsxs)(NA,{"data-slot":`dialog-close`,render:(0,J.jsx)($,{variant:`ghost`,className:`absolute top-2 right-2`,size:`icon-sm`}),children:[(0,J.jsx)(i_,{}),(0,J.jsx)(`span`,{className:`sr-only`,children:`Close`})]})]})]})}function gj({className:e,...t}){return(0,J.jsx)(`div`,{"data-slot":`dialog-header`,className:X(`flex flex-col gap-2`,e),...t})}function _j({className:e,...t}){return(0,J.jsx)(sj,{"data-slot":`dialog-title`,className:X(`text-heading font-semibold`,e),...t})}function vj({className:e,...t}){return(0,J.jsx)(PA,{"data-slot":`dialog-description`,className:X(`text-ui text-muted-foreground *:[a]:underline *:[a]:underline-offset-3 *:[a]:hover:text-foreground`,e),...t})}var yj=({src:e,alt:t,onClose:n})=>(0,J.jsx)(fj,{open:!0,onOpenChange:e=>{e||n()},children:(0,J.jsxs)(hj,{"data-slot":`image-viewer`,className:`top-0 left-0 flex h-dvh w-screen max-w-none translate-x-0 translate-y-0 items-center justify-center rounded-none bg-background/95 p-4 pt-12 ring-0 sm:max-w-none`,onClick:e=>{e.target===e.currentTarget&&n()},children:[(0,J.jsx)(_j,{className:`sr-only`,children:t}),(0,J.jsx)(`img`,{src:e,alt:t,className:`max-h-full max-w-full object-contain`})]})}),bj=e=>e===null?null:Jk({path:`code.${e}`,language:e}),xj=({text:e,language:t})=>{let n=EA(e,bj(t)),r=e.split(`
|
|
83
|
+
`);return(0,J.jsx)(`pre`,{"data-slot":`thread-code`,className:`overflow-x-auto rounded-md border bg-surface-subtle px-2.5 py-1.5 font-mono text-code-compact`,children:(0,J.jsx)(`code`,{children:r.map((e,t)=>(0,J.jsx)(`span`,{className:`block min-h-[1lh] whitespace-pre`,children:(0,J.jsx)(DA,{text:e,tokens:n?.[t]})},t))})})},Sj=({kind:e,alt:t,src:n,size:r})=>{let[i,a]=(0,q.useState)(!1),[o,s]=(0,q.useState)(!1);if(i)return(0,J.jsxs)(`span`,{"data-slot":`thread-image`,className:`inline-flex items-center gap-1 rounded-sm border bg-muted px-1 text-caption text-muted-foreground`,children:[(0,J.jsx)(gg,{"aria-hidden":`true`,className:`size-3`}),e===`image`?`Image`:`Video`,t===``?``:`: ${t}`,` couldn't be loaded`]});let c=`block max-h-[28rem] max-w-full rounded-md border bg-muted`,l=t===``?`Image from the comment`:t;return e===`image`?(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(`button`,{type:`button`,"aria-label":`Open ${l} full screen`,onClick:()=>s(!0),className:`block max-w-full cursor-zoom-in rounded-md`,children:(0,J.jsx)(`img`,{"data-slot":`thread-media`,src:n,alt:l,...r===void 0?{}:{width:r.width,height:r.height},loading:`lazy`,onError:()=>a(!0),className:X(c,`h-auto w-auto`)})}),o&&(0,J.jsx)(yj,{src:n,alt:l,onClose:()=>s(!1)})]}):(0,J.jsx)(`video`,{"data-slot":`thread-media`,src:n,controls:!0,preload:`metadata`,onError:()=>a(!0),className:c})},Cj=({span:e,mediaUrl:t})=>{switch(e.kind){case`text`:return(0,J.jsx)(J.Fragment,{children:e.text});case`code`:return(0,J.jsx)(`code`,{className:`rounded-sm bg-muted px-1 font-mono text-code-compact`,children:e.text});case`strong`:return(0,J.jsx)(`strong`,{className:`font-semibold`,children:(0,J.jsx)(wj,{spans:e.spans,mediaUrl:t})});case`emphasis`:return(0,J.jsx)(`em`,{children:(0,J.jsx)(wj,{spans:e.spans,mediaUrl:t})});case`strike`:return(0,J.jsx)(`del`,{children:(0,J.jsx)(wj,{spans:e.spans,mediaUrl:t})});case`link`:return e.url===null?(0,J.jsx)(wj,{spans:e.spans,mediaUrl:t}):(0,J.jsx)(`a`,{href:e.url,title:e.url,target:`_blank`,rel:`noreferrer noopener nofollow`,className:`underline`,children:(0,J.jsx)(wj,{spans:e.spans,mediaUrl:t})});case`image`:case`video`:{if(e.url!==null&&t)return(0,J.jsx)(Sj,{kind:e.kind,alt:e.text,src:t(e.url),size:e.size});let n=e.kind===`image`?`Image`:`Video`;return(0,J.jsxs)(`span`,{"data-slot":`thread-image`,className:`inline-flex items-center gap-1 rounded-sm border bg-muted px-1 text-caption text-muted-foreground`,children:[(0,J.jsx)(gg,{"aria-hidden":`true`,className:`size-3`}),e.text===``?n:`${n}: ${e.text}`,(0,J.jsx)(`span`,{className:`sr-only`,children:`, not loaded: it isn't in the host's own attachments`})]})}}},wj=({spans:e,mediaUrl:t})=>e.map((e,n)=>(0,J.jsx)(Cj,{span:e,mediaUrl:t},`${e.kind}:${n}`)),Tj={1:`text-heading font-semibold`,2:`text-heading font-semibold`,3:`text-body font-semibold`},Ej={left:`text-left`,center:`text-center`,right:`text-right`},Dj=({blocks:e,...t})=>e.map((e,n)=>(0,J.jsx)(Oj,{block:e,...t},`${e.kind}:${n}`)),Oj=({block:e,suggestion:t,mediaUrl:n})=>{switch(e.kind){case`suggestion`:return(0,J.jsx)(`div`,{children:t(e.lines)});case`code`:return(0,J.jsx)(xj,{text:e.text,language:e.language});case`paragraph`:return(0,J.jsx)(`p`,{className:`whitespace-pre-wrap`,children:(0,J.jsx)(wj,{spans:e.spans,mediaUrl:n})});case`heading`:return(0,J.jsx)(`p`,{"data-slot":`thread-heading`,className:X(`whitespace-pre-wrap`,Tj[e.level]??`font-semibold`),children:(0,J.jsx)(wj,{spans:e.spans,mediaUrl:n})});case`quote`:return(0,J.jsx)(`blockquote`,{className:`flex flex-col gap-2 border-l-2 border-border pl-3 text-muted-foreground`,children:(0,J.jsx)(Dj,{blocks:e.blocks,suggestion:t,mediaUrl:n})});case`list`:{let r=e.items.map((e,r)=>(0,J.jsx)(`li`,{className:X(`pl-1`,e.checked!==null&&`list-none -ml-5 pl-0`),children:(0,J.jsxs)(`div`,{className:`flex items-baseline gap-1.5`,children:[e.checked!==null&&(0,J.jsx)(`span`,{"aria-hidden":`true`,className:`w-4 shrink-0 text-center`,children:e.checked?`☑`:`☐`}),e.checked!==null&&(0,J.jsx)(`span`,{className:`sr-only`,children:e.checked?`Done: `:`Not done: `}),(0,J.jsx)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-1`,children:(0,J.jsx)(Dj,{blocks:e.blocks,suggestion:t,mediaUrl:n})})]})},r));return e.ordered?(0,J.jsx)(`ol`,{start:e.start,className:`flex list-decimal flex-col gap-1 pl-5`,children:r}):(0,J.jsx)(`ul`,{className:`flex list-disc flex-col gap-1 pl-5`,children:r})}case`table`:return(0,J.jsx)(`div`,{className:`overflow-x-auto`,children:(0,J.jsxs)(`table`,{className:`border-collapse text-ui`,children:[(0,J.jsx)(`thead`,{children:(0,J.jsx)(`tr`,{children:e.head.map((t,r)=>(0,J.jsx)(`th`,{className:X(`border bg-muted px-2 py-1 font-semibold`,Ej[e.align[r]??`left`]),children:(0,J.jsx)(wj,{spans:t,mediaUrl:n})},r))})}),(0,J.jsx)(`tbody`,{children:e.rows.map((t,r)=>(0,J.jsx)(`tr`,{children:t.map((t,r)=>(0,J.jsx)(`td`,{className:X(`border px-2 py-1`,Ej[e.align[r]??`left`]),children:(0,J.jsx)(wj,{spans:t,mediaUrl:n})},r))},r))})]})});case`rule`:return(0,J.jsx)(`hr`,{className:`border-border`})}},kj=({blocks:e,suggestion:t,mediaUrl:n})=>(0,J.jsx)(`div`,{"data-slot":`thread-body`,className:`flex flex-col gap-2 text-body break-words`,children:(0,J.jsx)(Dj,{blocks:e,suggestion:t,mediaUrl:n})}),Aj=`inline-flex items-center gap-1 rounded-sm border px-1.5 text-caption font-medium`,jj=`shadow-[inset_0_0_0_2px_var(--ring)]`,Mj=({name:e})=>(0,J.jsx)(`span`,{"aria-hidden":`true`,className:`flex size-6 shrink-0 items-center justify-center rounded-full bg-muted text-caption font-medium text-muted-foreground`,children:kk(e)}),Nj=e=>{let t=e.line??e.originalLine;if(t===null)return e.path;let n=e.side===`old`?`old `:``;return e.startLine!==null&&e.line!==null?`${n}lines ${e.startLine}–${t}`:`${n}line ${t}`},Pj=e=>{let t=[];for(let n of e){let e=t.at(-1);e!==void 0&&e[0]?.author.id===n.author.id?e.push(n):t.push([n])}return t},Fj=({thread:e,authorId:t,now:n,language:r,covered:i,onReply:a,onResolve:o,replying:s=!1,mediaUrl:c,initialReply:l,current:u=!1,anchorId:d,linesAbove:f=0,className:p})=>{let[m,h]=(0,q.useState)(!e.resolved||u),[g,_]=(0,q.useState)(u);u!==g&&(_(u),u&&h(!0));let[v,y]=(0,q.useState)(l!==void 0),[b,x]=(0,q.useState)(0),[S,C]=(0,q.useState)(l?.text??``),[w,T]=(0,q.useState)(l?.status===`posting`),[E,D]=(0,q.useState)(l?.status===`failed`?l.error??``:null),[O,k]=(0,q.useState)(!1),[A,j]=(0,q.useState)(null),M=(0,q.useRef)(null),N=(0,q.useId)(),P=e.resolved?`resolved`:e.outdated?`outdated`:`open`,F=!e.outdated&&e.line!==null&&e.side===`new`,I=a!==void 0&&e.can.reply,L=o!==void 0&&e.can.resolve,R=I&&(v||S!==``||w||E!==null),ee=()=>{h(!0),y(!0),x(e=>e+1)};(0,q.useEffect)(()=>{b>0&&M.current?.focus()},[b]),(0,q.useEffect)(()=>{s&&ee()},[s]);let z=()=>M.current?.closest(`[data-slot=review-thread]`)?.focus(),te=()=>{w||(z(),C(``),D(null),y(!1))},B=async()=>{let e=S.trim();if(e===``||w||a===void 0)return;let t=M.current?.closest(`[data-slot=review-thread]`);T(!0),D(null);let n=await a(e);T(!1),n===null?(C(``),y(!1),t?.focus()):D(n)},ne=async()=>{if(o===void 0||O)return;k(!0),j(null);let t=await o(!e.resolved);k(!1),t===null?h(e.resolved):j(t)},V=e=>(0,J.jsx)(kA,{title:`Suggested change`,removed:F?i:null,added:e,language:r}),H=e=>(0,J.jsx)(`time`,{dateTime:e.createdAt,title:Pk(e.createdAt),className:`ml-auto shrink-0 pl-3 text-caption text-muted-foreground`,children:Nk(e.createdAt,n)}),re=e=>{let[n]=e;return n===void 0?null:(0,J.jsxs)(`section`,{"data-slot":`thread-group`,className:`grid grid-cols-[1.5rem_minmax(0,1fr)] gap-x-2.5 gap-y-0.5`,children:[(0,J.jsx)(Mj,{name:n.author.name}),(0,J.jsxs)(`header`,{className:`flex min-w-0 flex-wrap items-center gap-x-2 gap-y-0.5`,children:[(0,J.jsx)(`span`,{className:`font-medium`,children:n.author.name}),t!==null&&n.author.id===t&&(0,J.jsx)(`span`,{className:X(`inline-flex items-center gap-1 rounded-sm border px-1.5 text-caption font-medium`,`border-border bg-muted text-muted-foreground`),children:`Author`}),H(n)]}),e.length>1?(0,J.jsx)(`span`,{"data-slot":`thread-run`,"aria-hidden":`true`,className:`flex justify-center pt-1.5 pb-1`,children:(0,J.jsx)(`span`,{className:`w-px bg-thread-run`})}):(0,J.jsx)(`span`,{"aria-hidden":`true`}),(0,J.jsx)(`div`,{className:`flex min-w-0 flex-col gap-3`,children:e.map((e,t)=>{let{blocks:n}=Vd(e.body);return(0,J.jsxs)(`div`,{"data-slot":`thread-comment`,className:`flex items-baseline`,children:[(0,J.jsx)(`div`,{className:`flex min-w-0 flex-1 flex-col items-start gap-1.5`,children:(0,J.jsx)(`div`,{className:`w-full`,children:(0,J.jsx)(kj,{blocks:n,suggestion:V,...c===void 0?{}:{mediaUrl:c}})})}),t>0&&H(e)]},e.id)})})]})},[ie]=e.comments,ae=e.line??e.originalLine,oe=e.resolvedBy?.name,se=I||L;return(0,J.jsx)(Ok,{as:`article`,state:P,"data-slot":`review-thread`,id:d,"data-current":u||void 0,"aria-label":`Thread on ${Nj(e)}${e.resolved?`, resolved`:``}`,tabIndex:-1,style:vh({"--lines-above":Math.min(f,5)}),className:X(`flex scroll-mt-[calc(6rem+var(--lines-above)*var(--text-code--line-height))] flex-col gap-3 -outline-offset-2`,!m&&`py-1.5`,u&&jj,p),children:m?(0,J.jsxs)(J.Fragment,{children:[(0,J.jsxs)(`div`,{"data-slot":`thread-header`,className:`flex flex-wrap items-center gap-x-1.5 gap-y-1 text-caption text-muted-foreground`,children:[ae!==null&&(0,J.jsxs)(J.Fragment,{children:[e.startLine!==null&&e.line!==null?`Lines`:`Line`,` `,(0,J.jsx)(Ik,{children:Fk(e.side,e.line===null?null:e.startLine,ae)}),(0,J.jsx)(`span`,{children:`·`})]}),(0,J.jsxs)(`span`,{children:[e.comments.length,` `,e.comments.length===1?`comment`:`comments`]}),e.outdated&&(0,J.jsx)(`span`,{className:X(`inline-flex items-center gap-1 rounded-sm border px-1.5 text-caption font-medium`,`border-border bg-muted text-muted-foreground`),children:`Outdated`}),e.resolved&&(0,J.jsxs)(J.Fragment,{children:[(0,J.jsxs)(`span`,{className:`text-review-approved`,children:[(0,J.jsx)(`span`,{"aria-hidden":`true`,children:`✓ `}),`Resolved`,oe===void 0?``:` by ${oe}`]}),(0,J.jsx)($,{variant:`ghost`,size:`sm`,onClick:()=>h(!1),"aria-expanded":!0,children:`Hide`})]})]}),Pj(e.comments).map((e,t)=>(0,J.jsxs)(q.Fragment,{children:[t>0&&(0,J.jsx)(`hr`,{"data-slot":`thread-divider`}),re(e)]},e[0]?.id??t)),A!==null&&(0,J.jsxs)(`p`,{role:`alert`,className:`text-caption text-destructive`,children:[`✕ `,e.resolved?`Not reopened`:`Not resolved`,`: `,A]}),R?(0,J.jsxs)(`div`,{"data-slot":`thread-reply`,className:`flex flex-col gap-1.5 border-t pt-3 pl-8.5`,children:[(0,J.jsxs)(`label`,{htmlFor:N,className:`sr-only`,children:[`Reply to the thread on `,Nj(e)]}),(0,J.jsx)(ik,{id:N,ref:M,rows:2,value:S,placeholder:`Reply…`,disabled:w,"aria-invalid":E!==null||void 0,onChange:e=>C(e.target.value),onSubmitShortcut:()=>void B(),onKeyDown:e=>{e.key===`Escape`&&(e.stopPropagation(),te())},className:`min-h-14 bg-background`}),E!==null&&(0,J.jsxs)(`p`,{role:`alert`,className:`text-caption text-destructive`,children:[`✕ Not sent: `,E,` Your reply is still here; send it again when you're ready.`]}),(0,J.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,J.jsx)(Ek,{hints:[{id:`submit`,action:`reply`},{id:`close`,action:`cancel`}]}),(0,J.jsxs)(`div`,{className:`ml-auto flex items-center gap-2`,children:[(0,J.jsx)($,{variant:`ghost`,size:`sm`,disabled:w,onClick:te,children:`Cancel`}),(0,J.jsx)($,{size:`sm`,disabled:S.trim()===``||w,onClick:()=>void B(),children:w?`Sending…`:`Reply`})]})]})]}):se&&(0,J.jsxs)(`div`,{"data-slot":`thread-actions`,className:`flex items-center gap-2 pl-8.5`,children:[I&&(0,J.jsx)(`button`,{type:`button`,onClick:ee,className:`h-8 min-w-0 flex-1 cursor-text truncate rounded-md border border-input bg-background px-2.5 text-left text-ui text-muted-foreground hover:border-foreground/40`,children:`Reply…`}),L&&(0,J.jsx)($,{variant:`outline`,size:`sm`,disabled:O,onClick:()=>void ne(),className:X(!I&&`ml-auto`),children:e.resolved?`Reopen`:(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(Ih,{"aria-hidden":`true`}),`Resolve`]})})]})]}):(0,J.jsxs)(`div`,{className:`flex min-h-7 flex-wrap items-center gap-2`,children:[(0,J.jsxs)(`span`,{className:`text-caption text-review-approved`,children:[(0,J.jsx)(`span`,{"aria-hidden":`true`,children:`✓ `}),`Resolved`,oe===void 0?``:` by ${oe}`]}),ie!==void 0&&(0,J.jsxs)(`span`,{className:`min-w-0 flex-1 truncate text-caption text-muted-foreground`,children:[ie.author.name,`: `,Td(ie.body)]}),(0,J.jsxs)($,{variant:`ghost`,size:`sm`,onClick:()=>h(!0),"aria-expanded":!1,children:[`Show `,e.comments.length,` `,e.comments.length===1?`comment`:`comments`]})]})})},Ij=/[\p{L}\p{N}_]+|\s+|[^\p{L}\p{N}_\s]/gu,Lj=e=>e.match(Ij)??[],Rj=e=>{let t=new Map,n=0;for(;n<e.length;){if(e[n]?.kind!==`del`){n++;continue}let r=n;for(;e[n]?.kind===`del`;)n++;let i=n;for(;e[n]?.kind===`add`;)n++;let a=Math.min(i-r,n-i);for(let n=0;n<a;n++){let a=zj(e[r+n]?.text??``,e[i+n]?.text??``);a!==null&&(t.set(r+n,a.old),t.set(i+n,a.new))}}return t},zj=(e,t)=>{if(e.length>500||t.length>500)return null;let n=Lj(e),r=Lj(t),{inOld:i,inNew:a}=Vj(n,r),o=n.reduce((e,t,n)=>e+(i[n]?t.length:0),0),s=e.length+t.length;return s>0&&2*o/s<.3?null:{old:Bj(n,i),new:Bj(r,a)}},Bj=(e,t)=>{let n=[],r=0;return e.forEach((e,i)=>{let a=r+e.length;if(!t[i]){let e=n.at(-1);e?.end===r?n[n.length-1]={start:e.start,end:a}:n.push({start:r,end:a})}r=a}),n},Vj=(e,t)=>{let n=e.map(()=>!1),r=t.map(()=>!1),i=new Map([[1,0]]),a=[],o=(e,t)=>a[e]?.[t+e+1]??0,s=0;search:for(let n=0;n<=e.length+t.length;n++){let r=new Int32Array(2*n+3);for(let e=-n-1;e<=n+1;e++)r[e+n+1]=i.get(e)??0;a.push(r);for(let r=-n;r<=n;r+=2){let a=r===-n||r!==n&&(i.get(r-1)??0)<(i.get(r+1)??0)?i.get(r+1)??0:(i.get(r-1)??0)+1,o=a-r;for(;a<e.length&&o<t.length&&e[a]===t[o];)a++,o++;if(i.set(r,a),a>=e.length&&o>=t.length){s=n;break search}}}let c=e.length,l=t.length;for(let e=s;e>=0;e--){let t=c-l,i=t===-e||t!==e&&o(e,t-1)<o(e,t+1)?t+1:t-1,a=o(e,i),s=a-i;for(;c>a&&l>s;)c--,l--,n[c]=!0,r[l]=!0;c=a,l=s}return{inOld:n,inNew:r}},Hj=(e,t=null)=>{let n=Rj(e.lines);return iA(e.lines).map(({line:r,text:i,carriageReturn:a},o)=>({key:`${e.id}:${o}`,hunkId:e.id,kind:r.kind,oldNo:r.oldLine,newNo:r.newLine,text:i,tokens:t?.[o]??null,wordRanges:n.get(o)??[],notes:[...a?[`CRLF`]:[],...r.noNewlineAtEnd?[`No newline at end of file`]:[]]}))},Uj=e=>e.kind===`del`?e.oldLine===null?null:{side:`old`,line:e.oldLine}:e.newLine===null?null:{side:`new`,line:e.newLine},Wj=`sticky left-0 w-[100cqw]`,Gj=`pr-3 pl-29`,Kj=({inset:e,children:t})=>(0,J.jsx)(`div`,{role:`row`,"data-slot":`line-row`,className:X(e&&X(Gj,`py-2`),`font-sans`,Wj),children:(0,J.jsx)(`div`,{role:`cell`,children:t})}),qj=(e,t)=>e.side===t.side&&e.line===t.line,Jj=e=>e.startLine===void 0?`Comment on ${e.side===`old`?`old `:``}line ${e.line}`:`Comment on ${e.side===`old`?`old `:``}lines ${e.startLine}–${e.line}`,Yj=(e,t,n)=>{let r=new Map(e.lines.flatMap(e=>e.kind!==`del`&&e.newLine!==null?[[e.newLine,e.text]]:[])),i=[];for(let e=t;e<=n;e+=1){let t=r.get(e);if(t===void 0)return null;i.push(t)}return i},Xj=[],Zj=(0,q.memo)(function({id:e,hunk:t,file:n,risk:r,proofs:i=[],highlighted:a=!1,focused:o=!1,onFocus:s,lineLimit:c,unchanged:l=[],comments:u=[],openComment:d=null,onOpenComment:f,onCancelComment:p,onComment:m,onCommentNow:h,afterHeader:g,threadsAt:_,rangeNote:v,inFile:y=!1,marks:b,pointLines:x,pointsAt:S,pointsAtEnd:C,flagged:w}){let T=e??t.id,E=(0,q.useRef)(null),[D,O]=(0,q.useState)(!1),k=CA(t,n,SA(E)),A=(0,q.useMemo)(()=>Hj(t,k),[t,k]),j=c===void 0||D||A.length<=c?A:A.slice(0,c);(0,q.useEffect)(()=>{let e=E.current;o&&e!==null&&!e.contains(document.activeElement)&&(e.focus({preventScroll:!0}),e.scrollIntoView({block:`start`}))},[o]);let M=aA(t),N=!y||i.length>0,P=f!==void 0&&m!==void 0,F=(e,t)=>{let n=d;if(n!==null&&n.side===e.side&&n.line===e.line)f?.(T,null);else if(t&&n!==null&&n.side===e.side){let t=Math.min(n.startLine??n.line,e.line),r=Math.max(n.line,e.line);f?.(T,{side:e.side,line:r,startLine:t})}else f?.(T,e)};return(0,J.jsxs)(`section`,{ref:E,"data-slot":`hunk-card`,"data-risk":r?.riskClass,"data-highlighted":a||void 0,className:X(`relative scroll-mt-24 bg-card -outline-offset-2`,!y&&`overflow-hidden rounded-lg border`,a&&`bg-primary/5 shadow-[inset_0_0_0_2px_var(--ring)]`),"aria-label":`${n.path}, ${sA(t)}`,tabIndex:0,onFocus:()=>s?.(T),children:[N&&(0,J.jsxs)(`header`,{"data-slot":`hunk-header`,className:X(`flex flex-wrap items-center gap-x-3 gap-y-1 border-b bg-surface-subtle px-3 py-1.5`,y&&`sticky left-0 w-[100cqw]`),children:[!y&&(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)($D,{file:n,status:n.status}),(0,J.jsx)(eO,{status:n.status}),t.sectionHeading!==null&&(0,J.jsx)(`code`,{className:`font-mono text-code-compact text-diff-hunk-fg`,children:t.sectionHeading}),(0,J.jsxs)(`span`,{className:`tabular font-mono text-code-compact`,children:[(0,J.jsxs)(`span`,{className:`text-diff-add-fg`,children:[`+`,M.added]}),` `,(0,J.jsxs)(`span`,{className:`text-diff-del-fg`,children:[`−`,M.deleted]})]})]}),i.map(e=>(0,J.jsxs)(`span`,{className:`text-caption text-review-approved`,children:[(0,J.jsx)(`span`,{"aria-hidden":`true`,children:`✓ `}),e.detail]},e.kind)),!y&&r!==null&&(0,J.jsxs)(`span`,{className:`ml-auto`,title:r.reason===``?void 0:r.reason,children:[(0,J.jsx)(oO,{status:KE[r.riskClass]}),r.reason!==``&&(0,J.jsxs)(`span`,{className:`sr-only`,children:[`: `,r.reason]})]})]}),(l.length>0||g!=null)&&(0,J.jsxs)(`div`,{className:X(y&&`sticky left-0 w-[100cqw]`),children:[l.map(e=>(0,J.jsx)(nO,{callers:e,named:l.length>1},e.symbol)),g]}),(0,J.jsx)(`div`,{role:`table`,"aria-label":`Lines`,className:X(`[content-visibility:auto]`,!y&&`overflow-x-auto`),style:{containIntrinsicSize:`auto ${j.length*20}px`},children:(0,J.jsx)(`div`,{className:`w-max min-w-full`,children:j.map(e=>{let r=Uj({kind:e.kind,oldLine:e.oldNo,newLine:e.newNo}),i=r===null?void 0:u.find(e=>qj(e,r)),a=r!==null&&d!==null&&qj(d,r),o=a?d:i,s=r===null?null:_?.(r)??null,c=r===null?null:S?.(r)??null,l=r===null?null:C?.(r)??null,g=r===null?null:`${r.side}:${r.line}`,E=g===null?void 0:x?.get(g);return(0,J.jsxs)(q.Fragment,{children:[(0,J.jsx)(BE,{line:e,cellRole:`cell`,pointKind:E?.kind??null,flagged:g!==null&&w?.has(g)===!0,...l===null?{}:{end:l},...E?.landing===void 0?{}:{pointLanding:E.landing},marks:(e.kind===`del`||e.newNo===null?void 0:b?.get(e.newNo))??Xj,marked:r!==null&&m!==void 0&&d!==null&&d.side===r.side&&r.line>=(d.startLine??d.line)&&r.line<=d.line,numberButton:r===null||!P?void 0:{side:r.side,label:Jj(r),onClick:e=>F(r,e.shiftKey)},...r===null||!P?{}:{onRowClick:e=>{window.getSelection()?.isCollapsed!==!1&&(e.target instanceof Element&&e.target.closest(`button`)||F(r,e.shiftKey))}}}),c,r!==null&&o!=null&&(i!==void 0||a&&m!==void 0)&&(0,J.jsx)(Qj,{place:o,comment:i,editing:a&&m!==void 0,shown:(e,n)=>Yj(t,e,n),language:Jk(n),rangeNote:v,fileName:n.path.split(`/`).at(-1)??n.path,onChange:m===void 0?void 0:e=>m(T,{side:o.side,line:o.line,...o.startLine===void 0?{}:{startLine:o.startLine},...e}),onEdit:()=>f?.(T,{side:o.side,line:o.line,...o.startLine===void 0?{}:{startLine:o.startLine}}),onDone:()=>f?.(T,null),onCancel:()=>p?.(T,o),...h===void 0?{}:{onPostNow:e=>h(T,{side:o.side,line:o.line,...o.startLine===void 0?{}:{startLine:o.startLine},...e})},pinned:y}),s!==null&&(0,J.jsx)(`div`,{role:`row`,"data-slot":`line-threads`,className:X(Gj,`py-2 font-sans`,y&&`sticky left-0 w-[100cqw]`),children:(0,J.jsx)(`div`,{role:`cell`,className:`flex max-w-3xl flex-col gap-2`,children:s})})]},e.key)})})}),j.length<A.length&&(0,J.jsx)(`div`,{className:X(`border-t p-2`,y&&`sticky left-0 w-[100cqw]`),children:(0,J.jsxs)($,{variant:`outline`,size:`sm`,onClick:()=>O(!0),children:[`Show all `,A.length,` lines`]})})]})}),Qj=({place:e,comment:t,editing:n,shown:r,language:i,rangeNote:a,fileName:o,onChange:s,onEdit:c,onDone:l,onCancel:u,onPostNow:d,pinned:f})=>{let p=(0,q.useRef)(null),m=(0,q.useRef)(null),[h,g]=(0,q.useState)(`write`),[_,v]=(0,q.useState)(!1),[y,b]=(0,q.useState)(null);(0,q.useEffect)(()=>{n?m.current?.focus():(g(`write`),b(null))},[n]);let x=Jj(e),S=t?.body??``,C=t?.suggestion,w={body:S,...C===void 0?{}:{suggestion:C}},T=(0,q.useRef)(null);n?T.current===null&&(T.current=w):T.current=null;let E=e.side===`new`?r(e.startLine??e.line,e.line):null,D=e.startLine===void 0?null:`Lines ${e.startLine}–${e.line}`,O=()=>p.current?.closest(`[data-slot=hunk-card]`)?.focus({preventScroll:!0}),k=()=>s?.({body:``}),A=()=>{O(),S.trim()===``&&C===void 0&&s?.({body:``}),l()},j=async()=>{if(d===void 0||_||S.trim()===``)return;v(!0),b(null);let e=await d(w);v(!1),e===null?(O(),s?.({body:``}),l()):b(e)},M=()=>{O();let e=T.current;s?.(e===null||e.body.trim()===``&&e.suggestion===void 0?{body:``}:e),u?.(),l()},N=e=>(0,J.jsx)(kA,{title:`Suggested change`,removed:E,added:e,language:i});return(0,J.jsx)(`div`,{ref:p,role:`row`,"data-slot":`line-comment`,"data-editing":n||void 0,className:X(Gj,`py-2 font-sans`,f&&`sticky left-0 w-[100cqw]`),children:(0,J.jsx)(Ok,{role:`cell`,state:`draft`,className:`flex max-w-3xl flex-col gap-2`,onKeyDown:n?e=>{if(e.key===`Enter`&&(e.metaKey||e.ctrlKey)){if(e.defaultPrevented)return;e.preventDefault(),A()}else e.key===`Escape`&&(e.stopPropagation(),M())}:void 0,children:n?(0,J.jsxs)(J.Fragment,{children:[(0,J.jsxs)(`p`,{className:`flex flex-wrap items-center gap-x-1.5 gap-y-1 text-caption text-muted-foreground`,children:[`Commenting on `,(0,J.jsx)(Ik,{children:o}),e.startLine===void 0?`line`:`lines`,` `,(0,J.jsx)(Ik,{children:Fk(e.side,e.startLine??null,e.line)}),a!==void 0&&e.startLine!==void 0&&(0,J.jsx)(`span`,{children:a})]}),(0,J.jsxs)($O,{value:h,onValueChange:e=>g(e===`preview`?`preview`:`write`),children:[(0,J.jsxs)(tk,{children:[(0,J.jsx)(nk,{value:`write`,children:`Write`}),(0,J.jsx)(nk,{value:`preview`,children:`Preview`})]}),(0,J.jsx)(rk,{value:`write`,children:(0,J.jsx)(ik,{ref:m,rows:2,"aria-label":x,placeholder:`Leave a comment`,value:S,onChange:e=>s?.({...w,body:e.target.value}),onSubmitShortcut:A,className:`min-h-14 bg-background`})}),(0,J.jsx)(rk,{value:`preview`,"data-slot":`comment-preview`,className:`min-h-14 rounded-md border px-2.5 py-2`,children:S.trim()===``?(0,J.jsx)(`p`,{className:`text-caption text-muted-foreground`,children:`Nothing to preview`}):(0,J.jsx)(kj,{blocks:Vd(S).blocks,suggestion:N})})]}),(0,J.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,J.jsx)(Ek,{hints:[{id:`submit`,action:`add to review`},{id:`close`,action:`cancel`}]}),(0,J.jsxs)(`div`,{className:`ml-auto flex items-center gap-2`,children:[(0,J.jsx)($,{variant:`ghost`,size:`sm`,disabled:_,onClick:M,children:`Cancel`}),d!==void 0&&(0,J.jsx)($,{variant:`outline`,size:`sm`,disabled:_||S.trim()===``,onClick:()=>void j(),children:_?`Posting…`:`Comment now`}),(0,J.jsx)($,{size:`sm`,disabled:_,onClick:A,children:`Add to review`})]})]}),y!==null&&(0,J.jsxs)(`p`,{role:`alert`,className:`text-caption text-destructive`,children:[`✕ Not posted: `,y,` Your comment is still here.`]})]}):(0,J.jsxs)(J.Fragment,{children:[(0,J.jsxs)(`header`,{className:`flex flex-wrap items-center gap-2`,children:[(0,J.jsxs)(`span`,{className:`sr-only`,children:[x,`: `]}),(0,J.jsx)(`span`,{className:X(Aj,`border-review-pending/25 bg-review-pending-bg text-review-pending`),children:s===void 0?`Posted with your review`:`Draft · posts with your review`}),D!==null&&(0,J.jsx)(`span`,{className:`text-caption text-muted-foreground`,children:D})]}),S.trim()!==``&&(0,J.jsx)(kj,{blocks:Vd(S).blocks,suggestion:N}),C!==void 0&&N(C),s!==void 0&&(0,J.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,J.jsx)($,{variant:`outline`,size:`sm`,onClick:c,children:`Edit`}),(0,J.jsx)($,{variant:`ghost`,size:`sm`,onClick:k,children:`Discard`})]})]})})})},$j=()=>NE(),eM=({handle:e,payload:t,id:n,render:r=(0,J.jsx)(`span`,{}),children:i})=>(0,J.jsx)(ME,{handle:e,payload:t,id:n,delay:300,closeDelay:150,render:r,"data-slot":`call`,className:`underline decoration-current decoration-dotted underline-offset-3 hover:decoration-primary hover:decoration-solid data-popup-open:decoration-primary data-popup-open:decoration-solid`,children:i}),tM=({handle:e,onGoTo:t})=>(0,J.jsx)(jE,{handle:e,children:({payload:n})=>n===void 0?null:(0,J.jsx)(PE,{side:`bottom`,align:`start`,"aria-label":n.label??`Code ${n.symbol} runs`,className:`flex max-h-[min(26rem,60vh)] w-[min(44rem,calc(100vw-2rem))] flex-col overflow-hidden p-0`,children:(0,J.jsx)(nM,{payload:n,onGoTo:n=>{e.close(),t(n)}})})}),nM=({payload:e,onGoTo:t})=>{let n=(0,q.useRef)(null),r=e.targets[0],i=r===void 0?null:`${r.hunk.id}:${iM(r.hunk,e.symbol)}`;return(0,q.useEffect)(()=>{let e=n.current,t=i===null?null:e?.querySelector(`[data-line="${i}"]`),r=e?.querySelector(`header`);e!=null&&t!=null&&(e.scrollTop=t.offsetTop-(r?.offsetHeight??0))},[i]),(0,J.jsx)(`div`,{ref:n,"data-slot":`peek-scroller`,className:`@container relative min-h-0 overflow-auto`,children:(0,J.jsx)(`div`,{className:`w-max min-w-full`,children:e.targets.map((n,r)=>(0,J.jsx)(rM,{target:n,symbol:e.symbol,onGoTo:t,divided:r>0,last:r===e.targets.length-1},n.id))})})},rM=({target:e,symbol:t,onGoTo:n,divided:r,last:i})=>{let{hunk:a,file:o}=e,s=CA(a,o,!0),c=(0,q.useMemo)(()=>Hj(a,s),[a,s]),l=aA(a),u=sA(a);return(0,J.jsxs)(`section`,{"aria-label":`${o.path}, ${u}`,className:r?`border-t`:void 0,children:[(0,J.jsxs)(`header`,{className:X(Wj,`top-0 z-[2] flex flex-wrap items-center gap-x-3 gap-y-1 border-b bg-surface-subtle px-3 py-1 text-caption`),children:[(0,J.jsx)($D,{file:o,status:o.status}),(0,J.jsx)(`span`,{className:`text-muted-foreground`,children:u}),(0,J.jsxs)(`span`,{className:`tabular font-mono text-code-compact`,children:[(0,J.jsxs)(`span`,{className:`text-diff-add-fg`,children:[`+`,l.added]}),` `,(0,J.jsxs)(`span`,{className:`text-diff-del-fg`,children:[`−`,l.deleted]})]}),(0,J.jsx)($,{variant:`link`,size:`xs`,className:`ml-auto px-0`,onClick:()=>n(e.id),children:`Go to file`})]}),(0,J.jsx)(`div`,{role:`table`,"aria-label":`Lines of ${t}`,className:`w-max min-w-full`,children:c.map(e=>(0,J.jsx)(BE,{line:e,layout:`split-new`,cellRole:`cell`,density:`compact`},e.key))}),i&&(0,J.jsx)(UE,{kind:c.at(-1)?.kind??`context`,className:`h-3`})]})},iM=(e,t)=>{let n=t.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`),r=RegExp(`(?<![\\w$])${n}(?![\\w$])`),i=RegExp(`\\b(def|class|function|func|fn|const|let|var|type|interface|enum|struct|trait|impl)\\b[^=(]*?(?<![\\w$])${n}(?![\\w$])`),a=e.lines.map((e,t)=>({line:e,at:t})).filter(({line:e})=>e.kind!==`del`);return a.find(({line:e})=>i.test(e.text))?.at??a.find(({line:e})=>r.test(e.text))?.at??0},aM=q.createContext(void 0);function oM(){return q.useContext(aM)}function sM(e){let{render:t,className:n,style:r,state:i=Mv,props:a=jv,refs:o=jv,metadata:s,stateAttributesMapping:c,tag:l=`div`,...u}=e,{compositeProps:d,compositeRef:f}=EO({metadata:s});return Iv(l,e,{state:i,ref:[f,...o],props:[d,...a,u],stateAttributesMapping:c})}var cM=q.forwardRef(function(e,t){let{className:n,defaultPressed:r=!1,disabled:i=!1,form:a,onPressedChange:o,pressed:s,render:c,type:l,value:u,nativeButton:d=!0,style:f,...p}=e,m=eE(u||void 0),h=oM(),g=h?.value??[],_=(i||h?.disabled)??!1,[v,y]=sO({controlled:h?m!==void 0&&g.indexOf(m)>-1:s,default:r,name:`Toggle`,state:`pressed`}),{getButtonProps:b,buttonRef:x}=vv({disabled:_,native:d}),S={disabled:_,pressed:v},C=[x,t],w=[{"aria-pressed":v,onClick(e){let t=!v,n=mb(gb,e.nativeEvent);o?.(t,n),!n.isCanceled&&(m&&h?.setGroupValue?.(m,t,n),!n.isCanceled&&y(t))}},p,b],T=Iv(`button`,e,{enabled:!h,state:S,ref:C,props:w}),E=q.useMemo(()=>({disabled:_,focusableWhenDisabled:!1}),[_]);return h?(0,J.jsx)(sM,{tag:`button`,render:c,className:n,style:f,metadata:E,state:S,refs:C,props:w}):T}),lM=q.createContext(void 0);function uM(e){let t=q.useContext(lM);if(t===void 0&&!e)throw Error(fv(69));return t}var dM=Kv(`group/toggle inline-flex items-center justify-center gap-1 rounded-md text-ui font-medium whitespace-nowrap transition-all hover:bg-muted hover:text-foreground disabled:pointer-events-none disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-destructive/20 aria-pressed:bg-background aria-pressed:text-foreground aria-pressed:shadow-sm aria-pressed:ring-1 aria-pressed:ring-muted-foreground [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4`,{variants:{variant:{default:`bg-transparent`,outline:`border border-input bg-transparent hover:bg-muted`},size:{default:`h-8 min-w-8 px-2.5 has-data-[icon=inline-end]:pr-2 has-data-[icon=inline-start]:pl-2`,sm:`h-7 min-w-7 rounded-md px-2.5 text-ui has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 [&_svg:not([class*='size-'])]:size-3.5`,lg:`h-9 min-w-9 px-2.5 has-data-[icon=inline-end]:pr-2 has-data-[icon=inline-start]:pl-2`}},defaultVariants:{variant:`default`,size:`default`}});function fM({className:e,variant:t=`default`,size:n=`default`,...r}){return(0,J.jsx)(cM,{"data-slot":`toggle`,className:X(dM({variant:t,size:n,className:e})),...r})}q.createContext({size:`default`,variant:`default`,spacing:2,orientation:`horizontal`});var pM=(e,t)=>{let n=new Set,r=e=>{let r=t.filter(t=>!n.has(t)&&e(t));for(let e of r)n.add(e);return r},i=e.flatMap(e=>{let t=r(t=>t.path===e.path&&t.hunkId===null).map(t=>({key:`${e.path}\0${t.kind}`,path:e.path,file:e,hunk:null,proofs:[t],summary:mM(t,e)})),n=e.hunks.flatMap(t=>{let n=r(e=>e.hunkId===t.id);if(n.length===0)return[];let{added:i,deleted:a}=aA(t),o=n.map(e=>e.detail).join(`; `);return[{key:t.id,path:e.path,file:e,hunk:t,proofs:n,summary:`${e.path} — ${o} (+${i} −${a})`}]});return[...t,...n]}),a=t.filter(e=>!n.has(e)).map((e,t)=>({key:`orphan-${t}`,path:e.path,file:null,hunk:null,proofs:[e],summary:`${e.path} — ${e.detail}`}));return[...i,...a]},mM=(e,t)=>e.kind===`rename`&&t.oldPath!==null?`${t.oldPath} → ${t.path} — renamed, content unchanged`:`${t.path} — ${e.detail}`,hM=`flex min-h-8 w-full items-center gap-2 rounded-md px-2 py-1 text-left text-muted-foreground`,gM=({open:e,children:t,...n})=>(0,J.jsxs)(`button`,{type:`button`,"data-slot":`mechanical-toggle`,"aria-expanded":e,className:X(hM,`hover:bg-accent hover:text-accent-foreground`),...n,children:[(0,J.jsx)(`span`,{"aria-hidden":`true`,className:X(`w-3 shrink-0 transition-transform duration-(--duration-fast) ease-standard`,!e&&`-rotate-90`),children:`▾`}),(0,J.jsx)(`span`,{className:`min-w-0`,children:t})]}),_M=(0,q.memo)(function({hunk:e,file:t,risk:n,proofs:r,focused:i=!1,onFocus:a}){let o=(0,q.useRef)(null),[s,c]=(0,q.useState)(!1),{added:l,deleted:u}=aA(e);return(0,q.useEffect)(()=>{let e=o.current;i&&e!==null&&e!==document.activeElement&&(e.focus({preventScroll:!0}),e.scrollIntoView({block:`start`}))},[i]),(0,J.jsxs)(`div`,{"data-slot":`mechanical-hunk`,className:`bg-surface-subtle`,children:[(0,J.jsxs)(gM,{ref:o,open:s,onClick:()=>c(e=>!e),onFocus:()=>a?.(e.id),children:[t.path,`, `,sA(e),` — `,r.map(e=>e.detail).join(`; `),` (+`,l,` −`,u,`)`]}),s&&(0,J.jsx)(Zj,{hunk:e,file:t,risk:n,proofs:r,lineLimit:500})]})}),vM=({files:e,proofs:t,risk:n})=>{let r=(0,q.useId)(),i=(0,q.useMemo)(()=>pM(e,t),[e,t]),[a,o]=(0,q.useState)(new Set),s=i.filter(e=>e.hunk!==null).map(e=>e.key),c=s.length>0&&s.every(e=>a.has(e));if(i.length===0)return null;let l=e=>o(t=>{let n=new Set(t);return n.delete(e)||n.add(e),n});return(0,J.jsxs)(`section`,{"aria-labelledby":r,className:`flex flex-col gap-2 rounded-lg border bg-card p-3`,children:[(0,J.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,J.jsxs)(`h2`,{id:r,className:`flex items-center gap-2 text-heading font-semibold`,children:[`Mechanical changes`,` `,(0,J.jsx)(`span`,{className:`tabular rounded-full bg-muted px-2 text-caption font-medium text-muted-foreground`,children:i.length})]}),s.length>0&&(0,J.jsx)($,{variant:`outline`,size:`sm`,onClick:()=>o(new Set(c?[]:s)),children:c?`Collapse all`:`Expand all`})]}),(0,J.jsx)(`ul`,{className:`flex flex-col gap-1`,children:i.map(e=>{let t=a.has(e.key);return(0,J.jsxs)(`li`,{className:`flex flex-col gap-1`,children:[e.hunk===null||e.file===null?(0,J.jsxs)(`span`,{className:hM,children:[(0,J.jsx)(`span`,{"aria-hidden":`true`,className:`w-3 shrink-0`}),e.summary]}):(0,J.jsx)(gM,{open:t,onClick:()=>l(e.key),children:e.summary}),t&&e.hunk!==null&&e.file!==null&&(0,J.jsx)(Zj,{hunk:e.hunk,file:e.file,risk:n.find(t=>t.hunkId===e.hunk?.id)??null,proofs:e.proofs,lineLimit:500})]},e.key)})})]})},yM={added:`added`,deleted:`deleted`,modified:`changed`,renamed:`changed`},bM=e=>e.flatMap(e=>{let t=e.oldMode!==null||e.newMode!==null,n=!e.binary&&!t&&e.hunks.length===0&&e.status!==`renamed`;return[...e.binary?[{key:`${e.path}\0binary`,file:e,text:`binary file ${yM[e.status]}`}]:[],...t?[{key:`${e.path}\0mode`,file:e,text:`mode ${e.oldMode??`unknown`} → ${e.newMode??`unknown`}`}]:[],...n?[{key:`${e.path}\0empty`,file:e,text:e.status===`modified`?`changed, no lines to show`:`empty file ${e.status}`}]:[]]}),xM=({files:e})=>{let t=(0,q.useId)(),n=bM(e);return n.length===0?null:(0,J.jsxs)(`section`,{"aria-labelledby":t,className:`flex flex-col gap-2 rounded-lg border bg-card p-3`,children:[(0,J.jsx)(`h2`,{id:t,className:`text-heading font-semibold`,children:`Changes without lines to show`}),(0,J.jsx)(`ul`,{className:`flex flex-col gap-1`,children:n.map(({key:e,file:t,text:n})=>(0,J.jsxs)(`li`,{className:`flex flex-wrap items-center gap-2`,children:[(0,J.jsx)($D,{file:t,status:t.status}),(0,J.jsx)(eO,{status:t.status}),(0,J.jsx)(`span`,{children:n})]},e))})]})},SM=({hunkId:e,lines:t})=>t.length===0?null:(0,J.jsx)(`div`,{role:`table`,"aria-label":`Unchanged lines`,children:(0,J.jsx)(`div`,{className:`w-max min-w-full`,children:t.map(({oldNo:t,newNo:n,text:r,tokens:i})=>{let a={key:`${e}:unchanged:${n}`,hunkId:e,kind:`context`,oldNo:t,newNo:n,text:r,tokens:i,wordRanges:[],notes:[]};return(0,J.jsx)(BE,{line:a,cellRole:`cell`},n)})})}),CM=q.createContext(void 0);function wM(e){let t=q.useContext(CM);if(t===void 0&&!e)throw Error(fv(47));return t}var TM={...sw,disabled:e=>e.disabled,instantType:e=>e.instantType===`trigger-change`&&!sw.open(e)?void 0:e.instantType,openMethod:e=>e.openMethod,openChangeReason:e=>e.openChangeReason,isPressOpenedByTrigger:(e,t)=>e.openChangeReason===`trigger-press`&&sw.isOpenedByTrigger(e,t),isTouchPressOpen:(e,t)=>t&&e.openMethod===`touch`&&e.openChangeReason===`trigger-press`,hasTriggerFocusGuards:(e,t)=>sw.isOpenedByTrigger(e,t)&&!e.focusManagerModal,modal:e=>e.modal,titleElementId:e=>e.titleElementId,descriptionElementId:e=>e.descriptionElementId,openOnHover:e=>e.openOnHover,closeDelay:e=>e.closeDelay,adaptiveOrigin:e=>e.adaptiveOrigin},EM=class extends QC{constructor(e,t,n){let r=new zC;super(DM(e,r,t,n),OM(r),TM)}setOpen=(e,t)=>{let n=t.reason===vb,r=t.reason===`trigger-press`&&t.event.detail===0,i=!e&&(t.reason===`escape-key`||t.reason==null),a=MC(t),o=this.select(`activeTriggerId`);if(!e&&t.reason===`close-press`&&t.trigger==null&&o!=null&&(t.trigger=this.context.triggerElements.getById(o)??this.select(`activeTriggerElement`)??void 0),this.context.onOpenChange?.(e,t),t.isCanceled)return;this.state.floatingRootContext.dispatchOpenChange(e,t);let s=()=>{let n=jC(this.state,e,t.trigger,a());n.openChangeReason=t.reason,this.update(n)};n?(this.context.stickIfOpen=!0,this.context.stickIfOpenTimeout.start(500,()=>{this.context.stickIfOpen=!1}),DS.flushSync(s)):s();let c;r?c=`click`:i?c=`dismiss`:t.reason===`focus-out`&&(c=`focus`),this.set(`instantType`,c)}};function DM(e,t,n,r=!1){let i={...tw(t,n,r),disabled:!1,modal:!1,focusManagerModal:!1,instantType:void 0,openMethod:null,openChangeReason:null,titleElementId:void 0,descriptionElementId:void 0,openOnHover:!1,closeDelay:0,adaptiveOrigin:void 0,...e};return i.open&&e?.mounted===void 0&&(i.mounted=!0),i}function OM(e){return{popupRef:q.createRef(),onOpenChange:void 0,onOpenChangeComplete:void 0,triggerFocusTargetRef:q.createRef(),beforeTriggerFocusGuardRef:q.createRef(),beforeContentFocusGuardRef:q.createRef(),stickIfOpenTimeout:new ry,stickIfOpen:!0,triggerElements:e}}var kM=Qv(function({props:e}){let{children:t,open:n,defaultOpen:r=!1,onOpenChange:i,onOpenChangeComplete:a,modal:o=!1,handle:s,triggerId:c,defaultTriggerId:l=null}=e,u=jM(s,{modal:o,open:r,openProp:n,activeTriggerId:l,triggerIdProp:c});u.useControlledProp(`openProp`,n),u.useControlledProp(`triggerIdProp`,c);let d=u.useState(`open`),f=u.useState(`mounted`),p=u.useState(`payload`);u.useContextCallback(`onOpenChange`,i),u.useContextCallback(`onOpenChangeComplete`,a),RC(u,d),FC(u);let{forceUnmount:m}=IC(d,u,()=>{u.context.stickIfOpen=!0,u.set(`openChangeReason`,null)});u.useSyncedValues({modal:o}),q.useEffect(()=>{d||u.context.stickIfOpenTimeout.clear()},[u,d]),q.useImperativeHandle(e.actionsRef,()=>({unmount:m,close:()=>u.setOpen(!1,mb(Nb))}),[m,u]);let h=d||f||s!=null;return(0,J.jsxs)(CM.Provider,{value:u,children:[s&&(0,J.jsx)(OC,{handle:s,store:u}),h&&(0,J.jsx)(MM,{store:u,modal:o}),typeof t==`function`?t({payload:p}):t]})});function AM(e){return wM(!0)?(0,J.jsx)(kM,{props:e}):(0,J.jsx)(VS,{children:(0,J.jsx)(kM,{props:e})})}function jM(e,t){let n=DC((e,n)=>new EM(t,e,n));return q.useEffect(()=>n.context.stickIfOpenTimeout.disposeEffect(),[n]),n}function MM({store:e,modal:t}){let n=iC(e.useState(`floatingRootContext`),{outsidePressEvent:{mouse:t===`trap-focus`?`sloppy`:`intentional`,touch:`sloppy`}}),r=n.reference,i=n.floating;return LC(e,{activeTriggerProps:r,inactiveTriggerProps:r,popupProps:i}),null}function NM(e,t){function n(n,r,i){let a=n.currentTarget;DS.flushSync(()=>{e.setOpen(!1,mb(Cb,n.nativeEvent,a))}),Zx(a.isConnected?a:t.current,r,i)?.focus()}function r(t){n(t,-1,e.select(`positionerElement`))}function i(t){let r=e.select(`positionerElement`);r&&Qx(t,r)?e.context.beforeContentFocusGuardRef.current?.focus():n(t,1,r)}return{handlePreFocusGuardFocus:r,handleFocusTargetFocus:i}}var PM=$v(function(e,t){let{render:n,className:r,style:i,disabled:a=!1,nativeButton:o=!0,handle:s,payload:c,openOnHover:l=!1,delay:u=300,closeDelay:d=0,id:f,...p}=e,m=wM(!0),h=cw(s)??m;if(!h)throw Error(fv(74));let g=eE(f),_=h.useState(`isTriggerActive`,g),v=h.useState(`floatingRootContext`),y=h.useState(`isOpenedByTrigger`,g),b=h.useState(`triggerPopupId`,g),x=q.useRef(null),{registerTrigger:S,isMountedByThisTrigger:C}=PC(g,x,h,{payload:c,disabled:a,openOnHover:l,closeDelay:d}),w=h.useState(`isPressOpenedByTrigger`,g),T=h.useState(`isTouchPressOpen`,l),E=h.useState(`hasTriggerFocusGuards`,g),D=yw(v,{enabled:!a&&l&&!T,mouseOnly:!0,move:!1,handleClose:Fw(),restMs:u,delay:{close:d},triggerElementRef:x,isActiveTrigger:_,isClosing:()=>h.select(`transitionStatus`)===`ending`}),O=QS(v,{stickIfOpen:Z(()=>h.context.stickIfOpen)}),k=uj(()=>h.select(`open`),e=>{h.set(`openMethod`,e)}),A=h.useState(`triggerProps`,C),{getButtonProps:j,buttonRef:M}=vv({disabled:a,native:o}),N={open(e){return w?Zy.open(e):Xy.open(e)}},{handlePreFocusGuardFocus:P,handleFocusTargetFocus:F}=NM(h,x),I=Iv(`button`,e,{state:{disabled:a,open:y},ref:[M,t,S,x],props:[O.reference,D,A,k,{[CS]:``,id:g,"aria-haspopup":`dialog`,"aria-expanded":y,"aria-controls":b},p,j],stateAttributesMapping:N}),L=(0,J.jsx)(q.Fragment,{children:I},g);return E?(0,J.jsxs)(q.Fragment,{children:[(0,J.jsx)(Xb,{ref:h.context.beforeTriggerFocusGuardRef,onFocus:P}),L,(0,J.jsx)(Xb,{ref:h.context.triggerFocusTargetRef,onFocus:F})]}):L}),FM=q.createContext(void 0);function IM(){let e=q.useContext(FM);if(e===void 0)throw Error(fv(45));return e}var LM=q.forwardRef(function(e,t){let{keepMounted:n=!1,...r}=e;return wM().useState(`mounted`)||n?(0,J.jsx)(FM.Provider,{value:n,children:(0,J.jsx)(MS,{ref:t,...r})}):null}),RM=q.createContext(void 0);function zM(){let e=q.useContext(RM);if(!e)throw Error(fv(46));return e}function BM(e){let{store:t,domReference:n,positionerElement:r,open:i}=e,a=q.useRef(null),o=q.useRef(null),s=SC(r);Q(()=>{i||(o.current?.abort(),o.current=null,t.state.instantType===`trigger-change`&&t.set(`instantType`,void 0))},[i,t]),Q(()=>{let e=n,r=a.current;if(e&&(a.current=e),!r||!e||e===r||!t.select(`open`))return;t.set(`instantType`,void 0);let i=new AbortController;return o.current=i,s(()=>{t.select(`open`)&&t.set(`instantType`,`trigger-change`)},i.signal),()=>{i.abort()}},[n,s,t])}var VM=20;function HM(e,t,n,r){let[i,a]=q.useState(!1);Q(()=>{if(!e||!t||n==null){a(!1);return}let r=gv(n).documentElement.clientWidth,i=n.offsetWidth;a(r>0&&i>0&&i>=r-VM)},[e,t,n]),$A(e&&(!t||i),r)}var UM=q.forwardRef(function(e,t){let{render:n,className:r,style:i,anchor:a,positionMethod:o,side:s,align:c,sideOffset:l,alignOffset:u,collisionBoundary:d=`clipping-ancestors`,collisionPadding:f,arrowPadding:p,sticky:m,disableAnchorTracking:h=!1,collisionAvoidance:g=TS,..._}=e,v=wM(),y=IM(),b=zS(),x=v.useState(`floatingRootContext`),S=v.useState(`mounted`),C=v.useState(`open`),w=v.useState(`openChangeReason`),T=v.useState(`activeTriggerElement`),E=v.useState(`modal`),D=v.useState(`openMethod`),O=v.useState(`positionerElement`),k=v.useState(`instantType`),A=v.useState(`transitionStatus`),j=bE({anchor:a,floatingRootContext:x,positionMethod:o,mounted:S,side:s,sideOffset:l,align:c,alignOffset:u,arrowPadding:p,collisionBoundary:d,collisionPadding:f,sticky:m,disableAnchorTracking:h,keepMounted:y,nodeId:b,collisionAvoidance:g,adaptiveOrigin:v.useState(`adaptiveOrigin`)});BM({store:v,domReference:x.useState(`domReferenceElement`),positionerElement:O,open:C});let M=E===!0&&w!==`trigger-hover`;HM(C&&M,D===`touch`,O,T);let N=v.useStateSetter(`positionerElement`),P=wE(e,{open:C,side:j.side,align:j.align,anchorHidden:j.anchorHidden,instant:k},{styles:j.positionerStyles,transitionStatus:A,props:_,refs:[t,N],hidden:!S,inert:!C});return(0,J.jsxs)(RM.Provider,{value:j,children:[S&&M&&(0,J.jsx)(VA,{inert:DE(!C),cutout:T}),(0,J.jsx)(BS,{id:b,children:P})]})}),WM=q.createContext(void 0);function GM(){let[e,t]=q.useState(0),n=Z(()=>(t(e=>e+1),()=>{t(e=>Math.max(0,e-1))}));return{context:q.useMemo(()=>({register:n}),[n]),hasClosePart:e>0}}var KM=q.forwardRef(function(e,t){let{render:n,className:r,style:i,initialFocus:a,finalFocus:o,...s}=e,c=wM(),l=zM(),u=uM(!0)!=null,{context:d,hasClosePart:f}=GM(),p=c.useState(`open`),m=c.useState(`openMethod`),h=c.useState(`instantType`),g=c.useState(`transitionStatus`),_=c.useState(`popupProps`),v=c.useState(`titleElementId`),y=c.useState(`descriptionElementId`),b=c.useState(`modal`),x=c.useState(`mounted`),S=c.useState(`openChangeReason`),C=c.useState(`activeTriggerElement`),w=c.useState(`floatingRootContext`),T=w.useState(`floatingId`),E=c.useState(`disabled`),D=c.useState(`openOnHover`),O=c.useState(`closeDelay`);CC({open:p,ref:c.context.popupRef,onComplete(){p&&c.context.onOpenChangeComplete?.(!0)}}),_w(w,{enabled:D&&!E,closeDelay:O});let k=a===void 0?EC(c.context.popupRef):a,A=b!==!1&&f;c.useSyncedValue(`focusManagerModal`,A);let j=c.useStateSetter(`popupElement`),M=Iv(`div`,e,{state:{open:p,side:l.side,align:l.align,instant:h,transitionStatus:g},ref:[t,c.context.popupRef,j],props:[_,{id:T,role:`dialog`,...TC,"aria-labelledby":v,"aria-describedby":y,onKeyDown(e){u&&VO.has(e.key)&&e.stopPropagation()}},CE(g),s],stateAttributesMapping:$y});return(0,J.jsx)(ZS,{context:w,openInteractionType:m,modal:A,disabled:!x||S===`trigger-hover`,initialFocus:k,returnFocus:o,restoreFocus:`popup`,getInsideElements:()=>[c.context.beforeTriggerFocusGuardRef.current],previousFocusableElement:w_(C)?C:void 0,nextFocusableElement:c.context.triggerFocusTargetRef,beforeContentFocusGuardRef:c.context.beforeContentFocusGuardRef,children:(0,J.jsx)(WM.Provider,{value:d,children:M})})}),qM=q.forwardRef(function(e,t){let{render:n,className:r,style:i,...a}=e,o=wM(),s=eE(a.id);return o.useSyncedValueWithCleanup(`titleElementId`,s),Iv(`h2`,e,{ref:t,props:[{id:s},a]})});function JM({...e}){return(0,J.jsx)(AM,{"data-slot":`popover`,...e})}function YM({...e}){return(0,J.jsx)(PM,{"data-slot":`popover-trigger`,...e})}function XM({className:e,align:t=`center`,alignOffset:n=0,side:r=`bottom`,sideOffset:i=4,...a}){return(0,J.jsx)(LM,{children:(0,J.jsx)(UM,{align:t,alignOffset:n,side:r,sideOffset:i,className:`isolate z-50`,children:(0,J.jsx)(KM,{"data-slot":`popover-content`,className:X(`z-50 flex w-72 origin-(--transform-origin) flex-col gap-2.5 rounded-xl bg-popover p-2.5 text-ui text-popover-foreground shadow-md ring-1 ring-foreground/10 outline-hidden duration-(--duration-fast) data-[side=bottom]:slide-in-from-top-2 data-[side=inline-end]:slide-in-from-left-2 data-[side=inline-start]:slide-in-from-right-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95`,e),...a})})})}function ZM({className:e,...t}){return(0,J.jsx)(qM,{"data-slot":`popover-title`,className:X(`font-medium`,e),...t})}var QM={open:cg,draft:fg,merged:og,closed:ug},$M=({state:e})=>{let{label:t,className:n}=JE[e],r=QM[e];return(0,J.jsxs)(aO,{"data-slot":`pr-state`,variant:`outline`,className:n,children:[(0,J.jsx)(r,{"aria-hidden":`true`}),t]})},eN=({status:e})=>e===null?null:(0,J.jsx)(`span`,{"data-slot":`review-status`,children:(0,J.jsx)(oO,{status:YE[e]})}),tN=e=>{switch(e.state){case`failed`:return`CI ${e.failed} of ${e.total} failed`;case`running`:return`CI ${e.running} of ${e.total} running`;case`skipped`:return`CI ${e.skipped} skipped`;default:return`CI ${e.passed}/${e.total} passed`}},nN=e=>{let t=e=>`${e} ${e===1?`check`:`checks`}`;switch(e.state){case`failed`:return`CI: ${e.failed} of ${t(e.total)} failed`;case`running`:return`CI: ${e.running} of ${t(e.total)} running`;case`skipped`:return`CI: ${t(e.skipped)} skipped`;default:return`CI: ${e.passed} of ${t(e.total)} passed`}},rN=`h-6 gap-1.5 px-1.5 font-normal text-muted-foreground`,iN=({check:e})=>{let t=XE[e.state];return(0,J.jsxs)(`li`,{className:`flex min-w-0 items-center gap-2`,children:[(0,J.jsx)(`span`,{"aria-hidden":`true`,className:X(`w-3 shrink-0 text-center`,t.tone),children:t.glyph}),(0,J.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,title:e.name,children:e.name}),(0,J.jsx)(`span`,{className:`shrink-0 text-caption text-muted-foreground`,children:t.label}),e.url!==null&&(0,J.jsx)(`a`,{className:`shrink-0 text-caption`,href:e.url,target:`_blank`,rel:`noreferrer noopener`,"aria-label":`Details of ${e.name}`,children:`Details`})]})},aN=({checks:e,unreadable:t,head:n})=>{let r=e===null?null:cf(e),i=r===null||r.state===null?null:nN(r),a=oN(i);if(e===null)return(0,J.jsxs)(JM,{children:[(0,J.jsx)(YM,{render:(0,J.jsx)($,{variant:`ghost`,size:`xs`,className:rN,"data-slot":`ci-summary`,children:`CI not readable`})}),(0,J.jsxs)(XM,{align:`end`,children:[(0,J.jsx)(ZM,{children:`CI not readable`}),(0,J.jsx)(`p`,{className:`text-muted-foreground`,children:t})]})]});if(r===null||r.state===null)return null;let o=XE[r.state];return(0,J.jsxs)(J.Fragment,{children:[(0,J.jsxs)(JM,{children:[(0,J.jsx)(YM,{render:(0,J.jsxs)($,{variant:`ghost`,size:`xs`,className:rN,"data-slot":`ci-summary`,"data-state":r.state,"aria-label":`${i}, show checks`,children:[(0,J.jsx)(`span`,{"aria-hidden":`true`,className:o.tone,children:o.glyph}),(0,J.jsx)(`span`,{className:`tabular`,children:tN(r)})]})}),(0,J.jsxs)(XM,{align:`end`,className:`w-96`,children:[(0,J.jsxs)(ZM,{children:[`Checks on `,(0,J.jsx)(`code`,{className:`font-mono text-code-compact`,children:n.slice(0,7)})]}),(0,J.jsx)(`ul`,{className:`flex max-h-80 flex-col gap-1.5 overflow-y-auto`,"aria-label":`Checks`,children:sf(e).map(e=>(0,J.jsx)(iN,{check:e},`${e.name}:${e.url??``}`))})]})]}),(0,J.jsx)(`span`,{role:`status`,className:`sr-only`,children:a})]})},oN=e=>{let t=(0,q.useRef)(void 0),[n,r]=(0,q.useState)(``);return(0,q.useEffect)(()=>{t.current===void 0?t.current=e:e!==null&&e!==t.current&&(t.current=e,r(e))},[e]),n},sN={"changes-requested":i_,approved:Ih,commented:Mg},cN=3,lN=({reviewer:e})=>{let t=e.verdict===null?null:sN[e.verdict];return(0,J.jsxs)(`span`,{className:`relative flex size-6 shrink-0 items-center justify-center rounded-full bg-muted text-caption font-medium text-muted-foreground ring-2 ring-background`,children:[kk(e.name),t!==null&&e.verdict!==null&&(0,J.jsx)(`span`,{className:`absolute -right-0.5 -bottom-0.5 flex size-3 items-center justify-center rounded-full bg-background`,children:(0,J.jsx)(t,{className:X(`size-2.5`,ZE[e.verdict].tone),strokeWidth:3.5})})]})},uN=e=>{let t=new Map;for(let n of e){let e=ZE[n.verdict??`waiting`].label.toLowerCase();t.set(e,(t.get(e)??0)+1)}let n=[...t].map(([e,t])=>`${t} ${e}`);return`${`${e.length} ${e.length===1?`reviewer`:`reviewers`}`}: ${n.join(`, `)}`},dN=({reviewers:e})=>{if(e.length===0)return null;let t=af(e),n=t.length>cN?t.slice(0,2):t,r=t.length-n.length;return(0,J.jsxs)(JM,{children:[(0,J.jsx)(YM,{render:(0,J.jsx)($,{variant:`ghost`,size:`xs`,className:`h-7 px-1`,"data-slot":`reviewers`,"aria-label":`${uN(t)}, show reviewers`,children:(0,J.jsxs)(`span`,{"aria-hidden":`true`,className:`flex items-center -space-x-1`,children:[n.map(e=>(0,J.jsx)(lN,{reviewer:e},e.id)),r>0&&(0,J.jsxs)(`span`,{className:`flex size-6 items-center justify-center rounded-full bg-muted text-caption font-medium text-muted-foreground ring-2 ring-background`,children:[`+`,r]})]})})}),(0,J.jsxs)(XM,{align:`end`,children:[(0,J.jsx)(ZM,{children:`Reviewers`}),(0,J.jsx)(`ul`,{className:`flex flex-col gap-2`,"aria-label":`Reviewers`,children:t.map(e=>{let t=ZE[e.verdict??`waiting`];return(0,J.jsxs)(`li`,{className:`flex min-w-0 items-center gap-2`,children:[(0,J.jsx)(`span`,{"aria-hidden":`true`,children:(0,J.jsx)(lN,{reviewer:e})}),(0,J.jsxs)(`span`,{className:`min-w-0 flex-1 truncate`,children:[e.name,e.team&&(0,J.jsx)(`span`,{className:`text-muted-foreground`,children:` (team)`})]}),(0,J.jsx)(`span`,{className:X(`shrink-0 text-caption`,t.tone),children:t.label})]},e.id)})})]})]})};function fN(e){if(!e||typeof document>`u`)return;let t=document.head||document.getElementsByTagName(`head`)[0],n=document.createElement(`style`);n.type=`text/css`,t.appendChild(n),n.styleSheet?n.styleSheet.cssText=e:n.appendChild(document.createTextNode(e))}var pN=e=>{switch(e){case`success`:return gN;case`info`:return vN;case`warning`:return _N;case`error`:return yN;default:return null}},mN=Array(12).fill(0),hN=({visible:e,className:t})=>q.createElement(`div`,{className:[`sonner-loading-wrapper`,t].filter(Boolean).join(` `),"data-visible":e},q.createElement(`div`,{className:`sonner-spinner`},mN.map((e,t)=>q.createElement(`div`,{className:`sonner-loading-bar`,key:`spinner-bar-${t}`})))),gN=q.createElement(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 20 20`,fill:`currentColor`,height:`20`,width:`20`,"aria-hidden":`true`},q.createElement(`path`,{fillRule:`evenodd`,d:`M10 18a8 8 0 100-16 8 8 0 000 16zm3.857-9.809a.75.75 0 00-1.214-.882l-3.483 4.79-1.88-1.88a.75.75 0 10-1.06 1.061l2.5 2.5a.75.75 0 001.137-.089l4-5.5z`,clipRule:`evenodd`})),_N=q.createElement(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 24 24`,fill:`currentColor`,height:`20`,width:`20`,"aria-hidden":`true`},q.createElement(`path`,{fillRule:`evenodd`,d:`M9.401 3.003c1.155-2 4.043-2 5.197 0l7.355 12.748c1.154 2-.29 4.5-2.599 4.5H4.645c-2.309 0-3.752-2.5-2.598-4.5L9.4 3.003zM12 8.25a.75.75 0 01.75.75v3.75a.75.75 0 01-1.5 0V9a.75.75 0 01.75-.75zm0 8.25a.75.75 0 100-1.5.75.75 0 000 1.5z`,clipRule:`evenodd`})),vN=q.createElement(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 20 20`,fill:`currentColor`,height:`20`,width:`20`,"aria-hidden":`true`},q.createElement(`path`,{fillRule:`evenodd`,d:`M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-7-4a1 1 0 11-2 0 1 1 0 012 0zM9 9a.75.75 0 000 1.5h.253a.25.25 0 01.244.304l-.459 2.066A1.75 1.75 0 0010.747 15H11a.75.75 0 000-1.5h-.253a.25.25 0 01-.244-.304l.459-2.066A1.75 1.75 0 009.253 9H9z`,clipRule:`evenodd`})),yN=q.createElement(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 20 20`,fill:`currentColor`,height:`20`,width:`20`,"aria-hidden":`true`},q.createElement(`path`,{fillRule:`evenodd`,d:`M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-8-5a.75.75 0 01.75.75v4.5a.75.75 0 01-1.5 0v-4.5A.75.75 0 0110 5zm0 10a1 1 0 100-2 1 1 0 000 2z`,clipRule:`evenodd`})),bN=q.createElement(`svg`,{xmlns:`http://www.w3.org/2000/svg`,width:`12`,height:`12`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.5`,strokeLinecap:`round`,strokeLinejoin:`round`,"aria-hidden":`true`},q.createElement(`line`,{x1:`18`,y1:`6`,x2:`6`,y2:`18`}),q.createElement(`line`,{x1:`6`,y1:`6`,x2:`18`,y2:`18`})),xN=()=>{let[e,t]=q.useState(document.hidden);return q.useEffect(()=>{let e=()=>{t(document.hidden)};return document.addEventListener(`visibilitychange`,e),()=>document.removeEventListener(`visibilitychange`,e)},[]),e},SN=1,CN=100,wN=e=>typeof e?.id==`number`||e?.id?.length>0?e.id:SN++,TN=new class{constructor(){this.subscribe=e=>(this.subscribers.push(e),this.getActiveToasts().forEach(t=>e(t)),()=>{let t=this.subscribers.indexOf(e);this.subscribers.splice(t,1)}),this.publish=e=>{this.subscribers.forEach(t=>t(e))},this.addToast=e=>{this.publish(e),this.toasts=[...this.toasts,e],this.trimHistory()},this.trimHistory=()=>{let e=this.toasts.length-CN;e<=0||(this.toasts=this.toasts.filter(t=>e>0&&this.dismissedToasts.has(t.id)?(this.dismissedToasts.delete(t.id),e--,!1):!0))},this.create=e=>{let{message:t,...n}=e,r=wN(e),i=this.pendingDismissals.get(r);i!==void 0&&(cancelAnimationFrame(i),this.pendingDismissals.delete(r),this.dismissedToasts.delete(r));let a=this.dismissedToasts.has(r),o=e.dismissible===void 0||e.dismissible;return a&&(this.dismissedToasts.delete(r),this.toasts=this.toasts.filter(e=>e.id!==r)),!a&&this.toasts.find(e=>e.id===r)?this.toasts=this.toasts.map(n=>n.id===r?(this.publish({...n,...e,id:r,title:t}),{...n,...e,id:r,dismissible:o,title:t}):n):this.addToast({title:t,...n,dismissible:o,id:r}),r},this.dismiss=e=>{if(e==null)return this.getActiveToasts().forEach(e=>{this.dismissedToasts.add(e.id),this.subscribers.forEach(t=>t({id:e.id,dismiss:!0}))}),e;this.dismissedToasts.add(e);let t=this.pendingDismissals.get(e);return t!==void 0&&cancelAnimationFrame(t),this.pendingDismissals.set(e,requestAnimationFrame(()=>{this.pendingDismissals.delete(e),this.subscribers.forEach(t=>t({id:e,dismiss:!0}))})),e},this.message=(e,t)=>this.create({...t,message:e,type:void 0}),this.error=(e,t)=>this.create({...t,message:e,type:`error`}),this.success=(e,t)=>this.create({...t,type:`success`,message:e}),this.info=(e,t)=>this.create({...t,type:`info`,message:e}),this.warning=(e,t)=>this.create({...t,type:`warning`,message:e}),this.loading=(e,t)=>this.create({...t,type:`loading`,message:e}),this.promise=(e,t)=>{if(!t)return;let n;t.loading!==void 0&&(n=this.create({...t,promise:e,type:`loading`,message:t.loading,description:typeof t.description==`function`?void 0:t.description}));let r=Promise.resolve(e instanceof Function?e():e),i=n!==void 0,a,o=r.then(async e=>{if(a=[`resolve`,e],q.isValidElement(e))i=!1,this.create({id:n,type:`default`,message:e});else if(DN(e)&&!e.ok){i=!1;let r=typeof t.error==`function`?await t.error(`HTTP error! status: ${e.status}`):t.error,a=typeof t.description==`function`?await t.description(`HTTP error! status: ${e.status}`):t.description,o=typeof r==`object`&&!q.isValidElement(r)?r:{message:r};this.create({id:n,type:`error`,description:a,...o})}else if(e instanceof Error){i=!1;let r=typeof t.error==`function`?await t.error(e):t.error,a=typeof t.description==`function`?await t.description(e):t.description,o=typeof r==`object`&&!q.isValidElement(r)?r:{message:r};this.create({id:n,type:`error`,description:a,...o})}else if(t.success!==void 0){i=!1;let r=typeof t.success==`function`?await t.success(e):t.success,a=typeof t.description==`function`?await t.description(e):t.description,o=typeof r==`object`&&!q.isValidElement(r)?r:{message:r};this.create({id:n,type:`success`,description:a,...o})}}).catch(async e=>{if(a=[`reject`,e],t.error!==void 0){i=!1;let r=typeof t.error==`function`?await t.error(e):t.error,a=typeof t.description==`function`?await t.description(e):t.description,o=typeof r==`object`&&!q.isValidElement(r)?r:{message:r};this.create({id:n,type:`error`,description:a,...o})}}).finally(()=>{i&&(this.dismiss(n),n=void 0),t.finally==null||t.finally.call(t)}),s=()=>new Promise((e,t)=>o.then(()=>a[0]===`reject`?t(a[1]):e(a[1])).catch(t));return typeof n!=`string`&&typeof n!=`number`?{unwrap:s}:Object.assign(n,{unwrap:s})},this.custom=(e,t)=>{let n=wN(t);return this.create({...t,jsx:e(n),id:n,type:void 0}),n},this.getActiveToasts=()=>this.toasts.filter(e=>!this.dismissedToasts.has(e.id)),this.subscribers=[],this.toasts=[],this.dismissedToasts=new Set,this.pendingDismissals=new Map}},EN=(e,t)=>TN.message(e,t),DN=e=>e&&typeof e==`object`&&`ok`in e&&typeof e.ok==`boolean`&&`status`in e&&typeof e.status==`number`;Object.assign(EN,{success:TN.success,info:TN.info,warning:TN.warning,error:TN.error,custom:TN.custom,message:TN.message,promise:TN.promise,dismiss:TN.dismiss,loading:TN.loading},{getHistory:()=>TN.toasts,getToasts:()=>TN.getActiveToasts()}),fN(`[data-sonner-toaster][dir=ltr],html[dir=ltr]{--toast-icon-margin-start:-3px;--toast-icon-margin-end:4px;--toast-svg-margin-start:-1px;--toast-svg-margin-end:0px;--toast-button-margin-start:auto;--toast-button-margin-end:0;--toast-close-button-start:0;--toast-close-button-end:unset;--toast-close-button-transform:translate(-35%, -35%)}[data-sonner-toaster][dir=rtl],html[dir=rtl]{--toast-icon-margin-start:4px;--toast-icon-margin-end:-3px;--toast-svg-margin-start:0px;--toast-svg-margin-end:-1px;--toast-button-margin-start:0;--toast-button-margin-end:auto;--toast-close-button-start:unset;--toast-close-button-end:0;--toast-close-button-transform:translate(35%, -35%)}[data-sonner-toaster]{position:fixed;width:var(--width);font-family:ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,Noto Sans,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji;--gray1:hsl(0, 0%, 99%);--gray2:hsl(0, 0%, 97.3%);--gray3:hsl(0, 0%, 95.1%);--gray4:hsl(0, 0%, 93%);--gray5:hsl(0, 0%, 90.9%);--gray6:hsl(0, 0%, 88.7%);--gray7:hsl(0, 0%, 85.8%);--gray8:hsl(0, 0%, 78%);--gray9:hsl(0, 0%, 56.1%);--gray10:hsl(0, 0%, 52.3%);--gray11:hsl(0, 0%, 43.5%);--gray12:hsl(0, 0%, 9%);--border-radius:8px;box-sizing:border-box;padding:0;margin:0;list-style:none;outline:0;z-index:999999999;transition:transform .4s ease}@media (hover:none) and (pointer:coarse){[data-sonner-toaster][data-lifted=true]{transform:none}}[data-sonner-toaster][data-x-position=right]{right:var(--offset-right)}[data-sonner-toaster][data-x-position=left]{left:var(--offset-left)}[data-sonner-toaster][data-x-position=center]{left:50%;transform:translateX(-50%)}[data-sonner-toaster][data-y-position=top]{top:var(--offset-top)}[data-sonner-toaster][data-y-position=bottom]{bottom:var(--offset-bottom)}[data-sonner-toast]{--y:translateY(100%);--lift-amount:calc(var(--lift) * var(--gap));z-index:var(--z-index);position:absolute;opacity:0;transform:var(--y);touch-action:none;transition:transform .4s,opacity .4s,height .4s,box-shadow .2s;box-sizing:border-box;outline:0;overflow-wrap:anywhere}[data-sonner-toast][data-styled=true]{padding:16px;background:var(--normal-bg);border:1px solid var(--normal-border);color:var(--normal-text);border-radius:var(--border-radius);box-shadow:0 4px 12px rgba(0,0,0,.1);width:var(--width);font-size:13px;display:flex;align-items:center;gap:6px}[data-sonner-toast]:focus-visible{box-shadow:0 4px 12px rgba(0,0,0,.1),0 0 0 2px rgba(0,0,0,.2)}[data-sonner-toast][data-y-position=top]{top:0;--y:translateY(-100%);--lift:1;--lift-amount:calc(1 * var(--gap))}[data-sonner-toast][data-y-position=bottom]{bottom:0;--y:translateY(100%);--lift:-1;--lift-amount:calc(var(--lift) * var(--gap))}[data-sonner-toast][data-styled=true] [data-description]{font-weight:400;line-height:1.4;color:#3f3f3f}[data-rich-colors=true][data-sonner-toast][data-styled=true] [data-description]{color:inherit}[data-sonner-toaster][data-sonner-theme=dark] [data-description]{color:#e8e8e8}[data-sonner-toast][data-styled=true] [data-title]{font-weight:500;line-height:1.5;color:inherit}[data-sonner-toast][data-styled=true] [data-icon]{display:flex;height:16px;width:16px;position:relative;justify-content:flex-start;align-items:center;flex-shrink:0;margin-left:var(--toast-icon-margin-start);margin-right:var(--toast-icon-margin-end)}[data-sonner-toast][data-promise=true] [data-icon]>svg{opacity:0;transform:scale(.8);transform-origin:center;animation:sonner-fade-in .3s ease forwards}[data-sonner-toast][data-styled=true] [data-icon]>*{flex-shrink:0}[data-sonner-toast][data-styled=true] [data-icon] svg{margin-left:var(--toast-svg-margin-start);margin-right:var(--toast-svg-margin-end)}[data-sonner-toast][data-styled=true] [data-content]{display:flex;flex-direction:column;gap:2px;flex:1;min-width:0}[data-sonner-toast][data-styled=true] [data-button]{border-radius:4px;padding-left:8px;padding-right:8px;height:24px;font-size:12px;color:var(--normal-bg);background:var(--normal-text);margin-left:var(--toast-button-margin-start);margin-right:var(--toast-button-margin-end);border:none;font-weight:500;cursor:pointer;outline:0;display:flex;align-items:center;flex-shrink:0;transition:opacity .4s,box-shadow .2s}[data-sonner-toast][data-styled=true] [data-button]:focus-visible{box-shadow:0 0 0 2px rgba(0,0,0,.4)}[data-sonner-toast][data-styled=true] [data-button]:first-of-type{margin-left:var(--toast-button-margin-start);margin-right:var(--toast-button-margin-end)}[data-sonner-toast][data-styled=true] [data-cancel]{color:var(--normal-text);background:rgba(0,0,0,.08)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast][data-styled=true] [data-cancel]{background:rgba(255,255,255,.3)}[data-sonner-toast][data-styled=true] [data-close-button]{position:absolute;left:var(--toast-close-button-start);right:var(--toast-close-button-end);top:0;height:20px;width:20px;display:flex;justify-content:center;align-items:center;padding:0;color:var(--normal-text);background:var(--normal-bg);border:1px solid var(--normal-border);transform:var(--toast-close-button-transform);border-radius:50%;cursor:pointer;z-index:1;transition:opacity .1s,background .2s,border-color .2s}[data-sonner-toast][data-styled=true] [data-close-button]:focus-visible{box-shadow:0 4px 12px rgba(0,0,0,.1),0 0 0 2px rgba(0,0,0,.2)}[data-sonner-toast][data-styled=true] [data-disabled=true]{cursor:not-allowed}[data-sonner-toast][data-styled=true]:hover [data-close-button]:hover{background:var(--gray2);border-color:var(--gray5)}[data-sonner-toast][data-swiping=true]::before{content:'';position:absolute;left:-100%;right:-100%;height:100%;z-index:-1}[data-sonner-toast][data-y-position=top][data-swiping=true]::before{bottom:50%;transform:scaleY(3) translateY(50%)}[data-sonner-toast][data-y-position=bottom][data-swiping=true]::before{top:50%;transform:scaleY(3) translateY(-50%)}[data-sonner-toast][data-swiping=false][data-removed=true]::before{content:'';position:absolute;inset:0;transform:scaleY(2)}[data-sonner-toast][data-expanded=true]::after{content:'';position:absolute;left:0;height:calc(var(--gap) + 1px);bottom:100%;width:100%}[data-sonner-toast][data-mounted=true]{--y:translateY(0);opacity:1}[data-sonner-toast][data-expanded=false][data-front=false]{--scale:var(--toasts-before) * 0.05 + 1;--y:translateY(calc(var(--lift-amount) * var(--toasts-before))) scale(calc(-1 * var(--scale)));height:var(--front-toast-height)}[data-sonner-toast]>*{transition:opacity .4s}[data-sonner-toast][data-x-position=right]{right:0}[data-sonner-toast][data-x-position=left]{left:0}[data-sonner-toast][data-expanded=false][data-front=false][data-styled=true]>*{opacity:0}[data-sonner-toast][data-visible=false]{opacity:0;pointer-events:none}[data-sonner-toast][data-mounted=true][data-expanded=true]{--y:translateY(calc(var(--lift) * var(--offset)));height:var(--initial-height)}[data-sonner-toast][data-removed=true][data-front=true][data-swipe-out=false]{--y:translateY(calc(var(--lift) * -100%));opacity:0}[data-sonner-toast][data-removed=true][data-front=false][data-swipe-out=false][data-expanded=true]{--y:translateY(calc(var(--lift) * var(--offset) + var(--lift) * -100%));opacity:0}[data-sonner-toast][data-removed=true][data-front=false][data-swipe-out=false][data-expanded=false]{--y:translateY(40%);opacity:0;transition:transform .5s,opacity .2s}[data-sonner-toast][data-removed=true][data-front=false]::before{height:calc(var(--initial-height) + 20%)}[data-sonner-toast][data-swiping=true]{transform:var(--y) translateY(var(--swipe-amount-y,0)) translateX(var(--swipe-amount-x,0));transition:none}[data-sonner-toast][data-swiped=true]{-webkit-user-select:none;user-select:none}[data-sonner-toast][data-swipe-out=true][data-y-position=bottom],[data-sonner-toast][data-swipe-out=true][data-y-position=top]{animation-duration:.2s;animation-timing-function:ease-out;animation-fill-mode:forwards}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=left]{animation-name:swipe-out-left}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=right]{animation-name:swipe-out-right}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=up]{animation-name:swipe-out-up}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=down]{animation-name:swipe-out-down}@keyframes swipe-out-left{from{transform:var(--y) translateX(var(--swipe-amount-x));opacity:1}to{transform:var(--y) translateX(calc(var(--swipe-amount-x) - 100%));opacity:0}}@keyframes swipe-out-right{from{transform:var(--y) translateX(var(--swipe-amount-x));opacity:1}to{transform:var(--y) translateX(calc(var(--swipe-amount-x) + 100%));opacity:0}}@keyframes swipe-out-up{from{transform:var(--y) translateY(var(--swipe-amount-y));opacity:1}to{transform:var(--y) translateY(calc(var(--swipe-amount-y) - 100%));opacity:0}}@keyframes swipe-out-down{from{transform:var(--y) translateY(var(--swipe-amount-y));opacity:1}to{transform:var(--y) translateY(calc(var(--swipe-amount-y) + 100%));opacity:0}}@media (max-width:600px){[data-sonner-toaster]{position:fixed;right:var(--mobile-offset-right);left:var(--mobile-offset-left);width:100%}[data-sonner-toaster][dir=rtl]{left:calc(var(--mobile-offset-left) * -1)}[data-sonner-toaster] [data-sonner-toast]{left:0;right:0;width:calc(100% - var(--mobile-offset-left) * 2)}[data-sonner-toaster][data-x-position=left]{left:var(--mobile-offset-left)}[data-sonner-toaster][data-y-position=bottom]{bottom:var(--mobile-offset-bottom)}[data-sonner-toaster][data-y-position=top]{top:var(--mobile-offset-top)}[data-sonner-toaster][data-x-position=center]{left:var(--mobile-offset-left);right:var(--mobile-offset-right);transform:none}}[data-sonner-toaster][data-sonner-theme=light]{--normal-bg:#fff;--normal-border:var(--gray4);--normal-text:var(--gray12);--success-bg:hsl(143, 85%, 96%);--success-border:hsl(145, 92%, 87%);--success-text:hsl(140, 100%, 27%);--info-bg:hsl(208, 100%, 97%);--info-border:hsl(221, 91%, 93%);--info-text:hsl(210, 92%, 45%);--warning-bg:hsl(49, 100%, 97%);--warning-border:hsl(49, 91%, 84%);--warning-text:hsl(31, 92%, 45%);--error-bg:hsl(359, 100%, 97%);--error-border:hsl(359, 100%, 94%);--error-text:hsl(360, 100%, 45%)}[data-sonner-toaster][data-sonner-theme=light] [data-sonner-toast][data-invert=true]{--normal-bg:#000;--normal-border:hsl(0, 0%, 20%);--normal-text:var(--gray1)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast][data-invert=true]{--normal-bg:#fff;--normal-border:var(--gray3);--normal-text:var(--gray12)}[data-sonner-toaster][data-sonner-theme=dark]{--normal-bg:#000;--normal-bg-hover:hsl(0, 0%, 12%);--normal-border:hsl(0, 0%, 20%);--normal-border-hover:hsl(0, 0%, 25%);--normal-text:var(--gray1);--success-bg:hsl(150, 100%, 6%);--success-border:hsl(147, 100%, 12%);--success-text:hsl(150, 86%, 65%);--info-bg:hsl(215, 100%, 6%);--info-border:hsl(223, 43%, 17%);--info-text:hsl(216, 87%, 65%);--warning-bg:hsl(64, 100%, 6%);--warning-border:hsl(60, 100%, 9%);--warning-text:hsl(46, 87%, 65%);--error-bg:hsl(358, 76%, 10%);--error-border:hsl(357, 89%, 16%);--error-text:hsl(358, 100%, 81%)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast] [data-close-button]{background:var(--normal-bg);border-color:var(--normal-border);color:var(--normal-text)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast] [data-close-button]:hover{background:var(--normal-bg-hover);border-color:var(--normal-border-hover)}[data-rich-colors=true][data-sonner-toast][data-type=success]{background:var(--success-bg);border-color:var(--success-border);color:var(--success-text)}[data-rich-colors=true][data-sonner-toast][data-type=success] [data-close-button]{background:var(--success-bg);border-color:var(--success-border);color:var(--success-text)}[data-rich-colors=true][data-sonner-toast][data-type=info]{background:var(--info-bg);border-color:var(--info-border);color:var(--info-text)}[data-rich-colors=true][data-sonner-toast][data-type=info] [data-close-button]{background:var(--info-bg);border-color:var(--info-border);color:var(--info-text)}[data-rich-colors=true][data-sonner-toast][data-type=warning]{background:var(--warning-bg);border-color:var(--warning-border);color:var(--warning-text)}[data-rich-colors=true][data-sonner-toast][data-type=warning] [data-close-button]{background:var(--warning-bg);border-color:var(--warning-border);color:var(--warning-text)}[data-rich-colors=true][data-sonner-toast][data-type=error]{background:var(--error-bg);border-color:var(--error-border);color:var(--error-text)}[data-rich-colors=true][data-sonner-toast][data-type=error] [data-close-button]{background:var(--error-bg);border-color:var(--error-border);color:var(--error-text)}.sonner-loading-wrapper{--size:16px;height:var(--size);width:var(--size);position:absolute;inset:0;z-index:10}.sonner-loading-wrapper[data-visible=false]{transform-origin:center;animation:sonner-fade-out .2s ease forwards}.sonner-spinner{position:relative;top:50%;left:50%;height:var(--size);width:var(--size)}.sonner-loading-bar{animation:sonner-spin 1.2s linear infinite;background:var(--gray11);border-radius:6px;height:8%;left:-10%;position:absolute;top:-3.9%;width:24%}.sonner-loading-bar:first-child{animation-delay:-1.2s;transform:rotate(.0001deg) translate(146%)}.sonner-loading-bar:nth-child(2){animation-delay:-1.1s;transform:rotate(30deg) translate(146%)}.sonner-loading-bar:nth-child(3){animation-delay:-1s;transform:rotate(60deg) translate(146%)}.sonner-loading-bar:nth-child(4){animation-delay:-.9s;transform:rotate(90deg) translate(146%)}.sonner-loading-bar:nth-child(5){animation-delay:-.8s;transform:rotate(120deg) translate(146%)}.sonner-loading-bar:nth-child(6){animation-delay:-.7s;transform:rotate(150deg) translate(146%)}.sonner-loading-bar:nth-child(7){animation-delay:-.6s;transform:rotate(180deg) translate(146%)}.sonner-loading-bar:nth-child(8){animation-delay:-.5s;transform:rotate(210deg) translate(146%)}.sonner-loading-bar:nth-child(9){animation-delay:-.4s;transform:rotate(240deg) translate(146%)}.sonner-loading-bar:nth-child(10){animation-delay:-.3s;transform:rotate(270deg) translate(146%)}.sonner-loading-bar:nth-child(11){animation-delay:-.2s;transform:rotate(300deg) translate(146%)}.sonner-loading-bar:nth-child(12){animation-delay:-.1s;transform:rotate(330deg) translate(146%)}@keyframes sonner-fade-in{0%{opacity:0;transform:scale(.8)}100%{opacity:1;transform:scale(1)}}@keyframes sonner-fade-out{0%{opacity:1;transform:scale(1)}100%{opacity:0;transform:scale(.8)}}@keyframes sonner-spin{0%{opacity:1}100%{opacity:.15}}@media (prefers-reduced-motion){.sonner-loading-bar,[data-sonner-toast],[data-sonner-toast]>*{transition:none!important;animation:none!important}}.sonner-loader{position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);transform-origin:center;transition:opacity .2s,transform .2s}.sonner-loader[data-visible=false]{opacity:0;transform:scale(.8) translate(-50%,-50%)}`);function ON(e){return e.label!==void 0}var kN=3,AN=`24px`,jN=`16px`,MN=4e3,NN=356,PN=14,FN=45,IN=200;function LN(...e){return e.filter(Boolean).join(` `)}function RN(e){let[t,n]=e.split(`-`),r=[];return t&&r.push(t),n&&r.push(n),r}var zN=e=>{let{invert:t,toast:n,unstyled:r,interacting:i,setHeights:a,visibleToasts:o,heights:s,index:c,toasts:l,expanded:u,removeToast:d,defaultRichColors:f,closeButton:p,style:m,cancelButtonStyle:h,actionButtonStyle:g,className:_=``,descriptionClassName:v=``,duration:y,position:b,gap:x,expandByDefault:S,classNames:C,icons:w,closeButtonAriaLabel:T=`Close toast`}=e,[E,D]=q.useState(null),[O,k]=q.useState(null),[A,j]=q.useState(!1),[M,N]=q.useState(!1),[P,F]=q.useState(!1),[I,L]=q.useState(!1),[R,ee]=q.useState(!1),[z,te]=q.useState(0),[B,ne]=q.useState(0),V=q.useRef(n.duration||y||MN),H=q.useRef(null),re=q.useRef(null),ie=c===0,ae=c+1<=o,oe=n.type,se=oe??`default`,U=n.dismissible!==!1,ce=n.className||``,le=n.descriptionClassName||``,ue=q.useMemo(()=>s.findIndex(e=>e.toastId===n.id)||0,[s,n.id]),de=q.useMemo(()=>n.closeButton??p,[n.closeButton,p]),fe=q.useMemo(()=>n.duration||y||MN,[n.duration,y]),pe=q.useRef(0),me=q.useRef(0),he=q.useRef(0),ge=q.useRef(null),[_e,ve]=b.split(`-`),ye=q.useMemo(()=>s.reduce((e,t,n)=>n>=ue?e:e+t.height,0),[s,ue]),be=xN(),xe=q.useMemo(()=>e.swipeDirections??RN(b),[e.swipeDirections,b]),Se=n.invert||t,Ce=oe===`loading`;me.current=q.useMemo(()=>ue*x+ye,[ue,ye]),q.useEffect(()=>{V.current=fe},[fe]),q.useEffect(()=>{j(!0)},[]),q.useEffect(()=>{let e=re.current;if(e){let t=e.getBoundingClientRect().height;return ne(t),a(e=>[{toastId:n.id,height:t,position:n.position},...e]),()=>a(e=>e.filter(e=>e.toastId!==n.id))}},[a,n.id]),q.useLayoutEffect(()=>{if(!A)return;let e=re.current,t=e.style.height;e.style.height=`auto`;let r=e.getBoundingClientRect().height;e.style.height=t,ne(r),a(e=>e.find(e=>e.toastId===n.id)?e.map(e=>e.toastId===n.id?{...e,height:r}:e):[{toastId:n.id,height:r,position:n.position},...e])},[A,n.title,n.description,a,n.id,n.jsx,n.action,n.cancel]);let we=q.useCallback(()=>{N(!0),te(me.current),a(e=>e.filter(e=>e.toastId!==n.id)),setTimeout(()=>{d(n)},IN)},[n,d,a,me]);q.useEffect(()=>{if(n.promise&&oe===`loading`||n.duration===1/0||n.type===`loading`)return;let e;return u||i||be?(()=>{if(he.current<pe.current){let e=new Date().getTime()-pe.current;V.current-=e}he.current=new Date().getTime()})():V.current!==1/0&&(pe.current=new Date().getTime(),e=setTimeout(()=>{n.onAutoClose==null||n.onAutoClose.call(n,n),we()},V.current)),()=>clearTimeout(e)},[u,i,n,oe,be,we]),q.useEffect(()=>{n.delete&&(we(),n.onDismiss==null||n.onDismiss.call(n,n))},[we,n.delete]);function Te(){return w?.loading?q.createElement(`div`,{className:LN(C?.loader,n?.classNames?.loader,`sonner-loader`),"data-visible":oe===`loading`},w.loading):q.createElement(hN,{className:LN(C?.loader,n?.classNames?.loader),visible:oe===`loading`})}let Ee=n.icon||w?.[oe]||pN(oe);return q.createElement(`li`,{tabIndex:0,ref:re,className:LN(_,ce,C?.toast,n?.classNames?.toast,C?.[se],n?.classNames?.[se]),"data-sonner-toast":``,"data-rich-colors":n.richColors??f,"data-styled":!(n.jsx||n.unstyled||r),"data-mounted":A,"data-promise":!!n.promise,"data-swiped":R,"data-removed":M,"data-visible":ae,"data-y-position":_e,"data-x-position":ve,"data-index":c,"data-front":ie,"data-swiping":P,"data-dismissible":U,"data-type":oe,"data-invert":Se,"data-swipe-out":I,"data-swipe-direction":O,"data-expanded":!!(u||S&&A),"data-testid":n.testId,style:{"--index":c,"--toasts-before":c,"--z-index":l.length-c,"--offset":`${M?z:me.current}px`,"--initial-height":S?`auto`:`${B}px`,...m,...n.style},onDragEnd:()=>{F(!1),D(null),ge.current=null},onPointerDown:e=>{e.button!==2&&!Ce&&U&&(H.current=new Date,te(me.current),e.target.setPointerCapture(e.pointerId),e.target.tagName!==`BUTTON`&&(F(!0),ge.current={x:e.clientX,y:e.clientY}))},onPointerUp:()=>{if(I||!U)return;ge.current=null;let e=Number(re.current?.style.getPropertyValue(`--swipe-amount-x`).replace(`px`,``)||0),t=Number(re.current?.style.getPropertyValue(`--swipe-amount-y`).replace(`px`,``)||0),r=new Date().getTime()-H.current?.getTime(),i=E===`x`?e:t,a=Math.abs(i)/r;if((E===`x`?xe.includes(e>0?`right`:`left`):xe.includes(t>0?`bottom`:`top`))&&(Math.abs(i)>=FN||a>.11))te(me.current),n.onDismiss==null||n.onDismiss.call(n,n),k(E===`x`?e>0?`right`:`left`:t>0?`down`:`up`),we(),L(!0);else{var o,s;(o=re.current)==null||o.style.setProperty(`--swipe-amount-x`,`0px`),(s=re.current)==null||s.style.setProperty(`--swipe-amount-y`,`0px`),ee(!1),F(!1),D(null)}},onPointerMove:e=>{var t,n;if(!ge.current||!U||window.getSelection()?.toString().length>0)return;let r=e.clientY-ge.current.y,i=e.clientX-ge.current.x;!E&&(Math.abs(i)>1||Math.abs(r)>1)&&D(Math.abs(i)>Math.abs(r)?`x`:`y`);let a={x:0,y:0},o=e=>1/(1.5+Math.abs(e)/20);if(E===`y`){if(xe.includes(`top`)||xe.includes(`bottom`)){if(xe.includes(`top`)&&r<0||xe.includes(`bottom`)&&r>0)a.y=r;else{let e=r*o(r);a.y=Math.abs(e)<Math.abs(r)?e:r}}}else if(E===`x`&&(xe.includes(`left`)||xe.includes(`right`))){if(xe.includes(`left`)&&i<0||xe.includes(`right`)&&i>0)a.x=i;else{let e=i*o(i);a.x=Math.abs(e)<Math.abs(i)?e:i}}(Math.abs(a.x)>0||Math.abs(a.y)>0)&&ee(!0),(t=re.current)==null||t.style.setProperty(`--swipe-amount-x`,`${a.x}px`),(n=re.current)==null||n.style.setProperty(`--swipe-amount-y`,`${a.y}px`)}},de&&!n.jsx&&oe!==`loading`?q.createElement(`button`,{"aria-label":T,"data-disabled":Ce,"data-close-button":!0,onClick:Ce||!U?()=>{}:()=>{we(),n.onDismiss==null||n.onDismiss.call(n,n)},className:LN(C?.closeButton,n?.classNames?.closeButton)},w?.close??bN):null,(oe||n.icon||n.promise)&&n.icon!==null&&(w?.[oe]!==null||n.icon)?q.createElement(`div`,{"data-icon":``,className:LN(C?.icon,n?.classNames?.icon)},oe===`loading`?n.icon||Te():n.promise?Te():null,oe===`loading`?null:Ee):null,q.createElement(`div`,{"data-content":``,className:LN(C?.content,n?.classNames?.content)},q.createElement(`div`,{"data-title":``,className:LN(C?.title,n?.classNames?.title)},n.jsx?n.jsx:typeof n.title==`function`?n.title():n.title),n.description?q.createElement(`div`,{"data-description":``,className:LN(v,le,C?.description,n?.classNames?.description)},typeof n.description==`function`?n.description():n.description):null),q.isValidElement(n.cancel)?n.cancel:n.cancel&&ON(n.cancel)?q.createElement(`button`,{"data-button":!0,"data-cancel":!0,style:n.cancelButtonStyle||h,onClick:e=>{ON(n.cancel)&&U&&(n.cancel.onClick==null||n.cancel.onClick.call(n.cancel,e),we())},className:LN(C?.cancelButton,n?.classNames?.cancelButton)},n.cancel.label):null,q.isValidElement(n.action)?n.action:n.action&&ON(n.action)?q.createElement(`button`,{"data-button":!0,"data-action":!0,style:n.actionButtonStyle||g,onClick:e=>{ON(n.action)&&(n.action.onClick==null||n.action.onClick.call(n.action,e),!e.defaultPrevented&&we())},className:LN(C?.actionButton,n?.classNames?.actionButton)},n.action.label):null)};function BN(){if(typeof window>`u`||typeof document>`u`)return`ltr`;let e=document.documentElement.getAttribute(`dir`);return e===`auto`||!e?window.getComputedStyle(document.documentElement).direction:e}function VN(e,t){let n={};return[e,t].forEach((e,t)=>{let r=t===1,i=r?`--mobile-offset`:`--offset`,a=r?jN:AN;function o(e){[`top`,`right`,`bottom`,`left`].forEach(t=>{n[`${i}-${t}`]=typeof e==`number`?`${e}px`:e})}typeof e==`number`||typeof e==`string`?o(e):typeof e==`object`?[`top`,`right`,`bottom`,`left`].forEach(t=>{e[t]===void 0?n[`${i}-${t}`]=a:n[`${i}-${t}`]=typeof e[t]==`number`?`${e[t]}px`:e[t]}):o(a)}),n}var HN=q.forwardRef(function(e,t){let{id:n,invert:r,position:i=`bottom-right`,hotkey:a=[`altKey`,`KeyT`],expand:o,closeButton:s,className:c,offset:l,mobileOffset:u,theme:d=`light`,richColors:f,duration:p,style:m,visibleToasts:h=kN,toastOptions:g,dir:_=BN(),gap:v=PN,icons:y,customAriaLabel:b,containerAriaLabel:x=`Notifications`}=e,[S,C]=q.useState([]),w=q.useMemo(()=>n?S.filter(e=>e.toasterId===n):S.filter(e=>!e.toasterId),[S,n]),T=q.useMemo(()=>Array.from(new Set([i].concat(w.filter(e=>e.position).map(e=>e.position)))),[w,i]),[E,D]=q.useState([]),[O,k]=q.useState(!1),[A,j]=q.useState(!1),[M,N]=q.useState(d===`system`?typeof window<`u`&&window.matchMedia&&window.matchMedia(`(prefers-color-scheme: dark)`).matches?`dark`:`light`:d),P=q.useRef(null),F=a.join(`+`).replace(/Key/g,``).replace(/Digit/g,``),I=q.useRef(null),L=q.useRef(!1),R=q.useCallback(e=>{C(t=>(t.find(t=>t.id===e.id)?.delete||TN.dismiss(e.id),t.filter(({id:t})=>t!==e.id)))},[]);return q.useEffect(()=>TN.subscribe(e=>{e.dismiss?requestAnimationFrame(()=>{C(t=>t.map(t=>t.id===e.id?{...t,delete:!0}:t))}):setTimeout(()=>{DS.flushSync(()=>{C(t=>{let n=t.findIndex(t=>t.id===e.id);return n===-1?[e,...t]:[...t.slice(0,n),{...t[n],...e},...t.slice(n+1)]})})})}),[]),q.useEffect(()=>{if(d!==`system`){N(d);return}if(d===`system`&&(window.matchMedia&&window.matchMedia(`(prefers-color-scheme: dark)`).matches?N(`dark`):N(`light`)),typeof window>`u`)return;let e=window.matchMedia(`(prefers-color-scheme: dark)`);try{e.addEventListener(`change`,({matches:e})=>{N(e?`dark`:`light`)})}catch{e.addListener(({matches:e})=>{try{N(e?`dark`:`light`)}catch(e){console.error(e)}})}},[d]),q.useEffect(()=>{S.length<=1&&k(!1)},[S]),q.useEffect(()=>{let e=e=>{if(a.length>0&&a.every(t=>e[t]||e.code===t)){var t;k(!0),(t=P.current)==null||t.focus()}e.code===`Escape`&&(document.activeElement===P.current||P.current?.contains(document.activeElement))&&k(!1)};return document.addEventListener(`keydown`,e),()=>document.removeEventListener(`keydown`,e)},[a]),q.useEffect(()=>{if(P.current)return()=>{I.current&&(I.current.focus({preventScroll:!0}),I.current=null,L.current=!1)}},[P.current]),q.createElement(`section`,{ref:t,"aria-label":b??`${x} ${F}`,tabIndex:-1,"aria-live":`polite`,"aria-relevant":`additions text`,"aria-atomic":`false`,suppressHydrationWarning:!0,"data-react-aria-top-layer":!0},T.map((t,n)=>{let[i,a]=t.split(`-`);return w.length?q.createElement(`ol`,{key:t,dir:_===`auto`?BN():_,tabIndex:-1,ref:P,className:c,"data-sonner-toaster":!0,"data-sonner-theme":M,"data-y-position":i,"data-x-position":a,style:{"--front-toast-height":`${E[0]?.height||0}px`,"--width":`${NN}px`,"--gap":`${v}px`,...m,...VN(l,u)},onBlur:e=>{L.current&&!e.currentTarget.contains(e.relatedTarget)&&(L.current=!1,I.current&&=(I.current.focus({preventScroll:!0}),null))},onFocus:e=>{e.target instanceof HTMLElement&&e.target.dataset.dismissible===`false`||L.current||(L.current=!0,I.current=e.relatedTarget)},onMouseEnter:()=>k(!0),onMouseMove:()=>k(!0),onMouseLeave:()=>{A||k(!1)},onDragEnd:()=>k(!1),onPointerDown:e=>{e.target instanceof HTMLElement&&e.target.dataset.dismissible===`false`||j(!0)},onPointerUp:()=>j(!1)},w.filter(e=>!e.position&&n===0||e.position===t).map((n,i)=>q.createElement(zN,{key:n.id,icons:y,index:i,toast:n,defaultRichColors:f,duration:g?.duration??p,className:g?.className,descriptionClassName:g?.descriptionClassName,invert:r,visibleToasts:h,closeButton:g?.closeButton??s,interacting:A,position:t,style:g?.style,unstyled:g?.unstyled,classNames:g?.classNames,cancelButtonStyle:g?.cancelButtonStyle,actionButtonStyle:g?.actionButtonStyle,closeButtonAriaLabel:g?.closeButtonAriaLabel,removeToast:R,toasts:w.filter(e=>e.position==n.position),heights:E.filter(e=>e.position==n.position),setHeights:D,expandByDefault:o,gap:v,expanded:O,swipeDirections:e.swipeDirections}))):null}))});function UN({className:e,...t}){return(0,J.jsx)(`label`,{"data-slot":`label`,className:X(`flex items-center gap-2 text-ui leading-none font-medium select-none group-data-[disabled=true]:pointer-events-none group-data-[disabled=true]:opacity-50 peer-disabled:cursor-not-allowed peer-disabled:opacity-50`,e),...t})}var WN=`data-valid`,GN=`data-invalid`,KN={badInput:!1,customError:!1,patternMismatch:!1,rangeOverflow:!1,rangeUnderflow:!1,stepMismatch:!1,tooLong:!1,tooShort:!1,typeMismatch:!1,valid:null,valueMissing:!1},qN={disabled:!1,valid:null,touched:!1,dirty:!1,filled:!1,focused:!1},JN={valid(e){return e===null?null:e?{[WN]:``}:{[GN]:``}}},YN={invalid:void 0,name:void 0,validityData:{state:KN,errors:[],error:``,value:``,initialValue:null},setValidityData:Av,disabled:void 0,setTouched:Av,setDirty:Av,setFilled:Av,setFocused:Av,focusOwnerRef:{current:void 0},validationMode:`onSubmit`,shouldValidateOnChange:()=>!1,state:qN,registerFieldControl:Av,validation:{getValidationProps:(e,t=Mv)=>t,inputRef:{current:null},registeredInputs:new Map,registerInput:Av,getInputControl:()=>null,commit:async()=>{},change:Av}},XN=q.createContext(YN);function ZN(e=!0){let t=q.useContext(XN);if(t.setValidityData===Av&&!e)throw Error(fv(28));return t}function QN(e,t,n){let{setFocused:r,focusOwnerRef:i}=ZN(),a=Z(t=>{(t?!e:i.current===a)&&(i.current=t&&a,n?.(t),r(t))});return Q(()=>{let e=t.current;return e?.getRootNode()?.activeElement===e&&a(!0),()=>a(!1)},[e,t,a]),a}var $N=q.createContext({controlId:void 0,registerControlId:Av,resetControlId:Av,labelId:void 0,setLabelId:Av,messageIds:[],setMessageIds:Av,getDescriptionProps:e=>e});function eP(){return q.useContext($N)}function tP(e,t,n,r=!0,i,a){let[o,s]=q.useState(),c=eE(i?`${i}-label`:void 0),l=!!a?.trim(),u=e??(l?void 0:t)??o;return Q(()=>{let i=e||t||l||!r?void 0:nP(n.current,c);o!==i&&s(i)}),u}function nP(e,t){let n=rP(e);if(n)return!n.id&&t&&(n.id=t),n.id||void 0}function rP(e){if(!e)return;let t=e.parentElement;if(t&&t.tagName===`LABEL`)return t;let n=e.id;if(n){let t=e.nextElementSibling;if(t&&t.htmlFor===n)return t}let r=e.labels;return r&&r[0]}function iP(e={}){let{id:t,enabled:n=!0}=e,{controlId:r,registerControlId:i,resetControlId:a}=eP(),o=eE(),s=G_(()=>Symbol()),c=q.useRef(!1),l=q.useRef(!1),u=Z(()=>{c.current&&i!==Av&&(c.current=!1,i(s.current,void 0))});return Q(()=>{if(!n||i===Av){u();return}let e;if(t!==void 0)l.current=!0,e=t;else if(l.current)e=o;else{a();return}e===void 0?u():(c.current=!0,i(s.current,e))},[t,n,i,a,o,s,u]),Q(()=>u,[u]),(n?r:void 0)??t??o}function aP(e){if(e==null)return``;if(typeof e==`string`)return e;try{return JSON.stringify(e)}catch{return String(e)}}function oP(e,t,n,r,i=!0,a){let{registerFieldControl:o}=ZN(),s=G_(()=>Symbol());Q(()=>{let c=s.current;i?o(c,{controlRef:e,getValue:r,id:t,name:a,value:n}):o(c,void 0)},[e,i,r,t,a,o,s,n]),Q(()=>{let e=s.current;return()=>{o(e,void 0)}},[o,s])}var sP=q.createContext({elementRef:{current:null},formRef:{current:{fields:new Map}},errors:{},clearErrors:Av,validationMode:`onSubmit`,submitCountRef:{current:0}});function cP(){return q.useContext(sP)}var lP=`rounded-lg border border-review-changes/25 bg-review-changes-bg px-3 py-2 text-review-changes`,uP=`rounded-lg border border-review-pending/25 bg-review-pending-bg px-3 py-2 text-review-pending`;function dP({className:e,...t}){return(0,J.jsx)(`div`,{"data-slot":`skeleton`,className:X(`animate-pulse rounded-md bg-muted`,e),...t})}var fP=({lines:e=7})=>(0,J.jsxs)(`div`,{role:`status`,"aria-label":`Loading the diff`,className:`overflow-hidden rounded-lg border bg-card`,children:[(0,J.jsxs)(`div`,{className:`flex h-10 items-center gap-3 border-b px-3`,children:[(0,J.jsx)(dP,{className:`h-3 w-3`}),(0,J.jsx)(dP,{className:`h-3 w-56`}),(0,J.jsx)(dP,{className:`ml-auto h-3 w-12`})]}),(0,J.jsx)(`div`,{className:`flex flex-col py-1`,children:Array.from({length:e},(e,t)=>(0,J.jsxs)(`div`,{className:`flex h-5 items-center gap-3 px-3`,children:[(0,J.jsx)(dP,{className:`h-2.5 w-8`}),(0,J.jsx)(dP,{className:`h-2.5`,style:{width:`${30+t*37%55}%`}})]},t))})]}),pP=({rows:e=8})=>(0,J.jsxs)(`div`,{role:`status`,"aria-label":`Loading the files`,className:`flex flex-col gap-2 px-1`,children:[(0,J.jsx)(dP,{className:`h-7 w-full`}),Array.from({length:e},(e,t)=>(0,J.jsxs)(`div`,{className:`flex h-6 items-center gap-2`,style:{paddingLeft:`${t%3*12}px`},children:[(0,J.jsx)(dP,{className:`h-2.5 flex-1`}),(0,J.jsx)(dP,{className:`h-2.5 w-10`})]},t))]}),mP=q.createContext(void 0);function hP(){let e=q.useContext(mP);if(e===void 0)throw Error(fv(63));return e}var gP=`data-checked`,_P=`data-unchecked`,vP={...JN,checked(e){return e?{[gP]:``}:{[_P]:``}}},yP=q.forwardRef(function(e,t){let{checked:n,className:r,defaultChecked:i,"aria-labelledby":a,form:o,id:s,inputRef:c,name:l,nativeButton:u=!1,onCheckedChange:d,readOnly:f=!1,required:p=!1,disabled:m=!1,render:h,uncheckedValue:g,value:_,style:v,...y}=e,{clearErrors:b}=cP(),{state:x,setTouched:S,setDirty:C,validityData:w,setFilled:T,validationMode:E,disabled:D,name:O,validation:k}=ZN(),{labelId:A}=eP(),j=D||m,M=O??l,N=q.useRef(null),P=xv(N,c,k.inputRef),F=q.useRef(null),I=QN(j,F),L=eE(),R=iP({id:s}),ee=u?void 0:R,[z,te]=sO({controlled:n,default:!!i,name:`Switch`,state:`checked`});oP(F,L,z,void 0,!j,l),Q(()=>{T(z)},[z,T]),lj(z,()=>{b(M),C(z!==w.initialValue),k.change(z)});let{getButtonProps:B,buttonRef:ne}=vv({disabled:j,native:u}),V=tP(a,A,N,!u,ee,y[`aria-label`]),H={id:u?R:L,role:`switch`,"aria-checked":z,"aria-readonly":f||void 0,"aria-required":p||void 0,"aria-labelledby":V,onFocus(){I(!0)},onBlur(){let e=N.current;e&&!j&&(S(!0),I(!1),E===`onBlur`&&k.commit(e.checked))},onClick(e){if(f||j)return;e.preventDefault();let t=N.current;t&&_v(t,e)}},re={...k.getValidationProps(j),checked:z,disabled:j,form:o,id:ee,name:M,required:p,style:M?Yb:Jb,tabIndex:-1,type:`checkbox`,"aria-hidden":!0,ref:P,onChange(e){if(e.nativeEvent.defaultPrevented)return;if(f){e.preventDefault();return}let t=e.currentTarget.checked,n=mb(gb,e.nativeEvent);d?.(t,n),!n.isCanceled&&te(t)},onClick(e){e.stopPropagation()},onFocus(){F.current?.focus()},..._===void 0?Mv:{value:_}},ie=q.useMemo(()=>({...x,checked:z,disabled:j,readOnly:f,required:p}),[x,z,j,f,p]),ae=Iv(`span`,e,{state:ie,ref:[t,F,ne],props:[H,y,B,e=>k.getValidationProps(j,e)],stateAttributesMapping:vP});return(0,J.jsxs)(mP.Provider,{value:ie,children:[ae,!z&&M&&g!==void 0&&(0,J.jsx)(`input`,{type:`hidden`,form:o,name:M,value:g,disabled:j}),(0,J.jsx)(`input`,{...re,suppressHydrationWarning:!0})]})}),bP=q.forwardRef(function(e,t){let{render:n,className:r,style:i,...a}=e;return Iv(`span`,e,{state:hP(),ref:t,stateAttributesMapping:vP,props:a})});function xP({className:e,size:t=`default`,...n}){return(0,J.jsx)(yP,{"data-slot":`switch`,"data-size":t,className:X(`peer group/switch relative inline-flex shrink-0 items-center rounded-full border border-transparent transition-all group-has-[:focus-visible]/field-label:border-transparent group-has-[:focus-visible]/field-label:ring-0 after:absolute after:-inset-x-3 after:-inset-y-2 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 data-[size=default]:h-[18.4px] data-[size=default]:w-[32px] data-[size=sm]:h-[14px] data-[size=sm]:w-[24px] data-checked:bg-primary data-unchecked:bg-input data-disabled:cursor-not-allowed data-disabled:opacity-50`,e),...n,children:(0,J.jsx)(bP,{"data-slot":`switch-thumb`,className:`pointer-events-none block rounded-full bg-background ring-0 transition-transform group-data-[size=default]/switch:size-4 group-data-[size=sm]/switch:size-3 group-data-[size=default]/switch:data-checked:translate-x-[calc(100%-2px)] group-data-[size=sm]/switch:data-checked:translate-x-[calc(100%-2px)] group-data-[size=default]/switch:data-unchecked:translate-x-0 group-data-[size=sm]/switch:data-unchecked:translate-x-0`})})}var SP=[{scope:`global`,title:`Anywhere`},{scope:`diff`,title:`In the code`},{scope:`overview`,title:`In the overview`},{scope:`tree`,title:`In the file tree`},{scope:`composer`,title:`Writing a comment or review`},{scope:`picker`,title:`On the pull requests page`}],CP=({open:e,onOpenChange:t,ids:n})=>{let r=ak.filter(e=>n===void 0||n.includes(e.id)),[i,a]=xk(),o=(0,q.useMemo)(gk,[]),s=(0,q.useId)();return(0,J.jsx)(fj,{open:e,onOpenChange:t,children:(0,J.jsxs)(hj,{className:`max-h-[85vh] overflow-y-auto sm:max-w-lg`,children:[(0,J.jsxs)(gj,{children:[(0,J.jsx)(_j,{children:`Keyboard shortcuts`}),(0,J.jsx)(vj,{children:`Keys don't fire while you type in a field.`})]}),(0,J.jsxs)(`div`,{className:`flex items-center justify-between gap-3 rounded-lg border p-3`,children:[(0,J.jsxs)(UN,{htmlFor:s,className:`leading-snug`,children:[`Single-key shortcuts`,(0,J.jsx)(`span`,{className:`block text-caption font-normal text-muted-foreground`,children:`Letter keys like n and c. Off if they get in the way of speech input or another tool.`})]}),(0,J.jsx)(xP,{id:s,checked:i,onCheckedChange:a})]}),SP.filter(({scope:e})=>r.some(t=>t.scope===e)).map(({scope:e,title:t})=>(0,J.jsxs)(`section`,{"aria-label":t,className:`flex flex-col gap-1`,children:[(0,J.jsx)(`h3`,{className:`text-caption font-medium text-muted-foreground`,children:t}),(0,J.jsx)(`dl`,{className:`flex flex-col`,children:r.filter(t=>t.scope===e).map(e=>{let t=!i&&e.chords.every(uk);return(0,J.jsxs)(`div`,{className:`flex min-h-7 items-center justify-between gap-4 border-b py-1 last:border-0`,children:[(0,J.jsxs)(`dt`,{className:t?`text-muted-foreground line-through`:void 0,children:[e.action,t&&(0,J.jsx)(`span`,{className:`sr-only`,children:` (off)`})]}),(0,J.jsx)(`dd`,{className:`flex gap-2`,children:e.chords.map(e=>(0,J.jsx)(wk,{children:fk(e,o).map(e=>(0,J.jsx)(Ck,{children:e},e))},fk(e,o).join(` `)))})]},e.id)})})]},e))]})})},wP=q.forwardRef(function(e,t){let{render:n,className:r,id:i,name:a,value:o,disabled:s=!1,onValueChange:c,defaultValue:l,autoFocus:u=!1,style:d,...f}=e,{state:p,name:m,disabled:h,setTouched:g,setDirty:_,validityData:v,setFilled:y,validationMode:b,validation:x}=ZN(),{clearErrors:S,elementRef:C,submitCountRef:w}=cP(),T=h||s,E=m??a,D={...p,disabled:T},{labelId:O}=eP(),k=iP({id:i}),A=o!==void 0,j=o==null?void 0:String(o),M=Z(()=>x.inputRef.current?.value);oP(x.inputRef,k,j,M,!T,a),Q(()=>{let e=j??x.inputRef.current?.value;e!==void 0&&y(e!==``)},[j,l,x.inputRef,y]),lj(j,()=>{j!==void 0&&(S(E),_(j!==(v.initialValue??``)),x.change(j))});let N=q.useRef(null),P=QN(T,N),F=iy();return Iv(`input`,e,{ref:[t,N],state:D,props:[{id:k,disabled:T,name:E,ref:x.inputRef,"aria-labelledby":O,autoFocus:u,...A?{value:o}:{defaultValue:l},onChange(e){let t=e.currentTarget.value,n=mb(gb,e.nativeEvent);c?.(t,n),!A&&(_(t!==(v.initialValue??``)),y(t!==``),!e.nativeEvent.defaultPrevented&&!n.isCanceled&&(S(E),x.change(t)))},onFocus(){P(!0)},onBlur(e){if(g(!0),P(!1),b===`onBlur`){let t=e.currentTarget.value;x.commit(t),A&&queueMicrotask(()=>{let e=x.inputRef.current?.value;e!==void 0&&e!==t&&e!==(v.initialValue??``)&&x.commit(e)})}},onKeyDown(e){if(e.currentTarget.tagName===`INPUT`&&e.key===`Enter`){g(!0);let t=e.currentTarget.value,n=e.currentTarget.form;if(n&&n===C.current&&!e.defaultPrevented){let t=e.currentTarget,n=w.current;F.start(0,()=>{w.current===n&&x.commit(t.value)})}else x.commit(t)}}},f,e=>x.getValidationProps(T,e)],stateAttributesMapping:JN})}),TP=q.forwardRef(function(e,t){return(0,J.jsx)(wP,{ref:t,...e})});function EP({className:e,type:t,...n}){return(0,J.jsx)(TP,{type:t,"data-slot":`input`,className:X(`h-8 w-full min-w-0 rounded-md border border-input bg-transparent px-2.5 py-1 text-ui transition-colors file:inline-flex file:h-6 file:border-0 file:bg-transparent file:text-ui file:font-medium file:text-foreground placeholder:text-muted-foreground disabled:pointer-events-none disabled:cursor-not-allowed disabled:bg-input/50 disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20`,e),...n})}var DP=q.createContext(void 0);function OP(){let e=q.useContext(DP);if(e===void 0)throw Error(fv(53));return e}function kP(e,t,n){if(!e)return 0;let r=getComputedStyle(e),i=`${t}${n===`x`?`Inline`:`Block`}`,a=parseFloat(r[`${i}Start`]);return n===`x`&&t===`margin`?a*2:a+parseFloat(r[`${i}End`])}var AP=`base-ui-disable-scrollbar`,jP={className:AP,getElement(e){return(0,J.jsx)(`style`,{nonce:e,href:AP,precedence:`base-ui:low`,children:`.${AP}{scrollbar-width:none}.${AP}::-webkit-scrollbar{display:none}`})}},MP=`data-has-overflow-x`,NP=`data-has-overflow-y`,PP=`data-overflow-x-start`,FP=`data-overflow-x-end`,IP=`data-overflow-y-start`,LP=`data-overflow-y-end`,RP=e=>t=>t?{[e]:``}:null,zP={hasOverflowX:RP(MP),hasOverflowY:RP(NP),overflowXStart:RP(PP),overflowXEnd:RP(FP),overflowYStart:RP(IP),overflowYEnd:RP(LP),cornerHidden:()=>null},BP=`--scroll-area-corner-height`,VP=`--scroll-area-corner-width`,HP=`data-orientation`,UP={x:0,y:0},WP={width:0,height:0},GP={xStart:!1,xEnd:!1,yStart:!1,yEnd:!1},KP={x:!0,y:!0,corner:!0},qP=q.forwardRef(function(e,t){let{render:n,className:r,overflowEdgeThreshold:i,style:a,...o}=e,{xStart:s,xEnd:c,yStart:l,yEnd:u}=JP(i),d=eE(),f=iy(),p=iy(),{nonce:m,disableStyleElements:h}=MO(),[g,_]=q.useState(!1),[v,y]=q.useState(!1),[b,x]=q.useState(!1),[S,C]=q.useState(!1),[w,T]=q.useState(!1),[E,D]=q.useState(WP),[O,k]=q.useState(WP),[A,j]=q.useState(GP),[M,N]=q.useState(KP),P=q.useRef(null),F=q.useRef(null),I=q.useRef(null),L=q.useRef(null),R=q.useRef(null),ee=q.useRef(null),z=q.useRef(null),te=q.useRef(null),B=q.useRef(0),ne=q.useRef(0),V=q.useRef(0),H=q.useRef(0),re=q.useRef(`vertical`),ie=q.useRef(UP),ae=q.useRef(null);function oe(e){let t=e?x:y,n=e?f:p;t(!0),n.start(500,()=>{t(!1)})}let se=Z(e=>{let t=e.x-ie.current.x,n=e.y-ie.current.y;ie.current=e,n!==0&&oe(!0),t!==0&&oe(!1)}),U=Z(()=>{let e=F.current;e&&ae.current===null&&(ae.current=e.style.scrollSnapType,e.style.scrollSnapType=`none`)}),ce=Z(e=>{if(e.button!==0||te.current!==null&&(re.current===`vertical`?R.current:ee.current)?.hasPointerCapture(te.current))return;te.current=e.pointerId,B.current=e.clientY,ne.current=e.clientX,re.current=e.currentTarget.getAttribute(HP);let t=F.current;t&&(V.current=t.scrollTop,H.current=t.scrollLeft,U()),(re.current===`vertical`?R.current:ee.current)?.setPointerCapture(e.pointerId)}),le=Z(e=>{if(e.pointerId!==te.current)return;te.current=null,(re.current===`vertical`?x:y)(!1),ae.current!==null&&(F.current&&(F.current.style.scrollSnapType=ae.current),ae.current=null);let t=re.current===`vertical`?R.current:ee.current;t?.hasPointerCapture(e.pointerId)&&t.releasePointerCapture(e.pointerId)}),ue=Z(e=>{if(e.pointerId!==te.current)return;if(e.buttons%2==0){le(e);return}let t=F.current;if(!t)return;let n=re.current===`vertical`,r=n?R.current:ee.current,i=n?I.current:L.current;if(!r||!i)return;let a=n?`y`:`x`,o=kP(i,`padding`,a),s=kP(r,`margin`,a),c=n?r.offsetHeight:r.offsetWidth,l=(n?i.offsetHeight:i.offsetWidth)-c-o-s,u=n?e.clientY-B.current:e.clientX-ne.current,d=l<=0?0:u/l,f=n?t.scrollHeight:t.scrollWidth,p=n?t.clientHeight:t.clientWidth,m=(n?V.current:H.current)+d*(f-p);n?t.scrollTop=m:t.scrollLeft=m,e.preventDefault(),oe(n)});function de(e){C(e.pointerType===`touch`)}function fe(e){if(de(e),e.pointerType!==`touch`){let t=Ey(P.current,e.target);_(t)}}let pe=q.useMemo(()=>({scrolling:v||b,hasOverflowX:!M.x,hasOverflowY:!M.y,overflowXStart:A.xStart,overflowXEnd:A.xEnd,overflowYStart:A.yStart,overflowYEnd:A.yEnd,cornerHidden:M.corner}),[v,b,M.x,M.y,M.corner,A]),me={role:`presentation`,onPointerEnter:fe,onPointerMove:fe,onPointerDown:de,onPointerLeave(){_(!1)},style:{position:`relative`,[BP]:`${E.height}px`,[VP]:`${E.width}px`}},he=Iv(`div`,e,{state:pe,ref:[t,P],props:[me,o],stateAttributesMapping:zP}),ge=q.useMemo(()=>({handlePointerDown:ce,handlePointerMove:ue,handlePointerUp:le,handleScroll:se,disableViewportSnap:U,cornerSize:E,setCornerSize:D,thumbSize:O,setThumbSize:k,hasMeasuredScrollbar:w,setHasMeasuredScrollbar:T,touchModality:S,cornerRef:z,scrollingX:v,scrollingY:b,hovering:g,setHovering:_,viewportRef:F,scrollbarYRef:I,scrollbarXRef:L,thumbYRef:R,thumbXRef:ee,rootId:d,hiddenState:M,setHiddenState:N,overflowEdges:A,setOverflowEdges:j,viewportState:pe,overflowEdgeThreshold:{xStart:s,xEnd:c,yStart:l,yEnd:u}}),[ce,ue,le,se,U,E,O,w,S,v,b,g,d,M,A,pe,s,c,l,u]);return(0,J.jsxs)(DP.Provider,{value:ge,children:[!h&&jP.getElement(m),he]})});function JP(e){let t=typeof e==`number`?{xStart:e,xEnd:e,yStart:e,yEnd:e}:e;return{xStart:Math.max(0,t?.xStart||0),xEnd:Math.max(0,t?.xEnd||0),yStart:Math.max(0,t?.yStart||0),yEnd:Math.max(0,t?.yEnd||0)}}function YP(e,t=-(2**53-1),n=2**53-1){return Math.max(t,Math.min(e,n))}var XP=q.createContext(void 0);function ZP(e,t){return Math.max(0,e-t)}function QP(e,t){if(t<=0)return 0;let n=YP(e,0,t),r=n,i=t-n,a=r<=1,o=i<=1;return a&&o?r<=i?0:t:a?0:o?t:n}var $P=`--scroll-area-overflow-x-start`,eF=`--scroll-area-overflow-x-end`,tF=`--scroll-area-overflow-y-start`,nF=`--scroll-area-overflow-y-end`,rF=`--scroll-area-thumb-height`,iF=`--scroll-area-thumb-width`,aF=[$P,eF,tF,nF],oF=!1;function sF(){oF||gy||(typeof CSS<`u`&&`registerProperty`in CSS&&aF.forEach(e=>{try{CSS.registerProperty({name:e,syntax:`<length>`,inherits:!1,initialValue:`0px`})}catch{}}),oF=!0)}var cF=q.forwardRef(function(e,t){let{render:n,className:r,style:i,...a}=e,{viewportRef:o,scrollbarYRef:s,scrollbarXRef:c,thumbYRef:l,thumbXRef:u,cornerRef:d,cornerSize:f,setCornerSize:p,setThumbSize:m,rootId:h,setHiddenState:g,hiddenState:_,setHasMeasuredScrollbar:v,handleScroll:y,touchModality:b,setHovering:x,setOverflowEdges:S,overflowEdgeThreshold:C,viewportState:w}=OP(),T=oE(),E=q.useRef(!0),D=q.useRef([NaN,NaN,NaN,NaN]),O=iy(),k=iy(),A=Z(()=>{let e=o.current,t=s.current,n=c.current,r=l.current,i=u.current,a=d.current;if(!e)return;let h=e.scrollHeight,_=e.scrollWidth,y=e.clientHeight,b=e.clientWidth,x=e.scrollTop,w=e.scrollLeft,E=D.current,O=Number.isNaN(E[0]);if(E[0]=y,E[1]=h,E[2]=b,E[3]=_,O&&v(!0),h===0||_===0)return;let k=lF(e),A=k.y,j=k.x,M=b/_,N=y/h,P=Math.max(0,_-b),F=Math.max(0,h-y),I=0,L=0;j||(I=QP(T===`rtl`?-w:w,P),L=P-I);let R=A?0:QP(x,F),ee=A?0:F-R,z=j?0:b,te=A?0:y,B=0,ne=0;!j&&!A&&(B=t?.offsetWidth||0,ne=n?.offsetHeight||0);let V=f.width===0&&f.height===0,H=V?B:0,re=V?ne:0,ie=kP(n,`padding`,`x`),ae=kP(t,`padding`,`y`),oe=kP(i,`margin`,`x`),se=kP(r,`margin`,`y`),U=z-ie-oe,ce=te-ae-se,le=n?Math.min(n.offsetWidth-H,U):U,ue=t?Math.min(t.offsetHeight-re,ce):ce,de=Math.max(16,le*M),fe=Math.max(16,ue*N);if(m(e=>uF(e,{width:de,height:fe})),t&&r){let e=dF(r,rF,x,F,h,fe,t.offsetHeight-fe-ae-se);r.style.transform=`translate3d(0,${e}px,0)`}if(n&&i){let e=n.offsetWidth-de-ie-oe,t=dF(i,iF,T===`rtl`?-w:w,P,_,de,e);i.style.transform=`translate3d(${T===`rtl`?-t:t}px,0,0)`}let pe=[I,L,R,ee];aF.forEach((t,n)=>{e.style.setProperty(t,`${pe[n]}px`)}),a&&p(e=>uF(e,{width:B,height:ne})),g(e=>uF(e,k));let me={xStart:!j&&I>C.xStart,xEnd:!j&&L>C.xEnd,yStart:!A&&R>C.yStart,yEnd:!A&&ee>C.yEnd};S(e=>uF(e,me))});Q(()=>{sF()},[]),Q(()=>{queueMicrotask(A)},[A,_,T,C.xStart,C.xEnd,C.yStart,C.yEnd]),Q(()=>{o.current?.matches(`:hover`)&&x(!0)},[o,x]),Q(()=>{let e=o.current;if(typeof ResizeObserver>`u`||!e)return;let t=!1,n=new ResizeObserver(()=>{if(!t){t=!0;let n=D.current;if(n[0]===e.clientHeight&&n[1]===e.scrollHeight&&n[2]===e.clientWidth&&n[3]===e.scrollWidth)return}A()});return n.observe(e),k.start(0,()=>{let t=yC(e,{subtree:!0});t.length!==0&&Promise.allSettled(t.map(e=>e.finished.then(Av))).then(A).catch(()=>{})}),()=>{n.disconnect(),k.clear()}},[A,o,k]);function j(){E.current=!1}let M={...h&&{"data-id":`${h}-viewport`},tabIndex:_.x&&_.y?-1:0,className:jP.className,style:{overflow:`scroll`},onScroll(){o.current&&(A(),(b||!E.current)&&y({x:o.current.scrollLeft,y:o.current.scrollTop}),O.start(100,()=>{E.current=!0}))},onWheel:j,onPointerMove:j,onPointerEnter:j,onKeyDown:j},N=Iv(`div`,e,{ref:[t,o],state:w,props:[M,a],stateAttributesMapping:zP}),P=q.useMemo(()=>({computeThumbPosition:A}),[A]);return(0,J.jsx)(XP.Provider,{value:P,children:N})});function lF(e){let t=e.clientHeight>=e.scrollHeight,n=e.clientWidth>=e.scrollWidth;return{y:t,x:n,corner:t||n}}function uF(e,t){for(let n in t)if(e[n]!==t[n])return t;return e}function dF(e,t,n,r,i,a,o){let s=YP(n,0,r),c=n-s,l=Math.max(16,a*i/(i+Math.abs(c)));return e.style.setProperty(t,c?`${l}px`:``),(r?s/r*o:0)+(c>0?a-l:0)}var fF=q.createContext(void 0);function pF(){let e=q.useContext(fF);if(e===void 0)throw Error(fv(54));return e}var mF=q.forwardRef(function(e,t){let{render:n,className:r,orientation:i=`vertical`,keepMounted:a=!1,style:o,...s}=e,{hovering:c,scrollingX:l,scrollingY:u,hiddenState:d,scrollbarYRef:f,scrollbarXRef:p,viewportRef:m,thumbYRef:h,thumbXRef:g,handlePointerDown:_,handlePointerUp:v,handleScroll:y,disableViewportSnap:b,rootId:x,thumbSize:S,hasMeasuredScrollbar:C,viewportState:w}=OP(),T=i===`vertical`,E={...w,hovering:c,scrolling:T?u:l,orientation:i},D=oE(),O=!C&&!a,k=T?d.y:d.x,A=a||!k;q.useEffect(()=>{if(!A)return;let e=m.current,t=T?f.current:p.current;if(!t)return;function n(t){if(!e||t.ctrlKey)return;let n=!T,r=n?`scrollLeft`:`scrollTop`,i=n?t.deltaX:t.deltaY;if(i===0)return;let a=n?e.scrollWidth-e.clientWidth:e.scrollHeight-e.clientHeight,o=n&&D===`rtl`?-a:0,s=n&&D===`rtl`?0:a,c=e[r];c<=o&&i<0||c>=s&&i>0||(t.preventDefault(),e[r]=Math.min(s,Math.max(o,c+i)),y({x:e.scrollLeft,y:e.scrollTop}))}return zb(t,`wheel`,n,{passive:!1})},[D,y,T,p,f,A,m]);let j={...x&&{"data-id":`${x}-scrollbar`},"aria-hidden":!0,onPointerDown(e){if(e.button!==0)return;let t=Oy(e.nativeEvent),n=T?h.current:g.current;if(n&&Ey(n,t))return;let r=m.current;if(!r)return;let i=T?f.current:p.current;if(!n||!i)return;let a=T?`y`:`x`,o=kP(n,`margin`,a),s=kP(i,`padding`,a),c=T?n.offsetHeight:n.offsetWidth,l=i.getBoundingClientRect(),u=T?e.clientY-l.top-c/2-s+o/2:e.clientX-l.left-c/2-s+o/2,d=T?r.scrollHeight:r.scrollWidth,v=T?r.clientHeight:r.clientWidth,x=(T?i.offsetHeight:i.offsetWidth)-c-s-o;if(x<=0)return;let S=u/x,C=d-v;b(),T?r.scrollTop=S*C:r.scrollLeft=D===`rtl`?-(1-S)*C:S*C,y({x:r.scrollLeft,y:r.scrollTop}),_(e)},onMouseDown(e){e.preventDefault()},onPointerUp:v,onPointerCancel:v,style:{position:`absolute`,touchAction:`none`,WebkitUserSelect:`none`,userSelect:`none`,visibility:O?`hidden`:void 0,...T?{top:0,bottom:`var(${BP})`,insetInlineEnd:0,[rF]:`${S.height}px`}:{insetInlineStart:0,insetInlineEnd:`var(${VP})`,bottom:0,[iF]:`${S.width}px`}}},M=Iv(`div`,e,{ref:[t,T?f:p],state:E,props:[j,s],stateAttributesMapping:zP});return A?(0,J.jsx)(fF.Provider,{value:i,children:M}):null}),hF=q.forwardRef(function(e,t){let{render:n,className:r,style:i,...a}=e,{thumbYRef:o,thumbXRef:s,handlePointerDown:c,handlePointerMove:l,handlePointerUp:u,scrollingX:d,scrollingY:f,hasMeasuredScrollbar:p}=OP(),m=pF(),h=m===`vertical`;return Iv(`div`,e,{ref:[t,h?o:s],state:{scrolling:h?f:d,orientation:m},props:[{onPointerDown:c,onPointerMove:l,onPointerUp:u,onPointerCancel:u,style:{visibility:p?void 0:`hidden`,...h?{height:`var(--scroll-area-thumb-height)`}:{width:`var(--scroll-area-thumb-width)`}}},a]})}),gF=q.forwardRef(function(e,t){let{render:n,className:r,style:i,...a}=e,{cornerRef:o,cornerSize:s,hiddenState:c}=OP(),l=Iv(`div`,e,{ref:[t,o],props:[{"aria-hidden":!0,style:{position:`absolute`,bottom:0,insetInlineEnd:0,width:s.width,height:s.height}},a]});return c.corner?null:l});function _F({className:e,children:t,...n}){return(0,J.jsxs)(qP,{"data-slot":`scroll-area`,className:X(`relative`,e),...n,children:[(0,J.jsx)(cF,{"data-slot":`scroll-area-viewport`,className:`size-full rounded-[inherit] transition-[color,box-shadow] -outline-offset-2`,children:t}),(0,J.jsx)(vF,{}),(0,J.jsx)(gF,{})]})}function vF({className:e,orientation:t=`vertical`,...n}){return(0,J.jsx)(mF,{"data-slot":`scroll-area-scrollbar`,"data-orientation":t,orientation:t,className:X(`flex touch-none p-px transition-colors select-none data-horizontal:h-2.5 data-horizontal:flex-col data-horizontal:border-t data-horizontal:border-t-transparent data-vertical:h-full data-vertical:w-2.5 data-vertical:border-l data-vertical:border-l-transparent`,e),...n,children:(0,J.jsx)(hF,{"data-slot":`scroll-area-thumb`,className:`relative flex-1 rounded-full bg-border`})})}var yF=(e,t)=>{let n=t.toLowerCase().split(/\s+/).filter(Boolean);return e.filter(e=>{let t=e.path.toLowerCase();return n.every(e=>t.includes(e))})},bF=`…`,xF=e=>e.match(/[A-Z]?[a-z0-9]+|[A-Z]+(?![a-z])|[^A-Za-z0-9]+/g)??[e],SF=(e,t)=>{if(t(e))return e;let n=xF(e);if(n.length>2&&n.join(``)===e)for(let e=1;e<=n.length-2;e++)for(let r=Math.ceil((n.length-e)/2);r>=1;r--){if(r+e>n.length-1)continue;let i=`${n.slice(0,r).join(``)}${bF}${n.slice(r+e).join(``)}`;if(t(i))return i}let r=Math.min(8,e.length>>1),i=e;for(let n=e.length-r-1;n>=3;n--)if(i=`${e.slice(0,n)}${bF}${e.slice(-r)}`,t(i))return i;return i},CF=e=>{let t=/(?<=.)\.[a-z][a-z0-9]{0,9}$/.exec(e)?.[0]??``;return[e.slice(0,e.length-t.length),t]},wF=e=>{let t=e.split(`/`);for(let e=0;e<t.length-2;e++){let n=t[e]??``;if(!n.includes(`.`)||t[e+1]!==`src`)continue;let r=n.split(`.`);if(t.slice(e+2,e+2+r.length).join(`.`)===n&&!(e+2+r.length>=t.length)){t.splice(e+1,1+r.length);break}}return t.join(`/`)},TF=(e,t)=>{let n=wF(e).split(`/`),r=wF(t).split(`/`);for(let e=0;e<Math.min(n.length,r.length);e++){let t=n[e]??``,i=r[e]??``;if(t===i)continue;let a=e<n.length-1;if(a!==e<r.length-1)return a?-1:1;let o=t.toLowerCase().localeCompare(i.toLowerCase(),`en`);return o===0?t<i?-1:1:o}return n.length-r.length},EF=e=>e.slice(0,Math.max(e.lastIndexOf(`/`),0)),DF=e=>e.slice(e.lastIndexOf(`/`)+1),OF=e=>{let t={directories:new Map,files:[]};for(let n of e){let e=t;for(let t of wF(n).split(`/`).slice(0,-1)){let n=e.directories.get(t)??{directories:new Map,files:[]};e.directories.set(t,n),e=n}e.files.push(n)}let n=(e,t,n,r)=>{let i=e,a=t,o=n===``?e:`${n}/${e}`;for(let[e]=a.directories;a.files.length===0&&a.directories.size===1&&e!==void 0;[e]=a.directories)i=`${i}/${e[0]}`,o=`${o}/${e[0]}`,a=e[1];return{label:`${r}${i}`,path:o,inner:a}},r=(t,n,r)=>({kind:`directory`,path:n,label:t,folder:KD(n,e),children:a(r,n)}),i=e=>e.sort((e,t)=>TF(e.kind===`file`?e.path:`${e.path}/x`,t.kind===`file`?t.path:`${t.path}/x`)),a=(e,t)=>i([...[...e.directories].map(([e,i])=>{let{label:a,path:o,inner:s}=n(e,i,t,``);return r(a,o,s)}),...e.files.map(e=>({kind:`file`,path:e,name:DF(e)}))]),o=(e,t,i)=>[...e.directories].flatMap(([e,a])=>{let{label:s,path:c,inner:l}=n(e,a,t,i),u=s.slice(i.length);return l.files.length===0&&l.directories.size>1&&!u.includes(`.`)?o(l,c,`${s}/`):[r(s,c,l)]});return i([...o(t,``,``),...t.files.map(e=>({kind:`file`,path:e,name:DF(e)}))])},kF=e=>e.flatMap(e=>e.kind===`file`?[e.path]:kF(e.children)),AF={added:`new file`,modified:`modified`,deleted:`deleted`,renamed:`renamed`},jF=(e,t)=>`${e} ${t}${e===1?``:`s`}`,MF=e=>e.status===`renamed`?e.oldPath??null:null,NF=e=>{let{finding:t=0,risk:n=0}=e.points??{},r=MF(e),i=r===null?``:` from ${r}`;return[DF(e.path),`${UD(e.path,e.status).label}, ${AF[e.status]}${i}`,e.additions>0?`${jF(e.additions,`line`)} added`:``,e.deletions>0?`${jF(e.deletions,`line`)} removed`:``,(e.threads??0)>0?jF(e.threads??0,`open thread`):``,t>0?jF(t,`finding`):``,n>0?jF(n,`risk`):``,EF(e.path)===``?``:`in ${EF(e.path)}`].filter(Boolean).join(`, `)},PF=e=>{let t=AF[e.status],n=MF(e),r=n===null?``:` · was ${DF(n)}`;return`${e.path}\n${t[0]?.toUpperCase()}${t.slice(1)}${r}`},FF=({files:e,activePath:t,onSelect:n,navigate:r=!1,className:i})=>{let a=(0,q.useRef)(null),o=(0,q.useRef)(null),s=(0,q.useRef)(null),[c,l]=(0,q.useState)(``),[u,d]=(0,q.useState)(`all`),[f,p]=(0,q.useState)(new Set),[m,h]=(0,q.useState)(null),[g,_]=(0,q.useState)(t);if(g!==t){_(t);let e=t===null?null:wF(t),n=[...f].filter(t=>e?.startsWith(`${t}/`));n.length>0&&p(new Set([...f].filter(e=>!n.includes(e))))}Sk({filterTree:()=>s.current?.focus()});let v=(0,q.useMemo)(()=>new Map(e.map(e=>[e.path,e])),[e]),y=(0,q.useMemo)(()=>OF(e.map(e=>e.path)),[e]),b=e.filter(e=>(e.points?.finding??0)>0).length,x=e.filter(e=>(e.points?.risk??0)>0).length,S=(0,q.useMemo)(()=>{let t=new Set(yF(e,c).map(e=>e.path));return new Set(e.filter(e=>t.has(e.path)).filter(e=>u===`all`||(e.points?.[u]??0)>0).map(e=>e.path))},[e,c,u]),C=c.trim()!==``,w=(0,q.useMemo)(()=>{let e=[],t=e=>e.kind===`file`?Number(S.has(e.path)):e.children.reduce((e,n)=>e+t(n),0),n=(r,i)=>{for(let a of r){if(a.kind===`file`){let t=v.get(a.path);t!==void 0&&S.has(t.path)&&e.push({kind:`file`,key:t.path,file:t,depth:i});continue}let r=t(a);if(r===0)continue;let o=C||!f.has(a.path);e.push({kind:`directory`,key:`${a.path}/`,label:a.label,entry:a,depth:i,open:o,count:r}),o&&n(a.children,i+1)}};return n(y,0),e},[y,v,S,f,C]),T=(0,q.useMemo)(()=>kF(y).filter(e=>S.has(e)),[y,S]),E=(0,q.useMemo)(()=>{let e=T.filter(e=>{let{finding:t=0,risk:n=0}=v.get(e)?.points??{};return t+n>0});return new Map(e.map((e,t)=>[e,t]))},[T,v]),D=e=>{let r=t===null?-1:T.indexOf(t),i=T[Math.min(T.length-1,Math.max(0,r+e))];i!==void 0&&n(i)};Sk({nextFile:()=>D(1),previousFile:()=>D(-1)},r),(0,q.useEffect)(()=>{let e=a.current?.querySelector(`[data-slot=scroll-area-viewport]`),t=o.current?.querySelector(`[aria-selected=true]`);if(e==null||t==null)return;let n=t.getBoundingClientRect().top-e.getBoundingClientRect().top+e.scrollTop;(n<e.scrollTop||n>e.scrollTop+e.clientHeight-40)&&(e.scrollTop=Math.max(0,n-e.clientHeight/3))},[t]);let O=w.find(e=>e.key===m)?.key??w.find(e=>e.kind===`file`&&e.file.path===t)?.key??w[0]?.key,k=e=>{e!==void 0&&(h(e),o.current?.querySelector(`[data-key="${CSS.escape(e)}"]`)?.focus())},A=e=>{let t=new Set(f);t.has(e)?t.delete(e):t.add(e),p(t)},j=e=>{h(e.key),e.kind===`file`?n(e.file.path):C||A(e.entry.path)};return(0,J.jsxs)(`nav`,{ref:a,"aria-label":`Changed files`,className:X(`flex min-h-0 flex-col`,i),children:[(0,J.jsxs)(`div`,{className:`px-2.5 pt-2.5 pb-1`,children:[(0,J.jsxs)(`div`,{className:`relative`,children:[(0,J.jsx)(Wg,{"aria-hidden":`true`,className:`pointer-events-none absolute top-1/2 left-2 size-3.5 -translate-y-1/2 text-muted-foreground`}),(0,J.jsx)(EP,{ref:s,type:`text`,value:c,spellCheck:!1,autoComplete:`off`,onChange:e=>l(e.target.value),onKeyDown:e=>{e.key===`Escape`?(e.preventDefault(),l(``),e.currentTarget.blur()):e.key===`ArrowDown`&&(e.preventDefault(),k(O))},placeholder:`Filter files`,"aria-label":`Filter files by name or path`,className:`h-7.5 pl-7`})]}),(0,J.jsxs)(`div`,{className:`mt-1 flex h-7 items-center justify-between text-caption text-muted-foreground`,children:[(0,J.jsx)(`span`,{className:`tabular`,"aria-live":`polite`,children:S.size===e.length?`${e.length} files`:`${S.size} of ${e.length} files`}),(0,J.jsx)(`div`,{role:`group`,"aria-label":`Show`,className:`flex gap-px`,children:[[`all`,`All`],[`finding`,`Findings ${b}`],[`risk`,`Risks ${x}`]].map(([e,t])=>(0,J.jsx)(`button`,{type:`button`,"aria-pressed":u===e,onClick:()=>d(e),className:X(`tabular rounded-sm px-1.5 py-0.5 text-caption hover:text-foreground`,u===e&&`bg-secondary font-medium text-foreground`),children:t},e))})]})]}),w.length===0?(0,J.jsxs)(`p`,{className:`border-t px-3 py-4 text-caption text-muted-foreground`,children:[`No files match.`,` `,(0,J.jsx)(`button`,{type:`button`,onClick:()=>{l(``),d(`all`)},className:`text-primary underline`,children:`Clear filter`})]}):(0,J.jsx)(_F,{className:`min-h-0 flex-1 border-t`,children:(0,J.jsx)(`div`,{ref:o,role:`tree`,"aria-label":`Changed files`,onKeyDown:e=>{let t=w.findIndex(t=>t.key===e.target.dataset.key),n=w[t];if(n===void 0)return;let r=t=>{e.preventDefault(),k(w[Math.min(w.length-1,Math.max(0,t))]?.key)};switch(e.key){case`ArrowDown`:return r(t+1);case`ArrowUp`:if(t===0){e.preventDefault(),s.current?.focus();return}return r(t-1);case`Home`:return r(0);case`End`:return r(w.length-1);case`Enter`:case` `:return e.preventDefault(),j(n);case`ArrowRight`:n.kind===`directory`&&!n.open&&(e.preventDefault(),A(n.entry.path));return;case`ArrowLeft`:{if(n.kind===`directory`&&n.open&&!C){e.preventDefault(),A(n.entry.path);return}let i=w.slice(0,t).findLastIndex(e=>e.depth<n.depth);i>=0&&r(i);return}}},className:`pt-1 pb-4`,children:w.map(e=>e.kind===`directory`?(0,J.jsx)(RF,{row:e,tabbable:e.key===O,onActivate:()=>j(e)},e.key):(0,J.jsx)(UF,{file:e.file,depth:e.depth,active:e.file.path===t,tabbable:e.key===O,onActivate:()=>j(e),...E.has(e.file.path)?{landing:{at:E.get(e.file.path)??0,of:E.size}}:{}},e.key))})})]})},IF=`relative flex h-7 cursor-default items-center whitespace-nowrap pr-[7px] select-none hover:bg-surface-row focus-visible:outline-2 focus-visible:-outline-offset-2 focus-visible:outline-ring`,LF=e=>({paddingLeft:`${6+e*9}px`}),RF=({row:e,tabbable:t,onActivate:n})=>{let r=e.label.lastIndexOf(`/`)+1;return(0,J.jsxs)(`div`,{role:`treeitem`,"aria-level":e.depth+1,"aria-expanded":e.open,"aria-label":`${e.entry.path}, folder, ${jF(e.count,`file`)}`,title:e.entry.path,"data-key":e.key,tabIndex:t?0:-1,onClick:n,className:X(IF,`gap-[5px]`),style:LF(e.depth),children:[(0,J.jsx)(Hh,{"aria-hidden":`true`,className:X(`size-3 shrink-0 text-muted-foreground transition-transform duration-(--duration-fast) ease-standard`,e.open&&`rotate-90`)}),(0,J.jsx)(`span`,{className:`mr-px`,children:(0,J.jsx)(ZD,{kind:e.entry.folder})}),(0,J.jsxs)(`span`,{className:`min-w-0 flex-1 truncate text-caption text-muted-foreground`,children:[r>0&&(0,J.jsx)(`span`,{children:e.label.slice(0,r)}),(0,J.jsx)(`span`,{className:`font-medium text-foreground`,children:e.label.slice(r)})]}),!e.open&&(0,J.jsx)(`span`,{className:`tabular font-mono text-kbd leading-none text-muted-foreground`,children:e.count})]})},zF={added:[`text-diff-add-fg`,`text-file-ext-add`],deleted:[`text-diff-del-fg line-through decoration-1`,`text-file-ext-del line-through decoration-1`],modified:[``,`text-muted-foreground`],renamed:[``,`text-muted-foreground`]},BF,VF=(e,t)=>{if(BF??=document.createElement(`canvas`).getContext(`2d`),BF===null)return null;let n=getComputedStyle(e);return BF.font=`${n.fontStyle} ${n.fontWeight} ${n.fontSize} ${n.fontFamily}`,BF.letterSpacing=n.letterSpacing===`normal`?`0px`:n.letterSpacing,BF.measureText(t).width},HF=({file:e})=>{let t=(0,q.useRef)(null),[n,r]=CF(DF(e.path)),[i,a]=(0,q.useState)(n);(0,q.useLayoutEffect)(()=>{let e=t.current;if(e===null)return;let i=()=>{let t=e.clientWidth,i=e.firstElementChild,o=e.lastElementChild;if(t===0||i===null||o===null)return;let s=VF(o,r);s!==null&&a(SF(n,e=>(VF(i,e)??0)+s<=t+.5))};if(i(),document.fonts?.ready.then(i),typeof ResizeObserver>`u`)return;let o=new ResizeObserver(i);return o.observe(e),()=>o.disconnect()},[n,r]);let[o,s]=zF[e.status];return(0,J.jsxs)(`span`,{ref:t,"data-slot":`file-name`,className:`min-w-0 flex-1 basis-0 truncate text-ui font-[450] tracking-[-0.012em]`,children:[(0,J.jsx)(`span`,{"data-slot":`file-stem`,className:o,children:i}),(0,J.jsx)(`span`,{"data-slot":`file-extension`,className:X(`font-normal`,s),children:r})]})},UF=({file:e,depth:t,active:n,tabbable:r,landing:i,onActivate:a})=>{let{finding:o=0,risk:s=0}=e.points??{},c=e.threads??0;return(0,J.jsxs)(`div`,{role:`treeitem`,"aria-level":t+1,"aria-selected":n,"aria-label":NF(e),title:PF(e),"data-key":e.path,"data-status":e.status,tabIndex:r?0:-1,onClick:a,className:X(IF,`gap-1.5`,n&&`bg-diff-hunk-bg before:absolute before:top-1 before:bottom-1 before:left-0 before:w-0.5 before:rounded-full before:bg-primary hover:bg-diff-hunk-bg`),style:LF(t),children:[(0,J.jsx)(XD,{path:e.path,status:e.status}),(0,J.jsx)(HF,{file:e}),(0,J.jsxs)(`span`,{"aria-hidden":`true`,className:`tabular flex flex-none items-center gap-1.5 font-mono text-kbd leading-none tracking-[-0.02em] text-muted-foreground`,children:[c>0&&(0,J.jsxs)(`span`,{"data-slot":`thread-count`,className:`inline-flex items-center gap-[2.5px]`,children:[(0,J.jsx)(Mg,{className:`size-3`,strokeWidth:1.75}),c]}),o+s>0&&(0,J.jsxs)(`span`,{"data-land":`drop`,style:vh({"--landing-i":i?.at??0,"--landing-n":i?.of??1}),className:`inline-flex items-center gap-1.5`,children:[o>0&&(0,J.jsxs)(`span`,{"data-slot":`point-count`,"data-kind":`finding`,className:`inline-flex items-center gap-[2.5px]`,children:[(0,J.jsx)(`i`,{className:`size-1.5 rounded-full bg-severity-minor`}),o>1&&o]}),s>0&&(0,J.jsx)(`span`,{"data-slot":`point-count`,"data-kind":`risk`,className:`inline-flex items-center`,children:(0,J.jsx)(`i`,{className:`size-[7px] rounded-full ring-[1.5px] ring-risk-logic ring-inset`})})]}),(e.additions>0||e.deletions>0)&&(0,J.jsxs)(`span`,{className:`inline-flex items-center gap-[5px]`,children:[e.additions>0&&(0,J.jsxs)(`span`,{className:`text-stat-add`,children:[`+`,e.additions]}),e.deletions>0&&(0,J.jsxs)(`span`,{className:`text-stat-del`,children:[`−`,e.deletions]})]})]})]})},WF=({count:e})=>(0,J.jsxs)(`span`,{"data-slot":`thread-count`,className:`tabular inline-flex items-center gap-0.5 text-caption`,children:[(0,J.jsx)(Mg,{"aria-hidden":`true`,className:`size-3`}),e,(0,J.jsxs)(`span`,{className:`sr-only`,children:[` open `,e===1?`thread`:`threads`]})]}),GF=60,KF=3600,qF=24*KF,JF=(e,t)=>{let n=Math.max(0,Math.round((t-Date.parse(e))/1e3));if(n<GF)return`just now`;if(n<KF)return`${Math.floor(n/GF)} min ago`;if(n<qF)return`${Math.floor(n/KF)} h ago`;let r=Math.floor(n/qF);if(r===1)return`yesterday`;if(r<7)return`${r} days ago`;let i=(e,t)=>`${e} ${t}${e===1?``:`s`} ago`;return r<30?i(Math.floor(r/7),`week`):r<365?i(Math.floor(r/30),`month`):i(Math.floor(r/365),`year`)},YF=e=>new Date(e).toLocaleString(`en`,{dateStyle:`full`,timeStyle:`short`}),XF={github:`GitHub`,bitbucket:`Bitbucket`},ZF=({repo:e,number:t})=>`${e.owner}/${e.repo} #${t}`,QF=[`bg-avatar-1-bg text-avatar-1-fg`,`bg-avatar-2-bg text-avatar-2-fg`,`bg-avatar-3-bg text-avatar-3-fg`,`bg-avatar-4-bg text-avatar-4-fg`,`bg-avatar-5-bg text-avatar-5-fg`,`bg-avatar-6-bg text-avatar-6-fg`,`bg-avatar-7-bg text-avatar-7-fg`,`bg-avatar-8-bg text-avatar-8-fg`],$F=e=>{let t=0;for(let n of e)t=t*31+(n.codePointAt(0)??0)>>>0;return QF[t%QF.length]??QF[0]},eI=`animate-spin motion-reduce:animate-[spin_3s_linear_infinite]`,tI=(e,t)=>{let n=e.role===`author`?`you`:e.author.name;return`${e.title}. ${ZF(e.ref)} by ${n}, updated ${JF(e.updatedAt,t)}, ${XF[e.ref.repo.host]}`},nI=({item:e,nowMs:t,starting:n,tabbable:r,onOpen:i,onFocus:a})=>{let o=XF[e.ref.repo.host],s=e.role===`author`?`you`:e.author.name;return(0,J.jsx)(`li`,{children:(0,J.jsxs)(`a`,{href:u_(e.ref),"data-pr-row":``,tabIndex:r?0:-1,"aria-label":tI(e,t),"aria-busy":n,onClick:e=>{g_(e)&&(e.preventDefault(),n||i())},onFocus:a,className:`group flex min-h-[58px] w-full flex-col items-stretch gap-x-3 gap-y-1 px-4 py-2 text-left text-foreground hover:bg-accent hover:no-underline focus-visible:bg-accent focus-visible:-outline-offset-2 aria-busy:bg-diff-hunk-bg max-sm:items-start sm:flex-row sm:items-center`,children:[(0,J.jsxs)(`span`,{className:`flex min-w-0 flex-1 flex-col gap-1 self-stretch`,children:[(0,J.jsx)(`span`,{className:`truncate font-medium`,children:e.title}),(0,J.jsxs)(`span`,{className:`flex min-w-0 items-center gap-x-1.5 text-caption text-muted-foreground`,children:[(0,J.jsxs)(`span`,{className:`flex min-w-0 gap-[1ch] font-mono text-code-compact`,children:[(0,J.jsxs)(`span`,{className:`min-w-0 truncate`,children:[e.ref.repo.owner,`/`,e.ref.repo.repo]}),(0,J.jsxs)(`span`,{className:`shrink-0`,children:[`#`,e.ref.number]})]}),(0,J.jsx)(`span`,{"aria-hidden":`true`,className:X(`flex size-5 shrink-0 items-center justify-center rounded-full text-[10px] font-medium`,$F(e.author.id)),children:kk(e.author.name)}),(0,J.jsx)(`span`,{className:`max-w-32 shrink-0 truncate`,children:s}),(0,J.jsx)(`time`,{dateTime:e.updatedAt,title:YF(e.updatedAt),className:`shrink-0 whitespace-nowrap`,children:JF(e.updatedAt,t)}),(0,J.jsx)(aO,{variant:`outline`,className:`ml-auto shrink-0 text-muted-foreground @min-[480px]:hidden`,children:o})]})]}),n?(0,J.jsxs)(`span`,{className:`flex shrink-0 items-center gap-2 text-caption`,children:[(0,J.jsx)(Og,{"aria-hidden":`true`,className:X(`size-4 text-diff-hunk-fg`,eI)}),(0,J.jsx)(`span`,{className:`font-medium text-diff-hunk-fg`,children:`Opening review…`}),(0,J.jsx)(`span`,{className:`text-muted-foreground`,children:`Esc to cancel`})]}):(0,J.jsxs)(`span`,{className:`flex shrink-0 items-center gap-2 @max-[479px]:hidden`,children:[(0,J.jsx)(aO,{variant:`outline`,className:`text-muted-foreground @max-[479px]:hidden`,children:o}),(0,J.jsx)(Tk,{id:`openRow`,className:`hidden group-focus-visible:inline-flex`}),(0,J.jsx)(Hh,{"aria-hidden":`true`,className:`size-4 text-muted-foreground opacity-0 group-hover:opacity-100 group-focus-visible:opacity-100 max-sm:hidden`})]})]})})},rI={ArrowDown:(e,t)=>Math.min(t,e+1),ArrowUp:e=>Math.max(0,e-1),Home:()=>0,End:(e,t)=>t},iI=({title:e,word:t,items:n,count:r,loading:i,skeletonRows:a,notes:o,blocked:s,empty:c,nowMs:l,startingUrl:u,onOpen:d})=>{let f=(0,q.useId)(),p=(0,q.useRef)(null),[m,h]=(0,q.useState)(0),g=n??[],_=Math.min(m,Math.max(0,g.length-1)),v=e=>{let t=rI[e.key],n=[...p.current?.querySelectorAll(`[data-pr-row]`)??[]],r=e.target instanceof HTMLElement?n.indexOf(e.target):-1;if(t===void 0||r===-1)return;e.preventDefault();let i=t(r,n.length-1);h(i),n[i]?.focus()},y=c.icon;return(0,J.jsxs)(`section`,{"aria-labelledby":f,className:`@container flex min-w-0 flex-col overflow-hidden rounded-xl border bg-card`,children:[(0,J.jsxs)(`div`,{className:`flex min-h-11 flex-wrap items-center gap-x-2 gap-y-1 border-b px-4 py-2`,children:[(0,J.jsx)(`h2`,{id:f,className:`text-heading font-semibold`,children:e}),r!==null&&(0,J.jsxs)(`span`,{className:`rounded-full bg-muted px-2 text-caption font-medium text-muted-foreground tabular-nums`,children:[(0,J.jsx)(`span`,{"aria-hidden":`true`,children:r}),(0,J.jsx)(`span`,{className:`sr-only`,children:r===`…`?`Loading`:`${r} pull request${r===1?``:`s`}`})]}),(0,J.jsx)(`span`,{className:`text-caption text-muted-foreground`,children:t})]}),(0,J.jsx)(`div`,{className:`flex flex-col gap-2 p-3 empty:hidden`,children:o}),s??(n===null?(0,J.jsxs)(`div`,{"aria-busy":`true`,className:`flex flex-col`,children:[(0,J.jsxs)(`p`,{className:`flex items-center gap-2 px-4 pt-3 text-caption text-muted-foreground`,children:[(0,J.jsx)(Og,{"aria-hidden":`true`,className:X(`size-4`,`animate-spin motion-reduce:animate-[spin_3s_linear_infinite]`)}),i]}),(0,J.jsx)(`ul`,{"aria-hidden":`true`,className:`flex flex-col gap-3 px-4 py-3`,children:Array.from({length:a},(e,t)=>(0,J.jsxs)(`li`,{className:`flex flex-col gap-1.5`,children:[(0,J.jsx)(dP,{className:`h-4 w-3/4 motion-reduce:animate-none`}),(0,J.jsx)(dP,{className:`h-3 w-1/2 motion-reduce:animate-none`})]},t))})]}):g.length===0?(0,J.jsxs)(`div`,{className:`flex flex-col items-center gap-1 px-6 py-8 text-center`,children:[(0,J.jsx)(y,{"aria-hidden":`true`,className:`mb-1 size-6 text-muted-foreground`}),(0,J.jsx)(`p`,{className:`font-medium`,children:c.title}),(0,J.jsx)(`p`,{className:`max-w-sm text-caption text-muted-foreground`,children:c.text})]}):(0,J.jsx)(`ul`,{ref:p,className:`divide-y`,onKeyDown:v,children:g.map((e,t)=>(0,J.jsx)(nI,{item:e,nowMs:l,starting:u===e.url,tabbable:t===_,onOpen:()=>d(e),onFocus:()=>h(t)},e.url))}))]})},aI=Tc.options,oI=`flex flex-wrap items-baseline gap-x-2 gap-y-1 text-caption`,sI=`h-6 min-w-6 px-1 text-caption`,cI=e=>e.map(e=>XF[e]).join(` and `),lI=(e,t)=>{let n=e===null?[]:aI.filter(t=>e.hosts[t].configured),r=n.filter(t=>e?.hosts[t].error!=null),i=(t?.errors??[]).filter(e=>!r.includes(e.host));return{configured:n,failing:r,listFailed:i,shown:n.filter(e=>!r.includes(e)&&!i.some(t=>t.host===e))}},uI=(e,t)=>(0,J.jsxs)(`div`,{className:`flex flex-col items-center gap-2 px-6 py-8 text-center text-caption text-muted-foreground`,children:[(0,J.jsx)(`p`,{children:e}),t]}),dI=({status:e,list:t,error:n,rowFailure:r,startingUrl:i,nowMs:a,onOpen:o,onRetry:s,onOpenConnections:c,onFix:l})=>{let u=lI(e,t),d=e!==null&&u.configured.length===0,f=t!==null&&u.configured.length>0&&u.shown.length===0,p=u.configured.length>1&&u.shown.length===1&&u.shown[0]!==void 0?`${XF[u.shown[0]]} only`:null,m=e=>n===null?null:(0,J.jsxs)(`p`,{className:X(lP,oI),role:`alert`,children:[(0,J.jsx)(`span`,{className:`font-medium`,children:`Couldn't list pull requests.`}),(0,J.jsx)(`span`,{children:Ap(n)}),e&&(0,J.jsx)($,{variant:`link`,className:`h-6 min-w-6 px-1 text-caption`,onClick:s,children:`Retry`})]}),h=e=>r?.role===e?(0,J.jsxs)(`p`,{className:X(lP,oI),role:`alert`,children:[(0,J.jsx)(`span`,{children:r.message}),(0,J.jsx)($,{variant:`link`,className:sI,onClick:r.onRetry,children:`Try again`})]}):null,g=u.failing.map(e=>(0,J.jsxs)(`p`,{className:X(uP,oI),role:`status`,children:[(0,J.jsxs)(`span`,{children:[XF[e],` pull requests are hidden until `,XF[e],` works again.`]}),(0,J.jsx)($,{variant:`link`,className:sI,onClick:l,children:`Fix…`})]},e)),_=u.listFailed.map(e=>(0,J.jsxs)(`p`,{className:X(lP,oI),role:`alert`,children:[(0,J.jsxs)(`span`,{className:`font-medium`,children:[`Couldn't load `,XF[e.host],` pull requests.`]}),(0,J.jsx)(`span`,{children:e.message}),u.shown.length>0&&(0,J.jsxs)(`span`,{children:[cI(u.shown),` pull requests are shown.`]}),(0,J.jsx)($,{variant:`link`,className:sI,onClick:s,children:`Retry`})]},e.host)),v=u.configured.length===0?`Loading`:`Loading from ${cI(u.configured)}`,y=t?.items.filter(e=>e.role===`reviewer`)??null,b=t?.items.filter(e=>e.role===`author`)??null,x=e=>e===null?n===null?`…`:null:f?null:e.length;return(0,J.jsxs)(`div`,{className:`grid items-start gap-4 lg:grid-cols-[1.55fr_1fr]`,children:[(0,J.jsx)(iI,{title:`To review`,word:p??`Waiting for your review`,items:y,count:x(y),loading:v,skeletonRows:5,notes:(0,J.jsxs)(J.Fragment,{children:[t!==null&&m(!0),g,_,h(`reviewer`)]}),blocked:d?uI(`Connect GitHub or Bitbucket to list pull requests.`,(0,J.jsx)($,{variant:`outline`,size:`sm`,onClick:c,children:`Open Connections`})):t===null&&n!==null?m(!0):!f&&void 0,empty:{icon:vg,title:`Nothing is waiting for you`,text:`When someone asks for your review on GitHub or Bitbucket, it appears here. To review something else, paste its link above.`},nowMs:a,startingUrl:i,onOpen:o}),(0,J.jsx)(iI,{title:`Your pull requests`,word:p??`Open`,items:b,count:x(b),loading:`Loading`,skeletonRows:3,notes:(0,J.jsxs)(J.Fragment,{children:[t!==null&&m(!1),h(`author`)]}),blocked:d?uI(`Connect GitHub or Bitbucket to list pull requests.`):t===null&&n!==null?m(!1):f?uI(`Couldn't load pull requests.`):void 0,empty:{icon:mg,title:`No open pull requests`,text:`Pull requests you open on GitHub or Bitbucket appear here.`},nowMs:a,startingUrl:i,onOpen:o})]})},fI=(0,q.createContext)(null),pI=()=>{let e=(0,q.useContext)(fI);if(e===null)throw Error(`useConnections needs a ConnectionsProvider`);return e},mI=({children:e,now:t=Date.now})=>{let{status:n,error:r,loading:i,refresh:a}=Sp(),[o,s]=(0,q.useState)(null),[c,l]=(0,q.useState)(null),[u,d]=(0,q.useState)(0),[f,p]=(0,q.useState)(!1),[m,h]=(0,q.useState)(!1);(0,q.useEffect)(()=>{!i&&n!==null&&s(t())},[i,n,t]);let g=(0,q.useCallback)(()=>{a(),d(e=>e+1)},[a]),_=(0,q.useCallback)((e,t)=>{h(e&&t?.focusCheckAgain===!0),p(e)},[]),v=(0,q.useMemo)(()=>({status:n,error:r,checking:i,checkedAtMs:o,listed:c,reportListed:l,checkAgain:g,checks:u,open:f,setOpen:_,focusCheckAgain:m}),[n,r,i,o,c,g,u,f,_,m]);return(0,J.jsx)(fI.Provider,{value:v,children:e})},hI=({pullRequest:e,error:t})=>{let{setOpen:n}=pI(),r=`Couldn't open ${ZF(e)}: `;return t.code===`host-not-configured`?(0,J.jsxs)(J.Fragment,{children:[r,XF[e.repo.host],` isn't configured.`,` `,(0,J.jsx)($,{variant:`link`,className:sI,onClick:()=>n(!0),children:`Open Connections`})]}):(0,J.jsx)(J.Fragment,{children:`${r}${Ap(t)}`})},gI=({pullRequest:e})=>{let{client:t}=yp(),[n,r]=(0,q.useState)(0),[i,a]=(0,q.useState)(null),o=ZF(e),s=(0,q.useRef)(0);return(0,q.useEffect)(()=>(s.current=n,t.startAnalysis({url:hf(e)}).then(e=>{s.current===n&&(e.ok?h_(d_(e.value.analysisId)):a(e.error))}),()=>{s.current=-1}),[t,e,n]),(0,J.jsxs)(`div`,{className:`mx-auto flex max-w-2xl flex-col gap-3 py-12`,children:[(0,J.jsx)(`h1`,{className:`text-title font-semibold tracking-[-0.01em]`,children:o}),(0,J.jsx)(`p`,{role:`status`,className:`flex flex-wrap items-center gap-x-2 gap-y-1 text-body`,children:i===null?(0,J.jsxs)(J.Fragment,{children:[(0,J.jsxs)(`span`,{className:`flex items-center gap-1.5 text-muted-foreground`,children:[(0,J.jsx)(Og,{"aria-hidden":`true`,className:X(`size-4`,eI)}),`Fetching `,o,` from `,XF[e.repo.host],`…`]}),(0,J.jsx)($,{variant:`link`,className:sI,onClick:()=>{s.current=-1,h_(`/`)},children:`Cancel`})]}):(0,J.jsxs)(J.Fragment,{children:[(0,J.jsxs)(`span`,{className:`text-destructive`,children:[(0,J.jsx)(n_,{"aria-hidden":`true`,className:`mr-1 inline size-4 align-[-3px]`}),(0,J.jsx)(hI,{pullRequest:e,error:i})]}),(0,J.jsx)($,{variant:`link`,className:sI,onClick:()=>{a(null),r(e=>e+1)},children:`Try again`})]})}),i!==null&&(0,J.jsx)(`p`,{className:`text-body`,children:(0,J.jsx)(__,{to:`/`,children:`Go to your pull requests`})})]})},_I=q.createContext(void 0);function vI(e){let t=q.useContext(_I);if(t===void 0&&!e)throw Error(fv(72));return t}var yI={...sw,disabled:e=>e.disabled,instantType:e=>e.instantType,isInstantPhase:e=>e.isInstantPhase,trackCursorAxis:e=>e.trackCursorAxis,disableHoverablePopup:e=>e.disableHoverablePopup,lastOpenChangeReason:e=>e.openChangeReason,closeOnClick:e=>e.closeOnClick,appliedTriggerProps:(e,t)=>t?e.activeTriggerProps:void 0,closeDelay:e=>e.closeDelay,adaptiveOrigin:e=>e.adaptiveOrigin},bI=class extends QC{constructor(e,t,n){let r=new zC;super(SI(e,r,t,n),CI(r),yI)}setOpen=(e,t)=>{NC(this,e,t,{extraState:{openChangeReason:t.reason}})};cancelPendingOpen(e){this.state.floatingRootContext.dispatchOpenChange(!1,mb(_b,e))}};function xI(){let e=new zC,t=new VT(Object.freeze(SI(void 0,e)),Object.freeze(CI(e)),yI);return Object.assign(t,{setOpen:Av,cancelPendingOpen:Av})}function SI(e,t,n,r=!1){return{...tw(t,n,r),disabled:!1,instantType:void 0,isInstantPhase:!1,trackCursorAxis:`none`,disableHoverablePopup:!1,openChangeReason:null,closeOnClick:!0,closeDelay:0,adaptiveOrigin:void 0,...e}}function CI(e){return{popupRef:q.createRef(),onOpenChange:void 0,onOpenChangeComplete:void 0,triggerElements:e}}var wI=Qv(function(e){let{disabled:t=!1,defaultOpen:n=!1,open:r,disableHoverablePopup:i=!1,trackCursorAxis:a=`none`,actionsRef:o,onOpenChange:s,onOpenChangeComplete:c,handle:l,triggerId:u,defaultTriggerId:d=null,children:f}=e,p=DC((e,t)=>new bI({open:n,openProp:r,activeTriggerId:d,triggerIdProp:u},e,t));p.useControlledProp(`openProp`,r),p.useControlledProp(`triggerIdProp`,u),p.useContextCallback(`onOpenChange`,s),p.useContextCallback(`onOpenChangeComplete`,c);let m=p.useState(`open`),h=!t&&m,g=p.useState(`activeTriggerId`),_=p.useState(`mounted`),v=p.useState(`payload`);p.useSyncedValues({trackCursorAxis:a,disableHoverablePopup:i,disabled:t}),FC(p,{closeOnActiveTriggerUnmount:!0});let{forceUnmount:y,transitionStatus:b}=IC(h,p),x=p.useState(`isInstantPhase`),S=p.useState(`instantType`),C=p.useState(`lastOpenChangeReason`),w=q.useRef(null);Q(()=>{m&&t&&p.setOpen(!1,mb(Ab))},[m,t,p]),Q(()=>{b===`ending`&&C===`none`||b!==`ending`&&x?(S!==`delay`&&(w.current=S),p.set(`instantType`,`delay`)):w.current!==null&&(p.set(`instantType`,w.current),w.current=null)},[b,x,C,S,p]),Q(()=>{h&&(g??p.set(`payload`,void 0))},[p,g,h]),q.useImperativeHandle(o,()=>({unmount:y,close:()=>p.setOpen(!1,mb(Nb))}),[y,p]);let T=h||_||!t&&a!==`none`;return(0,J.jsxs)(_I.Provider,{value:p,children:[l&&(0,J.jsx)(OC,{handle:l,store:p}),T&&(0,J.jsx)(TI,{store:p,disabled:t,trackCursorAxis:a}),typeof f==`function`?f({payload:v}):f]})});function TI({store:e,disabled:t,trackCursorAxis:n}){let r=e.useState(`floatingRootContext`),i=iC(r,{enabled:!t,referencePress:()=>e.select(`closeOnClick`)}),a=tC(r,{enabled:!t&&n!==`none`,axis:n===`none`?void 0:n}),o=q.useMemo(()=>Q_(a.reference,i.reference),[a.reference,i.reference]);return LC(e,{activeTriggerProps:o,inactiveTriggerProps:o,popupProps:i.floating??Mv}),null}var EI=q.createContext(void 0);function DI(){return q.useContext(EI)}var OI=`data-base-ui-tooltip-trigger`;function kI(e){let t=Oy(e);return C_(t)?t:null}var AI=$v(function(e,t){let{render:n,className:r,style:i,handle:a,payload:o,disabled:s,delay:c,closeOnClick:l=!0,closeDelay:u,id:d,...f}=e,p=vI(!0),m=cw(a)??p;if(!m)throw Error(fv(82));let h=eE(d),g=m.useState(`isTriggerActive`,h),_=m.useState(`isOpenedByTrigger`,h),v=m.useState(`floatingRootContext`),y=q.useRef(null),b=u??0,{registerTrigger:x,isMountedByThisTrigger:S}=PC(h,y,m,{payload:o,closeOnClick:l,closeDelay:b}),C=DI(),{activeIdRef:w,delayRef:T,isInstantPhase:E,hasProvider:D}=Rb(v,{open:_}),O=gw(v);m.useSyncedValue(`isInstantPhase`,E);let k=m.useState(`disabled`),A=s??k,j=Vb(A),M=m.useState(`trackCursorAxis`),N=m.useState(`disableHoverablePopup`),P=q.useRef(!1),F=iy(),I=q.useRef(void 0);function L(){return D&&w.current!=null?0:c??C??600}function R(e){let t=y.current;if(!t||!e)return!1;let n=Dy(e,`[${OI}]`);return n!==null&&n!==t&&Ey(t,n)}function ee(e){let t=R(e);return P.current=t,t&&(O.openChangeTimeout.clear(),O.restTimeout.clear(),O.restTimeoutPending=!1,F.clear()),t}let z=yw(v,{enabled:!A,mouseOnly:!0,move:!1,handleClose:!N&&M!==`both`?Fw():null,restMs:L,delay(){return u==null&&D?{close:ub(T.current,`close`)}:{close:b}},triggerElementRef:y,isActiveTrigger:g,isClosing:()=>m.select(`transitionStatus`)===`ending`,shouldOpen(){return!P.current}}),te=dw(v,{enabled:!A}).reference,B=e=>{let t=P.current,n=kI(e),r=ee(n),i=y.current,a=i&&n&&Ey(i,n);if(r&&m.select(`open`)&&m.select(`lastOpenChangeReason`)===`trigger-hover`)m.setOpen(!1,mb(vb,e));else if(t&&!r&&a&&!j.current&&!m.select(`open`)&&i&&Cy(I.current)){let t=()=>{!P.current&&!j.current&&!m.select(`open`)&&m.setOpen(!0,mb(vb,e,i))},n=L();n===0?(F.clear(),t()):F.start(n,t)}},ne=m.useState(`appliedTriggerProps`,S||M!==`none`);return Iv(`button`,e,{state:{open:_},ref:[t,x,y],props:[z,te,ne,{onMouseOver(e){B(e.nativeEvent)},onFocus(e){R(kI(e.nativeEvent))&&e.preventBaseUIHandler()},onMouseLeave(){P.current=!1,F.clear(),I.current=void 0},onPointerEnter(e){I.current=e.pointerType},onPointerDown(e){I.current=e.pointerType,m.set(`closeOnClick`,l),l&&!m.select(`open`)&&m.cancelPendingOpen(e.nativeEvent)},onClick(e){l&&!m.select(`open`)&&m.cancelPendingOpen(e.nativeEvent)},id:h,[eb]:A?``:void 0,[OI]:A?void 0:``},f],stateAttributesMapping:Xy})}),jI=q.createContext(void 0);function MI(){let e=q.useContext(jI);if(e===void 0)throw Error(fv(70));return e}var NI=q.forwardRef(function(e,t){let{keepMounted:n=!1,...r}=e;return vI().useState(`mounted`)||n?(0,J.jsx)(jI.Provider,{value:n,children:(0,J.jsx)(QT,{ref:t,...r})}):null}),PI=q.createContext(void 0);function FI(){let e=q.useContext(PI);if(e===void 0)throw Error(fv(71));return e}var II=q.forwardRef(function(e,t){let{render:n,className:r,anchor:i,positionMethod:a=`absolute`,side:o=`top`,align:s=`center`,sideOffset:c=0,alignOffset:l=0,collisionBoundary:u=`clipping-ancestors`,collisionPadding:d=5,arrowPadding:f=5,sticky:p=!1,disableAnchorTracking:m=!1,collisionAvoidance:h=TS,style:g,..._}=e,v=vI(),y=MI(),b=v.useState(`open`),x=v.useState(`mounted`),S=v.useState(`trackCursorAxis`),C=v.useState(`disableHoverablePopup`),w=v.useState(`floatingRootContext`),T=v.useState(`instantType`),E=v.useState(`transitionStatus`),D=bE({anchor:i,positionMethod:a,floatingRootContext:w,mounted:x,side:o,sideOffset:c,align:s,alignOffset:l,collisionBoundary:u,collisionPadding:d,sticky:p,arrowPadding:f,disableAnchorTracking:m,keepMounted:y,collisionAvoidance:h,adaptiveOrigin:v.useState(`adaptiveOrigin`)}),O=wE(e,q.useMemo(()=>({open:b,side:D.side,align:D.align,anchorHidden:D.anchorHidden,instant:S===`none`?T:`tracking-cursor`}),[b,D.side,D.align,D.anchorHidden,S,T]),{styles:D.positionerStyles,transitionStatus:E,props:_,refs:[t,v.useStateSetter(`positionerElement`)],hidden:!x,inert:!b||S===`both`||C});return(0,J.jsx)(PI.Provider,{value:D,children:O})}),LI=q.forwardRef(function(e,t){let{render:n,className:r,style:i,...a}=e,o=vI(),{side:s,align:c}=FI(),l=o.useState(`open`),u=o.useState(`instantType`),d=o.useState(`transitionStatus`),f=o.useState(`popupProps`),p=o.useState(`floatingRootContext`),m=o.useState(`disabled`),h=o.useState(`closeDelay`);CC({open:l,ref:o.context.popupRef,onComplete(){l&&o.context.onOpenChangeComplete?.(!0)}}),_w(p,{enabled:!m,closeDelay:h});let g=o.useStateSetter(`popupElement`);return Iv(`div`,e,{state:{open:l,side:s,align:c,instant:u,transitionStatus:d},ref:[t,o.context.popupRef,g],props:[TC,f,CE(d),a],stateAttributesMapping:$y})}),RI=q.forwardRef(function(e,t){let{render:n,className:r,style:i,...a}=e,o=vI(),{arrowRef:s,side:c,align:l,arrowUncentered:u,arrowStyles:d}=FI();return Iv(`div`,e,{state:{open:o.useState(`open`),side:c,align:l,uncentered:u,instant:o.useState(`instantType`)},ref:[t,s],props:[{style:d,"aria-hidden":!0},a],stateAttributesMapping:Qy})}),zI=function(e){let{delay:t,closeDelay:n,timeout:r=400}=e,i=q.useMemo(()=>({open:t,close:n}),[t,n]);return(0,J.jsx)(EI.Provider,{value:t,children:(0,J.jsx)(Lb,{delay:i,timeoutMs:r,children:e.children})})},BI=class extends gC{constructor(){super(xI(),`Tooltip`)}open(e){this.openByTrigger(e)}close(){this.closePopup()}get isOpen(){return this.attachedStore?.select(`open`)??!1}};function VI(){return new BI}function HI({delay:e=0,...t}){return(0,J.jsx)(zI,{"data-slot":`tooltip-provider`,delay:e,...t})}function UI({...e}){return(0,J.jsx)(wI,{"data-slot":`tooltip`,...e})}function WI({...e}){return(0,J.jsx)(AI,{"data-slot":`tooltip-trigger`,...e})}function GI({className:e,side:t=`top`,sideOffset:n=4,align:r=`center`,alignOffset:i=0,collisionBoundary:a,children:o,shortcut:s,...c}){return(0,J.jsx)(NI,{children:(0,J.jsx)(II,{collisionBoundary:a,align:r,alignOffset:i,side:t,sideOffset:n,className:`isolate z-50`,children:(0,J.jsxs)(LI,{"data-slot":`tooltip-content`,className:X(`z-50 inline-flex w-fit max-w-xs origin-(--transform-origin) items-center gap-1.5 rounded-md bg-foreground px-3 py-1.5 text-caption text-background has-data-[slot=kbd]:pr-1.5 data-[side=bottom]:slide-in-from-top-2 data-[side=inline-end]:slide-in-from-left-2 data-[side=inline-start]:slide-in-from-right-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 **:data-[slot=kbd]:relative **:data-[slot=kbd]:isolate **:data-[slot=kbd]:z-50 **:data-[slot=kbd]:rounded-sm data-[state=delayed-open]:animate-in data-[state=delayed-open]:fade-in-0 data-[state=delayed-open]:zoom-in-95 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95`,e),...c,children:[o,s!==void 0&&(0,J.jsx)(Ck,{children:s}),(0,J.jsx)(RI,{className:`z-50 size-2.5 translate-y-[calc(-50%-2px)] rotate-45 rounded-[2px] bg-foreground fill-foreground data-[side=bottom]:top-1 data-[side=inline-end]:top-1/2! data-[side=inline-end]:-left-1 data-[side=inline-end]:-translate-y-1/2 data-[side=inline-start]:top-1/2! data-[side=inline-start]:-right-1 data-[side=inline-start]:-translate-y-1/2 data-[side=left]:top-1/2! data-[side=left]:-right-1 data-[side=left]:-translate-y-1/2 data-[side=right]:top-1/2! data-[side=right]:-left-1 data-[side=right]:-translate-y-1/2 data-[side=top]:-bottom-2.5`})]})})})}var KI=e=>{if(e===null)return 26;let t=e>=900?e-260-32:e,n=Math.floor((t-32)/24);return Math.min(26,Math.max(8,n))},qI=e=>String(e).padStart(2,`0`),JI=e=>{let t=new Date(e);return`${t.getFullYear()}-${qI(t.getMonth()+1)}-${qI(t.getDate())}`},YI=e=>new Date(`${e}T00:00:00Z`),XI=e=>YI(e).toLocaleDateString(`en`,{month:`short`,day:`numeric`,timeZone:`UTC`}),ZI=e=>YI(e).toLocaleDateString(`en`,{weekday:`short`,month:`short`,day:`numeric`,timeZone:`UTC`}),QI=e=>YI(e).toLocaleDateString(`en`,{month:`short`,timeZone:`UTC`}),$I=e=>Number(e.slice(8,10)),eL=e=>{let t=Math.ceil(e.length/7);return Array.from({length:t},(t,n)=>{let r=e.slice(n*7,n*7+7),i=r.find(e=>$I(e.date)===1);if(i!==void 0)return QI(i.date);let a=r[0];return n===0&&a!==void 0&&$I(a.date)<=7?QI(a.date):null})},tL=e=>e===1?`1 PR`:`${e} PRs`,nL=e=>e===1?`1 comment`:`${e} comments`,rL=e=>`${e.pullRequests===0?`No PRs`:tL(e.pullRequests)} reviewed · ${nL(e.comments)}`,iL=(e,t)=>`${XI(e.date)}: ${e.pullRequests===0?`No PRs`:tL(e.pullRequests)} reviewed, ${nL(e.comments)}${e.date===t?` (today)`:``}`,aL=e=>`Busiest day: ${XI(e.date)}, ${tL(e.pullRequests)} and ${nL(e.comments)}.`,oL=(e,t,n)=>{let r={ArrowLeft:t-7,ArrowRight:t+7,ArrowUp:t-1,ArrowDown:t+1,Home:0,End:n}[e];return r===void 0||r<0||r>n?null:r},sL=e=>Ic(e),cL={0:`border-input bg-card`,1:`border-primary bg-activity-1`,2:`border-primary bg-activity-2`,3:`border-primary bg-activity-3`,4:`border-primary bg-primary`},lL=[{level:0,label:`0`},{level:1,label:`1`},{level:2,label:`2`},{level:3,label:`3–4`},{level:4,label:`5+`}],uL=[``,`Mon`,``,`Wed`,``,`Fri`,``],dL=({level:e,className:t})=>(0,J.jsx)(`span`,{className:X(`flex items-center justify-center rounded-[4px] border`,cL[e],t),children:e===4&&(0,J.jsx)(`span`,{className:`size-1.5 rounded-full bg-primary-foreground`})}),fL=e=>{let[t,n]=(0,q.useState)(null);return(0,q.useLayoutEffect)(()=>{let t=e.current;if(t===null)return;let r=t.getBoundingClientRect().width;if(r>0&&n(r),typeof ResizeObserver>`u`)return;let i=new ResizeObserver(([e])=>{e!==void 0&&n(e.contentRect.width)});return i.observe(t),()=>i.disconnect()},[e]),t},pL=VI(),mL=({days:e,today:t,weeks:n})=>{let[r,i]=(0,q.useState)(t),a=(0,q.useRef)(new Map),o=(0,q.useRef)(null),s=e.some(e=>e.date===r)?r:e[0]?.date??t,c=eL(e),l=Math.ceil(e.length/7);return(0,J.jsxs)(`div`,{ref:o,className:`flex min-w-0 flex-col gap-3`,children:[(0,J.jsx)(`div`,{"aria-hidden":`true`,className:`grid pl-8 text-caption text-muted-foreground`,style:{gridTemplateColumns:`repeat(${l}, 24px)`},children:c.map((e,t)=>(0,J.jsx)(`span`,{className:`h-4 overflow-visible whitespace-nowrap`,children:e},t))}),(0,J.jsx)(`div`,{role:`grid`,"aria-label":`Review activity for the last ${n} weeks, one square per day. Use arrow keys to move between days.`,className:`flex flex-col`,onKeyDown:t=>{let n=e.findIndex(e=>e.date===s),r=oL(t.key,n,e.length-1);if(r===null)return;t.preventDefault();let o=e[r];o!==void 0&&(i(o.date),a.current.get(o.date)?.focus())},children:uL.map((n,r)=>(0,J.jsxs)(`div`,{role:`row`,className:`flex items-center`,children:[(0,J.jsx)(`span`,{"aria-hidden":`true`,className:`w-8 shrink-0 text-caption text-muted-foreground`,children:n}),Array.from({length:l},(n,o)=>{let c=e[o*7+r];if(c===void 0||sL(c.date)!==r)return(0,J.jsx)(`span`,{className:`size-6 shrink-0`},o);let l=Bc(c.pullRequests);return(0,J.jsx)(WI,{handle:pL,payload:c,delay:150,render:(0,J.jsx)(`div`,{ref:e=>{e===null?a.current.delete(c.date):a.current.set(c.date,e)},role:`gridcell`,tabIndex:c.date===s?0:-1,"aria-label":iL(c,t),onFocus:()=>i(c.date),className:`group flex size-6 shrink-0 items-center justify-center rounded-md`}),children:(0,J.jsx)(dL,{level:l,className:X(`size-5 group-hover:ring-2 group-hover:ring-foreground`,c.date===t&&`outline-2 outline-offset-1 outline-foreground`)})},c.date)})]},r))}),(0,J.jsx)(wI,{handle:pL,children:({payload:e})=>e===void 0?null:(0,J.jsx)(GI,{collisionBoundary:o.current??void 0,children:(0,J.jsxs)(`span`,{className:`flex flex-col`,children:[(0,J.jsx)(`span`,{className:`font-semibold`,children:ZI(e.date)}),(0,J.jsx)(`span`,{children:rL(e)})]})})}),(0,J.jsxs)(`div`,{"aria-hidden":`true`,className:`flex items-start gap-2 pl-8 text-caption text-muted-foreground`,children:[(0,J.jsx)(`span`,{className:`leading-4`,children:`PRs a day`}),lL.map(({level:e,label:t})=>(0,J.jsxs)(`span`,{className:`flex w-6 flex-col items-center gap-0.5`,children:[(0,J.jsx)(dL,{level:e,className:`size-4`}),(0,J.jsx)(`span`,{className:`whitespace-nowrap`,children:t})]},e))]})]})},hL=({value:e,label:t})=>(0,J.jsxs)(`div`,{className:`flex flex-col`,children:[(0,J.jsx)(`span`,{className:`text-title font-semibold tabular-nums`,children:e}),(0,J.jsx)(`span`,{className:`text-caption text-muted-foreground`,children:t})]}),gL=({activity:e,error:t,onRetry:n,now:r})=>{let i=(0,q.useId)(),a=(0,q.useRef)(null),o=fL(a),s=KI(o),c=o===null||o>=900,l=JI(r()),u=(0,q.useMemo)(()=>e===null?null:zc(e,{today:l,weeks:s,dayOf:JI}),[e,l,s]),d=(0,q.useMemo)(()=>e===null?null:zc(e,{today:l,weeks:26,dayOf:JI}),[e,l]),f=u===null?null:Vc(u),p=d?.every(e=>e.pullRequests===0&&e.comments===0)===!0;return(0,J.jsxs)(`section`,{"aria-labelledby":i,className:`flex flex-col rounded-xl border bg-card`,children:[(0,J.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-2 gap-y-1 border-b px-4 py-2.5`,children:[(0,J.jsx)(`h2`,{id:i,className:`text-heading font-semibold`,children:`Review activity`}),(0,J.jsxs)(`span`,{className:`text-caption text-muted-foreground`,children:[`Last `,s,` weeks`]}),(0,J.jsxs)(`span`,{className:`flex items-center gap-1.5 text-caption text-muted-foreground max-sm:basis-full sm:ml-auto`,children:[(0,J.jsx)(Sg,{"aria-hidden":`true`,className:`size-3.5 shrink-0`}),`Reviews and comments posted from megareviewer on this machine`]})]}),(0,J.jsx)(`div`,{className:`overflow-hidden px-4 py-4`,children:(0,J.jsx)(`div`,{ref:a,children:u===null||f===null?t===null?(0,J.jsx)(dP,{"aria-label":`Loading review activity`,className:`h-[244px] w-full motion-reduce:animate-none`}):(0,J.jsxs)(`p`,{className:X(lP,`flex flex-wrap items-baseline gap-x-2 text-caption`),children:[(0,J.jsx)(`span`,{className:`font-medium`,children:`Couldn't read your review activity.`}),(0,J.jsx)(`span`,{children:Ap(t)}),(0,J.jsx)($,{variant:`link`,className:`h-6 min-w-6 px-1 text-caption`,onClick:n,children:`Try again`})]}):(0,J.jsxs)(`div`,{className:X(`flex gap-8`,c?`flex-row`:`flex-col`),children:[(0,J.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-3`,children:[(0,J.jsx)(mL,{days:u,today:l,weeks:s}),p&&(0,J.jsxs)(`p`,{className:`rounded-md bg-muted px-3 py-2 text-caption text-muted-foreground`,children:[(0,J.jsx)(`span`,{className:`font-medium text-foreground`,children:`No reviews yet.`}),` Open a pull request above and post your review. Each day you review fills a square here.`]})]}),(0,J.jsxs)(`div`,{className:X(`flex flex-col gap-3`,c&&`w-[260px] shrink-0`),children:[(0,J.jsxs)(`div`,{className:X(`grid gap-x-6 gap-y-3`,c||o!==null&&o<520?`grid-cols-2`:`grid-cols-4`),children:[(0,J.jsx)(hL,{value:f.pullRequests,label:`PRs reviewed`}),(0,J.jsx)(hL,{value:f.comments,label:`comments posted`}),(0,J.jsx)(hL,{value:f.daysWithReviews,label:`days with reviews`}),(0,J.jsx)(hL,{value:f.thisWeek,label:`PRs this week`})]}),f.busiest!==null&&(0,J.jsx)(`p`,{className:`border-t pt-3 text-caption text-muted-foreground`,children:aL(f.busiest)})]})]})})})]})},_L=`Paste a pull request link first.`,vL=`That isn't a pull request link. Use github.com/owner/repo/pull/123 or bitbucket.org/workspace/repo/pull-requests/45.`,yL=`h-6 min-w-6 px-1 text-caption`,bL=sk(`openInNewTab`).chords[0]??{key:`Enter`,mod:!0},xL=({inputRef:e,start:t,onSubmit:n,onSubmitInNewTab:r,onEdit:i,initial:a})=>{let[o,s]=(0,q.useState)(a?.url??``),[c,l]=(0,q.useState)(a?.invalid??null),u=(0,q.useId)(),d=t?.state===`starting`,f=()=>{let e=o.trim();if(e===``)return l(_L),null;let t=mf(e);return t.ok||l(vL),t.ok?t.value:null},p=e=>{if(e.preventDefault(),d)return;let t=f();t!==null&&n(o.trim(),t)},m=e=>{e.preventDefault();let t=f();t!==null&&r(t)},h=gk();return(0,J.jsx)(`search`,{children:(0,J.jsxs)(`form`,{"aria-label":`Open a pull request by link`,className:`flex flex-col gap-1.5`,onSubmit:p,noValidate:!0,children:[(0,J.jsxs)(`div`,{className:`flex gap-2 max-sm:flex-col`,children:[(0,J.jsxs)(`div`,{className:`relative flex-1`,children:[(0,J.jsx)(Eg,{"aria-hidden":`true`,className:`pointer-events-none absolute top-1/2 left-2.5 size-4 -translate-y-1/2 text-muted-foreground`}),(0,J.jsx)(`input`,{ref:e,id:`${u}-url`,"aria-label":`Pull request link`,className:X(`h-9 w-full min-w-0 rounded-md border border-input bg-card pr-10 pl-8 placeholder:text-muted-foreground`,c!==null&&`border-destructive`),type:`url`,inputMode:`url`,autoComplete:`off`,spellCheck:!1,placeholder:`Paste a GitHub or Bitbucket pull request link`,value:o,readOnly:d,onKeyDown:e=>{pk(e,bL,h)&&m(e)},onChange:e=>{s(e.target.value),l(null),i()},"aria-invalid":c!==null,"aria-describedby":`${u}-message`}),(0,J.jsx)(Tk,{id:`focusLink`,className:`pointer-events-none absolute top-1/2 right-2 -translate-y-1/2`})]}),(0,J.jsx)($,{type:`submit`,size:`lg`,className:`sm:w-28`,"aria-busy":d,onClick:e=>{(e.metaKey||e.ctrlKey||e.shiftKey)&&m(e)},onAuxClick:e=>{e.button===1&&m(e)},children:d?(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(Og,{"aria-hidden":`true`,className:eI}),`Opening…`]}):`Review`})]}),(0,J.jsx)(`div`,{id:`${u}-message`,role:`status`,className:`flex min-h-0 flex-wrap items-center gap-x-2 text-caption`,children:c===null?t?.state===`starting`?(0,J.jsxs)(J.Fragment,{children:[(0,J.jsxs)(`span`,{className:`flex items-center gap-1.5 text-muted-foreground`,children:[(0,J.jsx)(Og,{"aria-hidden":`true`,className:X(`size-3.5`,eI)}),t.message]}),(0,J.jsx)($,{type:`button`,variant:`link`,className:yL,onClick:t.onCancel,children:`Cancel`})]}):t?.state===`failed`?(0,J.jsxs)(J.Fragment,{children:[(0,J.jsxs)(`span`,{className:`text-destructive`,children:[(0,J.jsx)(n_,{"aria-hidden":`true`,className:`mr-1 inline size-3.5 align-[-2px]`}),t.message]}),(0,J.jsx)($,{type:`button`,variant:`link`,className:yL,onClick:t.onRetry,children:`Try again`})]}):null:(0,J.jsxs)(`span`,{className:`text-destructive`,children:[(0,J.jsx)(n_,{"aria-hidden":`true`,className:`mr-1 inline size-3.5 align-[-2px]`}),c]})})]})})},SL=Tc.options,CL=({now:e=Date.now})=>{let{client:t}=yp(),{status:n,checks:r,reportListed:i,setOpen:a}=pI(),o=Cp(),s=wp(),[c,l]=(0,q.useState)(null),[u,d]=(0,q.useState)(``),f=(0,q.useRef)(0),p=(0,q.useRef)(null),m=(0,q.useRef)(null),{refresh:h}=o,{refresh:g}=s,_=(0,q.useCallback)(()=>{h(),g()},[h,g]),v=(0,q.useRef)(r);(0,q.useEffect)(()=>{r!==v.current&&(v.current=r,_())},[r,_]),(0,q.useEffect)(()=>{if(o.loading||(m.current=e(),o.pullRequests===null))return;let t=new Set(o.pullRequests.errors.map(e=>e.host)),r={};for(let e of SL)t.has(e)||n?.hosts[e].configured!==!0||(r[e]=o.pullRequests.items.filter(t=>t.ref.repo.host===e).length);i({counts:r,atMs:e()})},[o.loading,o.pullRequests,n,e,i]),(0,q.useEffect)(()=>{let t=()=>{document.visibilityState===`visible`&&m.current!==null&&e()-m.current>12e4&&_()};return document.addEventListener(`visibilitychange`,t),()=>document.removeEventListener(`visibilitychange`,t)},[e,_]),(0,q.useEffect)(()=>{let e=e=>{e.key!==`/`||e.metaKey||e.ctrlKey||e.altKey||mk(e.target)||(e.preventDefault(),p.current?.focus(),p.current?.select())};return document.addEventListener(`keydown`,e),()=>document.removeEventListener(`keydown`,e)},[]);let y=async(e,n,r,i)=>{f.current+=1;let a=f.current;l({from:r,url:e,ref:n,role:i,state:`starting`}),r===`row`&&d(`Opening ${ZF(n)}`);let o=await t.startAnalysis({url:e});f.current===a&&(o.ok?m_(d_(o.value.analysisId)):l({from:r,url:e,ref:n,role:i,state:`failed`,error:o.error}))},b=(0,q.useCallback)(e=>{f.current+=1,l(null),e===`form`?p.current?.focus():d(`Cancelled`)},[]),x=c?.state===`starting`&&c.from===`row`;(0,q.useEffect)(()=>{if(!x)return;let e=e=>{e.key!==`Escape`||e.defaultPrevented||e.target instanceof Element&&e.target.closest(`[data-slot=popover-content]`)||b(`row`)};return document.addEventListener(`keydown`,e),()=>document.removeEventListener(`keydown`,e)},[x,b]);let S=e=>(0,J.jsx)(hI,{pullRequest:e.ref,error:e.error}),C=c?.from===`form`?c.state===`starting`?{state:`starting`,message:`Fetching ${ZF(c.ref)} from ${XF[c.ref.repo.host]}…`,onCancel:()=>b(`form`)}:{state:`failed`,message:S(c),onRetry:()=>void y(c.url,c.ref,`form`,null)}:null,w=e(),T=c?.state===`starting`&&c.from===`row`?c.url:null,E=c?.state===`failed`&&c.from===`row`&&c.role!==null?{role:c.role,message:S(c),onRetry:()=>void y(c.url,c.ref,`row`,c.role)}:null;return(0,J.jsxs)(`div`,{className:`mx-auto flex max-w-[1240px] flex-col gap-4`,children:[(0,J.jsx)(`h1`,{className:`sr-only`,children:`Pull requests`}),(0,J.jsx)(xL,{inputRef:p,start:C,onSubmit:(e,t)=>void y(e,t,`form`,null),onSubmitInNewTab:e=>window.open(u_(e),`_blank`,`noopener`),onEdit:()=>{c?.from===`form`&&c.state===`failed`&&l(null)}}),(0,J.jsx)(dI,{status:n,list:o.pullRequests,error:o.error,rowFailure:E,startingUrl:T,nowMs:w,onOpen:e=>void y(e.url,e.ref,`row`,e.role),onRetry:_,onOpenConnections:()=>a(!0),onFix:()=>a(!0,{focusCheckAgain:!0})}),(0,J.jsx)(gL,{activity:s.activity,error:s.error,onRetry:g,now:e}),(0,J.jsx)(`span`,{className:`sr-only`,"aria-live":`polite`,children:u})]})},wL=`megareviewer:`,TL=e=>{try{let t=window.localStorage.getItem(wL+e);return t===null?void 0:JSON.parse(t)}catch{return}},EL=(e,t)=>{try{window.localStorage.setItem(wL+e,JSON.stringify(t))}catch{}},DL=(e,t,n)=>{let[r,i]=(0,q.useState)(()=>({key:e,value:n(TL(e))??t}));return[r.key===e?r.value:n(TL(e))??t,(0,q.useCallback)(r=>i(i=>{let a=r(i.key===e?i.value:n(TL(e))??t);return EL(e,a),{key:e,value:a}}),[e,t,n])]},OL=e=>typeof e==`boolean`?e:void 0,kL=e=>typeof e==`string`?e:void 0,AL=e=>{let t=new Map;for(let n of e){let e=n.available?`${n.provider} ${n.via}`:n.provider,r=t.get(e)??[];r.push(n),t.set(e,r)}return[...t.values()].flatMap(e=>{let[t]=e;return t===void 0?[]:[[t,e]]})},jL=(e,t,n)=>{if(e.length<=6)return e;let r=e.filter(e=>e.id===t?.id||e.id===n);return r.length>0?r:e.slice(0,1)},ML=(e,t,n)=>{let r=n.toLowerCase().split(/\s+/).filter(e=>e!==``);return r.length===0?[]:e.filter(e=>!t.includes(e)&&r.every(t=>`${e.modelName} ${e.model}`.toLowerCase().includes(t)))},NL=e=>e.length===0?`No model is known to megareviewer`:e.some(e=>e.available)?null:AL(e).map(([e])=>e.reason??`${e.providerName} can't run`).join(`; or `),PL=e=>{let[t,n]=DL(`model-option`,null,kL),r=e?.options??[],i=r.find(e=>e.id===t&&e.available)??r.find(t=>t.id===e?.defaultId)??null,a=(0,q.useCallback)(e=>n(()=>e),[n]);return{options:r,chosen:i,defaultId:e?.defaultId??null,locked:e===null?null:NL(r),choose:a}},FL=(e,t)=>({...e,preferences:e.preferences.some(e=>e.id===t.id)?e.preferences.map(e=>e.id===t.id?t:e):[...e.preferences,t]}),IL=(e,t)=>({...e,preferences:e.preferences.filter(e=>e.id!==t)}),LL=(e,t)=>({...e,proposals:[...e.proposals,...t.filter(t=>!e.proposals.some(e=>e.id===t.id))]}),RL=(e,t)=>({...e,proposals:e.proposals.filter(e=>e.id!==t)}),zL=(e,t,n,r)=>({...e,repositories:e.repositories.map(e=>ru(e.repo,t)&&e.guidelineFiles!==null?{...e,guidelineFiles:e.guidelineFiles.map(e=>e.path===n?{...e,enabled:r}:e)}:e)}),BL=(e,t)=>e.preferences.filter(e=>iu(e.scope,t)),VL=e=>{let t=[...e.repositories];for(let{scope:n}of[...e.preferences,...e.proposals])n.kind!==`repo`||t.some(e=>ru(e.repo,n.repo))||t.push({repo:n.repo,guidelineFiles:null,guidelineNote:`No pull request of this repository has been analyzed yet`});return t},HL=e=>{if(e<1024)return`${e} B`;let t=e/1024;return`${t<10?t.toFixed(1):Math.round(t)} KB`},UL=e=>{let t=e.trim();return t===``||/[.!?]$/.test(t)?t:`${t}.`},WL=e=>e.code===`bad-request`?UL(e.message):Ap(e),GL=(e,t,n=`${t}s`)=>`${e} ${e===1?t:n}`,KL=new Intl.ListFormat(`en`,{type:`disjunction`}).format(Jl),qL=({file:e,repository:t,onSwitch:n})=>{let[r,i]=(0,q.useState)(null);return(0,J.jsxs)(`li`,{"data-slot":`guideline-file`,className:`flex min-h-8 flex-wrap items-center gap-x-3 gap-y-1`,children:[(0,J.jsx)(eg,{"aria-hidden":`true`,className:`size-3.5 shrink-0 text-muted-foreground`}),(0,J.jsx)(`span`,{className:`min-w-0 font-mono text-code-compact break-all`,children:e.path}),(0,J.jsx)(`span`,{className:`tabular shrink-0 text-caption text-muted-foreground`,children:HL(e.bytes)}),e.tooLarge?(0,J.jsxs)(`span`,{className:`text-caption text-muted-foreground`,children:[`too large to send: a guideline file can be `,HL(Xl)]}):(0,J.jsx)(xP,{checked:e.enabled,"aria-label":`Read ${e.path} in AI reviews of ${t}`,onCheckedChange:async t=>{i(null),i(await n(e.path,t))}}),r!==null&&(0,J.jsxs)(`p`,{role:`alert`,className:`basis-full text-caption text-destructive`,children:[(0,J.jsx)(n_,{"aria-hidden":`true`,className:`mr-1 inline size-3.5 align-[-2px]`}),r]})]})},JL=({files:e,note:t,repository:n,onSwitch:r})=>(0,J.jsxs)(`div`,{"data-slot":`guideline-files`,className:`flex flex-col gap-1 border-t px-4 py-3`,children:[(0,J.jsx)(`h3`,{className:`text-caption font-medium text-muted-foreground`,children:`Guideline files, read at the base commit of the pull request`}),e===null?(0,J.jsx)(`p`,{className:`text-caption text-muted-foreground`,children:UL(t??`Couldn't look for them`)}):e.length===0?(0,J.jsxs)(`p`,{className:`text-caption text-muted-foreground`,children:[`None at the repository's root, where megareviewer looks for `,KL,`.`]}):(0,J.jsx)(`ul`,{className:`flex flex-col`,children:e.map(e=>(0,J.jsx)(qL,{file:e,repository:n,onSwitch:r},e.path))})]}),YL=q.createContext(void 0);function XL(e){let t=q.useContext(YL);if(t===void 0&&!e)throw Error(fv(33));return t}var ZL=q.createContext(void 0);function QL(e){let t=q.useContext(ZL);if(t===void 0&&!e)throw Error(fv(36));return t}var $L=q.createContext(void 0);function eR(e=!0){let t=q.useContext($L);if(t===void 0&&!e)throw Error(fv(25));return t}var tR=q.createContext(null);function nR(e=`root`){let t=q.useContext(tR),n=q.useContext(ZL);return t===null||n===void 0?null:(e===`submenu-trigger`?n.virtualFocus||n.parentVirtualFocus:n.virtualFocus)?t:null}var rR={visible:!0,ref:null};function iR(){return rR}function aR(e,t,n=`root`){let r=nR(n),i=((n===`submenu-trigger`?r?.useSubmenuTrigger:r?.useItem)??iR)({label:e.label,children:e.children,render:e.render}),a=xv(t,i.ref);return{visible:i.visible,ref:a,props:i.props}}var oR=q.createContext(void 0);function sR(){let e=q.useContext(oR);if(e===void 0)throw Error(fv(30));return e}function cR(e){e.preventDefault()}function lR(e){let{closeOnClick:t,highlighted:n,id:r,nodeId:i,store:a,typingRef:o,itemRef:s,itemMetadata:c}=e,l=QL(),u=eR(!0),d=c.type===`submenu-trigger`,f=d?l.parentVirtualFocus:l.virtualFocus,p=(d&&l.parent.type===`menu`?l.parent.store:l.store).useState(`webkitAriaSelected`,n),{events:m}=a.useState(`floatingTreeRoot`),h=a.useState(`open`),g=u!==void 0,_=!f&&h&&n?0:-1;return q.useMemo(()=>({id:r,role:`menuitem`,tabIndex:_,"aria-selected":p,onMouseDown:f?cR:void 0,onKeyDown(e){e.key===` `&&o?.current&&e.preventDefault()},onMouseMove(e){i&&m.emit(`itemhover`,{nodeId:i,target:e.currentTarget})},onClick(e){t&&m.emit(`close`,{domEvent:e.nativeEvent,reason:xb})},onMouseUp(e){if(u){let t=u.initialCursorPointRef.current;if(u.initialCursorPointRef.current=null,g&&t&&Math.abs(e.clientX-t.x)<=1&&Math.abs(e.clientY-t.y)<=1||g&&!my&&e.button===2)return}s.current&&a.context.allowMouseUpTriggerRef.current&&(!g||e.button===2)&&c.type===`regular-item`&&_v(s.current,e,{detail:1,pointerType:`mouse`})}}),[t,_,r,m,i,a.context.allowMouseUpTriggerRef,o,s,u,g,c.type,p,f])}var uR={type:`regular-item`};function dR(e){let{closeOnClick:t,disabled:n,highlighted:r,id:i,store:a,typingRef:o=a.context.typingRef,nativeButton:s,itemMetadata:c,nodeId:l}=e,u=q.useRef(null),{getButtonProps:d,buttonRef:f}=vv({disabled:n,focusableWhenDisabled:!0,native:s,composite:!0}),p=lR({closeOnClick:t,highlighted:r,id:i,nodeId:l,store:a,typingRef:o,itemRef:u,itemMetadata:c}),m=q.useCallback(e=>Q_(p,{onMouseEnter(e){c.type===`submenu-trigger`&&c.setActive(e.nativeEvent)}},e,d),[p,d,c]),h=xv(u,f);return q.useMemo(()=>({getItemProps:m,itemRef:h}),[m,h])}var fR=`data-checked`,pR=`data-unchecked`,mR={checked(e){return e?{[fR]:``}:{[pR]:``}},...zy},hR=q.forwardRef(function(e,t){let{render:n,className:r,id:i,label:a,nativeButton:o=!1,disabled:s=!1,closeOnClick:c=!1,checked:l=!1,onCheckedChange:u,style:d,...f}=e,{store:p}=QL(),m=TO({guess:!0,label:a}),h=eE(i),g=p.useState(`disabled`),_=p.useState(`isActive`,m.index),v=p.useState(`floatingNodeId`),y=p.useState(`itemProps`),b=s||g,{getItemProps:x,itemRef:S}=dR({closeOnClick:c,disabled:b,highlighted:_,id:h,store:p,nativeButton:o,nodeId:v,itemMetadata:uR}),C=q.useMemo(()=>({disabled:b,highlighted:_,checked:l}),[b,_,l]);function w(e){let t=mb(xb,e.nativeEvent,void 0,{preventUnmountOnClose:Av});u?.(!l,t)}let T=Iv(`div`,e,{state:C,stateAttributesMapping:mR,props:[y,{role:`menuitemcheckbox`,"aria-checked":l,onClick:w},f,x],ref:[S,t,m.ref]});return(0,J.jsx)(oR.Provider,{value:C,children:T})}),gR=q.forwardRef(function(e,t){let{checked:n,defaultChecked:r,onCheckedChange:i,...a}=e,[o,s]=sO({controlled:n,default:r??!1,name:`MenuCheckboxItem`,state:`checked`}),c=aR(e,t);function l(e,t){i?.(e,t),t.isCanceled||s(e)}return c.visible?(0,J.jsx)(hR,{...a,checked:o,onCheckedChange:l,ref:c.ref}):null}),_R=q.forwardRef(function(e,t){let{render:n,className:r,style:i,keepMounted:a=!1,...o}=e,s=sR(),c=q.useRef(null),{transitionStatus:l,mounted:u,setMounted:d}=vC(s.checked);return CC({batch:!0,enabled:!s.checked,open:s.checked,ref:c,onComplete(){s.checked||d(!1)}}),Iv(`span`,e,{state:{checked:s.checked,disabled:s.disabled,highlighted:s.highlighted,transitionStatus:l},ref:[t,c],stateAttributesMapping:mR,props:{"aria-hidden":!0,...o},enabled:a||u})}),vR=q.createContext(void 0);function yR(){let e=q.useContext(vR);if(e===void 0)throw Error(fv(31));return e}var bR=q.forwardRef(function(e,t){let{render:n,className:r,style:i,...a}=e,[o,s]=q.useState(void 0),c=Iv(`div`,e,{ref:t,props:{role:`group`,"aria-labelledby":o,...a}});return(0,J.jsx)(vR.Provider,{value:s,children:c})}),xR=q.forwardRef(function(e,t){let n=nR()?.Group??bR;return(0,J.jsx)(n,{...e,ref:t})}),SR=q.forwardRef(function(e,t){let{render:n,className:r,style:i,id:a,...o}=e,s=eE(a),c=yR();return Q(()=>(c(s),()=>{c(e=>e===s?void 0:e)}),[c,s]),Iv(`div`,e,{ref:t,props:{id:s,"aria-hidden":!0,...o}})}),CR=q.forwardRef(function(e,t){let{render:n,className:r,id:i,label:a,nativeButton:o=!1,disabled:s=!1,closeOnClick:c=!0,style:l,...u}=e,{store:d}=QL(),f=TO({guess:!0,label:a}),p=eE(i),m=d.useState(`disabled`),h=d.useState(`isActive`,f.index),g=d.useState(`floatingNodeId`),_=d.useState(`itemProps`),v=s||m,{getItemProps:y,itemRef:b}=dR({closeOnClick:c,disabled:v,highlighted:h,id:p,store:d,nativeButton:o,nodeId:g,itemMetadata:uR});return Iv(`div`,e,{state:{disabled:v,highlighted:h},props:[_,u,y],ref:[b,t,f.ref]})}),wR=q.forwardRef(function(e,t){let n=aR(e,t);return n.visible?(0,J.jsx)(CR,{...e,ref:n.ref}):null}),TR=q.createContext(void 0);function ER(){return q.useContext(TR)}function DR(e,t){let n=Bv(e.render);if(q.isValidElement(n)){let e=n.props;if(Object.hasOwn(e,`id`))return e.id??``}return e.id??t}function OR(e,t,n){let r=DR(e,t),i=r===t?void 0:r;return[r,q.useCallback(e=>n?.(e?i:void 0),[i,n])]}function kR(e,t,n){let r=Bv(e.render),i=q.isValidElement(r)?r.props:void 0,a=e[`aria-label`]??i?.[`aria-label`],o=e[`aria-labelledby`]??i?.[`aria-labelledby`];return o==null&&!a&&(o=t?t.id||void 0:n||void 0),o}var AR=q.forwardRef(function(e,t){let{render:n,className:r,style:i,finalFocus:a,id:o,initialFocus:s,...c}=e,{store:l,defaultFloatingId:u,setRenderedFloatingId:d,virtualFocus:f,orientation:p}=QL(),m=ER(),{side:h,align:g}=XL(),_=uM(!0)!=null,v=l.useState(`open`),y=l.useState(`transitionStatus`),b=l.useState(`popupProps`),x=l.useState(`mounted`),S=l.useState(`instantType`),C=l.useState(`activeTriggerElement`),w=l.useState(`parent`),T=l.useState(`lastOpenChangeReason`),E=l.useState(`rootId`),D=l.useState(`floatingRootContext`),O=l.useState(`floatingTreeRoot`),k=l.useState(`closeDelay`),A=l.useState(`hoverEnabled`),j=l.useState(`disabled`),M=l.useState(`openMethod`),N=l.useState(`activeTriggerId`),P=l.useState(`listElement`),[F,I]=OR(e,u,d),L=kR(e,C,N),R=w.type===`menu`?m:void 0,ee=w.type===`context-menu`,z=s??w.type!==`menu`;s===void 0&&P&&w.type!==`menu`&&(z=()=>l.state.activeIndex===null&&P),CC({open:v,ref:l.context.popupRef,onComplete(){v&&l.context.onOpenChangeComplete?.(!0)}}),q.useEffect(()=>{function e(e){l.setOpen(!1,mb(e.reason,e.domEvent))}return O.events.on(`close`,e),()=>{O.events.off(`close`,e)}},[O.events,l]),_w(D,{enabled:A&&!j&&!ee&&w.type!==`menubar`,closeDelay:k});let te=l.useStateSetter(`popupElement`),{parentVirtualFocusRef:B,handleFocus:ne}=(q.useContext(tR)?.useParentHandoff??MR)(l,w,v,f),V=Iv(`div`,e,{state:{transitionStatus:y,side:h,align:g,open:v,nested:w.type===`menu`,instant:S},ref:[t,l.context.popupRef,te,I],stateAttributesMapping:$y,props:[b,{id:F,...P?{role:`presentation`}:{role:`menu`,"aria-orientation":p===`horizontal`?`horizontal`:void 0,"aria-labelledby":L},onKeyDown(e){R?.onPopupKeyDown?.(e),_&&VO.has(e.key)&&e.stopPropagation()},onFocus:ne},CE(y),c,{"data-rootownerid":E}]}),H=w.type===void 0||ee;(C||w.type===`menubar`&&T!==`outside-press`)&&(H=!0);let re=R?.getReturnElement??B;return(0,J.jsx)(ZS,{context:D,openInteractionType:M,modal:ee,disabled:!x,returnFocus:a??re??H,explicitReturnFocus:a===void 0&&re?!1:void 0,initialFocus:z,restoreFocus:!0,getInsideElements:w.type===void 0?()=>[l.context.beforeTriggerFocusGuardRef.current]:void 0,externalTree:w.type===`menubar`?void 0:O,previousFocusableElement:C,nextFocusableElement:w.type===void 0?l.context.triggerFocusTargetRef:void 0,beforeContentFocusGuardRef:l.context.beforeContentFocusGuardRef,children:V})}),jR={parentVirtualFocusRef:void 0,handleFocus:void 0};function MR(){return jR}var NR=q.forwardRef(function(e,t){let n=nR()?.Popup??AR;return(0,J.jsx)(n,{...e,ref:t})}),PR=q.createContext(void 0);function FR(){let e=q.useContext(PR);if(e===void 0)throw Error(fv(32));return e}var IR=q.forwardRef(function(e,t){let{keepMounted:n=!1,...r}=e,{store:i,parent:a}=QL();if(!(i.useState(`mounted`)||n))return null;let o=a.type===`menu`||a.type===`menubar`?`group`:void 0;return(0,J.jsx)(PR.Provider,{value:n,children:(0,J.jsx)(MS,{ref:t,...r,portalOwnerRole:o})})}),LR=q.forwardRef(function(e,t){let{anchor:n,positionMethod:r=`absolute`,className:i,render:a,side:o,align:s,sideOffset:c=0,alignOffset:l=0,collisionBoundary:u=`clipping-ancestors`,collisionPadding:d=5,arrowPadding:f=5,sticky:p=!1,disableAnchorTracking:m=!1,collisionAvoidance:h=wS,style:g,..._}=e,{store:v,virtualFocus:y,syncHighlightedItem:b}=QL(),x=FR(),S=eR(!0),C=v.useState(`parent`),w=v.useState(`floatingRootContext`),T=v.useState(`floatingTreeRoot`),E=v.useState(`mounted`),D=v.useState(`open`),O=v.useState(`modal`),k=v.useState(`openMethod`),A=v.useState(`activeTriggerElement`),j=v.useState(`transitionStatus`),M=v.useState(`positionerElement`),N=v.useState(`instantType`),P=v.useState(`adaptiveOrigin`),F=v.useState(`lastOpenChangeReason`),I=v.useState(`floatingNodeId`),L=v.useState(`floatingParentNodeId`),R=w.useState(`domReferenceElement`),ee=n,z=c,te=l,B=s,ne=h;C.type===`context-menu`&&(ee=n??C.context?.anchor,B??=`start`,!o&&B!==`center`&&(te=e.alignOffset??2,z=e.sideOffset??-5));let V=o,H=B;C.type===`menu`?(V??=`inline-end`,H??=`start`,ne=e.collisionAvoidance??TS):C.type===`menubar`&&(V??=C.context.orientation===`vertical`?`inline-end`:`bottom`,H??=`start`);let re=C.type===`context-menu`,ie=bE({anchor:ee,floatingRootContext:w,positionMethod:S?`fixed`:r,mounted:E,side:V,sideOffset:z,align:H,alignOffset:te,arrowPadding:re?0:f,collisionBoundary:u,collisionPadding:d,sticky:p,nodeId:I,keepMounted:x,disableAnchorTracking:m,collisionAvoidance:ne,shift:re?{crossAxis:!(`side`in ne&&ne.side===`flip`),rootBoundary:`layoutViewport`}:void 0,externalTree:T,adaptiveOrigin:P,lazyFlip:y?`placement`:!1});q.useEffect(()=>{function e(e){e.open&&(e.parentNodeId===I&&v.set(`hoverEnabled`,!1),e.nodeId!==I&&e.parentNodeId===v.select(`floatingParentNodeId`)&&v.setOpen(!1,mb(kb)))}return T.events.on(`menuopenchange`,e),()=>{T.events.off(`menuopenchange`,e)}},[v,T.events,I]),q.useEffect(()=>{if(v.select(`floatingParentNodeId`)==null)return;function e(e){if(e.open||e.nodeId!==v.select(`floatingParentNodeId`))return;let t=e.reason??`sibling-open`;v.setOpen(!1,mb(t))}return T.events.on(`menuopenchange`,e),()=>{T.events.off(`menuopenchange`,e)}},[T.events,v]);let ae=iy();q.useEffect(()=>{D||ae.clear()},[D,ae]),q.useEffect(()=>{function e(e){if(D&&e.nodeId===v.select(`floatingParentNodeId`)){if(e.target&&A&&A!==e.target){let e=v.select(`closeDelay`);e>0?ae.isStarted()||ae.start(e,()=>{v.setOpen(!1,mb(kb))}):v.setOpen(!1,mb(kb))}else ae.clear()}}return T.events.on(`itemhover`,e),()=>{T.events.off(`itemhover`,e)}},[T.events,D,A,v,ae]),q.useEffect(()=>{let e={open:D,nodeId:I,parentNodeId:L,reason:v.select(`lastOpenChangeReason`)};T.events.emit(`menuopenchange`,e)},[T.events,D,v,I,L]),BM({store:v,domReference:R,positionerElement:M,open:D});let oe={open:D,side:ie.side,align:ie.align,anchorHidden:ie.anchorHidden,nested:C.type===`menu`,instant:N},se=C.type===`menubar`&&C.context.modal;HM(D&&(se||O&&F!==`trigger-hover`),k===`touch`,M,A);let U=wE(e,oe,{styles:ie.positionerStyles,transitionStatus:j,props:_,refs:[t,v.useStateSetter(`positionerElement`)],hidden:!E,inert:!D}),ce=E&&C.type!==`menu`&&(C.type!==`menubar`&&O&&F!==`trigger-hover`||C.type===`menubar`&&C.context.modal),le=null;return C.type===`menubar`?le=C.context.contentElement:C.type===void 0&&(le=A),(0,J.jsxs)(YL.Provider,{value:ie,children:[ce&&(0,J.jsx)(VA,{ref:C.type===`context-menu`||C.type===`nested-context-menu`?C.context.internalBackdropRef:null,inert:DE(!D),cutout:le}),(0,J.jsx)(BS,{id:I,children:(0,J.jsx)(uO,{elementsRef:v.context.itemDomElements,labelsRef:v.context.itemLabels,onMapChange:b,children:U})})]})}),RR=q.createContext(void 0);function zR(){let e=q.useContext(RR);if(e===void 0)throw Error(fv(34));return e}var BR=q.forwardRef(function(e,t){let{render:n,className:r,value:i,defaultValue:a,onValueChange:o,disabled:s=!1,style:c,"aria-labelledby":l,...u}=e,[d,f]=q.useState(void 0),[p,m]=sO({controlled:i,default:a,name:`MenuRadioGroup`}),h=Z((e,t)=>{o?.(e,t),!t.isCanceled&&m(e)}),g=Iv(`div`,e,{state:{disabled:s},ref:t,props:{role:`group`,"aria-labelledby":l??d,"aria-disabled":s||void 0,...u}}),_=q.useMemo(()=>({value:p,setValue:h,disabled:s}),[p,h,s]);return(0,J.jsx)(vR.Provider,{value:f,children:(0,J.jsx)(RR.Provider,{value:_,children:g})})}),VR=q.memo(q.forwardRef(function(e,t){let n=nR()?.RadioGroup??BR;return(0,J.jsx)(n,{...e,ref:t})})),HR=q.createContext(void 0);function UR(){let e=q.useContext(HR);if(e===void 0)throw Error(fv(35));return e}var WR=q.forwardRef(function(e,t){let{render:n,className:r,id:i,label:a,nativeButton:o=!1,disabled:s=!1,closeOnClick:c=!1,value:l,style:u,...d}=e,{store:f}=QL(),{value:p,setValue:m,disabled:h}=zR(),g=TO({guess:!0,label:a}),_=eE(i),v=f.useState(`isActive`,g.index),y=f.useState(`floatingNodeId`),b=f.useState(`itemProps`),x=f.useState(`disabled`),S=s||h||x,C=p===l,{getItemProps:w,itemRef:T}=dR({closeOnClick:c,disabled:S,highlighted:v,id:_,store:f,nativeButton:o,nodeId:y,itemMetadata:uR}),E=q.useMemo(()=>({disabled:S,highlighted:v,checked:C}),[S,v,C]);function D(e){let t=mb(xb,e.nativeEvent,void 0,{preventUnmountOnClose:Av});m(l,t)}let O=Iv(`div`,e,{state:E,stateAttributesMapping:mR,props:[b,{role:`menuitemradio`,"aria-checked":C,onClick:D},d,w],ref:[T,t,g.ref]});return(0,J.jsx)(HR.Provider,{value:E,children:O})}),GR=q.forwardRef(function(e,t){let n=aR(e,t);return n.visible?(0,J.jsx)(WR,{...e,ref:n.ref}):null}),KR=q.forwardRef(function(e,t){let{render:n,className:r,style:i,keepMounted:a=!1,...o}=e,s=UR(),c=q.useRef(null),{transitionStatus:l,mounted:u,setMounted:d}=vC(s.checked);return CC({batch:!0,enabled:!s.checked,open:s.checked,ref:c,onComplete(){s.checked||d(!1)}}),Iv(`span`,e,{state:{checked:s.checked,disabled:s.disabled,highlighted:s.highlighted,transitionStatus:l},stateAttributesMapping:mR,ref:[t,c],props:{"aria-hidden":!0,...o},enabled:a||u})}),qR=q.createContext(null);function JR(e){let t=q.useContext(qR);if(t===null&&!e)throw Error(fv(5));return t}function YR(e){return e==null?gb:e.type.startsWith(`key`)?Eb:e.type.startsWith(`mouse`)||e.type.startsWith(`pointer`)?Db:gb}var XR={...sw,disabled:e=>e.parent.type===`menubar`&&e.parent.context.disabled||e.disabled,modal:e=>(e.parent.type===void 0||e.parent.type===`context-menu`)&&(e.modal??!0),openMethod:e=>e.openMethod,keyboardOpen:e=>e.keyboardOpen,allowMouseEnter:e=>e.allowMouseEnter,highlightItemOnHover:e=>e.highlightItemOnHover,parent:e=>e.parent,rootId:e=>e.parent.type===`menu`?e.parent.store.select(`rootId`):e.parent.type===void 0?e.rootId:e.parent.context.rootId,activeIndex:e=>e.activeIndex,listElement:e=>e.listElement,triggerControlsId:(e,t)=>{let n=sw.triggerPopupId(e,t);return n?e.listElement?.id||n:void 0},filterTriggerProps:e=>e.filterTriggerProps,inputProps:e=>e.inputProps,webkitAriaSelected:(e,t)=>gy&&e.inputFocused&&t?!0:void 0,highlightedItemId:e=>e.highlightedItem?.id||void 0,isActive:(e,t)=>e.activeIndex===t,hoverEnabled:e=>e.hoverEnabled,instantType:e=>e.instantType===`trigger-change`&&!sw.open(e)?void 0:e.instantType,lastOpenChangeReason:e=>e.openChangeReason,floatingTreeRoot:e=>e.parent.type===`menu`?e.parent.store.select(`floatingTreeRoot`):e.floatingTreeRoot,floatingNodeId:e=>e.floatingNodeId,floatingParentNodeId:e=>e.floatingParentNodeId,itemProps:e=>e.itemProps,closeDelay:e=>e.closeDelay,adaptiveOrigin:e=>e.adaptiveOrigin,keyboardEventRelay:e=>{if(e.keyboardEventRelay)return e.keyboardEventRelay;if(e.parent.type===`menu`)return e.parent.store.select(`keyboardEventRelay`)}},ZR=class extends QC{constructor(e,t,n=!1){let r=new zC,i=$R(r,t,n,e);super(i,QR(r),XR),this.observe(`parent`,e=>{e.type===`menu`?this.context.allowMouseUpTriggerRef=e.store.context.allowMouseUpTriggerRef:e.type!==void 0&&(this.context.allowMouseUpTriggerRef=e.context.allowMouseUpTriggerRef)})}subscribeToParentMenu(){let e=this.state.parent;if(e.type!==`menu`)return;let t=e.store.select(`rootId`),n=e.store.select(`floatingTreeRoot`),r=e.store.select(`keyboardEventRelay`);return e.store.subscribe(()=>{let i=e.store.select(`rootId`),a=e.store.select(`floatingTreeRoot`),o=e.store.select(`keyboardEventRelay`);(t!==i||n!==a||r!==o)&&(t=i,n=a,r=o,this.notifyAll())})}setOpen(e,t){this.state.floatingRootContext.context.events.emit(`setOpen`,{open:e,eventDetails:t})}setActiveIndex(e,t,n){if(this.state.activeIndex!==e){let r=(e===null?void 0:this.context.itemDomElements.current[e])===this.context.reportedItem;this.context.highlightReason=r?`none`:t,this.context.highlightEvent=r?void 0:n}this.set(`activeIndex`,e)}highlightItem(e,t,n){let r=this.context.itemDomElements.current.indexOf(e);r>-1&&this.setActiveIndex(r,t,n)}};function QR(e){return{positionerRef:q.createRef(),popupRef:q.createRef(),typingRef:{current:!1},itemDomElements:{current:[]},itemLabels:{current:[]},highlightReason:`none`,highlightEvent:void 0,reportedItem:void 0,allowMouseUpTriggerRef:{current:!1},virtualFocusRef:void 0,triggerFocusTargetRef:q.createRef(),beforeTriggerFocusGuardRef:q.createRef(),beforeContentFocusGuardRef:q.createRef(),onOpenChangeComplete:void 0,triggerElements:e}}function $R(e,t,n=!1,r){return{...tw(e,t,n),disabled:!1,modal:!0,openMethod:null,keyboardOpen:!1,allowMouseEnter:!1,highlightItemOnHover:!0,parent:{type:void 0},rootId:void 0,activeIndex:null,listElement:null,filterTriggerProps:Mv,inputProps:Mv,inputFocused:!1,highlightedItem:void 0,hoverEnabled:!0,instantType:void 0,openChangeReason:null,floatingTreeRoot:new PS,floatingNodeId:void 0,floatingParentNodeId:null,itemProps:Mv,keyboardEventRelay:void 0,closeDelay:0,adaptiveOrigin:void 0,...r}}var ez=q.createContext(null);function tz(e,t){return(e===`trigger-press`||e===`item-press`)&&t?.detail===0}function nz(e,t){return e===`list-navigation`||tz(e,t)}var rz=Qv(function(e){let{children:t,open:n,onOpenChange:r,onOpenChangeComplete:i,onItemHighlighted:a,defaultOpen:o=!1,disabled:s=!1,modal:c,loopFocus:l=!0,orientation:u=`vertical`,actionsRef:d,closeParentOnEsc:f=!1,handle:p,triggerId:m,defaultTriggerId:h=null,highlightItemOnHover:g=!0,isSubmenu:_=!1,virtualFocus:v=!1,virtualFocusRef:y,allowEscape:b=!0,resetOnPointerLeave:x=!0}=e,S=eR(!0),C=QL(!0),w=JR(!0),T=C?.store,E=C?.virtualFocus??!1,D=q.useMemo(()=>_&&T?{type:`menu`,store:T}:w?{type:`menubar`,context:w}:S&&!T?{type:`context-menu`,context:S}:{type:void 0},[S,T,w,_]),O=eE(),k=eE(),[A,j]=q.useState(void 0),M=(A??k)||void 0,N=LS(),P=D.type===`menu`?D.store:void 0,F=(n??o)&&P?.state.transitionStatus===`starting`,I=G_(()=>F?P?.state.instantType:void 0).current,L=G_(()=>{let e=new ZR({open:o,openProp:n,activeTriggerId:h,triggerIdProp:m,parent:D,disabled:s,highlightItemOnHover:g,modal:D.type===void 0?c:void 0,rootId:O,instantType:I},M,N!=null);return e.context.virtualFocusRef=y,e}).current;L.useControlledProp(`openProp`,n),L.useControlledProp(`triggerIdProp`,m),L.useContextCallback(`onOpenChangeComplete`,i);let R=L.useState(`floatingTreeRoot`),ee=zS(R),z=L.useState(`open`),te=L.useState(`activeTriggerElement`),B=L.useState(`positionerElement`),ne=L.useState(`hoverEnabled`),V=L.useState(`disabled`),H=L.useState(`lastOpenChangeReason`),re=L.useState(`parent`),ie=L.useState(`activeIndex`),ae=L.useState(`keyboardOpen`),oe=L.useState(`payload`),se=L.useState(`floatingParentNodeId`),U=q.useRef(null),ce=q.useRef(re.type!==`context-menu`),le=iy(),ue=q.useRef(!0),de=iy(),fe=se!=null,{openMethod:pe,triggerProps:me}=dj(z);L.useSyncedValues({disabled:s,highlightItemOnHover:g,modal:re.type===void 0?c:void 0,openMethod:pe,rootId:O}),FC(L);let{forceUnmount:he,transitionStatus:ge}=IC(z,L,()=>{L.set(`allowMouseEnter`,!1)},F),_e=SC(L.context.popupRef);q.useEffect(()=>{if(I===void 0)return;let e=()=>{L.state.instantType===I&&L.set(`instantType`,void 0)};if(!z){e();return}if(ge!==void 0)return;if(L.context.popupRef.current==null){e();return}let t=new AbortController;return _e(e,t.signal),()=>{t.abort()}},[I,z,ge,_e,L]),Q(()=>{S&&!C?L.update({parent:{type:`context-menu`,context:S},floatingNodeId:ee,floatingParentNodeId:N}):(C||!L.select(`activeTriggerElement`))&&L.update({floatingNodeId:ee,floatingParentNodeId:N})},[S,C,ee,N,te,L]),q.useEffect(()=>{z||(U.current=null),re.type===`context-menu`&&(z?le.start(500,()=>{ce.current=!0}):(le.clear(),ce.current=!1))},[le,z,re.type]),Q(()=>{!z&&!ne&&L.set(`hoverEnabled`,!0)},[z,ne,L]);let ve=Z((e,t)=>{let n=t.reason;if(!e&&!L.select(`open`)||z===e&&t.trigger===te&&H===n)return;let i=MC(t);if(!e&&t.trigger==null&&(t.trigger=te??void 0),r?.(e,t),t.isCanceled)return;L.state.floatingRootContext.dispatchOpenChange(e,t);let a=t.event;if(e===!1&&n!==`item-press`&&a?.type===`click`&&a.pointerType===`touch`&&!ue.current)return;e&&n===`trigger-focus`?(ue.current=!1,de.start(300,()=>{ue.current=!0})):(ue.current=!0,de.clear());let o=!e&&(n===`escape-key`||n==null);U.current=t.event;let s=jC(L.state,e,t.trigger,i());s.openChangeReason=n,s.keyboardOpen=e&&nz(n,a),s.instantType=re.type===`menubar`&&(n===`trigger-focus`||n===`focus-out`||n===`trigger-hover`||n===`list-navigation`||n===`sibling-open`)?`group`:tz(n,a)?`click`:o?`dismiss`:void 0,L.update(s)}),ye=_C({popupStore:L,floatingRootContext:L.state.floatingRootContext,floatingId:M,nested:N!=null,onOpenChange:ve}),be=ye.context.events;Q(()=>{let e=({open:e,eventDetails:t})=>ve(e,t);return be.on(`setOpen`,e),()=>{be?.off(`setOpen`,e)}},[be,ve]),Q(()=>L.subscribeToParentMenu(),[L]);let xe=q.useCallback(()=>{L.setOpen(!1,mb(Nb))},[L]);q.useImperativeHandle(d,()=>({unmount:he,close:xe}),[he,xe]);let Se;re.type===`context-menu`&&(Se=re.context),q.useImperativeHandle(Se?.positionerRef,()=>B,[B]),q.useImperativeHandle(Se?.actionsRef,()=>({setOpen:ve}),[ve]);let Ce=iC(ye,{enabled:!V,bubbles:{escapeKey:f&&re.type===`menu`},outsidePress(){return re.type!==`context-menu`||U.current?.type===`contextmenu`||ce.current},externalTree:fe?R:void 0}),we=oE(),Te=Ew(ye,{enabled:!V,listRef:L.context.itemDomElements,activeIndex:ie,virtual:v,nested:re.type===`menubar`||!v&&re.type!==void 0,parentOrientation:re.type===`menubar`?re.context.orientation:void 0,loopFocus:l,focusItemOnOpen:v?ae:void 0,allowEscape:v&&l&&b,orientation:u,triggerOrientation:v?`vertical`:u,rtl:we===`rtl`,disabledIndices:jv,onNavigate(e,t){L.setActiveIndex(e,YR(t),t?.nativeEvent)},openOnArrowKeyDown:re.type!==`context-menu`&&!(v&&_),externalTree:!v&&fe?R:void 0,nestedReturnFocusRef:P?.context.virtualFocusRef,focusItemOnHover:g,resetOnPointerLeave:x}),Ee=q.useCallback(e=>{L.context.typingRef.current=e},[L]),De=Dw(ye,{enabled:!V&&!v,listRef:L.context.itemLabels,elementsRef:L.context.itemDomElements,activeIndex:ie,resetMs:500,onMatch:(e,t)=>{z&&e!==ie&&L.setActiveIndex(e,Eb,t.nativeEvent)},onTyping:Ee}),Oe=Z(a),ke=q.useRef(-1),Ae=Z(()=>{let e=L.state.activeIndex,t=e===null?void 0:L.context.itemDomElements.current[e]??void 0;if(t?.isConnected===!1)return;let n=t===void 0?-1:e;if(ke.current===n&&L.context.reportedItem===t)return;ke.current=n,L.context.reportedItem=t,v&&L.set(`highlightedItem`,t);let{highlightReason:r,highlightEvent:i}=L.context;L.context.highlightReason=gb,L.context.highlightEvent=void 0,a&&Oe(t,hb(r,i,{label:t===void 0?void 0:L.context.itemLabels.current[n]??void 0}))});Q(()=>{Ae()},[ie,Ae]);let je=q.useMemo(()=>{if(!v)return Te.reference;if(!Te.trigger)return Mv;let{onFocus:e,...t}=Te.trigger;return t},[v,Te.reference,Te.trigger]);L.useSyncedValue(`inputProps`,v?Te.reference??Mv:Mv);let Me=q.useMemo(()=>{let e=Q_(De.reference,je,Ce.reference,{onMouseMove(){L.set(`allowMouseEnter`,!0)}},me);return e[`aria-haspopup`]=`menu`,e[`aria-expanded`]=z,e},[L,De.reference,je,Ce.reference,me,z]),Ne=q.useMemo(()=>{let e=Q_(Te.trigger,Ce.trigger,me);return e[`aria-haspopup`]=`menu`,e[`aria-expanded`]=!1,e},[Te.trigger,Ce.trigger,me]);G_(()=>(L.update({inactiveTriggerProps:Ne}),null)),LC(L,{floatingRootContext:ye,activeTriggerProps:Me,inactiveTriggerProps:Ne,popupProps:q.useMemo(()=>Q_(TC,{onMouseMove(){L.set(`allowMouseEnter`,!0),re.type===`menu`&&L.set(`hoverEnabled`,!1)},onClick(){L.select(`hoverEnabled`)&&L.set(`hoverEnabled`,!1)},onKeyDown(e){let t=L.select(`keyboardEventRelay`);t&&!e.isPropagationStopped()&&t(e)}},De.floating,Te.floating,Ce.floating),[re.type,L,De.floating,Te.floating,Ce.floating]),itemProps:Te.item??Mv});let Pe=q.useMemo(()=>({store:L,parent:D,orientation:u,loopFocus:l,allowEscape:b,defaultFloatingId:k,setRenderedFloatingId:j,virtualFocus:v,parentVirtualFocus:E,syncHighlightedItem:Ae}),[L,D,u,l,b,k,v,E,Ae]),Fe=typeof t==`function`?t({payload:oe}):t,Ie=(0,J.jsxs)(ZL.Provider,{value:Pe,children:[p&&(0,J.jsx)(OC,{handle:p,store:L}),Fe]});return(re.type===void 0||re.type===`context-menu`)&&(Ie=(0,J.jsx)(VS,{externalTree:R,children:Ie})),Ie});function iz(e){let t=q.useContext(ez);if(t===null)return(0,J.jsx)(rz,{...e});let n=t.Root;return(0,J.jsx)(ez.Provider,{value:null,children:(0,J.jsx)(n,{...t.options,...e})})}var az=5;function oz(e,t){let n=sz(t);return e.clientX>=n.left-az&&e.clientX<=n.right+az&&e.clientY>=n.top-az&&e.clientY<=n.bottom+az}function sz(e){let t=e.getBoundingClientRect(),n=b_(e);if(vy)return t;let r=n.getComputedStyle(e,`::before`),i=n.getComputedStyle(e,`::after`);if(r.content===`none`&&i.content===`none`)return t;let a=parseFloat(r.width)||0,o=parseFloat(r.height)||0,s=parseFloat(i.width)||0,c=parseFloat(i.height)||0,l=Math.max(t.width,a,s),u=Math.max(t.height,o,c),d=l-t.width,f=u-t.height;return{left:t.left-d/2,right:t.right+d/2,top:t.top-f/2,bottom:t.bottom+f/2}}function cz(e){if(w_(e)&&e.hasAttribute(`data-rootownerid`))return e.getAttribute(`data-rootownerid`);if(!I_(e))return cz(z_(e))}function lz(e){let{enabled:t=!0,mouseDownAction:n,open:r}=e,i=q.useRef(!1);return q.useMemo(()=>t?{onMouseDown:e=>{(n===`open`&&!r||n===`close`&&r)&&(i.current=!0,gv(e.currentTarget).addEventListener(`click`,()=>{i.current=!1},{once:!0}))},onClick:e=>{i.current&&(i.current=!1,e.preventBaseUIHandler())}}:Mv,[t,n,r])}var uz=$v(function(e,t){let{render:n,className:r,style:i,disabled:a=!1,nativeButton:o=!0,id:s,openOnHover:c,delay:l=100,closeDelay:u=0,handle:d,payload:f,...p}=e,m=QL(!0),h=cw(d)??m?.store;if(!h)throw Error(fv(85));let g=eE(s),_=h.useState(`isTriggerActive`,g),v=h.useState(`floatingRootContext`),y=h.useState(`isOpenedByTrigger`,g),b=h.useState(`triggerControlsId`,g),x=q.useRef(null),S=fz(),C=mv(!0),w=RS(),T=q.useMemo(()=>w??new PS,[w]),{registerTrigger:E,isMountedByThisTrigger:D}=PC(g,x,h,{payload:f,closeDelay:u,parent:S,floatingTreeRoot:T,floatingNodeId:zS(T),floatingParentNodeId:LS(),keyboardEventRelay:C?.relayKeyboardEvent}),O=S.type===`menubar`,k=h.useState(`disabled`),A=a||k||O&&S.context.disabled,{getButtonProps:j,buttonRef:M}=vv({disabled:A,native:o});q.useEffect(()=>{!y&&S.type===void 0&&(h.context.allowMouseUpTriggerRef.current=!1)},[h,y,S.type]);let N=q.useRef(null),P=iy(),F=Z(e=>{if(!N.current)return;P.clear(),h.context.allowMouseUpTriggerRef.current=!1;let t=e.target;Ey(N.current,t)||Ey(h.select(`positionerElement`),t)||t===N.current||(t==null||cz(t)!==h.select(`rootId`))&&(oz(e,N.current)||T.events.emit(`close`,{domEvent:e,reason:Ob}))});q.useEffect(()=>{let e=gv(N.current);if(y&&h.select(`lastOpenChangeReason`)===`trigger-hover`)return e.addEventListener(`mouseup`,F,{once:!0}),()=>{e.removeEventListener(`mouseup`,F)}},[y,F,h]);let I=O&&S.context.hasSubmenuOpen,L=yw(v,{enabled:(c??I)&&!A&&(!O||I&&!D),handleClose:Fw({blockPointerEvents:!O}),mouseOnly:!0,move:!1,restMs:S.type===void 0?l:void 0,delay:{close:u},triggerElementRef:x,externalTree:T,isActiveTrigger:_,isClosing:()=>h.select(`transitionStatus`)===`ending`}),R=dz(y,h.select(`lastOpenChangeReason`)),ee=QS(v,{enabled:!A,event:y&&O?`click`:`mousedown`,toggle:!0,ignoreMouse:!1,stickIfOpen:S.type===void 0&&R}),z=dw(v,{enabled:!A&&I}),te=lz({open:y,enabled:O,mouseDownAction:`open`}),B=q.useMemo(()=>Q_(z.reference,ee.reference),[z.reference,ee.reference]),ne=h.useState(`triggerProps`,D),V=h.useState(`filterTriggerProps`),{handlePreFocusGuardFocus:H,handleFocusTargetFocus:re}=NM(h,x),ie={disabled:A,open:y},ae=[N,t,M,E,x],oe=[B,L??Mv,ne,{"aria-haspopup":`menu`,"aria-controls":b,id:g,onMouseDown:e=>{h.select(`open`)||(P.start(200,()=>{h.context.allowMouseUpTriggerRef.current=!0}),gv(e.currentTarget).addEventListener(`mouseup`,F,{once:!0}))}},V,O?{role:`menuitem`}:{},te,p,j],se=Iv(`button`,e,{enabled:!O,stateAttributesMapping:Zy,state:ie,ref:ae,props:oe});return O?(0,J.jsx)(sM,{tag:`button`,render:n,className:r,style:i,state:ie,refs:ae,props:oe,stateAttributesMapping:Zy}):y?(0,J.jsxs)(q.Fragment,{children:[(0,J.jsx)(Xb,{ref:h.context.beforeTriggerFocusGuardRef,onFocus:H},`${g}-pre-focus-guard`),(0,J.jsx)(q.Fragment,{children:se},g),(0,J.jsx)(Xb,{ref:h.context.triggerFocusTargetRef,onFocus:re},`${g}-post-focus-guard`)]}):(0,J.jsx)(q.Fragment,{children:se},g)});function dz(e,t){let n=iy(),[r,i]=q.useState(!1);return Q(()=>{e&&t===`trigger-hover`?(i(!0),n.start(500,()=>{i(!1)})):e||(n.clear(),i(!1))},[e,t,n]),r}function fz(){let e=JR(!0);return q.useMemo(()=>e?{type:`menubar`,context:e}:{type:void 0},[e])}var pz=q.forwardRef(function(e,t){let{className:n,render:r,orientation:i=`horizontal`,style:a,...o}=e;return Iv(`div`,e,{state:{orientation:i},ref:t,props:[{role:`separator`,"aria-orientation":i},o]})});function mz(e){return typeof e==`object`&&!!e&&Array.isArray(e.items)}function hz(e){return mz(e?.[0])}function gz(e){return hz(e)?e.flatMap(e=>e.items):e}function _z(e){if(!Array.isArray(e))return e!=null&&`null`in e;let t=e;if(hz(t)){for(let e of t)for(let t of e.items)if(t&&t.value==null&&t.label!=null)return!0;return!1}for(let e of t)if(e&&e.value==null&&e.label!=null)return!0;return!1}function vz(e,t){if(t&&e!=null)return t(e)??``;if(e&&typeof e==`object`){if(`label`in e&&e.label!=null)return String(e.label);if(`value`in e)return String(e.value)}return aP(e)}function yz(e,t){return t&&e!=null?t(e)??``:e&&typeof e==`object`&&`value`in e&&`label`in e?aP(e.value):aP(e)}function bz(e,t,n){function r(){return vz(e,n)}if(n&&e!=null)return n(e);if(e&&typeof e==`object`&&`label`in e&&e.label!=null)return e.label;if(t&&!Array.isArray(t))return(Object.hasOwn(t,e)?t[e]:void 0)??r();if(Array.isArray(t)){let n=gz(t);if(typeof e!=`object`||!e){let t=n.find(t=>t.value===e);return t&&t.label!=null?t.label:r()}if(`value`in e){let t=n.find(t=>t&&t.value===e.value);if(t&&t.label!=null)return t.label}}return r()}function xz(e,t,n){return e.reduce((e,r,i)=>(i>0&&e.push(`, `),e.push((0,J.jsx)(q.Fragment,{children:bz(r,t,n)},i)),e),[])}function Sz({...e}){return(0,J.jsx)(iz,{"data-slot":`dropdown-menu`,...e})}function Cz({...e}){return(0,J.jsx)(uz,{"data-slot":`dropdown-menu-trigger`,...e})}function wz({align:e=`start`,alignOffset:t=0,side:n=`bottom`,sideOffset:r=4,className:i,...a}){return(0,J.jsx)(IR,{children:(0,J.jsx)(LR,{className:`isolate z-50 outline-none`,align:e,alignOffset:t,side:n,sideOffset:r,children:(0,J.jsx)(NR,{"data-slot":`dropdown-menu-content`,className:X(`z-50 max-h-(--available-height) w-(--anchor-width) min-w-32 origin-(--transform-origin) overflow-x-hidden overflow-y-auto rounded-xl bg-popover p-1 text-popover-foreground shadow-md ring-1 ring-foreground/10 duration-(--duration-fast) outline-none data-[side=bottom]:slide-in-from-top-2 data-[side=inline-end]:slide-in-from-left-2 data-[side=inline-start]:slide-in-from-right-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:overflow-hidden data-closed:fade-out-0 data-closed:zoom-out-95`,i),...a})})})}function Tz({...e}){return(0,J.jsx)(xR,{"data-slot":`dropdown-menu-group`,...e})}function Ez({className:e,inset:t,...n}){return(0,J.jsx)(SR,{"data-slot":`dropdown-menu-label`,"data-inset":t,className:X(`px-1.5 py-1 text-caption font-medium text-muted-foreground data-inset:pl-7`,e),...n})}function Dz({className:e,inset:t,variant:n=`default`,...r}){return(0,J.jsx)(wR,{"data-slot":`dropdown-menu-item`,"data-inset":t,"data-variant":n,className:X(`group/dropdown-menu-item relative flex cursor-default items-center gap-1.5 rounded-md px-1.5 py-1 text-ui -outline-offset-2 select-none focus:bg-accent focus:text-accent-foreground not-data-[variant=destructive]:focus:**:text-accent-foreground data-inset:pl-7 data-[variant=destructive]:text-destructive data-[variant=destructive]:focus:bg-destructive/10 data-[variant=destructive]:focus:text-destructive data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 data-[variant=destructive]:*:[svg]:text-destructive`,e),...r})}function Oz({className:e,children:t,checked:n,inset:r,...i}){return(0,J.jsxs)(gR,{"data-slot":`dropdown-menu-checkbox-item`,"data-inset":r,className:X(`relative flex cursor-default items-center gap-1.5 rounded-md py-1 pr-8 pl-1.5 text-ui -outline-offset-2 select-none focus:bg-accent focus:text-accent-foreground focus:**:text-accent-foreground data-inset:pl-7 data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4`,e),checked:n,...i,children:[(0,J.jsx)(`span`,{className:`pointer-events-none absolute right-2 flex items-center justify-center`,"data-slot":`dropdown-menu-checkbox-item-indicator`,children:(0,J.jsx)(_R,{children:(0,J.jsx)(Ih,{})})}),t]})}function kz({...e}){return(0,J.jsx)(VR,{"data-slot":`dropdown-menu-radio-group`,...e})}function Az({className:e,children:t,inset:n,...r}){return(0,J.jsxs)(GR,{"data-slot":`dropdown-menu-radio-item`,"data-inset":n,className:X(`relative flex cursor-default items-center gap-1.5 rounded-md py-1 pr-8 pl-1.5 text-ui -outline-offset-2 select-none focus:bg-accent focus:text-accent-foreground focus:**:text-accent-foreground data-inset:pl-7 data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4`,e),...r,children:[(0,J.jsx)(`span`,{className:`pointer-events-none absolute right-2 flex items-center justify-center`,"data-slot":`dropdown-menu-radio-item-indicator`,children:(0,J.jsx)(KR,{children:(0,J.jsx)(Ih,{})})}),t]})}function jz({className:e,...t}){return(0,J.jsx)(pz,{"data-slot":`dropdown-menu-separator`,className:X(`-mx-1 my-1 h-px bg-border`,e),...t})}var Mz=({option:e,noteId:t})=>(0,J.jsxs)(Az,{value:e.id,disabled:!e.available,"aria-describedby":e.available?void 0:t,children:[e.modelName,!e.measured&&(0,J.jsx)(`span`,{className:`rounded-full border px-1.5 text-caption text-muted-foreground`,children:`unmeasured`})]}),Nz=e=>{if(e.key===`Escape`||e.key===`Tab`||(e.stopPropagation(),e.key!==`ArrowDown`&&e.key!==`ArrowUp`))return;let t=[...e.currentTarget.closest(`[role="menu"]`)?.querySelectorAll(`[role="menuitemradio"]`)??[]],n=t.findIndex(t=>e.currentTarget.compareDocumentPosition(t)&Node.DOCUMENT_POSITION_FOLLOWING),r=e.key===`ArrowDown`?t[n]:t[(n===-1?t.length:n)-1];r!==void 0&&(e.preventDefault(),r.focus())},Pz=({first:e,options:t,separated:n,noteId:r,choice:i})=>{let[a,o]=(0,q.useState)(``),s=jL(t,i.chosen,i.defaultId),c=t.length-s.length,l=ML(t,s,a);return(0,J.jsxs)(Tz,{children:[n&&(0,J.jsx)(jz,{}),(0,J.jsxs)(Ez,{className:`flex flex-col gap-0.5`,children:[(0,J.jsx)(`span`,{className:`text-foreground`,children:e.available?e.via:e.providerName}),!e.available&&(0,J.jsx)(`span`,{id:r,className:`font-normal`,children:e.reason})]}),s.map(e=>(0,J.jsx)(Mz,{option:e,noteId:r},e.id)),c>0&&(0,J.jsx)(`div`,{className:`px-1.5 py-1`,children:(0,J.jsx)(EP,{value:a,onChange:e=>o(e.target.value),onKeyDown:Nz,placeholder:`Filter ${c} more models`,"aria-label":`Filter ${c} more models through ${e.via}`,className:`h-7`})}),l.map(e=>(0,J.jsx)(Mz,{option:e,noteId:r},e.id)),c>0&&a.trim()!==``&&l.length===0&&(0,J.jsx)(`p`,{className:`px-2 py-1.5 text-caption text-muted-foreground`,children:`No model matches`})]})},Fz=({choice:e,disabled:t,filled:n})=>{let r=(0,q.useId)();return(0,J.jsxs)(Sz,{children:[(0,J.jsx)(Cz,{render:(0,J.jsx)($,{variant:n?`default`:`outline`,size:`sm`,"data-slot":`model-menu`,disabled:t,"aria-label":e.chosen===null?`Choose a model`:`Model: ${e.chosen.modelName}`,className:X(`w-6 rounded-l-none px-0`,n?`border-l-primary-foreground/30`:`border-l-0`)}),children:(0,J.jsx)(Rh,{"aria-hidden":`true`})}),(0,J.jsx)(wz,{align:`end`,className:`w-80`,children:(0,J.jsx)(kz,{value:e.chosen?.id??null,onValueChange:t=>e.choose(t),children:AL(e.options).map(([t,n],i)=>(0,J.jsx)(Pz,{first:t,options:n,separated:i>0,noteId:`${r}-${i}`,choice:e},t.id))})})]})},Iz=e=>`${Math.floor(e/60)}:${String(e%60).padStart(2,`0`)}`,Lz=(e,t)=>{let[n,r]=(0,q.useState)(t);return(0,q.useEffect)(()=>{if(e===null)return;r(t());let n=setInterval(()=>r(t()),1e3);return()=>clearInterval(n)},[e,t]),e===null?0:Math.max(0,Math.round((n-e)/1e3))},Rz=({label:e,running:t,icon:n,variant:r=`outline`,choice:i,what:a=`Runs`,blocked:o=null,idle:s=null,run:c,now:l=Date.now,initial:u})=>{let d=(0,q.useId)(),[f,p]=(0,q.useState)(()=>u===void 0?{is:`idle`}:`runningSince`in u?{is:`running`,since:u.runningSince}:u.ok?{is:`done`,said:u.said}:{is:`failed`,...u}),m=Lz(f.is===`running`?f.since:null,l),{chosen:h,locked:g}=i,_=f.is===`running`,v=o??g,y=v??(h===null?null:`${a} ${h.modelName} through ${h.via}`),b=async()=>{p({is:`running`,since:l()});let e=await c(h?.id);p(e.ok?{is:`done`,said:e.said}:{is:`failed`,...e})};return(0,J.jsxs)(`div`,{"data-slot":`model-action`,className:`flex flex-wrap items-center gap-x-3 gap-y-1.5`,children:[(0,J.jsxs)(`span`,{className:`flex shrink-0 items-center`,children:[(0,J.jsxs)(UI,{disabled:y===null,children:[(0,J.jsxs)(WI,{render:(0,J.jsx)($,{variant:r,size:`sm`,disabled:_||v!==null||h===null,focusableWhenDisabled:!0,"aria-busy":_,"aria-describedby":y===null?void 0:`${d}-note`,onClick:()=>void b(),className:`rounded-r-none`}),children:[_?(0,J.jsx)(Og,{"aria-hidden":`true`,className:eI}):g!==null&&o===null?(0,J.jsx)(Ag,{"aria-hidden":`true`}):n,e]}),(0,J.jsxs)(GI,{side:`bottom`,align:`start`,children:[v!==null&&(0,J.jsx)(bg,{"aria-hidden":`true`,className:`size-3.5 shrink-0`}),y]})]}),(0,J.jsx)(Fz,{choice:i,disabled:_||i.options.length===0,filled:r==="default"&&v===null})]}),y!==null&&(0,J.jsx)(`span`,{id:`${d}-note`,hidden:!0,children:y}),(0,J.jsx)(`span`,{role:f.is===`failed`?`alert`:`status`,className:X(`flex min-w-0 flex-1 basis-56 flex-wrap items-center gap-x-2 text-caption`,f.is===`failed`?`text-destructive`:`text-muted-foreground`),children:f.is===`running`?(0,J.jsxs)(J.Fragment,{children:[t,` `,(0,J.jsx)(`span`,{className:`tabular`,children:Iz(m)})]}):f.is===`done`?f.said:f.is===`failed`?(0,J.jsxs)(J.Fragment,{children:[(0,J.jsxs)(`span`,{children:[(0,J.jsx)(n_,{"aria-hidden":`true`,className:`mr-1 inline size-3.5 align-[-2px]`}),f.message]}),(0,J.jsx)($,{variant:`link`,className:`h-6 min-w-6 px-1 text-caption`,onClick:()=>void b(),children:`Try again`})]}):s})]})};function zz(e){let t=q.useRef(!0);t.current&&(t.current=!1,e())}var Bz=q.createContext(void 0),Vz=q.createContext(void 0);function Hz(){let e=q.useContext(Bz);if(e===void 0)throw Error(fv(60));return e}function Uz(){let e=q.useContext(Vz);if(e===void 0)throw Error(fv(61));return e}function Wz(e,t,n=Object.is){let{length:r}=e;if(r!==t.length)return!1;for(let i=0;i<r;i+=1)if(!n(e[i],t[i]))return!1;return!0}var Gz=(e,t)=>Object.is(e,t);function Kz(e,t,n){return e==null||t==null?Object.is(e,t):n(e,t)}function qz(e,t,n){return Array.isArray(e)&&Array.isArray(t)?!Wz(e,t,(e,t)=>Kz(e,t,n)):e!==t}function Jz(e,t,n){return e?e.some(e=>e!==void 0&&Kz(t,e,n)):!1}function Yz(e,t,n){return e?e.findIndex(e=>e!==void 0&&Kz(e,t,n)):-1}function Xz(e,t){if(t!==Gz)return n=>Jz(e,n,t);let n=new Set(e);return n.delete(void 0),t=>n.has(t)&&(t!==0||e.some(e=>Object.is(t,e)))}function Zz(e,t,n,r){let i=r&&Array.isArray(t)?e.findIndex(Xz(t,n)):Yz(e,t,n);return i===-1?null:i}function Qz(e,t,n,r,i,a){return Jz(r,t,i)?a!=null&&e>a&&Jz(r,n[a],i)?a:e:e===a?Zz(n,r,i,!0):a}function $z(e,t,n){return e.filter(e=>!Kz(t,e,n))}var eB={id:e=>e.id,labelId:e=>e.labelId,modal:e=>e.modal,multiple:e=>e.multiple,disabled:e=>e.disabled,readOnly:e=>e.readOnly,required:e=>e.required,highlightItemOnHover:e=>e.highlightItemOnHover,items:e=>e.items,itemToStringLabel:e=>e.itemToStringLabel,isItemEqualToValue:e=>e.isItemEqualToValue,value:e=>e.value,hasSelectedValue:e=>{let{value:t,multiple:n,itemToStringValue:r}=e;return t==null?!1:n&&Array.isArray(t)?t.length>0:yz(t,r)!==``},hasNullItemLabel:(e,t)=>t?_z(e.items):!1,open:e=>e.open,mounted:e=>e.mounted,forceMount:e=>e.forceMount,transitionStatus:e=>e.transitionStatus,openMethod:e=>e.openMethod,activeIndex:e=>e.activeIndex,selectedIndex:e=>e.selectedIndex,isActive:(e,t)=>e.activeIndex===t,isSelected:(e,t)=>{let n=e.isItemEqualToValue,r=e.value;return e.multiple?Array.isArray(r)&&r.some(e=>Kz(t,e,n)):Kz(t,r,n)},isSelectedByFocus:(e,t)=>e.selectedIndex===t,popupProps:e=>e.popupProps,triggerProps:e=>e.triggerProps,itemRoot:e=>e.itemRoot,triggerElement:e=>e.triggerElement,positionerElement:e=>e.positionerElement,listElement:e=>e.listElement,popupSide:e=>e.popupSide,scrollUpArrowVisible:e=>e.scrollUpArrowVisible,scrollDownArrowVisible:e=>e.scrollDownArrowVisible,hasScrollArrows:e=>e.hasScrollArrows};function tB(e){let{id:t,value:n,defaultValue:r=null,onValueChange:i,open:a,defaultOpen:o=!1,onOpenChange:s,name:c,form:l,autoComplete:u,disabled:d=!1,readOnly:f=!1,required:p=!1,modal:m=!0,actionsRef:h,inputRef:g,onOpenChangeComplete:_,items:v,multiple:y=!1,itemToStringLabel:b,itemToStringValue:x,isItemEqualToValue:S=Gz,highlightItemOnHover:C=!0,children:w}=e,{clearErrors:T}=cP(),{setDirty:E,setTouched:D,setFocused:O,validityData:k,setFilled:A,name:j,disabled:M,validation:N,validationMode:P}=ZN(),F=iP({id:t}),I=M||d,L=j??c,[R,ee]=sO({controlled:n,default:y?r??jv:r,name:`Select`,state:`value`}),[z,te]=sO({controlled:a,default:o,name:`Select`,state:`open`}),B=q.useRef([]),ne=q.useRef([]),V=q.useRef(null),H=q.useRef(null),re=q.useRef(0),ie=q.useRef(null),ae=q.useRef([]),oe=q.useRef(!1),se=q.useRef(null),U=q.useRef(null),ce=q.useRef({allowSelectedMouseUp:!1,allowUnselectedMouseUp:!1,dragY:0}),le=q.useRef(!1),ue=q.useRef(R),{openMethod:de,triggerProps:fe}=dj(z),pe=G_(()=>new QC({id:F,labelId:void 0,modal:m,multiple:y,disabled:I,readOnly:f,required:p,highlightItemOnHover:C,itemToStringLabel:b,itemToStringValue:x,isItemEqualToValue:S,value:R,open:z,mounted:z,transitionStatus:void 0,items:v,forceMount:!1,openMethod:null,activeIndex:null,selectedIndex:null,popupProps:Mv,triggerProps:Mv,itemRoot:{props:Mv,multiple:y,disabled:I,readOnly:f,isItemEqualToValue:S},triggerElement:null,positionerElement:null,listElement:null,popupSide:null,scrollUpArrowVisible:!1,scrollDownArrowVisible:!1,hasScrollArrows:!1},{setValue:Av,setOpen:Av,handleScrollArrowVisibility:Av,onOpenChangeComplete:Av,listRef:B,popupRef:V,scrollHandlerRef:H,scrollArrowsMountedCountRef:re,valueRef:ie,valuesRef:ae,labelsRef:ne,typingRef:oe,selectionRef:ce,firstItemTextRef:se,selectedItemTextRef:U,alignItemWithTriggerActiveRef:le,initialValueRef:ue},eB)).current,[me,he]=q.useState(!1),{mounted:ge,transitionStatus:_e,forceUnmount:ve}=wC({open:z,ref:V,preventUnmountOnClose:me,setPreventUnmountOnClose:he,onUnmount(){pe.update({activeIndex:null,openMethod:null,scrollUpArrowVisible:!1,scrollDownArrowVisible:!1}),_?.(!1)}}),ye=pe.useState(`activeIndex`),be=pe.useState(`selectedIndex`),xe=pe.useState(`triggerElement`),Se=pe.useState(`positionerElement`),Ce=OE(de),we=de??Ce,Te=q.useMemo(()=>y?``:yz(R,x),[y,R,x]),Ee=q.useMemo(()=>y&&Array.isArray(R)?R.map(e=>yz(e,x)):yz(R,x),[y,R,x]);oP(Vb(xe),F,R,Z(()=>Ee),!I,c);let De=y?Array.isArray(R)&&R.length>0:R!=null&&Te!==``;Q(()=>{A(De)},[De,A]),Q(function(){let e=Zz(ae.current,R,S,y);e===null&&(U.current=null),!z&&pe.set(`selectedIndex`,e)},[y,z,R,S,pe]),lj(R,()=>{T(L),E(qz(R,k.initialValue,S)),N.change(R)});let Oe=Z((e,t)=>{let n=t,r=MC(n);s?.(e,n),!t.isCanceled&&(e||he(r()),te(e),!e&&(t.reason===`focus-out`||t.reason===`outside-press`)&&(D(!0),O(!1),P===`onBlur`&&N.commit(R)))});q.useImperativeHandle(h,()=>({unmount:ve,close:()=>{pe.state.open&&Oe(!1,mb(Nb))}}),[ve,Oe,pe]);let ke=Z((e,t)=>{i?.(e,t),!t.isCanceled&&ee(e)}),Ae=Z(e=>{let t=ZP(e.scrollHeight,e.clientHeight),n=QP(e.scrollTop,t),r=n>0,i=n<t;pe.set(`scrollUpArrowVisible`,r),pe.set(`scrollDownArrowVisible`,i)}),je=lw({open:z,onOpenChange:Oe,elements:{reference:xe,floating:Se}}),Me=QS(je,{enabled:!I,event:`mousedown`}),Ne=iC(je),Pe=Ew(je,{enabled:!I,listRef:B,activeIndex:ye,selectedIndex:be,disabledIndices:jv,onNavigate(e){(e!==null||z)&&pe.set(`activeIndex`,e)},focusItemOnHover:C}),Fe=Dw(je,{enabled:!I&&(z||!f&&!y),listRef:ne,activeIndex:ye,selectedIndex:be,disabledIndices:e=>IO(B.current[e]),onMatch(e){z?pe.set(`activeIndex`,e):ke(ae.current[e],mb(gb))},onTyping(e){oe.current=e}}),Ie=q.useMemo(()=>Q_(Fe.reference,Pe.reference,Ne.reference,Me.reference,fe),[Me.reference,Fe.reference,Pe.reference,Ne.reference,fe]),Le=q.useMemo(()=>Q_(TC,Fe.floating,Pe.floating,Ne.floating),[Fe.floating,Pe.floating,Ne.floating]),Re=Pe.item??Mv,ze=q.useMemo(()=>({props:Re,multiple:y,disabled:I,readOnly:f,isItemEqualToValue:S}),[Re,y,I,f,S]);pe.useContextCallback(`setValue`,ke),pe.useContextCallback(`setOpen`,Oe),pe.useContextCallback(`handleScrollArrowVisibility`,Ae),pe.useContextCallback(`onOpenChangeComplete`,_),zz(()=>{pe.update({popupProps:Le,triggerProps:Ie,itemRoot:ze})}),pe.useSyncedValues({id:F,modal:m,multiple:y,disabled:I,readOnly:f,required:p,highlightItemOnHover:C,value:R,open:z,mounted:ge,transitionStatus:_e,popupProps:Le,triggerProps:Ie,itemRoot:ze,items:v,itemToStringLabel:b,itemToStringValue:x,isItemEqualToValue:S,openMethod:we});let Be=xv(g,N.inputRef),Ve=y?void 0:L,He=q.useMemo(()=>!y||!Array.isArray(R)||!L?null:R.map(e=>{let t=yz(e,x);return(0,J.jsx)(`input`,{type:`hidden`,form:l,name:L,value:t,disabled:I},t)}),[y,R,l,L,x,I]);return(0,J.jsxs)(Bz.Provider,{value:pe,children:[(0,J.jsx)(Vz.Provider,{value:je,children:w}),(0,J.jsx)(`input`,{...N.getValidationProps(I,{onFocus(){pe.state.triggerElement?.focus({focusVisible:!0})},onChange(e){if(e.nativeEvent.defaultPrevented||I||f)return;let t=e.currentTarget.value,n=mb(gb,e.nativeEvent);function r(){if(y)return;let e=t.toLowerCase(),r=ae.current.findIndex(t=>yz(t,x).toLowerCase()===e||vz(t,b).toLowerCase()===e);r===-1&&(r=ae.current.findIndex((t,n)=>{let r=ne.current[n];return r!=null&&r.toLowerCase()===e}));let i=ae.current[r];i!=null&&ke(i,n)}pe.set(`forceMount`,!0),queueMicrotask(r)}}),id:F&&Ve==null?`${F}-hidden-input`:void 0,form:l,name:Ve,autoComplete:u,value:Te,disabled:I,required:p&&!(y&&De),readOnly:f,ref:Be,style:L?Yb:Jb,tabIndex:-1,"aria-hidden":!0,suppressHydrationWarning:!0}),He]})}function nB(e,t){return e??t}var rB=`data-popup-side`,iB=400,aB={...Zy,...JN,popupSide:e=>e?{[rB]:e}:null,value:()=>null},oB=q.forwardRef(function(e,t){let{render:n,className:r,id:i,disabled:a=!1,nativeButton:o=!0,style:s,...c}=e,{setTouched:l,validationMode:u,validation:d,state:f,disabled:p}=ZN(),{labelId:m}=eP(),h=Hz(),g=h.useState(`readOnly`),_=h.useState(`required`),v=h.useState(`disabled`),y=p||v||a,b=h.useState(`open`),x=h.useState(`mounted`),S=h.useState(`value`),C=h.useState(`triggerProps`),w=h.useState(`positionerElement`),T=h.useState(`listElement`),E=h.useState(`popupSide`),D=h.useState(`id`),O=h.useState(`labelId`),k=h.useState(`hasSelectedValue`),A=x&&w?E:null,j=i??D,M=nB(m,O);iP({id:i});let N=Vb(w),P=q.useRef(null),F=QN(y,P),{getButtonProps:I,buttonRef:L}=vv({disabled:y,native:o}),R=h.useStateSetter(`triggerElement`),ee=iy(),z=iy(),te=iy();q.useEffect(()=>{if(b)return te.start(iB,()=>{h.context.selectionRef.current.allowUnselectedMouseUp=!0,h.context.selectionRef.current.allowSelectedMouseUp=!0}),()=>{te.clear()};h.context.selectionRef.current={allowSelectedMouseUp:!1,allowUnselectedMouseUp:!1,dragY:0},z.clear()},[b,h,z,te]);let B=Q_(C,{id:j,role:`combobox`,"aria-expanded":b,"aria-haspopup":`listbox`,"aria-controls":b?T?.id??cb(w)?.id:void 0,"aria-labelledby":M,"aria-readonly":g||void 0,"aria-required":_||void 0,tabIndex:y?-1:0,onFocus(e){F(!0),b&&h.context.alignItemWithTriggerActiveRef.current&&h.context.setOpen(!1,mb(gb,e.nativeEvent)),ee.start(0,()=>{h.set(`forceMount`,!0)})},onBlur(e){Ey(w,e.relatedTarget)||(l(!0),F(!1),u===`onBlur`&&d.commit(S))},onMouseDown(e){if(b)return;let t=gv(e.currentTarget);function n(e){if(!P.current)return;let t=e.target;Ey(P.current,t)||Ey(N.current,t)||oz(e,P.current)||h.context.setOpen(!1,mb(Ob,e))}z.start(0,()=>{t.addEventListener(`mouseup`,n,{once:!0})})}},c,I),ne=d.getValidationProps(y,B);ne.role=`combobox`;let V={...f,open:b,disabled:y,value:S,readOnly:g,popupSide:A,placeholder:!k};return Iv(`button`,e,{ref:[t,P,L,R],state:V,stateAttributesMapping:aB,props:ne})}),sB={value:()=>null},cB=q.forwardRef(function(e,t){let{className:n,render:r,children:i,placeholder:a,style:o,...s}=e,c=Hz(),l=c.useState(`value`),u=c.useState(`items`),d=c.useState(`itemToStringLabel`),f=c.useState(`hasSelectedValue`),p=!f&&a!=null&&i==null,m=c.useState(`hasNullItemLabel`,p),h={value:l,placeholder:!f},g=null;return g=typeof i==`function`?i(l):i??(p&&!m?a:Array.isArray(l)?xz(l,u,d):bz(l,u,d)),Iv(`span`,e,{state:h,ref:[t,c.context.valueRef],props:[{children:g},s],stateAttributesMapping:sB})}),lB=q.forwardRef(function(e,t){let{render:n,className:r,style:i,...a}=e;return Iv(`span`,e,{state:{open:Hz().useState(`open`)},ref:t,props:[{"aria-hidden":!0,children:`▼`},a],stateAttributesMapping:Xy})}),uB=q.forwardRef(function(e,t){let n=Hz(),r=n.useState(`mounted`),i=n.useState(`forceMount`);return r||i?(0,J.jsx)(MS,{ref:t,...e}):null}),dB=q.createContext(void 0);function fB(){let e=q.useContext(dB);if(!e)throw Error(fv(59));return e}function pB(e,t){e&&Object.assign(e.style,t)}var mB={position:`relative`,maxHeight:`100%`,overflowX:`hidden`,overflowY:`auto`},hB={position:`fixed`},gB=q.forwardRef(function(e,t){let{anchor:n,className:r,render:i,positionMethod:a,side:o,align:s,sideOffset:c,alignOffset:l,collisionBoundary:u=`clipping-ancestors`,collisionPadding:d,arrowPadding:f,sticky:p,disableAnchorTracking:m,alignItemWithTrigger:h=!0,collisionAvoidance:g=wS,style:_,...v}=e,y=Hz(),b=Uz(),x=y.useState(`open`),S=y.useState(`mounted`),C=y.useState(`modal`),w=y.useState(`value`),T=y.useState(`openMethod`),E=y.useState(`positionerElement`),D=y.useState(`triggerElement`),O=y.useState(`isItemEqualToValue`),k=y.useState(`transitionStatus`),A=q.useRef(null),j=q.useRef(null),[M,N]=q.useState(h),P=S&&M&&T!==`touch`;!S&&M!==h&&N(h),q.useImperativeHandle(y.context.alignItemWithTriggerActiveRef,()=>P),HM((P||C)&&x,T===`touch`,E,D);let F=bE({anchor:n,floatingRootContext:b,positionMethod:a,mounted:S,side:o,sideOffset:c,align:s,alignOffset:l,arrowPadding:f,collisionBoundary:u,collisionPadding:d,sticky:p,disableAnchorTracking:m??P,collisionAvoidance:g,keepMounted:!0}),I=P?`none`:F.side,L=P?hB:F.positionerStyles,R={open:x,side:I,align:F.align,anchorHidden:F.anchorHidden};Q(()=>{y.set(`popupSide`,F.side)},[y,F.side]);let ee=wE(e,R,{styles:L,transitionStatus:k,props:v,refs:[t,y.useStateSetter(`positionerElement`)],hidden:!S,inert:!x}),z=q.useRef(0),te=Z(e=>{if(y.context.valuesRef.current.length===0)return;let t=z.current;z.current=e.size;let n=mb(gb);if(t!==0&&!y.state.multiple&&w!==null&&Yz(y.context.valuesRef.current,w,O)===-1){let e=y.context.initialValueRef.current,t=e!=null&&Yz(y.context.valuesRef.current,e,O)!==-1?e:null;y.context.setValue(t,n),t===null&&(y.set(`selectedIndex`,null),y.context.selectedItemTextRef.current=null)}if(t!==0&&y.state.multiple&&Array.isArray(w)){let e=w.filter(e=>Yz(y.context.valuesRef.current,e,O)!==-1);e.length!==w.length&&(y.context.setValue(e,n),e.length===0&&(y.set(`selectedIndex`,null),y.context.selectedItemTextRef.current=null))}if(x&&P){y.update({scrollUpArrowVisible:!1,scrollDownArrowVisible:!1});let e={height:``};pB(E,e),pB(y.context.popupRef.current,e)}}),B=q.useMemo(()=>({...F,side:I,alignItemWithTriggerActive:P,setControlledAlignItemWithTrigger:N,scrollUpArrowRef:A,scrollDownArrowRef:j}),[F,I,P,N]);return(0,J.jsx)(uO,{elementsRef:y.context.listRef,labelsRef:y.context.labelsRef,onMapChange:te,children:(0,J.jsxs)(dB.Provider,{value:B,children:[S&&C&&(0,J.jsx)(VA,{inert:DE(!x),cutout:D}),ee]})})}),_B=`--transform-origin`,vB={...Qy,...zy},yB=q.forwardRef(function(e,t){let{render:n,className:r,style:i,finalFocus:a,...o}=e,s=Hz(),c=s.useState(`multiple`),l=s.useState(`readOnly`),u=s.useState(`highlightItemOnHover`),d=Uz(),{side:f,align:p,alignItemWithTriggerActive:m,isPositioned:h,setControlledAlignItemWithTrigger:g}=fB(),_=uM(!0)!=null,v=oE(),{nonce:y,disableStyleElements:b}=MO(),x=s.useState(`id`),S=s.useState(`open`),C=s.useState(`openMethod`),w=s.useState(`mounted`),T=s.useState(`popupProps`),E=s.useState(`transitionStatus`),D=s.useState(`triggerElement`),O=s.useState(`positionerElement`),k=s.useState(`listElement`),A=q.useRef(!1),j=q.useRef(!1),M=q.useRef({}),N=Kb(),P=Z(e=>{if(!O||!s.context.popupRef.current||!j.current)return;let t=O.style.top===`0px`,n=O.style.bottom===`0px`;if(A.current||!m||!t&&!n){s.context.handleScrollArrowVisibility(e);return}let r=SB(O),i=CB(O.getBoundingClientRect().height,`y`,r),a=gv(O),o=b_(O),c=o.getComputedStyle(O),l=parseFloat(c.marginTop),u=parseFloat(c.marginBottom),d=bB(o.getComputedStyle(s.context.popupRef.current)),f=Math.min(a.documentElement.clientHeight-l-u,d),p=e.scrollTop,h=xB(e),g=null,_=e=>{O.style.height=`${e}px`},v=t?h-p:p,y=Math.min(i+v,f);if(v<=1){let n=YP(v,0,f-i);n>0&&_(i+n),e.scrollTop=t?h:0,f-(i+n)<=1&&(A.current=!0),s.context.handleScrollArrowVisibility(e);return}f-y>1?g=t?1/0:0:n&&p<h&&(g=p-(v-(i+v-f)));let b=Math.ceil(y);if(b!==0&&_(b),g!=null){let t=YP(g,0,xB(e));Math.abs(e.scrollTop-t)>1&&(e.scrollTop=t)}b>=f-1&&(A.current=!0),s.context.handleScrollArrowVisibility(e)});q.useImperativeHandle(s.context.scrollHandlerRef,()=>P,[P]),CC({open:S,ref:s.context.popupRef,onComplete(){S&&s.context.onOpenChangeComplete(!0)}});let F={open:S,transitionStatus:E,side:f,align:p};Q(()=>{O&&s.context.popupRef.current&&!Object.keys(M.current).length&&(M.current={top:O.style.top||`0`,left:O.style.left||`0`,right:O.style.right,height:O.style.height,bottom:O.style.bottom,minHeight:O.style.minHeight,maxHeight:O.style.maxHeight,marginTop:O.style.marginTop,marginBottom:O.style.marginBottom})},[s,O]),Q(()=>{S||m||(j.current=!1,A.current=!1,pB(O,M.current))},[S,m,O]),Q(()=>{let e=s.context.popupRef.current;if(!S||!D||!O||!e||m&&!h||s.state.transitionStatus===`ending`)return;if(j.current=!0,e.style.removeProperty(_B),!m){N.request(()=>s.context.handleScrollArrowVisibility(k||e));return}let t=EB(e);try{let t=s.context.selectedItemTextRef.current;t?.isConnected||(t=!s.select(`hasSelectedValue`)&&s.context.firstItemTextRef.current?.isConnected?s.context.firstItemTextRef.current:null);let n=s.context.valueRef.current,r=b_(O),i=r.getComputedStyle(O),a=r.getComputedStyle(e),o=gv(D),c=SB(D),l=wB(D.getBoundingClientRect(),c),d=wB(O.getBoundingClientRect(),c),f=l.height,p=k||e,m=p.scrollHeight,h=parseFloat(a.borderBottomWidth),_=parseFloat(i.marginTop)||10,y=parseFloat(i.marginBottom)||10,b=parseFloat(i.minHeight)||100,x=bB(a),S=o.documentElement.clientHeight-_-y,C=o.documentElement.clientWidth,w=S-l.bottom+f,T,E=v===`rtl`?l.right-d.width:l.left,j=0;if(t&&n){let e=wB(n.getBoundingClientRect(),c);T=wB(t.getBoundingClientRect(),c),E=d.left+(v===`rtl`?e.right-T.right:e.left-T.left);let r=e.top-l.top+e.height/2;j=T.top-d.top+T.height/2-r}let N=w+j+y+h,P=Math.min(S,N),F=S-_-y,I=N-P,L=C-5;O.style.left=`${YP(E,5,L-d.width)}px`,O.style.height=`${P}px`,O.style.maxHeight=`none`,O.style.marginTop=`${_}px`,O.style.marginBottom=`${y}px`,e.style.height=`100%`;let R=xB(p),ee=I>=R-1;ee&&(P=Math.min(S,d.height)-(I-R));let z=l.top<20||l.bottom>S-20||Math.ceil(P)+1<Math.min(m,b),te=(r.visualViewport?.scale??1)!==1&&gy;if(z||te){pB(O,M.current),g(!1);return}let B=Math.max(b,P);if(ee){let e=Math.max(0,S-N);O.style.top=d.height>=F?`0`:`${e}px`,O.style.height=`${P}px`,p.scrollTop=xB(p)}else O.style.bottom=`0`,p.scrollTop=I;if(T){let t=d.top,n=d.height,r=T.top+T.height/2,i=YP(n>0?(r-t)/n*100:50,0,100);e.style.setProperty(_B,`50% ${i}%`)}(B===S||P>=x)&&(A.current=!0),s.context.handleScrollArrowVisibility(p),u&&s.state.selectedIndex===null&&s.state.activeIndex===null&&s.context.listRef.current[0]!=null&&s.set(`activeIndex`,0)}finally{t()}},[s,S,O,D,m,g,N,k,u,v,h]),q.useEffect(()=>{if(!m||!O||!S)return;let e=b_(O);function t(e){s.context.setOpen(!1,mb(Pb,e))}return zb(e,`resize`,t)},[s,m,O,S]);let I={...k?{role:`presentation`}:{role:`listbox`,"aria-multiselectable":c||void 0,"aria-readonly":l||void 0,id:`${x}-list`},onKeyDown(e){_&&VO.has(e.key)&&e.stopPropagation()},onScroll(e){k||P(e.currentTarget)},...m&&{style:k?{height:`100%`}:mB},className:!k&&m?jP.className:void 0},L=Iv(`div`,e,{ref:[t,s.context.popupRef],state:F,stateAttributesMapping:vB,props:[T,I,CE(E),o]});return(0,J.jsxs)(q.Fragment,{children:[!b&&jP.getElement(y),(0,J.jsx)(ZS,{context:d,modal:!1,disabled:!w,openInteractionType:C,returnFocus:a,restoreFocus:!0,children:L})]})});function bB(e){let t=e.maxHeight;return t.endsWith(`px`)&&parseFloat(t)||1/0}function xB(e){return ZP(e.scrollHeight,e.clientHeight)}function SB(e){return vT.getScale(e)}function CB(e,t,n){return e/n[t]}function wB(e,t){return Cx({x:CB(e.x,`x`,t),y:CB(e.y,`y`,t),width:CB(e.width,`x`,t),height:CB(e.height,`y`,t)})}var TB=[[`transform`,`none`],[`scale`,`1`],[`translate`,`0 0`]];function EB(e){let{style:t}=e,n={};for(let[e,r]of TB)n[e]=t.getPropertyValue(e),t.setProperty(e,r,`important`);return()=>{for(let[e]of TB){let r=n[e];r?t.setProperty(e,r):t.removeProperty(e)}}}var DB=q.forwardRef(function(e,t){let{render:n,className:r,style:i,...a}=e,o=Hz(),s=o.useState(`multiple`),c=o.useState(`readOnly`),{alignItemWithTriggerActive:l}=fB(),u=o.useState(`hasScrollArrows`),d=o.useState(`openMethod`),f={id:`${o.useState(`id`)}-list`,role:`listbox`,"aria-multiselectable":s||void 0,"aria-readonly":c||void 0,onScroll(e){o.context.scrollHandlerRef.current?.(e.currentTarget)},...l&&{style:mB},className:u&&d!==`touch`?jP.className:void 0};return Iv(`div`,e,{ref:[t,o.useStateSetter(`listElement`)],props:[f,a]})}),OB=q.createContext(void 0);function kB(){let e=q.useContext(OB);if(!e)throw Error(fv(57));return e}var AB=q.memo(q.forwardRef(function(e,t){let{render:n,className:r,style:i,value:a=null,label:o,disabled:s=!1,nativeButton:c=!1,...l}=e,u=q.useRef(null),d=TO({guess:!0,label:o,textRef:u}),f=Hz(),{props:p,multiple:m,disabled:h,readOnly:g,isItemEqualToValue:_}=f.useState(`itemRoot`),v=h||s,y=f.useState(`isActive`,d.index),b=f.useState(`open`),x=f.useState(`isSelected`,a),S=f.useState(`isSelectedByFocus`,d.index),C=d.index,w=q.useRef(null);Q(()=>{let e=f.context.valuesRef.current;return e[C]=a,()=>{delete e[C]}},[C,a,f]),Q(()=>{let e=f.state.value,t=f.state.selectedIndex,n=t,r;m&&Array.isArray(e)?(n=Qz(C,a,f.context.valuesRef.current,e,_,t),r=n===C,C===t&&!r&&(f.context.selectedItemTextRef.current=null)):(r=e!==void 0&&Kz(a,e,_),r&&(n=C)),f.set(`selectedIndex`,n),r&&u.current&&(f.context.selectedItemTextRef.current=u.current)},[C,m,_,f,a]);let T=q.useRef(`mouse`),E=q.useRef(!1),{getButtonProps:D,buttonRef:O}=vv({disabled:v,focusableWhenDisabled:!0,native:c,composite:!0}),k={disabled:v,selected:x,highlighted:y};function A(e){if(h||g)return;let t=f.state.value;if(m){let n=Array.isArray(t)?t:[],r=x?$z(n,a,_):[...n,a];f.context.setValue(r,mb(xb,e))}else f.context.setValue(a,mb(xb,e)),f.context.setOpen(!1,mb(xb,e))}function j(){f.context.selectionRef.current.dragY=0}let M={role:`option`,"aria-selected":x,tabIndex:b&&y?0:-1,onKeyDown(e){f.set(`activeIndex`,C),e.key===` `&&f.context.typingRef.current&&e.preventDefault()},onClick(e){let t=T.current!==`touch`,n=e.nativeEvent.pointerType,r=t&&xy(e.nativeEvent)&&(n!==void 0||y),i=t&&!r&&!E.current;E.current=!1,!(v||i)&&A(e.nativeEvent)},onPointerEnter(e){T.current=e.pointerType},onPointerMove(e){if(e.pointerType===`mouse`&&e.buttons===1){let t=f.context.selectionRef.current;t.dragY+=e.movementY,t.dragY**2>=64&&(t.allowUnselectedMouseUp=!0)}},onPointerDown(e){T.current=e.pointerType,E.current=!0,j()},onMouseUp(){if(j(),v||T.current===`touch`||E.current)return;let e=!f.context.selectionRef.current.allowSelectedMouseUp&&x,t=!f.context.selectionRef.current.allowUnselectedMouseUp&&!x;e||t||(E.current=!0,w.current?.click(),E.current=!1)}},N=Iv(`div`,e,{ref:[O,t,d.ref,w],state:k,props:[p,M,l,D]}),P=q.useMemo(()=>({selected:x,index:C,textRef:u,selectedByFocus:S}),[x,C,u,S]);return(0,J.jsx)(OB.Provider,{value:P,children:N})})),jB=q.memo(q.forwardRef(function(e,t){let{render:n,className:r,style:i,keepMounted:a,selected:o,...s}=e,c=q.useRef(null),{transitionStatus:l,setMounted:u}=vC(o),d=Iv(`span`,e,{ref:[t,c],state:{selected:o,transitionStatus:l},props:[{"aria-hidden":!0,children:`✔️`},s],stateAttributesMapping:zy});return CC({batch:!0,enabled:!o,open:o,ref:c,onComplete(){o||u(!1)}}),d})),MB=q.forwardRef(function(e,t){let{selected:n}=kB();return e.keepMounted||n?(0,J.jsx)(jB,{...e,selected:n,ref:t}):null}),NB=q.memo(q.forwardRef(function(e,t){let{index:n,textRef:r,selectedByFocus:i}=kB(),a=Hz(),{render:o,className:s,style:c,...l}=e;return Iv(`div`,e,{ref:[q.useCallback(e=>{e&&(n===0&&(a.context.firstItemTextRef.current=e),i&&(a.context.selectedItemTextRef.current=e))},[a,n,i]),t,r],props:l})})),PB=q.forwardRef(function(e,t){let{render:n,className:r,style:i,direction:a,keepMounted:o,...s}=e,c=a===`up`,l=Hz(),{side:u,scrollDownArrowRef:d,scrollUpArrowRef:f}=fB(),p=c?`scrollUpArrowVisible`:`scrollDownArrowVisible`,m=l.useState(p),h=l.useState(`openMethod`),g=m&&h!==`touch`,_=iy(),v=c?f:d,{mounted:y,transitionStatus:b,setMounted:x}=vC(g);Q(()=>(l.context.scrollArrowsMountedCountRef.current+=1,l.set(`hasScrollArrows`,!0),()=>{l.context.scrollArrowsMountedCountRef.current=Math.max(0,l.context.scrollArrowsMountedCountRef.current-1),l.context.scrollArrowsMountedCountRef.current===0&&l.set(`hasScrollArrows`,!1)}),[l]),CC({open:g,ref:v,onComplete(){g||x(!1)}});let S=Iv(`div`,e,{ref:[t,v],state:{direction:a,visible:g,side:u,transitionStatus:b},props:[{"aria-hidden":!0,children:c?`▲`:`▼`,style:{position:`absolute`},onMouseMove(e){if(e.movementX===0&&e.movementY===0||_.isStarted())return;l.set(`activeIndex`,null);function t(){let e=l.state.listElement??l.context.popupRef.current;if(!e)return;l.set(`activeIndex`,null),l.context.handleScrollArrowVisibility(e);let n=ZP(e.scrollHeight,e.clientHeight),r=QP(e.scrollTop,n),i=r===(c?0:n),a=l.context.listRef.current;if(r!==e.scrollTop&&(e.scrollTop=r),i)_.clear();else{if(a.length>0){let t=v.current?.offsetHeight||0;e.scrollTop=FB(a,c,r,e.clientHeight,t,n)}_.start(40,t)}}_.start(40,t)},onMouseLeave(){_.clear()}},s],stateAttributesMapping:zy});return y||o?S:null});function FB(e,t,n,r,i,a){if(t){let t=0,r=n+i-1;for(let n=0;n<e.length;n+=1){let i=e[n];if(i&&i.offsetTop>=r){t=n;break}}let o=Math.max(0,t-1),s=e[o];return o<t&&s?QP(s.offsetTop-i,a):0}let o=e.length-1,s=n+r-i+1;for(let t=0;t<e.length;t+=1){let n=e[t];if(n&&n.offsetTop+n.offsetHeight>s){o=Math.max(0,t-1);break}}let c=Math.min(e.length-1,o+1),l=e[c];return c>o&&l?QP(l.offsetTop+l.offsetHeight-r+i,a):a}var IB=q.forwardRef(function(e,t){return(0,J.jsx)(PB,{...e,ref:t,direction:`down`})}),LB=q.forwardRef(function(e,t){return(0,J.jsx)(PB,{...e,ref:t,direction:`up`})}),RB=tB;function zB({className:e,...t}){return(0,J.jsx)(cB,{"data-slot":`select-value`,className:X(`flex flex-1 text-left`,e),...t})}function BB({className:e,size:t=`default`,children:n,...r}){return(0,J.jsxs)(oB,{"data-slot":`select-trigger`,"data-size":t,className:X(`flex w-fit items-center justify-between gap-1.5 rounded-md border border-input bg-transparent py-2 pr-2 pl-2.5 text-ui whitespace-nowrap transition-colors select-none disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 data-placeholder:text-muted-foreground data-[size=default]:h-8 data-[size=sm]:h-7 *:data-[slot=select-value]:line-clamp-1 *:data-[slot=select-value]:flex *:data-[slot=select-value]:items-center *:data-[slot=select-value]:gap-1.5 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4`,e),...r,children:[n,(0,J.jsx)(lB,{render:(0,J.jsx)(Rh,{className:`pointer-events-none size-4 text-muted-foreground`})})]})}function VB({className:e,children:t,side:n=`bottom`,sideOffset:r=4,align:i=`center`,alignOffset:a=0,alignItemWithTrigger:o=!0,...s}){return(0,J.jsx)(uB,{children:(0,J.jsx)(gB,{side:n,sideOffset:r,align:i,alignOffset:a,alignItemWithTrigger:o,className:`isolate z-50`,children:(0,J.jsxs)(yB,{"data-slot":`select-content`,"data-align-trigger":o,className:X(`relative isolate z-50 max-h-(--available-height) w-(--anchor-width) min-w-36 origin-(--transform-origin) overflow-x-hidden overflow-y-auto rounded-xl bg-popover text-popover-foreground shadow-md ring-1 ring-foreground/10 duration-(--duration-fast) data-[align-trigger=true]:animate-none data-[side=bottom]:slide-in-from-top-2 data-[side=inline-end]:slide-in-from-left-2 data-[side=inline-start]:slide-in-from-right-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95`,e),...s,children:[(0,J.jsx)(UB,{}),(0,J.jsx)(DB,{children:t}),(0,J.jsx)(WB,{})]})})})}function HB({className:e,children:t,...n}){return(0,J.jsxs)(AB,{"data-slot":`select-item`,className:X(`relative flex w-full cursor-default items-center gap-1.5 rounded-md py-1 pr-8 pl-1.5 text-ui -outline-offset-2 select-none focus:bg-accent focus:text-accent-foreground not-data-[variant=destructive]:focus:**:text-accent-foreground data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 *:[span]:last:flex *:[span]:last:items-center *:[span]:last:gap-2`,e),...n,children:[(0,J.jsx)(NB,{className:`flex flex-1 shrink-0 gap-2 whitespace-nowrap`,children:t}),(0,J.jsx)(MB,{render:(0,J.jsx)(`span`,{className:`pointer-events-none absolute right-2 flex size-4 items-center justify-center`}),children:(0,J.jsx)(Ih,{className:`pointer-events-none`})})]})}function UB({className:e,...t}){return(0,J.jsx)(LB,{"data-slot":`select-scroll-up-button`,className:X(`top-0 z-10 flex w-full cursor-default items-center justify-center bg-popover py-1 [&_svg:not([class*='size-'])]:size-4`,e),...t,children:(0,J.jsx)(Wh,{})})}function WB({className:e,...t}){return(0,J.jsx)(IB,{"data-slot":`select-scroll-down-button`,className:X(`bottom-0 z-10 flex w-full cursor-default items-center justify-center bg-popover py-1 [&_svg:not([class*='size-'])]:size-4`,e),...t,children:(0,J.jsx)(Rh,{})})}var GB={"look-for":{label:`Look for`,icon:Wg,className:`border-diff-hunk-fg/25 bg-diff-hunk-bg text-diff-hunk-fg`},"dont-flag":{label:`Don't flag`,icon:ng,className:`border-border bg-muted text-muted-foreground`}},KB=({kind:e,className:t})=>{let{label:n,icon:r,className:i}=GB[e];return(0,J.jsxs)(`span`,{"data-slot":`preference-kind`,"data-kind":e,className:X(`inline-flex h-5 shrink-0 items-center gap-1 rounded-full border px-2 text-caption font-medium whitespace-nowrap`,i,t),children:[(0,J.jsx)(r,{"aria-hidden":`true`,className:`size-3`}),n]})},qB={written:`written`,learned:`learned`,imported:`imported`},JB={kind:`global`},YB=({owner:e,repo:t})=>`${e}/${t}`,XB=({host:e,owner:t,repo:n})=>`${e}/${t}/${n}`,ZB=e=>e.kind===`global`?`global`:XB(e.repo),QB=e=>[{key:ZB(JB),label:`Everywhere`,scope:JB},...e.map(t=>{let n=e.some(e=>e!==t&&YB(e)===YB(t));return{key:XB(t),label:n?`${YB(t)} on ${XF[t.host]}`:YB(t),scope:{kind:`repo`,repo:t}}})],$B=e=>{let t=(0,q.useRef)(null),n=(0,q.useRef)(!1);return(0,q.useEffect)(()=>{e?n.current=!0:n.current&&(n.current=!1,t.current?.focus())},[e]),t},eV=`Write the rule first.`,tV=e=>`A preference is one sentence of at most 300 characters: this is ${e} too many.`,nV=[`look-for`,`dont-flag`],rV={"look-for":{label:`What an AI review should look for`,example:`Tenant isolation: every query filters by tenant ID`},"dont-flag":{label:`What an AI review should leave out`,example:`Naming`}},iV=({legend:e,initial:t,scopes:n,kindFixed:r=!1,submit:i,submitting:a,note:o=null,focus:s=!1,onSubmit:c,onCancel:l})=>{let u=(0,q.useId)(),[d,f]=(0,q.useState)(t.kind),[p,m]=(0,q.useState)(t.text),[h,g]=(0,q.useState)(ZB(t.scope)),[_,v]=(0,q.useState)(!1),[y,b]=(0,q.useState)(o),x=(0,q.useRef)(null);(0,q.useEffect)(()=>{s&&x.current!==null&&(x.current.focus(),x.current.setSelectionRange(x.current.value.length,x.current.value.length))},[]);let S=n.find(e=>e.key===h)??n[0],C=p.trim().length,w=C-300,T=async e=>{if(e.preventDefault(),_||S===void 0)return;if(C===0)return b(eV);if(w>0)return b(tV(w));v(!0),b(null);let t=await c({kind:d,text:p.trim(),scope:S.scope});v(!1),b(t)};return(0,J.jsxs)(`form`,{"aria-label":e,"data-slot":`preference-form`,className:`flex flex-col gap-2.5`,onSubmit:e=>void T(e),noValidate:!0,children:[(0,J.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-4 gap-y-2`,children:[r?(0,J.jsx)(KB,{kind:d}):(0,J.jsxs)(`fieldset`,{className:`flex items-center gap-1`,children:[(0,J.jsx)(`legend`,{className:`sr-only`,children:`Kind`}),nV.map(e=>{let{label:t,icon:n}=GB[e];return(0,J.jsxs)(fM,{variant:`outline`,size:`sm`,pressed:d===e,onPressedChange:t=>{t&&f(e)},children:[(0,J.jsx)(n,{"aria-hidden":`true`}),t]},e)})]}),(0,J.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,J.jsx)(`span`,{id:`${u}-scope`,className:`shrink-0 text-caption text-muted-foreground`,children:`Applies to`}),n.length>1&&S!==void 0?(0,J.jsxs)(RB,{value:S.key,items:n.map(e=>({value:e.key,label:e.label})),onValueChange:e=>{typeof e==`string`&&g(e)},children:[(0,J.jsx)(BB,{size:`sm`,className:`max-w-64 min-w-0`,"aria-labelledby":`${u}-scope`,children:(0,J.jsx)(zB,{})}),(0,J.jsx)(VB,{alignItemWithTrigger:!1,align:`start`,children:n.map(e=>(0,J.jsx)(HB,{value:e.key,children:e.label},e.key))})]}):(0,J.jsx)(`span`,{className:`truncate`,children:S?.label.toLowerCase()})]})]}),(0,J.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,J.jsx)(`label`,{htmlFor:`${u}-text`,className:`text-caption font-medium`,children:rV[d].label}),(0,J.jsx)(ik,{ref:x,id:`${u}-text`,rows:2,className:`min-h-14 bg-card`,placeholder:rV[d].example,value:p,onChange:e=>{m(e.target.value.replace(/\s*\n\s*/g,` `)),b(null)},onKeyDown:e=>{e.key!==`Enter`||e.shiftKey||e.nativeEvent.isComposing||(e.preventDefault(),e.currentTarget.form?.requestSubmit())},"aria-invalid":y!==null||w>0,"aria-describedby":`${u}-count ${u}-problem`}),(0,J.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-x-3 text-caption`,children:[(0,J.jsx)(`span`,{id:`${u}-problem`,role:`status`,className:`min-w-0 flex-1 text-destructive`,children:y!==null&&(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(n_,{"aria-hidden":`true`,className:`mr-1 inline size-3.5 align-[-2px]`}),y]})}),(0,J.jsxs)(`span`,{id:`${u}-count`,"data-slot":`character-count`,className:X(`tabular shrink-0`,w>0?`text-destructive`:`text-muted-foreground`),children:[C,`/`,300,(0,J.jsx)(`span`,{className:`sr-only`,children:` characters`}),w>0&&`, ${w} too many`]})]})]}),(0,J.jsxs)(`div`,{className:`flex flex-wrap justify-end gap-2`,children:[l!==void 0&&(0,J.jsx)($,{type:`button`,variant:`ghost`,size:`sm`,onClick:l,children:`Cancel`}),(0,J.jsx)($,{type:`submit`,size:`sm`,disabled:_,focusableWhenDisabled:!0,"aria-busy":_,children:_?a:i})]})]})},aV=({title:e,onClose:t,children:n,className:r,returnFocus:i=()=>!0})=>{let a=(0,q.useRef)(null);return(0,J.jsx)(fj,{open:!0,onOpenChange:e=>{e||t()},children:(0,J.jsxs)(hj,{ref:a,className:X(`max-h-[calc(100dvh-2rem)] overflow-y-auto sm:max-w-lg`,r),initialFocus:()=>a.current?.querySelector(`[data-autofocus]`)??!0,finalFocus:()=>i(),children:[(0,J.jsx)(gj,{className:`shrink-0 pr-8`,children:(0,J.jsx)(_j,{children:e})}),n]})})},oV=({preference:e,onDelete:t,onClose:n})=>{let[r,i]=(0,q.useState)(!1),[a,o]=(0,q.useState)(null);return(0,J.jsxs)(aV,{title:`Delete preference`,onClose:n,children:[(0,J.jsxs)(`p`,{className:`flex flex-wrap items-center gap-2`,children:[(0,J.jsx)(KB,{kind:e.kind}),(0,J.jsx)(`span`,{className:`min-w-0 break-words`,children:e.text})]}),(0,J.jsx)(`p`,{className:`text-ui text-muted-foreground`,children:`AI reviews stop using it. A review already made keeps what it says of it.`}),a!==null&&(0,J.jsxs)(`p`,{className:`rounded-lg border border-review-changes/25 bg-review-changes-bg px-3 py-2 text-review-changes`,role:`alert`,children:[`Couldn't delete it. `,a]}),(0,J.jsxs)(`div`,{className:`flex justify-end gap-2`,children:[(0,J.jsx)($,{variant:`outline`,"data-autofocus":!0,onClick:n,children:`Cancel`}),(0,J.jsx)($,{variant:`destructive`,disabled:r,onClick:async()=>{i(!0);let e=await t();i(!1),o(e),e===null&&n()},children:r?`Deleting…`:`Delete`})]})]})},sV=({preference:e,scopes:t,actions:n})=>{let[r,i]=(0,q.useState)(`shown`),[a,o]=(0,q.useState)(null),s=$B(r===`editing`),{id:c,kind:l,text:u,source:d,enabled:f}=e;return r===`editing`?(0,J.jsx)(`li`,{className:`bg-surface-subtle px-4 py-3`,children:(0,J.jsx)(iV,{legend:`Edit: ${u}`,initial:e,scopes:t,submit:`Save`,submitting:`Saving…`,onCancel:()=>i(`shown`),onSubmit:async e=>{let t=await n.onEdit(c,e);return t===null&&i(`shown`),t}})}):(0,J.jsxs)(`li`,{"data-slot":`preference`,"data-enabled":f,className:`flex min-h-11 flex-wrap items-center gap-x-3 gap-y-1 px-4 py-2`,children:[(0,J.jsx)(KB,{kind:l}),(0,J.jsx)(`span`,{className:X(`min-w-0 flex-1 basis-56 break-words`,!f&&`text-muted-foreground`),children:u}),(0,J.jsxs)(`span`,{className:`flex shrink-0 items-center gap-3`,children:[(0,J.jsxs)(`span`,{className:`text-caption text-muted-foreground`,children:[qB[d],!f&&` · off`]}),(0,J.jsx)(xP,{checked:f,"aria-label":`Use in AI reviews: ${u}`,onCheckedChange:async e=>{o(null),o(await n.onSwitch(c,e))}}),(0,J.jsxs)(Sz,{children:[(0,J.jsx)(Cz,{render:(0,J.jsx)($,{ref:s,variant:`ghost`,size:`icon-xs`,"aria-label":`More for: ${u}`}),children:(0,J.jsx)(Xh,{"aria-hidden":`true`})}),(0,J.jsxs)(wz,{align:`end`,className:`w-36`,children:[(0,J.jsxs)(Dz,{onClick:()=>i(`editing`),children:[(0,J.jsx)(Ig,{"aria-hidden":`true`}),`Edit`]}),(0,J.jsxs)(Dz,{variant:`destructive`,onClick:()=>i(`deleting`),children:[(0,J.jsx)(e_,{"aria-hidden":`true`}),`Delete…`]})]})]})]}),a!==null&&(0,J.jsxs)(`p`,{role:`alert`,className:`basis-full text-caption text-destructive`,children:[(0,J.jsx)(n_,{"aria-hidden":`true`,className:`mr-1 inline size-3.5 align-[-2px]`}),a]}),r===`deleting`&&(0,J.jsx)(oV,{preference:e,onDelete:()=>n.onDelete(c),onClose:()=>i(`shown`)})]})},cV=({preferences:e,scopes:t,actions:n,label:r})=>(0,J.jsx)(`ul`,{"aria-label":r,className:`divide-y`,children:e.map(e=>(0,J.jsx)(sV,{preference:e,scopes:t,actions:n},e.id))}),lV=({option:e,title:t,word:n,preferences:r,scopes:i,actions:a,addable:o=!0,adding:s,onAdding:c,onAdd:l,empty:u,children:d})=>{let f=(0,q.useId)(),p=(0,q.useRef)(null),m=()=>{c(!1),p.current?.focus()};return(0,J.jsxs)(`section`,{"aria-labelledby":f,"data-slot":`preference-scope`,className:`flex min-w-0 flex-col overflow-hidden rounded-xl border bg-card`,children:[(0,J.jsxs)(`div`,{className:`flex min-h-11 flex-wrap items-center gap-x-2 gap-y-1 border-b px-4 py-2`,children:[(0,J.jsx)(`h2`,{id:f,className:`flex min-w-0 items-center gap-2 text-heading font-semibold`,children:t}),(0,J.jsxs)(`span`,{className:`rounded-full bg-muted px-2 text-caption font-medium text-muted-foreground tabular-nums`,children:[(0,J.jsx)(`span`,{"aria-hidden":`true`,children:r.length}),(0,J.jsxs)(`span`,{className:`sr-only`,children:[r.length,` `,r.length===1?`preference`:`preferences`]})]}),(0,J.jsx)(`span`,{className:`min-w-0 text-caption text-muted-foreground max-sm:order-last max-sm:basis-full`,children:n}),o&&(0,J.jsxs)($,{ref:p,variant:`outline`,size:`sm`,className:`ml-auto`,"aria-expanded":s,"aria-label":e.scope.kind===`repo`?`Add preference for ${e.label}`:void 0,onClick:()=>c(!s),children:[(0,J.jsx)(Rg,{"aria-hidden":`true`}),`Add preference`]})]}),s&&(0,J.jsx)(`div`,{className:`border-b bg-surface-subtle px-4 py-3`,children:(0,J.jsx)(iV,{legend:`Add a preference`,initial:{kind:`look-for`,text:``,scope:e.scope},scopes:i,submit:`Add preference`,submitting:`Adding…`,focus:!0,onCancel:m,onSubmit:async e=>{let t=await l(e);return t===null&&m(),t}})}),r.length===0?u:(0,J.jsx)(cV,{preferences:r,scopes:i,actions:a,label:`Preferences for ${e.label.toLowerCase()}`}),d]})},uV={learned:`from what you did in reviews`,imported:`from your past reviews`},dV=({proposal:e,scopes:t,actions:n})=>{let{id:r,kind:i,text:a,scope:o,evidence:s}=e,c=a.length-300,[l,u]=(0,q.useState)(null),[d,f]=(0,q.useState)(null),[p,m]=(0,q.useState)(null),h=$B(l!==null),g=t.find(e=>e.key===ZB(o))?.label??`Everywhere`,_=async e=>{if(d!==null)return;if(e===`accept`&&c>0)return u({note:tV(c)});f(e),m(null);let t=await(e===`accept`?n.onAccept(r,null):n.onReject(r));f(null),m(t)};return l===null?(0,J.jsxs)(`li`,{"data-slot":`proposal`,className:`flex flex-col gap-1.5 px-4 py-3`,children:[(0,J.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-3 gap-y-1`,children:[(0,J.jsx)(KB,{kind:i}),(0,J.jsx)(`span`,{className:`min-w-0 flex-1 basis-56 font-medium break-words`,children:a}),(0,J.jsxs)(`span`,{className:`shrink-0 text-caption text-muted-foreground`,children:[g,`, `,uV[e.source]]})]}),s.length>0&&(0,J.jsxs)(`div`,{className:`flex gap-1.5 text-caption text-muted-foreground`,children:[(0,J.jsx)(`span`,{className:`shrink-0`,children:`Based on:`}),(0,J.jsx)(`ul`,{className:`flex min-w-0 flex-col`,children:[...new Set(s)].map(e=>(0,J.jsx)(`li`,{className:`break-words`,children:e},e))})]}),(0,J.jsxs)(`div`,{className:`flex flex-wrap items-center justify-end gap-2`,children:[p!==null&&(0,J.jsxs)(`span`,{role:`alert`,className:`min-w-0 flex-1 text-caption text-destructive`,children:[(0,J.jsx)(n_,{"aria-hidden":`true`,className:`mr-1 inline size-3.5 align-[-2px]`}),p]}),(0,J.jsx)($,{variant:`ghost`,size:`sm`,"aria-label":`Reject: ${a}`,"aria-busy":d===`reject`,onClick:()=>void _(`reject`),children:d===`reject`?`Rejecting…`:`Reject`}),(0,J.jsx)($,{ref:h,variant:`outline`,size:`sm`,"aria-label":`Edit: ${a}`,onClick:()=>u({note:null}),children:`Edit`}),(0,J.jsx)($,{size:`sm`,"aria-label":`Accept: ${a}`,"aria-busy":d===`accept`,onClick:()=>void _(`accept`),children:d===`accept`?`Accepting…`:`Accept`})]})]}):(0,J.jsx)(`li`,{className:`bg-surface-subtle px-4 py-3`,children:(0,J.jsx)(iV,{legend:`Edit the suggestion: ${a}`,initial:e,scopes:t,submit:`Accept`,submitting:`Accepting…`,note:l.note,onCancel:()=>u(null),onSubmit:e=>n.onAccept(r,e)})})},fV=({proposals:e,scopes:t,actions:n,fallbackFocus:r})=>{let i=(0,q.useId)(),a=(0,q.useRef)(null),o=()=>(e.length>1?a.current:r?.current)?.focus(),s=e=>e.then(e=>(e===null&&o(),e)),c={onAccept:(e,t)=>s(n.onAccept(e,t)),onReject:e=>s(n.onReject(e))};return e.length===0?null:(0,J.jsxs)(`section`,{ref:a,tabIndex:-1,"aria-labelledby":i,"data-slot":`suggested`,className:`flex min-w-0 flex-col overflow-hidden rounded-xl border bg-card`,children:[(0,J.jsxs)(`div`,{className:`flex min-h-11 flex-wrap items-center gap-x-2 gap-y-1 border-b px-4 py-2`,children:[(0,J.jsx)(`h2`,{id:i,className:`text-heading font-semibold`,children:`Suggested`}),(0,J.jsxs)(`span`,{className:`rounded-full bg-muted px-2 text-caption font-medium text-muted-foreground tabular-nums`,children:[(0,J.jsx)(`span`,{"aria-hidden":`true`,children:e.length}),(0,J.jsxs)(`span`,{className:`sr-only`,children:[e.length,` `,e.length===1?`suggestion`:`suggestions`]})]}),(0,J.jsx)(`span`,{className:`text-caption text-muted-foreground`,children:`None is used until you accept it. A rejected one isn't suggested again.`})]}),(0,J.jsx)(`ul`,{className:`divide-y`,children:e.map(e=>(0,J.jsx)(dV,{proposal:e,scopes:t,actions:c},e.id))})]})},pV=`Nothing new to suggest from: megareviewer records the points you dismiss and raise and the comments you post.`,mV=()=>(0,J.jsxs)(`div`,{role:`status`,"aria-busy":`true`,"aria-label":`Loading your preferences`,className:`flex flex-col gap-4`,children:[(0,J.jsx)(dP,{className:`h-7 w-56 motion-reduce:animate-none`}),[3,2].map(e=>(0,J.jsxs)(`div`,{className:`flex flex-col overflow-hidden rounded-xl border bg-card`,children:[(0,J.jsx)(`div`,{className:`flex h-11 items-center border-b px-4`,children:(0,J.jsx)(dP,{className:`h-4 w-32 motion-reduce:animate-none`})}),(0,J.jsx)(`ul`,{"aria-hidden":`true`,className:`flex flex-col gap-3 px-4 py-3`,children:Array.from({length:e},(e,t)=>(0,J.jsxs)(`li`,{className:`flex items-center gap-3`,children:[(0,J.jsx)(dP,{className:`h-5 w-20 rounded-full motion-reduce:animate-none`}),(0,J.jsx)(dP,{className:`h-4 flex-1 motion-reduce:animate-none`}),(0,J.jsx)(dP,{className:`h-4 w-12 motion-reduce:animate-none`})]},t))})]},e))]}),hV=()=>(0,J.jsxs)(`p`,{className:`text-muted-foreground`,children:[`A preference is one rule for AI reviews: something to look for, or something not to flag. For example `,(0,J.jsx)(KB,{kind:`look-for`,className:`align-middle`}),` “Tenant isolation: every query filters by tenant ID”, or `,(0,J.jsx)(KB,{kind:`dont-flag`,className:`align-middle`}),` “Naming”.`]}),gV=({now:e=Date.now})=>{let{client:t}=yp(),n=PL(pI().status?.model??null),r=Tp(),[i,a]=(0,q.useState)(null),[o,s]=(0,q.useState)(null);r.preferences!==i&&(a(r.preferences),s(r.preferences));let[c,l]=(0,q.useState)(null),[u,d]=(0,q.useState)(``),f=(0,q.useRef)(null),p=e=>s(t=>t===null?t:e(t)),m=(e,t,n)=>e.ok?(p(n=>t(n,e.value)),d(n),null):WL(e.error),h=async e=>m(await t.addPreference(e),FL,`Added: ${e.text}`),g={onSwitch:async(e,n)=>m(await t.updatePreference(e,{enabled:n}),FL,n?`Switched on`:`Switched off`),onEdit:async(e,n)=>m(await t.updatePreference(e,n),FL,`Saved: ${n.text}`),onDelete:async e=>m(await t.deletePreference(e),t=>IL(t,e),`Deleted`)},_={onAccept:async(e,n)=>m(await t.decideProposal(e,{decision:`accept`,...n}),(t,{preference:n})=>{let r=RL(t,e);return n===null?r:FL(r,n)},`Accepted`),onReject:async e=>m(await t.decideProposal(e,{decision:`reject`}),t=>RL(t,e),`Rejected`)},v=async e=>{let n=await t.suggestPreferences(e===void 0?{}:{optionId:e});if(!n.ok)return{ok:!1,message:WL(n.error)};let{proposals:r,signals:i}=n.value;return p(e=>({...LL(e,r),signalsSinceSuggestion:0})),{ok:!0,said:r.length===0?`Nothing new to suggest from ${GL(i,`action`)}.`:`${GL(r.length,`suggestion`)} from ${GL(i,`action`)}, above.`}},y=async(e,n)=>{let r=await t.importPreferences({repo:e,...n===void 0?{}:{optionId:n}});if(!r.ok)return{ok:!1,message:WL(r.error)};let{proposals:i,comments:a,pullRequests:o}=r.value;if(p(e=>LL(e,i)),a===0)return{ok:!0,said:o===0?`Found no pull request of this repository that you reviewed.`:`Found no comment of yours on its last ${GL(o,`pull request`)}.`};let s=`Read ${GL(a,`comment`)} from ${GL(o,`pull request`)}`;return{ok:!0,said:i.length===0?`${s}: nothing new to suggest.`:`${s}: ${GL(i.length,`suggestion`)}, above.`}},b=async(e,n,r)=>m(await t.setGuidelineSwitch({repo:e,path:n,enabled:r}),t=>zL(t,e,n,r),r?`${n} switched on`:`${n} switched off`);return(0,J.jsxs)(`div`,{"data-slot":`preferences-page`,className:`mx-auto flex max-w-[960px] flex-col gap-4`,children:[(0,J.jsxs)(`header`,{className:`flex flex-col gap-1`,children:[(0,J.jsx)(`h1`,{ref:f,tabIndex:-1,className:`text-title font-semibold tracking-[-0.01em]`,children:`Preferences`}),(0,J.jsx)(`p`,{className:`text-muted-foreground`,children:`What you want an AI review to look for and to leave out. Used by Request AI review.`})]}),(()=>{if(o===null)return r.loading||r.error===null?(0,J.jsx)(mV,{}):(0,J.jsxs)(`div`,{className:X(lP,`flex flex-wrap items-center justify-between gap-2`),role:`alert`,children:[(0,J.jsxs)(`p`,{children:[`Couldn't read your preferences. `,Ap(r.error)]}),(0,J.jsx)($,{variant:`outline`,size:`sm`,onClick:r.refresh,children:`Try again`})]});let t=VL(o),i=QB(t.map(e=>e.repo)),[a]=i;if(a===void 0)return null;let s=o.preferences.length===0,u=o.signalsSinceSuggestion;return(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(fV,{proposals:o.proposals,scopes:i,actions:_,fallbackFocus:f}),(0,J.jsx)(Rz,{label:`Suggest from my reviews`,running:`Reading what you did in reviews…`,icon:(0,J.jsx)(Xg,{"aria-hidden":`true`}),choice:n,blocked:u===0?pV:null,idle:u===0?pV:`${GL(u,`action`)} recorded since the last suggestions`,run:v,now:e}),(0,J.jsx)(lV,{option:a,title:`Everywhere`,word:`Used on every pull request`,preferences:BL(o,JB),scopes:i,actions:g,addable:!s,adding:!s&&c===a.key,onAdding:e=>l(e?a.key:null),onAdd:h,empty:s?(0,J.jsxs)(`div`,{"data-slot":`no-preferences`,className:`flex flex-col gap-3 px-4 py-4`,children:[(0,J.jsx)(hV,{}),(0,J.jsx)(iV,{legend:`Add a preference`,initial:{kind:`look-for`,text:``,scope:JB},scopes:i,submit:`Add preference`,submitting:`Adding…`,onSubmit:h})]}):(0,J.jsx)(`p`,{className:`px-4 py-3 text-caption text-muted-foreground`,children:`No preference for every repository yet.`})}),t.map(({repo:t,guidelineFiles:r,guidelineNote:s})=>{let u=i.find(e=>e.key===XB(t))??a;return(0,J.jsxs)(lV,{option:u,title:(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(`span`,{className:`min-w-0 truncate`,children:YB(t)}),(0,J.jsx)(aO,{variant:`outline`,className:`font-normal text-muted-foreground`,children:XF[t.host]})]}),word:`Used on its pull requests, after the ones for everywhere`,preferences:BL(o,u.scope),scopes:i,actions:g,adding:c===u.key,onAdding:e=>l(e?u.key:null),onAdd:h,empty:(0,J.jsx)(`p`,{className:`px-4 py-3 text-caption text-muted-foreground`,children:`No preference for this repository yet.`}),children:[(0,J.jsx)(JL,{files:r,note:s,repository:YB(t),onSwitch:(e,n)=>b(t,e,n)}),(0,J.jsx)(`div`,{className:`border-t px-4 py-3`,children:(0,J.jsx)(Rz,{label:`Import from my past reviews`,running:`Reading your comments on ${YB(t)}…`,icon:(0,J.jsx)(Bg,{"aria-hidden":`true`}),choice:n,what:`Reads your own comments on its recent pull requests on ${XF[t.host]}, then runs`,run:e=>y(t,e),now:e})})]},u.key)})]})})(),(0,J.jsx)(`span`,{className:`sr-only`,"aria-live":`polite`,children:u})]})},_V=[`import`,`call`,`type`,`request`],vV=e=>e.slice(e.lastIndexOf(`/`)+1),yV=(e,t)=>e<t?-1:+(e>t),bV=e=>/\.(md|mdx|rst|adoc)$/i.test(e),xV=/(^|[/_.-])(fakes?|mocks?|stubs?|fixtures?|testing|test[_-]?(utils?|helpers?|support))([/_.-]|$)/i,SV=e=>EF(e).split(`/`).slice(0,3).join(`/`),CV=e=>`group:${e}`,wV=e=>{let t=new Map(e.map(e=>[e,e.split(`/`)])),n=(e,n)=>(t.get(e)??[]).slice(-n).join(`/`),r=new Map;for(let i of e){let a=t.get(i)?.length??1,o=1;for(;o<a&&e.some(e=>e!==i&&n(e,o)===n(i,o));)o+=1;r.set(i,n(i,o))}return r},TV=`\0routes`,EV=e=>`${e.method} ${e.path}`,DV=e=>{let[t]=e;return e.length===1&&t!==void 0?`${t.method} ${t.path}`:`${e.length} routes`},OV=(e,t)=>{let n=al(e.parts),r=new Map(e.files.flatMap(e=>ol(e,n).map(({id:t,hunk:n})=>[t,{file:e,hunk:n}]))),i=new Map,a=(e,t)=>{let n=i.get(e)??[];n.includes(t)||i.set(e,[...n,t])},o=new Map;for(let e of t){let t=new Map;for(let n of e.entries){let e=r.get(n)?.file.path;e!==void 0&&t.set(e,[...t.get(e)??[],n])}for(let[n,i]of t){let t=i.flatMap(e=>{let t=r.get(e),n=t===void 0?null:Ku(t.file,t.hunk,[]);return n?.kind===`route`?n.routes:[]});if(t.length>0&&(a(n,TV),o.set(n,[...o.get(n)??[],...t])),!(new Set(t.map(EV)).size===i.length&&t.length>0))for(let t of(e.codeTitle??e.title).split(`; `)){t.startsWith(`Page: `)&&a(n,t);let e=/^Command: (\S+) in (.+)$/.exec(t);e!==null&&e[2]===vV(n)&&a(n,`Command: ${e[1]}`)}}}return new Map([...i].map(([e,t])=>{let n=[...new Map((o.get(e)??[]).map(e=>[EV(e),e])).values()];return[e,t.map(e=>e===TV?DV(n):e)]}))},kV=(e,t)=>{let n=new Map,r=new Map,i=[],a=new Set,o=[],s=0,c=e=>{n.set(e,s),r.set(e,s),s+=1,i.push(e),a.add(e);for(let i of t(e))n.has(i)?a.has(i)&&r.set(e,Math.min(r.get(e)??0,n.get(i)??0)):(c(i),r.set(e,Math.min(r.get(e)??0,r.get(i)??0)));if(r.get(e)!==n.get(e))return;let l=[];for(let t=i.pop();t!==void 0&&(a.delete(t),l.push(t),t!==e);t=i.pop());l.length>1&&o.push(l)};for(let t of e)n.has(t)||c(t);return o},AV=()=>({uses:new Set,symbols:new Set,pairs:0}),jV=e=>{let t=new Set(e.proofs.flatMap(e=>e.hunkId??[])),n=e.files.filter(e=>e.hunks.some(e=>!t.has(e.id))),r=new Map(n.flatMap(e=>e.hunks.map(t=>[t.id,e.path]))),i=new Set(n.map(e=>e.path)),a=new Map,o=(e,t,n,r)=>{if(e===t||!i.has(e)||!i.has(t))return;let o=a.get(e)??new Map,s=o.get(t)??{...AV(),pairs:1};s.uses.add(n),r!==void 0&&s.symbols.add(r),o.set(t,s),a.set(e,o)};for(let{from:t,to:n}of e.fileLinks)o(t,n,`import`);for(let t of e.callGraph){let e=r.get(rl(t.fromPartId)),n=r.get(rl(t.toPartId));e!==void 0&&n!==void 0&&o(e,n,t.use,t.symbol)}return{mechanical:t,files:n,pathOfHunk:r,links:a}},MV=(e,t,n=new Set)=>{let{mechanical:r,files:i,pathOfHunk:a,links:o}=jV(e),s=[...new Set(t.flatMap(e=>e.partIds))],c=new Map(s.map((e,t)=>[e,t])),l=e=>c.get(e)??s.length,u=new Set(e.generated),d=new Map(i.map(t=>{let n=t.hunks.flatMap(e=>e.lines),i=ol(t,al(e.parts)).map(e=>e.id).filter(e=>!r.has(rl(e))).sort((e,t)=>l(e)-l(t)),a=t.hunks.every(e=>r.has(e.id))?`mechanical`:`logic`;return[t.path,{added:n.filter(e=>e.kind===`add`).length,deleted:n.filter(e=>e.kind===`del`).length,partIds:i,risk:a,rank:i.reduce((e,t)=>Math.min(e,l(t)),1/0)}]})),f=e=>d.get(e)?.rank??1/0,p=(e,t)=>f(e)-f(t)||yV(e,t),m=i.map(e=>e.path).sort(p),h=e=>[...o.get(e)?.keys()??[]],g=e=>m.filter(t=>o.get(t)?.has(e)===!0),_=new Set(m.filter(ul));for(let e=!0;e;){e=!1;for(let t of m){let n=g(t);!_.has(t)&&xV.test(t)&&n.length>0&&n.every(e=>_.has(e))&&(_.add(t),e=!0)}}let v=m.filter(e=>!_.has(e)&&bV(e)),y=m.filter(e=>!_.has(e)&&!bV(e)),b=new Set(y),x=new Map;for(let e of[..._].sort(p)){let t=[],n=new Set([e]),r=e=>{for(let i of h(e))n.has(i)||(n.add(i),b.has(i)?t.push(i):r(i))};r(e),x.set(e,t)}let S=new Map;for(let[e,t]of x)for(let n of t)S.set(n,[...S.get(n)??[],e]);let C=[..._].filter(e=>(x.get(e)??[]).length===0),w=new Map;for(let e of[...y,...v,...C].sort(TF)){let t=CV(EF(e)),r=n.has(t)?e:t;w.set(r,[...w.get(r)??[],e])}let T=new Map;for(let[e,t]of w)for(let n of t)T.set(n,e);let E=e=>Math.min(...(w.get(e)??[e]).map(f)),D=(e,t)=>E(e)-E(t)||yV(e,t),O=[...w.keys()].sort(D),k=new Map;for(let[e,t]of o)for(let[n,r]of t){let t=T.get(e),i=T.get(n);if(t===void 0||i===void 0||t===i)continue;let a=k.get(t)??new Map,o=a.get(i)??AV();for(let e of r.uses)o.uses.add(e);for(let e of r.symbols)o.symbols.add(e);o.pairs+=r.pairs,a.set(i,o),k.set(t,a)}let A=new Map;for(let{partId:t,symbol:n,uses:r}of e.unchangedCallers??[]){let e=a.get(rl(t)),i=e===void 0?void 0:T.get(e);if(i!==void 0)for(let e of r){let r=A.get(e.path)??{targets:new Map,uses:0,partIds:new Set},a=r.targets.get(i)??AV();a.uses.add(e.use),a.symbols.add(n),r.targets.set(i,a),r.uses+=1,r.partIds.add(t),A.set(e.path,r)}}let j=[...A.keys()].sort((e,t)=>Number(ul(e))-Number(ul(t))||yV(e,t)),M=new Map;for(let e of j){let t=j.length>10?`outside:${SV(e)}/`:`outside:${e}`;M.set(t,[...M.get(t)??[],e])}for(let[e,t]of[...M]){let[n]=t;e.endsWith(`/`)&&t.length===1&&n!==void 0&&(M.delete(e),M.set(`outside:${n}`,[n]))}let N=new Map;for(let[e,t]of M){let n=new Map;for(let e of t)for(let[t,r]of A.get(e)?.targets??[]){let e=n.get(t)??AV();for(let t of r.uses)e.uses.add(t);for(let t of r.symbols)e.symbols.add(t);n.set(t,e)}N.set(e,n)}let P=new Set([...[...k].flatMap(([e,t])=>t.size>0?[e,...t.keys()]:[]),...[...N.values()].flatMap(e=>[...e.keys()])]),F=O.filter(e=>P.has(e)),I=new Set,L=(e,t)=>`${e}\u0000${t}`,R=e=>[...k.get(e)?.keys()??[]].filter(t=>!I.has(L(e,t))),ee=(e,t)=>k.get(e)?.get(t)?.pairs??0;for(let e=kV(F,R);e.length>0;e=kV(F,R))for(let t of e){let[e,n,r]=t;if(e!==void 0&&n!==void 0&&r===void 0&&ee(e,n)!==ee(n,e)){I.add(ee(e,n)<ee(n,e)?L(e,n):L(n,e));continue}let[i]=[...t].sort(D);for(let e of t)i!==void 0&&R(e).includes(i)&&I.add(L(e,i))}let z=new Map(F.map(e=>[e,[]]));for(let e of F)for(let t of R(e))z.get(t)?.push(e);let te=new Map,B=e=>{let t=te.get(e);if(t!==void 0)return t;let n=Math.max(-1,...(z.get(e)??[]).map(B))+1;return te.set(e,n),n},ne=[],V=(e,t)=>{for(;ne.length<=t;)ne.push([]);ne[t]?.push(e)};for(let e of F)V(e,B(e));for(let[e,t]of N){let n=[...t.keys()];z.set(e,n),te.set(e,Math.max(...n.map(B))+1),V(e,te.get(e)??0)}let H=()=>new Map(ne.flatMap(e=>e.map((t,n)=>[t,n-(e.length-1)/2]))),re=e=>R(e),ie=(e,t)=>{for(let n of e){let e=H(),r=n=>{let r=t(n).map(t=>e.get(t)??0);return r.length===0?e.get(n)??0:r.reduce((e,t)=>e+t,0)/r.length},i=new Map(n.map(e=>[e,r(e)]));n.sort((e,t)=>(i.get(e)??0)-(i.get(t)??0)||D(e,t))}},ae=e=>z.get(e)??[];ie(ne.slice(1),ae),ie(ne.slice(0,-1).reverse(),re),ie(ne.slice(1),ae);let oe=wV(m),se=OV(e,t),U=new Map;for(let e of t)if(e.kind===`flow`)for(let t of new Set(e.partIds.flatMap(e=>a.get(rl(e))??[])))U.set(t,[...U.get(t)??[],e.title]);let ce=e=>[...new Set(e)],le=wV(j),ue=(e,t)=>{let n=M.get(e)??[],[r]=n;return{key:e,kind:`outside`,paths:n,label:e.endsWith(`/`)||r===void 0?e.slice(8):le.get(r)??r,added:0,deleted:0,risk:`logic`,generated:!1,entries:[],flows:[],partIds:[...new Set(n.flatMap(e=>[...A.get(e)?.partIds??[]]))],uses:n.reduce((e,t)=>e+(A.get(t)?.uses??0),0),badges:[],row:t}},de=(e,t)=>{if(M.has(e))return ue(e,t);let n=w.get(e)??[e],r=n.flatMap(e=>d.get(e)??[]),i=e.startsWith(`group:`);return{key:e,kind:i?`group`:`file`,paths:n,label:i?`${e.slice(6)||`.`}/`:oe.get(e)??e,added:r.reduce((e,t)=>e+t.added,0),deleted:r.reduce((e,t)=>e+t.deleted,0),risk:r.every(e=>e.risk===`mechanical`)?`mechanical`:`logic`,generated:n.every(e=>u.has(e)),entries:ce(n.flatMap(e=>se.get(e)??[])),flows:ce(n.flatMap(e=>U.get(e)??[])),partIds:r.flatMap(e=>e.partIds).sort((e,t)=>l(e)-l(t)),badges:ce(n.flatMap(e=>S.get(e)??[])).sort(p),uses:0,row:t}},fe=ne.map((e,t)=>e.map(e=>de(e,t))),pe=O.filter(e=>!P.has(e)).map(e=>de(e,-1)),me=new Map;for(let e of[...fe.flat(),...pe])if(e.kind!==`outside`)for(let t of e.paths)me.set(t,e.key);for(let[e,t]of x){let[n]=t,r=n===void 0?void 0:T.get(n);r!==void 0&&me.set(e,r)}return{rows:fe,edges:[...[...k].map(e=>[e,!1]),...[...N].map(e=>[e,!0])].flatMap(([[e,t],n])=>[...t].map(([t,r])=>({from:e,to:t,uses:_V.filter(e=>r.uses.has(e)),symbols:[...r.symbols].sort(yV),back:I.has(L(e,t)),outside:n}))),strip:pe,placeOf:me}},NV=e=>e.kind!==`outside`&&!e.generated&&e.risk!==`mechanical`,PV=e=>e.kind===`group`?e.key.slice(6)||`.`:e.key,FV=e=>{let t=e.rows.map(e=>e.filter(NV)).filter(e=>e.length>0),n=e.strip.filter(NV),r=t.length>0,i=r?t:[n],a=i.flat();if(a.length===0)return null;let o=wV(a.map(PV)),s=8,c=i.map(e=>e.flatMap(e=>s===0?[]:(--s,[{label:o.get(PV(e))??PV(e),entries:e.entries}]))).filter(e=>e.length>0);return{rows:c,linked:r,more:a.length-c.flat().length+(r?n.length:0)}},IV=(e,t)=>{let n=e.flatMap(e=>{let n=t(e.partId);if(n===void 0||ul(n))return[];let r=e.uses.filter(e=>!ul(e.path)).length,i=e.uses.length>r?0:e.more;return r+i===0?[]:[{symbol:e.symbol,uses:r+i}]});return n.length===0?null:{symbols:[...new Set(n.map(e=>e.symbol))],uses:n.reduce((e,t)=>e+t.uses,0)}},LV=e=>e.split(/`([^`\n]+)`/).map((e,t)=>({text:e,code:t%2==1})).filter(e=>e.text!==``),RV=e=>{let[t,n]=(0,q.useState)(()=>Date.now());return(0,q.useEffect)(()=>{if(e===null)return;n(Date.now());let t=setInterval(()=>n(Date.now()),1e3);return()=>clearInterval(t)},[e]),e===null?0:Math.max(0,Math.round((t-e)/1e3))},zV=e=>`${Math.floor(e/60)}:${String(e%60).padStart(2,`0`)}`,BV={finding:[`finding`,`findings`],risk:[`risk`,`risks`],decision:[`decision`,`decisions`]},VV=({kind:e,count:t,words:n,at:r,pressed:i,onPressed:a,label:o})=>{let[s,c]=n,l=e===`thread`?Mg:GE[e];return(0,J.jsxs)(`button`,{type:`button`,"data-slot":`point-chip`,"data-kind":e,"data-land":`rise`,"aria-pressed":i,"aria-label":o,style:vh({"--landing-i":r}),onClick:()=>a(!i),className:X(`flex min-h-6 shrink-0 items-center gap-1.5 rounded-full border px-2 text-caption font-medium aria-pressed:border-current aria-pressed:ring-1 aria-pressed:ring-current`,e===`thread`?`border-border bg-background text-foreground`:WE[e].className),children:[(0,J.jsx)(l,{"aria-hidden":`true`,className:`size-3.5`}),(0,J.jsxs)(`span`,{children:[(0,J.jsx)(`span`,{"data-slot":`count-up`,"aria-hidden":`true`,className:`tabular`,style:vh({"--count":t})}),(0,J.jsx)(`span`,{className:`sr-only`,children:t}),` `,(0,J.jsx)(`span`,{className:`max-xl:sr-only`,children:t===1?s:c})]})]})},HV=({choice:e,starting:t,failed:n,onRun:r})=>{let i=(0,q.useId)(),{chosen:a,locked:o}=e,s=o??(a===null?null:`Runs ${a.modelName} through ${a.via}`),c=(0,J.jsx)($,{variant:n?`outline`:`default`,size:`sm`,"data-slot":`request-review`,disabled:t||o!==null||a===null,focusableWhenDisabled:!0,"aria-describedby":s===null?void 0:i,onClick:r,className:`rounded-r-none`}),l=(0,J.jsxs)(J.Fragment,{children:[o===null?(0,J.jsx)(Xg,{"aria-hidden":`true`,className:X(n&&`text-primary`)}):(0,J.jsx)(Ag,{"aria-hidden":`true`}),t?`Starting…`:n?`Try again`:`Request AI review`]});return(0,J.jsxs)(`span`,{className:`flex shrink-0 items-center`,children:[(0,J.jsxs)(UI,{disabled:s===null,children:[(0,J.jsx)(WI,{render:c,children:l}),(0,J.jsxs)(GI,{side:`bottom`,align:`start`,children:[o!==null&&(0,J.jsx)(bg,{"aria-hidden":`true`,className:`size-3.5 shrink-0`}),s]})]}),s!==null&&(0,J.jsx)(`span`,{id:i,hidden:!0,children:s}),(0,J.jsx)(Fz,{choice:e,disabled:t||e.options.length===0,filled:!n&&o===null})]})},UV=e=>{let t=[`intent`,`findings`,`risk`,`decisions`].filter(t=>e.stages[t]!==`done`);return t.length===0||e.modelError===null?null:`${t.join(`, `)} missing: ${e.modelError.message}`},WV=({analysis:e,choice:t,running:n,startedAt:r,starting:i,error:a,points:o,leftOut:s=0,threads:c=null,narrowed:l,onNarrow:u,onRun:d,children:f})=>{let p=RV(n?r:null),m=Rl(e.modelOption??t.chosen),h=f!=null&&f!==!1,g=e=>(0,J.jsxs)(`span`,{className:`flex min-w-0 items-center gap-2`,children:[e,h&&(0,J.jsx)(`span`,{className:X(`flex min-w-0 items-center`,e!==null&&`border-l pl-1.5`),children:f})]});if(n)return g((0,J.jsxs)(`span`,{"data-slot":`claude-running`,role:`status`,className:`flex shrink-0 items-center gap-2 whitespace-nowrap text-muted-foreground`,children:[(0,J.jsx)(Xg,{"aria-hidden":`true`,className:`size-3.5`}),m,` is reading this PR`,(0,J.jsx)(`span`,{className:`tabular text-caption`,children:zV(p)})]}));let _=[`finding`,`risk`,`decision`].map(e=>[e,o.filter(t=>t.kind===e).length]).filter(([,e])=>e>0),v=UV(e),y=_.length+(c===null?0:1),b=e=>({"data-land":`rise`,style:vh({"--landing-i":y+e})});if(o.length>0)return(0,J.jsxs)(`span`,{"data-slot":`claude-receipt`,className:`flex min-w-0 items-center gap-1.5`,children:[_.map(([e,t],n)=>(0,J.jsx)(VV,{kind:e,count:t,words:BV[e],at:n,pressed:l===e,onPressed:t=>u(t?e:null)},e)),c!==null&&(0,J.jsx)(VV,{kind:`thread`,count:c.count,words:c.words,label:c.label,at:_.length,pressed:l===`thread`,onPressed:e=>u(e?`thread`:null)}),(0,J.jsx)(`span`,{...b(0),className:`ml-1 flex min-w-0 items-center border-l pl-1.5`,children:f}),(a??v)!==null&&(0,J.jsx)(`span`,{...b(1),role:`alert`,title:a??v??void 0,className:`min-w-0 truncate text-caption text-destructive`,children:a??v}),Vu(e)&&(0,J.jsx)(`span`,{...b(1),children:(0,J.jsx)($,{variant:`ghost`,size:`xs`,disabled:i,onClick:d,children:i?`Starting…`:`Try again`})})]});if(!Vu(e))return g(e.stages.findings===`done`?(0,J.jsxs)(`span`,{"data-slot":`claude-receipt`,"data-land":`fade`,className:`shrink-0 whitespace-nowrap text-muted-foreground`,children:[(0,J.jsx)(`span`,{"aria-hidden":`true`,children:`✓ `}),m,` found nothing to raise`,s>0&&`, and left out ${s} by your preferences`]}):null);let x=e.modelError;return g((0,J.jsxs)(`span`,{className:`flex min-w-0 items-center gap-2`,children:[(0,J.jsx)(HV,{choice:t,starting:i,failed:x!==null,onRun:d}),(a??x)!==null&&(0,J.jsx)(`span`,{role:`alert`,title:a??`${m} couldn't finish: ${x?.message}`,className:`min-w-0 truncate text-caption text-destructive`,children:a??`${m} couldn't finish: ${x?.message}`})]}))},GV=e=>`call-${e.partId}-${e.line}-${e.column}`,KV=(e,t,n)=>{let r=new Map;for(let i of e){let e=t.items(i.toPartIds).map(({id:e,hunk:t,file:n})=>({id:e,hunk:t,file:n}));if(e.length===0||!t.parts.has(i.partId))continue;let a={symbol:i.symbol,targets:e},o=GV(i),s=r.get(i.partId)??new Map,c=s.get(i.line)??[];c.some(e=>e.start===i.column)||(c.push({start:i.column,end:i.column+i.length,render:e=>(0,J.jsx)(eM,{handle:n,payload:a,id:o,children:e})}),s.set(i.line,c),r.set(i.partId,s))}return r},qV=(e,t)=>{let n=e.checkedBy;if(n===void 0)return null;let{hunkId:r,startLine:i}=n.lines,a=t.items(t.partsOf(r)),o=a.filter(({hunk:e})=>e.lines.some(e=>e.kind!==`del`&&e.newLine===i)),s=(o.length>0?o:a).map(({id:e,hunk:t,file:n})=>({id:e,hunk:t,file:n}));return s.length===0?null:{symbol:n.test,targets:s,label:`Test ${n.test}`}},JV=e=>`hunk-${e}`,YV=e=>e===void 0?{}:{marks:e},XV=({id:e,deps:t})=>{let[n]=t.index.items([e]);if(n===void 0)return null;let{hunk:r,file:i,risk:a,proofs:o=[]}=n;return o.length>0?(0,J.jsx)(`div`,{className:Wj,children:(0,J.jsx)(_M,{hunk:r,file:i,risk:a,proofs:o,onFocus:t.onFocusHunk})}):(0,J.jsx)(Zj,{id:e,hunk:r,file:i,risk:a,highlighted:t.highlighted.has(e),onFocus:t.onFocusHunk,unchanged:t.unchangedOf(e),inFile:!0,comments:t.commentsOf(e),openComment:t.openComment?.partId===e?t.openComment.place:null,onOpenComment:t.onOpenComment,...t.onCancelComment===void 0?{}:{onCancelComment:t.onCancelComment},onComment:t.onComment,...t.onCommentNow===void 0?{}:{onCommentNow:t.onCommentNow},afterHeader:t.pointsOn(e),...t.pointLinesOf(e)===void 0?{}:{pointLines:t.pointLinesOf(e)},threadsAt:n=>t.threadsAt(e,n),pointsAt:n=>t.pointsAt(e,n),pointsAtEnd:n=>t.pointsAtEnd(e,n),...t.flaggedOf(e)===void 0?{}:{flagged:t.flaggedOf(e)},...t.rangeNote===void 0?{}:{rangeNote:t.rangeNote},...YV(t.marksOf(e))})},ZV=/^#{1,6}\s+/,QV=e=>e.replace(/!?(\[([^\]]+)\])\([^)]*\)/g,`$2`).replace(/(`+)(.*?)\1/g,`$2`).replace(/(\*\*|__|~~)(.*?)\1/g,`$2`).replace(/(^|\s)[*_]([^*_]+)[*_](?=\s|[.,!?]|$)/g,`$1$2`).replace(/^\s*(?:>\s*|[-*+]\s+|\d+[.)]\s+)/,``).replace(/\\([\\`*_{}[\]()#+.!>-])/g,`$1`),$V=e=>{let t=e.split(`
|
|
84
|
+
`).map(e=>e.trim()).filter(e=>e!==``);return QV(t.find(e=>!ZV.test(e))??t[0]?.replace(ZV,``)??``)},eH=/^(.+?[.!?])\s+(?=[A-Z0-9"'(`[])/,tH=e=>{let t=$V(e);return eH.exec(t)?.[1]??t},nH=`font-medium text-muted-foreground`,rH=({text:e})=>(0,J.jsx)(`span`,{"data-slot":`model-text`,className:`whitespace-pre-line`,children:LV(e).map((e,t)=>e.code?(0,J.jsx)(`code`,{className:`font-mono text-code-compact`,children:e.text},t):(0,J.jsx)(`span`,{children:QV(e.text)},t))}),iH=({through:e})=>(0,J.jsxs)(`span`,{"data-slot":`through`,children:[e.rows.map((e,t)=>(0,J.jsxs)(`span`,{children:[t>0&&` → `,e.map((e,t)=>(0,J.jsxs)(`span`,{children:[t>0&&`, `,(0,J.jsx)(`code`,{className:`font-mono text-code-compact`,children:e.label}),e.entries.length>0&&(0,J.jsxs)(`span`,{className:`text-muted-foreground`,children:[` (`,e.entries.join(`, `),`)`]})]},e.label))]},t)),e.more>0&&(0,J.jsxs)(`span`,{className:`text-muted-foreground`,children:[` `,`· `,e.more,` more `,e.more===1?`directory`:`directories`]})]}),aH=({reach:e})=>{let t=e.symbols.slice(0,3),n=e.symbols.length-t.length,r=t.map((e,r)=>(0,J.jsxs)(`span`,{children:[r>0&&(r===t.length-1&&n===0?` and `:`, `),(0,J.jsx)(`code`,{className:`font-mono text-code-compact`,children:e})]},e));return(0,J.jsxs)(`span`,{"data-slot":`reach`,children:[`Changes `,r,n>0&&` and ${n} more`,`, used in `,e.uses,` `,e.uses===1?`place`:`places`,` the PR doesn't change.`]})},oH=({lead:e,children:t})=>(0,J.jsxs)(`p`,{className:`min-w-0`,children:[(0,J.jsx)(`span`,{className:nH,children:e}),` `,t]}),sH=({analysis:e,through:t,running:n,onDetails:r})=>{let{intent:i,pullRequest:a}=e,o=i?.mismatches??[],s=a===null?``:tH(a.description),[c,l]=(0,q.useState)(i!==null),[u,d]=(0,q.useState)(!1);i!==null!==c&&(l(i!==null),d(i!==null&&n)),u&&!n&&d(!1);let f=(i!==null||a!==null)&&(0,J.jsx)($,{variant:`ghost`,size:`icon-xs`,"aria-label":`Details`,title:`Details`,onClick:r,className:`ml-1 rounded-full align-middle text-muted-foreground`,children:(0,J.jsx)(bg,{"aria-hidden":`true`})}),p=new Map(e.files.flatMap(e=>e.hunks.map(t=>[t.id,e.path]))),m=IV(e.unchangedCallers,e=>p.get(rl(e))),h=t!==null&&(0,J.jsx)(oH,{lead:t.linked?`Through:`:`In:`,children:(0,J.jsx)(iH,{through:t})}),g=m!==null&&(0,J.jsx)(oH,{lead:`Watch:`,children:(0,J.jsx)(aH,{reach:m})}),_=a!==null&&(0,J.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-0.5`,children:[(0,J.jsxs)(`p`,{className:`min-w-0`,children:[s===``?(0,J.jsx)(`span`,{className:`text-muted-foreground`,children:`The pull request has no description.`}):(0,J.jsx)(`span`,{children:s}),!u&&f]}),h,g]}),v=i!==null&&(0,J.jsxs)(`div`,{"data-arriving":u||void 0,className:`flex min-w-0 flex-col gap-0.5`,children:[(0,J.jsxs)(`p`,{className:`min-w-0`,children:[(0,J.jsx)(`span`,{className:o.length===0?`font-medium text-review-approved`:`font-medium`,children:o.length>0||i.stated===null?`From the code:`:`✓ Does what was asked:`}),` `,(0,J.jsx)(rH,{text:i.inferred.summary}),f]}),i.inferred.shape===``?h:(0,J.jsx)(oH,{lead:`Through:`,children:(0,J.jsx)(rH,{text:i.inferred.shape})}),i.inferred.watch.length===0?g:(0,J.jsx)(oH,{lead:`Watch:`,children:i.inferred.watch.map((e,t)=>(0,J.jsxs)(`span`,{children:[t>0&&` · `,(0,J.jsx)(rH,{text:e})]},t))})]});return(0,J.jsx)(`div`,{"data-slot":`intent-brief`,className:`flex min-w-0 flex-col gap-1 text-body`,children:v===!1?_:u?(0,J.jsxs)(`div`,{"data-slot":`intent-swap`,className:`min-w-0`,children:[(0,J.jsx)(`div`,{"data-leaving":!0,"aria-hidden":`true`,children:_}),v]}):v})},cH=`rounded-full border bg-muted px-2 py-0.5 text-caption`,lH=({pullRequest:e,tickets:t,missingTicketKeys:n})=>{let r=e.description.trim();return(0,J.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[r===``?(0,J.jsx)(`p`,{className:`text-muted-foreground`,children:`The pull request has no description.`}):(0,J.jsx)(`p`,{className:`text-body whitespace-pre-line`,children:r}),(t.length>0||n.length>0)&&(0,J.jsxs)(`ul`,{className:`flex flex-wrap gap-2`,"aria-label":`Tickets`,children:[t.map(e=>(0,J.jsx)(`li`,{className:`rounded-full border bg-muted px-2 py-0.5 text-caption`,children:(0,J.jsxs)(`a`,{href:e.url,target:`_blank`,rel:`noreferrer`,children:[e.key,` · `,e.summary]})},e.key)),n.map(e=>(0,J.jsxs)(`li`,{className:`rounded-full border bg-muted px-2 py-0.5 text-caption`,title:`Jira didn't return this ticket, or Jira isn't configured`,children:[e,` · not fetched`]},e))]}),e.commits.length>0&&(0,J.jsxs)(`details`,{className:`group`,children:[(0,J.jsxs)(`summary`,{className:`min-h-6 cursor-pointer font-medium`,children:[`Commits (`,e.commits.length,`)`]}),(0,J.jsx)(`ol`,{className:`mt-1 flex flex-col gap-1`,children:e.commits.map(e=>(0,J.jsxs)(`li`,{children:[(0,J.jsx)(`code`,{className:`font-mono text-code-compact text-muted-foreground`,children:e.sha.slice(0,7)}),` `,e.message.split(`
|
|
85
|
+
`)[0]]},e.sha))})]})]})},uH={description:`Description`,commits:`Commits`,branch:`Branch name`},dH={unrequested:`Unrequested`,missing:`Missing`,contradicts:`Contradicts`},fH={contradicts:`text-review-changes bg-review-changes-bg border-review-changes/25`,missing:`text-review-pending bg-review-pending-bg border-review-pending/25`,unrequested:`text-review-pending bg-review-pending-bg border-review-pending/25`},pH=`whitespace-pre-line`,mH=`text-caption font-medium text-muted-foreground`,hH=({ticketKey:e,ticket:t})=>t===void 0?(0,J.jsxs)(`li`,{className:cH,title:`Jira didn't return this ticket, or Jira isn't configured`,children:[e,` · not fetched`]}):(0,J.jsx)(`li`,{className:cH,children:(0,J.jsxs)(`a`,{href:t.url,target:`_blank`,rel:`noreferrer`,title:t.summary,children:[t.key,` · `,t.status]})}),gH=({stated:e,ticketOf:t,unfetched:n})=>(0,J.jsxs)(J.Fragment,{children:[e!==null&&(0,J.jsx)(`ul`,{className:`flex flex-wrap gap-2`,"aria-label":`Sources`,children:e.sources.map(e=>e.kind===`ticket`&&e.ref!==null?(0,J.jsx)(hH,{ticketKey:e.ref,ticket:t.get(e.ref)},`ticket:${e.ref}`):e.kind===`ticket`?null:(0,J.jsx)(`li`,{className:`rounded-full border bg-muted px-2 py-0.5 text-caption`,children:uH[e.kind]},e.kind))}),n.length>0&&(0,J.jsx)(`ul`,{className:`flex flex-wrap gap-2`,"aria-label":`Tickets mentioned but not fetched`,children:n.map(e=>(0,J.jsx)(hH,{ticketKey:e,ticket:void 0},e))})]}),_H=`No stated intent: the PR has no description or linked tickets.`,vH=({intent:e,tickets:t,missingTicketKeys:n,onSelectMismatch:r})=>{let{stated:i,inferred:a,mismatches:o}=e,s=new Map(t.map(e=>[e.key,e])),c=new Set(i?.sources.flatMap(e=>e.ref??[])??[]),l=n.filter(e=>!c.has(e)),u=(0,J.jsx)(gH,{stated:i,ticketOf:s,unfetched:l}),d=o.length===0?i:null,{behaviorChanges:f}=a;return(0,J.jsxs)(`div`,{className:`flex flex-col gap-4 text-body`,children:[o.length===0?(0,J.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,J.jsxs)(`p`,{children:[i===null?(0,J.jsx)(`span`,{className:`font-medium`,children:`From the code:`}):(0,J.jsx)(`span`,{className:`font-medium text-review-approved`,children:`✓ Does what was asked:`}),` `,(0,J.jsx)(`span`,{className:pH,children:a.summary})]}),i===null&&(0,J.jsx)(`p`,{className:`text-muted-foreground`,children:_H}),u]}):(0,J.jsxs)(`div`,{className:`grid gap-4 md:grid-cols-3`,children:[(0,J.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,J.jsx)(`h3`,{className:mH,children:`Stated`}),i===null?(0,J.jsx)(`p`,{className:`text-muted-foreground`,children:_H}):(0,J.jsx)(`p`,{className:pH,children:i.summary}),u]}),(0,J.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,J.jsx)(`h3`,{className:mH,children:`Inferred from the code`}),(0,J.jsx)(`p`,{className:pH,children:a.summary})]}),(0,J.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,J.jsx)(`h3`,{className:mH,children:`Mismatches`}),(0,J.jsx)(`ul`,{className:`flex flex-col gap-1.5`,children:o.map((e,t)=>(0,J.jsx)(`li`,{children:(0,J.jsxs)(`button`,{type:`button`,className:`flex w-full flex-col items-start gap-1 rounded-md border p-2 text-left hover:bg-accent`,onClick:()=>r(t),children:[(0,J.jsxs)(`span`,{className:X(`rounded-full border px-2 text-caption font-medium`,fH[e.kind]),children:[(0,J.jsx)(`span`,{"aria-hidden":`true`,children:`⚠ `}),dH[e.kind]]}),(0,J.jsx)(`span`,{className:pH,children:e.description})]})},t))})]})]}),(d!==null||f.length>0)&&(0,J.jsxs)(`details`,{className:`flex flex-col gap-2`,children:[(0,J.jsxs)(`summary`,{className:`min-h-6 cursor-pointer font-medium`,children:[`Details`,f.length>0&&` (${f.length})`]}),d!==null&&(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(`h3`,{className:X(mH,`mt-2`),children:`Asked`}),(0,J.jsx)(`p`,{className:pH,children:d.summary})]}),f.length>0&&(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(`h3`,{className:X(mH,`mt-2`),children:`Behavior changes`}),(0,J.jsx)(`ul`,{className:`list-disc pl-5`,children:f.map((e,t)=>(0,J.jsx)(`li`,{className:pH,children:e},t))})]})]})]})},yH=3,bH=(e,t)=>{let n=e.end??t;return n===null?null:Math.max(0,n-e.start+1)},xH=e=>({head:e.newLines===0?e.newStart+1:e.newStart+e.newLines,base:e.oldLines===0?e.oldStart+1:e.oldStart+e.oldLines}),SH=e=>e.newLines===0?e.newStart+1:e.newStart,CH=e=>{let t=e.lines.at(-1);if(t===void 0||t.noNewlineAtEnd)return!0;let n=0;for(let t=e.lines.length-1;t>=0&&e.lines[t]?.kind===`context`;t--)n++;return n<yH},wH=e=>!e.binary&&e.status!==`added`&&e.status!==`deleted`,TH=(e,t)=>{let n=e.flatMap(e=>{let n=t.parts.get(e);return n===void 0?[]:[{id:e,hunk:n.hunk}]}),r=[],i=n[0];if(i===void 0)return r;let a=SH(i.hunk)-1;a>0&&r.push({before:i.id,after:null,start:1,end:a,offset:0});for(let[e,{id:t,hunk:i}]of n.entries()){let a=xH(i),o=n[e+1],s=a.base-a.head;if(o===void 0){CH(i)||r.push({before:null,after:t,start:a.head,end:null,offset:s});continue}let c=SH(o.hunk)-1;c>=a.head&&r.push({before:o.id,after:t,start:a.head,end:c,offset:s})}return r},EH=(e,t)=>Array.from({length:bH(e,t)??0},(t,n)=>e.start+n),DH=e=>{let t=e.split(`
|
|
86
|
+
`);return t.at(-1)===``&&t.pop(),t.map(e=>e.endsWith(`\r`)?e.slice(0,-1):e)},OH=(e,t)=>{let{client:n}=yp(),[r,i]=(0,q.useState)({status:`idle`}),a=(0,q.useRef)(`idle`);return{text:r,load:(0,q.useCallback)(()=>{if(a.current===`loading`||a.current===`ready`)return;let r=e=>{a.current=e.status,i(e)};r({status:`loading`}),n.getFileContent(e,`head`,t).then(e=>r(e.ok?e.value.content===null?{status:`error`,message:`The file isn't at the pull request's head commit.`}:{status:`ready`,lines:DH(e.value.content)}:{status:`error`,message:Ap(e.error)}))},[n,e,t])}},kH=()=>(0,J.jsx)(`svg`,{"data-slot":`unfold-icon`,className:`shrink-0`,viewBox:`0 0 16 16`,width:`16`,height:`16`,"aria-hidden":`true`,focusable:`false`,children:(0,J.jsx)(`path`,{d:`M8 1.5v4M5.5 3.5 8 1l2.5 2.5M8 14.5v-4M5.5 12.5 8 15l2.5-2.5M2 8h12`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.5`,strokeLinecap:`round`,strokeLinejoin:`round`})}),AH=e=>`${e} ${e===1?`line`:`lines`}`,jH=(e,t,n,r)=>e.map(e=>({oldNo:e+t.offset,newNo:e,text:n[e-1]??``,tokens:r?.[e-1]??null})),MH=({fold:e,file:t,hunkId:n,opened:r,text:i,onOpen:a,above:o,below:s})=>{let c=i.status===`ready`?i.lines:null,l=wA(c,t),u=bH(e,c?.length??null);if(u===0)return null;if(r&&c!==null)return(0,J.jsx)(`div`,{"data-slot":`file-fold`,children:(0,J.jsx)(SM,{hunkId:n,lines:jH(EH(e,c.length),e,c,l)})});let d=r&&i.status===`loading`,f=u===null?`Unchanged lines below`:`${AH(u)} unchanged`;return(0,J.jsxs)(`div`,{"data-slot":`file-gap`,className:X(`flex flex-wrap items-center bg-surface-subtle text-muted-foreground`,Wj,o&&`border-t`,s?`border-b`:`rounded-b-lg`),children:[(0,J.jsxs)(`button`,{type:`button`,"data-slot":`fold-open`,"aria-busy":d||void 0,disabled:d,onClick:a,className:X(`flex min-h-8 flex-1 items-center gap-2 px-3 cursor-pointer text-left -outline-offset-2 hover:bg-accent hover:text-foreground disabled:cursor-wait disabled:hover:bg-transparent`,!s&&`rounded-b-lg`),children:[(0,J.jsx)(kH,{}),d?(0,J.jsxs)(`span`,{role:`status`,className:`flex items-center gap-1.5`,children:[(0,J.jsx)(`span`,{"aria-hidden":`true`,className:`size-3 animate-spin rounded-full border-2 border-muted-foreground border-t-transparent`}),`Opening `,u===null?`unchanged lines below`:f]}):(0,J.jsx)(`span`,{children:f})]}),r&&i.status===`error`&&(0,J.jsx)(`span`,{role:`alert`,className:`px-3 text-destructive`,children:i.message})]})},NH=e=>e===`map`?`map`:e===`overview`||e===`tree`?`overview`:void 0,PH=(e,t)=>TF(e.path,t.path),FH=`Not classified yet.`,IH=e=>{let t=al(e.parts),n=new Map,r=new Map;for(let i of e.files){for(let e of i.hunks){let n=t.get(e.id)??[],i=n.map(e=>e.id);r.set(e.id,n.length>0?i:[e.id])}for(let e of ol(i,t)){let r=t.get(e.hunk.id)??[],a=r.findIndex(t=>t.id===e.id),o=r[a];n.set(e.id,{hunk:e.hunk,file:i,place:o===void 0?null:{n:a+1,of:r.length,definitions:o.definitions,siblings:r.map(e=>e.id)}})}}let i=new Map(e.risk.map(e=>[e.hunkId,e])),a=new Map;for(let t of e.proofs)t.hunkId!==null&&a.set(t.hunkId,[...a.get(t.hunkId)??[],t]);let o=new Set(a.keys()),s=e=>{let t=rl(e);return i.get(t)??{hunkId:t,riskClass:`logic`,reason:FH,source:`fallback`,lines:null,guidance:null}},c=e=>e.flatMap(e=>{let t=n.get(e);return t===void 0?[]:[{...t,id:e,hunkId:rl(e),risk:s(e),proofs:a.get(e)??[]}]}),l=e=>r.get(e)??[];return{parts:n,mechanical:o,items:c,partsOf:l,partsInFile:e=>e.hunks.flatMap(e=>l(e.id))}},LH=(e,t)=>[...e.files].sort(PH).flatMap(e=>e.hunks.flatMap(e=>t.partsOf(e.id))).filter(e=>!t.mechanical.has(e)),RH=(e,t)=>{let n=e.tour?.steps??[],r=new Set(n.flatMap(e=>e.partIds)),i=LH(e,t).filter(e=>!r.has(e));return i.length===0?n:[...n,{id:yu.parse(`s${n.length+1}`),title:`Changes the tour left out`,explanation:`The tour didn't include these changes, so they're shown here in file order.`,partIds:i,kind:`supporting`,via:[],entries:[],codeTitle:null,merged:[]}]},zH=(e,t)=>[...e.files].sort((e,t)=>TF(e.path,t.path)).flatMap(e=>{let n=t.partsInFile(e);return n.every(e=>t.mechanical.has(e))?[]:[{file:e,partIds:n}]}),BH=(e,t,n)=>{let r=n.parts.get(e),i=n.parts.get(t);if(r===void 0||i===void 0||r.file!==i.file)return null;let a=r.file.status===`deleted`?`old`:`new`,o=e=>a===`old`?{start:e.oldStart,count:e.oldLines}:{start:e.newStart,count:e.newLines},s=o(r.hunk),c=o(i.hunk),l=s.count===0?s.start:s.start+s.count-1,u=c.count===0?c.start+1:c.start;return Math.max(u-l-1,0)},VH=(e,t,n)=>{let r=new Map(t.map((e,t)=>[e,t])),i=new Map,a=new Map,o=new Map,s=[],c=(e,t,n)=>e.set(t,[...e.get(t)??[],n]);for(let t of e){let e=[...new Set(t.hunkIds)].flatMap(n.partsOf).filter(e=>r.has(e)&&!n.mechanical.has(e)).sort((e,t)=>(r.get(e)??0)-(r.get(t)??0)),l=t.lines===null?void 0:HH(t.lines,e,n),[u=l,...d]=l===void 0?e:[l,...e.filter(e=>e!==l)];if(u===void 0){s.push(t);continue}c(i,u,t),o.set(t.id,u);let f=l===void 0?null:rl(u);for(let e of d)rl(e)!==f&&c(a,e,t)}return{cards:i,mentions:a,cardPart:o,unplaced:s}},HH=(e,t,n)=>t.find(t=>n.parts.get(t)?.hunk.lines.some(t=>{let n=Uj(t);return n!==null&&n.side===e.side&&n.line===e.startLine})),UH=e=>{let t=new Set,n=0;for(let r of e)r.hunkId===null?n+=1:t.add(r.hunkId);return t.size+n},WH=(e,t)=>{let n=new Set([...t.parts].flatMap(([e,{file:n}])=>t.mechanical.has(e)?[]:[n.path]));return e.proofs.filter(e=>e.hunkId===null||!n.has(e.path))},GH=(e,t)=>{let n=new Map;for(let r of e){let e=t.partsOf(r.hunkId).find(e=>t.parts.get(e)?.hunk.lines.some(e=>{let t=Uj(e);return t!==null&&t.side===r.side&&t.line===r.line}));e!==void 0&&n.set(e,[...n.get(e)??[],r])}return n},KH=e=>({files:e.length,additions:e.reduce((e,t)=>e+t.additions,0),deletions:e.reduce((e,t)=>e+t.deletions,0)}),qH=e=>({threads:e.length,unresolved:e.filter(e=>!e.resolved).length}),JH=`mechanical-changes`,YH=e=>`file-${e}`,XH=(0,q.memo)(function({render:e}){return e()},(e,t)=>e.signature===t.signature),ZH=({id:e,joined:t,deps:n,signatureOf:r})=>(0,J.jsx)(`div`,{id:JV(e),className:X(`scroll-mt-24`,!t&&`border-t first:border-t-0`),"data-hunk-id":e,children:(0,J.jsx)(XH,{signature:r(e),render:()=>(0,J.jsx)(XV,{id:e,deps:n})})}),QH=({lines:e})=>e===0?null:(0,J.jsx)(`div`,{"data-slot":`file-gap`,className:X(`flex h-8 items-center gap-2 border-t bg-surface-subtle px-3 text-muted-foreground`,Wj),children:(0,J.jsxs)(`span`,{children:[e,` `,e===1?`line`:`lines`,` unchanged`]})}),$H=({analysisId:e,group:t,deps:n,signatureOf:r})=>{let i=n.index.items(t.partIds),a=i.reduce((e,t)=>e+aA(t.hunk).added,0),o=i.reduce((e,t)=>e+aA(t.hunk).deleted,0),s=n.openThreads(t.file.path),c=n.earlierThreads(t.file.path),{text:l,load:u}=OH(e,t.file.path),[d,f]=(0,q.useState)(new Set),p=(0,q.useMemo)(()=>wH(t.file)?TH(t.partIds,n.index):[],[t,n.index]),m=e=>`${e.after??``}>${e.before??``}`,h=e=>{let r=m(e),i=e.before??e.after,a=i===null?void 0:n.index.parts.get(i);return a===void 0?null:(0,J.jsx)(MH,{fold:e,file:t.file,hunkId:a.hunk.id,opened:d.has(r),text:l,above:e.after!==null,below:e.before!==null,onOpen:()=>{u(),f(e=>new Set(e).add(r))}},r)};return(0,J.jsxs)(`section`,{id:YH(t.file.path),"data-slot":`file-card`,className:`scroll-mt-2 rounded-lg border bg-card -outline-offset-2`,"aria-label":t.file.path,"data-path":t.file.path,tabIndex:-1,children:[(0,J.jsxs)(`header`,{"data-slot":`file-card-header`,className:`sticky top-[var(--review-bar-h,0px)] z-10 flex flex-wrap items-center gap-x-3 gap-y-1 rounded-t-lg border-b bg-card px-3 py-2`,children:[(0,J.jsx)($D,{file:t.file,status:t.file.status,className:`min-w-0 flex-1`}),(0,J.jsx)(eO,{status:t.file.status}),(0,J.jsxs)(`span`,{className:`tabular flex flex-wrap items-center gap-x-1.5 text-caption`,children:[s>0&&(0,J.jsxs)(`span`,{"data-slot":`count-threads`,className:`inline-flex items-center gap-1.5 font-medium`,children:[(0,J.jsx)(WF,{count:s}),(0,J.jsx)(`span`,{"aria-hidden":`true`,children:`·`})]}),(0,J.jsxs)(`span`,{className:`font-mono text-code-compact`,children:[(0,J.jsxs)(`span`,{className:`text-diff-add-fg`,children:[`+`,a]}),` `,(0,J.jsxs)(`span`,{className:`text-diff-del-fg`,children:[`−`,o]})]})]})]}),(0,J.jsx)(`div`,{"data-slot":`file-lines`,className:`@container overflow-x-auto rounded-b-lg`,children:(0,J.jsxs)(`div`,{className:`w-max min-w-full`,children:[t.partIds.map((e,i)=>{let a=t.partIds[i-1],o=a===void 0?null:BH(a,e,n.index),s=p.find(t=>t.before===e);return(0,J.jsxs)(q.Fragment,{children:[s===void 0?o!==null&&(0,J.jsx)(QH,{lines:o}):h(s),(0,J.jsx)(ZH,{id:e,joined:o===0||s!==void 0,deps:n,signatureOf:r})]},e)}),p.filter(e=>e.before===null).map(h)]})}),c!==null&&(0,J.jsxs)(`section`,{"data-slot":`earlier-comments`,"aria-label":`Earlier comments on ${t.file.path}`,className:`flex flex-col gap-2 border-t bg-surface-subtle px-3 py-2`,children:[(0,J.jsx)(`h3`,{className:`text-caption font-medium text-muted-foreground`,children:`Earlier comments`}),c]})]})},eU=({analysis:e,files:t,deps:n,before:r,after:i,trailingProofs:a,mechanicalCount:o,scrollRequest:s,signatureOf:c})=>((0,q.useEffect)(()=>{if(s===null)return;let e=document.getElementById(s.id);if(e===null)return;let t=(e.dataset.hunkId===void 0?null:e.querySelector(`[data-slot=hunk-card], [data-slot=mechanical-toggle]`))??e,n=e.dataset.slot===`decision`;e.scrollIntoView({block:n?`center`:`start`}),t.focus({preventScroll:!0})},[s]),(0,J.jsxs)(`section`,{className:`flex min-w-0 flex-col gap-4`,"aria-label":`Changes`,children:[r,t.map(t=>(0,J.jsx)($H,{analysisId:e.id,group:t,deps:n,signatureOf:c},t.file.path)),i,(0,J.jsxs)(`div`,{id:JH,className:`flex scroll-mt-2 flex-col gap-4 -outline-offset-2`,tabIndex:-1,children:[o===0&&e.stages.prep===`done`&&(0,J.jsx)(`p`,{className:`text-muted-foreground`,children:`No mechanical changes in this pull request.`}),(0,J.jsx)(vM,{files:e.files,proofs:a,risk:e.risk}),(0,J.jsx)(xM,{files:e.files})]})]})),tU={intent:`Intent`,findings:`Findings`,risk:`Risk`,decisions:`Decisions`},nU=e=>e>=1e6?`${(e/1e6).toFixed(1)}M`:e>=1e3?`${Math.round(e/1e3)}k`:`${e}`,rU=e=>`$${e.toFixed(2)}`,iU=e=>e===void 0?`—`:`${(e/1e3).toFixed(1)} s`,aU=e=>e===null?null:`${e.modelName} through ${e.providerName}`,oU=new Intl.ListFormat(`en`,{type:`conjunction`}),sU=e=>{if(e===null)return null;let t=e.preferences.length,n=[...t===0?[]:[`${t} ${t===1?`preference`:`preferences`}`],...e.guidelines.map(e=>e.path)];return n.length===0?null:oU.format(n)},cU=(e,t)=>{let n=aU(e),r=sU(t);return r===null?n:n===null?`With ${r}`:`${n} with ${r}`},lU=e=>e===null?`—`:rU(e),uU=(e,t,n=`Claude`)=>{let r=e.filter(e=>e!==null),i=e.length-r.length,a=t?`on your ${n} plan`:null;if(r.length===0)return a??`cost unknown`;let o=rU(r.reduce((e,t)=>e+t,0)),s=i===0?``:`, cost unknown for ${i} ${i===1?`call`:`calls`}`;return a===null?`${o}${s}`:`≈ ${o} at API prices${s}, ${a}`},dU=e=>e.inputTokens+e.cacheWriteTokens,fU=({usage:e,option:t=null,guidance:n=null})=>{let r=(0,q.useId)();if(e.length===0)return null;let i=t=>e.reduce((e,n)=>e+t(n),0),a=e.some(e=>e.billing===`plan`),o=e.some(e=>e.durationMs!==void 0);return(0,J.jsxs)(`div`,{className:`group relative flex justify-end`,children:[(0,J.jsxs)(`button`,{type:`button`,className:`peer tabular min-h-6 rounded-sm text-caption text-muted-foreground hover:text-foreground`,"aria-describedby":`${r}-breakdown`,children:[cU(t,n)===null?``:`${cU(t,n)} · `,`Usage: `,nU(i(dU)),` tokens in ·`,` `,nU(i(e=>e.cacheReadTokens)),` cache read ·`,` `,nU(i(e=>e.outputTokens)),` out ·`,` `,uU(e.map(e=>e.costUsd),a,Pl(t))]}),(0,J.jsxs)(`table`,{id:`${r}-breakdown`,role:`tooltip`,className:`tabular absolute right-0 bottom-full mb-2 hidden rounded-xl bg-popover p-3 text-caption text-popover-foreground shadow-md ring-1 ring-foreground/10 group-hover:table peer-focus-visible:table [&_td]:px-2 [&_td]:text-right [&_th]:px-2 [&_th]:text-left [&_thead_th]:font-medium [&_thead_th]:text-muted-foreground`,children:[(0,J.jsx)(`thead`,{children:(0,J.jsxs)(`tr`,{children:[(0,J.jsx)(`th`,{scope:`col`,children:`Pass`}),(0,J.jsx)(`th`,{scope:`col`,children:`In`}),(0,J.jsx)(`th`,{scope:`col`,children:`Cache read`}),(0,J.jsx)(`th`,{scope:`col`,children:`Out`}),(0,J.jsx)(`th`,{scope:`col`,children:a?`At API prices`:`Cost`}),o&&(0,J.jsx)(`th`,{scope:`col`,children:`Time`})]})}),(0,J.jsx)(`tbody`,{children:e.map(e=>(0,J.jsxs)(`tr`,{children:[(0,J.jsx)(`th`,{scope:`row`,children:tU[e.pass]}),(0,J.jsx)(`td`,{children:nU(dU(e))}),(0,J.jsx)(`td`,{children:nU(e.cacheReadTokens)}),(0,J.jsx)(`td`,{children:nU(e.outputTokens)}),(0,J.jsx)(`td`,{children:lU(e.costUsd)}),o&&(0,J.jsx)(`td`,{children:iU(e.durationMs)})]},e.pass))})]})]})},pU={intent:`Intent`,findings:`Findings`,risk:`Risk`,decisions:`Decisions`},mU=e=>{let t=Math.round(e/1e3);return`+${Math.floor(t/60)}:${String(t%60).padStart(2,`0`)}`},hU=e=>{if(e.outcome===`ok`)return`✓ Answered`;if(e.outcome===`failed`)return`✕ Failed: ${e.error?.kind??`unknown`}`;let t=e.problems.length;return`⚠ ${t} ${t===1?`problem`:`problems`}`},gU=e=>[...e].sort((e,t)=>Date.parse(e.startedAt)-Date.parse(t.startedAt)||e.attempt-t.attempt),_U=({guidance:e,leftOut:t})=>{let n=sU(e);return n===null?null:(0,J.jsxs)(`section`,{"aria-label":`What the run read beside the code`,className:`flex flex-col gap-1.5`,children:[(0,J.jsx)(`h3`,{className:`font-medium`,children:`Read beside the code`}),(0,J.jsxs)(`p`,{className:`text-ui text-muted-foreground`,children:[n,`, as they were when the run started.`,` `,t===0?`No point was left out by them.`:`${t} ${t===1?`point was`:`points were`} left out by them, folded where ${t===1?`its card`:`their cards`} would be.`,` `,(0,J.jsx)(__,{to:o_,className:`underline`,children:`Preferences`})]}),(0,J.jsxs)(`ul`,{className:`flex flex-col gap-1 text-ui`,children:[e.preferences.map(e=>(0,J.jsxs)(`li`,{className:`flex flex-wrap items-center gap-x-2 gap-y-0.5`,children:[(0,J.jsx)(KB,{kind:e.kind}),(0,J.jsx)(`span`,{className:`min-w-0 flex-1 basis-56 break-words`,children:e.text}),(0,J.jsx)(`span`,{className:`text-caption text-muted-foreground`,children:e.scope.kind===`global`?`Everywhere`:YB(e.scope.repo)})]},e.ref)),e.guidelines.map(e=>(0,J.jsxs)(`li`,{className:`flex items-center gap-2`,children:[(0,J.jsx)(eg,{"aria-hidden":`true`,className:`size-3.5 shrink-0 text-muted-foreground`}),(0,J.jsx)(`span`,{className:`font-mono text-code-compact break-all`,children:e.path}),(0,J.jsx)(`span`,{className:`tabular text-caption text-muted-foreground`,children:HL(e.bytes)})]},e.ref))]})]})},vU=({calls:e,option:t,guidance:n=null,leftOut:r=0})=>{let[i,a]=(0,q.useState)(!1),o=gU(e),s=o[0];if(s===void 0)return null;let c=Date.parse(s.startedAt),l=Math.max(...o.map(e=>Date.parse(e.startedAt)+e.durationMs));return(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)($,{variant:`ghost`,size:`xs`,onClick:()=>a(!0),children:`Run details…`}),i&&(0,J.jsxs)(aV,{title:`${Rl(t)}'s calls`,onClose:()=>a(!1),className:`sm:max-w-3xl`,children:[(0,J.jsxs)(`p`,{className:`text-ui text-muted-foreground`,children:[aU(t)===null?``:`On ${aU(t)}. `,iU(l-c),` from the first call to the end of the last. A call whose answer has problems runs once more, told what they are.`]}),(0,J.jsxs)(`table`,{className:`tabular w-full text-ui [&_td]:px-2 [&_td]:py-1 [&_td]:align-top [&_th]:px-2 [&_th]:py-1 [&_th]:text-left [&_th]:align-top [&_th]:font-normal [&_thead_th]:font-medium [&_thead_th]:text-muted-foreground`,children:[(0,J.jsx)(`thead`,{children:(0,J.jsxs)(`tr`,{children:[(0,J.jsx)(`th`,{scope:`col`,children:`Pass`}),(0,J.jsx)(`th`,{scope:`col`,children:`Started`}),(0,J.jsx)(`th`,{scope:`col`,children:`Time`}),(0,J.jsx)(`th`,{scope:`col`,children:`Outcome`})]})}),(0,J.jsx)(`tbody`,{children:o.map(e=>{let t=e.error===null?e.problems:[e.error.message];return(0,J.jsxs)(`tr`,{children:[(0,J.jsxs)(`th`,{scope:`row`,children:[pU[e.pass],e.attempt>1&&(0,J.jsx)(`span`,{className:`text-muted-foreground`,children:` · again`})]}),(0,J.jsx)(`td`,{children:mU(Date.parse(e.startedAt)-c)}),(0,J.jsx)(`td`,{children:iU(e.durationMs)}),(0,J.jsxs)(`td`,{children:[(0,J.jsx)(`span`,{className:e.outcome===`failed`?`text-destructive`:void 0,children:hU(e)}),t.length>0&&(0,J.jsx)(`ul`,{className:`mt-1 list-disc pl-4 text-muted-foreground`,children:t.map(e=>(0,J.jsx)(`li`,{children:e},e))})]})]},`${e.pass}/${e.attempt}/${e.startedAt}`)})})]}),n!==null&&(0,J.jsx)(_U,{guidance:n,leftOut:r})]})]})},yU={logic:`border-risk-logic-solid bg-risk-logic-bg text-risk-logic`,mechanical:`border-risk-mechanical-solid bg-risk-mechanical-bg text-risk-mechanical`},bU=`border-dashed border-input bg-surface-subtle text-muted-foreground`,xU={call:``,import:`[stroke-dasharray:6_4]`,request:`stroke-muted-foreground [stroke-dasharray:12_4_3_4] [stroke-width:2.5]`,type:`[stroke-dasharray:1.5_3] [stroke-linecap:round]`,outside:`[stroke-dasharray:4_4] opacity-60`},SU=56,CU=24,wU=16,TU=120,EU=300,DU=8.6,OU=6.6,kU=6.7,AU=32,jU=24,MU=20,NU=380,PU=e=>e.slice(e.lastIndexOf(`/`)+1),FU=e=>e===1?`1 use`:`${e} uses`,IU=e=>e===1?`1 file`:`${e} files`,LU=e=>e.kind===`outside`?`${e.paths.length>1?`${IU(e.paths.length)} · `:``}outside the PR · ${FU(e.uses)}`:[e.kind===`group`?IU(e.paths.length):`+${e.added} −${e.deleted}`,...e.entries].join(` · `),RU=e=>{let t=e.badges.reduce((e,t)=>e+PU(t).length*kU+14,0),n=Math.min(Math.max(e.label.length*DU+AU+(e.kind===`group`&&e.paths.length>1?jU:0),LU(e).length*OU+MU,t+MU),NU),r=TU+Math.sqrt(e.added+e.deleted)*9;return Math.round(Math.max(n,Math.min(r,EU)))},zU=72,BU=(e,t)=>{let n=e.map(e=>e.reduce((e,t,n)=>e+RU(t)+(n>0?CU:0),0)),r=Math.max(0,...n)+32,i=r+(t?zU:0),a=new Map;return e.forEach((e,t)=>{let i=(r-(n[t]??0))/2;for(let n of e){let e=RU(n);a.set(n.key,{x:i,y:wU+t*120,width:e}),i+=e+CU}}),{boxes:a,width:i,height:e.length===0?0:32+e.length*64+(e.length-1)*SU}},VU=e=>e.outside?`outside`:e.uses.includes(`request`)?`request`:e.uses.includes(`call`)?`call`:e.uses.every(e=>e===`import`)?`import`:`type`,HU=(e,t)=>{let n=e=>{let n=t.get(e);return n===void 0?0:n.x+n.width/2},r=(e,r,i)=>{let a=t.get(r),o=[...e].sort((e,t)=>n(i(e))-n(i(t)));return new Map(o.map((e,t)=>[e,a===void 0?0:a.x+a.width*(.5+(o.length===1?0:(t/(o.length-1)-.5)*.5))]))},i=e.filter(e=>!e.back&&!e.outside),a=new Map,o=new Map;for(let e of t.keys()){for(let[t,n]of r(i.filter(t=>t.from===e),e,e=>e.to))a.set(t,n);for(let[t,n]of r(i.filter(t=>t.to===e),e,e=>e.from))o.set(t,n)}return{out:a,into:o}},UU=(e,t,n,r,i=e.x+e.width/2,a=t.x+t.width/2)=>{if(n){let n=e.x+e.width,i=t.x+t.width,a=e.y+32,o=t.y+32,s=r-zU/2;return`M ${n} ${a} C ${s} ${a} ${s} ${o} ${i} ${o}`}if(e.y>t.y){let n=e.y,r=t.y+64,o=Math.max(SU/2,(n-r)/2);return`M ${i} ${n} C ${i} ${n-o} ${a} ${r+o} ${a} ${r}`}let o=e.y+64,s=t.y,c=Math.max(SU/2,(s-o)/2);return`M ${i} ${o} C ${i} ${o+c} ${a} ${s-c} ${a} ${s}`},WU={import:`imports`,call:`calls`,type:`uses types from`,request:`sends requests to`},GU=(e,t)=>{let n=e.uses.map(e=>WU[e]).join(`, `),r=e.symbols.length>0?`: ${e.symbols.join(`, `)}`:``;return`${t(e.from)} ${n} ${t(e.to)}${r}`},KU=({node:e,box:t,active:n,current:r,onOpen:i,onExpand:a,onFocus:o})=>{let s=e.kind===`group`,c=e.kind===`outside`,l=(c?[e.label,LU(e)]:[e.label,s?IU(e.paths.length):null,...e.entries,e.risk,e.generated?`generated`:null,r?`in view in the code`:null]).filter(e=>e!==null).join(`, `);return(0,J.jsxs)(`div`,{"data-slot":`overview-node-box`,className:X(`grid`,t===void 0?`relative`:`absolute`),style:t===void 0?{width:RU(e)}:{left:t.x,top:t.y,width:t.width,height:64},children:[(0,J.jsxs)(`button`,{type:`button`,"data-slot":`overview-node`,"data-risk":c?`outside`:e.risk,"data-generated":e.generated||void 0,"data-active":n||void 0,"data-current":r||void 0,className:X(`grid h-full w-full content-start gap-0.5 overflow-hidden rounded-md border px-2 py-1 text-left text-caption`,c?bU:yU[e.risk],e.generated&&`border-dashed`,n&&`border-primary`,r&&`shadow-[0_0_0_2px_var(--background),0_0_0_4px_var(--primary)]`),"data-key":e.key,"aria-label":l,"aria-current":r?`location`:void 0,title:s?e.label:e.paths.length===1?e.paths[0]:void 0,onClick:()=>i(e),onFocus:()=>o(e),onMouseEnter:()=>o(e),onMouseLeave:()=>o(null),children:[(0,J.jsx)(`span`,{className:X(`flex min-w-0 items-baseline gap-2`,s&&`pr-6`),children:(0,J.jsx)(`span`,{"data-slot":`overview-label`,className:`min-w-0 truncate font-mono text-code-compact font-semibold`,children:e.label})}),(0,J.jsx)(`span`,{className:`truncate`,children:LU(e)}),e.badges.length>0&&(0,J.jsx)(`span`,{className:`flex gap-1 overflow-hidden`,children:e.badges.map(e=>(0,J.jsx)(`span`,{className:`shrink-0 rounded-sm border border-current px-1 font-mono text-kbd`,children:PU(e)},e))})]}),s&&e.paths.length>1&&(0,J.jsx)($,{variant:`ghost`,size:`icon-xs`,className:`absolute top-1 right-1 text-current`,"aria-label":`Show the files of ${e.label}`,title:`Show its files`,onClick:()=>a(e),children:(0,J.jsx)(wg,{"aria-hidden":`true`})})]})},qU=({overview:e,focusKey:t,currentPath:n,onOpen:r,onExpand:i,onCollapse:a,expandedGroups:o,onFocusNode:s})=>{let c=(0,q.useId)(),l=(0,q.useRef)(null),[u,d]=(0,q.useState)(null),{boxes:f,width:p,height:m}=(0,q.useMemo)(()=>BU(e.rows,e.edges.some(e=>e.back)),[e]),h=(0,q.useMemo)(()=>HU(e.edges,f),[e.edges,f]),g=(0,q.useMemo)(()=>new Map([...e.rows.flat(),...e.strip].map(e=>[e.key,e.label])),[e]),_=e=>g.get(e)??e,v=(0,q.useMemo)(()=>[...e.rows,e.strip].filter(e=>e.length>0),[e]);(0,q.useEffect)(()=>d(null),[e]);let y=(0,q.useRef)(-1);(0,q.useEffect)(()=>{if(t===null||y.current===t.n)return;let n=e.placeOf.get(t.key)??t.key,r=l.current?.querySelector(`[data-key="${CSS.escape(n)}"]`);r!=null&&(y.current=t.n,r.focus(),r.scrollIntoView?.({block:`nearest`,inline:`nearest`}))},[t,e]);let b=e=>l.current?.querySelector(`[data-key="${CSS.escape(e)}"]`)?.focus(),x=e=>{let t=e.target.dataset.key;if(t===void 0)return;let n=v.findIndex(e=>e.some(e=>e.key===t)),r=v[n]?.findIndex(e=>e.key===t)??-1,i=e=>{let t=l.current?.querySelector(`[data-key="${CSS.escape(e.key)}"]`)?.getBoundingClientRect();return t===void 0?0:t.left+t.width/2},a;if(e.key===`ArrowRight`)a=v[n]?.[r+1];else if(e.key===`ArrowLeft`)a=v[n]?.[r-1];else if(e.key===`ArrowDown`||e.key===`ArrowUp`){let t=v[n+(e.key===`ArrowDown`?1:-1)]??[],o=v[n]?.[r],s=o===void 0?0:i(o);a=[...t].sort((e,t)=>Math.abs(i(e)-s)-Math.abs(i(t)-s))[0]}else return;e.preventDefault(),a!==void 0&&b(a.key)},S=u?.kind===`node`?u.node.key:null,C=e=>e.from===S||e.to===S,w=e=>{e!==null&&s(e.key),d(e===null?null:{kind:`node`,node:e})},T=n===null?null:e.placeOf.get(n)??null,E=e=>({node:e,active:S===e.key,current:T===e.key,onOpen:r,onExpand:e=>i(e.key),onFocus:w});return(0,J.jsxs)(`section`,{className:`flex min-w-0 flex-col gap-3`,"aria-label":`Overview of the changed files`,ref:l,onKeyDown:x,children:[(0,J.jsxs)(`p`,{"data-slot":`overview-legend`,className:`text-muted-foreground`,children:[`Each box is a directory. Directories that nothing in the pull request calls are on top; each sits below its callers. Solid lines are calls, dash-dot ones HTTP requests to a route, dashed ones imports, dotted ones types. Tests show on the directories they call. The outlined box holds the file last in view in the code.`,e.edges.some(e=>e.outside)&&` Faded files are outside the pull request, under the code whose changes they use.`]}),o.length>0&&(0,J.jsx)(`p`,{className:`flex flex-wrap gap-2`,children:o.map(e=>(0,J.jsxs)($,{variant:`outline`,size:`sm`,onClick:()=>a(e),children:[`Collapse `,e.slice(6),`/`]},e))}),e.rows.length>0?(0,J.jsx)(`div`,{"data-slot":`overview-scroll`,className:`overflow-x-auto rounded-lg border bg-surface-subtle`,children:(0,J.jsxs)(`div`,{"data-slot":`overview-diagram`,className:`relative mx-auto`,style:{width:p,height:m},children:[(0,J.jsxs)(`svg`,{className:`absolute inset-0 overflow-visible`,width:p,height:m,"aria-hidden":`true`,children:[(0,J.jsx)(`defs`,{children:(0,J.jsx)(`marker`,{id:`${c}-arrow`,viewBox:`0 0 8 8`,refX:`7`,refY:`4`,markerWidth:`7`,markerHeight:`7`,orient:`auto-start-reverse`,children:(0,J.jsx)(`path`,{d:`M 0 0 L 8 4 L 0 8 z`,className:`fill-input`})})}),e.edges.map(e=>{let t=f.get(e.from),n=f.get(e.to);if(t===void 0||n===void 0)return null;let r=UU(t,n,e.back,p,h.out.get(e),h.into.get(e)),i=C(e)||u?.kind===`edge`&&u.edge===e,a=u!==null&&!i;return(0,J.jsxs)(`g`,{"data-slot":`overview-edge`,"data-style":VU(e),"data-lit":i||void 0,"data-dim":a||void 0,className:X(a&&`opacity-30`),onMouseEnter:()=>d({kind:`edge`,edge:e}),onMouseLeave:()=>d(null),children:[(0,J.jsx)(`path`,{d:r,className:`fill-none stroke-transparent [stroke-width:10]`}),(0,J.jsx)(`path`,{d:r,className:X(`fill-none stroke-input [stroke-width:1.5]`,xU[VU(e)],i&&`stroke-primary [stroke-width:2]`),markerEnd:`url(#${c}-arrow)`}),(0,J.jsx)(`title`,{children:GU(e,_)})]},`${e.from}>${e.to}`)})]}),e.rows.flat().map(e=>(0,J.jsx)(KU,{box:f.get(e.key),...E(e)},e.key))]})}):(0,J.jsx)(`p`,{className:`text-muted-foreground`,children:`No changed file calls or imports another.`}),e.strip.length>0&&(0,J.jsxs)(`section`,{"aria-label":`Not linked`,className:`flex flex-col gap-2`,children:[(0,J.jsx)(`h3`,{className:`text-caption font-medium text-muted-foreground`,children:`Not linked`}),(0,J.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:e.strip.map(e=>(0,J.jsx)(KU,{...E(e)},e.key))})]}),(0,J.jsx)(`p`,{"data-slot":`overview-detail`,className:`min-h-5 text-muted-foreground`,"aria-live":`polite`,children:u===null?`Hover or focus a directory to see its files, flows and tests.`:u.kind===`edge`?GU(u.edge,_):JU(u.node,e.edges,_)})]})},JU=(e,t,n)=>{let r=t.filter(t=>t.from===e.key).map(e=>{let t=e.symbols.length>0?` (${e.symbols.join(`, `)})`:``;return`${n(e.to)}${t}`});return e.kind===`outside`?`${e.paths.length>1?`${e.label}: ${e.paths.length} files`:e.paths[0]} · outside the pull request · uses ${r.join(`, `)}.`:`${[e.kind===`group`?`${e.label}: ${e.paths.map(PU).join(`, `)}`:e.paths[0],e.flows.length>0?`read in ${e.flows.join(`; `)}`:`in no flow`,...r.length>0?[`reaches ${r.join(`, `)}`]:[],...e.badges.length>0?[`tested in ${e.badges.map(PU).join(`, `)}`]:[]].join(` · `)}.`},YU=e=>`point-${e}`,XU={contradicts:`Contradicts what was asked`,missing:`Asked for, not done`,unrequested:`Done, not asked for`},ZU={finding:`text-review-changes`,risk:`text-risk-contract`,decision:`text-muted-foreground`},QU=({kind:e})=>{let t=GE[e];return(0,J.jsxs)(`span`,{className:X(`inline-flex items-center gap-1 font-medium`,ZU[e]),children:[(0,J.jsx)(t,{"aria-hidden":`true`,className:`size-3.5`}),WE[e].label]})},$U=({point:e,state:t,current:n,note:r,action:i,className:a,leftOut:o=!1})=>{let s=GE[e.kind];return(0,J.jsxs)(`article`,{id:YU(e.id),"data-slot":`point`,"data-kind":e.kind,"data-state":t,"data-left-out":o||void 0,"data-current":n||void 0,"aria-label":e.title,className:X(`flex scroll-mt-24 flex-wrap items-center gap-x-2 gap-y-0.5 text-muted-foreground`,a,n&&dW),children:[(0,J.jsx)(s,{"aria-hidden":`true`,className:`size-3.5 shrink-0`}),(0,J.jsxs)(`span`,{className:`sr-only`,children:[WE[e.kind].label,`: `]}),(0,J.jsx)(`span`,{className:X(`min-w-0 flex-1 basis-40 truncate`,t===`dismissed`&&`line-through`),children:e.title}),(0,J.jsx)(`span`,{className:`max-w-full min-w-0 truncate text-caption`,children:r}),i]})},eW=({effect:e,preferenceId:t})=>{let n=t===null?``:` your preference:`;return e===`raised`?`From${n}`:`Left out by${n}`},tW=({guidance:e,className:t})=>{let n=e.preferenceId===null?eg:Jg;return(0,J.jsxs)(`p`,{"data-slot":`point-guidance`,"data-effect":e.effect,className:X(`flex items-start gap-1.5 text-caption text-muted-foreground`,t),children:[(0,J.jsx)(n,{"aria-hidden":`true`,className:`mt-0.5 size-3.5 shrink-0`}),(0,J.jsxs)(`span`,{className:`min-w-0`,children:[eW(e),` `,(0,J.jsx)(__,{to:o_,className:X(`underline`,e.preferenceId===null&&`font-mono text-code-compact`),children:e.label})]})]})},nW=({point:e,guidance:t,state:n,current:r,onShow:i})=>(0,J.jsx)($U,{point:e,state:n,current:r,leftOut:!0,note:`${eW(t)} ${t.label}`,className:mW,action:(0,J.jsx)($,{variant:`ghost`,size:`xs`,"aria-label":`Show: ${e.title}`,onClick:i,children:`Show`})}),rW=(e,t,n)=>{let r=(0,q.useRef)(null),i=(0,q.useRef)(!1);return(0,q.useEffect)(()=>{!e&&i.current&&(i.current=!1,r.current?.focus())},[e]),{card:r,show:()=>{i.current=!0,t(n)}}},iW=({point:e,size:t,disabled:n,onDismiss:r,onRule:i})=>(0,J.jsxs)(`span`,{className:`flex items-center`,children:[(0,J.jsxs)($,{variant:`ghost`,size:t,disabled:n,"aria-label":`Dismiss: ${e.title}`,className:`rounded-r-none`,onClick:r,children:[t===`sm`&&(0,J.jsx)(i_,{"aria-hidden":`true`}),`Dismiss`]}),(0,J.jsxs)(Sz,{children:[(0,J.jsx)(Cz,{render:(0,J.jsx)($,{variant:`ghost`,size:t,"data-slot":`dismiss-menu`,disabled:n,"aria-label":`More ways to dismiss: ${e.title}`,className:`w-6 rounded-l-none px-0`}),children:(0,J.jsx)(Rh,{"aria-hidden":`true`})}),(0,J.jsx)(wz,{align:`end`,className:`w-64`,children:(0,J.jsxs)(Dz,{onClick:i,children:[(0,J.jsx)(ng,{"aria-hidden":`true`}),`Don't flag things like this…`]})})]})]}),aW=({point:e,scopes:t,onSave:n,onCancel:r})=>{let[i]=t;return i===void 0?null:(0,J.jsxs)(`div`,{"data-slot":`point-rule`,className:`flex flex-col gap-2 rounded-md border bg-card p-3`,children:[(0,J.jsx)(`p`,{className:`text-caption text-muted-foreground`,children:`Word it as a rule. It's saved to your preferences, and AI reviews leave out what it describes, folded to a line you can open.`}),(0,J.jsx)(iV,{legend:`Don't flag things like: ${e.title}`,initial:{kind:`dont-flag`,text:e.title,scope:i.scope},scopes:t,kindFixed:!0,submit:`Save and dismiss`,submitting:`Saving…`,focus:!0,onCancel:r,onSubmit:n})]})},oW=(e,t)=>{let[n,r]=(0,q.useState)(!1),[i,a]=(0,q.useState)(!1);return{writing:n,setWriting:r,saved:i,save:async n=>{let i=await t(e,n);return i===null&&(a(!0),r(!1)),i}}},sW=e=>e?(0,J.jsxs)(J.Fragment,{children:[`Dismissed, and saved to your`,` `,(0,J.jsx)(__,{to:o_,className:`underline`,children:`preferences`})]}):`Dismissed`,cW={blocking:{glyph:`■`,className:`text-severity-blocker bg-review-changes-bg border-severity-blocker/25`},major:{glyph:`▲`,className:`text-severity-major bg-severity-major-bg border-severity-major/25`},minor:{glyph:`●`,className:`text-severity-minor bg-review-pending-bg border-severity-minor/25`}},lW=({severity:e})=>(0,J.jsxs)(`span`,{"data-slot":`severity`,className:X(Aj,cW[e].className),children:[(0,J.jsx)(`span`,{"aria-hidden":`true`,children:cW[e].glyph}),e]}),uW=`animate-in duration-(--duration-slow) fade-in-0 slide-in-from-top-1`,dW=`shadow-[inset_0_0_0_2px_var(--ring)]`,fW=`relative max-w-3xl rounded-lg border bg-thread-bg`,pW=`scroll-mt-[calc(6rem+var(--lines-above)*var(--text-code--line-height))] -outline-offset-2`,mW=X(fW,`px-3 py-1.5`),hW={finding:`bg-review-changes`,risk:`bg-risk-contract-solid`},gW=({kind:e})=>(0,J.jsx)(`span`,{"aria-hidden":`true`,className:X(`absolute top-2 bottom-2 left-1.5 w-[3px] rounded-full`,hW[e])}),_W=(0,q.memo)(function({point:e,state:t,saving:n,readOnly:r,current:i,onRaise:a,onState:o,leftOut:s,onShow:c,ruleScopes:l,onRule:u,inReview:d,removed:f,language:p,linesAbove:m=0}){let h=(0,q.useId)(),{card:g,show:_}=rW(s,c,e.id),v=oW(e,u);if(t===`dismissed`)return(0,J.jsx)($U,{point:e,state:t,current:i,note:sW(v.saved),className:mW,action:(0,J.jsx)($,{variant:`ghost`,size:`xs`,disabled:r,onClick:()=>o(e.id,`open`),children:`Undo`})});if(t===`raised`&&d)return(0,J.jsx)($U,{point:e,state:t,current:i,note:`In your review, below`,className:`max-w-3xl px-1`,action:(0,J.jsx)(`span`,{"aria-hidden":`true`,children:`✓`})});if(s&&e.guidance!==void 0)return(0,J.jsx)(nW,{point:e,guidance:e.guidance,state:t,current:i,onShow:_});let y=r||n;return(0,J.jsxs)(`article`,{ref:g,id:YU(e.id),"data-slot":`point`,"data-kind":`finding`,"data-state":t,"data-current":i||void 0,"aria-labelledby":`${h}-title`,tabIndex:-1,style:vh({"--lines-above":m}),className:X(fW,pW,`flex flex-col gap-2 py-2.5 pr-4 pl-5`,i&&dW),children:[(0,J.jsx)(gW,{kind:`finding`}),(0,J.jsxs)(`header`,{className:`flex flex-wrap items-center gap-2`,children:[(0,J.jsx)(QU,{kind:`finding`}),e.severity!==null&&(0,J.jsx)(lW,{severity:e.severity}),(0,J.jsx)(`span`,{className:X(Aj,`border-review-pending/25 bg-review-pending-bg text-review-pending`),children:`Draft`}),e.lines!==null&&(0,J.jsxs)(`span`,{className:`flex items-center gap-1 text-caption text-muted-foreground`,children:[`on`,` `,(0,J.jsx)(Ik,{children:Fk(e.lines.side,e.lines.startLine,e.lines.line)})]}),(0,J.jsxs)(`span`,{className:`ml-auto flex items-center gap-1 text-caption text-muted-foreground`,children:[(0,J.jsx)(Qh,{"aria-hidden":`true`,className:`size-3.5`}),`Only you see this`]})]}),(0,J.jsx)(`h3`,{id:`${h}-title`,className:`font-semibold`,children:e.title}),e.explanation!==``&&(0,J.jsx)(kj,{blocks:Vd(e.explanation).blocks,suggestion:()=>null}),e.mismatch!==null&&(0,J.jsxs)(`p`,{className:`text-caption text-muted-foreground`,children:[(0,J.jsxs)(`span`,{className:`font-medium text-foreground`,children:[XU[e.mismatch.kind],`:`]}),` `,e.mismatch.description]}),e.guidance!==void 0&&(0,J.jsx)(tW,{guidance:e.guidance}),e.suggestion!==null&&(0,J.jsx)(kA,{title:`Suggested change`,removed:f,added:e.suggestion,language:p}),v.writing?(0,J.jsx)(aW,{point:e,scopes:l,onSave:v.save,onCancel:()=>{v.setWriting(!1),g.current?.focus()}}):(0,J.jsxs)(`div`,{className:`flex flex-wrap items-center justify-end gap-2`,children:[(0,J.jsx)(iW,{point:e,size:`sm`,disabled:y,onDismiss:()=>o(e.id,`dismissed`),onRule:()=>v.setWriting(!0)}),e.lines!==null&&(0,J.jsxs)(J.Fragment,{children:[(0,J.jsxs)($,{variant:`outline`,size:`sm`,disabled:y,"aria-label":`Edit: ${e.title}`,onClick:()=>a(e,!1),children:[(0,J.jsx)(Ig,{"aria-hidden":`true`}),`Edit`]}),(0,J.jsx)($,{size:`sm`,disabled:y,"aria-label":`Add to review: ${e.title}`,onClick:()=>a(e,!0),children:`Add to review`})]})]})]})}),vW=e=>e.slice(e.lastIndexOf(`/`)+1),yW=({checkedBy:e,peek:t,id:n})=>{let r=(0,J.jsx)(`span`,{className:`font-mono text-code-compact`,children:e.test});return(0,J.jsxs)(`p`,{"data-slot":`checked-by`,className:`flex items-start gap-1.5 pb-0.5 text-muted-foreground`,children:[(0,J.jsx)(ig,{"aria-hidden":`true`,className:`mt-0.5 size-3.5 shrink-0`}),(0,J.jsxs)(`span`,{className:`min-w-0`,children:[(0,J.jsx)(`span`,{className:`font-medium text-foreground`,children:`Checked by`}),` `,t===null?r:(0,J.jsx)(eM,{handle:t.handle,payload:t.payload,id:n,render:(0,J.jsx)(`button`,{type:`button`,className:`text-left text-foreground`}),children:r}),` `,`in `,vW(e.path),`, which asserts: `,e.checks]})]})},bW=(0,q.memo)(function({point:e,state:t,saving:n,readOnly:r,current:i,onRaise:a,onState:o,leftOut:s,onShow:c,ruleScopes:l,onRule:u,linesAbove:d=0,test:f=null}){let p=(0,q.useId)(),{card:m,show:h}=rW(s,c,e.id),g=oW(e,u);if(t===`dismissed`)return(0,J.jsx)($U,{point:e,state:t,current:i,note:sW(g.saved),className:mW,action:(0,J.jsx)($,{variant:`ghost`,size:`xs`,disabled:r,onClick:()=>o(e.id,`open`),children:`Undo`})});if(s&&e.guidance!==void 0)return(0,J.jsx)(nW,{point:e,guidance:e.guidance,state:t,current:i,onShow:h});let _=r||n;return(0,J.jsxs)(`article`,{ref:m,id:YU(e.id),"data-slot":`point`,"data-kind":`risk`,"data-state":t,"data-current":i||void 0,"aria-labelledby":`${p}-title`,tabIndex:-1,style:vh({"--lines-above":d}),className:X(fW,pW,`flex flex-col gap-0.5 py-1.5 pr-2 pl-5`,i&&dW),children:[(0,J.jsx)(gW,{kind:`risk`}),(0,J.jsxs)(`header`,{className:`flex flex-wrap items-center gap-2`,children:[(0,J.jsx)(QU,{kind:`risk`}),e.lines!==null&&(0,J.jsx)(Ik,{children:Fk(e.lines.side,e.lines.startLine,e.lines.line)}),t===`raised`&&(0,J.jsxs)(`span`,{className:`text-caption text-muted-foreground`,children:[(0,J.jsx)(`span`,{"aria-hidden":`true`,children:`✓ `}),`Commented`]}),(0,J.jsxs)(`span`,{className:`ml-auto flex items-center gap-1`,children:[(0,J.jsx)($,{variant:`ghost`,size:`xs`,disabled:_||e.lines===null,"aria-label":`Comment: ${e.title}`,onClick:()=>a(e,!1),children:`Comment`}),(0,J.jsx)(iW,{point:e,size:`xs`,disabled:_,onDismiss:()=>o(e.id,`dismissed`),onRule:()=>g.setWriting(!0)})]})]}),(0,J.jsx)(`h3`,{id:`${p}-title`,className:`pb-0.5 font-normal`,children:e.title}),e.checkedBy!==void 0&&(0,J.jsx)(yW,{checkedBy:e.checkedBy,peek:f,id:`${YU(e.id)}-test`}),e.guidance!==void 0&&(0,J.jsx)(tW,{guidance:e.guidance,className:`pb-0.5`}),g.writing&&(0,J.jsx)(`div`,{className:`py-1.5 pr-2`,children:(0,J.jsx)(aW,{point:e,scopes:l,onSave:g.save,onCancel:()=>{g.setWriting(!1),m.current?.focus()}})})]})}),xW=({point:e,state:t,open:n,current:r,onToggle:i})=>{let a=GE.decision;return(0,J.jsxs)(`button`,{type:`button`,id:YU(e.id),"data-slot":`decision-chip`,"data-inline-target":!0,"data-state":t,"data-current":r||void 0,"aria-expanded":n,"aria-label":`Decision: ${e.title}`,className:X(`ml-3 inline-flex min-h-5 scroll-mt-24 items-center gap-1 rounded-full border bg-background px-2 align-middle font-sans text-caption text-muted-foreground hover:text-foreground`,t===`dismissed`&&`line-through`,r&&dW),onClick:t=>{t.stopPropagation(),i(e.id)},children:[(0,J.jsx)(a,{"aria-hidden":`true`,className:`size-3`}),e.title]})},SW=({point:e,state:t,saving:n,readOnly:r,onRaise:i,onState:a})=>{let o=r||n;return(0,J.jsxs)(`article`,{"data-slot":`decision-note`,"data-state":t,"aria-label":e.title,className:X(`flex max-w-3xl flex-wrap items-baseline gap-x-2 border-l pl-3 text-caption`,uW),children:[(0,J.jsxs)(`p`,{className:`min-w-0 flex-1 basis-80 text-muted-foreground`,children:[(0,J.jsxs)(`span`,{className:`font-medium text-foreground`,children:[e.title,`.`]}),` `,e.explanation]}),(0,J.jsx)(`span`,{className:`flex items-center gap-1`,children:t===`dismissed`?(0,J.jsx)($,{variant:`ghost`,size:`xs`,disabled:r,onClick:()=>a(e.id,`open`),children:`Show again`}):(0,J.jsxs)(J.Fragment,{children:[t===`raised`&&(0,J.jsxs)(`span`,{className:`text-muted-foreground`,children:[(0,J.jsx)(`span`,{"aria-hidden":`true`,children:`✓ `}),`Commented`]}),(0,J.jsx)($,{variant:`ghost`,size:`xs`,disabled:o||e.lines===null,"aria-label":`Comment: ${e.title}`,onClick:()=>i(e,!1),children:`Comment`}),(0,J.jsx)($,{variant:`ghost`,size:`xs`,disabled:o,"aria-label":`Hide: ${e.title}`,onClick:()=>a(e.id,`dismissed`),children:`Hide`})]})})]})},CW=({point:e,onGo:t})=>{let n=GE[e.kind];return(0,J.jsxs)(`p`,{"data-slot":`point-mention`,className:`flex items-center gap-1.5 text-muted-foreground`,children:[(0,J.jsx)(n,{"aria-hidden":`true`,className:`size-3.5 shrink-0`}),WE[e.kind].label,`:`,` `,(0,J.jsx)(`button`,{type:`button`,className:`min-h-6 rounded-sm text-left whitespace-pre-line text-primary underline-offset-2 hover:underline`,onClick:()=>t(e.id),children:e.title})]})},wW=({pointId:e,fresh:t,at:n,row:r=!1,className:i,bodyClassName:a,children:o})=>(0,J.jsx)(`div`,{role:r?`row`:void 0,"data-slot":`point-fold`,"data-point-id":e,"data-fresh":t||void 0,"data-unfold":n!==void 0||void 0,style:n===void 0?void 0:vh({"--landing-i":n}),className:i,children:(0,J.jsx)(`div`,{role:r?`cell`:void 0,children:(0,J.jsx)(`div`,{className:a,children:o})})}),TW={finding:[`finding`,`findings`],risk:[`risk`,`risks`],decision:[`decision`,`decisions`]},EW=({points:e,kind:t,stateOf:n,onGo:r,onClose:i,family:a=`Claude`})=>{let o=t===null?e:e.filter(e=>e.kind===t),s=(0,q.useRef)(!1),[c,l]=t===null?[`point`,`points`]:TW[t];return(0,J.jsx)(aV,{title:`${o.length} ${o.length===1?c:l} from ${a}`,onClose:i,returnFocus:()=>!s.current,className:`sm:max-w-2xl`,children:(0,J.jsx)(`ul`,{className:`flex min-w-0 flex-col gap-1`,"aria-label":`Points`,children:o.map(e=>{let{label:t}=WE[e.kind],i=GE[e.kind],a=n(e.id);return(0,J.jsx)(`li`,{children:(0,J.jsxs)(`button`,{type:`button`,"data-slot":`point-row`,"data-kind":e.kind,className:`flex min-h-7 w-full items-center gap-2 rounded-md px-2 py-1 text-left hover:bg-accent`,onClick:()=>{s.current=!0,r(e.id)},children:[(0,J.jsx)(i,{"aria-hidden":`true`,className:`size-3.5 shrink-0`}),(0,J.jsxs)(`span`,{className:`sr-only`,children:[t,`: `]}),(0,J.jsx)(`span`,{className:X(`min-w-0 flex-1 truncate`,a===`dismissed`&&`line-through`),children:e.title}),a!==`open`&&(0,J.jsx)(`span`,{className:`text-caption text-muted-foreground`,children:a===`raised`?`Raised`:`Dismissed`}),e.path!==null&&(0,J.jsx)(`span`,{className:`truncate font-mono text-code-compact text-muted-foreground`,children:e.path})]})},e.id)})})})},DW=(e,t,n)=>{let r=t===null?e:e.filter(e=>e.kind===t),i=r.findIndex(e=>e.id===n);return{steps:r,at:i===-1?null:i}},OW=(e,t)=>{let{steps:n,at:r}=e;return n.length===0?null:n[r===null?t===1?0:n.length-1:(r+t+n.length)%n.length]?.id??null},kW=(e,t,n)=>{if(t===null)return null;let r=DW(e,t,n);return r.at===null?r.steps[0]?.id??null:null},AW={finding:`findings`,risk:`risks`,decision:`decisions`},jW={finding:`text-review-changes`,risk:`text-risk-contract`,decision:`text-muted-foreground`},MW=({kind:e})=>{let t=GE[e];return(0,J.jsx)(t,{"aria-hidden":`true`,className:X(`size-3.5 shrink-0`,jW[e])})},NW=({slot:e,noun:t,total:n,at:r,count:i,title:a,status:o,onStep:s,onOpenList:c})=>{let l=r===null?i:`${r+1} of ${n}`,u=`${t.charAt(0).toUpperCase()}${t.slice(1)}`;return(0,J.jsxs)(`span`,{"data-slot":e,className:`flex min-w-0 items-center gap-0.5`,children:[(0,J.jsx)($,{variant:`ghost`,size:`icon-xs`,"aria-label":`Previous ${t}`,disabled:n===0,onClick:()=>s(-1),children:(0,J.jsx)(Bh,{"aria-hidden":`true`})}),(0,J.jsx)($,{variant:`ghost`,size:`xs`,className:`tabular`,"aria-label":r===null?`${i}, show all`:`${u} ${l}, show all`,onClick:c,children:l}),(0,J.jsx)($,{variant:`ghost`,size:`icon-xs`,"aria-label":`Next ${t}`,disabled:n===0,onClick:()=>s(1),children:(0,J.jsx)(Hh,{"aria-hidden":`true`})}),a,(0,J.jsx)(`span`,{role:`status`,className:`sr-only`,children:o})]})},PW=({points:e,current:t,stateOf:n,kind:r,onGo:i,onOpenList:a})=>{let o=DW(e,r,t),{steps:s,at:c}=o,l=c===null?void 0:s[c],u=r===null||s.length===1?`${s.length} ${s.length===1?`point`:`points`}`:`${s.length} ${AW[r]}`,d=l!==void 0&&n(l.id)===`dismissed`;return(0,J.jsx)(NW,{slot:`point-stepper`,noun:`point`,total:s.length,at:c,count:u,onStep:e=>{let t=OW(o,e);t!==null&&i(t)},onOpenList:a,title:l!==void 0&&(0,J.jsxs)(`button`,{type:`button`,"data-slot":`stepper-title`,"data-kind":l.kind,className:`ml-1 flex h-6 min-w-0 items-center gap-1.5 rounded-md px-1 text-left max-sm:hidden hover:bg-muted`,"aria-label":`Go to ${WE[l.kind].label.toLowerCase()}: ${l.title}`,onClick:()=>i(l.id),children:[(0,J.jsx)(MW,{kind:l.kind}),(0,J.jsx)(`span`,{className:X(`min-w-0 truncate`,d&&`text-muted-foreground line-through`),children:l.title})]}),status:l===void 0||c===null?``:`${WE[l.kind].label} ${c+1} of ${s.length}: ${l.title}${d?` (dismissed)`:``}`})},FW={collect:`Collect`,prep:`Prepare`,intent:`Intent`,findings:`Findings`,risk:`Risk`,decisions:`Decisions`},IW={pending:`waiting`,running:`running`,done:`done`,failed:`failed`,skipped:`skipped`},LW={pending:`text-muted-foreground`,running:`text-primary font-medium`,done:`text-review-approved`,failed:`text-destructive font-medium`,skipped:`text-muted-foreground`},RW={pending:`○`,running:`◐`,done:`●`,failed:`✗`,skipped:`–`},zW=({stages:e,shown:t,filesFetched:n})=>(0,J.jsx)(`ol`,{className:`flex flex-wrap gap-x-4 gap-y-1 rounded-lg border bg-surface-subtle px-3 py-2`,"aria-label":`Analysis progress`,children:t.map(t=>{let r=e[t];return(0,J.jsxs)(`li`,{"data-status":r,className:LW[r],children:[(0,J.jsx)(`span`,{"aria-hidden":`true`,children:RW[r]}),` `,FW[t],(0,J.jsxs)(`span`,{className:`sr-only`,children:[`: `,IW[r]]}),t===`collect`&&r===`running`&&n!==null&&(0,J.jsxs)(`span`,{className:`tabular text-muted-foreground`,children:[` `,`· `,n.done,` of `,n.total,` files`]})]},t)})}),BW=e=>FW[e],VW=xu.options.filter(e=>!zu.includes(e)),HW=({legend:e,options:t,value:n,onChange:r})=>(0,J.jsxs)(`fieldset`,{className:`flex items-center gap-1`,children:[(0,J.jsx)(`legend`,{className:`sr-only`,children:e}),t.map(e=>(0,J.jsx)(fM,{variant:`outline`,size:`sm`,pressed:n===e.value,disabled:e.disabled===!0,onPressedChange:t=>{t&&r(e.value)},children:e.label},e.value))]}),UW=[{value:`comment`,label:`Comment`},{value:`approve`,label:`Approve`},{value:`request_changes`,label:`Request changes`}],WW=`whitespace-pre-wrap wrap-anywhere`,GW=(e,t)=>{let n=t===0?``:` ${t} ${t===1?`comment`:`comments`}`;return e===`comment`?n===``?`Publish the summary`:`Publish${n}`:`Publish${n} and ${e===`approve`?`approve`:`request changes`}`},KW=({analysisId:e,hunkComments:t,isAuthor:n,published:r,onClose:i,onPublished:a})=>{let{client:o}=yp(),s=(0,q.useId)(),[c,l]=(0,q.useState)(``),[u,d]=(0,q.useState)(`comment`),[f,p]=(0,q.useState)(null),[m,h]=(0,q.useState)(null),[g,_]=(0,q.useState)(!1),[v,y]=(0,q.useState)(!1),[b]=(0,q.useState)(()=>qd.parse(crypto.randomUUID())),x=Dp(o.publish);(0,q.useEffect)(()=>{let n=!0;return o.previewPublication(e,{summary:``,hunkComments:t}).then(e=>{n&&(p(e.ok?e.value:null),h(e.ok?null:e.error))}),()=>{n=!1}},[e,o,t]);let S=n?`comment`:u,C=GW(S,f?.comments.length??t.length),w=f!==null&&Jd({...f,verdict:S,summary:c}),T=async n=>{y(n),_(!1);let r=await x.run(e,{publicationId:b,summary:c,allowStale:n,hunkComments:t,verdict:S});r.ok?a(r.value):r.error.code===`stale-analysis`&&(x.reset(),_(!0))};return(0,J.jsxs)(aV,{title:`Publish review`,onClose:i,className:`flex flex-col sm:max-w-2xl`,children:[r&&(0,J.jsx)(`p`,{className:`shrink-0 text-muted-foreground`,children:`Your earlier review is on the pull request. This one posts as another, with its own verdict.`}),m===null?f===null?(0,J.jsx)(`p`,{className:`text-muted-foreground`,children:`Reading the comments…`}):f.comments.length>0&&(0,J.jsx)(`section`,{"data-slot":`publish-comments`,"aria-label":`Comments to post`,tabIndex:0,className:`-mx-4 min-h-12 overflow-y-auto overscroll-contain border-y px-4 py-3 -outline-offset-2`,children:(0,J.jsx)(`ul`,{"aria-label":`Comments`,className:`flex flex-col gap-1.5`,children:f.comments.map(e=>(0,J.jsxs)(`li`,{className:`min-w-0 border-l-2 border-l-review-pending py-0.5 pl-2.5`,children:[(0,J.jsxs)(`code`,{className:`font-mono text-code-compact text-muted-foreground`,children:[e.path,`:`,e.startLine===void 0?e.line:`${e.startLine}–${e.line}`,e.side===`old`?` (old side)`:``]}),(0,J.jsx)(`p`,{className:WW,children:e.body})]},e.key))})}):(0,J.jsxs)(`p`,{className:lP,role:`alert`,children:[`Couldn't read what will be posted. `,Ap(m)]}),(0,J.jsxs)(`div`,{className:`flex shrink-0 flex-col gap-4`,children:[(0,J.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,J.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,J.jsx)(`span`,{className:`text-caption text-muted-foreground`,children:`Verdict`}),(0,J.jsx)(HW,{legend:`Verdict`,options:UW.map(e=>({...e,disabled:n&&e.value!==`comment`})),value:S,onChange:d})]}),n&&(0,J.jsx)(`p`,{className:`text-caption text-muted-foreground`,children:`You opened this pull request, and its author can't approve it or request changes, so your review comments.`})]}),(0,J.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,J.jsx)(`label`,{htmlFor:`${s}-summary`,className:`sr-only`,children:`Summary`}),(0,J.jsx)(ik,{id:`${s}-summary`,rows:2,"data-autofocus":!0,placeholder:`Summary (optional)`,value:c,onChange:e=>l(e.target.value)})]}),g?(0,J.jsxs)(`div`,{className:X(uP,`flex flex-col gap-2`),role:`alert`,children:[(0,J.jsx)(`p`,{children:`This PR changed since the analysis. Publish anyway?`}),(0,J.jsxs)(`div`,{className:`flex justify-end gap-2`,children:[(0,J.jsx)($,{variant:`outline`,onClick:()=>_(!1),children:`Cancel`}),(0,J.jsx)($,{onClick:()=>void T(!0),children:`Publish anyway`})]})]}):(0,J.jsxs)(J.Fragment,{children:[x.error!==null&&(0,J.jsxs)(`div`,{className:`rounded-lg border border-review-changes/25 bg-review-changes-bg px-3 py-2 text-review-changes`,role:`alert`,children:[(0,J.jsxs)(`p`,{children:[`Couldn't publish. `,Ap(x.error)]}),(0,J.jsx)(`p`,{className:`text-muted-foreground`,children:`Retrying is safe: comments that were already posted aren't posted again.`})]}),(0,J.jsxs)(`div`,{className:`flex flex-wrap items-center justify-end gap-2`,children:[w&&(0,J.jsx)(`p`,{id:`${s}-nothing`,className:`mr-auto text-caption text-muted-foreground`,children:`Nothing to post yet: write a summary, or approve or request changes.`}),(0,J.jsx)($,{variant:`outline`,onClick:i,children:`Cancel`}),(0,J.jsx)($,{disabled:x.pending||f===null||w,"aria-describedby":w?`${s}-nothing`:void 0,onClick:()=>void T(v),children:x.pending?`Publishing…`:x.error===null?C:`Retry`})]})]})]})]})},qW=({children:e})=>(0,J.jsx)(`aside`,{id:`review-tree-rail`,"aria-label":`Files`,className:`sticky top-[var(--review-bar-h,0px)] -ml-1 flex h-[calc(100vh-var(--review-bar-h,0px))] min-h-0 flex-col gap-2 self-start overflow-hidden p-1`,children:e}),JW=({analysisId:e,family:t,onRemoved:n})=>{let{client:r}=yp(),i=Dp(r.removeModelRun),[a,o]=(0,q.useState)(!1);return(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)($,{variant:`ghost`,size:`xs`,onClick:()=>o(!0),children:`Remove AI review…`}),a&&(0,J.jsxs)(aV,{title:`Remove AI review`,onClose:()=>{o(!1),i.reset()},children:[(0,J.jsxs)(`p`,{className:`text-ui`,children:[t,`'s intent, findings, risks and decisions go, with what you did with them, and the code's analysis is back as it was. Your comments stay. Request AI review runs a model again, the same or another.`]}),i.error!==null&&(0,J.jsxs)(`p`,{className:`rounded-lg border border-review-changes/25 bg-review-changes-bg px-3 py-2 text-review-changes`,role:`alert`,children:[`Couldn't remove it. `,Ap(i.error)]}),(0,J.jsxs)(`div`,{className:`flex justify-end gap-2`,children:[(0,J.jsx)($,{variant:`outline`,"data-autofocus":!0,onClick:()=>o(!1),children:`Cancel`}),(0,J.jsx)($,{variant:`destructive`,disabled:i.pending,onClick:async()=>{let t=await i.run(e);t.ok&&(o(!1),n(t.value))},children:i.pending?`Removing…`:`Remove`})]})]})]})},YW=()=>{let e=(0,q.useRef)(null),[t,n]=(0,q.useState)(!1);return(0,q.useEffect)(()=>{let t=e.current;if(t===null||typeof IntersectionObserver>`u`)return;let r=new IntersectionObserver(([e])=>{e!==void 0&&n(e.intersectionRatio<1&&e.boundingClientRect.top<=0)},{rootMargin:`-1px 0px 0px 0px`,threshold:1});return r.observe(t),()=>r.disconnect()},[]),{bar:e,stuck:t}},XW=({title:e,claude:t,tools:n,publish:r,publication:i,hairline:a,stuck:o})=>{let s=YW(),c=o??s.stuck;return(0,J.jsxs)(`div`,{ref:s.bar,"data-slot":`review-bar`,"data-stuck":c||void 0,className:`sticky top-0 z-20 flex h-(--review-bar-h) min-w-0 items-center gap-3 border-b bg-background`,children:[a!==null&&(0,J.jsx)(`span`,{"data-slot":`model-hairline`,"data-state":a,"aria-hidden":`true`,children:(0,J.jsx)(`span`,{})}),c&&e!==null&&(0,J.jsx)(`span`,{"aria-hidden":`true`,className:`max-w-72 shrink truncate font-semibold max-xl:hidden`,title:e,children:e}),(0,J.jsx)(`div`,{"data-slot":`claude-slot`,className:`flex min-w-0 flex-1 items-center`,children:t}),(0,J.jsx)(`div`,{className:`flex shrink-0 items-center gap-2`,children:n}),i!==null&&(0,J.jsxs)(`p`,{role:`status`,className:`flex shrink-0 items-center gap-1 font-medium text-review-approved`,children:[(0,J.jsx)(`span`,{"aria-hidden":`true`,children:`✓`}),` `,i.url===null?`Published`:(0,J.jsx)(`a`,{href:i.url,target:`_blank`,rel:`noreferrer`,className:`text-review-approved`,children:`Published`})]}),r]})},ZW=2,QW=(e,t,n)=>`${e} ${e===1?t:n}`,$W=()=>(0,J.jsx)(`span`,{"aria-hidden":`true`,className:`h-4 w-px shrink-0 bg-border`}),eG=({error:e,onRetry:t})=>(0,J.jsxs)(JM,{children:[(0,J.jsx)(YM,{render:(0,J.jsx)($,{variant:`ghost`,size:`xs`,className:`h-6 px-1.5 font-normal text-muted-foreground`,"data-slot":`status-unavailable`,children:`Status unavailable`})}),(0,J.jsxs)(XM,{align:`end`,children:[(0,J.jsx)(ZM,{children:`The PR's status couldn't be read`}),(0,J.jsx)(`p`,{className:`text-muted-foreground`,children:Ap(e)}),(0,J.jsx)($,{variant:`outline`,size:`sm`,className:`self-start`,onClick:t,children:`Try again`})]})]}),tG=({name:e})=>(0,J.jsx)(`code`,{className:`rounded-sm bg-muted px-1 font-mono text-code-compact text-foreground`,children:e}),nG=({view:e,intent:t,totals:n,threads:r,status:i,statusError:a,onRetryStatus:o,now:s,reanalyzing:c,reanalyzeError:l,onReanalyze:u})=>{let{analysis:d,stale:f}=e,{pullRequest:p,warnings:m}=d,{ref:h}=d.key;return(0,J.jsxs)(`header`,{className:`flex flex-col gap-1.5`,children:[(0,J.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-x-4 gap-y-1`,children:[(0,J.jsxs)(`a`,{className:`font-mono text-code-compact`,href:p?.url??hf(h),target:`_blank`,rel:`noreferrer`,children:[h.repo.repo,` #`,h.number]}),(0,J.jsx)(`div`,{"data-slot":`pr-standing`,className:`flex flex-wrap items-center gap-x-3 gap-y-1`,children:[r!==null&&r.threads>0&&(0,J.jsxs)(`span`,{"data-slot":`thread-totals`,className:`tabular text-caption text-muted-foreground`,children:[QW(r.threads,`thread`,`threads`),r.unresolved>0&&` · ${r.unresolved} unresolved`]},`threads`),i===null&&a!==null&&(0,J.jsx)(eG,{error:a,onRetry:o},`unavailable`),i!==null&&(i.checks===null||i.checks.length>0)&&(0,J.jsx)(aN,{checks:i.checks,unreadable:i.checksUnreadable,head:d.key.headSha},`ci`),i!==null&&i.reviewers.length>0&&(0,J.jsx)(dN,{reviewers:i.reviewers},`reviewers`)].filter(e=>e!==!1).flatMap((e,t)=>t===0?[e]:[(0,J.jsx)($W,{},`before-${e.key}`),e])})]}),(0,J.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-3 gap-y-1`,children:[(0,J.jsx)(`h1`,{className:`min-w-0 text-title font-semibold tracking-[-0.01em] whitespace-pre-line`,children:p?.title??`Collecting the pull request…`}),i!==null&&(0,J.jsxs)(`span`,{className:`flex items-center gap-2`,children:[(0,J.jsx)($M,{state:i.state}),(0,J.jsx)(eN,{status:i.reviewStatus})]})]}),p!==null&&(0,J.jsxs)(`p`,{"data-slot":`pr-byline`,className:`flex flex-wrap items-center gap-x-1.5 gap-y-1 text-muted-foreground`,children:[(0,J.jsxs)(`span`,{children:[p.author.name,` wants to merge `,(0,J.jsx)(tG,{name:p.sourceBranch}),` `,(0,J.jsx)(`span`,{"aria-hidden":`true`,children:`→`}),` `,(0,J.jsx)(`span`,{className:`sr-only`,children:`into`}),` `,(0,J.jsx)(tG,{name:p.targetBranch})]}),` `,(0,J.jsx)(`span`,{"aria-hidden":`true`,children:`·`}),` `,(0,J.jsxs)(`span`,{children:[`updated `,Nk(p.updatedAt,s)]}),` `,d.stages.prep===`done`&&(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(`span`,{"aria-hidden":`true`,children:`·`}),` `,(0,J.jsxs)(`span`,{className:`tabular`,children:[QW(n.files,`file`,`files`),` `,(0,J.jsxs)(`span`,{className:`font-mono text-code-compact`,children:[(0,J.jsxs)(`span`,{"aria-hidden":`true`,children:[(0,J.jsxs)(`span`,{className:`text-diff-add-fg`,children:[`+`,n.additions]}),` `,(0,J.jsxs)(`span`,{className:`text-diff-del-fg`,children:[`−`,n.deletions]})]}),(0,J.jsxs)(`span`,{className:`sr-only`,children:[`, `,n.additions,` lines added, `,n.deletions,` removed`]})]})]})]})]}),(0,J.jsx)(`div`,{className:`mt-1.5`,children:t}),f&&(0,J.jsxs)(`div`,{role:`status`,className:X(`rounded-lg border border-review-pending/25 bg-review-pending-bg px-3 py-2 text-review-pending`,`flex flex-wrap items-center gap-3`),children:[(0,J.jsx)(`span`,{children:`This PR has new commits since the analysis.`}),(0,J.jsx)($,{variant:`outline`,size:`sm`,disabled:c,onClick:u,children:c?`Starting…`:`Re-analyze`}),l!==null&&(0,J.jsx)(`span`,{className:`text-destructive`,role:`alert`,children:Ap(l)})]}),m.length>0&&m.length<=ZW&&(0,J.jsx)(`ul`,{className:`flex flex-col gap-2`,"aria-label":`Warnings`,children:m.map(e=>(0,J.jsxs)(`li`,{className:`rounded-lg border border-review-pending/25 bg-review-pending-bg px-3 py-2 text-review-pending`,children:[(0,J.jsx)(`span`,{"aria-hidden":`true`,children:`⚠ `}),e]},e))}),m.length>ZW&&(0,J.jsxs)(`details`,{className:`rounded-lg border border-review-pending/25 bg-review-pending-bg px-3 py-2 text-review-pending`,children:[(0,J.jsxs)(`summary`,{className:`cursor-pointer`,children:[(0,J.jsx)(`span`,{"aria-hidden":`true`,children:`⚠ `}),m.length,` warnings`]}),(0,J.jsx)(`ul`,{className:`mt-1 list-disc pl-5`,children:m.map(e=>(0,J.jsx)(`li`,{children:e},e))})]})]})},rG=e=>`thread-${e}`,iG=e=>`${e.side}:${e.line}`,aG={onLine:new Map,earlier:new Map,elsewhere:[],open:new Map},oG=(e,t,n)=>e.set(t,[...e.get(t)??[],n]),sG=(e,t,n)=>{if(e===null||e.length===0)return aG;let r=new Map(t.map(e=>[e.file.path,e])),i=new Map,a=new Map,o=[],s=new Map;for(let t of e){t.resolved||s.set(t.path,(s.get(t.path)??0)+1);let e=r.get(t.path);if(e===void 0){o.push(t);continue}let{line:c}=t,l=t.outdated||c===null?void 0:e.partIds.find(e=>n.parts.get(e)?.hunk.lines.some(e=>{let n=Uj(e);return n!==null&&n.side===t.side&&n.line===c}));if(l===void 0||c===null){oG(a,t.path,t);continue}let u=i.get(l)??new Map;oG(u,iG({side:t.side,line:c}),t),i.set(l,u)}return{onLine:i,earlier:a,elsewhere:o,open:s}},cG=(e,t,n)=>{let r=new Map(e.lines.flatMap(e=>e.kind!==`del`&&e.newLine!==null?[[e.newLine,e.text]]:[])),i=[];for(let e=t;e<=n;e+=1){let t=r.get(e);if(t===void 0)return null;i.push(t)}return i},lG=(e,t,n)=>{let r=[];for(let i of t){for(let t of i.partIds){let i=e.onLine.get(t),a=n.parts.get(t)?.hunk;if(i===void 0||a===void 0)continue;let o=new Set;for(let e of a.lines){let t=Uj(e);if(t===null)continue;let n=iG(t);o.has(n)||(o.add(n),r.push(...i.get(n)??[]))}}r.push(...e.earlier.get(i.file.path)??[])}return r.push(...e.elsewhere),r},uG=(e,t,n)=>t===`all`?e:e.filter(e=>!e.resolved||n.has(e.id)),dG=(e,t,n)=>e===null?uG(t,`unresolved`,n).length>0?`unresolved`:`all`:e,fG=(e,t,n,r)=>{if(t.length===0)return null;let i=new Set(t.map(e=>e.id)),a=n===null?-1:e.findIndex(e=>e.id===n);if(a===-1)return(r===1?t[0]:t.at(-1))?.id??null;for(let t=1;t<=e.length;t+=1){let n=e[(a+r*t+e.length*t)%e.length];if(n!==void 0&&i.has(n.id))return n.id}return null},pG=(e,t,n)=>`${e} ${e===1?t:n}`,mG=e=>(e.line??e.originalLine)===null?`the file`:Nj(e.outdated?{...e,line:null}:e),hG=e=>{let[t]=e.comments;if(t===void 0)return mG(e);let n=Td(t.body);return`${t.author.name}: ${n===``?`Suggested change`:n}`},gG=(e,t)=>e===`unresolved`?`${t} unresolved`:pG(t,`thread`,`threads`),_G=(e,t,n)=>{if(e.length===0)return null;let r=uG(e,t,n).length;return t===`unresolved`?{count:r,words:[`unresolved`,`unresolved`],label:pG(r,`unresolved thread`,`unresolved threads`)}:{count:r,words:[`thread`,`threads`],label:pG(r,`thread`,`threads`)}},vG=({resolved:e})=>e?(0,J.jsx)(Ih,{"aria-hidden":`true`,className:`size-3.5 shrink-0 text-review-approved`}):(0,J.jsx)(Mg,{"aria-hidden":`true`,className:`size-3.5 shrink-0 text-muted-foreground`}),yG=({ordered:e,scope:t,resolvedHere:n,current:r,onGo:i,onOpenList:a})=>{let o=uG(e,t,n),s=o.findIndex(e=>e.id===r),c=s===-1?null:s,l=c===null?void 0:o[c],u=l===void 0?``:hG(l);return(0,J.jsx)(NW,{slot:`thread-stepper`,noun:`thread`,total:o.length,at:c,count:gG(t,o.length),onStep:t=>{let n=fG(e,o,r,t);n!==null&&i(n)},onOpenList:a,title:l!==void 0&&(0,J.jsxs)(`button`,{type:`button`,"data-slot":`stepper-title`,"data-kind":`thread`,className:`ml-1 flex h-6 min-w-0 items-center gap-1.5 rounded-md px-1 text-left max-sm:hidden hover:bg-muted`,title:`${l.path}, ${mG(l)}`,"aria-label":`Go to thread: ${u}`,onClick:()=>i(l.id),children:[(0,J.jsx)(vG,{resolved:l.resolved}),(0,J.jsx)(`span`,{className:X(`min-w-0 truncate`,l.resolved&&`text-muted-foreground`),children:u})]}),status:l===void 0||c===null?``:`Thread ${c+1} of ${o.length}, ${l.path} ${mG(l)}${l.resolved?`, resolved`:l.outdated?`, outdated`:``}: ${u}`})},bG=({ordered:e,scope:t,onScope:n,onGo:r,onClose:i})=>{let a=e.filter(e=>!e.resolved).length,o=(0,q.useRef)(!1),s=[];for(let t of e){let e=s.at(-1);e?.path===t.path?e.threads.push(t):s.push({path:t.path,threads:[t]})}return(0,J.jsxs)(aV,{title:`${pG(e.length,`thread`,`threads`)}, ${a} unresolved`,onClose:i,returnFocus:()=>!o.current,className:`sm:max-w-2xl`,children:[a>0&&a<e.length&&(0,J.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 text-caption text-muted-foreground`,children:[(0,J.jsx)(`span`,{"aria-hidden":`true`,children:`Previous and Next go round`}),(0,J.jsx)(HW,{legend:`Previous and Next go round`,options:[{value:`unresolved`,label:`Unresolved (${a})`},{value:`all`,label:`All (${e.length})`}],value:t,onChange:n})]}),(0,J.jsx)(`div`,{className:`flex min-w-0 flex-col gap-3`,children:s.map(({path:e,threads:t})=>(0,J.jsxs)(`section`,{"aria-label":e,className:`flex flex-col gap-1`,children:[(0,J.jsx)(`h3`,{className:`truncate px-2 font-mono text-code-compact text-muted-foreground`,children:e}),(0,J.jsx)(`ul`,{className:`flex flex-col gap-1`,children:t.map(e=>(0,J.jsx)(`li`,{children:(0,J.jsxs)(`button`,{type:`button`,"data-slot":`thread-row`,"data-resolved":e.resolved||void 0,className:`flex min-h-7 w-full items-center gap-2 rounded-md px-2 py-1 text-left hover:bg-accent`,onClick:()=>{o.current=!0,r(e.id)},children:[(0,J.jsx)(vG,{resolved:e.resolved}),(0,J.jsx)(`span`,{className:X(`min-w-0 flex-1 truncate`,e.resolved&&`text-muted-foreground`),children:hG(e)}),(e.resolved||e.outdated)&&(0,J.jsx)(`span`,{className:`text-caption text-muted-foreground`,children:e.resolved?`Resolved`:`Outdated`}),(0,J.jsx)(`span`,{className:`shrink-0 text-caption text-muted-foreground`,children:mG(e)})]})},e.id))})]},t[0]?.id??e))})]})},xG=.25,SG=(e,t,n)=>{let r=n?t-1:t*xG;return(e.findLast(e=>e.top<=r)??e[0])?.path??null},CG=()=>{let e=[...document.querySelectorAll(`[aria-label=Changes] [data-slot=file-card][data-path]`)],t=e.map(e=>e.getBoundingClientRect());return t.every(e=>e.height===0)?null:e.map((e,n)=>({path:e.dataset.path??``,top:t[n]?.top??0}))},wG=(e,t)=>{let[n,r]=(0,q.useState)(null),i=e.join(`\0`);return(0,q.useEffect)(()=>{if(!t)return;let e=0,n=()=>{e=0;let t=document.documentElement,n=window.scrollY+window.innerHeight>=t.scrollHeight-2,i=CG();if(i===null)return;let a=SG(i,window.innerHeight,n&&window.scrollY>0);a!==null&&r(a)},i=()=>{e===0&&(e=requestAnimationFrame(n))};return n(),window.addEventListener(`scroll`,i,{passive:!0}),window.addEventListener(`resize`,i),()=>{window.removeEventListener(`scroll`,i),window.removeEventListener(`resize`,i),e!==0&&cancelAnimationFrame(e)}},[i,t]),n},TG=1,EG=240,DG=6,OG=()=>{},kG=e=>{let t=e.left+e.width/2;for(let e=TG;e<Math.min(window.innerHeight,EG);e+=DG){let n=document.elementFromPoint(t,e);if(n===null||n.closest(`[data-slot=file-card-header]`)!==null)continue;let r=n.closest(`[role=row]`);if(r!==null)return r}return null},AG=e=>{let t=document.querySelector(e)?.getBoundingClientRect();if(window.scrollY<=TG||t===void 0||t.top>=0||typeof document.elementFromPoint!=`function`)return OG;let n=kG(t);if(n===null)return OG;let r=n.getBoundingClientRect().top;return()=>{if(!n.isConnected)return;let e=n.getBoundingClientRect().top-r;e!==0&&window.scrollBy({top:e,behavior:`instant`})}},jG=`[aria-label=Changes]`,MG=e=>{let t=getComputedStyle(document.documentElement).getPropertyValue(e).trim(),n=Number.parseFloat(t);return Number.isFinite(n)?t.endsWith(`ms`)?n:t.endsWith(`s`)?n*1e3:n:0},NG=e=>`✓ ${e} is done`,PG=new Set,FG=new Map,IG=(e,t,n=`Claude`)=>{let[r,i]=(0,q.useState)({running:e,before:PG}),[a,o]=(0,q.useState)(`done`),[s,c]=(0,q.useState)(FG),[l,u]=(0,q.useState)(0);e!==r.running&&(i({running:e,before:e?new Set(t):r.before}),o(e?`done`:`measure`),c(FG),e||u(l+1)),(0,q.useEffect)(()=>{if(l===0||!document.hidden)return;let e=document.title;document.title=`${NG(n)} · ${e}`;let t=()=>{document.hidden||(document.title=e)};return document.addEventListener(`visibilitychange`,t),()=>{document.removeEventListener(`visibilitychange`,t),document.title=e}},[l,n]);let d=(0,q.useRef)(null);(0,q.useLayoutEffect)(()=>{if(a!==`measure`)return;if(d.current=AG(jG),MG(`--landing-total`)===0){o(`done`);return}let e=new Map;for(let t of document.querySelectorAll(`[data-slot=point-fold][data-fresh]`)){let{top:n}=t.getBoundingClientRect(),r=uu.safeParse(t.dataset.pointId);r.success&&n>=0&&n<window.innerHeight&&e.set(r.data,e.size)}c(e),o(`landing`)},[a]),(0,q.useLayoutEffect)(()=>{a!==`measure`&&d.current!==null&&(d.current(),d.current=null)},[a]),(0,q.useEffect)(()=>{if(a!==`landing`)return;let e=Math.max(0,s.size-1)*MG(`--landing-step-code`),t=setTimeout(()=>o(`done`),MG(`--landing-total`)+e);return()=>clearTimeout(t)},[a,s]);let{before:f}=r,p=(0,q.useCallback)(e=>a!==`done`&&!f.has(e),[a,f]);return{phase:a,running:e||a===`measure`,fresh:p,inView:a===`landing`?s:FG}},LG=(e,t)=>{let{client:n}=yp(),[r,i]=(0,q.useState)(new Map),[a,o]=(0,q.useState)(new Set),[s,c]=(0,q.useState)(null),l=(0,q.useRef)(new Map),u=(0,q.useMemo)(()=>{let e=new Map(t.map(e=>[e.pointId,e.state]));for(let[t,n]of r)e.set(t,n);return e},[t,r]);return{stateOf:(0,q.useCallback)(e=>u.get(e)??`open`,[u]),setState:(0,q.useCallback)(async(t,r)=>{i(e=>new Map(e).set(t,r)),o(e=>new Set(e).add(t));let a=(l.current.get(t)??0)+1;l.current.set(t,a);let s=await n.putPointState(e,t,{state:r});l.current.get(t)===a&&(o(e=>{let n=new Set(e);return n.delete(t),n}),s.ok?c(e=>e?.pointId===t?null:e):(i(e=>{let n=new Map(e);return n.delete(t),n}),c({pointId:t,message:Ap(s.error)})))},[e,n]),isSaving:e=>a.has(e),failure:s,dismissFailure:()=>c(null)}},RG=6e4,zG=e=>{let{client:t}=yp(),[n,r]=(0,q.useState)(null),[i,a]=(0,q.useState)(null),o=(0,q.useRef)(0),s=(0,q.useCallback)(()=>{o.current+=1;let n=o.current;t.getPullRequestStatus(e).then(e=>{n===o.current&&(e.ok?(r(e.value),a(null)):a(e.error))})},[t,e]);(0,q.useEffect)(()=>(s(),window.addEventListener(`focus`,s),()=>window.removeEventListener(`focus`,s)),[s]);let c=n?.checks?.some(e=>e.state===`running`)===!0;return(0,q.useEffect)(()=>{if(!c)return;let e=setInterval(()=>{document.visibilityState===`visible`&&s()},RG);return()=>clearInterval(e)},[c,s]),{status:n,error:i,reload:s}},BG=(e,t)=>{let{client:n}=yp(),[r,i]=(0,q.useState)(null),[a,o]=(0,q.useState)(null),s=(0,q.useRef)(0),c=(0,q.useCallback)(()=>{s.current+=1;let t=s.current;n.getThreads(e).then(e=>{t===s.current&&(e.ok?(i(e.value),o(null)):o(e.error))})},[n,e]);return(0,q.useEffect)(()=>{t&&c()},[t,c]),{list:r,error:a,reload:c,reply:(0,q.useCallback)(async(t,r)=>{let i=await n.replyToThread(e,t,{body:r});return i.ok?(c(),null):Ap(i.error)},[n,e,c]),resolve:(0,q.useCallback)(async(t,r)=>{let i=await n.resolveThread(e,t,{resolved:r});return i.ok?(c(),null):Ap(i.error)},[n,e,c]),post:(0,q.useCallback)(async t=>{let r=await n.postComment(e,t);return r.ok?(c(),null):Ap(r.error)},[n,e,c])}},VG=[],HG=e=>Wd.array().safeParse(e).data,UG=({analysisId:e})=>{let[t,n]=(0,q.useState)({count:0,seed:null}),r=(0,q.useCallback)((e=null)=>n(({count:t})=>({count:t+1,seed:e})),[]);return(0,J.jsx)(WG,{analysisId:e,seed:t.seed,restart:r},`${e}/${t.count}`)},WG=({analysisId:e,seed:t,restart:n})=>{let{view:r,error:i,refetch:a,follow:o}=Ep(e,t);return r===null?i?.code===`not-found`?(0,J.jsxs)(`div`,{className:`mx-auto flex max-w-2xl flex-col gap-3 py-12`,children:[(0,J.jsx)(`h1`,{className:`text-title font-semibold tracking-[-0.01em]`,children:`Analysis not found`}),(0,J.jsx)(`p`,{className:`text-body`,children:Ap(i)}),(0,J.jsx)(`p`,{children:(0,J.jsx)(__,{to:`/`,children:`Pick a pull request to review`})})]}):i===null?(0,J.jsx)(GG,{}):(0,J.jsxs)(`div`,{className:`mx-auto flex max-w-2xl flex-col items-start gap-3 py-12`,children:[(0,J.jsxs)(`p`,{className:lP,role:`alert`,children:[`Couldn't load the analysis. `,Ap(i)]}),(0,J.jsx)($,{variant:`outline`,onClick:()=>void a(),children:`Try again`})]}):(0,J.jsx)(iK,{view:r,refetch:a,follow:o,restart:n})},GG=()=>(0,J.jsxs)(`div`,{className:`mx-auto flex max-w-[1600px] flex-col gap-4`,role:`status`,"aria-busy":`true`,"aria-label":`Loading the analysis`,children:[(0,J.jsx)(dP,{className:`h-7 w-2/3`}),(0,J.jsx)(dP,{className:`h-4 w-1/2`}),(0,J.jsxs)(`div`,{className:KG,children:[(0,J.jsx)(pP,{}),(0,J.jsx)(fP,{})]})]}),KG=`grid items-start gap-5 lg:grid-cols-[17rem_minmax(0,1fr)]`,qG=[],JG=[{value:`map`,label:`Map`},{value:`overview`,label:`Overview`}],YG=[`nextFile`,`previousFile`,`comment`,`openCall`,`moveFile`,`openFile`,`toggleLayout`,`openReview`,`close`,`help`],XG=({analysis:e})=>{let{checkout:t,pullRequest:n}=e;if(t===`read`||n===null)return null;let{ref:r,headSha:i}=n;return(0,J.jsxs)(`p`,{"data-slot":`checkout-note`,className:`text-muted-foreground`,children:[`Code outside the pull request that calls what it changes isn't shown:`,` `,t===`missing-commit`?(0,J.jsxs)(J.Fragment,{children:[`the local checkout doesn't have the head commit`,` `,(0,J.jsx)(`code`,{className:`rounded-sm bg-muted px-1 font-mono text-code-compact`,children:i.slice(0,7)}),`. Run`,` `,(0,J.jsx)(`code`,{className:`rounded-sm bg-muted px-1 font-mono text-code-compact`,children:`git fetch`}),` in it`,r.repo.host===`github`&&(0,J.jsxs)(J.Fragment,{children:[`, or`,` `,(0,J.jsxs)(`code`,{className:`rounded-sm bg-muted px-1 font-mono text-code-compact`,children:[`git fetch origin pull/`,r.number,`/head`]}),` `,`for a pull request from a fork`]}),`, then open the pull request again.`]}):(0,J.jsxs)(J.Fragment,{children:[`megareviewer didn't run in a checkout of `,r.repo.owner,`/`,r.repo.repo,`. Start it in one, or pass`,` `,(0,J.jsx)(`code`,{className:`rounded-sm bg-muted px-1 font-mono text-code-compact`,children:`--checkout <dir>`}),`, then open the pull request again.`]})]})},ZG=[],QG=(e,t)=>{let[n,r]=(0,q.useState)(e);return!t&&n!==e&&r(e),t?n:e},$G=(e,t)=>{let{lines:n}=e;if(n===null)return null;let r=null,i=null;for(let[e,a]of t.lines.entries()){let t=Uj(a);t!==null&&t.side===n.side&&(t.line<n.startLine||t.line>n.line||(r??=e,(i===null||t.line>i.line)&&(i={line:t.line,at:e})))}return r===null||i===null?null:{key:`${n.side}:${i.line}`,rows:i.at-r+1}},eK={github:void 0,bitbucket:`Bitbucket can't anchor a range, so the comment goes on the last line and names them.`},tK=new WeakMap,nK=0,rK=e=>{let t=tK.get(e);return t===void 0?(nK+=1,tK.set(e,nK),nK):t},iK=({view:e,refetch:t,follow:n,restart:r})=>{let{client:i}=yp(),a=PL(Sp().status?.model??null),{analysis:o,publication:s}=e,c=o.id,l=o.status===`complete`,u=l&&Bu(o),d=QG(o,u),f=Dp(i.runModel),p=s!==null||!l,m=(0,q.useMemo)(()=>IH(d),[d]),h=(0,q.useMemo)(()=>RH(d,m),[d,m]),g=(0,q.useMemo)(()=>zH(d,m),[d,m]),_=(0,q.useMemo)(()=>g.flatMap(e=>e.partIds),[g]),v=(0,q.useMemo)(()=>WH(d,m),[d,m]),y=UH(v),[b,x]=DL(`decisions`,!1,OL),S=(0,q.useMemo)(()=>hu(d).filter(e=>b||e.kind!==`decision`),[d,b]),C=(0,q.useMemo)(()=>S.map(e=>e.id),[S]),w=LG(c,e.pointReviews),[T,E]=(0,q.useState)(new Set),{stateOf:D}=w,O=(0,q.useMemo)(()=>new Set(S.filter(e=>e.guidance?.effect===`left-out`&&D(e.id)===`open`&&!T.has(e.id)).map(e=>e.id)),[S,D,T]),k=(0,q.useMemo)(()=>S.filter(e=>!O.has(e.id)),[S,O]),A=(0,q.useCallback)(e=>E(t=>new Set(t).add(e)),[]),j=Rl(o.modelOption??a.chosen),M=IG(u,C,j),N=(0,q.useMemo)(()=>VH(S,_,m),[S,_,m]),P=(0,q.useMemo)(()=>{let e=new Map,t=new Map,n=new Map,r=new Map,i=(e,t,n,r)=>{let i=e.get(t)??new Map;i.set(n,[...i.get(n)??[],r]),e.set(t,i)};for(let[a,o]of N.cards){let s=m.parts.get(a);for(let c of o){let o=s===void 0?null:$G(c,s.hunk);o===null?n.set(a,[...n.get(a)??[],c]):c.kind===`decision`?i(t,a,o.key,c):(i(e,a,o.key,c),r.set(c.id,o.rows))}}for(let t of e.values())for(let[e,n]of t)t.set(e,[...n.filter(e=>e.kind===`finding`),...n.filter(e=>e.kind!==`finding`)]);return{underLine:e,atLineEnd:t,underHeader:n,rowsAbove:r}},[N,m]),F=(0,q.useMemo)(()=>{let e=new Map,t=t=>{let[n]=t;for(let r of t)n!==void 0&&e.set(r.id,n.id)};for(let e of P.underLine.values())for(let n of e.values())t(n);for(let[e,n]of P.underHeader)t([...n,...N.mentions.get(e)??qG]);for(let[e,n]of N.mentions)P.underHeader.has(e)||t(n);return t(N.unplaced),e},[P,N]),{inView:I}=M,L=(0,q.useCallback)(e=>I.get(F.get(e)??e),[I,F]),R=(0,q.useMemo)(()=>{let e=new Map;for(let[t,n]of N.cards){let r=m.parts.get(t)?.file.path;if(r===void 0)continue;let i=n.filter(e=>!O.has(e.id));if(i.length===0)continue;let a=e.get(r)??{};for(let e of i)a[e.kind]=(a[e.kind]??0)+1;e.set(r,a)}return e},[N,m,O]),ee=(0,q.useMemo)(()=>g.map(({file:e})=>({path:e.path,status:e.status,oldPath:e.oldPath,additions:e.additions,deletions:e.deletions,...R.has(e.path)?{points:R.get(e.path)}:{}})),[g,R]),[z,te]=(0,q.useState)([]),B=(0,q.useMemo)(()=>MV(d,h,new Set(z)),[d,h,z]),ne=(0,q.useMemo)(()=>d.stages.prep===`done`?FV(MV(d,h)):null,[d,h]),[V,H]=DL(`review-layout`,`map`,NH),re=wG((0,q.useMemo)(()=>g.map(e=>e.file.path),[g]),V===`map`&&d.stages.prep===`done`),[ie,ae]=(0,q.useState)(!1),oe=(0,q.useMemo)(()=>{let e=new Map;for(let t of d.unchangedCallers)e.set(t.partId,[...e.get(t.partId)??[],t]);return e},[d.unchangedCallers]),se=(0,q.useCallback)(e=>oe.get(e)??ZG,[oe]),[U]=(0,q.useState)($j),ce=(0,q.useMemo)(()=>KV(d.callSites,m,U),[d.callSites,m,U]),le=(0,q.useCallback)(e=>ce.get(e),[ce]),ue=(0,q.useMemo)(()=>new Map(S.flatMap(e=>{let t=qV(e,m);return t===null?[]:[[e.id,{handle:U,payload:t}]]})),[S,m,U]),[de,fe]=(0,q.useState)(null),[pe,me]=(0,q.useState)(null),he=(0,q.useRef)(null),[ge,_e]=(0,q.useState)(null),[ve,ye]=(0,q.useState)(null),[be,xe]=(0,q.useState)(null),[Se,Ce]=(0,q.useState)(null),[we,Te]=(0,q.useState)(null),[Ee,De]=(0,q.useState)(new Set),[Oe,ke]=(0,q.useState)(!1),Ae=be===`thread`||k.length===0,je=Ae?null:ve,[Me,Ne]=(0,q.useState)(!1),[Pe,Fe]=(0,q.useState)(new Set),Ie=(0,q.useCallback)(e=>Fe(t=>{let n=new Set(t);return n.delete(e)||n.add(e),n}),[]),[Le,Re]=(0,q.useState)(null),[ze,Be]=(0,q.useState)(new Set),[Ve,He]=(0,q.useState)(null),[W,Ue]=(0,q.useState)(!1),[We,Ge]=(0,q.useState)(!1),Ke=(0,q.useRef)(!0),[qe,Je]=(0,q.useState)(!1),[Ye,Xe]=DL(`hunk-comments:${c}`,VG,HG),[Ze,Qe]=(0,q.useState)(null),$e=(0,q.useRef)(null),et=(0,q.useMemo)(()=>GH(Ye,m),[Ye,m]),tt=(0,q.useCallback)(e=>et.get(e)??VG,[et]),nt=(0,q.useCallback)((e,t)=>Xe(n=>{let r=rl(e),i=e=>e.hunkId===r&&e.side===t.side&&e.line===t.line,a={hunkId:r,...t},o=t.body===``&&t.suggestion===void 0;return n.some(i)?o?n.filter(e=>!i(e)):n.map(e=>i(e)?a:e):o?n:[...n,a]}),[Xe]),rt=(0,q.useCallback)((e,t)=>{$e.current=null,Qe(n=>{if(t?.startLine!==void 0&&n!==null&&n.partId===e){let r=rl(e),i=n.place;Xe(e=>e.map(e=>e.hunkId===r&&e.side===i.side&&e.line===i.line?{...e,line:t.line,startLine:t.startLine}:e))}return t===null?null:{partId:e,place:t}})},[Xe]),{setState:it}=w,at=(0,q.useCallback)((e,t)=>{let n=$e.current;$e.current=null,n!==null&&n.partId===e&&n.place.side===t.side&&n.place.line===t.line&&(nt(e,n.before??{...n.place,body:``}),n.state!==`raised`&&it(n.pointId,n.state))},[nt,it]),ot=BG(c,d.stages.prep===`done`),st=zG(c),{post:ct}=ot,lt=(0,q.useCallback)((e,t)=>ct({hunkId:rl(e),...t}),[ct]),ut=(0,q.useMemo)(()=>sG(ot.list?.threads??null,g,m),[ot.list,g,m]),dt=(0,q.useMemo)(()=>lG(ut,g,m),[ut,g,m]),ft=dG(we,dt,Ee),pt=Ae?Se:null,{resolve:mt}=ot,ht=(0,q.useCallback)(async(e,t)=>{let n=await mt(e,t);return n===null&&t&&De(t=>new Set(t).add(e)),n},[mt]),gt=d.pullRequest?.author.id??null,_t=(e,t)=>(0,J.jsx)(Fj,{thread:e,authorId:gt,now:Date.now(),language:Jk({path:e.path,language:null}),covered:t,mediaUrl:e=>i.attachmentUrl(c,e),onReply:t=>ot.reply(e.id,t),onResolve:t=>ht(e.id,t),current:pt===e.id,anchorId:rG(e.id),linesAbove:t?.length??0},e.id),vt=(e,t)=>{let n=ut.onLine.get(e)?.get(iG(t));if(n===void 0)return null;let r=m.parts.get(e)?.hunk;return n.map(e=>{let n=e.startLine??t.line;return _t(e,r===void 0?null:cG(r,Math.min(n,t.line),t.line))})},yt=e=>{let t=ut.earlier.get(e);return t===void 0?null:t.map(e=>(0,J.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,J.jsx)(`span`,{className:`text-caption text-muted-foreground`,children:e.outdated?`Was on ${e.side===`old`?`old `:``}line ${e.originalLine??`?`}; the code has changed since`:`On ${Nj(e)}, which the diff doesn't show`}),_t(e,null)]},e.id))},bt=e=>ut.open.get(e)??0,xt=(0,q.useMemo)(()=>ee.map(e=>({...e,threads:ut.open.get(e.path)??0})),[ee,ut]),St=e=>He(t=>({id:e,n:(t?.n??0)+1})),Ct=()=>V===`overview`?null:de,wt=(0,q.useCallback)(e=>fe(e),[]),Tt=e=>{B.placeOf.has(e)&&me(t=>({key:e,n:(t?.n??0)+1}))},Et=(e,t=V)=>{if(t===`overview`){let t=m.parts.get(e)?.file.path;t!==void 0&&Tt(t)}else St(_.includes(e)?JV(e):JH)},Dt=e=>{let t=S.find(t=>t.id===e),n=N.cardPart.get(e);t?.kind===`decision`&&Fe(t=>new Set([...t,e])),O.has(e)&&A(e),be===`thread`&&xe(null),Be(new Set((t?.hunkIds??[]).flatMap(m.partsOf))),V===`overview`?n!==void 0&&Et(n):St(YU(e)),ye(e)},Ot=e=>{xe(`thread`),Ce(e),Be(new Set),V===`overview`&&H(()=>`map`),St(rG(e))},kt=e=>{if(xe(e),e===`thread`){let e=uG(dt,ft,Ee),[t]=e;t!==void 0&&!e.some(e=>e.id===Se)&&Ot(t.id);return}let t=kW(k,e,ve);t!==null&&Dt(t)},At=e=>{let t=uu.parse(`m${e+1}`),n=d.findings.find(t=>t.mismatch===`m${e+1}`);Dt(S.some(e=>e.id===t)||n===void 0?t:uu.parse(n.id))},jt=()=>{let e=(document.activeElement?.closest(`[aria-label=Changes] [data-slot=file-card]`))?.dataset.path??re;H(()=>`overview`),_e(null),e!==null&&Tt(e)},Mt=e=>{let[t]=e.kind===`outside`?[]:e.paths,n=t===void 0?e.partIds[0]:g.find(e=>e.file.path===t)?.partIds[0];n!==void 0&&(H(()=>`map`),_e(e.key),fe(n),t===void 0?Et(n,`map`):St(YH(t)))},Nt=()=>{if(V===`map`)return jt();let e=[...B.rows.flat(),...B.strip].find(e=>e.key===he.current);if(e!==void 0&&e.kind!==`outside`)return Mt(e);H(()=>`map`)};Ip({label:`Layout`,options:JG,value:V,onChange:e=>{e!==V&&Nt()},toggle:{label:`Decisions`,checked:b,onChange:e=>x(()=>e)}});let Pt=e=>{let t=[...document.querySelectorAll(`[aria-label=Changes] [data-slot=file-card]`)],n=t.findIndex(e=>e.contains(document.activeElement)),r=n===-1?e===1?t.find(e=>e.getBoundingClientRect().top>1):t.findLast(e=>e.getBoundingClientRect().top<-1):t[n+e];r!==void 0&&St(r.id)},Ft=(e,t=!1)=>{let n=N.cardPart.get(e.id),r=n===void 0?void 0:m.parts.get(n);if(p||n===void 0||r===void 0)return;let i=e.lines===null?null:{side:e.lines.side,line:e.lines.line,...e.lines.startLine===e.lines.line?{}:{startLine:e.lines.startLine}},a=r.hunk.lines.find(e=>e.kind!==`context`),o=i??(a===void 0?null:Uj(a));if(o===null)return;let s=e.explanation===``?e.title:`${e.title}\n\n${e.explanation}`,c=rl(n),l=Ye.find(e=>e.hunkId===c&&e.side===o.side&&e.line===o.line),u={...e.suggestion===null?{}:{suggestion:e.suggestion}};l===void 0?nt(n,{...o,body:s,...u}):w.stateOf(e.id)!==`raised`&&!l.body.includes(s)&&nt(n,{...u,...l,body:l.body===``?s:`${l.body}\n\n${s}`}),ye(e.id);let d=w.stateOf(e.id);if(w.setState(e.id,`raised`),t)return;let{startLine:f}=l??o,h={side:o.side,line:o.line,...f===void 0?{}:{startLine:f}};Qe({partId:n,place:h}),$e.current={partId:n,place:h,before:l,pointId:e.id,state:d},St(JV(n))},It=()=>{let e=Ct(),t=e===null?void 0:m.parts.get(e),n=t?.hunk.lines.find(e=>e.kind!==`context`);if(!l||t===void 0||n===void 0)return;let r=Uj(n);r!==null&&e!==null&&($e.current=null,Qe({partId:e,place:r}))},Lt=()=>{let e=document.activeElement;if(!(e instanceof HTMLElement))return;let t=[...(e.closest(`[role=row]`)??e.closest(`[data-slot=hunk-card]`)??e.closest(`[data-slot=file-card]`))?.querySelectorAll(`[data-slot=call]`)??[]],n=t[(t.findIndex(e=>e.hasAttribute(`data-popup-open`))+1)%t.length];n!==void 0&&U.open(n.id)},Rt=()=>{if(ze.size>0)return Be(new Set);V===`map`&&ge!==null&&(H(()=>`overview`),me(e=>({key:ge,n:(e?.n??0)+1})),_e(null))},zt=l;Sk({...V===`map`?{nextFile:()=>Pt(1),previousFile:()=>Pt(-1),comment:It,openCall:Lt,close:Rt}:{},toggleLayout:()=>Nt(),openReview:()=>{zt&&Wt()},help:()=>Ge(!0)},!W&&!We&&!qe);let Bt=d.pullRequest?.url??hf(d.key.ref),Vt=Dp(i.startAnalysis),Ht=Dp(i.retryAnalysis),Ut=e=>{e===c?r():m_(d_(e))},Wt=()=>Ue(!0),Gt=Ye.length,Kt=(0,q.useMemo)(()=>KH(d.files),[d.files]),qt=w.failure===null?``:S.find(e=>e.id===w.failure?.pointId)?.title??``,Jt=async(e,t)=>{let n=await i.addPreference({...t,source:`learned`});return n.ok?(w.setState(e.id,`dismissed`),null):WL(n.error)},Yt=e=>({state:w.stateOf(e.id),saving:w.isSaving(e.id),readOnly:p,current:je===e.id,onRaise:ln.raisePoint,onState:ln.setPointState,leftOut:O.has(e.id),onShow:A,ruleScopes:dn,onRule:ln.saveRule}),Xt=(e,t)=>{let n=t===null?void 0:m.parts.get(t),r=e.lines,i=t!==null&&r!==null&&tt(t).some(e=>e.side===r.side&&e.line===r.line);return(0,J.jsx)(_W,{point:e,...Yt(e),linesAbove:P.rowsAbove.get(e.id)??0,inReview:i,removed:n===void 0||r===null||r.side===`old`?null:cG(n.hunk,r.startLine,r.line),language:n===void 0?null:Jk(n.file)},e.id)},Zt=e=>(0,J.jsx)(bW,{point:e,...Yt(e),linesAbove:P.rowsAbove.get(e.id)??0,test:ue.get(e.id)??null},e.id),Qt=e=>(0,J.jsx)(SW,{point:e,...Yt(e)},e.id),$t=(e,t=null)=>e.kind===`finding`?Xt(e,t):e.kind===`risk`?Zt(e):Qt(e),en=(0,q.useMemo)(()=>{let e={finding:0,risk:1,decision:2},t=new Map;for(let[n,r]of N.cards){let i=new Map;for(let t of r){if(t.lines===null||t.kind===`decision`||O.has(t.id))continue;let{side:n,startLine:r,line:a}=t.lines,o=L(t.id);for(let s=r;s<=a;s+=1){let c=`${n}:${s}`,l=i.get(c);l!==void 0&&e[t.kind]>=e[l.kind]||i.set(c,{kind:t.kind,...o===void 0?{}:{landing:{at:o,line:s-r,lines:a-r+1}}})}}i.size>0&&t.set(n,i)}return t},[N,L,O]),tn=(0,q.useCallback)(e=>en.get(e),[en]),nn=(e,t,n)=>{let[r]=e;return r===void 0?null:(0,J.jsx)(wW,{pointId:r.id,fresh:e.some(e=>M.fresh(e.id)),at:L(r.id),...t,children:n},r.id)},rn=e=>{let t=P.underHeader.get(e)??qG,n=N.mentions.get(e)??qG;return nn([...t,...n],{bodyClassName:`flex flex-col gap-2 border-b bg-surface-subtle p-3`},(0,J.jsxs)(J.Fragment,{children:[t.map(t=>$t(t,e)),n.map(e=>(0,J.jsx)(CW,{point:e,onGo:ln.goToPoint},e.id))]}))},an=(e,t)=>{let n=iG(t),r=P.underLine.get(e)?.get(n)??qG,i=(P.atLineEnd.get(e)?.get(n)??qG).filter(e=>Pe.has(e.id));return(0,J.jsxs)(J.Fragment,{children:[nn(r,{row:!0,className:Wj,bodyClassName:`flex max-w-3xl flex-col gap-2 py-2 pr-3 pl-29 font-sans`},r.map(t=>$t(t,e))),i.length>0&&(0,J.jsx)(Kj,{inset:!0,children:(0,J.jsx)(`div`,{className:`flex flex-col gap-1`,children:i.map(Qt)})})]})},on=(e,t)=>{let n=P.atLineEnd.get(e)?.get(iG(t));return n===void 0?null:n.map(e=>(0,J.jsx)(xW,{point:e,state:w.stateOf(e.id),open:Pe.has(e.id),current:je===e.id,onToggle:Ie},e.id))},sn=(0,q.useCallback)(e=>{let t=P.underLine.get(e);if(t===void 0)return;let n=[...t].filter(([,e])=>e.some(e=>e.kind===`finding`&&!O.has(e.id)));return new Set(n.map(([e])=>e))},[P,O]),cn=(0,q.useRef)({goToPoint:Dt,raisePoint:Ft,saveRule:Jt});cn.current={goToPoint:Dt,raisePoint:Ft,saveRule:Jt};let ln=(0,q.useMemo)(()=>({goToPoint:e=>cn.current.goToPoint(e),raisePoint:(e,t)=>cn.current.raisePoint(e,t),saveRule:(e,t)=>cn.current.saveRule(e,t),setPointState:w.setState}),[w.setState]),un=d.key.ref.repo,dn=(0,q.useMemo)(()=>QB([un]).reverse(),[un]),fn=e=>{let t=[rK(d),p,ze.has(e),Ze?.partId===e?`${Ze.place.side}${Ze.place.line}`:``,...tt(e).map(e=>JSON.stringify(e))];ut.onLine.has(e)&&t.push(rK(ut),pt??``);let n=N.cards.get(e)??qG,r=N.mentions.get(e)??qG;for(let e of n)t.push(e.id,w.stateOf(e.id),w.isSaving(e.id)),t.push(je===e.id,O.has(e.id)),e.kind===`decision`&&t.push(Pe.has(e.id));for(let e of r)t.push(e.id);for(let e of[...n,...r])t.push(M.fresh(e.id),L(e.id)??``);return t.join(`\0`)},pn={index:m,unchangedOf:se,highlighted:ze,commentsOf:tt,openComment:Ze,onOpenComment:rt,onCancelComment:at,onComment:l?nt:void 0,...l?{onCommentNow:lt}:{},onFocusHunk:wt,marksOf:le,pointsOn:rn,pointsAt:an,pointsAtEnd:on,flaggedOf:sn,pointLinesOf:tn,threadsAt:vt,earlierThreads:yt,openThreads:bt,...eK[d.key.ref.repo.host]===void 0?{}:{rangeNote:eK[d.key.ref.repo.host]}},mn=(0,J.jsx)(J.Fragment,{children:N.unplaced.length>0&&(0,J.jsx)(`section`,{"aria-label":`Points on no change shown here`,children:nn(N.unplaced,{bodyClassName:`flex flex-col gap-2`},N.unplaced.map(e=>$t(e)))})});return(0,J.jsxs)(`div`,{"data-slot":`review-page`,"data-layout":V,"data-landing":M.phase,className:`mx-auto flex max-w-[1600px] flex-col gap-4`,children:[(0,J.jsx)(nG,{view:e,intent:(0,J.jsx)(sH,{analysis:o,through:ne,running:M.running,onDetails:()=>{Ke.current=!0,Je(!0)}}),totals:Kt,threads:ot.list===null?null:qH(ot.list.threads),status:st.status,statusError:st.error,onRetryStatus:st.reload,now:Date.now(),reanalyzing:Vt.pending,reanalyzeError:Vt.error,onReanalyze:async()=>{let e=await Vt.run({url:Bt});e.ok&&Ut(e.value.analysisId)}}),(0,J.jsx)(XW,{title:o.pullRequest?.title??null,claude:(0,J.jsx)(WV,{analysis:o,choice:a,running:M.running,startedAt:Le,starting:f.pending,error:f.error===null?null:Ap(f.error),points:k,leftOut:O.size,threads:_G(dt,ft,Ee),narrowed:be,onNarrow:kt,onRun:async()=>{let e=a.chosen?.id;(await f.run(c,e===void 0?{}:{optionId:e})).ok&&(Re(Date.now()),n())},children:Ae?dt.length>0&&(0,J.jsx)(yG,{ordered:dt,scope:ft,resolvedHere:Ee,current:Se,onGo:Ot,onOpenList:()=>ke(!0)}):(0,J.jsx)(PW,{points:k,current:ve,stateOf:w.stateOf,kind:be,onGo:Dt,onOpenList:()=>Ne(!0)})}),tools:V===`map`&&(0,J.jsx)($,{variant:`outline`,size:`sm`,className:`lg:hidden`,"aria-expanded":ie,"aria-controls":`review-tree-rail`,onClick:()=>ae(!ie),children:ie?`Hide files`:`Show files`}),publish:zt&&(0,J.jsxs)($,{size:`sm`,"data-slot":`publish-button`,className:`shrink-0`,onClick:()=>void Wt(),children:[`Publish review…`,Gt>0&&(0,J.jsxs)(`span`,{className:`tabular rounded-full bg-primary-foreground px-1.5 text-caption text-primary`,children:[Gt,(0,J.jsx)(`span`,{className:`sr-only`,children:` to post`})]})]}),publication:s,hairline:M.running?`running`:M.phase===`landing`?`finishing`:null}),!l&&(0,J.jsx)(zW,{stages:o.stages,shown:VW,filesFetched:o.filesFetched}),o.error!==null&&(0,J.jsxs)(`div`,{className:X(`rounded-lg border border-review-changes/25 bg-review-changes-bg px-3 py-2 text-review-changes`,`flex flex-col items-start gap-2`),role:`alert`,children:[(0,J.jsxs)(`p`,{children:[`The analysis failed at the `,BW(o.error.stage).toLowerCase(),` stage:`,` `,o.error.message]}),Ht.error!==null&&(0,J.jsxs)(`p`,{children:[`Couldn't retry. `,Ap(Ht.error)]}),(0,J.jsx)($,{variant:`outline`,size:`sm`,disabled:Ht.pending,onClick:async()=>{let e=await Ht.run(c);e.ok&&Ut(e.value.analysisId)},children:Ht.pending?`Retrying…`:`Retry`})]}),w.failure!==null&&(0,J.jsxs)(`div`,{className:X(`rounded-lg border border-review-changes/25 bg-review-changes-bg px-3 py-2 text-review-changes`,`flex flex-wrap items-center justify-between gap-2`),role:`alert`,children:[(0,J.jsxs)(`p`,{children:[`Couldn't save what you did with “`,qt,`”. `,w.failure.message]}),(0,J.jsx)($,{variant:`ghost`,size:`sm`,onClick:w.dismissFailure,children:`Dismiss`})]}),ot.error!==null&&(0,J.jsxs)(`div`,{role:`status`,className:X(`rounded-lg border border-review-pending/25 bg-review-pending-bg px-3 py-2 text-review-pending`,`flex flex-wrap items-center gap-3`),children:[(0,J.jsxs)(`span`,{children:[(0,J.jsx)(`span`,{"aria-hidden":`true`,children:`⚠ `}),`Couldn't read the comments on the pull request. `,Ap(ot.error)]}),(0,J.jsx)($,{variant:`outline`,size:`sm`,onClick:ot.reload,children:`Try again`})]}),d.stages.prep===`done`?V===`map`?(0,J.jsxs)(`div`,{className:X(KG,`[&>aside]:hidden lg:[&>aside]:flex`,ie&&`[&>aside]:flex`),children:[(0,J.jsx)(qW,{children:(0,J.jsx)(FF,{files:xt,activePath:re,onSelect:e=>St(YH(e)),className:`min-h-0 flex-1`})}),(0,J.jsx)(eU,{analysis:d,files:g,deps:pn,before:mn,after:ut.elsewhere.length>0&&(0,J.jsxs)(`section`,{"aria-label":`Comments on other files`,className:`flex flex-col gap-2 rounded-lg border bg-surface-subtle p-3`,children:[(0,J.jsx)(`h2`,{className:`text-caption font-medium text-muted-foreground`,children:`Comments on files without a card here`}),ut.elsewhere.map(e=>(0,J.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,J.jsx)(`span`,{className:`font-mono text-code-compact`,children:e.path}),_t(e,null)]},e.id))]}),trailingProofs:v,mechanicalCount:y,scrollRequest:Ve,signatureOf:fn})]}):(0,J.jsx)(`div`,{children:(0,J.jsx)(qU,{overview:B,focusKey:pe,currentPath:re,onOpen:Mt,onExpand:e=>te(t=>[...t,e]),expandedGroups:z,onCollapse:e=>te(t=>t.filter(t=>t!==e)),onFocusNode:e=>{he.current=e}})}):(0,J.jsx)(`section`,{"aria-busy":d.status===`running`,children:(0,J.jsx)(`p`,{className:`text-muted-foreground`,children:d.status===`running`?`Reading the diff…`:`The diff couldn't be read, so there are no changes to show.`})}),(0,J.jsxs)(`footer`,{className:`flex items-center justify-end gap-3`,children:[(0,J.jsx)(vU,{calls:o.modelCalls,option:o.modelOption,guidance:o.guidance,leftOut:S.filter(e=>e.guidance?.effect===`left-out`).length}),l&&!u&&Hu(o)&&(0,J.jsx)(JW,{analysisId:c,family:j,onRemoved:t=>r({...e,...t})}),(0,J.jsx)(fU,{usage:o.usage,option:o.modelOption,guidance:o.guidance})]}),W&&(0,J.jsx)(KW,{analysisId:c,hunkComments:Ye,isAuthor:e.isAuthor,published:s!==null,onClose:()=>Ue(!1),onPublished:()=>{Ue(!1),Xe(()=>[]),ot.reload(),st.reload(),t()}}),Oe&&(0,J.jsx)(bG,{ordered:dt,scope:ft,onScope:Te,onGo:e=>{ke(!1),Ot(e)},onClose:()=>ke(!1)}),Me&&(0,J.jsx)(EW,{points:k,family:j,kind:be===`thread`?null:be,stateOf:w.stateOf,onGo:e=>{Ne(!1),Dt(e)},onClose:()=>Ne(!1)}),(0,J.jsx)(CP,{open:We,onOpenChange:Ge,ids:YG}),(0,J.jsx)(tM,{handle:U,onGoTo:e=>St(JV(e))}),qe&&(0,J.jsxs)(aV,{title:d.intent===null?`What was asked`:`Intent`,onClose:()=>Je(!1),className:`sm:max-w-4xl`,returnFocus:()=>Ke.current,children:[d.intent===null?d.pullRequest!==null&&(0,J.jsx)(lH,{pullRequest:d.pullRequest,tickets:d.tickets,missingTicketKeys:d.missingTicketKeys}):(0,J.jsx)(vH,{intent:d.intent,tickets:d.tickets,missingTicketKeys:d.missingTicketKeys,onSelectMismatch:e=>{Ke.current=!1,Je(!1),At(e)}}),(0,J.jsx)(XG,{analysis:d})]}),(0,J.jsxs)(`p`,{className:`flex items-center gap-1.5 text-caption text-muted-foreground`,children:[`Press `,(0,J.jsx)(Tk,{id:`help`}),` for keyboard shortcuts.`]})]})},aK={theme:`megareviewer:theme`,diffPalette:`megareviewer:diffPalette`},oK=`(prefers-color-scheme: dark)`,sK=e=>e===`light`||e===`dark`?e:`system`,cK=e=>e===`cb`?`cb`:`default`,lK=(e,t)=>e===`system`?t?`dark`:`light`:e,uK=(e,t,n)=>{e.classList.toggle(`dark`,t===`dark`),n===`cb`?e.dataset.diffPalette=`cb`:delete e.dataset.diffPalette},dK=e=>{try{let t=window.localStorage.getItem(e);return t===null?void 0:JSON.parse(t)}catch{return}},fK=(e,t)=>{try{window.localStorage.setItem(e,JSON.stringify(t))}catch{}},pK=new Set,mK=()=>{for(let e of pK)e()},hK=e=>{pK.add(e);let t=window.matchMedia(oK);return t.addEventListener(`change`,e),window.addEventListener(`storage`,e),()=>{pK.delete(e),t.removeEventListener(`change`,e),window.removeEventListener(`storage`,e)}},gK=()=>`${sK(dK(aK.theme))} ${cK(dK(aK.diffPalette))} ${window.matchMedia(oK).matches}`,_K=()=>{let[e=`system`,t=`default`,n]=(0,q.useSyncExternalStore)(hK,gK).split(` `),r=sK(e),i=cK(t),a=lK(r,n===`true`);return(0,q.useEffect)(()=>{uK(document.documentElement,a,i)},[a,i]),{theme:r,resolvedTheme:a,diffPalette:i,setTheme:(0,q.useCallback)(e=>{fK(aK.theme,e),mK()},[]),setDiffPalette:(0,q.useCallback)(e=>{fK(aK.diffPalette,e),mK()},[])}},vK={"--normal-bg":`var(--popover)`,"--normal-text":`var(--popover-foreground)`,"--normal-border":`var(--border)`,"--border-radius":`var(--radius-xl)`},yK=({...e})=>{let{resolvedTheme:t}=_K();return(0,J.jsx)(HN,{theme:t,className:`toaster group`,icons:{success:(0,J.jsx)(Kh,{className:`size-4`}),info:(0,J.jsx)(bg,{className:`size-4`}),warning:(0,J.jsx)(n_,{className:`size-4`}),error:(0,J.jsx)(Pg,{className:`size-4`}),loading:(0,J.jsx)(Og,{className:`size-4 animate-spin`})},style:vK,toastOptions:{classNames:{toast:`cn-toast`}},...e})},bK={github:`GitHub`,bitbucket:`Bitbucket`},xK=`then restart megareviewer.`,SK={github:{connect:`Set GITHUB_TOKEN or run \`gh auth login\`, ${xK}`,adds:`Lists and opens GitHub pull requests.`},bitbucket:{connect:`Set BITBUCKET_EMAIL and BITBUCKET_API_TOKEN, and BITBUCKET_WORKSPACE to list its pull requests, ${xK}`,adds:`Lists and opens Bitbucket pull requests.`}},CK=e=>e===1?`1 pull request`:`${e} pull requests`,wK=(e,t,n,r,i)=>{let a=bK[e],{connect:o,adds:s}=SK[e];if(!t.configured)return n.configured?{kind:e,name:a,state:`optional`,detail:s,fix:o}:{kind:e,name:a,state:`not-connected`,detail:`${a} isn't configured.`,fix:o};if(t.user===null)return{kind:e,name:a,state:`failing`,detail:t.error??`Couldn't read the signed-in ${a} user.`,fix:`Check the token, ${xK} A network failure needs only Check again.`};let c=r?.counts[e];return{kind:e,name:a,state:`working`,detail:c===void 0||r===null?t.user.name:`${t.user.name} · ${CK(c)} listed ${JF(new Date(r.atMs).toISOString(),i)}`,fix:null}},TK={claude:{name:`Claude`,providers:[`claude-code`,`anthropic-api`],adds:`Adds intent, findings, risks and decisions with Request AI review.`,connect:"Run `claude` and sign in, or set ANTHROPIC_API_KEY."},codex:{name:`Codex`,providers:[`codex`],adds:`Adds OpenAI's GPT models to Request AI review, on your ChatGPT plan.`,connect:"Install the Codex CLI and run `codex login`."},opencode:{name:`opencode`,providers:[`opencode`],adds:`Adds the models of the providers you connected in opencode to Request AI review.`,connect:"Install opencode (https://opencode.ai) and connect a provider with `opencode auth login`."}},EK=e=>e.length<=1?e[0]??``:`${e.slice(0,-1).join(`, `)} and ${e.at(-1)??``}`,DK=(e,t,n)=>{if(e===`claude`){let e=t.find(e=>e.id===n)??t[0];return e===void 0?``:`${e.modelName} through ${e.via}`}if(e===`codex`)return`${EK(t.map(e=>e.modelName))} through ${t[0]?.via??`Codex`}`;let r=[...new Set(t.map(e=>e.via.replace(/^opencode, on /,``)))];return`${t.length===1?`1 model`:`${t.length} models`} through ${EK(r)}`},OK=(e,{options:t,defaultId:n})=>{let{name:r,providers:i,adds:a,connect:o}=TK[e],s=t.filter(e=>i.includes(e.provider)),c=s.filter(e=>e.available);if(c.length>0)return{kind:e,name:r,state:`working`,detail:DK(e,c,n),fix:null};let l=[...new Set(s.flatMap(e=>e.reason??[]))];return{kind:e,name:r,state:`optional`,detail:a,fix:l.length>0?l.join(`; or `):`${o.slice(0,-1)}, ${xK}`}},kK=e=>e?{kind:`jira`,name:`Jira`,state:`working`,detail:`Links tickets`,fix:null}:{kind:`jira`,name:`Jira`,state:`optional`,detail:`Reads the tickets a pull request names.`,fix:`Set JIRA_BASE_URL, JIRA_EMAIL and JIRA_API_TOKEN, ${xK}`},AK={failing:0,"not-connected":1,working:2,optional:2,checking:2},jK=(e,t)=>e===1?`1 ${t}`:`${e} ${t}s`,MK=[[`github`,`GitHub`],[`bitbucket`,`Bitbucket`],[`claude`,`Claude`],[`codex`,`Codex`],[`opencode`,`opencode`],[`jira`,`Jira`]],NK=e=>{let{status:t,error:n,checking:r,checkedAtMs:i,listed:a,nowMs:o}=e;if(n!==null&&!r)return{rows:[],button:{label:`Disconnected`,tone:`danger`,name:`Connections: megareviewer's server isn't answering. Open for details.`},summary:`megareviewer's server isn't answering`,disconnected:Ap(n)};if(t===null)return{rows:MK.map(([e,t])=>({kind:e,name:t,state:`checking`,detail:``,fix:null})),button:{label:`Checking…`,tone:`checking`,name:`Connections: checking. Open for details.`},summary:`Checking ${MK.length} connections…`,disconnected:null};let{github:s,bitbucket:c}=t.hosts,l=[wK(`github`,s,c,a,o),wK(`bitbucket`,c,s,a,o),OK(`claude`,t.model),OK(`codex`,t.model),OK(`opencode`,t.model),kK(t.jira.configured)].sort((e,t)=>AK[e.state]-AK[t.state]),u=e=>l.filter(t=>t.state===e).length,d=u(`failing`),f=u(`not-connected`),p=u(`working`),m=u(`optional`),h=d+f,g=[...d>0?[`${d} failing`]:[],...f>0?[`${f} not connected`]:[],...p>0?[`${p} working`]:[],...m>0&&h===0?[`${m} optional`]:[]],_=i===null?``:` · checked ${JF(new Date(i).toISOString(),o)}`,v=h>0?g.join(` · `):p===l.length?`All ${p} working${_}`:`${g.join(` · `)}${_}`,y=`Connections: ${g.join(` · `)}. ${h>0?`Open to fix.`:`Open for details.`}`;return r?{rows:l.map(e=>({...e,state:`checking`})),button:{label:`Checking…`,tone:`checking`,name:`Connections: checking. Open for details.`},summary:`Checking ${l.length} connections…`,disconnected:null}:{rows:l,button:{...h>0?{label:jK(h,`issue`),tone:d>0?`danger`:`warning`}:p===l.length?{label:`All connected`,tone:`ok`}:{label:`${p} of ${l.length} connected`,tone:`ok`},name:y},summary:v,disconnected:null}},PK={checking:`text-muted-foreground`,ok:``,warning:`border-review-pending bg-review-pending-bg text-review-pending hover:bg-review-pending-bg hover:text-review-pending aria-expanded:bg-review-pending-bg aria-expanded:text-review-pending`,danger:`border-destructive bg-review-changes-bg text-destructive hover:bg-review-changes-bg hover:text-destructive aria-expanded:bg-review-changes-bg aria-expanded:text-destructive`},FK={github:mg,bitbucket:mg,claude:Xg,codex:Xg,opencode:Xg,jira:Qg},IK={working:{label:`Connected`,icon:Ih,tone:`text-ci-success`,row:``},failing:{label:`Failing`,icon:n_,tone:`text-destructive`,row:`border-l-3 border-l-destructive bg-review-changes-bg`},"not-connected":{label:`Not connected`,icon:Jh,tone:`text-review-pending`,row:`border-l-3 border-l-review-pending bg-review-pending-bg`},optional:{label:`Not connected · Optional`,icon:Jh,tone:`text-muted-foreground`,row:``},checking:{label:`Checking…`,icon:Og,tone:`text-muted-foreground`,row:``}},LK=new Set([`claude`,`codex`,`opencode`]),RK=({className:e})=>(0,J.jsx)(Og,{"aria-hidden":`true`,className:X(`animate-spin motion-reduce:animate-[spin_3s_linear_infinite]`,e)}),zK=({tone:e})=>e===`checking`?(0,J.jsx)(RK,{}):e===`ok`?(0,J.jsx)(Ih,{"aria-hidden":`true`,className:`text-ci-success`}):(0,J.jsx)(n_,{"aria-hidden":`true`}),BK=({row:e})=>{let t=IK[e.state],n=e.state===`optional`&&LK.has(e.kind)?`Not connected`:t.label,r=FK[e.kind],i=t.icon;return(0,J.jsxs)(`li`,{"data-state":e.state,className:X(`flex flex-col gap-0.5 rounded-md px-2.5 py-2`,t.row,e.state===`optional`&&`text-muted-foreground`),children:[(0,J.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,J.jsx)(r,{"aria-hidden":`true`,className:`size-4 shrink-0`}),(0,J.jsx)(`span`,{className:`font-medium`,children:e.name}),(0,J.jsxs)(`span`,{className:X(`ml-auto flex items-center gap-1 text-caption`,t.tone),children:[(0,J.jsx)(i,{"aria-hidden":`true`,className:X(`size-3.5`,e.state===`checking`&&`animate-spin motion-reduce:animate-[spin_3s_linear_infinite]`)}),n]})]}),e.detail!==``&&(0,J.jsx)(`p`,{className:`text-caption`,children:e.detail}),e.fix!==null&&(0,J.jsx)(`p`,{className:`text-caption`,children:e.fix})]})},VK=({connections:e,version:t,checking:n,onCheckAgain:r,checkAgainRef:i})=>(0,J.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,J.jsxs)(`div`,{className:`flex flex-col gap-0.5 px-1`,children:[(0,J.jsx)(ZM,{className:`text-heading font-semibold`,children:`Connections`}),(0,J.jsx)(`p`,{className:`text-caption text-muted-foreground`,children:e.summary})]}),e.disconnected===null?(0,J.jsx)(`ul`,{className:`flex flex-col gap-1`,children:e.rows.map(e=>(0,J.jsx)(BK,{row:e},e.kind))}):(0,J.jsx)(`p`,{className:`rounded-md border-l-3 border-l-destructive bg-review-changes-bg px-2.5 py-2 text-caption`,children:e.disconnected}),(0,J.jsxs)(`div`,{className:`flex items-center justify-between gap-2 border-t px-1 pt-2`,children:[(0,J.jsxs)($,{ref:i,variant:`outline`,size:`sm`,onClick:r,"aria-busy":n,"aria-disabled":n,children:[n&&(0,J.jsx)(RK,{}),`Check again`]}),t!==null&&(0,J.jsxs)(`span`,{className:`text-caption text-muted-foreground`,children:[`megareviewer `,t]})]})]}),HK=({connections:e,version:t,checking:n,open:r,onOpenChange:i,onCheckAgain:a,focusCheckAgain:o=!1})=>{let s=(0,q.useCallback)(e=>{e!==null&&o&&e.focus()},[o]),{label:c,tone:l,name:u}=e.button;return(0,J.jsxs)(JM,{...r===void 0?{}:{open:r},...i===void 0?{}:{onOpenChange:e=>i(e)},children:[(0,J.jsxs)(YM,{render:(0,J.jsx)($,{variant:`outline`,size:`sm`,className:PK[l],"data-tone":l,"aria-label":u}),children:[(0,J.jsx)(zK,{tone:l}),c]}),(0,J.jsx)(XM,{align:`end`,className:`w-[min(340px,calc(100vw-24px))] p-2`,initialFocus:!1,children:(0,J.jsx)(VK,{connections:e,version:t,checking:n,onCheckAgain:()=>{n||a()},checkAgainRef:s})})]})},UK=({now:e=Date.now})=>{let t=pI(),{status:n,error:r,checking:i,checkedAtMs:a,listed:o,open:s,setOpen:c,focusCheckAgain:l}=t,u=NK({status:n,error:r,checking:i,checkedAtMs:a,listed:o,nowMs:e()}),{label:d,tone:f}=u.button,[p,m]=(0,q.useState)(``),h=(0,q.useRef)(!0);return(0,q.useEffect)(()=>{f!==`checking`&&(h.current?h.current=!1:m(`Connections: ${d}`))},[d,f]),(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(HK,{connections:u,version:n?.version??null,checking:i,open:s,onOpenChange:e=>c(e),onCheckAgain:t.checkAgain,focusCheckAgain:l}),(0,J.jsx)(`span`,{className:`sr-only`,"aria-live":`polite`,children:p})]})},WK=[{value:`light`,label:`Light`},{value:`dark`,label:`Dark`},{value:`system`,label:`System`}],GK=()=>{let{theme:e,diffPalette:t,setTheme:n,setDiffPalette:r}=_K(),i=Fp(),a=(0,q.useRef)(!1);return(0,J.jsxs)(Sz,{children:[(0,J.jsx)(Cz,{render:(0,J.jsx)($,{variant:`ghost`,size:`sm`,className:`max-sm:px-1.5`}),children:`Display`}),(0,J.jsxs)(wz,{align:`end`,className:`w-56`,finalFocus:()=>{let e=a.current;return a.current=!1,!e},children:[i!==null&&(0,J.jsxs)(J.Fragment,{children:[(0,J.jsxs)(Tz,{children:[(0,J.jsx)(Ez,{children:i.label}),(0,J.jsx)(kz,{value:i.value,onValueChange:e=>{a.current=!0,i.onChange(e)},children:i.options.map(e=>(0,J.jsx)(Az,{value:e.value,closeOnClick:!0,children:e.label},e.value))})]}),(0,J.jsx)(jz,{}),i.toggle!==void 0&&(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(Oz,{checked:i.toggle.checked,onCheckedChange:i.toggle.onChange,children:i.toggle.label}),(0,J.jsx)(jz,{})]})]}),(0,J.jsxs)(Tz,{children:[(0,J.jsx)(Ez,{children:`Theme`}),(0,J.jsx)(kz,{value:e,onValueChange:e=>{let t=WK.find(t=>t.value===e);t!==void 0&&n(t.value)},children:WK.map(e=>(0,J.jsx)(Az,{value:e.value,children:e.label},e.value))})]}),(0,J.jsx)(jz,{}),(0,J.jsx)(Oz,{checked:t===`cb`,onCheckedChange:e=>r(e?`cb`:`default`),children:`Color-blind safe diff`})]})]})},KK=({current:e})=>(0,J.jsxs)(__,{to:o_,"aria-current":e?`page`:void 0,className:X(qv({variant:`ghost`,size:`sm`}),`min-w-7 text-foreground hover:no-underline aria-[current=page]:bg-muted max-sm:px-0`),children:[(0,J.jsx)(Jg,{"aria-hidden":`true`,className:`sm:hidden`}),(0,J.jsx)(`span`,{className:`max-sm:sr-only`,children:`Preferences`})]}),qK=()=>{let e=l_(p_());return(0,J.jsxs)(`header`,{className:`flex h-12 items-center justify-between gap-4 border-b bg-background px-4 max-sm:gap-2 sm:px-6`,children:[(0,J.jsx)(__,{to:`/`,className:`text-heading font-semibold text-foreground hover:no-underline`,children:`megareviewer`}),(0,J.jsxs)(`div`,{className:`flex items-center gap-2 max-sm:gap-1`,children:[(0,J.jsx)(UK,{}),(0,J.jsx)(KK,{current:e.page===`preferences`}),(0,J.jsx)(GK,{})]})]})},JK=()=>(0,J.jsxs)(`div`,{className:`mx-auto flex max-w-2xl flex-col gap-3 py-12`,children:[(0,J.jsx)(`h1`,{className:`text-title font-semibold tracking-[-0.01em]`,children:`Page not found`}),(0,J.jsxs)(`p`,{className:`text-body`,children:[`There's nothing at this address. `,(0,J.jsx)(__,{to:`/`,children:`Go to your pull requests`}),`.`]})]}),YK=({reason:e})=>(0,J.jsxs)(`main`,{className:`mx-auto flex max-w-2xl flex-col gap-3 px-4 py-12`,children:[(0,J.jsx)(`h1`,{className:`text-title font-semibold tracking-[-0.01em]`,children:`Open megareviewer from your terminal`}),e===`missing`?(0,J.jsxs)(`p`,{className:`text-body`,children:[`This page needs the link megareviewer printed when it started. It looks like`,` `,(0,J.jsx)(`code`,{className:`rounded-sm bg-muted px-1 font-mono text-code-compact`,children:`http://127.0.0.1:4823/?token=…`}),`. Copy it from your terminal and open it once; other tabs in this browser then work without it.`]}):(0,J.jsx)(`p`,{className:`text-body`,children:`This page's session has ended, usually because megareviewer was restarted. Open the new link printed in your terminal.`}),(0,J.jsxs)(`p`,{className:`text-muted-foreground`,children:[`Not running? Start it with`,` `,(0,J.jsx)(`code`,{className:`rounded-sm bg-muted px-1 font-mono text-code-compact`,children:`npx megareviewer`}),`.`]})]}),XK=({token:e,fetch:t,openEventStream:n})=>{let[r,i]=(0,q.useState)(!1),[a,o]=(0,q.useState)(e.value),s=(0,q.useMemo)(()=>a===null?null:{client:hp({fetch:t,token:a,onUnauthorized:()=>{let t=e.reject(a);t===null?i(!0):o(t)}}),subscribe:(e,t)=>_p(e,a,t,n)},[t,n,e,a]);return r?(0,J.jsx)(YK,{reason:`ended`}):s===null?(0,J.jsx)(YK,{reason:`missing`}):(0,J.jsx)(vp.Provider,{value:s,children:(0,J.jsx)(ZK,{},a)})},ZK=()=>{let e=l_(p_());return(0,J.jsx)(HI,{children:(0,J.jsx)(Pp,{children:(0,J.jsxs)(mI,{children:[(0,J.jsx)(qK,{}),(0,J.jsx)(`main`,{className:X(`px-4 py-5 sm:px-6`,(e.page===`picker`||e.page===`preferences`)&&`min-h-[calc(100dvh-3rem)] bg-surface-subtle`),children:e.page===`picker`?(0,J.jsx)(CL,{}):e.page===`preferences`?(0,J.jsx)(gV,{}):e.page===`review`?(0,J.jsx)(UG,{analysisId:e.analysisId}):e.page===`open`?(0,J.jsx)(gI,{pullRequest:e.ref},u_(e.ref)):(0,J.jsx)(JK,{})}),(0,J.jsx)(yK,{})]})})})},QK=class extends q.Component{state={error:null};static getDerivedStateFromError(e){return{error:e instanceof Error?e:Error(String(e))}}render(){let{error:e}=this.state;if(e===null)return this.props.children;let t=this.props.onReload??(()=>window.location.reload());return(0,J.jsxs)(`main`,{className:`mx-auto flex max-w-2xl flex-col items-start gap-3 px-4 py-12`,role:`alert`,children:[(0,J.jsx)(`h1`,{className:`text-title font-semibold tracking-[-0.01em]`,children:`Something went wrong`}),(0,J.jsx)(`p`,{className:`text-body`,children:`megareviewer hit a bug while showing this page.`}),(0,J.jsx)(`pre`,{className:`w-full overflow-x-auto rounded-md border bg-muted p-3 font-mono text-code-compact whitespace-pre-wrap`,children:String(e)}),(0,J.jsx)($,{onClick:t,children:`Reload`})]})}},$K=`token`,eq=`megareviewer.token`,tq=e=>{let t=(()=>{try{return e.localStorage}catch{return null}})(),n=e=>{try{return t===null?null:e(t)}catch{return null}},r=new URL(e.location.href),i=r.searchParams.get($K),a;return i!==null&&i!==``?(a=i,n(e=>e.setItem(eq,i))):a=n(e=>e.getItem(eq)),r.searchParams.has($K)&&(r.searchParams.delete($K),e.history.replaceState(e.history.state,``,`${r.pathname}${r.search}${r.hash}`)),{get value(){return a},reject(e){let t=n(e=>e.getItem(eq));return t===e&&n(e=>e.removeItem(eq)),a=t!==null&&t!==e?t:null,a}}},nq=document.getElementById(`root`);if(nq===null)throw Error(`index.html has no #root`);(0,xc.createRoot)(nq).render((0,J.jsx)(q.StrictMode,{children:(0,J.jsx)(QK,{children:(0,J.jsx)(XK,{token:tq(window),fetch:window.fetch.bind(window)})})}));export{s as t};
|