tarsk 0.5.55 → 0.5.57
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/index.js +6927 -5021
- package/dist/public/assets/{account-view-CkhRveFm.js → account-view-CCbGosVi.js} +1 -1
- package/dist/public/assets/api-DG0vQ1QZ.js +1 -0
- package/dist/public/assets/browser-tab-BpUYCZGi.js +8 -0
- package/dist/public/assets/commit-dialog-DpwAQ4Z6.js +1 -0
- package/dist/public/assets/context-menu-B5kRTqdn.js +1 -0
- package/dist/public/assets/create-repo-dialog-BoCupv2m.js +1 -0
- package/dist/public/assets/dialogs-config-BIrrNhlc.js +51 -0
- package/dist/public/assets/diff-view-D10roF70.js +3 -0
- package/dist/public/assets/explorer-tab-view-CA_AMgZd.js +2 -0
- package/dist/public/assets/explorer-tree-xlOwCJvH.js +1 -0
- package/dist/public/assets/explorer-view-C6eud9zx.js +75 -0
- package/dist/public/assets/git-history-dialog-BN7wBt9F.js +1 -0
- package/dist/public/assets/git-ops-button-CrICekvM.js +2 -0
- package/dist/public/assets/history-view-DfTUOfnG.js +9 -0
- package/dist/public/assets/index-BUA2xxQg.js +79 -0
- package/dist/public/assets/index-BgPn08Yc.css +1 -0
- package/dist/public/assets/mcp-server-card-CzNUrI8l.js +1 -0
- package/dist/public/assets/merged-pr-dialog-CzXN0cEw.js +1 -0
- package/dist/public/assets/model-star-rating-t0v8L-DE.js +1 -0
- package/dist/public/assets/{monaco-CZnIWXyV.js → monaco-y4UqQVp0.js} +198 -198
- package/dist/public/assets/onboarding-B0Jzwrxy.js +1 -0
- package/dist/public/assets/project-settings-view-CsrfJOxB.js +1 -0
- package/dist/public/assets/providers-list-view-CMc48hq3.js +1 -0
- package/dist/public/assets/pull-request-dialog-X0kSTYFA.js +1 -0
- package/dist/public/assets/pull-with-changes-dialog-CSHYq7Pw.js +1 -0
- package/dist/public/assets/push-before-pr-dialog-CQEDHNrv.js +1 -0
- package/dist/public/assets/radio-group-r6OYvBm-.js +1 -0
- package/dist/public/assets/react-vendor-B19oy2bp.js +16 -0
- package/dist/public/assets/settings-general-view-D_9c5_qk.js +1 -0
- package/dist/public/assets/settings-instructions-view-DA4cK-tR.js +1 -0
- package/dist/public/assets/settings-list-DIkoBKWq.js +1 -0
- package/dist/public/assets/settings-mcp-servers-view-DdEOTT5a.js +5 -0
- package/dist/public/assets/{settings-models-skeleton-MXSIpmT8.js → settings-models-skeleton-H4k7on9v.js} +1 -1
- package/dist/public/assets/settings-models-view-Dr2-jQBx.js +1 -0
- package/dist/public/assets/settings-rules-view-BkwWI1jx.js +8 -0
- package/dist/public/assets/settings-skills-view-C9CI7z7Q.js +3 -0
- package/dist/public/assets/settings-slash-commands-view-TF-A8FFP.js +1 -0
- package/dist/public/assets/settings-subagents-view-B73VymuX.js +2 -0
- package/dist/public/assets/{settings-system-prompt-view-DPMiLsrM.js → settings-system-prompt-view-CiX_so-K.js} +1 -1
- package/dist/public/assets/settings-view-DsEVR17r.js +2 -0
- package/dist/public/assets/skeleton-Cnmylb3F.js +1 -0
- package/dist/public/assets/slug-utils-DLI9k6Hb.js +1 -0
- package/dist/public/assets/tabs-CsOdC2OA.js +1 -0
- package/dist/public/assets/tasks-view-CGMAai1T.js +2 -0
- package/dist/public/assets/{terminal-panel-D6RjOZfD.js → terminal-panel-C8OewkuK.js} +2 -2
- package/dist/public/assets/{ui-components-BJRW2LJq.js → ui-components-CTS7wHdF.js} +1 -1
- package/dist/public/assets/{use-deferred-search-DOfdC3JO.js → use-deferred-search-BDiZsnWG.js} +1 -1
- package/dist/public/assets/use-installed-ai-files-BfMG7O3g.js +1 -0
- package/dist/public/assets/{utils-DPYK-CSn.js → utils-CFYgrqBu.js} +1 -1
- package/dist/public/assets/{vosk-speech-Ce0kC8Ck.js → vosk-speech-BZoPqFPM.js} +1 -1
- package/dist/public/assets/{web-Cp_I5n5Z.js → web-B15zzKQ-.js} +1 -1
- package/dist/public/assets/{web-DLSR_y_6.js → web-BElJIgS6.js} +1 -1
- package/dist/public/assets/{web-BFYPtzjF.js → web-CU5taXAB.js} +1 -1
- package/dist/public/assets/{web-DGEc3VyT.js → web-gruOPZvU.js} +1 -1
- package/dist/public/index.html +9 -9
- package/dist/recommended-models.txt +5 -4
- package/package.json +2 -1
- package/dist/public/assets/api-BUjKoVUu.js +0 -1
- package/dist/public/assets/browser-tab-DbT2QjH_.js +0 -8
- package/dist/public/assets/commit-dialog-DRMKciNP.js +0 -1
- package/dist/public/assets/context-menu-DO3hiSAo.js +0 -1
- package/dist/public/assets/create-repo-dialog-CXiWjkFb.js +0 -1
- package/dist/public/assets/dialogs-config-86QTDk4G.js +0 -51
- package/dist/public/assets/diff-view-D_xoUbUb.js +0 -3
- package/dist/public/assets/explorer-tab-view-JIMdE8cA.js +0 -2
- package/dist/public/assets/explorer-tree-B60M0QAV.js +0 -1
- package/dist/public/assets/explorer-view-BBaEk8i9.js +0 -75
- package/dist/public/assets/git-history-dialog-DfzFi0Nx.js +0 -1
- package/dist/public/assets/git-ops-button-C_4iUio-.js +0 -2
- package/dist/public/assets/history-view-BsN806ip.js +0 -9
- package/dist/public/assets/index-C2iIghSR.js +0 -81
- package/dist/public/assets/index-DhnUeGIU.css +0 -1
- package/dist/public/assets/mcp-server-card-DUJUtQq-.js +0 -1
- package/dist/public/assets/merged-pr-dialog-DVNtED4V.js +0 -1
- package/dist/public/assets/model-star-rating-DrR6jzjq.js +0 -1
- package/dist/public/assets/onboarding-DCrFdRM5.js +0 -1
- package/dist/public/assets/project-settings-view-DRL5CTSQ.js +0 -1
- package/dist/public/assets/providers-list-view-DkmgzncX.js +0 -1
- package/dist/public/assets/pull-request-dialog-CPjzwrdo.js +0 -1
- package/dist/public/assets/pull-with-changes-dialog-DLfDpEEX.js +0 -1
- package/dist/public/assets/push-before-pr-dialog-v-3J53Hw.js +0 -1
- package/dist/public/assets/radio-group-C7-1cZ2t.js +0 -1
- package/dist/public/assets/react-vendor-DK2COBjg.js +0 -16
- package/dist/public/assets/settings-general-view-BZZs0t0d.js +0 -1
- package/dist/public/assets/settings-instructions-view-CE-ugC91.js +0 -1
- package/dist/public/assets/settings-list-CICo_cz2.js +0 -1
- package/dist/public/assets/settings-mcp-servers-view-DKviDm0q.js +0 -5
- package/dist/public/assets/settings-models-view-DWqPx-2m.js +0 -1
- package/dist/public/assets/settings-rules-view-Cq-60UOT.js +0 -8
- package/dist/public/assets/settings-skills-view-B6srjIvU.js +0 -3
- package/dist/public/assets/settings-slash-commands-view-j8NdZX1V.js +0 -1
- package/dist/public/assets/settings-subagents-view-4LusGYrq.js +0 -2
- package/dist/public/assets/settings-view-0Idf-mDz.js +0 -2
- package/dist/public/assets/skeleton-BvvAbfo4.js +0 -1
- package/dist/public/assets/slug-utils-jE4NOx-f.js +0 -1
- package/dist/public/assets/tabs-0fGgot48.js +0 -1
- package/dist/public/assets/tasks-view-DD03SZ7R.js +0 -3
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{$r as t,Aa as n,An as r,Ba as i,Fi as a,Fo as o,Ia as s,J as c,Jo as l,Li as u,Mn as d,Po as f,Ra as p,Rr as m,Rs as h,U as g,Vr as _,Vs as v,Wn as y,_a as b,ai as x,c as S,dn as C,ii as w,io as T,ja as E,ms as D,no as O,qi as k,ri as A,ti as j,to as M,xt as N,zr as P,zs as F}from"./dialogs-config-BIrrNhlc.js";import{x as I}from"./react-vendor-B19oy2bp.js";import{n as L}from"./monaco-y4UqQVp0.js";import{I as R,a as ee,l as z,n as B,o as V}from"./history-view-DfTUOfnG.js";import{d as te}from"./onboarding-B0Jzwrxy.js";import{n as ne}from"./utils-CFYgrqBu.js";import{G as re,J as H,K as ie,R as ae,T as oe,U,W,d as G,f as K,h as se,m as q,p as J}from"./index-BUA2xxQg.js";import{a as Y,n as X,r as ce,t as le}from"./context-menu-B5kRTqdn.js";var Z=e(v(),1),Q=F(),$=h();function ue(e){let t=(0,Q.c)(20),{children:n,title:r,subtitle:i,headerAction:a,footer:o}=e,s;t[0]===r?s=t[1]:(s=r&&(0,$.jsx)(`span`,{className:D.sectionTitle,children:r}),t[0]=r,t[1]=s);let c;t[2]===s?c=t[3]:(c=(0,$.jsx)(`div`,{className:`flex items-center gap-2`,children:s}),t[2]=s,t[3]=c);let l;t[4]===a?l=t[5]:(l=a&&(0,$.jsx)(`div`,{className:`flex items-center gap-2 ml-auto`,children:a}),t[4]=a,t[5]=l);let u;t[6]!==c||t[7]!==l?(u=(0,$.jsxs)(`div`,{className:`flex items-center justify-between`,children:[c,l]}),t[6]=c,t[7]=l,t[8]=u):u=t[8];let d;t[9]!==i||t[10]!==u?(d=(0,$.jsxs)(`div`,{className:`flex shrink-0 flex-col gap-1 border-b border-sidebar-border px-4 py-6`,children:[u,i]}),t[9]=i,t[10]=u,t[11]=d):d=t[11];let f;t[12]===n?f=t[13]:(f=(0,$.jsx)(S,{className:`min-h-0 flex-1`,children:n}),t[12]=n,t[13]=f);let p;t[14]===o?p=t[15]:(p=o&&(0,$.jsx)(`div`,{className:`border-t border-sidebar-border`,children:o}),t[14]=o,t[15]=p);let m;return t[16]!==d||t[17]!==f||t[18]!==p?(m=(0,$.jsxs)(`div`,{className:`flex h-full min-h-0 w-full flex-col`,children:[d,f,p]}),t[16]=d,t[17]=f,t[18]=p,t[19]=m):m=t[19],m}function de(e){let t=[],n={};return e.forEach((e,r)=>{let i=e.path.split(`/`),a=t,o=``;for(let e=0;e<i.length-1;e++){if(o=o?`${o}/${i[e]}`:i[e],!n[o]){let t={id:`dir:${o}`,name:i[e],children:[]};n[o]=t,a.push(t)}a=n[o].children}a.push({id:`file:${e.path}`,name:i[i.length-1],fileIndex:r,status:e.status})}),t}var fe={added:`text-green-500`,deleted:`text-red-500`,untracked:`text-green-500`,renamed:`text-blue-500`,modified:`text-orange-500`},pe={added:`A`,deleted:`D`,untracked:`U`,renamed:`R`,modified:`M`};function me(e){return u(u(D.compact,`status-badge font-mono font-semibold`),fe[e]??`text-orange-500`)}function he(e){return pe[e]??`M`}var ge=R(e=>(0,$.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,$.jsxs)(`span`,{className:e.v0,children:[e.v1,` file`,e.v2]}),(0,$.jsxs)(`span`,{className:e.v3,children:[`+`,e.v4]}),(0,$.jsxs)(`span`,{className:e.v5,children:[`-`,e.v6]})]}),{name:`JSX_stats_1`,portals:[`v1`,`v2`,`v4`,`v6`]}),_e=R(e=>e.v0,{name:`DiffTree_1`,portals:[`v0`]}),ve=R(e=>e.v0,{name:`DiffTree_2`,portals:[`v0`]}),ye=R(e=>e.v0,{name:`DiffTree_3`,portals:[`v0`]}),be=function(e){let t=(0,Q.c)(32),{treeData:n,files:r,error:i,selectedFileIndex:a,onFileSelect:o,onRevertFile:s}=e,c;t[0]===r?c=t[1]:(c=r.reduce(Ce,0),t[0]=r,t[1]=c);let l=c,d;t[2]===r?d=t[3]:(d=r.reduce(Ee,0),t[2]=r,t[3]=d);let p=d,m;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(m=u(D.compact,`text-muted-foreground`),t[4]=m):m=t[4];let h=r.length,g=r.length===1?``:`s`,_;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(_=u(D.compact,`text-green-500`),t[5]=_):_=t[5];let v;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(v=u(D.compact,`text-red-500`),t[6]=v):v=t[6];let y;t[7]!==r.length||t[8]!==g||t[9]!==l||t[10]!==p?(y=(0,$.jsx)(ge,{v0:m,v1:h,v2:g,v3:_,v4:l,v5:v,v6:p}),t[7]=r.length,t[8]=g,t[9]=l,t[10]=p,t[11]=y):y=t[11];let x=y;if(i){let e;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(e=u(D.compact,`text-destructive text-center`),t[12]=e):e=t[12];let n;t[13]===i?n=t[14]:(n=(0,$.jsx)(`div`,{className:`flex-1 flex items-center justify-center p-4 pt-7 pb-2`,children:(0,$.jsx)(`p`,{className:e,children:i})}),t[13]=i,t[14]=n);let r;return t[15]!==x||t[16]!==n?(r=(0,$.jsx)(_e,{v0:(0,$.jsx)(ue,{title:`Review Changes`,subtitle:x,children:n})}),t[15]=x,t[16]=n,t[17]=r):r=t[17],r}if(r.length===0){let e;t[18]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,$.jsx)(`div`,{className:`flex-1 flex items-center justify-center p-4 pt-7 pb-2`,children:(0,$.jsx)(`p`,{className:u(D.compact,D.bodyMuted,`text-center`),children:`No changes to review`})}),t[18]=e):e=t[18];let n;return t[19]===x?n=t[20]:(n=(0,$.jsx)(ve,{v0:(0,$.jsx)(ue,{title:`Review Changes`,subtitle:x,children:e})}),t[19]=x,t[20]=n),n}let S;t[21]!==r||t[22]!==o||t[23]!==s||t[24]!==a?(S=(e,t)=>{let{isOpen:n,toggle:i}=t,c=!!e.children,l=(0,$.jsxs)(te,{onClick:()=>{c?i():e.fileIndex!==void 0&&o(e.fileIndex)},selected:!c&&e.fileIndex===a,className:`gap-1.5`,children:[c?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(f,{className:u(`h-3.5 w-3.5 shrink-0 text-muted-foreground transition-transform`,n&&`rotate-90`)}),n?(0,$.jsx)(O,{className:`h-3.5 w-3.5 shrink-0 text-muted-foreground`}):(0,$.jsx)(M,{className:`h-3.5 w-3.5 shrink-0 text-muted-foreground`})]}):(0,$.jsx)(T,{className:`h-3.5 w-3.5 shrink-0 text-muted-foreground`}),(0,$.jsx)(`span`,{className:`truncate flex-1 min-w-0`,children:e.name}),!c&&e.status&&(0,$.jsx)(`span`,{className:me(e.status),children:he(e.status)})]});return c?l:(0,$.jsxs)(le,{children:[(0,$.jsx)(Y,{asChild:!0,children:(0,$.jsx)(`div`,{children:l})}),(0,$.jsx)(X,{children:(0,$.jsxs)(ce,{onClick:()=>{e.fileIndex!==void 0&&s?.(r[e.fileIndex])},children:[(0,$.jsx)(b,{className:`mr-2 h-3.5 w-3.5`}),`Revert Change`]})})]})},t[21]=r,t[22]=o,t[23]=s,t[24]=a,t[25]=S):S=t[25];let C;t[26]!==S||t[27]!==n?(C=(0,$.jsx)(`div`,{className:`px-1 pt-3 pb-2`,children:(0,$.jsx)(U,{nodes:n,defaultOpen:!0,resetKey:n,indent:16,childContainerClassName:`ml-4 border-l border-sidebar-border pl-2`,renderNode:S})}),t[26]=S,t[27]=n,t[28]=C):C=t[28];let w;return t[29]!==x||t[30]!==C?(w=(0,$.jsx)(ye,{v0:(0,$.jsx)(ue,{title:`Review Changes`,subtitle:x,children:C})}),t[29]=x,t[30]=C,t[31]=w):w=t[31],w};function xe(e){return e.type===`add`}function Se(e,t){return e+t.changes.filter(xe).length}function Ce(e,t){return e+t.hunks.reduce(Se,0)}function we(e){return e.type===`delete`}function Te(e,t){return e+t.changes.filter(we).length}function Ee(e,t){return e+t.hunks.reduce(Te,0)}function De(e){let n=(0,Q.c)(36),{open:r,lineNumber:i,lineContent:o,initialComment:s,isEditing:c,onSave:l,onDelete:d,onClose:f}=e,[p,m]=(0,Z.useState)((s===void 0?``:s)??``),h;n[0]!==l||n[1]!==p?(h=()=>{p.trim()&&l(p.trim())},n[0]=l,n[1]=p,n[2]=h):h=n[2];let g=h,_;n[3]===g?_=n[4]:(_=e=>{(e.metaKey||e.ctrlKey)&&e.key===`Enter`&&(e.preventDefault(),g())},n[3]=g,n[4]=_);let v=_,y;n[5]===f?y=n[6]:(y=e=>{e||f()},n[5]=f,n[6]=y);let b;n[7]===i?b=n[8]:(b=(0,$.jsx)(w,{children:(0,$.jsxs)(x,{children:[`Comment on line `,i]})}),n[7]=i,n[8]=b);let S;n[9]===Symbol.for(`react.memo_cache_sentinel`)?(S=u(D.compact,`font-mono rounded bg-muted px-3 py-2 text-muted-foreground overflow-x-auto whitespace-pre`),n[9]=S):S=n[9];let C=o||` `,T;n[10]===C?T=n[11]:(T=(0,$.jsx)(`div`,{className:S,children:C}),n[10]=C,n[11]=T);let E;n[12]===Symbol.for(`react.memo_cache_sentinel`)?(E=e=>m(e.target.value),n[12]=E):E=n[12];let O;n[13]!==v||n[14]!==p?(O=(0,$.jsx)(W,{autoFocus:!0,placeholder:`Add a comment... (Cmd+Enter to save)`,value:p,onChange:E,onKeyDown:v,rows:12,className:`resize-none text-base`}),n[13]=v,n[14]=p,n[15]=O):O=n[15];let k;n[16]!==c||n[17]!==d?(k=c&&d&&(0,$.jsx)(a,{variant:`destructive`,size:`sm`,onClick:d,className:`mr-auto`,children:`Delete`}),n[16]=c,n[17]=d,n[18]=k):k=n[18];let M;n[19]===p?M=n[20]:(M=p.trim(),n[19]=p,n[20]=M);let N=!M,P;n[21]!==g||n[22]!==N?(P=(0,$.jsx)(a,{size:`sm`,onClick:g,disabled:N,children:`Save`}),n[21]=g,n[22]=N,n[23]=P):P=n[23];let F;n[24]!==k||n[25]!==P?(F=(0,$.jsxs)(A,{className:`gap-2 sm:gap-0`,children:[k,P]}),n[24]=k,n[25]=P,n[26]=F):F=n[26];let I;n[27]!==O||n[28]!==F||n[29]!==b||n[30]!==T?(I=(0,$.jsxs)(j,{className:`max-w-2xl`,children:[b,T,O,F]}),n[27]=O,n[28]=F,n[29]=b,n[30]=T,n[31]=I):I=n[31];let L;return n[32]!==r||n[33]!==I||n[34]!==y?(L=(0,$.jsx)(t,{open:r,onOpenChange:y,children:I}),n[32]=r,n[33]=I,n[34]=y,n[35]=L):L=n[35],L}function Oe(e){let t=re(),n=ie(e=>e.diffComments),r=(0,Z.useMemo)(()=>n[e]??[],[n,e]),i=(0,Z.useCallback)(r=>{let i=n[e]??[],a=typeof r==`function`?r(i):r;t({type:H.SetDiffComments,threadId:e,comments:a})},[t,e,n]),a=(0,Z.useRef)(!1);return(0,Z.useEffect)(()=>{if((n[e]??[]).length>0){a.current=!0;return}N(e).then(n=>{n.diffComments&&n.diffComments.length>0&&t({type:H.SetDiffComments,threadId:e,comments:n.diffComments}),a.current=!0}).catch(()=>{a.current=!0})},[e]),(0,Z.useEffect)(()=>{a.current&&C(e,{diffComments:r}).catch(()=>{})},[e,r]),{comments:r,setComments:i}}function ke(e,t){return`git-diff:${e}:${t}`}function Ae(){return Error(`Loading review changes timed out. Please try again.`)}async function je(e,t=15e3){return Promise.race([r(e),new Promise((e,n)=>{window.setTimeout(()=>n(Ae()),t)})])}function Me(e){if(e.hunks.length===0)return null;let t=1/0,n=0;return e.hunks.forEach(e=>{let r=Math.min(e.oldStart,e.newStart),i=e.oldStart+e.oldLines,a=e.newStart+e.newLines,o=Math.max(i,a);t=Math.min(t,r),n=Math.max(n,o)}),t===1/0?null:{startLine:Math.max(1,t-2),endLine:n+2}}function Ne(e,t,n){return e.split(`
|
|
2
|
+
`).slice(t-1,n).join(`
|
|
3
|
+
`)}function Pe(e){let t=Me(e);return t?t.startLine<=1:!0}function Fe(e){return{ts:`typescript`,tsx:`typescript`,js:`javascript`,jsx:`javascript`,json:`json`,md:`markdown`,css:`css`,scss:`scss`,html:`html`,py:`python`,rb:`ruby`,go:`go`,rs:`rust`,java:`java`,kt:`kotlin`,swift:`swift`,c:`c`,cpp:`cpp`,h:`c`,hpp:`cpp`,sh:`shell`,yaml:`yaml`,yml:`yaml`,xml:`xml`,sql:`sql`}[e.split(`.`).pop()??``]||`plaintext`}function Ie(e){let t=(0,Q.c)(33),{comments:n,activeCommentIndex:r,isFullView:i,selectedFileIndex:a,files:o,selectedFile:s,onLineGutterClick:c}=e,l=(0,Z.useRef)(null),u=(0,Z.useRef)(n),d=(0,Z.useRef)(r),f;t[0]!==o||t[1]!==i||t[2]!==a?(f={isFullView:i,selectedFileIndex:a,files:o},t[0]=o,t[1]=i,t[2]=a,t[3]=f):f=t[3];let p=(0,Z.useRef)(f),m;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(m={original:[],modified:[]},t[4]=m):m=t[4];let h=(0,Z.useRef)(m),g=(0,Z.useRef)(!0),_,v;t[5]===n?(_=t[6],v=t[7]):(_=()=>{u.current=n},v=[n],t[5]=n,t[6]=_,t[7]=v),(0,Z.useEffect)(_,v);let y,b;t[8]===r?(y=t[9],b=t[10]):(y=()=>{d.current=r},b=[r],t[8]=r,t[9]=y,t[10]=b),(0,Z.useEffect)(y,b);let x,S;t[11]!==o||t[12]!==i||t[13]!==a?(x=()=>{p.current={isFullView:i,selectedFileIndex:a,files:o}},S=[i,a,o],t[11]=o,t[12]=i,t[13]=a,t[14]=x,t[15]=S):(x=t[14],S=t[15]),(0,Z.useEffect)(x,S);let C;t[16]===Symbol.for(`react.memo_cache_sentinel`)?(C=()=>{if(!g.current)return;let e=l.current;if(!e)return;let{isFullView:t,selectedFileIndex:n,files:r}=p.current,i=u.current,a=d.current,o=r[n];if(!o)return;let s=(e,r)=>{let s=t?null:Me(o),c=i.filter(e=>e.fileIndex===n&&e.side===r),l=new Set(c.map(e=>s?e.lineNumber-s.startLine+1:e.lineNumber)),u=e.getModel()?.getLineCount()??0,d=[];for(let e=1;e<=u;e++)l.has(e)||d.push({range:{startLineNumber:e,startColumn:1,endLineNumber:e,endColumn:1},options:{isWholeLine:!0,glyphMarginClassName:`diff-gutter-add-comment`,glyphMarginHoverMessage:{value:`$(add) Click to add a comment`},stickiness:L.TrackedRangeStickiness.NeverGrowsWhenTypingAtEdges}});let f=c.map(e=>{let t=s?e.lineNumber-s.startLine+1:e.lineNumber;if(t<1)return null;let n=i.indexOf(e)===a;return{range:{startLineNumber:t,startColumn:1,endLineNumber:t,endColumn:1},options:{isWholeLine:!0,className:n?`diff-comment-active-line`:`diff-comment-marked-line`,glyphMarginClassName:n?`diff-comment-glyph-active`:`diff-comment-glyph`,glyphMarginHoverMessage:{value:e.comment},stickiness:L.TrackedRangeStickiness.NeverGrowsWhenTypingAtEdges}}}).filter(Re);d.push(...f);let p=r===`original`?h.current.original:h.current.modified,m=e.deltaDecorations(p,d);r===`original`?h.current.original=m:h.current.modified=m};s(e.getOriginalEditor(),`original`),s(e.getModifiedEditor(),`modified`)},t[16]=C):C=t[16];let w=C,T;t[17]===Symbol.for(`react.memo_cache_sentinel`)?(T=()=>{w()},t[17]=T):T=t[17];let E;t[18]!==r||t[19]!==n||t[20]!==i||t[21]!==s||t[22]!==a?(E=[w,n,r,a,i,s],t[18]=r,t[19]=n,t[20]=i,t[21]=s,t[22]=a,t[23]=E):E=t[23],(0,Z.useEffect)(T,E);let D;t[24]===Symbol.for(`react.memo_cache_sentinel`)?(D=()=>()=>{l.current=null,h.current={original:[],modified:[]}},t[24]=D):D=t[24];let O;t[25]===a?O=t[26]:(O=[a],t[25]=a,t[26]=O),(0,Z.useEffect)(D,O);let k,A;t[27]===Symbol.for(`react.memo_cache_sentinel`)?(k=()=>()=>{g.current=!1,l.current&&=(l.current.getOriginalEditor().getModel()?.dispose(),l.current.getModifiedEditor().getModel()?.dispose(),l.current.dispose(),null),h.current={original:[],modified:[]}},A=[],t[27]=k,t[28]=A):(k=t[27],A=t[28]),(0,Z.useEffect)(k,A);let j;t[29]===c?j=t[30]:(j=e=>{l.current=e;let t=Le,n=(e,n)=>{e.onMouseDown(r=>{if(!r.target?.position||!t(r.target.type))return;let i=r.target.position.lineNumber,{isFullView:a,selectedFileIndex:o,files:s}=p.current,l=s[o];if(!l)return;let d=a?null:Me(l),f=d?d.startLine+i-1:i,m=e.getModel()?.getLineContent(i)??``;c({existing:u.current.find(e=>e.fileIndex===o&&e.lineNumber===f&&e.side===n),lineNumber:f,lineContent:m,side:n})})};n(e.getOriginalEditor(),`original`),n(e.getModifiedEditor(),`modified`),setTimeout(()=>{l.current===e&&w()},150)},t[29]=c,t[30]=j);let M=j,N;return t[31]===M?N=t[32]:(N={diffEditorRef:l,applyAllDecorations:w,handleEditorDidMount:M},t[31]=M,t[32]=N),N}function Le(e){return e===L.MouseTargetType.GUTTER_GLYPH_MARGIN||e===L.MouseTargetType.GUTTER_LINE_NUMBERS||e===L.MouseTargetType.GUTTER_LINE_DECORATIONS||e===L.MouseTargetType.GUTTER_VIEW_ZONE}function Re(e){return e!==null}var ze=R(e=>e.v0,{name:`ReviewLoadingFallback_1`,portals:[`v0`]}),Be=R(e=>(0,$.jsx)(`div`,{className:`flex h-full items-center justify-center p-6`,children:(0,$.jsxs)(`div`,{className:`space-y-4 text-center`,children:[(0,$.jsx)(`p`,{className:e.v0,children:`Loading review changes is taking longer than expected.`}),e.v1]})}),{name:`ReviewLoadingFallback_2`,portals:[`v1`]}),Ve=function(e){let t=(0,Q.c)(5),{onRetry:n}=e,[r,i]=(0,Z.useState)(!1),o,s;if(t[0]===Symbol.for(`react.memo_cache_sentinel`)?(o=()=>{let e=window.setTimeout(()=>{i(!0)},15e3);return()=>{window.clearTimeout(e)}},s=[],t[0]=o,t[1]=s):(o=t[0],s=t[1]),(0,Z.useEffect)(o,s),!r){let e;return t[2]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,$.jsx)(ze,{v0:(0,$.jsx)(z,{label:`Loading review changes...`})}),t[2]=e):e=t[2],e}let c;return t[3]===n?c=t[4]:(c=(0,$.jsx)(Be,{v0:D.bodyMuted,v1:(0,$.jsx)(a,{variant:`outline`,onClick:n,children:`Retry`})}),t[3]=n,t[4]=c),c},He=R(e=>(0,$.jsxs)(`div`,{className:`flex flex-col h-full`,children:[(0,$.jsx)(`div`,{className:e.v0,children:e.v1}),(0,$.jsx)(`div`,{className:`flex-1 flex items-center justify-center p-4 overflow-auto bg-background`,children:(0,$.jsx)(`img`,{src:e.v2,alt:e.v3,className:`max-w-full max-h-full object-contain`})})]}),{name:`DiffImageSingle_1`,portals:[`v1`]}),Ue=function(e){let t=(0,Q.c)(5),{threadId:n,filePath:r,version:i,label:a}=e,o=Ge(n,r,i),s;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(s=u(D.caption,`px-3 py-1.5 border-b text-muted-foreground bg-muted/30`),t[0]=s):s=t[0];let c=`${a} - ${r}`,l;return t[1]!==a||t[2]!==o||t[3]!==c?(l=(0,$.jsx)(He,{v0:s,v1:a,v2:o,v3:c}),t[1]=a,t[2]=o,t[3]=c,t[4]=l):l=t[4],l};function We(e,t,n){return`git-media:${e}:${t}:${n}`}function Ge(e,t,n){let r=(0,Q.c)(13),i;r[0]!==t||r[1]!==e||r[2]!==n?(i=We(e,t,n),r[0]=t,r[1]=e,r[2]=n,r[3]=i):i=r[3];let a;r[4]!==t||r[5]!==e||r[6]!==n?(a=()=>d(e,t,n),r[4]=t,r[5]=e,r[6]=n,r[7]=a):a=r[7];let o=ee(i,a),s;r[8]===o?s=r[9]:(s=URL.createObjectURL(o),r[8]=o,r[9]=s);let c=s,l,u;return r[10]===c?(l=r[11],u=r[12]):(l=()=>()=>{URL.revokeObjectURL(c)},u=[c],r[10]=c,r[11]=l,r[12]=u),(0,Z.useEffect)(l,u),c}function Ke(e){let t=(0,Q.c)(23),{threadId:n,file:r}=e,i=r.status===`modified`||r.status===`deleted`||r.status===`renamed`,a=r.status===`modified`||r.status===`added`||r.status===`untracked`||r.status===`renamed`;if(i&&a){let e;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,$.jsx)(z,{label:`Loading before...`}),t[0]=e):e=t[0];let i=r.status===`renamed`&&r.oldPath?r.oldPath:r.path,a;t[1]!==i||t[2]!==n?(a=(0,$.jsx)(`div`,{className:`flex-1 border-r border-border`,children:(0,$.jsx)(Z.Suspense,{fallback:e,children:(0,$.jsx)(Ue,{threadId:n,filePath:i,version:`old`,label:`Before`})})}),t[1]=i,t[2]=n,t[3]=a):a=t[3];let o;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,$.jsx)(z,{label:`Loading after...`}),t[4]=o):o=t[4];let s;t[5]!==r.path||t[6]!==n?(s=(0,$.jsx)(`div`,{className:`flex-1`,children:(0,$.jsx)(Z.Suspense,{fallback:o,children:(0,$.jsx)(Ue,{threadId:n,filePath:r.path,version:`new`,label:`After`})})}),t[5]=r.path,t[6]=n,t[7]=s):s=t[7];let c;return t[8]!==a||t[9]!==s?(c=(0,$.jsxs)(`div`,{className:`flex h-full`,children:[a,s]}),t[8]=a,t[9]=s,t[10]=c):c=t[10],c}let o=a?`new`:`old`,s=a?`Added`:`Deleted`,c;t[11]===s?c=t[12]:(c=s.toLowerCase(),t[11]=s,t[12]=c);let l=`Loading ${c} image...`,u;t[13]===l?u=t[14]:(u=(0,$.jsx)(z,{label:l}),t[13]=l,t[14]=u);let d;t[15]!==r.path||t[16]!==s||t[17]!==n||t[18]!==o?(d=(0,$.jsx)(Ue,{threadId:n,filePath:r.path,version:o,label:s}),t[15]=r.path,t[16]=s,t[17]=n,t[18]=o,t[19]=d):d=t[19];let f;return t[20]!==u||t[21]!==d?(f=(0,$.jsx)(`div`,{className:`flex h-full flex-col`,children:(0,$.jsx)(Z.Suspense,{fallback:u,children:d})}),t[20]=u,t[21]=d,t[22]=f):f=t[22],f}function qe(e){let t=(0,Q.c)(63),{threadId:r,selectedFile:c,selectedFileIndex:l,isImageFile:d,diffOriginal:h,diffModified:g,resolvedTheme:v,onEditorMount:y,diffEditorOptions:b,isPanelCollapsed:x,showTreeBackButton:S,onShowTree:C,onTogglePanel:w,isFullView:T,onToggleFullView:O,comments:A,activeCommentIndex:j,onPrevComment:M,onNextComment:N,onFixComments:F,isChatOpen:L,onOpenChat:R,onCloseChat:ee}=e,z=x&&`h-auto py-3 flex-col items-start gap-3 md:flex-row md:items-center md:h-[71px] md:py-0 md:gap-2 justify-between`,B;t[0]===z?B=t[1]:(B=u(`bg-transparent`,z),t[0]=z,t[1]=B);let V;t[2]!==x||t[3]!==C||t[4]!==w||t[5]!==S?(V=S?(0,$.jsxs)(a,{variant:`ghost`,size:`icon`,className:`h-8 w-8 text-muted-foreground shrink-0`,onClick:C,children:[(0,$.jsx)(n,{className:`h-4 w-4`}),(0,$.jsx)(`span`,{className:`sr-only`,children:`Show file tree`})]}):(0,$.jsxs)(a,{variant:`ghost`,size:`icon`,className:`h-8 w-8 text-muted-foreground shrink-0`,onClick:w,children:[x?(0,$.jsx)(n,{className:`h-4 w-4`}):(0,$.jsx)(E,{className:`h-4 w-4`}),(0,$.jsx)(`span`,{className:`sr-only`,children:`Toggle file tree`})]}),t[2]=x,t[3]=C,t[4]=w,t[5]=S,t[6]=V):V=t[6];let te;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(te=u(D.label,`text-foreground`),t[7]=te):te=t[7];let ne=c?c.path:`Review Changes`,re;t[8]===ne?re=t[9]:(re=(0,$.jsx)(`span`,{className:te,children:ne}),t[8]=ne,t[9]=re);let H;t[10]!==V||t[11]!==re?(H=(0,$.jsxs)(`div`,{className:`flex items-center gap-2`,children:[V,re]}),t[10]=V,t[11]=re,t[12]=H):H=t[12];let ie=x&&`ml-0`,ae=!x&&`ml-auto`,oe;t[13]!==ie||t[14]!==ae?(oe=u(`flex items-center gap-2`,ie,ae,`md:ml-auto`),t[13]=ie,t[14]=ae,t[15]=oe):oe=t[15];let U;t[16]!==T||t[17]!==d||t[18]!==O||t[19]!==c?(U=!d&&(0,$.jsx)(a,{variant:`ghost`,size:`sm`,onClick:O,disabled:!c,className:u(D.compact,`h-8 gap-1 px-2`),children:T?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(s,{className:`h-3 w-3`}),` Show changes only`]}):(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(i,{className:`h-3 w-3`}),` Show full file`]})}),t[16]=T,t[17]=d,t[18]=O,t[19]=c,t[20]=U):U=t[20];let W;t[21]!==j||t[22]!==A.length||t[23]!==N||t[24]!==M?(W=A.length>0&&(0,$.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,$.jsxs)(m,{children:[(0,$.jsx)(_,{asChild:!0,children:(0,$.jsx)(a,{variant:`ghost`,size:`icon`,className:`h-8 w-8 rounded-full`,onClick:M,disabled:(j??0)===0,children:(0,$.jsx)(o,{className:`h-3 w-3`})})}),(0,$.jsx)(P,{children:`Previous comment`})]}),(0,$.jsx)(`span`,{className:u(D.caption,`whitespace-nowrap`),children:A.length===1?`1 Comment`:`Comment ${(j??0)+1} of ${A.length}`}),(0,$.jsxs)(m,{children:[(0,$.jsx)(_,{asChild:!0,children:(0,$.jsx)(a,{variant:`ghost`,size:`icon`,className:`h-8 w-8 rounded-full`,onClick:N,disabled:(j??0)===A.length-1,children:(0,$.jsx)(f,{className:`h-3 w-3`})})}),(0,$.jsx)(P,{children:`Next comment`})]})]}),t[21]=j,t[22]=A.length,t[23]=N,t[24]=M,t[25]=W):W=t[25];let K;t[26]!==A.length||t[27]!==F?(K=A.length>0&&(0,$.jsxs)(m,{children:[(0,$.jsx)(_,{asChild:!0,children:(0,$.jsxs)(a,{size:`sm`,onClick:F,className:u(D.compact,`h-8 gap-1 px-3 bg-foreground text-background hover:bg-foreground/90`),children:[(0,$.jsx)(p,{className:`h-3 w-3`}),`Fix all comments`]})}),(0,$.jsx)(P,{children:`Send all comments to Tarsk for resolution`})]}),t[26]=A.length,t[27]=F,t[28]=K):K=t[28];let q;t[29]!==oe||t[30]!==U||t[31]!==W||t[32]!==K?(q=(0,$.jsxs)(`div`,{className:oe,children:[U,W,K]}),t[29]=oe,t[30]=U,t[31]=W,t[32]=K,t[33]=q):q=t[33];let J;t[34]!==q||t[35]!==B||t[36]!==H?(J=(0,$.jsxs)(G,{className:B,children:[H,q]}),t[34]=q,t[35]=B,t[36]=H,t[37]=J):J=t[37];let Y;t[38]!==b||t[39]!==g||t[40]!==h||t[41]!==d||t[42]!==y||t[43]!==v||t[44]!==c||t[45]!==l||t[46]!==r?(Y=d&&c?(0,$.jsx)(Ke,{threadId:r,file:c}):(0,$.jsx)(I,{height:`100%`,language:Fe(c?.path||``),original:h,modified:g,theme:v===`dark`?`vs-dark`:`vs-light`,onMount:y,options:b},`diff-${l}`),t[38]=b,t[39]=g,t[40]=h,t[41]=d,t[42]=y,t[43]=v,t[44]=c,t[45]=l,t[46]=r,t[47]=Y):Y=t[47];let X;t[48]!==L||t[49]!==ee?(X=L&&(0,$.jsxs)(`div`,{className:`pointer-events-auto w-[min(100%,48rem)] rounded-2xl bg-background/50 p-4 backdrop-blur-md`,children:[(0,$.jsx)(`div`,{className:`mb-3 flex items-center justify-end`,children:(0,$.jsxs)(a,{variant:`ghost`,size:`icon`,className:`h-8 w-8`,onClick:ee,children:[(0,$.jsx)(k,{className:`h-4 w-4`}),(0,$.jsx)(`span`,{className:`sr-only`,children:`Close chat`})]})}),(0,$.jsx)(se,{})]}),t[48]=L,t[49]=ee,t[50]=X):X=t[50];let ce;t[51]!==L||t[52]!==R?(ce=!L&&(0,$.jsxs)(m,{children:[(0,$.jsx)(_,{asChild:!0,children:(0,$.jsxs)(a,{size:`icon`,className:`pointer-events-auto h-12 w-12 rounded-full shadow-lg`,onClick:R,children:[(0,$.jsx)(p,{className:`h-5 w-5`}),(0,$.jsx)(`span`,{className:`sr-only`,children:`Open review chat`})]})}),(0,$.jsx)(P,{children:`Chat about this diff`})]}),t[51]=L,t[52]=R,t[53]=ce):ce=t[53];let le;t[54]!==X||t[55]!==ce?(le=(0,$.jsxs)(`div`,{className:`pointer-events-none absolute bottom-4 right-4 z-20 flex flex-col items-end gap-3`,children:[X,ce]}),t[54]=X,t[55]=ce,t[56]=le):le=t[56];let Z;t[57]!==Y||t[58]!==le?(Z=(0,$.jsxs)(`div`,{className:`flex-1 bg-transparent relative`,children:[Y,le]}),t[57]=Y,t[58]=le,t[59]=Z):Z=t[59];let ue;return t[60]!==J||t[61]!==Z?(ue=(0,$.jsxs)(`div`,{className:`diff-editor-panel flex h-full min-h-0 w-full min-w-0 flex-1 flex-col overflow-hidden bg-transparent`,children:[J,Z]}),t[60]=J,t[61]=Z,t[62]=ue):ue=t[62],ue}function Je(e){let t=(0,Q.c)(4),{isOpen:n}=e,r=(n===void 0?!0:n)&&`ml-[-40px]`,i;t[0]===r?i=t[1]:(i=u(`z-10 shrink-0`,r),t[0]=r,t[1]=i);let a;return t[2]===i?a=t[3]:(a=(0,$.jsx)(K,{withHandle:!0,className:i}),t[2]=i,t[3]=a),a}function Ye(e){let t=(0,Q.c)(9),{isMobile:n,mobileShowTree:r,isPanelCollapsed:i,panelRef:a,onPanelCollapse:o,onPanelExpand:s,fileTreePanel:c,diffEditorPanel:l}=e,d;return t[0]!==l||t[1]!==c||t[2]!==n||t[3]!==i||t[4]!==r||t[5]!==o||t[6]!==s||t[7]!==a?(d=(0,$.jsx)(`div`,{className:`diff-body flex min-h-0 w-full flex-1 overflow-hidden`,children:n?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`div`,{className:u(`flex min-h-0 w-full min-w-0 flex-1 flex-col overflow-hidden`,!r&&`hidden`),children:c}),(0,$.jsx)(`div`,{className:u(`flex min-h-0 w-full min-w-0 flex-1 flex-col overflow-hidden`,r&&`hidden`),children:l})]}):(0,$.jsxs)(q,{direction:`horizontal`,children:[(0,$.jsx)(J,{ref:a,defaultSize:25,minSize:12,maxSize:40,collapsible:!0,collapsedSize:0,onCollapse:o,onExpand:s,className:`border-r border-transparent`,children:c}),(0,$.jsx)(Je,{isOpen:!i}),(0,$.jsx)(J,{className:`overflow-hidden border-l border-border bg-transparent`,children:l})]})}),t[0]=l,t[1]=c,t[2]=n,t[3]=i,t[4]=r,t[5]=o,t[6]=s,t[7]=a,t[8]=d):d=t[8],d}var Xe=l(`app.diff-view.ui`);function Ze({threadId:e,onExit:t,loadVersion:n,cachedState:i,onCachedStateChange:a}){let o=ee(ke(e,n),()=>je(e)),s=re(),l=ie(e=>e.projectModelSelections),{resolvedTheme:u}=ne(),d=oe(),{fetchUnifiedStatus:f}=ae(),[p,m]=(0,Z.useState)(i?.files??o.files??[]),[h,_]=(0,Z.useState)(null),[v,b]=(0,Z.useState)(i?.selectedFileIndex??0),[x,S]=(0,Z.useState)(!1),[C,w]=(0,Z.useState)(!1),[T,E]=(0,Z.useState)(!1),[D,O]=(0,Z.useState)(!0),k=(0,Z.useRef)(null);(0,Z.useEffect)(()=>{m(o.files??[]),b(e=>{let t=i?.selectedFileIndex??e,n=Math.max((o.files?.length??1)-1,0);return Math.min(t,n)})},[i?.selectedFileIndex,o.files]),(0,Z.useEffect)(()=>{O(!0)},[e]);let A=(0,Z.useCallback)(e=>{b(e),d&&O(!1)},[d]);(0,Z.useEffect)(()=>{a&&a(e=>{let t=p,n=Math.max(t.length-1,0),r=Math.min(v,n);return e?.files===t&&e.selectedFileIndex===r?e:{files:t,selectedFileIndex:r}})},[p,a,v]);let j=(0,Z.useCallback)(()=>{O(!0)},[]),M=d&&!D,{comments:N,setComments:P}=Oe(e),[F,I]=(0,Z.useState)(null),[L,R]=(0,Z.useState)(null),[z,B]=(0,Z.useState)(null),V=(0,Z.useCallback)(()=>{k.current&&(C?k.current.expand():k.current.collapse())},[C]),te=(0,Z.useCallback)(async()=>{if(e){_(null);try{m((await r(e)).files||[]),b(0)}catch(e){_(e instanceof Error?e.message:`Failed to load diff`)}}},[e]),U=(0,Z.useCallback)(async t=>{try{await y(e,t.path),await Promise.all([te(),f(!0)])}catch(e){_(e instanceof Error?e.message:`Failed to revert file`)}},[e,te,f]),W=(0,Z.useMemo)(()=>de(p),[p]),G=p[v],K=G?.isBinary??!1,se=G?x?G.oldContent:(()=>{let e=Me(G);return e?Ne(G.oldContent,e.startLine,e.endLine):G.oldContent})():``,q=G?x?G.newContent:(()=>{let e=Me(G);return e?Ne(G.newContent,e.startLine,e.endLine):G.newContent})():``,{diffEditorRef:J,applyAllDecorations:Y,handleEditorDidMount:X}=Ie({comments:N,activeCommentIndex:F,isFullView:x,selectedFileIndex:v,files:p,selectedFile:G,onLineGutterClick:(0,Z.useCallback)(({existing:e,lineNumber:t,lineContent:n,side:r})=>{e?B(e):R({lineNumber:t,lineContent:n,side:r})},[])}),ce=(0,Z.useCallback)(e=>{if(L&&G){let t={id:`comment-${Date.now()}`,filePath:G.path,fileIndex:v,lineNumber:L.lineNumber,lineContent:L.lineContent,comment:e,side:L.side};P(e=>[...e,t]),R(null)}else z&&(P(t=>t.map(t=>t.id===z.id?{...t,comment:e}:t)),B(null))},[L,z,G,v,P]),le=(0,Z.useCallback)(()=>{z&&(P(e=>e.filter(e=>e.id!==z.id)),B(null))},[z,P]),Q=(0,Z.useCallback)(e=>{if(N.length===0)return;let t=(e%N.length+N.length)%N.length,n=N[t];I(t),b(n.fileIndex),d&&O(!1),setTimeout(()=>{let e=J.current;if(!e)return;let t=p[n.fileIndex];if(!t)return;let r=x?null:Me(t),i=r?n.lineNumber-r.startLine+1:n.lineNumber;(n.side===`original`?e.getOriginalEditor():e.getModifiedEditor()).revealLineInCenter(Math.max(1,i)),Y()},100)},[N,p,x,Y,d]),ue=(0,Z.useCallback)(()=>{Q((F??0)-1)},[Q,F]),fe=(0,Z.useCallback)(()=>{Q((F??-1)+1)},[Q,F]),pe=(0,Z.useCallback)(async()=>{let n=l[e];if(!n)try{let e=await c(),t=Object.values(e).flat();if(t.length>0)n=t[0];else{Xe.error(`No models available to process comments`);return}}catch(e){Xe.error(`Failed to load models:`,e);return}let r=n.id,i=n.provider;try{let{prompt:n}=await g(e,N);P([]),s({type:H.SetPendingChatMessage,message:{threadId:e,message:n,model:r,provider:i}}),t()}catch(e){Xe.error(`Failed to fix comments:`,e),typeof window<`u`&&window.alert(`Failed to process comments. Please try again.`)}},[N,l,s,e,t,P]),me={readOnly:!0,renderSideBySide:!d,ignoreTrimWhitespace:!1,renderOverviewRuler:!0,scrollBeyondLastLine:!1,minimap:{enabled:!1},folding:!1,glyphMargin:!0,lineNumbers:G&&(x||Pe(G))?`on`:`off`,diffWordWrap:`on`,originalEditable:!1,automaticLayout:!0};return(0,$.jsxs)(`div`,{className:`diff-view-root flex h-full min-h-0 w-full flex-col`,children:[(0,$.jsx)(Ye,{isMobile:d,mobileShowTree:D,isPanelCollapsed:C,panelRef:k,onPanelCollapse:()=>w(!0),onPanelExpand:()=>w(!1),fileTreePanel:(0,$.jsx)(`div`,{className:`flex h-full min-h-0 w-full min-w-0 flex-1 flex-col overflow-hidden`,children:(0,$.jsx)(be,{treeData:W,files:p,error:h,selectedFileIndex:v,onFileSelect:A,onRevertFile:U})}),diffEditorPanel:(0,$.jsx)(qe,{threadId:e,selectedFile:G,selectedFileIndex:v,isImageFile:K,diffOriginal:se,diffModified:q,resolvedTheme:u,onEditorMount:X,diffEditorOptions:me,isPanelCollapsed:C,showTreeBackButton:M,onShowTree:j,onTogglePanel:V,isFullView:x,onToggleFullView:()=>S(e=>!e),comments:N,activeCommentIndex:F,onPrevComment:ue,onNextComment:fe,onFixComments:pe,isChatOpen:T,onOpenChat:()=>E(!0),onCloseChat:()=>E(!1)})}),(0,$.jsx)(De,{open:L!==null||z!==null,lineNumber:z?.lineNumber??L?.lineNumber??0,lineContent:z?.lineContent??L?.lineContent??``,initialComment:z?.comment,isEditing:z!==null,onSave:ce,onDelete:le,onClose:()=>{R(null),B(null)}},`${z?.id??``}-${L?.lineNumber??``}-${L?.side??``}`)]})}function Qe(e){let t=(0,Q.c)(23),[n,r]=(0,Z.useState)(0),[i,a]=(0,Z.useState)(0),o=(0,Z.useRef)(0),s=!!e.cachedState,c;t[0]===e.threadId?c=t[1]:(c=()=>{r(t=>(V(ke(e.threadId,t)),t+1)),a(et)},t[0]=e.threadId,t[1]=c);let l=c,u;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(u=()=>{a(0),r(0),o.current=0},t[2]=u):u=t[2];let d;t[3]===e.threadId?d=t[4]:(d=[e.threadId],t[3]=e.threadId,t[4]=d),(0,Z.useEffect)(u,d);let f,p;t[5]!==e.refreshTrigger||t[6]!==e.threadId?(f=()=>{!e.refreshTrigger||e.refreshTrigger<=o.current||(o.current=e.refreshTrigger,r(t=>(V(ke(e.threadId,t)),t+1)),a($e))},p=[e.refreshTrigger,e.threadId],t[5]=e.refreshTrigger,t[6]=e.threadId,t[7]=f,t[8]=p):(f=t[7],p=t[8]),(0,Z.useEffect)(f,p);let m=`${e.threadId}:${i}`,h;t[9]!==l||t[10]!==s?(h=s?null:(0,$.jsx)(Ve,{onRetry:l}),t[9]=l,t[10]=s,t[11]=h):h=t[11];let g=`${e.threadId}:${n}`,_;t[12]!==n||t[13]!==e||t[14]!==g?(_=(0,$.jsx)(Ze,{...e,loadVersion:n},g),t[12]=n,t[13]=e,t[14]=g,t[15]=_):_=t[15];let v;t[16]!==h||t[17]!==_?(v=(0,$.jsx)(Z.Suspense,{fallback:h,children:_}),t[16]=h,t[17]=_,t[18]=v):v=t[18];let y;return t[19]!==l||t[20]!==m||t[21]!==v?(y=(0,$.jsx)(B,{fallbackTitle:`Failed to load review changes`,onRetry:l,children:v},m),t[19]=l,t[20]=m,t[21]=v,t[22]=y):y=t[22],y}function $e(e){return e+1}function et(e){return e+1}export{Qe as DiffView,Qe as default};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/explorer-tree-xlOwCJvH.js","assets/rolldown-runtime-aKtaBQYM.js","assets/index-BUA2xxQg.js","assets/monaco-y4UqQVp0.js","assets/monaco-Br_kD0ds.css","assets/history-view-DfTUOfnG.js","assets/dialogs-config-BIrrNhlc.js","assets/onboarding-B0Jzwrxy.js","assets/vosk-speech-BZoPqFPM.js","assets/react-vendor-B19oy2bp.js","assets/utils-CFYgrqBu.js","assets/index-BgPn08Yc.css","assets/api-DG0vQ1QZ.js","assets/context-menu-B5kRTqdn.js","assets/ui-components-CTS7wHdF.js","assets/explorer-view-C6eud9zx.js"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{Li as t,Rs as n,Vs as r,c as i,ms as a,zs as o}from"./dialogs-config-BIrrNhlc.js";import{r as s}from"./monaco-y4UqQVp0.js";import{l as c,n as l,u}from"./history-view-DfTUOfnG.js";import{I as d,K as f,L as p,T as m,f as h,m as g,p as _}from"./index-BUA2xxQg.js";var v=o(),y=e(r(),1),b=n(),x=(0,y.lazy)(()=>s(()=>import(`./explorer-tree-xlOwCJvH.js`),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14]))),S=(0,y.lazy)(()=>s(()=>import(`./explorer-view-C6eud9zx.js`),__vite__mapDeps([15,1,2,3,4,5,6,7,8,9,10,11,12])));function C(){let e=(0,v.c)(49),n=f(w),r=m(),[o,s]=(0,y.useState)(null),[C,T]=(0,y.useState)(!0),{pendingExplorerPath:E,setPendingExplorerPath:D,explorerClearPath:O,setExplorerClearPath:k}=d(),A;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(A=()=>{T(!0)},e[0]=A):A=e[0];let j;e[1]===n?j=e[2]:(j=[n],e[1]=n,e[2]=j),(0,y.useEffect)(A,j);let M;e[3]===r?M=e[4]:(M=e=>{s(e),r&&T(!1)},e[3]=r,e[4]=M);let N=M,P;e[5]===Symbol.for(`react.memo_cache_sentinel`)?(P=()=>{T(!0)},e[5]=P):P=e[5];let F=P,I;e[6]===r?I=e[7]:(I=e=>{s(e),r&&T(!1)},e[6]=r,e[7]=I);let L=I,R,z;e[8]!==r||e[9]!==E||e[10]!==D?(R=()=>{E&&(s({name:E.split(`/`).pop()??E,path:E,type:`file`}),r&&T(!1),D(null))},z=[r,E,D],e[8]=r,e[9]=E,e[10]=D,e[11]=R,e[12]=z):(R=e[11],z=e[12]),(0,y.useEffect)(R,z);let B,V;e[13]!==O||e[14]!==r||e[15]!==o||e[16]!==k?(B=()=>{O&&(o&&(o.path===O||o.path.startsWith(O+`/`))&&(s(null),r&&T(!0)),k(null))},V=[O,r,o,k],e[13]=O,e[14]=r,e[15]=o,e[16]=k,e[17]=B,e[18]=V):(B=e[17],V=e[18]),(0,y.useEffect)(B,V);let H;e[19]!==N||e[20]!==o?.path||e[21]!==n?(H=(0,b.jsx)(i,{className:`h-full`,children:n?(0,b.jsx)(p,{threadId:n,children:(0,b.jsx)(l,{fallbackTitle:`Failed to load files`,children:(0,b.jsx)(y.Suspense,{fallback:(0,b.jsx)(u,{}),children:(0,b.jsx)(x,{threadId:n,selectedPath:o?.path??null,onNodeSelect:N})})})}):(0,b.jsx)(`p`,{className:t(a.caption,`px-3 py-4 text-center`),children:`No thread selected.`})}),e[19]=N,e[20]=o?.path,e[21]=n,e[22]=H):H=e[22];let U=H,W;e[23]===Symbol.for(`react.memo_cache_sentinel`)?(W=(0,b.jsx)(c,{}),e[23]=W):W=e[23];let G=r&&!C,K;e[24]!==L||e[25]!==o||e[26]!==G?(K=(0,b.jsx)(y.Suspense,{fallback:W,children:(0,b.jsx)(S,{selectedFile:o,showTreeBackButton:G,onShowTree:F,onFileCreated:L})}),e[24]=L,e[25]=o,e[26]=G,e[27]=K):K=e[27];let q=K;if(r){let n=!C&&`hidden`,r;e[28]===n?r=e[29]:(r=t(`flex-1 min-h-0 overflow-hidden`,n),e[28]=n,e[29]=r);let i;e[30]!==U||e[31]!==r?(i=(0,b.jsx)(`div`,{className:r,children:U}),e[30]=U,e[31]=r,e[32]=i):i=e[32];let a=C&&`hidden`,o;e[33]===a?o=e[34]:(o=t(`flex-1 min-h-0 overflow-hidden`,a),e[33]=a,e[34]=o);let s;e[35]!==q||e[36]!==o?(s=(0,b.jsx)(`div`,{className:o,children:q}),e[35]=q,e[36]=o,e[37]=s):s=e[37];let c;return e[38]!==i||e[39]!==s?(c=(0,b.jsxs)(`div`,{className:`flex h-full flex-col overflow-hidden`,children:[i,s]}),e[38]=i,e[39]=s,e[40]=c):c=e[40],c}let J;e[41]===U?J=e[42]:(J=(0,b.jsx)(_,{defaultSize:25,minSize:15,maxSize:50,className:`overflow-hidden border-r border-border`,children:U}),e[41]=U,e[42]=J);let Y;e[43]===Symbol.for(`react.memo_cache_sentinel`)?(Y=(0,b.jsx)(h,{withHandle:!0}),e[43]=Y):Y=e[43];let X;e[44]===q?X=e[45]:(X=(0,b.jsx)(_,{className:`overflow-hidden`,children:q}),e[44]=q,e[45]=X);let Z;return e[46]!==J||e[47]!==X?(Z=(0,b.jsx)(`div`,{className:`flex h-full flex-col overflow-hidden`,children:(0,b.jsxs)(g,{direction:`horizontal`,className:`flex-1 overflow-hidden`,children:[J,Y,X]})}),e[46]=J,e[47]=X,e[48]=Z):Z=e[48],Z}function w(e){return e.selectedThreadId}export{C as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{Fi as t,Io as n,Li as r,Po as i,Qr as a,Rr as o,Rs as s,Vr as c,Vs as l,io as u,ms as d,no as f,pa as p,to as m,ya as h,zr as g,zs as _}from"./dialogs-config-BIrrNhlc.js";import{A as v,F as y,M as b,O as x,a as S,c as C,j as w,k as T,n as E,o as D,u as O}from"./history-view-DfTUOfnG.js";import{d as k}from"./onboarding-B0Jzwrxy.js";import{F as ee,H as A,I as j,N as te,P as M,R as N,w as ne}from"./index-BUA2xxQg.js";import{a as P,i as F,n as I,r as L,t as R}from"./context-menu-B5kRTqdn.js";import{l as z,n as re,o as ie,r as ae,s as oe,t as se}from"./api-DG0vQ1QZ.js";import{t as B}from"./ui-components-CTS7wHdF.js";var V=_(),H=e(l(),1),U=s(),W=H.forwardRef((e,t)=>{let n=(0,V.c)(9),i,a;n[0]===e?(i=n[1],a=n[2]):({className:i,...a}=e,n[0]=e,n[1]=i,n[2]=a);let o;n[3]===i?o=n[4]:(o=r(`flex h-full w-full flex-col overflow-hidden rounded-md bg-popover text-popover-foreground`,i),n[3]=i,n[4]=o);let s;return n[5]!==a||n[6]!==t||n[7]!==o?(s=(0,U.jsx)(B,{ref:t,className:o,...a}),n[5]=a,n[6]=t,n[7]=o,n[8]=s):s=n[8],s});W.displayName=B.displayName;var G=H.forwardRef((e,t)=>{let n=(0,V.c)(10),i,a;n[0]===e?(i=n[1],a=n[2]):({className:i,...a}=e,n[0]=e,n[1]=i,n[2]=a);let o;n[3]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,U.jsx)(p,{className:`mr-2 h-4 w-4 shrink-0 opacity-50`}),n[3]=o):o=n[3];let s;n[4]===i?s=n[5]:(s=r(`flex h-11 w-full rounded-md bg-transparent py-3 text-base outline-none placeholder:text-muted-foreground disabled:cursor-not-allowed disabled:opacity-50`,i),n[4]=i,n[5]=s);let c;return n[6]!==a||n[7]!==t||n[8]!==s?(c=(0,U.jsxs)(`div`,{className:`flex items-center border-b px-3`,"cmdk-input-wrapper":``,children:[o,(0,U.jsx)(B.Input,{ref:t,className:s,...a})]}),n[6]=a,n[7]=t,n[8]=s,n[9]=c):c=n[9],c});G.displayName=B.Input.displayName;var K=H.forwardRef((e,t)=>{let n=(0,V.c)(9),i,a;n[0]===e?(i=n[1],a=n[2]):({className:i,...a}=e,n[0]=e,n[1]=i,n[2]=a);let o;n[3]===i?o=n[4]:(o=r(`max-h-[300px] overflow-y-auto overflow-x-hidden`,i),n[3]=i,n[4]=o);let s;return n[5]!==a||n[6]!==t||n[7]!==o?(s=(0,U.jsx)(B.List,{ref:t,className:o,...a}),n[5]=a,n[6]=t,n[7]=o,n[8]=s):s=n[8],s});K.displayName=B.List.displayName;var q=H.forwardRef((e,t)=>{let n=(0,V.c)(4),i;n[0]===Symbol.for(`react.memo_cache_sentinel`)?(i=r(d.bodyMuted,`py-6 text-center`),n[0]=i):i=n[0];let a;return n[1]!==e||n[2]!==t?(a=(0,U.jsx)(B.Empty,{ref:t,className:i,...e}),n[1]=e,n[2]=t,n[3]=a):a=n[3],a});q.displayName=B.Empty.displayName;var J=H.forwardRef((e,t)=>{let n=(0,V.c)(9),i,a;n[0]===e?(i=n[1],a=n[2]):({className:i,...a}=e,n[0]=e,n[1]=i,n[2]=a);let o;n[3]===i?o=n[4]:(o=r(`overflow-hidden p-1 text-foreground [&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:py-1.5 [&_[cmdk-group-heading]]:text-xs [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group-heading]]:text-muted-foreground`,i),n[3]=i,n[4]=o);let s;return n[5]!==a||n[6]!==t||n[7]!==o?(s=(0,U.jsx)(B.Group,{ref:t,className:o,...a}),n[5]=a,n[6]=t,n[7]=o,n[8]=s):s=n[8],s});J.displayName=B.Group.displayName;var ce=H.forwardRef((e,t)=>{let n=(0,V.c)(9),i,a;n[0]===e?(i=n[1],a=n[2]):({className:i,...a}=e,n[0]=e,n[1]=i,n[2]=a);let o;n[3]===i?o=n[4]:(o=r(`-mx-1 h-px bg-border`,i),n[3]=i,n[4]=o);let s;return n[5]!==a||n[6]!==t||n[7]!==o?(s=(0,U.jsx)(B.Separator,{ref:t,className:o,...a}),n[5]=a,n[6]=t,n[7]=o,n[8]=s):s=n[8],s});ce.displayName=B.Separator.displayName;var le=H.forwardRef((e,t)=>{let n=(0,V.c)(9),i,a;n[0]===e?(i=n[1],a=n[2]):({className:i,...a}=e,n[0]=e,n[1]=i,n[2]=a);let o;n[3]===i?o=n[4]:(o=r(r(d.body,`relative flex cursor-default gap-2 select-none items-center rounded-sm px-2 py-1.5 outline-none data-[disabled=true]:pointer-events-none data-[selected='true']:bg-accent data-[selected=true]:text-accent-foreground data-[disabled=true]:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0`),i),n[3]=i,n[4]=o);let s;return n[5]!==a||n[6]!==t||n[7]!==o?(s=(0,U.jsx)(B.Item,{ref:t,className:o,...a}),n[5]=a,n[6]=t,n[7]=o,n[8]=s):s=n[8],s});le.displayName=B.Item.displayName;var Y=e=>{let t=(0,V.c)(8),n,i;t[0]===e?(n=t[1],i=t[2]):({className:n,...i}=e,t[0]=e,t[1]=n,t[2]=i);let a;t[3]===n?a=t[4]:(a=r(d.compact,`ml-auto tracking-widest text-muted-foreground`,n),t[3]=n,t[4]=a);let o;return t[5]!==i||t[6]!==a?(o=(0,U.jsx)(`span`,{className:a,...i}),t[5]=i,t[6]=a,t[7]=o):o=t[7],o};Y.displayName=`CommandShortcut`;var X=100,ue=500;function Z(e){return e.trim().toLowerCase().split(/\s+/).filter(Boolean)}function de(e,t){return t.length===0?!0:t.every(t=>e.haystack.includes(t))}function fe(e,t,n){if(t.length===0)return[];let r=[];for(let n of e)if(de(n,t)&&(r.push(n.node),r.length>=ue))break;return r.sort((e,t)=>pe(e,t,n)).slice(0,X)}function pe(e,t,n){let r=n.trim().toLowerCase(),i=e.name.toLowerCase(),a=t.name.toLowerCase(),o=r?i.startsWith(r):!1;return o===(r?a.startsWith(r):!1)?e.type===t.type?e.path.localeCompare(t.path):e.type===`folder`?-1:1:o?-1:1}function me(e){let t=(0,V.c)(38),{items:n,isReady:i,onRequestIndex:o,onOpenChange:s,onSelect:c}=e,l=i===void 0?!1:i,u=(0,H.useRef)(null),f=(0,H.useRef)(!1),p=(0,H.useRef)(!1),[h,g]=(0,H.useState)(!1),[_,v]=(0,H.useState)(``),y=(0,H.useDeferredValue)(_),b;t[0]===o?b=t[1]:(b=function(){p.current||(p.current=!0,o())},t[0]=o,t[1]=b);let x=b,S;t[2]!==y||t[3]!==n?(S=fe(n,Z(y),y),t[2]=y,t[3]=n,t[4]=S):S=t[4];let C=S,w,T;t[5]!==s||t[6]!==_?(w=()=>{let e=_.trim().length>0;g(e),f.current!==e&&(f.current=e,s(e))},T=[s,_],t[5]=s,t[6]=_,t[7]=w,t[8]=T):(w=t[7],T=t[8]),(0,H.useEffect)(w,T);let E;t[9]===s?E=t[10]:(E=function(e){e||v(``),g(e),s(e),e&&requestAnimationFrame(()=>u.current?.focus())},t[9]=s,t[10]=E);let D=E,O;t[11]!==s||t[12]!==c?(O=function(e){c(e),g(!1),s(!1),v(``)},t[11]=s,t[12]=c,t[13]=O):O=t[13];let k=O,A;t[14]===x?A=t[15]:(A=e=>{x(),v(e.target.value)},t[14]=x,t[15]=A);let j;t[16]!==_||t[17]!==x||t[18]!==A?(j=(0,U.jsx)(ee,{asChild:!0,children:(0,U.jsx)(`div`,{children:(0,U.jsx)(a,{ref:u,value:_,onPointerDown:x,onChange:A,placeholder:`Search files and folders`,className:`pr-[4px]`})})}),t[16]=_,t[17]=x,t[18]=A,t[19]=j):j=t[19];let N;t[20]===Symbol.for(`react.memo_cache_sentinel`)?(N=r(d.compact,`py-4`),t[20]=N):N=t[20];let P=l?`No matches found.`:`Indexing files and folders...`,F;t[21]===P?F=t[22]:(F=(0,U.jsx)(q,{className:N,children:P}),t[21]=P,t[22]=F);let I;if(t[23]!==k||t[24]!==C){let e;t[26]===k?e=t[27]:(e=e=>(0,U.jsxs)(le,{value:e.path,onSelect:()=>k(e),className:e.ignored?`opacity-50`:void 0,children:[e.type===`folder`?(0,U.jsx)(m,{className:`h-4 w-4 text-muted-foreground`}):(0,U.jsx)(ne,{filename:e.name}),(0,U.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,U.jsx)(`div`,{className:`truncate`,children:e.name}),(0,U.jsx)(`div`,{className:r(d.compact,`truncate text-muted-foreground`),children:e.path})]})]},e.path),t[26]=k,t[27]=e),I=C.map(e),t[23]=k,t[24]=C,t[25]=I}else I=t[25];let L;t[28]===I?L=t[29]:(L=(0,U.jsx)(J,{children:I}),t[28]=I,t[29]=L);let R;t[30]!==F||t[31]!==L?(R=(0,U.jsx)(M,{align:`start`,side:`bottom`,sideOffset:4,onOpenAutoFocus:Q,className:`w-[var(--radix-popover-trigger-width)] p-0`,children:(0,U.jsx)(W,{shouldFilter:!1,children:(0,U.jsxs)(K,{children:[F,L]})})}),t[30]=F,t[31]=L,t[32]=R):R=t[32];let z;return t[33]!==D||t[34]!==h||t[35]!==R||t[36]!==j?(z=(0,U.jsxs)(te,{open:h,onOpenChange:D,children:[j,R]}),t[33]=D,t[34]=h,t[35]=R,t[36]=j,t[37]=z):z=t[37],z}function Q(e){return e.preventDefault()}function he(e,t,n){return`explorer-dir:${e}:${t}:${n}`}function ge(e){let t=(0,V.c)(12),{threadId:n,dirPath:r,version:i,children:a}=e,o;t[0]!==r||t[1]!==n||t[2]!==i?(o=he(n,r,i),t[0]=r,t[1]=n,t[2]=i,t[3]=o):o=t[3];let s;t[4]!==r||t[5]!==n?(s=()=>ie(n,r).then(_e),t[4]=r,t[5]=n,t[6]=s):s=t[6];let c=S(o,s),l;t[7]!==a||t[8]!==c?(l=a(c),t[7]=a,t[8]=c,t[9]=l):l=t[9];let u;return t[10]===l?u=t[11]:(u=(0,U.jsx)(U.Fragment,{children:l}),t[10]=l,t[11]=u),u}function _e(e){return e.entries}function ve(e){let t=(0,V.c)(17),{defaultValue:n,onCommit:r,onCancel:i,level:a,basePadding:o,icon:s}=e,c=(0,H.useRef)(null),l,u;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(l=()=>{c.current?.focus(),c.current?.select()},u=[],t[0]=l,t[1]=u):(l=t[0],u=t[1]),(0,H.useEffect)(l,u);let d;t[2]!==i||t[3]!==r?(d=function(e){if(e.key===`Enter`){let e=c.current?.value.trim()??``;e?r(e):i()}else e.key===`Escape`&&i()},t[2]=i,t[3]=r,t[4]=d):d=t[4];let f=d,p;t[5]!==i||t[6]!==r?(p=function(){let e=c.current?.value.trim()??``;e?r(e):i()},t[5]=i,t[6]=r,t[7]=p):p=t[7];let m=p,h;t[8]!==n||t[9]!==m||t[10]!==f?(h=(0,U.jsx)(`input`,{ref:c,defaultValue:n,onKeyDown:f,onBlur:m,className:`flex-1 min-w-0 bg-transparent outline-none border border-border rounded px-1 text-base`,onClick:$}),t[8]=n,t[9]=m,t[10]=f,t[11]=h):h=t[11];let g;return t[12]!==o||t[13]!==s||t[14]!==a||t[15]!==h?(g=(0,U.jsxs)(k,{level:a,basePadding:o,children:[s,h]}),t[12]=o,t[13]=s,t[14]=a,t[15]=h,t[16]=g):g=t[16],g}function $(e){return e.stopPropagation()}function ye(e){return e.map(e=>({node:e,haystack:`${e.name} ${e.path}`.toLowerCase()}))}function be(e){let t=e.lastIndexOf(`/`);return t>=0?e.slice(0,t):``}var xe=(0,H.memo)(function e({node:t,level:r,threadId:a,selectedPath:o,expandedPaths:s,getDirVersion:c,renamingPath:l,newItemIn:d,onToggleFolder:p,onSelectNode:h,onStartRename:g,onCommitRename:_,onCancelRename:v,onDelete:y,onOpen:b,onCopyReference:x,onNewFile:S,onNewFolder:w,onCommitNewItem:T,onCancelNewItem:E}){let D=s.has(t.path),O=l===t.path,ee=d?.dirPath===t.path&&D;return t.type===`folder`?(0,U.jsxs)(R,{children:[(0,U.jsx)(P,{asChild:!0,children:(0,U.jsxs)(`div`,{children:[(0,U.jsxs)(k,{level:r,basePadding:10,selected:o===t.path,className:t.ignored?`opacity-50`:void 0,onClick:e=>{e.stopPropagation(),p(t)},children:[(0,U.jsx)(`span`,{className:`text-muted-foreground w-3 flex-shrink-0`,children:D?(0,U.jsx)(n,{className:`h-3 w-3`}):(0,U.jsx)(i,{className:`h-3 w-3`})}),O?(0,U.jsxs)(U.Fragment,{children:[D?(0,U.jsx)(f,{className:`h-4 w-4 flex-shrink-0`}):(0,U.jsx)(m,{className:`h-4 w-4 flex-shrink-0`}),(0,U.jsx)(`input`,{autoFocus:!0,defaultValue:t.name,onKeyDown:e=>{if(e.key===`Enter`){let n=e.target.value.trim();n?_(t,n):v()}else e.key===`Escape`&&v()},onBlur:e=>{let n=e.target.value.trim();n?_(t,n):v()},onClick:e=>e.stopPropagation(),className:`flex-1 min-w-0 bg-transparent outline-none border border-border rounded px-1 text-base`})]}):(0,U.jsxs)(U.Fragment,{children:[D?(0,U.jsx)(f,{className:`h-4 w-4 flex-shrink-0`}):(0,U.jsx)(m,{className:`h-4 w-4 flex-shrink-0`}),(0,U.jsx)(`span`,{className:`flex-1 truncate`,children:t.name})]})]}),D&&(0,U.jsx)(`div`,{children:(0,U.jsx)(H.Suspense,{fallback:(0,U.jsx)(C,{}),children:(0,U.jsx)(ge,{threadId:a,dirPath:t.path,version:c(t.path),children:t=>(0,U.jsxs)(U.Fragment,{children:[ee&&(0,U.jsx)(ve,{defaultValue:``,level:r+1,basePadding:d.type===`folder`?10:22,icon:d.type===`folder`?(0,U.jsx)(m,{className:`h-4 w-4 flex-shrink-0`}):(0,U.jsx)(u,{className:`h-4 w-4 flex-shrink-0 text-muted-foreground`}),onCommit:T,onCancel:E}),t.map(t=>(0,U.jsx)(e,{node:t,level:r+1,threadId:a,selectedPath:o,expandedPaths:s,getDirVersion:c,renamingPath:l,newItemIn:d,onToggleFolder:p,onSelectNode:h,onStartRename:g,onCommitRename:_,onCancelRename:v,onDelete:y,onOpen:b,onCopyReference:x,onNewFile:S,onNewFolder:w,onCommitNewItem:T,onCancelNewItem:E},t.path))]})})})})]})}),(0,U.jsxs)(I,{children:[(0,U.jsx)(L,{onSelect:()=>b(t),children:`Open`}),(0,U.jsx)(F,{}),(0,U.jsx)(L,{onSelect:()=>S(t.path),children:`New File...`}),(0,U.jsx)(L,{onSelect:()=>w(t.path),children:`New Folder...`}),(0,U.jsx)(F,{}),(0,U.jsx)(L,{onSelect:()=>x(t),children:`Copy Reference`}),(0,U.jsx)(L,{onSelect:()=>g(t),children:`Rename...`}),(0,U.jsx)(L,{onSelect:()=>y(t),className:`text-destructive focus:text-destructive`,children:`Delete`})]})]}):(0,U.jsxs)(R,{children:[(0,U.jsx)(P,{asChild:!0,children:(0,U.jsxs)(k,{level:r,basePadding:22,selected:o===t.path,className:t.ignored?`opacity-50`:void 0,onClick:()=>h(t),children:[(0,U.jsx)(ne,{filename:t.name}),O?(0,U.jsx)(`input`,{autoFocus:!0,defaultValue:t.name,onKeyDown:e=>{if(e.key===`Enter`){let n=e.target.value.trim();n?_(t,n):v()}else e.key===`Escape`&&v()},onBlur:e=>{let n=e.target.value.trim();n?_(t,n):v()},onClick:e=>e.stopPropagation(),className:`flex-1 min-w-0 bg-transparent outline-none border border-border rounded px-1 text-base`}):(0,U.jsx)(`span`,{className:`flex-1 truncate`,children:t.name})]})}),(0,U.jsxs)(I,{children:[(0,U.jsx)(L,{onSelect:()=>b(t),children:`Open`}),(0,U.jsx)(F,{}),(0,U.jsx)(L,{onSelect:()=>S(be(t.path)),children:`New File...`}),(0,U.jsx)(L,{onSelect:()=>w(be(t.path)),children:`New Folder...`}),(0,U.jsx)(F,{}),(0,U.jsx)(L,{onSelect:()=>x(t),children:`Copy Reference`}),(0,U.jsx)(L,{onSelect:()=>g(t),children:`Rename...`}),(0,U.jsx)(L,{onSelect:()=>y(t),className:`text-destructive focus:text-destructive`,children:`Delete`})]})]})}),Se=new Map;function Ce({threadId:e,selectedPath:n,onNodeSelect:r}){let[i,a]=(0,H.useState)(()=>new Map([[``,0]])),[s,l]=(0,H.useState)(new Set),[d,f]=(0,H.useState)(null),[p,_]=(0,H.useState)(null),[S,C]=(0,H.useState)(null),[k,ee]=(0,H.useState)(!1),[te,M]=(0,H.useState)([]),[ne,F]=(0,H.useState)(!1),[B,V]=(0,H.useState)(!1),W=(0,H.useRef)(null),G=(0,H.useRef)(0),K=(0,H.useRef)(null),{explorerRefreshTick:q,pendingExplorerPath:J,setExplorerClearPath:ce,triggerExplorerRefresh:le}=j(),{fetchUnifiedStatus:Y}=N(),X=(0,H.useMemo)(()=>`${e}:${q}`,[q,e]),ue=(0,H.useCallback)(e=>{(0,H.startTransition)(()=>{ee(t=>t===e?t:e)})},[]),Z=(0,H.useCallback)(async()=>{if(!e)return;let t=Se.get(X);if(t){M(t),F(!0);return}if(W.current!==X){W.current=X,M([]),F(!1);try{let t=ye((await ie(e,``,!0)).entries);Se.set(X,t),M(t),F(!0)}catch{M([]),F(!1)}finally{W.current===X&&(W.current=null)}}},[X,e]),de=(0,H.useCallback)(()=>{V(!0)},[]),fe=(0,H.useCallback)(()=>{Se.delete(X),M([]),F(!1)},[X]),pe=(0,H.useCallback)(()=>{fe(),B&&Z()},[fe,Z,B]),Q=(0,H.useCallback)(e=>i.get(e)??0,[i]),_e=(0,H.useCallback)(e=>{a(t=>{let n=new Map(t);return n.set(e,(t.get(e)??0)+1),n})},[]),$=(0,H.useCallback)(t=>{e&&(D(he(e,t,Q(t))),_e(t))},[_e,Q,e]),Ce=(0,H.useCallback)(t=>{if(!e)return;let n=t.path.split(`/`);t.type===`file`&&n.pop();let r=[],i=``;for(let e of n)i=i?`${i}/${e}`:e,r.push(i);l(e=>{let t=new Set(e);for(let e of r)t.add(e);return t})},[e]);(0,H.useEffect)(()=>{if(!e)return;let t=K.current!==null&&K.current!==e;K.current=e,t&&(a(new Map([[``,0]])),l(new Set),f(null),_(null),G.current=q)},[q,e]),(0,H.useEffect)(()=>{!e||q<=G.current||(G.current=q,a(t=>{let n=new Set([``]);for(let e of s)n.add(e);let r=new Map(t);for(let i of n){let n=t.get(i)??0;D(he(e,i,n)),r.set(i,n+1)}return r}))},[q,s,e]),(0,H.useEffect)(()=>{M([]),F(!1),V(!1),W.current=null},[X]),(0,H.useEffect)(()=>{!B||!e||Z()},[Z,B,e]),(0,H.useEffect)(()=>{if(!J||!e)return;let t=J.split(`/`);t.pop();let n=[],r=``;for(let e of t)r=r?`${r}/${e}`:e,n.push(r);if(n.length!==0){l(e=>{let t=new Set(e);for(let e of n)t.add(e);return t});for(let e of n)a(t=>{if(t.has(e))return t;let n=new Map(t);return n.set(e,0),n})}},[J,e]);function we(e){s.has(e.path)?l(t=>{let n=new Set(t);return n.delete(e.path),n}):(l(t=>new Set(t).add(e.path)),a(t=>{if(t.has(e.path))return t;let n=new Map(t);return n.set(e.path,0),n}))}function Te(e){C(e)}async function Ee(t){try{await oe(e,t.path)}catch{A({title:`Error`,description:`Failed to open "${t.name}"`,variant:`destructive`})}}async function De(e){try{await navigator.clipboard.writeText(e.path);let t=A({title:`Copied`,description:`Reference copied to clipboard.`});window.setTimeout(()=>{t.dismiss()},2e3)}catch{A({title:`Error`,description:`Failed to copy reference for "${e.name}"`,variant:`destructive`})}}async function Oe(){if(!S)return;let t=S;C(null);try{await ae(e,t.path),ce(t.path),$(be(t.path)),pe(),Y(!0),l(e=>{let n=new Set(e);for(let e of n)(e===t.path||e.startsWith(t.path+`/`))&&n.delete(e);return n}),a(e=>{let n=new Map(e);for(let e of n.keys())(e===t.path||e.startsWith(t.path+`/`))&&n.delete(e);return n})}catch{A({title:`Error`,description:`Failed to move "${t.name}" to trash`,variant:`destructive`})}}function ke(e){_(null),f(e.path)}async function Ae(t,n){if(n===t.name){f(null);return}f(null);try{await z(e,t.path,n),$(be(t.path)),pe(),Y(!0),t.type===`folder`&&(l(e=>{let n=new Set(e);for(let e of n)(e===t.path||e.startsWith(t.path+`/`))&&n.delete(e);return n}),a(e=>{let n=new Map(e);for(let e of n.keys())(e===t.path||e.startsWith(t.path+`/`))&&n.delete(e);return n}))}catch{A({title:`Error`,description:`Failed to rename "${t.name}"`,variant:`destructive`})}}function je(e){f(null),s.has(e)||(l(t=>new Set(t).add(e)),a(t=>{if(t.has(e))return t;let n=new Map(t);return n.set(e,0),n})),_({dirPath:e,type:`file`})}function Me(e){f(null),s.has(e)||(l(t=>new Set(t).add(e)),a(t=>{if(t.has(e))return t;let n=new Map(t);return n.set(e,0),n})),_({dirPath:e,type:`folder`})}async function Ne(t){if(!p)return;let{dirPath:n,type:r}=p;_(null);try{r===`file`?await se(e,n,t):await re(e,n,t),$(n),pe(),Y(!0)}catch{A({title:`Error`,description:`Failed to create ${r} "${t}"`,variant:`destructive`})}}function Pe(){_(null)}function Fe(e){Ce(e),e.type===`file`&&r(e)}let Ie=p?.dirPath===``?(0,U.jsx)(ve,{defaultValue:``,level:0,basePadding:p.type===`folder`?10:22,icon:p.type===`folder`?(0,U.jsx)(m,{className:`h-4 w-4 flex-shrink-0`}):(0,U.jsx)(u,{className:`h-4 w-4 flex-shrink-0 text-muted-foreground`}),onCommit:Ne,onCancel:Pe}):null;return(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(x,{open:S!==null,onOpenChange:e=>!e&&C(null),children:(0,U.jsxs)(w,{children:[(0,U.jsx)(y,{children:`Move to Trash`}),(0,U.jsxs)(b,{children:[`Move “`,S?.name,`” to trash?`]}),(0,U.jsxs)(`div`,{className:`flex gap-3 justify-end`,children:[(0,U.jsx)(v,{children:`Cancel`}),(0,U.jsx)(T,{onClick:()=>void Oe(),children:`Move to Trash`})]})]})}),(0,U.jsx)(`div`,{className:`border-b border-border bg-background px-2 py-2`,children:(0,U.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,U.jsx)(`div`,{className:`min-w-0 flex-1`,children:(0,U.jsx)(me,{items:te,isReady:ne,onRequestIndex:de,onOpenChange:ue,onSelect:e=>Fe(e)},X)}),(0,U.jsxs)(o,{children:[(0,U.jsx)(c,{asChild:!0,children:(0,U.jsx)(t,{variant:`ghost`,size:`icon-sm`,onClick:le,"aria-label":`Refresh file listing`,children:(0,U.jsx)(h,{className:`h-4 w-4`})})}),(0,U.jsx)(g,{children:`Refresh`})]})]})}),(0,U.jsxs)(R,{children:[(0,U.jsx)(P,{asChild:!0,disabled:k,children:(0,U.jsx)(`div`,{className:`py-2 min-h-full`,children:(0,U.jsx)(E,{fallbackTitle:`Failed to load files`,onRetry:()=>$(``),children:(0,U.jsx)(H.Suspense,{fallback:(0,U.jsx)(O,{}),children:(0,U.jsx)(ge,{threadId:e,dirPath:``,version:Q(``),children:t=>(0,U.jsxs)(U.Fragment,{children:[Ie,t.map(t=>(0,U.jsx)(xe,{node:t,level:0,threadId:e,selectedPath:n,expandedPaths:s,getDirVersion:Q,renamingPath:d,newItemIn:p,onToggleFolder:we,onSelectNode:r,onStartRename:ke,onCommitRename:Ae,onCancelRename:()=>f(null),onDelete:Te,onOpen:Ee,onCopyReference:De,onNewFile:je,onNewFolder:Me,onCommitNewItem:Ne,onCancelNewItem:Pe},t.path))]})})})})})}),(0,U.jsxs)(I,{children:[(0,U.jsx)(L,{onSelect:()=>je(``),children:`New File...`}),(0,U.jsx)(L,{onSelect:()=>Me(``),children:`New Folder...`})]})]})]})}export{Ce as default};
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{Aa as t,Ca as n,Eo as r,Fi as i,Jo as a,Li as o,Lo as s,Q as c,Rs as l,Va as u,Vs as d,as as f,ho as p,ir as ee,is as te,ms as m,oo as h,so as g,xa as ne,zs as _}from"./dialogs-config-BIrrNhlc.js";import{b as re}from"./react-vendor-B19oy2bp.js";import{I as v,a as y,l as b,n as x,o as S}from"./history-view-DfTUOfnG.js";import{n as ie}from"./utils-CFYgrqBu.js";import{B as ae,D as oe,H as C,I as se,K as w,M as T,O as E,d as ce,k as le}from"./index-BUA2xxQg.js";import{a as D,c as ue,i as O,o as k,s as de,t as fe,u as pe}from"./api-DG0vQ1QZ.js";var A=_(),j=l(),M=e(d(),1),me=v(e=>(0,j.jsxs)(`div`,{className:`flex flex-col items-center justify-center h-full gap-3 text-center`,children:[e.v0,(0,j.jsx)(`p`,{className:e.v1,children:`Select a thread to browse its files`})]}),{name:`ExplorerView_1`,portals:[`v0`]}),N=v(e=>(0,j.jsxs)(`div`,{className:`explorer-view-root flex flex-col h-full print:block print:h-auto`,children:[e.v0,(0,j.jsx)(`div`,{className:`flex-1 overflow-hidden print:overflow-visible print:flex-none`,children:(0,j.jsx)(`div`,{className:`h-full relative overflow-hidden print:h-auto print:overflow-visible`,children:e.v1})}),e.v2]}),{name:`ExplorerView_2`,portals:[`v0`,`v1`,`v2`]}),P=function({selectedFile:e,showTreeBackButton:a=!1,onShowTree:l,onFileCreated:d}){let{resolvedTheme:f}=ie(),p=w(e=>e.selectedThreadId),{triggerExplorerRefresh:h}=se(),_=(0,M.useRef)(null),v=(0,M.useRef)(null),y=(0,M.useRef)(!1),[D,O]=(0,M.useState)(null),[k,A]=(0,M.useState)(!1),[P,F]=(0,M.useState)(!1),[U,W]=(0,M.useState)(`edit`),[ve,ye]=(0,M.useState)(0),[G,be]=(0,M.useState)(null),[K,q]=(0,M.useState)(!1),xe=e?.path??null;(0,M.useEffect)(()=>{p&&c(p).then(be).catch(()=>{})},[p]);let Se=async()=>{if(!(!G||K)){q(!0);try{await navigator.clipboard.writeText(G),C({title:`Copied`,description:`Repository folder path copied to clipboard.`})}catch(e){V(`Failed to copy explorer folder path`,{threadId:p,folderPath:G},e),C({title:`Error`,description:`Failed to copy path to clipboard.`,variant:`destructive`})}finally{q(!1)}}},Ce=async()=>{if(p)try{await de(p,`.`)}catch(e){V(`Failed to open explorer repository folder`,{threadId:p,folderPath:G},e),C({title:`Error`,description:`Failed to open repository folder.`,variant:`destructive`})}},we=(0,M.useCallback)(async e=>{if(p)try{let t=await L(p,e);await fe(p,``,t);let n={name:t,path:t,type:`file`};v.current=t,y.current=!0,d?.(n),h(),C({title:`Created`,description:`${t} created successfully.`})}catch(t){V(`Failed to create explorer file`,{threadId:p,extension:e},t),C({title:`Error`,description:`Failed to create file.`,variant:`destructive`})}},[p,d,h]),J=e?te(e.path,e.name):null,Y=e?.type===`file`&&p&&!J?e:null,X=Y?`${p}:${Y.path}:${ve}`:null,Z=D&&D.key===X?D:null,Q=Z?.content??``,Te=Z?.original??``;(0,M.useEffect)(()=>()=>{_.current&&=(_.current.getModel()?.dispose(),_.current.dispose(),null)},[]),(0,M.useEffect)(()=>{e?.type===`file`?v.current===e.path?(v.current=null,W(`edit`)):W(R(e.path)?`view`:`edit`):W(`edit`)},[xe,p]);async function $(){if(!(!p||!e||!X)){A(!0);try{await pe(p,e.path,Q),O({key:X,content:Q,original:Q}),C({title:`Saved`,description:`${e.name} saved successfully.`})}catch(t){V(`Failed to save explorer file`,{threadId:p,path:e.path},t),C({title:`Error`,description:t instanceof Error?t.message:`Failed to save file`,variant:`destructive`})}finally{A(!1)}}}async function Ee(){if(!(!p||!e||P)){F(!0);try{if(!ee()){if(typeof window>`u`)return;let t=document.querySelector(`[data-markdown-print-content]`);if(!(t instanceof HTMLElement)){C({title:`Print unavailable`,description:`Couldn't find the markdown preview to print.`,variant:`destructive`});return}let n=`<!doctype html>
|
|
2
|
+
<html>
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="utf-8" />
|
|
5
|
+
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
|
6
|
+
<title>${e.name??`Markdown document`}</title>
|
|
7
|
+
<style>
|
|
8
|
+
:root {
|
|
9
|
+
color-scheme: light;
|
|
10
|
+
font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
|
|
11
|
+
line-height: 1.5;
|
|
12
|
+
}
|
|
13
|
+
* {
|
|
14
|
+
box-sizing: border-box;
|
|
15
|
+
}
|
|
16
|
+
body {
|
|
17
|
+
margin: 0;
|
|
18
|
+
background: white;
|
|
19
|
+
color: black;
|
|
20
|
+
}
|
|
21
|
+
.markdown-print-shell {
|
|
22
|
+
max-width: 900px;
|
|
23
|
+
margin: 0 auto;
|
|
24
|
+
padding: 32px;
|
|
25
|
+
}
|
|
26
|
+
img, video, svg {
|
|
27
|
+
max-width: 100%;
|
|
28
|
+
height: auto;
|
|
29
|
+
}
|
|
30
|
+
pre {
|
|
31
|
+
white-space: pre-wrap;
|
|
32
|
+
overflow-wrap: anywhere;
|
|
33
|
+
border: 1px solid #d4d4d8;
|
|
34
|
+
border-radius: 8px;
|
|
35
|
+
padding: 12px;
|
|
36
|
+
background: #f4f4f5;
|
|
37
|
+
}
|
|
38
|
+
code {
|
|
39
|
+
white-space: pre-wrap;
|
|
40
|
+
overflow-wrap: anywhere;
|
|
41
|
+
}
|
|
42
|
+
table {
|
|
43
|
+
width: 100%;
|
|
44
|
+
border-collapse: collapse;
|
|
45
|
+
}
|
|
46
|
+
th, td {
|
|
47
|
+
border: 1px solid #d4d4d8;
|
|
48
|
+
padding: 8px;
|
|
49
|
+
text-align: left;
|
|
50
|
+
}
|
|
51
|
+
@page {
|
|
52
|
+
margin: 0.75in;
|
|
53
|
+
}
|
|
54
|
+
@media print {
|
|
55
|
+
body {
|
|
56
|
+
-webkit-print-color-adjust: exact;
|
|
57
|
+
print-color-adjust: exact;
|
|
58
|
+
}
|
|
59
|
+
.markdown-print-shell {
|
|
60
|
+
max-width: none;
|
|
61
|
+
padding: 0;
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
</style>
|
|
65
|
+
</head>
|
|
66
|
+
<body>
|
|
67
|
+
<main class="markdown-print-shell">${t.innerHTML}</main>
|
|
68
|
+
<script>
|
|
69
|
+
window.addEventListener("load", () => {
|
|
70
|
+
window.focus();
|
|
71
|
+
window.print();
|
|
72
|
+
}, { once: true });
|
|
73
|
+
<\/script>
|
|
74
|
+
</body>
|
|
75
|
+
</html>`,r=window.open(``,`_blank`,`noopener,noreferrer`);if(!r){C({title:`Print blocked`,description:`Allow pop-ups to print this file.`,variant:`destructive`});return}r.document.open(),r.document.write(n),r.document.close();return}C({title:`PDF created`,description:`Opened ${(await ue(p,e.path)).outputPath.split(/[\\/]/).pop()??`the PDF`} in your default app.`})}catch(t){V(`Failed to print markdown file as PDF`,{threadId:p,path:e.path},t),C({title:`PDF export failed`,description:t instanceof Error?t.message:`Failed to convert this markdown file to PDF.`,variant:`destructive`})}finally{F(!1)}}}function De(){!p||!Y||(S(B(p,Y.path)),ye(e=>e+1))}return p?(0,j.jsx)(N,{v0:(0,j.jsxs)(ce,{className:`justify-between print:hidden`,children:[(0,j.jsxs)(`div`,{className:`flex min-w-0 items-start gap-2`,children:[a&&l?(0,j.jsxs)(i,{variant:`ghost`,size:`icon`,className:`h-8 w-8 shrink-0 text-muted-foreground electrobun-webkit-app-region-no-drag`,onClick:l,children:[(0,j.jsx)(t,{className:`h-4 w-4`}),(0,j.jsx)(`span`,{className:`sr-only`,children:`Show file tree`})]}):null,(0,j.jsxs)(`div`,{className:`flex min-w-0 flex-col`,children:[(0,j.jsx)(`span`,{className:o(m.label,`truncate text-foreground`),children:e?e.name:`Select a file to edit`}),(0,j.jsx)(`span`,{className:o(m.compact,`truncate text-muted-foreground`),children:e?e.path:`Browse and edit repository files`})]})]}),(0,j.jsxs)(`div`,{className:`flex gap-2`,children:[Y&&Z?(0,j.jsxs)(j.Fragment,{children:[R(Y.path)?(0,j.jsxs)(`div`,{className:`flex rounded-full border border-input bg-background p-0.5`,children:[(0,j.jsx)(i,{size:`sm`,variant:U===`view`?`secondary`:`ghost`,className:`h-7 px-3`,onClick:()=>W(`view`),children:`View`}),(0,j.jsx)(i,{size:`sm`,variant:U===`edit`?`secondary`:`ghost`,className:`h-7 px-3`,onClick:()=>W(`edit`),children:`Edit`})]}):null,R(Y.path)&&U===`view`?(0,j.jsxs)(i,{size:`sm`,variant:`outline`,onClick:()=>void Ee(),disabled:P,children:[P?(0,j.jsx)(u,{className:`h-4 w-4 animate-spin`}):(0,j.jsx)(ne,{className:`h-4 w-4`}),P?`Printing…`:`Print`]}):null,(0,j.jsxs)(i,{size:`sm`,onClick:()=>void $(),disabled:k||!Q||Q===Te,children:[k?(0,j.jsx)(u,{className:`h-4 w-4 animate-spin`}):null,`Save`]})]}):null,e?null:(0,j.jsxs)(oe,{children:[(0,j.jsx)(T,{asChild:!0,children:(0,j.jsxs)(i,{size:`sm`,className:`gap-1.5`,children:[(0,j.jsx)(n,{className:`h-3.5 w-3.5`}),`New file`]})}),(0,j.jsx)(E,{align:`end`,children:I.map(({label:e,ext:t,icon:n})=>(0,j.jsxs)(le,{onSelect:()=>void we(t),children:[(0,j.jsx)(n,{className:`h-4 w-4`}),e]},t))})]})]})]}),v1:Y?(0,j.jsxs)(x,{fallbackTitle:`Failed to load file`,onRetry:De,children:[(0,j.jsx)(M.Suspense,{fallback:(0,j.jsx)(b,{}),children:(0,j.jsx)(he,{threadId:p,path:Y.path,contentKey:X??``,onContentReady:O},X??void 0)}),Z?R(Y.path)&&U===`view`?(0,j.jsx)(`div`,{className:`h-full overflow-auto p-6 print:h-auto print:overflow-visible print:p-0`,children:(0,j.jsx)(`div`,{className:`mx-auto max-w-4xl print:max-w-none`,"data-markdown-print-content":!0,children:(0,j.jsx)(ae,{content:Q,enableMermaid:!0})})}):(0,j.jsx)(re,{height:`100%`,language:z(Y.path),value:Q,onChange:e=>O(t=>t&&{...t,content:e??``}),onMount:e=>{_.current=e,y.current&&(y.current=!1,e.focus())},theme:f===`dark`?`vs-dark`:`vs-light`,options:{minimap:{enabled:!1},scrollBeyondLastLine:!1,wordWrap:`on`,automaticLayout:!0,fontSize:13,lineNumbers:`on`,renderLineHighlight:`line`,scrollbar:{vertical:`auto`,horizontal:`auto`}}}):(0,j.jsx)(b,{})]},X??void 0):e?.type===`file`&&J===`image`?(0,j.jsx)(x,{fallbackTitle:`Failed to load image`,onRetry:()=>{!p||!e||S(H(p,e.path))},children:(0,j.jsx)(M.Suspense,{fallback:(0,j.jsx)(b,{}),children:(0,j.jsx)(ge,{threadId:p,path:e.path,alt:e.name})})},e.path):e?.type===`file`&&J===`video`?(0,j.jsx)(x,{fallbackTitle:`Failed to load video`,onRetry:()=>{!p||!e||S(H(p,e.path))},children:(0,j.jsx)(M.Suspense,{fallback:(0,j.jsx)(b,{}),children:(0,j.jsx)(_e,{threadId:p,path:e.path})})},e.path):(0,j.jsxs)(`div`,{className:`flex flex-col items-center justify-center h-full gap-3 text-center p-8`,children:[(0,j.jsx)(`h2`,{className:o(m.pageTitle,`text-foreground`),children:`File Explorer`}),(0,j.jsx)(`p`,{className:o(m.pageSubtitle),children:`Browse and edit files`})]}),v2:e?null:(0,j.jsx)(`div`,{className:`flex shrink-0 items-center gap-2 px-4 py-2`,children:G?(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(`button`,{type:`button`,onClick:()=>void Ce(),className:o(m.compact,`min-w-0 flex-1 truncate text-left font-mono text-muted-foreground hover:text-foreground hover:underline`),title:G,children:G}),(0,j.jsxs)(i,{variant:`ghost`,size:`icon`,className:`h-7 w-7 shrink-0`,onClick:()=>void Se(),disabled:K,children:[K?(0,j.jsx)(s,{className:`h-3.5 w-3.5`}):(0,j.jsx)(r,{className:`h-3.5 w-3.5`}),(0,j.jsx)(`span`,{className:`sr-only`,children:`Copy path`})]})]}):(0,j.jsx)(`p`,{className:o(m.compact,`text-muted-foreground/50 italic`),children:`Loading path...`})})}):(0,j.jsx)(me,{v0:(0,j.jsx)(g,{className:`h-8 w-8 text-muted-foreground`}),v1:m.bodyMuted})},F=a(`explorer.preview`),I=[{label:`Markdown`,ext:`md`,icon:g},{label:`TypeScript`,ext:`ts`,icon:p},{label:`Text`,ext:`txt`,icon:h}];async function L(e,t){try{let n=await k(e,``),r=new Set(n.entries.map(e=>e.name)),i=`untitled`,a=`${i}.${t}`,o=2;for(;r.has(a);)a=`${i}${o}.${t}`,o++;return a}catch{return`untitled.${t}`}}function R(e){return f(e)===`md`}function z(e){return{ts:`typescript`,tsx:`typescript`,js:`javascript`,jsx:`javascript`,json:`json`,md:`markdown`,mdc:`markdown`,css:`css`,scss:`scss`,html:`html`,py:`python`,sh:`shell`,yaml:`yaml`,yml:`yaml`,xml:`xml`,sql:`sql`}[f(e)]??`plaintext`}function B(e,t){return`explorer-file:${e}:${t}`}function he(e){let t=(0,A.c)(11),{threadId:n,path:r,contentKey:i,onContentReady:a}=e,o;t[0]!==r||t[1]!==n?(o=B(n,r),t[0]=r,t[1]=n,t[2]=o):o=t[2];let s;t[3]!==r||t[4]!==n?(s=async()=>{try{return await D(n,r)}catch(e){let t=e;throw V(`Failed to load explorer file preview`,{threadId:n,path:r},t),t}},t[3]=r,t[4]=n,t[5]=s):s=t[5];let c=y(o,s),l,u;return t[6]!==i||t[7]!==a||t[8]!==c.content?(l=()=>{a({key:i,content:c.content,original:c.content})},u=[a,c.content,i],t[6]=i,t[7]=a,t[8]=c.content,t[9]=l,t[10]=u):(l=t[9],u=t[10]),(0,M.useLayoutEffect)(l,u),null}function V(e,t,n){F.error(e,{...t,error:n})}function H(e,t){return`explorer-media:${e}:${t}`}function U(e,t){let n=(0,A.c)(11),r;n[0]!==t||n[1]!==e?(r=H(e,t),n[0]=t,n[1]=e,n[2]=r):r=n[2];let i;n[3]!==t||n[4]!==e?(i=async()=>{try{return await O(e,t)}catch(n){let r=n;throw V(`Failed to load explorer media preview`,{threadId:e,path:t},r),r}},n[3]=t,n[4]=e,n[5]=i):i=n[5];let a=y(r,i),o;n[6]===a?o=n[7]:(o=URL.createObjectURL(a),n[6]=a,n[7]=o);let s=o,c,l;return n[8]===s?(c=n[9],l=n[10]):(c=()=>()=>{URL.revokeObjectURL(s)},l=[s],n[8]=s,n[9]=c,n[10]=l),(0,M.useEffect)(c,l),s}function ge(e){let t=(0,A.c)(3),{threadId:n,path:r,alt:i}=e,a=U(n,r),o;return t[0]!==i||t[1]!==a?(o=(0,j.jsx)(`div`,{className:`flex items-center justify-center h-full p-4 overflow-auto`,children:(0,j.jsx)(`img`,{src:a,alt:i,className:`max-w-full max-h-full object-contain`})}),t[0]=i,t[1]=a,t[2]=o):o=t[2],o}function _e(e){let t=(0,A.c)(2),{threadId:n,path:r}=e,i=U(n,r),a;return t[0]===i?a=t[1]:(a=(0,j.jsx)(`div`,{className:`flex items-center justify-center h-full p-4`,children:(0,j.jsx)(`video`,{src:i,controls:!0,className:`max-w-full max-h-full`})}),t[0]=i,t[1]=a),a}export{P as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{$r as e,Fi as t,Li as n,Rs as r,Va as i,ai as a,ii as o,ms as s,ni as c,ri as l,ti as u,zs as d}from"./dialogs-config-BIrrNhlc.js";var f=d(),p=r();function m(r){let d=(0,f.c)(28),{open:m,onOpenChange:g,commits:_,displayedCommits:v,isLoadingMore:y,onScroll:b,currentBranch:x}=r,S;d[0]===Symbol.for(`react.memo_cache_sentinel`)?(S=(0,p.jsx)(a,{children:`Commit History`}),d[0]=S):S=d[0];let C;d[1]===x?C=d[2]:(C=(0,p.jsxs)(o,{children:[S,(0,p.jsxs)(c,{children:[`Recent commits on branch `,x]})]}),d[1]=x,d[2]=C);let w;d[3]===v?w=d[4]:(w=v.length>0?v.map(h):(0,p.jsx)(`p`,{className:n(s.bodyMuted,`text-center py-8`),children:`No commits found`}),d[3]=v,d[4]=w);let T;d[5]===y?T=d[6]:(T=y&&(0,p.jsx)(`div`,{className:`p-3 text-center`,children:(0,p.jsx)(i,{className:`h-4 w-4 animate-spin inline`})}),d[5]=y,d[6]=T);let E;d[7]!==_.length||d[8]!==v.length||d[9]!==y?(E=v.length<_.length&&!y&&(0,p.jsx)(`div`,{className:n(s.caption,`p-3 text-center`),children:`Scroll to load more`}),d[7]=_.length,d[8]=v.length,d[9]=y,d[10]=E):E=d[10];let D;d[11]!==w||d[12]!==T||d[13]!==E?(D=(0,p.jsxs)(`div`,{className:`divide-y`,children:[w,T,E]}),d[11]=w,d[12]=T,d[13]=E,d[14]=D):D=d[14];let O;d[15]!==b||d[16]!==D?(O=(0,p.jsx)(`div`,{className:`flex-1 overflow-y-auto border rounded-lg`,onScroll:b,children:D}),d[15]=b,d[16]=D,d[17]=O):O=d[17];let k;d[18]===g?k=d[19]:(k=(0,p.jsx)(l,{children:(0,p.jsx)(t,{onClick:()=>g(!1),children:`Close`})}),d[18]=g,d[19]=k);let A;d[20]!==C||d[21]!==O||d[22]!==k?(A=(0,p.jsxs)(u,{className:`max-w-2xl max-h-[80vh] flex flex-col`,children:[C,O,k]}),d[20]=C,d[21]=O,d[22]=k,d[23]=A):A=d[23];let j;return d[24]!==g||d[25]!==m||d[26]!==A?(j=(0,p.jsx)(e,{open:m,onOpenChange:g,children:A}),d[24]=g,d[25]=m,d[26]=A,d[27]=j):j=d[27],j}function h(e){return(0,p.jsxs)(`div`,{className:`p-3 hover:bg-muted/50 transition-colors`,children:[(0,p.jsx)(`p`,{className:n(s.label,`break-words`),children:e.message}),(0,p.jsxs)(`p`,{className:n(s.bodyMuted,`mt-1`),children:[(0,p.jsx)(`span`,{className:s.mono,children:e.hash.substring(0,7)}),` •`,` `,e.author,` • `,new Date(e.date).toLocaleDateString()]})]},e.hash)}export{m as GitHistoryDialog};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/commit-dialog-DpwAQ4Z6.js","assets/index-BUA2xxQg.js","assets/rolldown-runtime-aKtaBQYM.js","assets/monaco-y4UqQVp0.js","assets/monaco-Br_kD0ds.css","assets/history-view-DfTUOfnG.js","assets/dialogs-config-BIrrNhlc.js","assets/onboarding-B0Jzwrxy.js","assets/vosk-speech-BZoPqFPM.js","assets/react-vendor-B19oy2bp.js","assets/utils-CFYgrqBu.js","assets/index-BgPn08Yc.css","assets/pull-request-dialog-X0kSTYFA.js","assets/create-repo-dialog-BoCupv2m.js","assets/git-history-dialog-BN7wBt9F.js","assets/push-before-pr-dialog-CQEDHNrv.js","assets/pull-with-changes-dialog-CSHYq7Pw.js"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{As as t,Br as n,Dn as r,Et as i,Fi as a,Gn as o,Hn as s,Ho as c,In as l,Io as u,Jo as d,Ki as f,Li as p,Nn as m,On as h,Ot as g,Qa as _,Rn as v,Rr as y,Rs as b,So as x,Va as ee,Vn as te,Vr as ne,Vs as S,Wo as C,Za as re,Zi as w,dn as T,jn as E,kn as D,ms as ie,pt as ae,qa as oe,tt as se,xo as ce,ya as le,zn as O,zr as ue,zs as de}from"./dialogs-config-BIrrNhlc.js";import{r as k}from"./monaco-y4UqQVp0.js";import{A as fe,D as pe,G as me,H as A,J as j,K as he,M as ge,O as _e,R as ve,j as ye,k as M,v as be,y as xe}from"./index-BUA2xxQg.js";var Se=de(),N=e(S(),1),P=b();function F(e){return!e.hasChanges&&e.defaultBranchBehind>0}function I(e){return e.prExists&&e.prState===`OPEN`&&!e.hasChanges&&!e.hasUnpushedCommits}function L(e){return e.hasUnpushedCommits&&e.prExists}function Ce(e,t){return t?`Creating PR...`:e.hasChanges?`Commit`:L(e)?`Update PR`:I(e)?`Open PR`:e.commitsAheadOfDefault&&!e.prExists&&!e.hasChanges?`Create PR`:F(e)?`Sync`:`Commit`}function we(e,t,n=!1){return t||n||e.hasChanges||L(e)||I(e)||e.commitsAheadOfDefault&&!e.prExists&&!e.hasChanges||!e.hasChanges&&!e.hasUnpushedCommits&&!F(e)?null:F(e)?(0,P.jsx)(C,{className:`h-3.5 w-3.5`}):(0,P.jsx)(_,{className:`h-3.5 w-3.5`})}function Te(e){if(e.hasChanges)return e.changedFilesCount>0?`Commit ${e.changedFilesCount} changed file${e.changedFilesCount===1?``:`s`}`:`No changes to commit`;if(L(e))return`Update pull request with unpushed commits`;if(I(e))return`View pull request in GitHub`;if(e.commitsAheadOfDefault&&!e.prExists&&!e.hasChanges)return`Create pull request for committed changes`;if(F(e)){let t=e.defaultBranch??`main`,n=`${e.defaultBranchBehind} commit${e.defaultBranchBehind===1?``:`s`} behind origin/${t}`,r=e.defaultBranchAhead>0?`, ${e.defaultBranchAhead} commit${e.defaultBranchAhead===1?``:`s`} ahead`:``;return e.currentBranch===e.defaultBranch?`Your branch is ${n}${r}. Click to pull the latest changes.`:`Your branch "${e.currentBranch}" is ${n}${r}. Click to rebase onto the latest ${t}.`}return`No actions available`}function Ee(e,t,n=!1){return t||n?!0:I(e)||e.commitsAheadOfDefault&&!e.prExists&&!e.hasChanges||F(e)?!1:!e.hasChanges&&!e.hasUnpushedCommits}function De(e){return e.hasChanges||I(e)||L(e)||F(e)||e.commitsAheadOfDefault&&!e.prExists&&!e.hasChanges}function Oe(e){let t=(0,Se.c)(108),{branchStatus:r,remoteUrl:i,hasRemoteBranch:o,hasUnpushedCommits:s,canCreateRepo:l,repoUrl:d,isRefreshing:m,isCreatingPR:h,isBrandState:g,hasChanges:v,commitsAheadOfDefault:b,prExists:te,defaultBranch:S,defaultBranchAhead:T,defaultBranchBehind:E,gitUser:D,isDirectCommitMode:ae,autoGenerateCommitMessage:se,isLoading:O,isLoadingHistory:de,isQuickCommitting:k,onFetch:me,onPull:A,onPush:j,onOpenHistory:he,onCreatePR:ve,onCreateRepo:be,onViewInGitHub:xe,onQuickCommit:N,onSyncWithDefault:F,onOpenChange:I,open:L,layout:Ce}=e,we=h===void 0?!1:h,Te=Ce===void 0?`bar`:Ce,Ee=!!S&&!!i&&E>0,De=!v&&!O,Oe=Te===`bar`&&`w-8 rounded-l-none`,ke=Te===`menu`&&`w-full justify-start gap-2 rounded-md`,R=g&&Te===`bar`&&` border-transparent bg-brand text-brand-foreground hover:bg-brand/90 hover:text-brand-foreground`,z;t[0]!==Oe||t[1]!==ke||t[2]!==R?(z=p(`h-8 px-1`,Oe,ke,R),t[0]=Oe,t[1]=ke,t[2]=R,t[3]=z):z=t[3];let B=O||we,V;t[4]===Te?V=t[5]:(V=Te===`menu`&&(0,P.jsx)(`span`,{children:`More git actions`}),t[4]=Te,t[5]=V);let H;t[6]!==we||t[7]!==m?(H=we||m?(0,P.jsx)(ee,{className:`h-3.5 w-3.5 animate-spin`}):(0,P.jsx)(u,{className:`h-3.5 w-3.5`}),t[6]=we,t[7]=m,t[8]=H):H=t[8];let U;t[9]!==z||t[10]!==B||t[11]!==V||t[12]!==H?(U=(0,P.jsx)(ge,{asChild:!0,children:(0,P.jsxs)(a,{variant:`outline`,size:`sm`,className:z,disabled:B,children:[V,H]})}),t[9]=z,t[10]=B,t[11]=V,t[12]=H,t[13]=U):U=t[13];let W;t[14]!==r||t[15]!==i?(W=r===`Behind`&&(0,P.jsxs)(`div`,{className:p(ie.compact,`px-2 py-1 text-amber-600`),children:[`Branch is behind `,i?`origin`:`remote`]}),t[14]=r,t[15]=i,t[16]=W):W=t[16];let G;t[17]===D?G=t[18]:(G=D&&(0,P.jsxs)(`div`,{className:p(ie.compact,`px-2 py-1 text-muted-foreground`),children:[(0,P.jsx)(`span`,{className:`font-medium`,children:`User:`}),` `,D]}),t[17]=D,t[18]=G);let K;t[19]===Symbol.for(`react.memo_cache_sentinel`)?(K=(0,P.jsx)(fe,{}),t[19]=K):K=t[19];let Ae;t[20]!==De||t[21]!==S||t[22]!==T||t[23]!==E||t[24]!==v||t[25]!==F||t[26]!==Ee?(Ae=Ee&&(0,P.jsx)(n,{children:(0,P.jsxs)(y,{children:[(0,P.jsx)(ne,{asChild:!0,children:(0,P.jsxs)(M,{onClick:()=>{De&&F()},className:De?``:`opacity-50 cursor-not-allowed`,children:[(0,P.jsx)(le,{className:`h-3.5 w-3.5 mr-2`}),`Sync with `,S,(0,P.jsxs)(`span`,{className:`ml-auto flex items-center gap-2 pl-3 text-xs tabular-nums text-muted-foreground`,children:[T>0&&(0,P.jsxs)(`span`,{className:`inline-flex items-center gap-0.5`,children:[(0,P.jsx)(c,{className:`h-3 w-3`}),T]}),E>0&&(0,P.jsxs)(`span`,{className:`inline-flex items-center gap-0.5`,children:[(0,P.jsx)(C,{className:`h-3 w-3`}),E]})]})]})}),(0,P.jsx)(ue,{side:`right`,children:v?`Commit or stash changes before syncing with the default branch`:`Pull latest changes from origin/${S} onto your current branch`})]})}),t[20]=De,t[21]=S,t[22]=T,t[23]=E,t[24]=v,t[25]=F,t[26]=Ee,t[27]=Ae):Ae=t[27];let q;t[28]!==se||t[29]!==v||t[30]!==O||t[31]!==k||t[32]!==N?(q=v&&se&&(0,P.jsx)(n,{children:(0,P.jsxs)(y,{children:[(0,P.jsx)(ne,{asChild:!0,children:(0,P.jsxs)(M,{onClick:N,disabled:O||k,children:[k?(0,P.jsx)(ee,{className:`h-3.5 w-3.5 mr-2 animate-spin`}):(0,P.jsx)(f,{className:`h-3.5 w-3.5 mr-2`}),`Quick Commit`,(0,P.jsx)(ye,{children:`⌘⇧C`})]})}),(0,P.jsx)(ue,{side:`right`,children:`Generate the commit message and commit`})]})}),t[28]=se,t[29]=v,t[30]=O,t[31]=k,t[32]=N,t[33]=q):q=t[33];let J;t[34]===Symbol.for(`react.memo_cache_sentinel`)?(J=(0,P.jsx)(x,{className:`h-3.5 w-3.5 mr-2`}),t[34]=J):J=t[34];let Y;t[35]!==O||t[36]!==me?(Y=(0,P.jsx)(ne,{asChild:!0,children:(0,P.jsxs)(M,{onClick:me,disabled:O,children:[J,`Fetch`]})}),t[35]=O,t[36]=me,t[37]=Y):Y=t[37];let X;t[38]===Symbol.for(`react.memo_cache_sentinel`)?(X=(0,P.jsx)(ue,{side:`right`,children:`Download latest information from remote without merging changes`}),t[38]=X):X=t[38];let Z;t[39]===Y?Z=t[40]:(Z=(0,P.jsx)(n,{children:(0,P.jsxs)(y,{children:[Y,X]})}),t[39]=Y,t[40]=Z);let Q;t[41]!==o||t[42]!==O||t[43]!==A?(Q=()=>{o&&!O&&A()},t[41]=o,t[42]=O,t[43]=A,t[44]=Q):Q=t[44];let je=!o||O?`opacity-50 cursor-not-allowed`:``,Me;t[45]===Symbol.for(`react.memo_cache_sentinel`)?(Me=(0,P.jsx)(C,{className:`h-3.5 w-3.5 mr-2`}),t[45]=Me):Me=t[45];let Ne;t[46]!==Q||t[47]!==je?(Ne=(0,P.jsx)(ne,{asChild:!0,children:(0,P.jsxs)(M,{onClick:Q,className:je,children:[Me,`Pull`]})}),t[46]=Q,t[47]=je,t[48]=Ne):Ne=t[48];let Pe=o?`Pull latest changes from remote`:`No remote branch to pull from`,$;t[49]===Pe?$=t[50]:($=(0,P.jsx)(ue,{side:`right`,children:Pe}),t[49]=Pe,t[50]=$);let Fe;t[51]!==Ne||t[52]!==$?(Fe=(0,P.jsx)(n,{children:(0,P.jsxs)(y,{children:[Ne,$]})}),t[51]=Ne,t[52]=$,t[53]=Fe):Fe=t[53];let Ie;t[54]!==o||t[55]!==O||t[56]!==j?(Ie=!o&&(0,P.jsx)(n,{children:(0,P.jsxs)(y,{children:[(0,P.jsx)(ne,{asChild:!0,children:(0,P.jsxs)(M,{onClick:j,disabled:O,children:[(0,P.jsx)(w,{className:`h-3.5 w-3.5 mr-2`}),`Push Branch to Remote`]})}),(0,P.jsx)(ue,{side:`right`,children:`Create remote branch and push local commits`})]})}),t[54]=o,t[55]=O,t[56]=j,t[57]=Ie):Ie=t[57];let Le;t[58]!==s||t[59]!==O||t[60]!==j?(Le=()=>{s&&!O&&j()},t[58]=s,t[59]=O,t[60]=j,t[61]=Le):Le=t[61];let Re=!s||O?`opacity-50 cursor-not-allowed`:``,ze;t[62]===Symbol.for(`react.memo_cache_sentinel`)?(ze=(0,P.jsx)(w,{className:`h-3.5 w-3.5 mr-2`}),t[62]=ze):ze=t[62];let Be;t[63]!==Le||t[64]!==Re?(Be=(0,P.jsx)(ne,{asChild:!0,children:(0,P.jsxs)(M,{onClick:Le,className:Re,children:[ze,`Push Commits`]})}),t[63]=Le,t[64]=Re,t[65]=Be):Be=t[65];let Ve=s?O?`Push in progress...`:`Push your uncommitted commits to the remote branch`:`No commits to push - your branch is up to date with remote`,He;t[66]===Ve?He=t[67]:(He=(0,P.jsx)(ue,{side:`right`,children:Ve}),t[66]=Ve,t[67]=He);let Ue;t[68]!==Be||t[69]!==He?(Ue=(0,P.jsx)(n,{children:(0,P.jsxs)(y,{children:[Be,He]})}),t[68]=Be,t[69]=He,t[70]=Ue):Ue=t[70];let We=O||de,Ge;t[71]===Symbol.for(`react.memo_cache_sentinel`)?(Ge=(0,P.jsx)(oe,{className:`h-3.5 w-3.5 mr-2`}),t[71]=Ge):Ge=t[71];let Ke;t[72]!==he||t[73]!==We?(Ke=(0,P.jsxs)(M,{onClick:he,disabled:We,children:[Ge,`History`]}),t[72]=he,t[73]=We,t[74]=Ke):Ke=t[74];let qe;t[75]!==b||t[76]!==v||t[77]!==ae||t[78]!==O||t[79]!==ve||t[80]!==te?(qe=!ae&&b&&!te&&!v&&(0,P.jsxs)(M,{onClick:ve,disabled:O,children:[(0,P.jsx)(_,{className:`h-3.5 w-3.5 mr-2`}),`Create Pull Request`,(0,P.jsx)(ye,{children:`⌘⇧P`})]}),t[75]=b,t[76]=v,t[77]=ae,t[78]=O,t[79]=ve,t[80]=te,t[81]=qe):qe=t[81];let Je;t[82]!==l||t[83]!==O||t[84]!==be?(Je=l&&(0,P.jsxs)(M,{onClick:be,disabled:O,children:[(0,P.jsx)(re,{className:`h-3.5 w-3.5 mr-2`}),`Create Repo`]}),t[82]=l,t[83]=O,t[84]=be,t[85]=Je):Je=t[85];let Ye;t[86]!==O||t[87]!==xe||t[88]!==d?(Ye=d&&(0,P.jsxs)(M,{onClick:xe,disabled:O,children:[(0,P.jsx)(ce,{className:`h-3.5 w-3.5 mr-2`}),`View in GitHub`,(0,P.jsx)(ye,{children:`⌘⇧G`})]}),t[86]=O,t[87]=xe,t[88]=d,t[89]=Ye):Ye=t[89];let Xe;t[90]!==W||t[91]!==G||t[92]!==Ae||t[93]!==q||t[94]!==Z||t[95]!==Fe||t[96]!==Ie||t[97]!==Ue||t[98]!==Ke||t[99]!==qe||t[100]!==Je||t[101]!==Ye?(Xe=(0,P.jsxs)(_e,{align:`end`,children:[W,G,K,Ae,q,Z,Fe,Ie,Ue,Ke,qe,Je,Ye]}),t[90]=W,t[91]=G,t[92]=Ae,t[93]=q,t[94]=Z,t[95]=Fe,t[96]=Ie,t[97]=Ue,t[98]=Ke,t[99]=qe,t[100]=Je,t[101]=Ye,t[102]=Xe):Xe=t[102];let Ze;return t[103]!==I||t[104]!==L||t[105]!==U||t[106]!==Xe?(Ze=(0,P.jsxs)(pe,{open:L,onOpenChange:I,children:[U,Xe]}),t[103]=I,t[104]=L,t[105]=U,t[106]=Xe,t[107]=Ze):Ze=t[107],Ze}var ke=(0,N.lazy)(()=>k(()=>import(`./commit-dialog-DpwAQ4Z6.js`).then(e=>({default:e.CommitDialog})),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11]))),R=(0,N.lazy)(()=>k(()=>import(`./pull-request-dialog-X0kSTYFA.js`).then(e=>({default:e.PullRequestDialog})),__vite__mapDeps([12,1,2,3,4,5,6,7,8,9,10,11]))),z=(0,N.lazy)(()=>k(()=>import(`./create-repo-dialog-BoCupv2m.js`).then(e=>({default:e.CreateRepoDialog})),__vite__mapDeps([13,1,2,3,4,5,6,7,8,9,10,11]))),B=(0,N.lazy)(()=>k(()=>import(`./git-history-dialog-BN7wBt9F.js`).then(e=>({default:e.GitHistoryDialog})),__vite__mapDeps([14,6,2]))),V=(0,N.lazy)(()=>k(()=>import(`./push-before-pr-dialog-CQEDHNrv.js`).then(e=>({default:e.PushBeforePRDialog})),__vite__mapDeps([15,6,2]))),H=(0,N.lazy)(()=>k(()=>import(`./pull-with-changes-dialog-CSHYq7Pw.js`).then(e=>({default:e.PullWithChangesDialog})),__vite__mapDeps([16,5,2,6])));function U(){return null}function W(e){let t=(0,Se.c)(65),{isLoading:n,currentBranch:r,commit:i,pullRequest:a,pushBeforePR:o,createRepo:s,history:c,pullWithChanges:l}=e,u;t[0]!==i.autoGenerate||t[1]!==i.isGenerating||t[2]!==i.isOpen||t[3]!==i.message||t[4]!==i.onAutoGenerateChange||t[5]!==i.onCommit||t[6]!==i.onGenerateMessage||t[7]!==i.onMessageChange||t[8]!==i.onOpenChange||t[9]!==r||t[10]!==n?(u=i.isOpen&&(0,P.jsx)(N.Suspense,{fallback:(0,P.jsx)(U,{}),children:(0,P.jsx)(ke,{open:i.isOpen,onOpenChange:i.onOpenChange,commitMessage:i.message,onCommitMessageChange:i.onMessageChange,autoGenerateCommitMessage:i.autoGenerate,onAutoGenerateChange:i.onAutoGenerateChange,isGeneratingMessage:i.isGenerating,isLoading:n,onGenerateMessage:i.onGenerateMessage,onCommit:i.onCommit,currentBranch:r})}),t[0]=i.autoGenerate,t[1]=i.isGenerating,t[2]=i.isOpen,t[3]=i.message,t[4]=i.onAutoGenerateChange,t[5]=i.onCommit,t[6]=i.onGenerateMessage,t[7]=i.onMessageChange,t[8]=i.onOpenChange,t[9]=r,t[10]=n,t[11]=u):u=t[11];let d;t[12]!==r||t[13]!==n||t[14]!==a.autoGenerate||t[15]!==a.description||t[16]!==a.isGeneratingInfo||t[17]!==a.isOpen||t[18]!==a.onAutoGenerateChange||t[19]!==a.onCreatePR||t[20]!==a.onDescriptionChange||t[21]!==a.onGenerateInfo||t[22]!==a.onOpenChange||t[23]!==a.onTitleChange||t[24]!==a.title?(d=a.isOpen&&(0,P.jsx)(N.Suspense,{fallback:(0,P.jsx)(U,{}),children:(0,P.jsx)(R,{open:a.isOpen,onOpenChange:a.onOpenChange,prTitle:a.title,onPrTitleChange:a.onTitleChange,prDescription:a.description,onPrDescriptionChange:a.onDescriptionChange,isGeneratingPRInfo:a.isGeneratingInfo,isLoading:n,onGeneratePRInfo:a.onGenerateInfo,onCreatePR:a.onCreatePR,currentBranch:r,autoGeneratePRInfo:a.autoGenerate,onAutoGeneratePRInfoChange:a.onAutoGenerateChange})}),t[12]=r,t[13]=n,t[14]=a.autoGenerate,t[15]=a.description,t[16]=a.isGeneratingInfo,t[17]=a.isOpen,t[18]=a.onAutoGenerateChange,t[19]=a.onCreatePR,t[20]=a.onDescriptionChange,t[21]=a.onGenerateInfo,t[22]=a.onOpenChange,t[23]=a.onTitleChange,t[24]=a.title,t[25]=d):d=t[25];let f;t[26]!==n||t[27]!==o.isOpen||t[28]!==o.onCancel||t[29]!==o.onOpenChange||t[30]!==o.onPushAndCreatePR?(f=o.isOpen&&(0,P.jsx)(N.Suspense,{fallback:(0,P.jsx)(U,{}),children:(0,P.jsx)(V,{open:o.isOpen,onOpenChange:o.onOpenChange,isLoading:n,onPushAndCreatePR:o.onPushAndCreatePR,onCancel:o.onCancel})}),t[26]=n,t[27]=o.isOpen,t[28]=o.onCancel,t[29]=o.onOpenChange,t[30]=o.onPushAndCreatePR,t[31]=f):f=t[31];let p;t[32]!==s.description||t[33]!==s.isOpen||t[34]!==s.isPrivate||t[35]!==s.name||t[36]!==s.onCreateRepo||t[37]!==s.onDescriptionChange||t[38]!==s.onNameChange||t[39]!==s.onOpenChange||t[40]!==s.onPrivateChange||t[41]!==n?(p=s.isOpen&&(0,P.jsx)(N.Suspense,{fallback:(0,P.jsx)(U,{}),children:(0,P.jsx)(z,{open:s.isOpen,onOpenChange:s.onOpenChange,repoName:s.name,onRepoNameChange:s.onNameChange,repoDescription:s.description,onRepoDescriptionChange:s.onDescriptionChange,isPrivateRepo:s.isPrivate,onPrivateRepoChange:s.onPrivateChange,isLoading:n,onCreateRepo:s.onCreateRepo})}),t[32]=s.description,t[33]=s.isOpen,t[34]=s.isPrivate,t[35]=s.name,t[36]=s.onCreateRepo,t[37]=s.onDescriptionChange,t[38]=s.onNameChange,t[39]=s.onOpenChange,t[40]=s.onPrivateChange,t[41]=n,t[42]=p):p=t[42];let m;t[43]!==r||t[44]!==c.commits||t[45]!==c.displayedCommits||t[46]!==c.isLoadingMore||t[47]!==c.isOpen||t[48]!==c.onOpenChange||t[49]!==c.onScroll?(m=c.isOpen&&(0,P.jsx)(N.Suspense,{fallback:(0,P.jsx)(U,{}),children:(0,P.jsx)(B,{open:c.isOpen,onOpenChange:c.onOpenChange,commits:c.commits,displayedCommits:c.displayedCommits,isLoadingMore:c.isLoadingMore,onScroll:c.onScroll,currentBranch:r})}),t[43]=r,t[44]=c.commits,t[45]=c.displayedCommits,t[46]=c.isLoadingMore,t[47]=c.isOpen,t[48]=c.onOpenChange,t[49]=c.onScroll,t[50]=m):m=t[50];let h;t[51]!==n||t[52]!==l.isOpen||t[53]!==l.onCancel||t[54]!==l.onCommitFirst||t[55]!==l.onOpenChange||t[56]!==l.onStashAndPull?(h=l.isOpen&&(0,P.jsx)(N.Suspense,{fallback:(0,P.jsx)(U,{}),children:(0,P.jsx)(H,{open:l.isOpen,onOpenChange:l.onOpenChange,onCommitFirst:l.onCommitFirst,onStashAndPull:l.onStashAndPull,onCancel:l.onCancel,isLoading:n})}),t[51]=n,t[52]=l.isOpen,t[53]=l.onCancel,t[54]=l.onCommitFirst,t[55]=l.onOpenChange,t[56]=l.onStashAndPull,t[57]=h):h=t[57];let g;return t[58]!==u||t[59]!==d||t[60]!==f||t[61]!==p||t[62]!==m||t[63]!==h?(g=(0,P.jsxs)(P.Fragment,{children:[u,d,f,p,m,h]}),t[58]=u,t[59]=d,t[60]=f,t[61]=p,t[62]=m,t[63]=h,t[64]=g):g=t[64],g}function G(e){let t=e.split(`/`);return t.length>=2?{provider:t[0],model:t.slice(1).join(`/`)}:{provider:void 0,model:e}}var K=d(`app.use-ai-generation.hook`);function Ae(e,t,n){let[r,i]=(0,N.useState)(!1),[a,o]=(0,N.useState)(!1),s=()=>n?.id?n.provider?{provider:n.provider,model:n.id}:G(n.id):{provider:void 0,model:void 0};return{isGeneratingMessage:r,isGeneratingPRInfo:a,generateCommitMessageWithAI:(0,N.useCallback)(async()=>{if(!e)return null;try{i(!0);let{provider:t,model:n}=s();return await h(e,n,t)}catch(e){return K.error(`Failed to generate commit message:`,e),A({title:`Error`,description:e instanceof Error?e.message:`Failed to generate commit message`,variant:`destructive`}),null}finally{i(!1)}},[e,n]),generatePRInfoWithAI:(0,N.useCallback)(async()=>{if(!e)return null;try{o(!0);let{provider:t,model:n}=s();return await D(e,n,t)}catch(e){return K.error(`Failed to generate PR info:`,e),A({title:`Error`,description:e instanceof Error?e.message:`Failed to generate PR info`,variant:`destructive`}),null}finally{o(!1)}},[e,n])}}function q(e){return e?!0:(A({title:`Error`,description:`No thread selected`,variant:`destructive`}),!1)}async function J(e,t,n,r){r&&(await T(e,{title:r}),n({type:j.UpdateThreadTitle,projectId:t,threadId:e,title:r}))}var Y=2e3,X=6;function Z(e,t){let n=0;e.current!==null&&clearInterval(e.current),e.current=setInterval(async()=>{if(n++,n>=X){e.current!==null&&(clearInterval(e.current),e.current=null);return}await t(!0)},Y)}var Q=d(`app.git-ops-button.ui`),je=10;function Me(e){let{projectId:t,threadId:n,projectName:a,dispatch:c,aiGeneration:u,unifiedGitStatus:d}=e,[f,p]=(0,N.useState)(!1),[h,_]=(0,N.useState)(!1),[y,b]=(0,N.useState)(!1),[x,ee]=(0,N.useState)(!1),[ne,S]=(0,N.useState)(``),[C,re]=(0,N.useState)(``),[w,T]=(0,N.useState)(``),[D,ie]=(0,N.useState)(!1),[oe,ce]=(0,N.useState)(null),le=(0,N.useRef)(!1),ue=(0,N.useRef)(!1),de=(0,N.useRef)(C),k=(0,N.useRef)(w);de.current=C,k.current=w;let[fe,pe]=(0,N.useState)(!1),[me,he]=(0,N.useState)([]),[ge,_e]=(0,N.useState)(!1),[ve,ye]=(0,N.useState)([]),[M,Se]=(0,N.useState)(!1),[P,F]=(0,N.useState)(!1),[I,L]=(0,N.useState)(``),[Ce,we]=(0,N.useState)(``),[Te,Ee]=(0,N.useState)(``),[De,Oe]=(0,N.useState)(!1),[ke,R]=(0,N.useState)(!1),[z,B]=(0,N.useState)(!1),[V,H]=(0,N.useState)(!1),U=(0,N.useRef)(!1),W=(0,N.useRef)(null);(0,N.useEffect)(()=>()=>{W.current!==null&&(clearInterval(W.current),W.current=null)},[]);async function G(){i();let e=await ae();c({type:j.SetProjects,projects:e.projects})}let[K,Ae]=(0,N.useState)(()=>be());(0,N.useEffect)(()=>{P&&a&&!I&&L(a)},[P,a,I]),(0,N.useEffect)(()=>{xe(K)},[K]);function Y(){De||(Oe(!0),se().then(e=>Ee(e)).catch(()=>{}))}function X(e){H(e),e&&(Y(),d.fetchUnifiedStatus(!0))}(0,N.useEffect)(()=>{h&&d.prExists&&d.prState===`OPEN`&&_(!1)},[d.prExists,d.prState,h]),(0,N.useEffect)(()=>{if(!h)return;let e=setTimeout(()=>{_(!1)},15e3);return()=>clearTimeout(e)},[h]),(0,N.useEffect)(()=>{let e=d.prExists&&d.prState===`OPEN`&&!d.hasChanges&&!d.hasUnpushedCommits;e&&!U.current&&G(),U.current=e},[d.hasChanges,d.hasUnpushedCommits,d.prExists,d.prState]);async function Me(){if(ne.trim()&&q(n))try{p(!0),await l(n,ne),S(``),b(!1),await d.fetchUnifiedStatus(!0),G(),A({title:`Changes committed successfully`,description:`Your changes have been committed to '${d.currentBranch}'.`}),z&&(B(!1),await ze())}catch(e){Q.error(`Failed to commit:`,e),A({title:`Commit failed`,description:e instanceof Error?e.message:`Failed to commit changes`,variant:`destructive`})}finally{p(!1)}}async function Ne(){if(!q(n))return;let e=d.prUrl;if(!e)try{e=(await m(n)).url}catch(e){Q.error(`Failed to fetch pull request URL:`,e),A({title:`Could not open pull request`,description:e instanceof Error?e.message:`Failed to fetch pull request URL`,variant:`destructive`});return}if(!e){A({title:`Could not open pull request`,description:`Pull request URL is unavailable. Try refreshing git status.`,variant:`destructive`});return}try{await g(e)}catch(e){Q.error(`Failed to open pull request:`,e),A({title:`Could not open pull request`,description:e instanceof Error?e.message:`Failed to open URL in browser`,variant:`destructive`})}}async function Pe(){if(d.hasChanges){b(!0);return}if(d.hasUnpushedCommits&&d.prExists){await Le();return}if(d.prExists&&d.prState===`OPEN`&&!d.hasChanges&&!d.hasUnpushedCommits){await Ne();return}if(d.commitsAheadOfDefault&&!d.prExists&&!d.hasChanges){ee(!0);return}if(d.defaultBranchBehind>0){await He();return}}async function $(){let e=await u.generateCommitMessageWithAI();e&&S(e)}async function Fe(){if(q(n))try{p(!0);let e=await u.generateCommitMessageWithAI();if(!e){A({title:`Quick Commit failed`,description:`Could not generate commit message`,variant:`destructive`});return}await l(n,e),await d.fetchUnifiedStatus(!0),G(),A({title:`Changes committed successfully`,description:`Committed: ${e}`})}catch(e){Q.error(`Quick commit failed:`,e),A({title:`Quick Commit failed`,description:e instanceof Error?e.message:`Failed to commit changes`,variant:`destructive`})}finally{p(!1)}}async function Ie(){if(q(n))try{p(!0),await O(n),await d.fetchUnifiedStatus()}catch(e){Q.error(`Failed to fetch:`,e)}finally{p(!1)}}async function Le(){if(q(n))try{p(!0),await s(n),await d.fetchUnifiedStatus(!0),G(),d.hasRemoteBranch?A({title:`Branch pushed successfully`,description:`Your branch '${d.currentBranch}' has been pushed to the remote.`}):A({title:`Push completed`,description:`Changes have been pushed successfully.`})}catch(e){Q.error(`Failed to push:`,e),A({title:`Push failed`,description:e instanceof Error?e.message:`Failed to push to remote`,variant:`destructive`})}finally{p(!1)}}async function Re(){if(q(n)){if(d.hasChanges){R(!0);return}await ze()}}async function ze(){try{p(!0),await te(n),await d.fetchUnifiedStatus(!0),G(),A({title:`Pull successful`,description:`Latest changes have been pulled from remote.`})}catch(e){Q.error(`Failed to pull:`,e),A({title:`Pull failed`,description:e instanceof Error?e.message:`Failed to pull from remote`,variant:`destructive`})}finally{p(!1)}}function Be(){R(!1),B(!0),b(!0)}async function Ve(){R(!1),await ze()}async function He(){if(q(n))try{p(!0),await o(n),await d.fetchUnifiedStatus(!0),G(),A({title:`Branch synced successfully`,description:`Your branch '${d.currentBranch}' has been synced with the latest changes`})}catch(e){Q.error(`[sync] ✗ Failed to sync branch:`,e),A({title:`Sync failed`,description:e instanceof Error?e.message:`Failed to sync with default branch`,variant:`destructive`})}finally{p(!1)}}async function Ue(){if(q(n))try{p(!0),_(!0);let e=await v(n,C,w);await J(n,t,c,e.title??C),e.prUrl&&await g(e.prUrl),re(``),T(``),ee(!1),await d.fetchUnifiedStatus(!0),G(),Z(W,d.fetchUnifiedStatus)}catch(e){Q.error(`Failed to create PR:`,e);let t=e instanceof Error?e.message:`Failed to create PR`;t.includes(`push the current branch`)||t.includes(`--head flag`)?(ee(!1),Ke({title:C,description:w})):(_(!1),A({title:`Create PR Failed`,description:t,variant:`destructive`}))}finally{p(!1)}}async function We(){if(q(n))try{p(!0);let e=await r(n,I,Ce,K.privateRepositoryDefault);e.repoUrl&&setTimeout(()=>{g(e.repoUrl)},3e3),L(``),we(``),F(!1),await d.fetchUnifiedStatus(),G()}catch(e){Q.error(`Failed to create repo:`,e)}finally{p(!1)}}async function Ge(){let e=await u.generatePRInfoWithAI();e&&(re(e.title),T(e.description),A({title:`Success`,description:`PR title and description generated`}))}async function Ke(e){let r=e??oe;if(!(!n||!r))try{p(!0),_(!0);try{await s(n)}catch(e){let t=e?.message??``;if(t.includes(`non-fast-forward`)||t.includes(`Updates were rejected because the tip of your current branch is behind`)){A({title:`Syncing branch before push`,description:`Your branch is behind remote. Pulling latest changes first...`});try{await o(n),await s(n)}catch{throw e}}else throw e}let e=await v(n,r.title,r.description);await J(n,t,c,e.title??r.title),e.prUrl&&await g(e.prUrl),re(``),T(``),ce(null),ie(!1),await d.fetchUnifiedStatus(!0),G(),Z(W,d.fetchUnifiedStatus)}catch(e){Q.error(`Failed to push and create PR:`,e);let t=e instanceof Error?e.message:`Failed to push and create PR`;_(!1),A({title:`Push & Create PR Failed`,description:t,variant:`destructive`})}finally{p(!1)}}async function qe(){if(q(n))try{_e(!0);let e=await E(n,100);he(e),ye(e.slice(0,je)),pe(!0)}catch(e){Q.error(`Failed to fetch git history:`,e)}finally{_e(!1)}}function Je(){M||(Se(!0),setTimeout(()=>{let e=ve.length+je;ye(me.slice(0,e)),Se(!1)},300))}function Ye(e){let t=e.currentTarget;t.scrollHeight-t.scrollTop-t.clientHeight<100&&ve.length<me.length&&!M&&Je()}function Xe(){d.repoUrl&&g(d.repoUrl)}function Ze(){ie(!1),ce(null)}return{isLoading:f,isCreatingPR:h,isCommitDialogOpen:y,setIsCommitDialogOpen:b,isPRDialogOpen:x,setIsPRDialogOpen:ee,commitMessage:ne,setCommitMessage:S,prTitle:C,setPrTitle:re,prDescription:w,setPrDescription:T,isPushBeforePRDialogOpen:D,setIsPushBeforePRDialogOpen:ie,prGenerationRef:le,commitGenerationRef:ue,prTitleRef:de,prDescriptionRef:k,isHistoryDialogOpen:fe,setIsHistoryDialogOpen:pe,commits:me,displayedCommits:ve,isLoadingHistory:ge,isLoadingMore:M,isRepoDialogOpen:P,setIsRepoDialogOpen:F,repoName:I,setRepoName:L,repoDescription:Ce,setRepoDescription:we,gitUser:Te,isPullWithChangesDialogOpen:ke,setIsPullWithChangesDialogOpen:R,isGitOpsMenuOpen:V,userPrefs:K,setUserPrefsState:Ae,handleGitOpsMenuOpenChange:X,handleCommit:Me,handleOpenPullRequest:Ne,handleMainButtonClick:Pe,handleGenerateCommitMessage:$,handleQuickCommit:Fe,handleFetch:Ie,handlePush:Le,handlePull:Re,handleSyncBranch:He,handleCreatePR:Ue,handleCreateRepo:We,handleGeneratePRInfo:Ge,handlePushAndCreatePR:Ke,handleOpenHistory:qe,handleScroll:Ye,handleViewInGitHub:Xe,handleCancelPushBeforePR:Ze,handleCommitFirstAndPull:Be,handleStashAndPull:Ve}}function Ne(e){let t=(0,Se.c)(29),{threadId:n,aiGeneration:r,isCommitDialogOpen:i,commitMessage:a,setCommitMessage:o,autoGenerateCommitMessage:s,commitGenerationRef:c,isPRDialogOpen:l,prTitleRef:u,prDescriptionRef:d,setPrTitle:f,setPrDescription:p,autoGeneratePRInfo:m,prGenerationRef:h}=e,g;t[0]!==r||t[1]!==s||t[2]!==c||t[3]!==a||t[4]!==i||t[5]!==o||t[6]!==n?(g=()=>{if(!i){c.current=!1;return}i&&s&&!a.trim()&&n&&!c.current&&(c.current=!0,(async function(){let e=await r.generateCommitMessageWithAI();e&&o(e)})())},t[0]=r,t[1]=s,t[2]=c,t[3]=a,t[4]=i,t[5]=o,t[6]=n,t[7]=g):g=t[7];let _;t[8]!==r.generateCommitMessageWithAI||t[9]!==s||t[10]!==a||t[11]!==i||t[12]!==n?(_=[i,s,n,r.generateCommitMessageWithAI,a],t[8]=r.generateCommitMessageWithAI,t[9]=s,t[10]=a,t[11]=i,t[12]=n,t[13]=_):_=t[13],(0,N.useEffect)(g,_);let v;t[14]!==r||t[15]!==m||t[16]!==l||t[17]!==d||t[18]!==h||t[19]!==u||t[20]!==p||t[21]!==f||t[22]!==n?(v=()=>{if(!l){h.current=!1;return}l&&m&&!u.current.trim()&&!d.current.trim()&&n&&!h.current&&(h.current=!0,(async function(){let e=await r.generatePRInfoWithAI();e&&(f(e.title),p(e.description),A({title:`Success`,description:`PR title and description generated`}))})())},t[14]=r,t[15]=m,t[16]=l,t[17]=d,t[18]=h,t[19]=u,t[20]=p,t[21]=f,t[22]=n,t[23]=v):v=t[23];let y;t[24]!==r.generatePRInfoWithAI||t[25]!==m||t[26]!==l||t[27]!==n?(y=[l,m,n,r.generatePRInfoWithAI],t[24]=r.generatePRInfoWithAI,t[25]=m,t[26]=l,t[27]=n,t[28]=y):y=t[28],(0,N.useEffect)(v,y)}function Pe(e){let{unifiedGitStatus:t,autoGenerateCommitMessage:n,isLoading:r,isCreatingPR:i,isDirectCommitMode:a,onQuickCommit:o,onCreatePR:s,onViewInGitHub:c,onOpenGitOpsMenu:l}=e,u=(0,N.useRef)(o),d=(0,N.useRef)(s),f=(0,N.useRef)(c),p=(0,N.useRef)(l);u.current=o,d.current=s,f.current=c,p.current=l,(0,N.useEffect)(()=>{function e(e){let o=e.key.toLowerCase();if((e.metaKey||e.ctrlKey)&&e.shiftKey&&!e.altKey){if(o===`c`){t.hasChanges&&n&&!r&&(e.preventDefault(),u.current());return}if(o===`p`){t.commitsAheadOfDefault&&!t.prExists&&!t.hasChanges&&!r&&!a&&(e.preventDefault(),d.current());return}if(o===`g`){t.repoUrl&&!r&&(e.preventDefault(),f.current());return}o===`b`&&!r&&!i&&(e.preventDefault(),p.current())}}return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[t.commitsAheadOfDefault,t.hasChanges,t.prExists,t.repoUrl,n,r,i,a])}function $(e){let r=(0,Se.c)(209),{projectId:i,threadId:o,layout:s}=e,c=s===void 0?`bar`:s,l=me(),u;r[0]===o?u=r[1]:(u=e=>e.projectModelSelections[o],r[0]=o,r[1]=u);let d=he(u),f;r[2]===i?f=r[3]:(f=e=>e.projects.find(e=>e.projectId===i),r[2]=i,r[3]=f);let m=he(f),h=ve(),g=Ae(o,i,d),_=m?.commitMethod===t.Direct,v=m?.name,b;r[4]!==g||r[5]!==l||r[6]!==i||r[7]!==v||r[8]!==o||r[9]!==h?(b={projectId:i,threadId:o,projectName:v,dispatch:l,aiGeneration:g,unifiedGitStatus:h},r[4]=g,r[5]=l,r[6]=i,r[7]=v,r[8]=o,r[9]=h,r[10]=b):b=r[10];let x=Me(b),ee;r[11]!==x.commitGenerationRef||r[12]!==x.commitMessage||r[13]!==x.isCommitDialogOpen||r[14]!==x.isPRDialogOpen||r[15]!==x.prDescriptionRef||r[16]!==x.prGenerationRef||r[17]!==x.prTitleRef||r[18]!==x.setCommitMessage||r[19]!==x.setPrDescription||r[20]!==x.setPrTitle||r[21]!==x.userPrefs.autoGenerateCommitMessage||r[22]!==x.userPrefs.autoGeneratePRInfo||r[23]!==g||r[24]!==o?(ee={threadId:o,aiGeneration:g,isCommitDialogOpen:x.isCommitDialogOpen,commitMessage:x.commitMessage,setCommitMessage:x.setCommitMessage,autoGenerateCommitMessage:x.userPrefs.autoGenerateCommitMessage,commitGenerationRef:x.commitGenerationRef,isPRDialogOpen:x.isPRDialogOpen,prTitleRef:x.prTitleRef,prDescriptionRef:x.prDescriptionRef,setPrTitle:x.setPrTitle,setPrDescription:x.setPrDescription,autoGeneratePRInfo:x.userPrefs.autoGeneratePRInfo,prGenerationRef:x.prGenerationRef},r[11]=x.commitGenerationRef,r[12]=x.commitMessage,r[13]=x.isCommitDialogOpen,r[14]=x.isPRDialogOpen,r[15]=x.prDescriptionRef,r[16]=x.prGenerationRef,r[17]=x.prTitleRef,r[18]=x.setCommitMessage,r[19]=x.setPrDescription,r[20]=x.setPrTitle,r[21]=x.userPrefs.autoGenerateCommitMessage,r[22]=x.userPrefs.autoGeneratePRInfo,r[23]=g,r[24]=o,r[25]=ee):ee=r[25],Ne(ee);let te;r[26]===x?te=r[27]:(te=()=>x.setIsPRDialogOpen(!0),r[26]=x,r[27]=te);let S;r[28]===x?S=r[29]:(S=()=>{x.isLoading||x.isCreatingPR||x.handleGitOpsMenuOpenChange(!0)},r[28]=x,r[29]=S);let C;r[30]!==x.handleQuickCommit||r[31]!==x.handleViewInGitHub||r[32]!==x.isCreatingPR||r[33]!==x.isLoading||r[34]!==x.userPrefs.autoGenerateCommitMessage||r[35]!==_||r[36]!==te||r[37]!==S||r[38]!==h?(C={unifiedGitStatus:h,autoGenerateCommitMessage:x.userPrefs.autoGenerateCommitMessage,isLoading:x.isLoading,isCreatingPR:x.isCreatingPR,isDirectCommitMode:_,onQuickCommit:x.handleQuickCommit,onCreatePR:te,onViewInGitHub:x.handleViewInGitHub,onOpenGitOpsMenu:S},r[30]=x.handleQuickCommit,r[31]=x.handleViewInGitHub,r[32]=x.isCreatingPR,r[33]=x.isLoading,r[34]=x.userPrefs.autoGenerateCommitMessage,r[35]=_,r[36]=te,r[37]=S,r[38]=h,r[39]=C):C=r[39],Pe(C);let re,w,T,E,D,ie,ae,oe,se,ce;if(r[40]!==c||r[41]!==h){D=De(h);let e=c===`menu`&&`w-full flex-col gap-1 [&_button]:w-full [&_button]:justify-start`;r[52]===e?ce=r[53]:(ce=p(`flex items-center gap-0`,e),r[52]=e,r[53]=ce),E=n,T=y,w=ne,se=!0,re=a,ie=`outline`,ae=`sm`,oe=p(`h-8 gap-1.5`,c===`bar`&&`rounded-r-none border-r-0`,c===`menu`&&`rounded-md border`,D&&` border-transparent bg-brand text-brand-foreground hover:bg-brand/90 hover:text-brand-foreground`),r[40]=c,r[41]=h,r[42]=re,r[43]=w,r[44]=T,r[45]=E,r[46]=D,r[47]=ie,r[48]=ae,r[49]=oe,r[50]=se,r[51]=ce}else re=r[42],w=r[43],T=r[44],E=r[45],D=r[46],ie=r[47],ae=r[48],oe=r[49],se=r[50],ce=r[51];let le;r[54]!==x.isCreatingPR||r[55]!==x.isLoading||r[56]!==h?(le=Ee(h,x.isLoading,x.isCreatingPR),r[54]=x.isCreatingPR,r[55]=x.isLoading,r[56]=h,r[57]=le):le=r[57];let O=x.handleMainButtonClick,de;r[58]!==x.isCreatingPR||r[59]!==x.isLoading||r[60]!==h?(de=we(h,x.isCreatingPR,x.isLoading),r[58]=x.isCreatingPR,r[59]=x.isLoading,r[60]=h,r[61]=de):de=r[61];let k;r[62]!==x.isCreatingPR||r[63]!==h?(k=Ce(h,x.isCreatingPR),r[62]=x.isCreatingPR,r[63]=h,r[64]=k):k=r[64];let fe;r[65]!==re||r[66]!==x.handleMainButtonClick||r[67]!==ie||r[68]!==ae||r[69]!==oe||r[70]!==le||r[71]!==de||r[72]!==k?(fe=(0,P.jsxs)(re,{variant:ie,size:ae,className:oe,disabled:le,onClick:O,children:[de,k]}),r[65]=re,r[66]=x.handleMainButtonClick,r[67]=ie,r[68]=ae,r[69]=oe,r[70]=le,r[71]=de,r[72]=k,r[73]=fe):fe=r[73];let pe;r[74]!==w||r[75]!==se||r[76]!==fe?(pe=(0,P.jsx)(w,{asChild:se,children:fe}),r[74]=w,r[75]=se,r[76]=fe,r[77]=pe):pe=r[77];let A;r[78]===h?A=r[79]:(A=Te(h),r[78]=h,r[79]=A);let j;r[80]===A?j=r[81]:(j=(0,P.jsx)(ue,{children:A}),r[80]=A,r[81]=j);let ge;r[82]!==T||r[83]!==pe||r[84]!==j?(ge=(0,P.jsxs)(T,{children:[pe,j]}),r[82]=T,r[83]=pe,r[84]=j,r[85]=ge):ge=r[85];let _e;r[86]!==E||r[87]!==ge?(_e=(0,P.jsx)(E,{children:ge}),r[86]=E,r[87]=ge,r[88]=_e):_e=r[88];let ye=h.defaultBranch??null,M=g.isGeneratingMessage&&x.isLoading,be,xe,N,F,I,L;r[89]===x?(be=r[90],xe=r[91],N=r[92],F=r[93],I=r[94],L=r[95]):(be=()=>void x.handleFetch(),xe=()=>void x.handlePull(),N=()=>void x.handlePush(),F=()=>void x.handleOpenHistory(),I=()=>x.setIsPRDialogOpen(!0),L=()=>x.setIsRepoDialogOpen(!0),r[89]=x,r[90]=be,r[91]=xe,r[92]=N,r[93]=F,r[94]=I,r[95]=L);let ke,R;r[96]===x?(ke=r[97],R=r[98]):(ke=()=>void x.handleQuickCommit(),R=()=>void x.handleSyncBranch(),r[96]=x,r[97]=ke,r[98]=R);let z;r[99]!==x.gitUser||r[100]!==x.handleGitOpsMenuOpenChange||r[101]!==x.handleViewInGitHub||r[102]!==x.isCreatingPR||r[103]!==x.isGitOpsMenuOpen||r[104]!==x.isLoading||r[105]!==x.isLoadingHistory||r[106]!==x.userPrefs.autoGenerateCommitMessage||r[107]!==D||r[108]!==_||r[109]!==c||r[110]!==ye||r[111]!==M||r[112]!==be||r[113]!==xe||r[114]!==N||r[115]!==F||r[116]!==I||r[117]!==L||r[118]!==ke||r[119]!==R||r[120]!==h.canCreateRepo||r[121]!==h.commitsAheadOfDefault||r[122]!==h.defaultBranchAhead||r[123]!==h.defaultBranchBehind||r[124]!==h.hasChanges||r[125]!==h.hasRemoteBranch||r[126]!==h.hasUnpushedCommits||r[127]!==h.isRefreshing||r[128]!==h.prExists||r[129]!==h.remoteUrl||r[130]!==h.repoUrl||r[131]!==h.status?(z=(0,P.jsx)(Oe,{branchStatus:h.status,remoteUrl:h.remoteUrl,hasRemoteBranch:h.hasRemoteBranch,hasUnpushedCommits:h.hasUnpushedCommits,canCreateRepo:h.canCreateRepo,repoUrl:h.repoUrl,isRefreshing:h.isRefreshing,isCreatingPR:x.isCreatingPR,isBrandState:D,hasChanges:h.hasChanges,commitsAheadOfDefault:h.commitsAheadOfDefault,prExists:h.prExists,defaultBranch:ye,defaultBranchAhead:h.defaultBranchAhead,defaultBranchBehind:h.defaultBranchBehind,gitUser:x.gitUser,isDirectCommitMode:_,autoGenerateCommitMessage:x.userPrefs.autoGenerateCommitMessage,isLoading:x.isLoading,isLoadingHistory:x.isLoadingHistory,isQuickCommitting:M,onFetch:be,onPull:xe,onPush:N,onOpenHistory:F,onCreatePR:I,onCreateRepo:L,onViewInGitHub:x.handleViewInGitHub,onQuickCommit:ke,onSyncWithDefault:R,open:x.isGitOpsMenuOpen,onOpenChange:x.handleGitOpsMenuOpenChange,layout:c}),r[99]=x.gitUser,r[100]=x.handleGitOpsMenuOpenChange,r[101]=x.handleViewInGitHub,r[102]=x.isCreatingPR,r[103]=x.isGitOpsMenuOpen,r[104]=x.isLoading,r[105]=x.isLoadingHistory,r[106]=x.userPrefs.autoGenerateCommitMessage,r[107]=D,r[108]=_,r[109]=c,r[110]=ye,r[111]=M,r[112]=be,r[113]=xe,r[114]=N,r[115]=F,r[116]=I,r[117]=L,r[118]=ke,r[119]=R,r[120]=h.canCreateRepo,r[121]=h.commitsAheadOfDefault,r[122]=h.defaultBranchAhead,r[123]=h.defaultBranchBehind,r[124]=h.hasChanges,r[125]=h.hasRemoteBranch,r[126]=h.hasUnpushedCommits,r[127]=h.isRefreshing,r[128]=h.prExists,r[129]=h.remoteUrl,r[130]=h.repoUrl,r[131]=h.status,r[132]=z):z=r[132];let B;r[133]!==ce||r[134]!==_e||r[135]!==z?(B=(0,P.jsxs)(`div`,{className:ce,children:[_e,z]}),r[133]=ce,r[134]=_e,r[135]=z,r[136]=B):B=r[136];let V;r[137]===x?V=r[138]:(V=e=>x.setUserPrefsState(t=>({...t,autoGenerateCommitMessage:e})),r[137]=x,r[138]=V);let H;r[139]!==x.commitMessage||r[140]!==x.handleCommit||r[141]!==x.handleGenerateCommitMessage||r[142]!==x.isCommitDialogOpen||r[143]!==x.setCommitMessage||r[144]!==x.setIsCommitDialogOpen||r[145]!==x.userPrefs.autoGenerateCommitMessage||r[146]!==g.isGeneratingMessage||r[147]!==V?(H={isOpen:x.isCommitDialogOpen,onOpenChange:x.setIsCommitDialogOpen,message:x.commitMessage,onMessageChange:x.setCommitMessage,autoGenerate:x.userPrefs.autoGenerateCommitMessage,onAutoGenerateChange:V,isGenerating:g.isGeneratingMessage,onGenerateMessage:x.handleGenerateCommitMessage,onCommit:x.handleCommit},r[139]=x.commitMessage,r[140]=x.handleCommit,r[141]=x.handleGenerateCommitMessage,r[142]=x.isCommitDialogOpen,r[143]=x.setCommitMessage,r[144]=x.setIsCommitDialogOpen,r[145]=x.userPrefs.autoGenerateCommitMessage,r[146]=g.isGeneratingMessage,r[147]=V,r[148]=H):H=r[148];let U;r[149]===x?U=r[150]:(U=e=>x.setUserPrefsState(t=>({...t,autoGeneratePRInfo:e})),r[149]=x,r[150]=U);let G;r[151]!==x.handleCreatePR||r[152]!==x.handleGeneratePRInfo||r[153]!==x.isPRDialogOpen||r[154]!==x.prDescription||r[155]!==x.prTitle||r[156]!==x.setIsPRDialogOpen||r[157]!==x.setPrDescription||r[158]!==x.setPrTitle||r[159]!==x.userPrefs.autoGeneratePRInfo||r[160]!==g.isGeneratingPRInfo||r[161]!==U?(G={isOpen:x.isPRDialogOpen,onOpenChange:x.setIsPRDialogOpen,title:x.prTitle,onTitleChange:x.setPrTitle,description:x.prDescription,onDescriptionChange:x.setPrDescription,isGeneratingInfo:g.isGeneratingPRInfo,onGenerateInfo:x.handleGeneratePRInfo,onCreatePR:x.handleCreatePR,autoGenerate:x.userPrefs.autoGeneratePRInfo,onAutoGenerateChange:U},r[151]=x.handleCreatePR,r[152]=x.handleGeneratePRInfo,r[153]=x.isPRDialogOpen,r[154]=x.prDescription,r[155]=x.prTitle,r[156]=x.setIsPRDialogOpen,r[157]=x.setPrDescription,r[158]=x.setPrTitle,r[159]=x.userPrefs.autoGeneratePRInfo,r[160]=g.isGeneratingPRInfo,r[161]=U,r[162]=G):G=r[162];let K;r[163]===x?K=r[164]:(K=()=>x.handlePushAndCreatePR(),r[163]=x,r[164]=K);let q;r[165]!==x.handleCancelPushBeforePR||r[166]!==x.isPushBeforePRDialogOpen||r[167]!==x.setIsPushBeforePRDialogOpen||r[168]!==K?(q={isOpen:x.isPushBeforePRDialogOpen,onOpenChange:x.setIsPushBeforePRDialogOpen,onPushAndCreatePR:K,onCancel:x.handleCancelPushBeforePR},r[165]=x.handleCancelPushBeforePR,r[166]=x.isPushBeforePRDialogOpen,r[167]=x.setIsPushBeforePRDialogOpen,r[168]=K,r[169]=q):q=r[169];let J;r[170]===x?J=r[171]:(J=e=>x.setUserPrefsState(t=>({...t,privateRepositoryDefault:e})),r[170]=x,r[171]=J);let Y;r[172]!==x.handleCreateRepo||r[173]!==x.isRepoDialogOpen||r[174]!==x.repoDescription||r[175]!==x.repoName||r[176]!==x.setIsRepoDialogOpen||r[177]!==x.setRepoDescription||r[178]!==x.setRepoName||r[179]!==x.userPrefs.privateRepositoryDefault||r[180]!==J?(Y={isOpen:x.isRepoDialogOpen,onOpenChange:x.setIsRepoDialogOpen,name:x.repoName,onNameChange:x.setRepoName,description:x.repoDescription,onDescriptionChange:x.setRepoDescription,isPrivate:x.userPrefs.privateRepositoryDefault,onPrivateChange:J,onCreateRepo:x.handleCreateRepo},r[172]=x.handleCreateRepo,r[173]=x.isRepoDialogOpen,r[174]=x.repoDescription,r[175]=x.repoName,r[176]=x.setIsRepoDialogOpen,r[177]=x.setRepoDescription,r[178]=x.setRepoName,r[179]=x.userPrefs.privateRepositoryDefault,r[180]=J,r[181]=Y):Y=r[181];let X;r[182]!==x.commits||r[183]!==x.displayedCommits||r[184]!==x.handleScroll||r[185]!==x.isHistoryDialogOpen||r[186]!==x.isLoadingMore||r[187]!==x.setIsHistoryDialogOpen?(X={isOpen:x.isHistoryDialogOpen,onOpenChange:x.setIsHistoryDialogOpen,commits:x.commits,displayedCommits:x.displayedCommits,isLoadingMore:x.isLoadingMore,onScroll:x.handleScroll},r[182]=x.commits,r[183]=x.displayedCommits,r[184]=x.handleScroll,r[185]=x.isHistoryDialogOpen,r[186]=x.isLoadingMore,r[187]=x.setIsHistoryDialogOpen,r[188]=X):X=r[188];let Z;r[189]===x?Z=r[190]:(Z=()=>x.setIsPullWithChangesDialogOpen(!1),r[189]=x,r[190]=Z);let Q;r[191]!==x.handleCommitFirstAndPull||r[192]!==x.handleStashAndPull||r[193]!==x.isPullWithChangesDialogOpen||r[194]!==x.setIsPullWithChangesDialogOpen||r[195]!==Z?(Q={isOpen:x.isPullWithChangesDialogOpen,onOpenChange:x.setIsPullWithChangesDialogOpen,onCommitFirst:x.handleCommitFirstAndPull,onStashAndPull:x.handleStashAndPull,onCancel:Z},r[191]=x.handleCommitFirstAndPull,r[192]=x.handleStashAndPull,r[193]=x.isPullWithChangesDialogOpen,r[194]=x.setIsPullWithChangesDialogOpen,r[195]=Z,r[196]=Q):Q=r[196];let je;r[197]!==x.isLoading||r[198]!==H||r[199]!==G||r[200]!==q||r[201]!==Y||r[202]!==X||r[203]!==Q||r[204]!==h.currentBranch?(je=(0,P.jsx)(W,{isLoading:x.isLoading,currentBranch:h.currentBranch,commit:H,pullRequest:G,pushBeforePR:q,createRepo:Y,history:X,pullWithChanges:Q}),r[197]=x.isLoading,r[198]=H,r[199]=G,r[200]=q,r[201]=Y,r[202]=X,r[203]=Q,r[204]=h.currentBranch,r[205]=je):je=r[205];let $;return r[206]!==B||r[207]!==je?($=(0,P.jsxs)(P.Fragment,{children:[B,je]}),r[206]=B,r[207]=je,r[208]=$):$=r[208],$}export{$ as GitOpsButton};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import{i as e,n as t}from"./rolldown-runtime-aKtaBQYM.js";import{$ as n,Ai as r,Br as i,Bs as a,Ci as o,Ei as s,Fi as c,Fo as l,Gr as u,Hr as d,Ii as f,Io as p,Jo as m,Jr as h,Kr as g,Li as _,Lo as v,Mi as y,Ni as b,No as x,Oi as S,Pi as C,Po as ee,Rr as te,Rs as w,Ti as T,To as E,Va as D,Vr as O,Vs as k,Wi as A,Wr as j,_ as M,_i as ne,bi as N,c as re,ci as P,di as F,ea as ie,fi as ae,gi as oe,hi as se,ji as ce,ki as le,l as ue,li as de,mi as fe,ms as I,oi as pe,pi as me,ps as he,qi as ge,qr as _e,s as ve,si as ye,u as be,ui as xe,vi as Se,xi as Ce,zr as we,zs as Te}from"./dialogs-config-BIrrNhlc.js";var L=Te(),Ee=Object,De=Map,Oe=Set,ke=Oe.prototype.has,Ae=Oe.prototype.add,je=De.prototype.has,Me=De.prototype.get,Ne=De.prototype.set,Pe=1,Fe=2,Ie=4,Le=8,Re=16,ze=32,R=`__t`,Be=`__p`,Ve=`__e`,He=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,Ue=`http://www.w3.org/1999/xlink`,We=`http://www.w3.org/2000/xmlns/`,Ge=120,Ke=new Oe([`href`,`list`,`form`,`tabIndex`,`download`]),qe=new Oe([`area`,`base`,`basefont`,`bgsound`,`br`,`col`,`command`,`embed`,`frame`,`hr`,`image`,`img`,`input`,`isindex`,`keygen`,`link`,`menuitem`,`meta`,`nextid`,`param`,`source`,`track`,`wbr`]);if(typeof window>`u`)throw Error(`See http://million.dev/docs/install to install the compiler.`);var z=document;z.createElement(`template`);var Je=z.createElement(`template`),Ye=Je.content,Xe=z.createElementNS(`http://www.w3.org/2000/svg`,`svg`),B=Node.prototype,Ze=Element.prototype,Qe=CharacterData.prototype,$e=Ee.getOwnPropertyDescriptor,et=B.insertBefore,tt=B.cloneNode,nt=B.replaceChild,rt=Ze.remove,it=B.addEventListener,at=Ze.removeAttribute,ot=Ze.setAttribute,st=Ze.setAttributeNS,ct=$e(B,`textContent`).set,lt=$e(B,`firstChild`).get,ut=$e(B,`nextSibling`).get,dt=$e(Qe,`data`).set,ft=(e,t)=>{let n=t?Xe:Je;return n.innerHTML=e,(t?Xe:Ye).firstChild};z[Ve]=new Oe;var pt=(e,t,n)=>{let r=t.toLowerCase(),i=!1;r.endsWith(`capture`)&&(r=r.slice(0,-7),i=!0);let a=`$$${r}`;ke.call(z[Ve],r)||(it.call(z,r,e=>{let t=e.target;for(;t;){let n=t[a];n&&(Ee.defineProperty(e,`currentTarget`,{configurable:!0,get(){return t}}),n(e)),t=t.parentNode}},{capture:i}),Ae.call(z[Ve],r));let o=t=>{t?`key`in t&&t.key===e[a]?.key||(e[a]=t):e[a]=null};return o(n),o},V=(e,t)=>{let n=lt.call(e);if(t)for(let e=0;e<t&&n;++e)n=ut.call(n);return n},mt=new WeakSet,ht=e=>{if(mt.has(e))return;e.nodeType===8&&e.parentNode?.removeChild(e);let t=lt.call(e);for(;t;)ht(t),t=t.nextSibling;mt.add(e)},gt=(e,t,n)=>{let r=z.createTextNode(t),i=V(e,n);return et.call(e,r,i),r},_t=(e,t)=>{dt.call(e,t)},vt=(e,t,n)=>{typeof n!=`number`||He.test(t)?e.style[t]=n:typeof n==`string`?e.style.cssText=n:t.startsWith(`-`)?e.style.setProperty(t,String(n)):n==null?e.style[t]=``:e.style[t]=`${String(n)}px`},yt=(e,t,n)=>{t=t.replace(/xlink(?:H|:h)/,`h`).replace(/sName$/,`s`),t.startsWith(`xmlns`)?st.call(e,We,t,String(n)):t.startsWith(`xlink`)&&st.call(e,Ue,`href`,String(n))},bt=(e,t,n)=>{let r=n==null;if(n=r?``:n,t in e&&e[t]!==void 0&&e[t]!==null&&!(e instanceof SVGElement)&&ke.call(Ke,t))try{e[t]=n}catch{}else !r&&n!==``&&(n!==!1||t.includes(`-`))?ot.call(e,t,String(n)):at.call(e,t);let i=e instanceof HTMLInputElement,a=e instanceof HTMLSelectElement,o=e instanceof HTMLTextAreaElement;t===`value`&&(i||a||o)&&(ot.call(e,t,String(n)),e.value=n)},xt=new Map([[`acceptCharset`,`accept-charset`],[`htmlFor`,`for`],[`httpEquiv`,`http-equiv`],[`crossOrigin`,`crossorigin`],[`accentHeight`,`accent-height`],[`alignmentBaseline`,`alignment-baseline`],[`arabicForm`,`arabic-form`],[`baselineShift`,`baseline-shift`],[`capHeight`,`cap-height`],[`clipPath`,`clip-path`],[`clipRule`,`clip-rule`],[`colorInterpolation`,`color-interpolation`],[`colorInterpolationFilters`,`color-interpolation-filters`],[`colorProfile`,`color-profile`],[`colorRendering`,`color-rendering`],[`dominantBaseline`,`dominant-baseline`],[`enableBackground`,`enable-background`],[`fillOpacity`,`fill-opacity`],[`fillRule`,`fill-rule`],[`floodColor`,`flood-color`],[`floodOpacity`,`flood-opacity`],[`fontFamily`,`font-family`],[`fontSize`,`font-size`],[`fontSizeAdjust`,`font-size-adjust`],[`fontStretch`,`font-stretch`],[`fontStyle`,`font-style`],[`fontVariant`,`font-variant`],[`fontWeight`,`font-weight`],[`glyphName`,`glyph-name`],[`glyphOrientationHorizontal`,`glyph-orientation-horizontal`],[`glyphOrientationVertical`,`glyph-orientation-vertical`],[`horizAdvX`,`horiz-adv-x`],[`horizOriginX`,`horiz-origin-x`],[`imageRendering`,`image-rendering`],[`letterSpacing`,`letter-spacing`],[`lightingColor`,`lighting-color`],[`markerEnd`,`marker-end`],[`markerMid`,`marker-mid`],[`markerStart`,`marker-start`],[`overlinePosition`,`overline-position`],[`overlineThickness`,`overline-thickness`],[`paintOrder`,`paint-order`],[`panose-1`,`panose-1`],[`pointerEvents`,`pointer-events`],[`renderingIntent`,`rendering-intent`],[`shapeRendering`,`shape-rendering`],[`stopColor`,`stop-color`],[`stopOpacity`,`stop-opacity`],[`strikethroughPosition`,`strikethrough-position`],[`strikethroughThickness`,`strikethrough-thickness`],[`strokeDasharray`,`stroke-dasharray`],[`strokeDashoffset`,`stroke-dashoffset`],[`strokeLinecap`,`stroke-linecap`],[`strokeLinejoin`,`stroke-linejoin`],[`strokeMiterlimit`,`stroke-miterlimit`],[`strokeOpacity`,`stroke-opacity`],[`strokeWidth`,`stroke-width`],[`textAnchor`,`text-anchor`],[`textDecoration`,`text-decoration`],[`textRendering`,`text-rendering`],[`transformOrigin`,`transform-origin`],[`underlinePosition`,`underline-position`],[`underlineThickness`,`underline-thickness`],[`unicodeBidi`,`unicode-bidi`],[`unicodeRange`,`unicode-range`],[`unitsPerEm`,`units-per-em`],[`vAlphabetic`,`v-alphabetic`],[`vHanging`,`v-hanging`],[`vIdeographic`,`v-ideographic`],[`vMathematical`,`v-mathematical`],[`vectorEffect`,`vector-effect`],[`vertAdvY`,`vert-adv-y`],[`vertOriginX`,`vert-origin-x`],[`vertOriginY`,`vert-origin-y`],[`wordSpacing`,`word-spacing`],[`writingMode`,`writing-mode`],[`xmlnsXlink`,`xmlns:xlink`],[`xHeight`,`x-height`]]);function St(e){return xt.get(e)||e}var Ct=Object.defineProperty,wt=(e,t,n)=>t in e?Ct(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,H=(e,t,n)=>(wt(e,typeof t==`symbol`?t:t+``,n),n),Tt=class{constructor(){H(this,`r`),H(this,`e`),H(this,`l`),H(this,`g`),H(this,`_u`),H(this,`_t`),H(this,`d`),H(this,`k`),H(this,`c`)}},Et=(e,t=[],n=[])=>{if(typeof e==`string`)return e;if(typeof e==`number`||typeof e==`bigint`||e===!0)return String(e);if(e==null||e===!1)return``;if(typeof e==`object`&&`$`in e)return t.push({p:n,e:[{t:Pe,n:null,v:null,h:e.$,i:0,l:null,p:null,b:null}],i:[]}),`<slot/>`;let r=``,i=``,a={p:n,e:[],i:[]};for(let t in e.props){let n=e.props[t];if(t===`key`||t===`ref`||t===`children`)continue;let i=St(t);if(i&&(t=i),t===`className`&&(t=`class`),t.startsWith(`on`)){`$`in n?a.e.push({t:Ie,n:t.slice(2),v:null,h:n.$,i:null,l:null,p:null,b:null}):a.i.push({t:Ie,n:t.slice(2),v:null,h:null,i:null,l:n,p:null,b:null});continue}if(n){if(typeof n==`object`&&`$`in n){t===`style`?a.e.push({t:Le,n:t,v:null,h:n.$,i:null,l:null,p:null,b:null}):t.charCodeAt(0)===Ge?a.e.push({t:Re,n:t,v:null,h:n.$,i:null,l:null,p:null,b:null}):a.e.push({t:Fe,n:t,v:null,h:n.$,i:null,l:null,p:null,b:null});continue}if(t===`style`&&typeof n==`object`){let e=``;for(let t in n){if(typeof n[t]==`object`){a.e.push({t:Le,n:t,v:null,h:n[t].$,i:null,l:null,p:null,b:null});continue}let r=``;for(let e=0,n=t.length;e<n;++e){let n=t.charCodeAt(e);n<97?r+=`-${String.fromCharCode(n+32)}`:r+=t[e]}e+=`${r}:${String(n[t])};`}r+=` style="${e}"`;continue}r+=` ${t}="${String(n)}"`}}if(ke.call(qe,e.type))return a.e.length&&t.push(a),`<${e.type}${r} />`;let o=!1;for(let r=0,s=e.props.children?.length||0,c=0;r<s;++r){let s=e.props.children?.[r];if(s==null||s===!1)continue;if(typeof s==`object`&&`$`in s){a.e.push({t:Pe,n:null,v:null,h:s.$,i:r,l:null,p:null,b:null});continue}if(s instanceof Tt){a.i.push({t:ze,n:null,v:null,h:null,i:r,l:null,p:null,b:s});continue}if(typeof s==`string`||typeof s==`number`||typeof s==`bigint`){let e=typeof s==`number`||typeof s==`bigint`?String(s):s;if(o){a.i.push({t:Pe,n:null,v:e,h:null,i:r,l:null,p:null,b:null});continue}o=!0,i+=e,c++;continue}o=!1;let l=n.slice();l.push(c++),i+=Et(s,t,l)}return(a.i.length||a.e.length)&&t.push(a),`<${e.type}${r}>${i}</${e.type}>`},Dt=Object.defineProperty,Ot=(e,t,n)=>t in e?Dt(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,kt=(e,t,n)=>(Ot(e,typeof t==`symbol`?t:t+``,n),n),At=e=>new jt(e),jt=class extends Tt{constructor(e){super(),kt(this,`b`),this.b=e}v(){}p(e){let t=this.b,n=e.b,r=t.length,i=n.length,a=this.t();if(this===e||i===0&&r===0)return a;if(this.b=n,i===0)return Ft.call(this),a;if(r===0)return Nt.call(e,a),a;let o=0,s=0,c=r-1,l=i-1,u=t[0],d=n[0],f=t[c],p=n[l],m;for(;o<=c&&s<=l;){if(!u){u=t[++o];continue}if(!f){f=t[--c];continue}let e=u.k,r=d.k;if(e===r){Ut.call(u,d),n[s]=u,u=t[++o],d=n[++s];continue}let i=f.k,h=p.k;if(i===h){Ut.call(f,p),n[l]=f,f=t[--c],p=n[--l];continue}if(e===h){Ut.call(u,p),n[l]=u;let e=n[l+1];Wt.call(u,e,e?.l||null),u=t[++o],p=n[--l];continue}if(i===r){Ut.call(f,d),n[s]=f;let e=t[o];Wt.call(f,e,e?.l||null),f=t[--c],d=n[++s];continue}if(!m){m=new De;for(let e=o;e<=c;e++)Ne.call(m,t[e].k,e)}let g=m.get(r);if(g===void 0)Ht.call(d,a,u.l||null);else{let e=t[g];Wt.call(e,u,null),Ut.call(e,d),n[s]=e,t[g]=null}d=n[++s]}if(o<=c||s<=l)if(o>c){let e=n[l+1];for(let t=s;t<=l;++t)Ht.call(n[t],a,e?e.l:null)}else for(let e=o;e<=c;++e)Gt.call(t[e]);return a}m(e,t=null){if(this._t)return this._t;for(let n=0,r=this.b.length;n<r;++n){let r=this.b[n];Ht.call(r,e,t)}return this._t=e,e}x(){let e=this.t();if(e)ct.call(e,``);else for(let e=0,t=this.b.length;e<t;++e)Gt.call(this.b[e]);this.b=[]}u(){return!0}s(){return this.b.map(e=>e.s()).join(``)}t(){return this._t||=this.b[0].t(),this._t}},Mt=jt.prototype,Nt=Mt.m,Pt=Mt.p,Ft=Mt.x,It=new Proxy({},{get(e,t){return{$:t}}}),Lt=(e,t,n,r)=>{let i=e(It),a=[],o=ft(Et(t?t(i):i,a),r);return ht(o),(e,t,r)=>new zt(o,a,e,t??e?.key??null,r??n??null,null)},Rt=(e,t)=>{if((`b`in e||`b`in t)&&Pt.call(e,t),e.l||Ht.call(e,void 0,null,null),e.k&&e.k===t.k||e.r===t.r)return Ut.call(e,t);let n=Ht.call(t,e.t(),e.l,null);return Gt.call(e),e.k=t.k,n},zt=class extends Tt{constructor(e,t,n,r,i,a){super(),this.r=e,this.d=n,this.e=t,this.k=r,this.c=Array(t.length),i?this._u=i:this._u=null,a?this.g=a:this.g=null}m(e,t=null,n){if(this.l)return this.l;let r=n??tt.call(this.r,!0),i=this.g?.(r);i&&(this.c=i);for(let e=0,t=this.e.length;e<t;++e){let t=this.e[e],a=i?.[e]??Bt(t.p,r,this.c,e);for(let e=0,r=t.e.length;e<r;++e){let i=t.e[e],o=this.d[i.h];if(i.t&Pe){if(o instanceof Tt){let e=V(a,i.i);n?o.m(a,e,e):o.m(a,e);continue}if(a[R]||(a[R]=Array(r)),o&&typeof o==`object`&&`foreign`in o){if(n){let e=V(a,i.i);o.reset(e)}let t=o.current;a[R][e]=t,n||et.call(a,t,V(a,i.i));continue}if(n){a[R][e]=V(a,i.i);continue}a[R][e]=gt(a,o==null||o===!1?``:String(o),i.i)}else if(i.t&Ie){let e=pt(a,i.n,o);a[Be+i.n]=e}else if(i.t&Fe)bt(a,i.n,o);else if(i.t&Le)if(typeof o==`string`||typeof o==`number`)vt(a,i.n,o);else for(let e in o)vt(a,e,o[e]);else yt(a,i.n,o)}let o=t.i?.length;if(o)for(let e=0;e<o;++e){let r=t.i[e];if(r.t&Pe)r.v&&!n&>(a,r.v,r.i);else if(r.t&Ie)pt(a,r.n,r.l);else{let e=V(a,r.i);n?r.b.m(a,e,e):r.b.m(a,e)}}}return e&&!n&&et.call(e,r,t),this.l=r,r}p(e){let t=this.l;if(!e.d)return t;let n=this.d;if(!Kt.call(this,n,e.d))return t;this.d=e.d;for(let r=0,i=this.e.length;r<i;++r){let i=this.e[r],a=this.c[r]??Bt(i.p,t,this.c,r);for(let t=0,o=i.e.length;t<o;++t){let o=i.e[t],s=n[o.h],c=e.d[o.h];if(c!==s){if(o.t&Ie){a[Be+o.n](c);continue}if(o.t&Pe){if(s instanceof Tt){let n=e.e?.[r]?.e[t],i=e.d[n.h];s.p(i);continue}if(c&&typeof c==`object`&&`foreign`in c){let e=a[R][t];if(c.unstable&&s!==c){let n=c.current;a[R][t]=n,nt.call(a,n,e)}else c.current=e;continue}_t(a[R][t],c==null||c===!1?``:String(c))}else if(o.t&Fe)bt(a,o.n,c);else if(o.t&Le)if(typeof c==`string`||typeof c==`number`)vt(a,o.n,c);else for(let e in c)c[e]!==s[e]&&vt(a,e,c[e]);else yt(a,o.n,c)}}}return t}v(e=null,t=null){et.call(this.t(),this.l,e?e.l:t)}x(){rt.call(this.l),this.l=null}u(e,t){return this._u?this._u(e,t):!0}s(){return String(this.l?.outerHTML)}t(){return this._t||=this.l?.parentElement,this._t}},Bt=(e,t,n,r)=>{let i=e.length;if(!i)return t;let a=n&&r!==void 0;if(a&&n[r])return n[r];for(let n=0;n<i;++n){let r=e[n];t=V(t,r)}return a&&(n[r]=t),t},Vt=zt.prototype,Ht=Vt.m,Ut=Vt.p,Wt=Vt.v,Gt=Vt.x,Kt=Vt.u,U=e(k(),1),qt={noSlot:!1},Jt=e(a(),1),Yt=`slot`,Xt=({effect:e,deps:t})=>((0,U.useEffect)(e,t||[]),null),W=new Map,Zt=(0,U.createContext)(!1),Qt=(e,t,n)=>{let r={ref:t},i=0;for(let t in e){let a=e[t];if((0,U.isValidElement)(a)||Array.isArray(a)&&a.length&&(0,U.isValidElement)(a[0])){r[t]=en(a,!1,n,i++);continue}r[t]=e[t]}return r},$t=(e,t)=>(0,U.createElement)(Yt,{suppressHydrationWarning:!0,id:t},e),en=(e,t,n,r,i)=>{let a=n?.[r]?.current,o=(0,U.isValidElement)(e)&&typeof e.type==`function`&&`_c`in e.type,s=o&&e.type._c;if(typeof window>`u`)return o?s?e:$t($t(e),i):$t(e,i);if(s){let t=e.type(e.props);if(W.has(t.type)){let e=W.get(t.type);if(typeof e==`function`)return e(t.props)}}let c=a??(i?document.getElementById(i):null)??document.createElement(`slot`),l={foreign:!0,current:c,portal:(0,Jt.createPortal)((0,U.createElement)(U.Fragment,{children:e}),c,i),reset:e=>{e.childNodes.forEach(t=>e.removeChild(t))},unstable:t};return n&&(n[r]=l),l},tn=e=>{if(typeof e!=`object`||!e||!(`type`in e))return typeof e==`number`?String(e):e;let t=e.type;if(typeof t==`function`)return tn(t(e.props??{}));if(typeof t==`object`&&`$`in t)return t;let n={...e.props};return`css`in n&&`__EMOTION_TYPE_PLEASE_DO_NOT_USE__`in n&&(n.style=n.css.styles,t=n.__EMOTION_TYPE_PLEASE_DO_NOT_USE__,delete n.__EMOTION_TYPE_PLEASE_DO_NOT_USE__,delete n.css),e.props?.children!=null&&(n.children=nn(e.props.children).map(e=>tn(e))),{type:t,props:n}},nn=e=>{if(e==null)return[];if(typeof e==`object`&&`type`in e&&e.type===U.Fragment)return nn(e.props.children);if(!Array.isArray(e)||typeof e==`object`&&`$`in e)return[e];let t=e.flat(1/0),n=[];for(let e=0,r=t.length;e<r;++e)n.push(...nn(t[e]));return n},rn=typeof window>`u`?U.useEffect:U.useLayoutEffect;function an(e,t,n){if(!e||t(e))return e;let r=n?e.return:e.child;for(;r;){let e=an(r,t,n);if(e)return e;r=n?null:r.sibling}}function on(){let e=(0,U.useRef)();return(0,U.useState)(()=>{let t=Function.prototype.bind;Function.prototype.bind=function(n,r){return n===null&&typeof r?.type==`function`&&(e.current=r,Function.prototype.bind=t),t.apply(this,arguments)}}),e.current}function sn(e){let t=on(),n=(0,U.useRef)({el:null,depth:0});return rn(()=>{n.current.el=an(t,t=>(n.current.depth++,typeof t.type==`string`&&(e===void 0||t.type===e)),!0)?.stateNode},[t]),n}function cn(){let e=on(),t=(0,U.useRef)({el:null,depth:0});return rn(()=>{t.current.el=an(e,e=>(t.current.depth++,e.stateNode?.containerInfo!=null),!0)?.stateNode.containerInfo},[e]),t}var ln=(e,t={})=>{let n=t?.experimental_noSlot??qt.noSlot,r=t?.block,i=t?.svg?`g`:Yt;e&&(r=Lt(e,tn,t?.shouldUpdate,t?.svg));let a=(e,a)=>{let o=cn(),s=sn(),c=e._hmr,l=(0,U.useRef)(null),u=(0,U.useRef)(null),d=(0,U.useRef)([]);e=Qt(e,a,d.current),u.current?.(e);let f=(0,U.useCallback)(()=>{if(!l.current&&!n)return;let i=r(e,e.key);return c&&l.current?.textContent&&(l.current.textContent=``),n&&(l.current=s.current?.el??o.current?.el,(e.scoped||s.current&&o.current&&s.current.depth>o.current.depth)&&(l.current=o.current.el),l.current.childNodes.length&&console.error(Error(`\`experimental_options.noSlot\` does not support having siblings at the moment.
|
|
2
|
+
The block element should be the only child of the \`${tt.call(l.current).outerHTML}\` element.
|
|
3
|
+
To avoid this error, \`experimental_options.noSlot\` should be false`))),(u.current===null||c)&&(Ht.call(i,l.current,null),u.current=e=>{Rt(i,r(e,e.key,t?.shouldUpdate))}),()=>{Gt.call(i)}},[]),p=(0,U.useMemo)(()=>n?null:(0,U.createElement)(t?.as??i,{ref:l}),[]),m=d.current.length,h=Array(m);for(let e=0;e<m;++e)h[e]=d.current[e]?.portal;return(0,U.createElement)(U.Fragment,{},p,(0,U.createElement)(Xt,{effect:f,deps:c?[c]:[]}),h)};return je.call(W,a)||Ne.call(W,a,ln),t?.name&&(e&&(e.displayName=`Million(Render(${t.name}))`),a.displayName=`Million(Block(${t.name}))`),a};(0,U.memo)(({each:e,children:t,memo:n,svg:r,as:i,...a})=>{let o=(0,U.useRef)(null),[s]=(0,U.useState)(()=>({current:Array(e.length)})),c=(0,U.useRef)(null),l=(0,U.useRef)({each:null,children:null,mounted:!1}),[,u]=(0,U.useState)(!1);if(c.current&&(e!==l.current.each||!n)){let r=un(e,t,l,s,n);Pt.call(c.current,At(r))}let d=(0,U.createElement)(U.Fragment,null,(0,U.createElement)(i??(r?`g`:`slot`),{...a,ref:o}),...s.current.map(e=>e.portal));return(0,U.useEffect)(()=>{!o.current||c.current||l.current.mounted||(c.current=At(un(e,t,l,s,n)),je.call(W,d)||Ne.call(W,d,c.current),Nt.call(c.current,o.current),l.current.mounted=!0,u(!0))},[o.current]),d});var un=(e,t,n,r,i)=>{let a=Array(e.length),o=n.current;for(let n=0,s=e.length;n<s;++n){if(i&&o.each&&o.each[n]===e[n]){a[n]=o.children?.[n];continue}let s=t(e[n],n);if(je.call(W,s.type)){o.block||=Me.call(W,s.type),a[n]=o.block(s.props,r,n);continue}if(typeof s.type==`function`&&`_c`in s.type){let e=s.type(s.props);if(je.call(W,e.type)){let t=Me.call(W,e.type);if(typeof t==`function`){a[n]=t(e.props);continue}}}let c=Lt(e=>e?.scope),l=(e,t,n)=>c({scope:en((0,U.createElement)(s.type,e),!1,t.current,n)},s.key?String(s.key):void 0);Ne.call(W,s.type,l),o.block=l,a[n]=l(s.props,r,n)}return o.each=e,o.children=a,a};function dn(e,t){return e===t||e!==e&&t!==t}function fn(e,t){for(let n in e)if(!dn(e[n],t[n]))return!0;return!1}function pn(e,{portals:t,...n}){let r=`CompiledBlock(Inner(${n.name}))`,i=ln(t=>e(t),{...n,scoped:void 0,name:r,shouldUpdate:fn}),a=t?.length||0,o=t&&a>0?e=>{let n=(0,U.useContext)(Zt),[r]=(0,U.useState)(()=>[]),o={...e,scoped:n};for(let e=0;e<a;e++){let n=t[e];o[n]=en(o[n],!1,r,e)}let s=[];for(let e=0,t=r.length;e<t;e++)s[e]=r[e].portal;return(0,U.createElement)(U.Fragment,null,(0,U.createElement)(i,o),s)}:e=>(0,U.createElement)(i,e);return n.name&&(o.displayName=`Million(CompiledBlock(Outer(${n.name})))`),o}typeof window<`u`&&(window.__MILLION_DATA__={version:`3.1.11`});var G=w(),mn=`AlertDialog`,[hn,gn]=b(mn,[se]),K=se(),_n=e=>{let{__scopeAlertDialog:t,...n}=e,r=K(t);return(0,G.jsx)(F,{...r,...n,modal:!0})};_n.displayName=mn;var vn=`AlertDialogTrigger`,yn=U.forwardRef((e,t)=>{let{__scopeAlertDialog:n,...r}=e,i=K(n);return(0,G.jsx)(me,{...i,...r,ref:t})});yn.displayName=vn;var bn=`AlertDialogPortal`,xn=e=>{let{__scopeAlertDialog:t,...n}=e,r=K(t);return(0,G.jsx)(xe,{...r,...n})};xn.displayName=bn;var Sn=`AlertDialogOverlay`,Cn=U.forwardRef((e,t)=>{let{__scopeAlertDialog:n,...r}=e,i=K(n);return(0,G.jsx)(de,{...i,...r,ref:t})});Cn.displayName=Sn;var wn=`AlertDialogContent`,[Tn,En]=hn(wn),Dn=le(`AlertDialogContent`),On=U.forwardRef((e,t)=>{let{__scopeAlertDialog:n,children:r,...i}=e,a=K(n),o=U.useRef(null),s=A(t,o),c=U.useRef(null);return(0,G.jsx)(fe,{contentName:wn,titleName:kn,docsSlug:`alert-dialog`,children:(0,G.jsx)(Tn,{scope:n,cancelRef:c,children:(0,G.jsxs)(ye,{role:`alertdialog`,...a,...i,ref:s,onOpenAutoFocus:C(i.onOpenAutoFocus,e=>{e.preventDefault(),c.current?.focus({preventScroll:!0})}),onPointerDownOutside:e=>e.preventDefault(),onInteractOutside:e=>e.preventDefault(),children:[(0,G.jsx)(Dn,{children:r}),(0,G.jsx)(Ln,{contentRef:o})]})})})});On.displayName=wn;var kn=`AlertDialogTitle`,An=U.forwardRef((e,t)=>{let{__scopeAlertDialog:n,...r}=e,i=K(n);return(0,G.jsx)(ae,{...i,...r,ref:t})});An.displayName=kn;var jn=`AlertDialogDescription`,Mn=U.forwardRef((e,t)=>{let{__scopeAlertDialog:n,...r}=e,i=K(n);return(0,G.jsx)(P,{...i,...r,ref:t})});Mn.displayName=jn;var Nn=`AlertDialogAction`,Pn=U.forwardRef((e,t)=>{let{__scopeAlertDialog:n,...r}=e,i=K(n);return(0,G.jsx)(pe,{...i,...r,ref:t})});Pn.displayName=Nn;var Fn=`AlertDialogCancel`,In=U.forwardRef((e,t)=>{let{__scopeAlertDialog:n,...r}=e,{cancelRef:i}=En(Fn,n),a=K(n),o=A(t,i);return(0,G.jsx)(pe,{...a,...r,ref:o})});In.displayName=Fn;var Ln=({contentRef:e})=>{let t=`\`${wn}\` requires a description for the component to be accessible for screen reader users.
|
|
4
|
+
|
|
5
|
+
You can add a description to the \`${wn}\` by passing a \`${jn}\` component as a child, which also benefits sighted users by adding visible context to the dialog.
|
|
6
|
+
|
|
7
|
+
Alternatively, you can use your own component as a description by assigning it an \`id\` and passing the same value to the \`aria-describedby\` prop in \`${wn}\`. If the description is confusing or duplicative for sighted users, you can use the \`@radix-ui/react-visually-hidden\` primitive as a wrapper around your description component.
|
|
8
|
+
|
|
9
|
+
For more information, see https://radix-ui.com/primitives/docs/components/alert-dialog`;return U.useEffect(()=>{document.getElementById(e.current?.getAttribute(`aria-describedby`))||console.warn(t)},[t,e]),null},Rn=_n,zn=xn,Bn=Cn,Vn=On,Hn=Pn,Un=In,Wn=An,Gn=Mn,Kn=Rn,qn=zn,Jn=U.forwardRef((e,t)=>{let n=(0,L.c)(9),r,i;n[0]===e?(r=n[1],i=n[2]):({className:r,...i}=e,n[0]=e,n[1]=r,n[2]=i);let a;n[3]===r?a=n[4]:(a=_(`fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0`,r),n[3]=r,n[4]=a);let o;return n[5]!==i||n[6]!==t||n[7]!==a?(o=(0,G.jsx)(Bn,{className:a,...i,ref:t}),n[5]=i,n[6]=t,n[7]=a,n[8]=o):o=n[8],o});Jn.displayName=Bn.displayName;var Yn=U.forwardRef((e,t)=>{let n=(0,L.c)(10),r,i;n[0]===e?(r=n[1],i=n[2]):({className:r,...i}=e,n[0]=e,n[1]=r,n[2]=i);let a;n[3]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,G.jsx)(Jn,{}),n[3]=a):a=n[3];let o;n[4]===r?o=n[5]:(o=_(`fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg`,r),n[4]=r,n[5]=o);let s;return n[6]!==i||n[7]!==t||n[8]!==o?(s=(0,G.jsxs)(qn,{children:[a,(0,G.jsx)(Vn,{ref:t,className:o,...i})]}),n[6]=i,n[7]=t,n[8]=o,n[9]=s):s=n[9],s});Yn.displayName=Vn.displayName;var Xn=e=>{let t=(0,L.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=_(`flex flex-col space-y-2 text-center sm:text-left`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,G.jsx)(`div`,{className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a};Xn.displayName=`AlertDialogHeader`;var Zn=e=>{let t=(0,L.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=_(`flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,G.jsx)(`div`,{className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a};Zn.displayName=`AlertDialogFooter`;var Qn=U.forwardRef((e,t)=>{let n=(0,L.c)(9),r,i;n[0]===e?(r=n[1],i=n[2]):({className:r,...i}=e,n[0]=e,n[1]=r,n[2]=i);let a;n[3]===r?a=n[4]:(a=_(I.dialogTitle,r),n[3]=r,n[4]=a);let o;return n[5]!==i||n[6]!==t||n[7]!==a?(o=(0,G.jsx)(Wn,{ref:t,className:a,...i}),n[5]=i,n[6]=t,n[7]=a,n[8]=o):o=n[8],o});Qn.displayName=Wn.displayName;var $n=U.forwardRef((e,t)=>{let n=(0,L.c)(9),r,i;n[0]===e?(r=n[1],i=n[2]):({className:r,...i}=e,n[0]=e,n[1]=r,n[2]=i);let a;n[3]===r?a=n[4]:(a=_(I.dialogDescription,r),n[3]=r,n[4]=a);let o;return n[5]!==i||n[6]!==t||n[7]!==a?(o=(0,G.jsx)(Gn,{ref:t,className:a,...i}),n[5]=i,n[6]=t,n[7]=a,n[8]=o):o=n[8],o});$n.displayName=Gn.displayName;var er=U.forwardRef((e,t)=>{let n=(0,L.c)(9),r,i;n[0]===e?(r=n[1],i=n[2]):({className:r,...i}=e,n[0]=e,n[1]=r,n[2]=i);let a;n[3]===r?a=n[4]:(a=_(f(),r),n[3]=r,n[4]=a);let o;return n[5]!==i||n[6]!==t||n[7]!==a?(o=(0,G.jsx)(Hn,{ref:t,className:a,...i}),n[5]=i,n[6]=t,n[7]=a,n[8]=o):o=n[8],o});er.displayName=Hn.displayName;var tr=U.forwardRef((e,t)=>{let n=(0,L.c)(9),r,i;n[0]===e?(r=n[1],i=n[2]):({className:r,...i}=e,n[0]=e,n[1]=r,n[2]=i);let a;n[3]===r?a=n[4]:(a=_(f({variant:`outline`}),`mt-2 sm:mt-0`,r),n[3]=r,n[4]=a);let o;return n[5]!==i||n[6]!==t||n[7]!==a?(o=(0,G.jsx)(Un,{ref:t,className:a,...i}),n[5]=i,n[6]=t,n[7]=a,n[8]=o):o=n[8],o});tr.displayName=Un.displayName;var nr=pn(e=>(0,G.jsxs)(`div`,{className:e.v0,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`h1`,{className:e.v1,children:e.v2}),e.v3]}),e.v4]}),{name:`PageHeader_1`,portals:[`v2`,`v3`,`v4`]}),rr=function(e){let t=(0,L.c)(12),{title:n,description:r,action:i,className:a,titleClassName:o}=e,s;t[0]===a?s=t[1]:(s=_(`flex items-center justify-between mb-6`,a),t[0]=a,t[1]=s);let c;t[2]===o?c=t[3]:(c=_(I.pageTitle,o),t[2]=o,t[3]=c);let l;t[4]===r?l=t[5]:(l=r?(0,G.jsx)(`p`,{className:I.pageSubtitle,children:r}):null,t[4]=r,t[5]=l);let u;return t[6]!==i||t[7]!==s||t[8]!==c||t[9]!==l||t[10]!==n?(u=(0,G.jsx)(nr,{v0:s,v1:c,v2:n,v3:l,v4:i}),t[6]=i,t[7]=s,t[8]=c,t[9]=l,t[10]=n,t[11]=u):u=t[11],u};function ir(e){let t=(0,L.c)(5),{children:n,className:r}=e,i;t[0]===r?i=t[1]:(i=_(he.settingsPage,r),t[0]=r,t[1]=i);let a;return t[2]!==n||t[3]!==i?(a=(0,G.jsx)(`div`,{className:i,children:n}),t[2]=n,t[3]=i,t[4]=a):a=t[4],a}function ar(e){let t=(0,L.c)(5),{children:n,className:r}=e,i;t[0]===r?i=t[1]:(i=_(he.accountPage,r),t[0]=r,t[1]=i);let a;return t[2]!==n||t[3]!==i?(a=(0,G.jsx)(`div`,{className:i,children:n}),t[2]=n,t[3]=i,t[4]=a):a=t[4],a}function or(e){let t=(0,L.c)(5),{children:n,className:r}=e,i;t[0]===r?i=t[1]:(i=_(he.formPage,r),t[0]=r,t[1]=i);let a;return t[2]!==n||t[3]!==i?(a=(0,G.jsx)(`div`,{className:i,children:n}),t[2]=n,t[3]=i,t[4]=a):a=t[4],a}function sr(e){let t=(0,L.c)(5),{title:n,className:r}=e,i;t[0]===r?i=t[1]:(i=_(I.sectionTitle,`mb-3`,r),t[0]=r,t[1]=i);let a;return t[2]!==i||t[3]!==n?(a=(0,G.jsx)(`h2`,{className:i,children:n}),t[2]=i,t[3]=n,t[4]=a):a=t[4],a}function cr(e){let t=(0,L.c)(6),{children:n,variant:r,className:i}=e,a=r===void 0?`info`:r,o;t[0]!==i||t[1]!==a?(o=_(a===`hint`?I.hintBanner:a===`success`?_(I.body,`text-green-700 bg-green-50 dark:text-green-400 dark:bg-green-950/30 rounded-md px-3 py-2 mb-4`):a===`error`?_(I.error,`bg-destructive/10 rounded-md px-3 py-2 mb-4`):I.infoBanner,i),t[0]=i,t[1]=a,t[2]=o):o=t[2];let s;return t[3]!==n||t[4]!==o?(s=(0,G.jsx)(`div`,{className:o,children:n}),t[3]=n,t[4]=o,t[5]=s):s=t[5],s}function lr(e){let t=(0,L.c)(5),{children:n,className:r}=e,i;t[0]===r?i=t[1]:(i=_(`flex-1 overflow-auto`,r),t[0]=r,t[1]=i);let a;return t[2]!==n||t[3]!==i?(a=(0,G.jsx)(`div`,{className:i,children:n}),t[2]=n,t[3]=i,t[4]=a):a=t[4],a}function ur(e){let t=(0,L.c)(10),{children:n,title:r,action:i}=e,a;t[0]===r?a=t[1]:(a=r?(0,G.jsx)(`h2`,{className:_(I.emptyStateTitle,`mb-2`),children:r}):null,t[0]=r,t[1]=a);let o;t[2]===n?o=t[3]:(o=(0,G.jsx)(`p`,{className:I.bodyMuted,children:n}),t[2]=n,t[3]=o);let s;t[4]===i?s=t[5]:(s=i?(0,G.jsx)(`div`,{className:`mt-4`,children:i}):null,t[4]=i,t[5]=s);let c;return t[6]!==a||t[7]!==o||t[8]!==s?(c=(0,G.jsx)(`div`,{className:`flex items-center justify-center h-full`,children:(0,G.jsxs)(`div`,{className:`text-center`,children:[a,o,s]})}),t[6]=a,t[7]=o,t[8]=s,t[9]=c):c=t[9],c}function dr(e){let t=(0,L.c)(5),{children:n,className:r}=e,i;t[0]===r?i=t[1]:(i=_(`h-full flex flex-col overflow-hidden`,r),t[0]=r,t[1]=i);let a;return t[2]!==n||t[3]!==i?(a=(0,G.jsx)(`div`,{className:i,children:n}),t[2]=n,t[3]=i,t[4]=a):a=t[4],a}function fr(e){let t=(0,L.c)(14),{title:n,description:r,action:i,children:a,className:o}=e,s;t[0]===n?s=t[1]:(s=(0,G.jsx)(sr,{title:n,className:`mb-1`}),t[0]=n,t[1]=s);let c;t[2]===r?c=t[3]:(c=r?(0,G.jsx)(`p`,{className:I.bodyMuted,children:r}):null,t[2]=r,t[3]=c);let l;t[4]!==s||t[5]!==c?(l=(0,G.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[s,c]}),t[4]=s,t[5]=c,t[6]=l):l=t[6];let u;t[7]!==i||t[8]!==l?(u=(0,G.jsxs)(`div`,{className:`flex items-start justify-between gap-4 mb-3`,children:[l,i]}),t[7]=i,t[8]=l,t[9]=u):u=t[9];let d;return t[10]!==a||t[11]!==o||t[12]!==u?(d=(0,G.jsxs)(`div`,{className:o,children:[u,a]}),t[10]=a,t[11]=o,t[12]=u,t[13]=d):d=t[13],d}function pr(e){let t=U.useRef({value:e,previous:e});return U.useMemo(()=>(t.current.value!==e&&(t.current.previous=t.current.value,t.current.value=e),t.current.previous),[e])}var mr=[` `,`Enter`,`ArrowUp`,`ArrowDown`],hr=[` `,`Enter`],q=`Select`,[gr,_r,vr]=ve(q),[yr,br]=b(q,[vr,h]),xr=h(),[Sr,J]=yr(q),[Cr,wr]=yr(q),Tr=e=>{let{__scopeSelect:t,children:n,open:i,defaultOpen:a,onOpenChange:o,value:s,defaultValue:c,onValueChange:l,dir:u,name:d,autoComplete:f,disabled:p,required:m,form:h}=e,g=xr(t),[_,v]=U.useState(null),[y,b]=U.useState(null),[x,S]=U.useState(!1),C=be(u),[ee,te]=r({prop:i,defaultProp:a??!1,onChange:o,caller:q}),[w,T]=r({prop:s,defaultProp:c,onChange:l,caller:q}),E=U.useRef(null),D=_?h||!!_.closest(`form`):!0,[O,k]=U.useState(new Set),A=Array.from(O).map(e=>e.props.value).join(`;`);return(0,G.jsx)(_e,{...g,children:(0,G.jsxs)(Sr,{required:m,scope:t,trigger:_,onTriggerChange:v,valueNode:y,onValueNodeChange:b,valueNodeHasChildren:x,onValueNodeHasChildrenChange:S,contentId:ce(),value:w,onValueChange:T,open:ee,onOpenChange:te,dir:C,triggerPointerDownPosRef:E,disabled:p,children:[(0,G.jsx)(gr.Provider,{scope:t,children:(0,G.jsx)(Cr,{scope:e.__scopeSelect,onNativeOptionAdd:U.useCallback(e=>{k(t=>new Set(t).add(e))},[]),onNativeOptionRemove:U.useCallback(e=>{k(t=>{let n=new Set(t);return n.delete(e),n})},[]),children:n})}),D?(0,G.jsxs)(_i,{"aria-hidden":!0,required:m,tabIndex:-1,name:d,autoComplete:f,value:w,onChange:e=>T(e.target.value),disabled:p,form:h,children:[w===void 0?(0,G.jsx)(`option`,{value:``}):null,Array.from(O)]},A):null]})})};Tr.displayName=q;var Er=`SelectTrigger`,Dr=U.forwardRef((e,t)=>{let{__scopeSelect:n,disabled:r=!1,...i}=e,a=xr(n),o=J(Er,n),c=o.disabled||r,l=A(t,o.onTriggerChange),u=_r(n),d=U.useRef(`touch`),[f,p,m]=yi(e=>{let t=u().filter(e=>!e.disabled),n=bi(t,e,t.find(e=>e.value===o.value));n!==void 0&&o.onValueChange(n.value)}),h=e=>{c||(o.onOpenChange(!0),m()),e&&(o.triggerPointerDownPosRef.current={x:Math.round(e.pageX),y:Math.round(e.pageY)})};return(0,G.jsx)(j,{asChild:!0,...a,children:(0,G.jsx)(s.button,{type:`button`,role:`combobox`,"aria-controls":o.contentId,"aria-expanded":o.open,"aria-required":o.required,"aria-autocomplete":`none`,dir:o.dir,"data-state":o.open?`open`:`closed`,disabled:c,"data-disabled":c?``:void 0,"data-placeholder":vi(o.value)?``:void 0,...i,ref:l,onClick:C(i.onClick,e=>{e.currentTarget.focus(),d.current!==`mouse`&&h(e)}),onPointerDown:C(i.onPointerDown,e=>{d.current=e.pointerType;let t=e.target;t.hasPointerCapture(e.pointerId)&&t.releasePointerCapture(e.pointerId),e.button===0&&e.ctrlKey===!1&&e.pointerType===`mouse`&&(h(e),e.preventDefault())}),onKeyDown:C(i.onKeyDown,e=>{let t=f.current!==``;!(e.ctrlKey||e.altKey||e.metaKey)&&e.key.length===1&&p(e.key),!(t&&e.key===` `)&&mr.includes(e.key)&&(h(),e.preventDefault())})})})});Dr.displayName=Er;var Or=`SelectValue`,kr=U.forwardRef((e,t)=>{let{__scopeSelect:n,className:r,style:i,children:a,placeholder:o=``,...c}=e,l=J(Or,n),{onValueNodeHasChildrenChange:u}=l,d=a!==void 0,f=A(t,l.onValueNodeChange);return y(()=>{u(d)},[u,d]),(0,G.jsx)(s.span,{...c,ref:f,style:{pointerEvents:`none`},children:vi(l.value)?(0,G.jsx)(G.Fragment,{children:o}):a})});kr.displayName=Or;var Ar=`SelectIcon`,jr=U.forwardRef((e,t)=>{let{__scopeSelect:n,children:r,...i}=e;return(0,G.jsx)(s.span,{"aria-hidden":!0,...i,ref:t,children:r||`▼`})});jr.displayName=Ar;var Mr=`SelectPortal`,Nr=e=>(0,G.jsx)(N,{asChild:!0,...e});Nr.displayName=Mr;var Y=`SelectContent`,Pr=U.forwardRef((e,t)=>{let n=J(Y,e.__scopeSelect),[r,i]=U.useState();if(y(()=>{i(new DocumentFragment)},[]),!n.open){let t=r;return t?Jt.createPortal((0,G.jsx)(Fr,{scope:e.__scopeSelect,children:(0,G.jsx)(gr.Slot,{scope:e.__scopeSelect,children:(0,G.jsx)(`div`,{children:e.children})})}),t):null}return(0,G.jsx)(Rr,{...e,ref:t})});Pr.displayName=Y;var X=10,[Fr,Z]=yr(Y),Ir=`SelectContentImpl`,Lr=S(`SelectContent.RemoveScroll`),Rr=U.forwardRef((e,t)=>{let{__scopeSelect:n,position:r=`item-aligned`,onCloseAutoFocus:i,onEscapeKeyDown:a,onPointerDownOutside:s,side:c,sideOffset:l,align:u,alignOffset:d,arrowPadding:f,collisionBoundary:p,collisionPadding:m,sticky:h,hideWhenDetached:g,avoidCollisions:_,...v}=e,y=J(Y,n),[b,x]=U.useState(null),[S,ee]=U.useState(null),te=A(t,e=>x(e)),[w,T]=U.useState(null),[E,D]=U.useState(null),O=_r(n),[k,j]=U.useState(!1),M=U.useRef(!1);U.useEffect(()=>{if(b)return oe(b)},[b]),Se();let N=U.useCallback(e=>{let[t,...n]=O().map(e=>e.ref.current),[r]=n.slice(-1),i=document.activeElement;for(let n of e)if(n===i||(n?.scrollIntoView({block:`nearest`}),n===t&&S&&(S.scrollTop=0),n===r&&S&&(S.scrollTop=S.scrollHeight),n?.focus(),document.activeElement!==i))return},[O,S]),re=U.useCallback(()=>N([w,b]),[N,w,b]);U.useEffect(()=>{k&&re()},[k,re]);let{onOpenChange:P,triggerPointerDownPosRef:F}=y;U.useEffect(()=>{if(b){let e={x:0,y:0},t=t=>{e={x:Math.abs(Math.round(t.pageX)-(F.current?.x??0)),y:Math.abs(Math.round(t.pageY)-(F.current?.y??0))}},n=n=>{e.x<=10&&e.y<=10?n.preventDefault():b.contains(n.target)||P(!1),document.removeEventListener(`pointermove`,t),F.current=null};return F.current!==null&&(document.addEventListener(`pointermove`,t),document.addEventListener(`pointerup`,n,{capture:!0,once:!0})),()=>{document.removeEventListener(`pointermove`,t),document.removeEventListener(`pointerup`,n,{capture:!0})}}},[b,P,F]),U.useEffect(()=>{let e=()=>P(!1);return window.addEventListener(`blur`,e),window.addEventListener(`resize`,e),()=>{window.removeEventListener(`blur`,e),window.removeEventListener(`resize`,e)}},[P]);let[ie,ae]=yi(e=>{let t=O().filter(e=>!e.disabled),n=bi(t,e,t.find(e=>e.ref.current===document.activeElement));n&&setTimeout(()=>n.ref.current.focus())}),se=U.useCallback((e,t,n)=>{let r=!M.current&&!n;(y.value!==void 0&&y.value===t||r)&&(T(e),r&&(M.current=!0))},[y.value]),ce=U.useCallback(()=>b?.focus(),[b]),le=U.useCallback((e,t,n)=>{let r=!M.current&&!n;(y.value!==void 0&&y.value===t||r)&&D(e)},[y.value]),ue=r===`popper`?Hr:Br,de=ue===Hr?{side:c,sideOffset:l,align:u,alignOffset:d,arrowPadding:f,collisionBoundary:p,collisionPadding:m,sticky:h,hideWhenDetached:g,avoidCollisions:_}:{};return(0,G.jsx)(Fr,{scope:n,content:b,viewport:S,onViewportChange:ee,itemRefCallback:se,selectedItem:w,onItemLeave:ce,itemTextRefCallback:le,focusSelectedItem:re,selectedItemText:E,position:r,isPositioned:k,searchRef:ie,children:(0,G.jsx)(ne,{as:Lr,allowPinchZoom:!0,children:(0,G.jsx)(Ce,{asChild:!0,trapped:y.open,onMountAutoFocus:e=>{e.preventDefault()},onUnmountAutoFocus:C(i,e=>{y.trigger?.focus({preventScroll:!0}),e.preventDefault()}),children:(0,G.jsx)(o,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:a,onPointerDownOutside:s,onFocusOutside:e=>e.preventDefault(),onDismiss:()=>y.onOpenChange(!1),children:(0,G.jsx)(ue,{role:`listbox`,id:y.contentId,"data-state":y.open?`open`:`closed`,dir:y.dir,onContextMenu:e=>e.preventDefault(),...v,...de,onPlaced:()=>j(!0),ref:te,style:{display:`flex`,flexDirection:`column`,outline:`none`,...v.style},onKeyDown:C(v.onKeyDown,e=>{let t=e.ctrlKey||e.altKey||e.metaKey;if(e.key===`Tab`&&e.preventDefault(),!t&&e.key.length===1&&ae(e.key),[`ArrowUp`,`ArrowDown`,`Home`,`End`].includes(e.key)){let t=O().filter(e=>!e.disabled).map(e=>e.ref.current);if([`ArrowUp`,`End`].includes(e.key)&&(t=t.slice().reverse()),[`ArrowUp`,`ArrowDown`].includes(e.key)){let n=e.target,r=t.indexOf(n);t=t.slice(r+1)}setTimeout(()=>N(t)),e.preventDefault()}})})})})})})});Rr.displayName=Ir;var zr=`SelectItemAlignedPosition`,Br=U.forwardRef((e,t)=>{let{__scopeSelect:n,onPlaced:r,...i}=e,a=J(Y,n),o=Z(Y,n),[c,l]=U.useState(null),[u,d]=U.useState(null),f=A(t,e=>d(e)),p=_r(n),m=U.useRef(!1),h=U.useRef(!0),{viewport:g,selectedItem:_,selectedItemText:v,focusSelectedItem:b}=o,x=U.useCallback(()=>{if(a.trigger&&a.valueNode&&c&&u&&g&&_&&v){let e=a.trigger.getBoundingClientRect(),t=u.getBoundingClientRect(),n=a.valueNode.getBoundingClientRect(),i=v.getBoundingClientRect();if(a.dir!==`rtl`){let r=i.left-t.left,a=n.left-r,o=e.left-a,s=e.width+o,l=Math.max(s,t.width),u=window.innerWidth-X,d=ue(a,[X,Math.max(X,u-l)]);c.style.minWidth=s+`px`,c.style.left=d+`px`}else{let r=t.right-i.right,a=window.innerWidth-n.right-r,o=window.innerWidth-e.right-a,s=e.width+o,l=Math.max(s,t.width),u=window.innerWidth-X,d=ue(a,[X,Math.max(X,u-l)]);c.style.minWidth=s+`px`,c.style.right=d+`px`}let o=p(),s=window.innerHeight-X*2,l=g.scrollHeight,d=window.getComputedStyle(u),f=parseInt(d.borderTopWidth,10),h=parseInt(d.paddingTop,10),y=parseInt(d.borderBottomWidth,10),b=parseInt(d.paddingBottom,10),x=f+h+l+b+y,S=Math.min(_.offsetHeight*5,x),C=window.getComputedStyle(g),ee=parseInt(C.paddingTop,10),te=parseInt(C.paddingBottom,10),w=e.top+e.height/2-X,T=s-w,E=_.offsetHeight/2,D=_.offsetTop+E,O=f+h+D,k=x-O;if(O<=w){let e=o.length>0&&_===o[o.length-1].ref.current;c.style.bottom=`0px`;let t=u.clientHeight-g.offsetTop-g.offsetHeight,n=O+Math.max(T,E+(e?te:0)+t+y);c.style.height=n+`px`}else{let e=o.length>0&&_===o[0].ref.current;c.style.top=`0px`;let t=Math.max(w,f+g.offsetTop+(e?ee:0)+E)+k;c.style.height=t+`px`,g.scrollTop=O-w+g.offsetTop}c.style.margin=`${X}px 0`,c.style.minHeight=S+`px`,c.style.maxHeight=s+`px`,r?.(),requestAnimationFrame(()=>m.current=!0)}},[p,a.trigger,a.valueNode,c,u,g,_,v,a.dir,r]);y(()=>x(),[x]);let[S,C]=U.useState();return y(()=>{u&&C(window.getComputedStyle(u).zIndex)},[u]),(0,G.jsx)(Ur,{scope:n,contentWrapper:c,shouldExpandOnScrollRef:m,onScrollButtonChange:U.useCallback(e=>{e&&h.current===!0&&(x(),b?.(),h.current=!1)},[x,b]),children:(0,G.jsx)(`div`,{ref:l,style:{display:`flex`,flexDirection:`column`,position:`fixed`,zIndex:S},children:(0,G.jsx)(s.div,{...i,ref:f,style:{boxSizing:`border-box`,maxHeight:`100%`,...i.style}})})})});Br.displayName=zr;var Vr=`SelectPopperPosition`,Hr=U.forwardRef((e,t)=>{let{__scopeSelect:n,align:r=`start`,collisionPadding:i=X,...a}=e,o=xr(n);return(0,G.jsx)(g,{...o,...a,ref:t,align:r,collisionPadding:i,style:{boxSizing:`border-box`,...a.style,"--radix-select-content-transform-origin":`var(--radix-popper-transform-origin)`,"--radix-select-content-available-width":`var(--radix-popper-available-width)`,"--radix-select-content-available-height":`var(--radix-popper-available-height)`,"--radix-select-trigger-width":`var(--radix-popper-anchor-width)`,"--radix-select-trigger-height":`var(--radix-popper-anchor-height)`}})});Hr.displayName=Vr;var[Ur,Wr]=yr(Y,{}),Gr=`SelectViewport`,Kr=U.forwardRef((e,t)=>{let{__scopeSelect:n,nonce:r,...i}=e,a=Z(Gr,n),o=Wr(Gr,n),c=A(t,a.onViewportChange),l=U.useRef(0);return(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(`style`,{dangerouslySetInnerHTML:{__html:`[data-radix-select-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-select-viewport]::-webkit-scrollbar{display:none}`},nonce:r}),(0,G.jsx)(gr.Slot,{scope:n,children:(0,G.jsx)(s.div,{"data-radix-select-viewport":``,role:`presentation`,...i,ref:c,style:{position:`relative`,flex:1,overflow:`hidden auto`,...i.style},onScroll:C(i.onScroll,e=>{let t=e.currentTarget,{contentWrapper:n,shouldExpandOnScrollRef:r}=o;if(r?.current&&n){let e=Math.abs(l.current-t.scrollTop);if(e>0){let r=window.innerHeight-X*2,i=parseFloat(n.style.minHeight),a=parseFloat(n.style.height),o=Math.max(i,a);if(o<r){let i=o+e,a=Math.min(r,i),s=i-a;n.style.height=a+`px`,n.style.bottom===`0px`&&(t.scrollTop=s>0?s:0,n.style.justifyContent=`flex-end`)}}}l.current=t.scrollTop})})})]})});Kr.displayName=Gr;var qr=`SelectGroup`,[Jr,Yr]=yr(qr),Xr=U.forwardRef((e,t)=>{let{__scopeSelect:n,...r}=e,i=ce();return(0,G.jsx)(Jr,{scope:n,id:i,children:(0,G.jsx)(s.div,{role:`group`,"aria-labelledby":i,...r,ref:t})})});Xr.displayName=qr;var Zr=`SelectLabel`,Qr=U.forwardRef((e,t)=>{let{__scopeSelect:n,...r}=e,i=Yr(Zr,n);return(0,G.jsx)(s.div,{id:i.id,...r,ref:t})});Qr.displayName=Zr;var $r=`SelectItem`,[ei,ti]=yr($r),ni=U.forwardRef((e,t)=>{let{__scopeSelect:n,value:r,disabled:i=!1,textValue:a,...o}=e,c=J($r,n),l=Z($r,n),u=c.value===r,[d,f]=U.useState(a??``),[p,m]=U.useState(!1),h=A(t,e=>l.itemRefCallback?.(e,r,i)),g=ce(),_=U.useRef(`touch`),v=()=>{i||(c.onValueChange(r),c.onOpenChange(!1))};if(r===``)throw Error(`A <Select.Item /> must have a value prop that is not an empty string. This is because the Select value can be set to an empty string to clear the selection and show the placeholder.`);return(0,G.jsx)(ei,{scope:n,value:r,disabled:i,textId:g,isSelected:u,onItemTextChange:U.useCallback(e=>{f(t=>t||(e?.textContent??``).trim())},[]),children:(0,G.jsx)(gr.ItemSlot,{scope:n,value:r,disabled:i,textValue:d,children:(0,G.jsx)(s.div,{role:`option`,"aria-labelledby":g,"data-highlighted":p?``:void 0,"aria-selected":u&&p,"data-state":u?`checked`:`unchecked`,"aria-disabled":i||void 0,"data-disabled":i?``:void 0,tabIndex:i?void 0:-1,...o,ref:h,onFocus:C(o.onFocus,()=>m(!0)),onBlur:C(o.onBlur,()=>m(!1)),onClick:C(o.onClick,()=>{_.current!==`mouse`&&v()}),onPointerUp:C(o.onPointerUp,()=>{_.current===`mouse`&&v()}),onPointerDown:C(o.onPointerDown,e=>{_.current=e.pointerType}),onPointerMove:C(o.onPointerMove,e=>{_.current=e.pointerType,i?l.onItemLeave?.():_.current===`mouse`&&e.currentTarget.focus({preventScroll:!0})}),onPointerLeave:C(o.onPointerLeave,e=>{e.currentTarget===document.activeElement&&l.onItemLeave?.()}),onKeyDown:C(o.onKeyDown,e=>{l.searchRef?.current!==``&&e.key===` `||(hr.includes(e.key)&&v(),e.key===` `&&e.preventDefault())})})})})});ni.displayName=$r;var ri=`SelectItemText`,ii=U.forwardRef((e,t)=>{let{__scopeSelect:n,className:r,style:i,...a}=e,o=J(ri,n),c=Z(ri,n),l=ti(ri,n),u=wr(ri,n),[d,f]=U.useState(null),p=A(t,e=>f(e),l.onItemTextChange,e=>c.itemTextRefCallback?.(e,l.value,l.disabled)),m=d?.textContent,h=U.useMemo(()=>(0,G.jsx)(`option`,{value:l.value,disabled:l.disabled,children:m},l.value),[l.disabled,l.value,m]),{onNativeOptionAdd:g,onNativeOptionRemove:_}=u;return y(()=>(g(h),()=>_(h)),[g,_,h]),(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(s.span,{id:l.textId,...a,ref:p}),l.isSelected&&o.valueNode&&!o.valueNodeHasChildren?Jt.createPortal(a.children,o.valueNode):null]})});ii.displayName=ri;var ai=`SelectItemIndicator`,oi=U.forwardRef((e,t)=>{let{__scopeSelect:n,...r}=e;return ti(ai,n).isSelected?(0,G.jsx)(s.span,{"aria-hidden":!0,...r,ref:t}):null});oi.displayName=ai;var si=`SelectScrollUpButton`,ci=U.forwardRef((e,t)=>{let n=Z(si,e.__scopeSelect),r=Wr(si,e.__scopeSelect),[i,a]=U.useState(!1),o=A(t,r.onScrollButtonChange);return y(()=>{if(n.viewport&&n.isPositioned){let e=function(){a(t.scrollTop>0)},t=n.viewport;return e(),t.addEventListener(`scroll`,e),()=>t.removeEventListener(`scroll`,e)}},[n.viewport,n.isPositioned]),i?(0,G.jsx)(di,{...e,ref:o,onAutoScroll:()=>{let{viewport:e,selectedItem:t}=n;e&&t&&(e.scrollTop-=t.offsetHeight)}}):null});ci.displayName=si;var li=`SelectScrollDownButton`,ui=U.forwardRef((e,t)=>{let n=Z(li,e.__scopeSelect),r=Wr(li,e.__scopeSelect),[i,a]=U.useState(!1),o=A(t,r.onScrollButtonChange);return y(()=>{if(n.viewport&&n.isPositioned){let e=function(){let e=t.scrollHeight-t.clientHeight;a(Math.ceil(t.scrollTop)<e)},t=n.viewport;return e(),t.addEventListener(`scroll`,e),()=>t.removeEventListener(`scroll`,e)}},[n.viewport,n.isPositioned]),i?(0,G.jsx)(di,{...e,ref:o,onAutoScroll:()=>{let{viewport:e,selectedItem:t}=n;e&&t&&(e.scrollTop+=t.offsetHeight)}}):null});ui.displayName=li;var di=U.forwardRef((e,t)=>{let{__scopeSelect:n,onAutoScroll:r,...i}=e,a=Z(`SelectScrollButton`,n),o=U.useRef(null),c=_r(n),l=U.useCallback(()=>{o.current!==null&&(window.clearInterval(o.current),o.current=null)},[]);return U.useEffect(()=>()=>l(),[l]),y(()=>{c().find(e=>e.ref.current===document.activeElement)?.ref.current?.scrollIntoView({block:`nearest`})},[c]),(0,G.jsx)(s.div,{"aria-hidden":!0,...i,ref:t,style:{flexShrink:0,...i.style},onPointerDown:C(i.onPointerDown,()=>{o.current===null&&(o.current=window.setInterval(r,50))}),onPointerMove:C(i.onPointerMove,()=>{a.onItemLeave?.(),o.current===null&&(o.current=window.setInterval(r,50))}),onPointerLeave:C(i.onPointerLeave,()=>{l()})})}),fi=`SelectSeparator`,pi=U.forwardRef((e,t)=>{let{__scopeSelect:n,...r}=e;return(0,G.jsx)(s.div,{"aria-hidden":!0,...r,ref:t})});pi.displayName=fi;var mi=`SelectArrow`,hi=U.forwardRef((e,t)=>{let{__scopeSelect:n,...r}=e,i=xr(n),a=J(mi,n),o=Z(mi,n);return a.open&&o.position===`popper`?(0,G.jsx)(u,{...i,...r,ref:t}):null});hi.displayName=mi;var gi=`SelectBubbleInput`,_i=U.forwardRef(({__scopeSelect:e,value:t,...n},r)=>{let i=U.useRef(null),a=A(r,i),o=pr(t);return U.useEffect(()=>{let e=i.current;if(!e)return;let n=window.HTMLSelectElement.prototype,r=Object.getOwnPropertyDescriptor(n,`value`).set;if(o!==t&&r){let n=new Event(`change`,{bubbles:!0});r.call(e,t),e.dispatchEvent(n)}},[o,t]),(0,G.jsx)(s.select,{...n,style:{...d,...n.style},ref:a,defaultValue:t})});_i.displayName=gi;function vi(e){return e===``||e===void 0}function yi(e){let t=T(e),n=U.useRef(``),r=U.useRef(0),i=U.useCallback(e=>{let i=n.current+e;t(i),(function e(t){n.current=t,window.clearTimeout(r.current),t!==``&&(r.current=window.setTimeout(()=>e(``),1e3))})(i)},[t]),a=U.useCallback(()=>{n.current=``,window.clearTimeout(r.current)},[]);return U.useEffect(()=>()=>window.clearTimeout(r.current),[]),[n,i,a]}function bi(e,t,n){let r=t.length>1&&Array.from(t).every(e=>e===t[0])?t[0]:t,i=n?e.indexOf(n):-1,a=xi(e,Math.max(i,0));r.length===1&&(a=a.filter(e=>e!==n));let o=a.find(e=>e.textValue.toLowerCase().startsWith(r.toLowerCase()));return o===n?void 0:o}function xi(e,t){return e.map((n,r)=>e[(t+r)%e.length])}var Si=Tr,Ci=Dr,wi=kr,Ti=jr,Ei=Nr,Di=Pr,Oi=Kr,ki=Qr,Ai=ni,ji=ii,Mi=oi,Ni=ci,Pi=ui,Fi=pi,Ii=Si,Li=wi,Ri=U.forwardRef((e,t)=>{let n=(0,L.c)(12),r,i,a;n[0]===e?(r=n[1],i=n[2],a=n[3]):({className:i,children:r,...a}=e,n[0]=e,n[1]=r,n[2]=i,n[3]=a);let o;n[4]===i?o=n[5]:(o=_(`flex h-10 w-full items-center justify-between rounded-md border border-input bg-background px-3 py-2 text-base ring-offset-background placeholder:text-muted-foreground focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 [&>span]:line-clamp-1`,i),n[4]=i,n[5]=o);let s;n[6]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,G.jsx)(Ti,{asChild:!0,children:(0,G.jsx)(p,{className:`h-4 w-4 opacity-50`})}),n[6]=s):s=n[6];let c;return n[7]!==r||n[8]!==a||n[9]!==t||n[10]!==o?(c=(0,G.jsxs)(Ci,{ref:t,className:o,...a,children:[r,s]}),n[7]=r,n[8]=a,n[9]=t,n[10]=o,n[11]=c):c=n[11],c});Ri.displayName=Ci.displayName;var zi=U.forwardRef((e,t)=>{let n=(0,L.c)(10),r,i;n[0]===e?(r=n[1],i=n[2]):({className:r,...i}=e,n[0]=e,n[1]=r,n[2]=i);let a;n[3]===r?a=n[4]:(a=_(`flex cursor-default items-center justify-center py-1`,r),n[3]=r,n[4]=a);let o;n[5]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,G.jsx)(x,{className:`h-4 w-4`}),n[5]=o):o=n[5];let s;return n[6]!==i||n[7]!==t||n[8]!==a?(s=(0,G.jsx)(Ni,{ref:t,className:a,...i,children:o}),n[6]=i,n[7]=t,n[8]=a,n[9]=s):s=n[9],s});zi.displayName=Ni.displayName;var Bi=U.forwardRef((e,t)=>{let n=(0,L.c)(10),r,i;n[0]===e?(r=n[1],i=n[2]):({className:r,...i}=e,n[0]=e,n[1]=r,n[2]=i);let a;n[3]===r?a=n[4]:(a=_(`flex cursor-default items-center justify-center py-1`,r),n[3]=r,n[4]=a);let o;n[5]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,G.jsx)(p,{className:`h-4 w-4`}),n[5]=o):o=n[5];let s;return n[6]!==i||n[7]!==t||n[8]!==a?(s=(0,G.jsx)(Pi,{ref:t,className:a,...i,children:o}),n[6]=i,n[7]=t,n[8]=a,n[9]=s):s=n[9],s});Bi.displayName=Pi.displayName;var Vi=U.forwardRef((e,t)=>{let n=(0,L.c)(21),r,i,a,o;n[0]===e?(r=n[1],i=n[2],a=n[3],o=n[4]):({className:i,children:r,position:o,...a}=e,n[0]=e,n[1]=r,n[2]=i,n[3]=a,n[4]=o);let s=o===void 0?`popper`:o,c=s===`popper`&&`data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1`,l;n[5]!==i||n[6]!==c?(l=_(`relative z-50 max-h-96 min-w-[8rem] overflow-hidden rounded-md border bg-popover text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-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`,c,i),n[5]=i,n[6]=c,n[7]=l):l=n[7];let u;n[8]===Symbol.for(`react.memo_cache_sentinel`)?(u=(0,G.jsx)(zi,{}),n[8]=u):u=n[8];let d=s===`popper`&&`h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]`,f;n[9]===d?f=n[10]:(f=_(`p-1`,d),n[9]=d,n[10]=f);let p;n[11]!==r||n[12]!==f?(p=(0,G.jsx)(Oi,{className:f,children:r}),n[11]=r,n[12]=f,n[13]=p):p=n[13];let m;n[14]===Symbol.for(`react.memo_cache_sentinel`)?(m=(0,G.jsx)(Bi,{}),n[14]=m):m=n[14];let h;return n[15]!==s||n[16]!==a||n[17]!==t||n[18]!==l||n[19]!==p?(h=(0,G.jsx)(Ei,{children:(0,G.jsxs)(Di,{ref:t,className:l,position:s,...a,children:[u,p,m]})}),n[15]=s,n[16]=a,n[17]=t,n[18]=l,n[19]=p,n[20]=h):h=n[20],h});Vi.displayName=Di.displayName;var Hi=U.forwardRef((e,t)=>{let n=(0,L.c)(9),r,i;n[0]===e?(r=n[1],i=n[2]):({className:r,...i}=e,n[0]=e,n[1]=r,n[2]=i);let a;n[3]===r?a=n[4]:(a=_(`py-1.5 pl-8 pr-2 text-base font-semibold`,r),n[3]=r,n[4]=a);let o;return n[5]!==i||n[6]!==t||n[7]!==a?(o=(0,G.jsx)(ki,{ref:t,className:a,...i}),n[5]=i,n[6]=t,n[7]=a,n[8]=o):o=n[8],o});Hi.displayName=ki.displayName;var Ui=U.forwardRef((e,t)=>{let n=(0,L.c)(14),r,i,a;n[0]===e?(r=n[1],i=n[2],a=n[3]):({className:i,children:r,...a}=e,n[0]=e,n[1]=r,n[2]=i,n[3]=a);let o;n[4]===i?o=n[5]:(o=_(`relative flex w-full cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-base outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50`,i),n[4]=i,n[5]=o);let s;n[6]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,G.jsx)(`span`,{className:`absolute left-2 flex h-3.5 w-3.5 items-center justify-center`,children:(0,G.jsx)(Mi,{children:(0,G.jsx)(v,{className:`h-4 w-4`})})}),n[6]=s):s=n[6];let c;n[7]===r?c=n[8]:(c=(0,G.jsx)(ji,{children:r}),n[7]=r,n[8]=c);let l;return n[9]!==a||n[10]!==t||n[11]!==o||n[12]!==c?(l=(0,G.jsxs)(Ai,{ref:t,className:o,...a,children:[s,c]}),n[9]=a,n[10]=t,n[11]=o,n[12]=c,n[13]=l):l=n[13],l});Ui.displayName=Ai.displayName;var Wi=U.forwardRef((e,t)=>{let n=(0,L.c)(9),r,i;n[0]===e?(r=n[1],i=n[2]):({className:r,...i}=e,n[0]=e,n[1]=r,n[2]=i);let a;n[3]===r?a=n[4]:(a=_(`-mx-1 my-1 h-px bg-muted`,r),n[3]=r,n[4]=a);let o;return n[5]!==i||n[6]!==t||n[7]!==a?(o=(0,G.jsx)(Fi,{ref:t,className:a,...i}),n[5]=i,n[6]=t,n[7]=a,n[8]=o):o=n[8],o});Wi.displayName=Fi.displayName;function Gi(e){let t=(0,L.c)(14),{className:n,label:r,size:i}=e,a=i===void 0?`md`:i,o=a===`sm`?`h-4 w-4`:a===`lg`?`h-8 w-8`:`h-6 w-6`,s;t[0]===n?s=t[1]:(s=_(`flex h-full items-center justify-center`,n),t[0]=n,t[1]=s);let c;t[2]===o?c=t[3]:(c=_(o,`animate-spin mx-auto text-muted-foreground`),t[2]=o,t[3]=c);let l;t[4]===c?l=t[5]:(l=(0,G.jsx)(D,{className:c}),t[4]=c,t[5]=l);let u;t[6]===r?u=t[7]:(u=r?(0,G.jsx)(`p`,{className:_(I.bodyMuted,`mt-2`),children:r}):null,t[6]=r,t[7]=u);let d;t[8]!==l||t[9]!==u?(d=(0,G.jsxs)(`div`,{className:`text-center`,children:[l,u]}),t[8]=l,t[9]=u,t[10]=d):d=t[10];let f;return t[11]!==s||t[12]!==d?(f=(0,G.jsx)(`div`,{className:s,children:d}),t[11]=s,t[12]=d,t[13]=f):f=t[13],f}function Ki(){let e=(0,L.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,G.jsx)(`div`,{className:`space-y-1 px-2 py-2`,children:[1,2,3].map(qi)}),e[0]=t):t=e[0],t}function qi(e){return(0,G.jsx)(`div`,{className:`animate-pulse h-7 bg-muted rounded-full`},e)}function Ji(){let e=(0,L.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,G.jsx)(`div`,{className:`animate-pulse h-4 bg-muted rounded mx-4 my-1`}),e[0]=t):t=e[0],t}var Yi=new Map;function Xi(e,t){let n=Yi.get(e);return n||(n={promise:t().catch(t=>{throw Yi.delete(e),t})},Yi.set(e,n)),n.promise}function Zi(e){Yi.delete(e)}function Qi(e){for(let t of Yi.keys())t.startsWith(e)&&Yi.delete(t)}function $i(e,t){return(0,U.use)(Xi(e,t))}var ea=U.forwardRef((e,t)=>{let n=(0,L.c)(9),r,i;n[0]===e?(r=n[1],i=n[2]):({className:r,...i}=e,n[0]=e,n[1]=r,n[2]=i);let a;n[3]===r?a=n[4]:(a=_(`w-full caption-bottom`,I.body,r),n[3]=r,n[4]=a);let o;return n[5]!==i||n[6]!==t||n[7]!==a?(o=(0,G.jsx)(`div`,{className:`relative w-full overflow-auto`,children:(0,G.jsx)(`table`,{ref:t,className:a,...i})}),n[5]=i,n[6]=t,n[7]=a,n[8]=o):o=n[8],o});ea.displayName=`Table`;var ta=U.forwardRef((e,t)=>{let n=(0,L.c)(9),r,i;n[0]===e?(r=n[1],i=n[2]):({className:r,...i}=e,n[0]=e,n[1]=r,n[2]=i);let a;n[3]===r?a=n[4]:(a=_(`[&_tr]:border-b`,r),n[3]=r,n[4]=a);let o;return n[5]!==i||n[6]!==t||n[7]!==a?(o=(0,G.jsx)(`thead`,{ref:t,className:a,...i}),n[5]=i,n[6]=t,n[7]=a,n[8]=o):o=n[8],o});ta.displayName=`TableHeader`;var na=U.forwardRef((e,t)=>{let n=(0,L.c)(9),r,i;n[0]===e?(r=n[1],i=n[2]):({className:r,...i}=e,n[0]=e,n[1]=r,n[2]=i);let a;n[3]===r?a=n[4]:(a=_(`[&_tr:last-child]:border-0`,r),n[3]=r,n[4]=a);let o;return n[5]!==i||n[6]!==t||n[7]!==a?(o=(0,G.jsx)(`tbody`,{ref:t,className:a,...i}),n[5]=i,n[6]=t,n[7]=a,n[8]=o):o=n[8],o});na.displayName=`TableBody`;var ra=U.forwardRef((e,t)=>{let n=(0,L.c)(9),r,i;n[0]===e?(r=n[1],i=n[2]):({className:r,...i}=e,n[0]=e,n[1]=r,n[2]=i);let a;n[3]===r?a=n[4]:(a=_(`border-t bg-muted/50 font-medium [&>tr]:last:border-b-0`,r),n[3]=r,n[4]=a);let o;return n[5]!==i||n[6]!==t||n[7]!==a?(o=(0,G.jsx)(`tfoot`,{ref:t,className:a,...i}),n[5]=i,n[6]=t,n[7]=a,n[8]=o):o=n[8],o});ra.displayName=`TableFooter`;var ia=U.forwardRef((e,t)=>{let n=(0,L.c)(9),r,i;n[0]===e?(r=n[1],i=n[2]):({className:r,...i}=e,n[0]=e,n[1]=r,n[2]=i);let a;n[3]===r?a=n[4]:(a=_(`border-b transition-colors hover:bg-muted/50 data-[state=selected]:bg-muted`,r),n[3]=r,n[4]=a);let o;return n[5]!==i||n[6]!==t||n[7]!==a?(o=(0,G.jsx)(`tr`,{ref:t,className:a,...i}),n[5]=i,n[6]=t,n[7]=a,n[8]=o):o=n[8],o});ia.displayName=`TableRow`;var Q=U.forwardRef((e,t)=>{let n=(0,L.c)(9),r,i;n[0]===e?(r=n[1],i=n[2]):({className:r,...i}=e,n[0]=e,n[1]=r,n[2]=i);let a;n[3]===r?a=n[4]:(a=_(`h-12 px-4 text-left align-middle font-medium text-muted-foreground [&:has([role=checkbox])]:pr-0`,r),n[3]=r,n[4]=a);let o;return n[5]!==i||n[6]!==t||n[7]!==a?(o=(0,G.jsx)(`th`,{ref:t,className:a,...i}),n[5]=i,n[6]=t,n[7]=a,n[8]=o):o=n[8],o});Q.displayName=`TableHead`;var $=U.forwardRef((e,t)=>{let n=(0,L.c)(9),r,i;n[0]===e?(r=n[1],i=n[2]):({className:r,...i}=e,n[0]=e,n[1]=r,n[2]=i);let a;n[3]===r?a=n[4]:(a=_(`p-4 align-middle [&:has([role=checkbox])]:pr-0`,r),n[3]=r,n[4]=a);let o;return n[5]!==i||n[6]!==t||n[7]!==a?(o=(0,G.jsx)(`td`,{ref:t,className:a,...i}),n[5]=i,n[6]=t,n[7]=a,n[8]=o):o=n[8],o});$.displayName=`TableCell`;var aa=U.forwardRef((e,t)=>{let n=(0,L.c)(9),r,i;n[0]===e?(r=n[1],i=n[2]):({className:r,...i}=e,n[0]=e,n[1]=r,n[2]=i);let a;n[3]===r?a=n[4]:(a=_(I.caption,`mt-4`,r),n[3]=r,n[4]=a);let o;return n[5]!==i||n[6]!==t||n[7]!==a?(o=(0,G.jsx)(`caption`,{ref:t,className:a,...i}),n[5]=i,n[6]=t,n[7]=a,n[8]=o):o=n[8],o});aa.displayName=`TableCaption`;var oa=U.forwardRef((e,t)=>{let n=(0,L.c)(9),r,i;n[0]===e?(r=n[1],i=n[2]):({className:r,...i}=e,n[0]=e,n[1]=r,n[2]=i);let a;n[3]===r?a=n[4]:(a=_(`rounded-lg border bg-card text-card-foreground shadow-sm`,r),n[3]=r,n[4]=a);let o;return n[5]!==i||n[6]!==t||n[7]!==a?(o=(0,G.jsx)(`div`,{ref:t,className:a,...i}),n[5]=i,n[6]=t,n[7]=a,n[8]=o):o=n[8],o});oa.displayName=`Card`;var sa=U.forwardRef((e,t)=>{let n=(0,L.c)(9),r,i;n[0]===e?(r=n[1],i=n[2]):({className:r,...i}=e,n[0]=e,n[1]=r,n[2]=i);let a;n[3]===r?a=n[4]:(a=_(`flex flex-col space-y-1.5 p-6`,r),n[3]=r,n[4]=a);let o;return n[5]!==i||n[6]!==t||n[7]!==a?(o=(0,G.jsx)(`div`,{ref:t,className:a,...i}),n[5]=i,n[6]=t,n[7]=a,n[8]=o):o=n[8],o});sa.displayName=`CardHeader`;var ca=U.forwardRef((e,t)=>{let n=(0,L.c)(9),r,i;n[0]===e?(r=n[1],i=n[2]):({className:r,...i}=e,n[0]=e,n[1]=r,n[2]=i);let a;n[3]===r?a=n[4]:(a=_(I.sectionTitle,`leading-none tracking-tight`,r),n[3]=r,n[4]=a);let o;return n[5]!==i||n[6]!==t||n[7]!==a?(o=(0,G.jsx)(`div`,{ref:t,className:a,...i}),n[5]=i,n[6]=t,n[7]=a,n[8]=o):o=n[8],o});ca.displayName=`CardTitle`;var la=U.forwardRef((e,t)=>{let n=(0,L.c)(9),r,i;n[0]===e?(r=n[1],i=n[2]):({className:r,...i}=e,n[0]=e,n[1]=r,n[2]=i);let a;n[3]===r?a=n[4]:(a=_(I.bodyMuted,r),n[3]=r,n[4]=a);let o;return n[5]!==i||n[6]!==t||n[7]!==a?(o=(0,G.jsx)(`div`,{ref:t,className:a,...i}),n[5]=i,n[6]=t,n[7]=a,n[8]=o):o=n[8],o});la.displayName=`CardDescription`;var ua=U.forwardRef((e,t)=>{let n=(0,L.c)(9),r,i;n[0]===e?(r=n[1],i=n[2]):({className:r,...i}=e,n[0]=e,n[1]=r,n[2]=i);let a;n[3]===r?a=n[4]:(a=_(`p-6 pt-0`,r),n[3]=r,n[4]=a);let o;return n[5]!==i||n[6]!==t||n[7]!==a?(o=(0,G.jsx)(`div`,{ref:t,className:a,...i}),n[5]=i,n[6]=t,n[7]=a,n[8]=o):o=n[8],o});ua.displayName=`CardContent`;var da=U.forwardRef((e,t)=>{let n=(0,L.c)(9),r,i;n[0]===e?(r=n[1],i=n[2]):({className:r,...i}=e,n[0]=e,n[1]=r,n[2]=i);let a;n[3]===r?a=n[4]:(a=_(`flex items-center p-6 pt-0`,r),n[3]=r,n[4]=a);let o;return n[5]!==i||n[6]!==t||n[7]!==a?(o=(0,G.jsx)(`div`,{ref:t,className:a,...i}),n[5]=i,n[6]=t,n[7]=a,n[8]=o):o=n[8],o});da.displayName=`CardFooter`;var fa=m(`app.async-error-boundary.ui`),pa=class extends U.Component{state={error:null};static getDerivedStateFromError(e){return{error:e}}componentDidCatch(e,t){fa.error(`AsyncErrorBoundary caught an error`,{error:e,info:t})}handleRetry=()=>{this.setState({error:null}),this.props.onRetry?.()};render(){let{error:e}=this.state;return e?this.props.renderFallback?this.props.renderFallback(e,this.handleRetry):(0,G.jsx)(`div`,{className:`flex h-full items-center justify-center p-6`,children:(0,G.jsxs)(oa,{className:`max-w-md`,children:[(0,G.jsx)(sa,{children:(0,G.jsx)(ca,{className:`text-destructive`,children:this.props.fallbackTitle??`Something went wrong`})}),(0,G.jsxs)(ua,{className:`space-y-4`,children:[(0,G.jsx)(`p`,{className:I.body,children:e.message}),(0,G.jsx)(c,{variant:`outline`,onClick:this.handleRetry,children:`Retry`})]})]})}):this.props.children}},ma=t({ConversationHistoryView:()=>Ta,default:()=>Ta}),ha=pn(e=>(0,G.jsx)(`div`,{className:`flex h-full items-center justify-center p-6`,children:(0,G.jsxs)(`div`,{className:`max-w-md text-center space-y-2`,children:[(0,G.jsx)(`h3`,{className:e.v0,children:`No history`}),(0,G.jsx)(`p`,{className:e.v1,children:`No conversation history found for this thread.`})]})}),{name:`ConversationHistoryContent_1`}),ga=pn(e=>(0,G.jsxs)(`slot`,{children:[(0,G.jsxs)(`div`,{className:`flex items-center justify-between border-b py-3 px-0`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[e.v0,e.v1]}),(0,G.jsxs)(`div`,{className:e.v2,children:[e.v3,` of `,e.v4,` messages`]})]}),e.v5]}),{name:`ConversationHistoryContent_2`,portals:[`v0`,`v1`,`v3`,`v4`,`v5`]}),_a=function(e){let t=(0,L.c)(39),{scope:n,projects:r,loadVersion:a,currentPromptIndex:o,onPromptIndexChange:s}=e,u;t[0]!==a||t[1]!==n?(u=Ca(n,a),t[0]=a,t[1]=n,t[2]=u):u=t[2];let d;t[3]!==r||t[4]!==n?(d=()=>wa(n,r),t[3]=r,t[4]=n,t[5]=d):d=t[5];let f=$i(u,d),p;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(p=function(e){return new Date(e).toLocaleString()},t[6]=p):p=t[6];let m=p,h;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(h=function(e,t){let n=new Date(e),r=new Date(t).getTime()-n.getTime();if(r<0)return{display:`0:00`,tooltip:`0 seconds`};let i=Math.floor(r/1e3),a=Math.floor(i/60),o=i%60,s=`${a}:${o.toString().padStart(2,`0`)}`,c;return c=a===0?`${o} second${o===1?``:`s`}`:o===0?`${a} minute${a===1?``:`s`}`:`${a} minute${a===1?``:`s`} ${o} second${o===1?``:`s`}`,{display:s,tooltip:c}},t[7]=h):h=t[7];let g=h,v;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(v=function(e){return{inputTokens:e.inputTokens??0,outputTokens:e.outputTokens??0}},t[8]=v):v=t[8];let y=v,b;t[9]!==o||t[10]!==f.messages||t[11]!==s?(b=function(){f.messages&&o<f.messages.length-1&&s(o+1)},t[9]=o,t[10]=f.messages,t[11]=s,t[12]=b):b=t[12];let x=b,S;t[13]!==o||t[14]!==s?(S=function(){o>0&&s(o-1)},t[13]=o,t[14]=s,t[15]=S):S=t[15];let C=S;if(!f.messages?.length){let e;return t[16]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,G.jsx)(ha,{v0:I.emptyStateTitle,v1:I.bodyMuted}),t[16]=e):e=t[16],e}let w=o===0,T;t[17]===Symbol.for(`react.memo_cache_sentinel`)?(T=(0,G.jsx)(l,{className:`h-4 w-4 mr-1`}),t[17]=T):T=t[17];let D;t[18]!==C||t[19]!==w?(D=(0,G.jsx)(c,{variant:`outline`,size:`sm`,onClick:C,disabled:w,children:T}),t[18]=C,t[19]=w,t[20]=D):D=t[20];let k=o>=f.messages.length-1,A;t[21]===Symbol.for(`react.memo_cache_sentinel`)?(A=(0,G.jsx)(ee,{className:`h-4 w-4 ml-1`}),t[21]=A):A=t[21];let j;t[22]!==x||t[23]!==k?(j=(0,G.jsx)(c,{variant:`outline`,size:`sm`,onClick:x,disabled:k,children:A}),t[22]=x,t[23]=k,t[24]=j):j=t[24];let M=o+1,ne=f.messages.length,N;t[25]===Symbol.for(`react.memo_cache_sentinel`)?(N=(0,G.jsx)(ta,{children:(0,G.jsxs)(ia,{children:[(0,G.jsx)(Q,{children:`Prompt`}),(0,G.jsx)(Q,{children:`Answer`}),(0,G.jsx)(Q,{className:`w-24`,children:`Model`}),(0,G.jsx)(Q,{className:`w-24 text-right`,children:`Duration`}),(0,G.jsx)(Q,{className:`w-20 text-right`,children:`Input Tokens`}),(0,G.jsx)(Q,{className:`w-20 text-right`,children:`Output Tokens`}),(0,G.jsx)(Q,{className:`w-32 text-right`,children:`Timestamp`})]})}),t[25]=N):N=t[25];let P;if(t[26]!==o||t[27]!==f.messages){let e;t[29]===o?e=t[30]:(e=(e,t)=>{let{inputTokens:n,outputTokens:r}=y(e);return(0,G.jsxs)(ia,{className:t===o?`bg-muted/50`:``,children:[(0,G.jsx)($,{className:`max-w-md`,children:(0,G.jsx)(`div`,{className:I.body,children:(0,G.jsx)(ba,{text:e.request.message})})}),(0,G.jsx)($,{className:`max-w-md`,children:e.response?(0,G.jsx)(`div`,{className:I.body,children:(0,G.jsx)(ba,{text:e.response.content})}):(0,G.jsx)(`span`,{className:_(I.bodyMuted,`italic`),children:`No response`})}),(0,G.jsx)($,{children:(0,G.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,G.jsx)(E,{className:`h-3 w-3 text-muted-foreground`}),(0,G.jsx)(`span`,{className:`text-muted-foreground`,children:e.request.model})]})}),(0,G.jsx)($,{className:_(I.caption,`text-right`),children:e.response?(0,G.jsx)(i,{children:(0,G.jsxs)(te,{children:[(0,G.jsx)(O,{asChild:!0,children:(0,G.jsx)(`div`,{className:`cursor-help`,children:g(e.timestamp,e.response.completedAt).display})}),(0,G.jsx)(we,{children:(0,G.jsx)(`p`,{children:g(e.timestamp,e.response.completedAt).tooltip})})]})}):(0,G.jsx)(`span`,{className:`text-muted-foreground italic`,children:`-`})}),(0,G.jsx)($,{className:_(I.bodyMuted,`text-right`),children:n>0?n.toLocaleString():`-`}),(0,G.jsx)($,{className:_(I.bodyMuted,`text-right`),children:r>0?r.toLocaleString():`-`}),(0,G.jsx)($,{className:_(I.bodyMuted,`text-right`),children:m(e.timestamp)})]},e.id)},t[29]=o,t[30]=e),P=f.messages.map(e),t[26]=o,t[27]=f.messages,t[28]=P}else P=t[28];let F;t[31]===P?F=t[32]:(F=(0,G.jsx)(re,{className:`h-full`,children:(0,G.jsx)(`div`,{className:`py-4`,children:(0,G.jsxs)(ea,{children:[N,(0,G.jsx)(na,{children:P})]})})}),t[31]=P,t[32]=F);let ie;return t[33]!==f.messages.length||t[34]!==D||t[35]!==j||t[36]!==M||t[37]!==F?(ie=(0,G.jsx)(ga,{v0:D,v1:j,v2:I.bodyMuted,v3:M,v4:ne,v5:F}),t[33]=f.messages.length,t[34]=D,t[35]=j,t[36]=M,t[37]=F,t[38]=ie):ie=t[38],ie},va=m(`app.conversation-history-view.ui`),ya=`__ALL_PROJECTS__`;function ba(e){let t=(0,L.c)(8),{text:n,maxLength:r}=e,i=r===void 0?100:r;if(n.length<=i){let e;return t[0]===n?e=t[1]:(e=(0,G.jsx)(G.Fragment,{children:n}),t[0]=n,t[1]=e),e}let a;t[2]!==i||t[3]!==n?(a=n.substring(0,i),t[2]=i,t[3]=n,t[4]=a):a=t[4];let o;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,G.jsx)(`span`,{className:`text-muted-foreground ml-2`,children:`...`}),t[5]=o):o=t[5];let s;return t[6]===a?s=t[7]:(s=(0,G.jsxs)(G.Fragment,{children:[a,o]}),t[6]=a,t[7]=s),s}function xa(e,t){let n=`${t} - `,r=e.title??e.threadId;return r.startsWith(n)?r.slice(n.length):r}async function Sa(e){let t=[],r=new Set,i=``;for(let a of e)try{let e=await n(a.threadId);e?.messages&&(t.push(...e.messages),e.conversationIds&&e.conversationIds.forEach(e=>r.add(e)),e.lastUpdated>i&&(i=e.lastUpdated))}catch(e){va.warn(`Failed to load history for thread ${a.threadId}:`,e)}return t.sort((e,t)=>new Date(t.timestamp).getTime()-new Date(e.timestamp).getTime()),{messages:t,conversationIds:Array.from(r),lastUpdated:i??new Date().toISOString()}}function Ca(e,t){return e.type===`thread`?`conversation-history:thread:${e.threadId}:${t}`:e.type===`project`?`conversation-history:project:${e.projectId}:${t}`:`conversation-history:all:${t}`}async function wa(e,t){if(e.type===`thread`)return await n(e.threadId);if(e.type===`project`){let n=t.find(t=>t.projectId===e.projectId);if(!n||n.threads.length===0)return{threadId:e.projectId,messages:[],lastUpdated:new Date().toISOString(),conversationIds:[]};let r=await Sa(n.threads);return{threadId:e.projectId,...r}}return{threadId:ya,...await Sa(t.flatMap(e=>e.threads))}}var Ta=(0,U.memo)(function({isOpen:e,onClose:t,initialFilter:n,projects:r,inline:i}){let[a,o]=(0,U.useState)(0),[s,l]=(0,U.useState)(``),[u,d]=(0,U.useState)(``),[f,p]=(0,U.useState)(!1),[m,h]=(0,U.useState)(!1),[g,_]=(0,U.useState)(0),[v,y]=(0,U.useState)(null),[b,x]=(0,U.useState)(null),S=(0,U.useMemo)(()=>u?{type:`thread`,threadId:u}:s===ya?{type:`all`}:s?{type:`project`,projectId:s}:null,[s,u]),C=S?Ca(S,g):null;(0,U.useEffect)(()=>{e&&n?n.type===`thread`?(d(n.id),l(``),o(0)):n.type===`project`&&(l(n.id),d(``),o(0)):e&&!n?(l(ya),d(``),o(0)):e||(d(``),l(``),o(0),x(null),y(null))},[e,n]);let ee=e=>{d(e),l(``),o(0),y(null),x(null)},te=e=>{l(e),d(``),o(0),y(null),x(null)},w=(0,U.useCallback)(()=>{if(u){let e=r.flatMap(e=>e.threads).find(e=>e.threadId===u),t=r.find(e=>e.threads.some(e=>e.threadId===u)),n=e?xa(e,t?.name??t?.projectId??``):u;return{options:{threadId:u},title:`Clear Thread History`,description:`Permanently delete all conversation history for "${n}"? This cannot be undone.`}}if(s&&s!==ya){let e=r.find(e=>e.projectId===s)?.name??s;return{options:{projectId:s},title:`Clear Project History`,description:`Permanently delete all conversation history for "${e}"? This cannot be undone.`}}return{options:void 0,title:`Clear All History`,description:`Permanently delete all conversation history across every project and thread? This cannot be undone.`}},[r,s,u]),T=(0,U.useCallback)(async()=>{let e=w();h(!0),x(null);try{await M(e.options),C&&Zi(C),y(C),o(0),p(!1)}catch(e){x(e instanceof Error?e.message:`Failed to clear conversation history`)}finally{h(!1)}},[w,C]);function E(){S&&Zi(Ca(S,g)),_(e=>e+1),y(null),x(null)}let D=w();if(!e)return null;let O=(0,G.jsxs)(G.Fragment,{children:[(0,G.jsxs)(Ii,{value:s,onValueChange:te,children:[(0,G.jsx)(Ri,{className:`w-48`,children:(0,G.jsx)(Li,{placeholder:`Select project`})}),(0,G.jsxs)(Vi,{children:[(0,G.jsx)(Ui,{value:ya,children:`All Projects`}),r.map(e=>(0,G.jsx)(Ui,{value:e.projectId,children:e.name??e.projectId},e.projectId))]})]}),(0,G.jsxs)(Ii,{value:u,onValueChange:ee,children:[(0,G.jsx)(Ri,{className:`w-48`,children:(0,G.jsx)(Li,{placeholder:`Select thread`})}),(0,G.jsx)(Vi,{children:r.flatMap(e=>e.threads.map(t=>(0,G.jsx)(Ui,{value:t.threadId,children:xa(t,e.name??e.projectId)},t.threadId)))})]}),(0,G.jsxs)(c,{variant:`outline`,size:`sm`,onClick:()=>p(!0),disabled:m,children:[(0,G.jsx)(ie,{className:`h-4 w-4 mr-2`}),`Clear`]})]}),k=(0,G.jsxs)(`div`,{className:`flex h-full flex-col`,children:[(0,G.jsx)(`div`,{className:i?void 0:`border-b px-6 py-4`,children:(0,G.jsx)(rr,{title:`History`,description:i?`View and browse conversation history across projects and threads.`:void 0,action:(0,G.jsxs)(`div`,{className:`flex items-center gap-3`,children:[O,i?null:(0,G.jsx)(c,{variant:`action`,size:`icon-sm`,onClick:t,children:(0,G.jsx)(ge,{})})]})})}),(0,G.jsx)(`div`,{className:`flex-1 overflow-hidden`,children:b?(0,G.jsx)(`div`,{className:`flex h-full items-center justify-center`,children:(0,G.jsxs)(oa,{className:`max-w-md`,children:[(0,G.jsx)(sa,{children:(0,G.jsx)(ca,{className:`text-destructive`,children:`Error`})}),(0,G.jsxs)(ua,{className:`space-y-4`,children:[(0,G.jsx)(`p`,{children:b}),(0,G.jsx)(c,{onClick:()=>x(null),children:`Dismiss`})]})]})}):v&&v===C?(0,G.jsx)(`div`,{className:`flex h-full items-center justify-center p-6`,children:(0,G.jsxs)(`div`,{className:`max-w-md text-center space-y-2`,children:[(0,G.jsx)(`h3`,{className:I.emptyStateTitle,children:`No history`}),(0,G.jsx)(`p`,{className:I.bodyMuted,children:`No conversation history found for this thread.`})]})}):S?(0,G.jsx)(pa,{fallbackTitle:`Failed to load conversation history`,onRetry:E,children:(0,G.jsx)(U.Suspense,{fallback:(0,G.jsx)(Gi,{label:`Loading conversation history...`,size:`lg`}),children:(0,G.jsx)(_a,{scope:S,projects:r,loadVersion:g,currentPromptIndex:a,onPromptIndexChange:o},C??void 0)})}):(0,G.jsx)(Gi,{label:`Loading conversation history...`,size:`lg`})})]});return(0,G.jsxs)(G.Fragment,{children:[i?(0,G.jsx)(lr,{children:(0,G.jsx)(ir,{className:`max-w-none w-full h-full flex flex-col min-h-0`,children:k})}):(0,G.jsx)(`div`,{className:`fixed inset-0 z-50 bg-background`,children:k}),(0,G.jsx)(Kn,{open:f,onOpenChange:p,children:(0,G.jsxs)(Yn,{children:[(0,G.jsxs)(Xn,{children:[(0,G.jsx)(Qn,{children:D.title}),(0,G.jsx)($n,{children:D.description})]}),(0,G.jsxs)(Zn,{children:[(0,G.jsx)(tr,{disabled:m,children:`Cancel`}),(0,G.jsx)(er,{onClick:e=>{e.preventDefault(),T()},disabled:m,className:`bg-destructive text-destructive-foreground hover:bg-destructive/90`,children:m?`Clearing...`:`Clear`})]})]})})]})});export{tr as A,sr as C,lr as D,ir as E,Qn as F,pn as I,$n as M,Zn as N,Kn as O,Xn as P,rr as S,ur as T,pr as _,$i as a,fr as b,Ji as c,Ii as d,Vi as f,Li as g,Ri as h,ua as i,Yn as j,er as k,Gi as l,Wi as m,pa as n,Zi as o,Ui as p,oa as r,Qi as s,ma as t,Ki as u,ar as v,dr as w,cr as x,or as y};
|