@hienlh/ppm 0.2.18 → 0.2.20
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/web/assets/api-client-DzH9zCD7.js +1 -0
- package/dist/web/assets/{button-CvHWF07y.js → button-CQ5h5gxS.js} +1 -1
- package/dist/web/assets/{chat-tab-Cbc-uzKV.js → chat-tab-Cfw__7vJ.js} +3 -3
- package/dist/web/assets/code-editor-D8Pz69sx.js +2 -0
- package/dist/web/assets/{dialog-Cn5zGuid.js → dialog-BL9i7XEo.js} +1 -1
- package/dist/web/assets/diff-viewer-CWS5n7ur.js +4 -0
- package/dist/web/assets/dist-Ca3N8Xbh.js +46 -0
- package/dist/web/assets/{git-graph-D3ls9-HA.js → git-graph-DwA62J8-.js} +1 -1
- package/dist/web/assets/git-status-panel-DaB-zzSF.js +1 -0
- package/dist/web/assets/index-BYIXPY6U.css +2 -0
- package/dist/web/assets/index-DbTCLiox.js +17 -0
- package/dist/web/assets/{project-list-D6oBUMd8.js → project-list-Z4lhtp6P.js} +1 -1
- package/dist/web/assets/{settings-tab-DmTDAK9n.js → settings-tab-BW6MGcir.js} +1 -1
- package/dist/web/assets/{terminal-tab-DlRo-KzS.js → terminal-tab-sGlqTp7k.js} +1 -1
- package/dist/web/index.html +8 -9
- package/dist/web/sw.js +1 -1
- package/package.json +1 -1
- package/src/web/components/chat/message-input.tsx +2 -2
- package/src/web/components/editor/code-editor.tsx +55 -8
- package/src/web/components/editor/diff-viewer.tsx +14 -2
- package/src/web/components/git/git-status-panel.tsx +4 -11
- package/src/web/stores/settings-store.ts +21 -1
- package/dist/web/assets/api-client-B_eCZViO.js +0 -1
- package/dist/web/assets/code-editor-B9e5P-DN.js +0 -2
- package/dist/web/assets/diff-viewer-B0iMQ1Qf.js +0 -4
- package/dist/web/assets/dist-CBiGQxfr.js +0 -46
- package/dist/web/assets/git-status-panel-UB0AyOdX.js +0 -1
- package/dist/web/assets/index-BdUoflYx.css +0 -2
- package/dist/web/assets/index-DLIV9ojh.js +0 -17
- package/dist/web/assets/react-C32bf_ch.js +0 -1
- /package/dist/web/assets/{dist-B6sG2GPc.js → dist-0XHv8Vwc.js} +0 -0
- /package/dist/web/assets/{trash-2-Dc17nbCE.js → trash-2-CGlFXde_.js} +0 -0
- /package/dist/web/assets/{utils-61GRB9Cb.js → utils-D6me7KDg.js} +0 -0
- /package/dist/web/assets/{x-Bpqyw40Y.js → x-C0Rw5Giw.js} +0 -0
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{a as e,r as t,t as n}from"./jsx-runtime-BFALxl05.js";import{_ as r,a as i,b as a,d as o,f as s,h as c,i as l,l as u,m as d,n as ee,o as f,p,r as te,s as ne,t as m,u as h}from"./button-
|
|
1
|
+
import{a as e,r as t,t as n}from"./jsx-runtime-BFALxl05.js";import{_ as r,a as i,b as a,d as o,f as s,h as c,i as l,l as u,m as d,n as ee,o as f,p,r as te,s as ne,t as m,u as h}from"./button-CQ5h5gxS.js";import{t as re}from"./x-C0Rw5Giw.js";import{t as g}from"./utils-D6me7KDg.js";var _=e(t(),1);function ie(e,t){return _.useReducer((e,n)=>t[e][n]??e,e)}var v=e=>{let{present:t,children:n}=e,r=y(t),i=typeof n==`function`?n({present:r.isPresent}):_.Children.only(n),o=a(r.ref,x(i));return typeof n==`function`||r.isPresent?_.cloneElement(i,{ref:o}):null};v.displayName=`Presence`;function y(e){let[t,n]=_.useState(),r=_.useRef(null),i=_.useRef(e),a=_.useRef(`none`),[s,c]=ie(e?`mounted`:`unmounted`,{mounted:{UNMOUNT:`unmounted`,ANIMATION_OUT:`unmountSuspended`},unmountSuspended:{MOUNT:`mounted`,ANIMATION_END:`unmounted`},unmounted:{MOUNT:`mounted`}});return _.useEffect(()=>{let e=b(r.current);a.current=s===`mounted`?e:`none`},[s]),o(()=>{let t=r.current,n=i.current;if(n!==e){let r=a.current,o=b(t);e?c(`MOUNT`):o===`none`||t?.display===`none`?c(`UNMOUNT`):c(n&&r!==o?`ANIMATION_OUT`:`UNMOUNT`),i.current=e}},[e,c]),o(()=>{if(t){let e,n=t.ownerDocument.defaultView??window,o=a=>{let o=b(r.current).includes(CSS.escape(a.animationName));if(a.target===t&&o&&(c(`ANIMATION_END`),!i.current)){let r=t.style.animationFillMode;t.style.animationFillMode=`forwards`,e=n.setTimeout(()=>{t.style.animationFillMode===`forwards`&&(t.style.animationFillMode=r)})}},s=e=>{e.target===t&&(a.current=b(r.current))};return t.addEventListener(`animationstart`,s),t.addEventListener(`animationcancel`,o),t.addEventListener(`animationend`,o),()=>{n.clearTimeout(e),t.removeEventListener(`animationstart`,s),t.removeEventListener(`animationcancel`,o),t.removeEventListener(`animationend`,o)}}else c(`ANIMATION_END`)},[t,c]),{isPresent:[`mounted`,`unmountSuspended`].includes(s),ref:_.useCallback(e=>{r.current=e?getComputedStyle(e):null,n(e)},[])}}function b(e){return e?.animationName||`none`}function x(e){let t=Object.getOwnPropertyDescriptor(e.props,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var S=n(),C=`Dialog`,[w,ae]=d(C),[T,E]=w(C),D=e=>{let{__scopeDialog:t,children:n,open:r,defaultOpen:i,onOpenChange:a,modal:o=!0}=e,s=_.useRef(null),c=_.useRef(null),[l,d]=h({prop:r,defaultProp:i??!1,onChange:a,caller:C});return(0,S.jsx)(T,{scope:t,triggerRef:s,contentRef:c,contentId:u(),titleId:u(),descriptionId:u(),open:l,onOpenChange:d,onOpenToggle:_.useCallback(()=>d(e=>!e),[d]),modal:o,children:n})};D.displayName=C;var O=`DialogTrigger`,k=_.forwardRef((e,t)=>{let{__scopeDialog:n,...r}=e,i=E(O,n),o=a(t,i.triggerRef);return(0,S.jsx)(c.button,{type:`button`,"aria-haspopup":`dialog`,"aria-expanded":i.open,"aria-controls":i.contentId,"data-state":Y(i.open),...r,ref:o,onClick:s(e.onClick,i.onOpenToggle)})});k.displayName=O;var A=`DialogPortal`,[j,M]=w(A,{forceMount:void 0}),N=e=>{let{__scopeDialog:t,forceMount:n,children:r,container:a}=e,o=E(A,t);return(0,S.jsx)(j,{scope:t,forceMount:n,children:_.Children.map(r,e=>(0,S.jsx)(v,{present:n||o.open,children:(0,S.jsx)(i,{asChild:!0,container:a,children:e})}))})};N.displayName=A;var P=`DialogOverlay`,F=_.forwardRef((e,t)=>{let n=M(P,e.__scopeDialog),{forceMount:r=n.forceMount,...i}=e,a=E(P,e.__scopeDialog);return a.modal?(0,S.jsx)(v,{present:r||a.open,children:(0,S.jsx)(L,{...i,ref:t})}):null});F.displayName=P;var I=r(`DialogOverlay.RemoveScroll`),L=_.forwardRef((e,t)=>{let{__scopeDialog:n,...r}=e,i=E(P,n);return(0,S.jsx)(te,{as:I,allowPinchZoom:!0,shards:[i.contentRef],children:(0,S.jsx)(c.div,{"data-state":Y(i.open),...r,ref:t,style:{pointerEvents:`auto`,...r.style}})})}),R=`DialogContent`,z=_.forwardRef((e,t)=>{let n=M(R,e.__scopeDialog),{forceMount:r=n.forceMount,...i}=e,a=E(R,e.__scopeDialog);return(0,S.jsx)(v,{present:r||a.open,children:a.modal?(0,S.jsx)(B,{...i,ref:t}):(0,S.jsx)(V,{...i,ref:t})})});z.displayName=R;var B=_.forwardRef((e,t)=>{let n=E(R,e.__scopeDialog),r=_.useRef(null),i=a(t,n.contentRef,r);return _.useEffect(()=>{let e=r.current;if(e)return ee(e)},[]),(0,S.jsx)(H,{...e,ref:i,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:s(e.onCloseAutoFocus,e=>{e.preventDefault(),n.triggerRef.current?.focus()}),onPointerDownOutside:s(e.onPointerDownOutside,e=>{let t=e.detail.originalEvent,n=t.button===0&&t.ctrlKey===!0;(t.button===2||n)&&e.preventDefault()}),onFocusOutside:s(e.onFocusOutside,e=>e.preventDefault())})}),V=_.forwardRef((e,t)=>{let n=E(R,e.__scopeDialog),r=_.useRef(!1),i=_.useRef(!1);return(0,S.jsx)(H,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:t=>{e.onCloseAutoFocus?.(t),t.defaultPrevented||(r.current||n.triggerRef.current?.focus(),t.preventDefault()),r.current=!1,i.current=!1},onInteractOutside:t=>{e.onInteractOutside?.(t),t.defaultPrevented||(r.current=!0,t.detail.originalEvent.type===`pointerdown`&&(i.current=!0));let a=t.target;n.triggerRef.current?.contains(a)&&t.preventDefault(),t.detail.originalEvent.type===`focusin`&&i.current&&t.preventDefault()}})}),H=_.forwardRef((e,t)=>{let{__scopeDialog:n,trapFocus:r,onOpenAutoFocus:i,onCloseAutoFocus:o,...s}=e,c=E(R,n),u=_.useRef(null),d=a(t,u);return l(),(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)(f,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:i,onUnmountAutoFocus:o,children:(0,S.jsx)(ne,{role:`dialog`,id:c.contentId,"aria-describedby":c.descriptionId,"aria-labelledby":c.titleId,"data-state":Y(c.open),...s,ref:d,onDismiss:()=>c.onOpenChange(!1)})}),(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)(se,{titleId:c.titleId}),(0,S.jsx)(le,{contentRef:u,descriptionId:c.descriptionId})]})]})}),U=`DialogTitle`,W=_.forwardRef((e,t)=>{let{__scopeDialog:n,...r}=e,i=E(U,n);return(0,S.jsx)(c.h2,{id:i.titleId,...r,ref:t})});W.displayName=U;var G=`DialogDescription`,K=_.forwardRef((e,t)=>{let{__scopeDialog:n,...r}=e,i=E(G,n);return(0,S.jsx)(c.p,{id:i.descriptionId,...r,ref:t})});K.displayName=G;var q=`DialogClose`,J=_.forwardRef((e,t)=>{let{__scopeDialog:n,...r}=e,i=E(q,n);return(0,S.jsx)(c.button,{type:`button`,...r,ref:t,onClick:s(e.onClick,()=>i.onOpenChange(!1))})});J.displayName=q;function Y(e){return e?`open`:`closed`}var X=`DialogTitleWarning`,[oe,Z]=p(X,{contentName:R,titleName:U,docsSlug:`dialog`}),se=({titleId:e})=>{let t=Z(X),n=`\`${t.contentName}\` requires a \`${t.titleName}\` for the component to be accessible for screen reader users.
|
|
2
2
|
|
|
3
3
|
If you want to hide the \`${t.titleName}\`, you can wrap it with our VisuallyHidden component.
|
|
4
4
|
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import{a as e,n as t,r as n,t as r}from"./jsx-runtime-BFALxl05.js";import{t as i}from"./columns-2-DsiY76NQ.js";import{A as a,E as o,H as s,I as c,O as l,Q as u,Y as d,_t as f,a as p,at as m,ct as h,et as g,i as _,it as v,j as y,k as b,n as x,nt as ee,o as S,ot as C,r as w,rt as T,s as te,st as E,t as D}from"./dist-Ca3N8Xbh.js";import{r as O,t as ne}from"./api-client-DzH9zCD7.js";import{D as re,P as ie,T as ae,x as oe}from"./index-DbTCLiox.js";var se=t(`panel-right-open`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`M15 3v18`,key:`14nvp0`}],[`path`,{d:`m10 15-3-3 3-3`,key:`1pgupc`}]]),k=e(n(),1),A=class e{constructor(e,t,n,r){this.fromA=e,this.toA=t,this.fromB=n,this.toB=r}offset(t,n=t){return new e(this.fromA+t,this.toA+t,this.fromB+n,this.toB+n)}};function j(e,t,n,r,i,a){if(e==r)return[];let o=I(e,t,n,r,i,a),s=L(e,t+o,n,r,i+o,a);t+=o,n-=s,i+=o,a-=s;let c=n-t,l=a-i;if(!c||!l)return[new A(t,n,i,a)];if(c>l){let o=e.slice(t,n).indexOf(r.slice(i,a));if(o>-1)return[new A(t,t+o,i,i),new A(t+o+l,n,a,a)]}else if(l>c){let o=r.slice(i,a).indexOf(e.slice(t,n));if(o>-1)return[new A(t,t,i,i+o),new A(n,n,i+o+c,a)]}if(c==1||l==1)return[new A(t,n,i,a)];let u=pe(e,t,n,r,i,a);if(u){let[o,s,c]=u;return j(e,t,o,r,i,s).concat(j(e,o+c,n,r,s+c,a))}return ce(e,t,n,r,i,a)}var M=1e9,N=0,P=!1;function ce(e,t,n,r,i,a){let o=n-t,s=a-i;if(M<1e9&&Math.min(o,s)>M*16||N>0&&Date.now()>N)return Math.min(o,s)>M*64?[new A(t,n,i,a)]:me(e,t,n,r,i,a);let c=Math.ceil((o+s)/2);F.reset(c),ue.reset(c);let l=(n,a)=>e.charCodeAt(t+n)==r.charCodeAt(i+a),u=(t,i)=>e.charCodeAt(n-t-1)==r.charCodeAt(a-i-1),d=(o-s)%2==0?null:ue,f=d?null:F;for(let p=0;p<c;p++){if(p>M||N>0&&!(p&63)&&Date.now()>N)return me(e,t,n,r,i,a);let m=F.advance(p,o,s,c,d,!1,l)||ue.advance(p,o,s,c,f,!0,u);if(m)return de(e,t,n,t+m[0],r,i,a,i+m[1])}return[new A(t,n,i,a)]}var le=class{constructor(){this.vec=[]}reset(e){this.len=e<<1;for(let e=0;e<this.len;e++)this.vec[e]=-1;this.vec[e+1]=0,this.start=this.end=0}advance(e,t,n,r,i,a,o){for(let s=-e+this.start;s<=e-this.end;s+=2){let c=r+s,l=s==-e||s!=e&&this.vec[c-1]<this.vec[c+1]?this.vec[c+1]:this.vec[c-1]+1,u=l-s;for(;l<t&&u<n&&o(l,u);)l++,u++;if(this.vec[c]=l,l>t)this.end+=2;else if(u>n)this.start+=2;else if(i){let e=r+(t-n)-s;if(e>=0&&e<this.len&&i.vec[e]!=-1)if(a){let n=i.vec[e];if(n>=t-l)return[n,r+n-e]}else{let n=t-i.vec[e];if(l>=n)return[l,u]}}}return null}},F=new le,ue=new le;function de(e,t,n,r,i,a,o,s){let c=!1;return!B(e,r)&&++r==n&&(c=!0),!B(i,s)&&++s==o&&(c=!0),c?[new A(t,n,a,o)]:j(e,t,r,i,a,s).concat(j(e,r,n,i,s,o))}function fe(e,t){let n=1,r=Math.min(e,t);for(;n<r;)n<<=1;return n}function I(e,t,n,r,i,a){if(t==n||t==a||e.charCodeAt(t)!=r.charCodeAt(i))return 0;let o=fe(n-t,a-i);for(let s=t,c=i;;){let i=s+o,l=c+o;if(i>n||l>a||e.slice(s,i)!=r.slice(c,l)){if(o==1)return s-t-(B(e,s)?0:1);o>>=1}else if(i==n||l==a)return i-t;else s=i,c=l}}function L(e,t,n,r,i,a){if(t==n||i==a||e.charCodeAt(n-1)!=r.charCodeAt(a-1))return 0;let o=fe(n-t,a-i);for(let s=n,c=a;;){let a=s-o,l=c-o;if(a<t||l<i||e.slice(a,s)!=r.slice(l,c)){if(o==1)return n-s-(B(e,s)?0:1);o>>=1}else if(a==t||l==i)return n-a;else s=a,c=l}}function R(e,t,n,r,i,a,o,s){let c=r.slice(i,a),l=null;for(;;){if(l||o<s)return l;for(let s=t+o;;){B(e,s)||s++;let u=s+o;if(B(e,u)||(u+=u==s+1?1:-1),u>=n)break;let d=e.slice(s,u),f=-1;for(;(f=c.indexOf(d,f+1))!=-1;){let o=I(e,u,n,r,i+f+d.length,a),c=L(e,t,s,r,i,i+f),p=d.length+o+c;(!l||l[2]<p)&&(l=[s-c,i+f-c,p])}s=u}if(s<0)return l;o>>=1}}function pe(e,t,n,r,i,a){let o=n-t,s=a-i;if(o<s){let o=pe(r,i,a,e,t,n);return o&&[o[1],o[0],o[2]]}return o<4||s*2<o?null:R(e,t,n,r,i,a,Math.floor(o/4),-1)}function me(e,t,n,r,i,a){P=!0;let o=n-t,s=a-i,c;if(o<s){let s=R(r,i,a,e,t,n,Math.floor(o/6),50);c=s&&[s[1],s[0],s[2]]}else c=R(e,t,n,r,i,a,Math.floor(s/6),50);if(!c)return[new A(t,n,i,a)];let[l,u,d]=c;return j(e,t,l,r,i,u).concat(j(e,l+d,n,r,u+d,a))}function he(e,t){for(let n=1;n<e.length;n++){let r=e[n-1],i=e[n];r.toA>i.fromA-t&&r.toB>i.fromB-t&&(e[n-1]=new A(r.fromA,i.toA,r.fromB,i.toB),e.splice(n--,1))}}function ge(e,t,n){for(;;){he(n,1);let r=!1;for(let i=0;i<n.length;i++){let a=n[i],o,s;(o=I(e,a.fromA,a.toA,t,a.fromB,a.toB))&&(a=n[i]=new A(a.fromA+o,a.toA,a.fromB+o,a.toB)),(s=L(e,a.fromA,a.toA,t,a.fromB,a.toB))&&(a=n[i]=new A(a.fromA,a.toA-s,a.fromB,a.toB-s));let c=a.toA-a.fromA,l=a.toB-a.fromB;if(c&&l)continue;let u=a.fromA-(i?n[i-1].toA:0),d=(i<n.length-1?n[i+1].fromA:e.length)-a.toA;if(!u||!d)continue;let f=c?e.slice(a.fromA,a.toA):t.slice(a.fromB,a.toB);u<=f.length&&e.slice(a.fromA-u,a.fromA)==f.slice(f.length-u)?(n[i]=new A(a.fromA-u,a.toA-u,a.fromB-u,a.toB-u),r=!0):d<=f.length&&e.slice(a.toA,a.toA+d)==f.slice(0,d)&&(n[i]=new A(a.fromA+d,a.toA+d,a.fromB+d,a.toB+d),r=!0)}if(!r)break}return n}function _e(e,t,n){for(let r=0,i=0;i<e.length;i++){let a=e[i],o=a.toA-a.fromA,s=a.toB-a.fromB;if(o&&s||o>3||s>3){let c=i==e.length-1?t.length:e[i+1].fromA,l=a.fromA-r,u=c-a.toA,d=Ce(t,a.fromA,l),f=Se(t,a.toA,u),p=a.fromA-d,m=f-a.toA;if((!o||!s)&&p&&m){let l=Math.max(o,s),[u,h,g]=o?[t,a.fromA,a.toA]:[n,a.fromB,a.toB];l>p&&t.slice(d,a.fromA)==u.slice(g-p,g)?(a=e[i]=new A(d,d+o,a.fromB-p,a.toB-p),d=a.fromA,f=Se(t,a.toA,c-a.toA)):l>m&&t.slice(a.toA,f)==u.slice(h,h+m)&&(a=e[i]=new A(f-o,f,a.fromB+m,a.toB+m),f=a.toA,d=Ce(t,a.fromA,a.fromA-r)),p=a.fromA-d,m=f-a.toA}if(p||m)a=e[i]=new A(a.fromA-p,a.toA+m,a.fromB-p,a.toB+m);else if(!o){let t=Te(n,a.fromB,a.toB),r,o=t<0?-1:we(n,a.toB,a.fromB);t>-1&&(r=t-a.fromB)<=u&&n.slice(a.fromB,t)==n.slice(a.toB,a.toB+r)?a=e[i]=a.offset(r):o>-1&&(r=a.toB-o)<=l&&n.slice(a.fromB-r,a.fromB)==n.slice(o,a.toB)&&(a=e[i]=a.offset(-r))}else if(!s){let n=Te(t,a.fromA,a.toA),r,o=n<0?-1:we(t,a.toA,a.fromA);n>-1&&(r=n-a.fromA)<=u&&t.slice(a.fromA,n)==t.slice(a.toA,a.toA+r)?a=e[i]=a.offset(r):o>-1&&(r=a.toA-o)<=l&&t.slice(a.fromA-r,a.fromA)==t.slice(o,a.toA)&&(a=e[i]=a.offset(-r))}}r=a.toA}return he(e,3),e}var z;try{z=RegExp(`[\\p{Alphabetic}\\p{Number}]`,`u`)}catch{}function ve(e){return e>48&&e<58||e>64&&e<91||e>96&&e<123}function ye(e,t){if(t==e.length)return 0;let n=e.charCodeAt(t);return n<192?ve(n)?1:0:z?!Ee(n)||t==e.length-1?z.test(String.fromCharCode(n))?1:0:z.test(e.slice(t,t+2))?2:0:0}function be(e,t){if(!t)return 0;let n=e.charCodeAt(t-1);return n<192?ve(n)?1:0:z?!De(n)||t==1?z.test(String.fromCharCode(n))?1:0:z.test(e.slice(t-2,t))?2:0:0}var xe=8;function Se(e,t,n){if(t==e.length||!be(e,t))return t;for(let r=t,i=t+n,a=0;a<xe;a++){let t=ye(e,r);if(!t||r+t>i)return r;r+=t}return t}function Ce(e,t,n){if(!t||!ye(e,t))return t;for(let r=t,i=t-n,a=0;a<xe;a++){let t=be(e,r);if(!t||r-t<i)return r;r-=t}return t}function we(e,t,n){for(;t!=n;t--)if(e.charCodeAt(t-1)==10)return t;return-1}function Te(e,t,n){for(;t!=n;t++)if(e.charCodeAt(t)==10)return t;return-1}var Ee=e=>e>=55296&&e<=56319,De=e=>e>=56320&&e<=57343;function B(e,t){return!t||t==e.length||!Ee(e.charCodeAt(t-1))||!De(e.charCodeAt(t))}function Oe(e,t,n){let r=n?.override;return r?r(e,t):(M=(n?.scanLimit??1e9)>>1,N=n?.timeout?Date.now()+n.timeout:0,P=!1,ge(e,t,j(e,0,e.length,t,0,t.length)))}function ke(){return!P}function Ae(e,t,n){return _e(Oe(e,t,n),e,t)}var V=T.define({combine:e=>e[0]}),H=E.define(),je=T.define(),U=h.define({create(e){return null},update(e,t){for(let n of t.effects)n.is(H)&&(e=n.value);for(let n of t.state.facet(je))e=n(e,t);return e}}),W=class e{constructor(e,t,n,r,i,a=!0){this.changes=e,this.fromA=t,this.toA=n,this.fromB=r,this.toB=i,this.precise=a}offset(t,n){return t||n?new e(this.changes,this.fromA+t,this.toA+t,this.fromB+n,this.toB+n,this.precise):this}get endA(){return Math.max(this.fromA,this.toA-1)}get endB(){return Math.max(this.fromB,this.toB-1)}static build(e,t,n){return Pe(Ae(e.toString(),t.toString(),n),e,t,0,0,ke())}static updateA(e,t,n,r,i){return Le(Ie(e,r,!0,n.length),e,t,n,i)}static updateB(e,t,n,r,i){return Le(Ie(e,r,!1,t.length),e,t,n,i)}};function Me(e,t,n,r){let i=n.lineAt(e),a=r.lineAt(t);return i.to==e&&a.to==t&&e<n.length&&t<r.length?[e+1,t+1]:[i.from,a.from]}function Ne(e,t,n,r){let i=n.lineAt(e),a=r.lineAt(t);return i.from==e&&a.from==t?[e,t]:[i.to+1,a.to+1]}function Pe(e,t,n,r,i,a){let o=[];for(let s=0;s<e.length;s++){let c=e[s],[l,u]=Me(c.fromA+r,c.fromB+i,t,n),[d,f]=Ne(c.toA+r,c.toB+i,t,n),p=[c.offset(-l+r,-u+i)];for(;s<e.length-1;){let a=e[s+1],[o,c]=Me(a.fromA+r,a.fromB+i,t,n);if(o>d+1&&c>f+1)break;p.push(a.offset(-l+r,-u+i)),[d,f]=Ne(a.toA+r,a.toB+i,t,n),s++}o.push(new W(p,l,Math.max(l,d),u,Math.max(u,f),a))}return o}var G=1e3;function Fe(e,t,n,r){let i=0,a=e.length;for(;;){if(i==a){let r=0,a=0;i&&({toA:r,toB:a}=e[i-1]);let o=t-(n?r:a);return[r+o,a+o]}let o=i+a>>1,s=e[o],[c,l]=n?[s.fromA,s.toA]:[s.fromB,s.toB];if(c>t)a=o;else if(l<=t)i=o+1;else return r?[s.fromA,s.fromB]:[s.toA,s.toB]}}function Ie(e,t,n,r){let i=[];return t.iterChangedRanges((a,o,s,c)=>{let l=0,u=n?t.length:r,d=0,f=n?r:t.length;a>G&&([l,d]=Fe(e,a-G,n,!0)),o<t.length-G&&([u,f]=Fe(e,o+G,n,!1));let p=c-s-(o-a),m,[h,g]=n?[p,0]:[0,p];i.length&&(m=i[i.length-1]).toA>=l?i[i.length-1]={fromA:m.fromA,fromB:m.fromB,toA:u,toB:f,diffA:m.diffA+h,diffB:m.diffB+g}:i.push({fromA:l,toA:u,fromB:d,toB:f,diffA:h,diffB:g})}),i}function Le(e,t,n,r,i){if(!e.length)return t;let a=[];for(let o=0,s=0,c=0,l=0;;o++){let u=o==e.length?null:e[o],d=u?u.fromA+s:n.length,f=u?u.fromB+c:r.length;for(;l<t.length;){let e=t[l];if(u&&(e.toA+s>d||e.toB+c>f))break;a.push(e.offset(s,c)),l++}if(!u)break;let p=u.toA+s+u.diffA,m=u.toB+c+u.diffB,h=Ae(n.sliceString(d,p),r.sliceString(f,m),i);for(let e of Pe(h,n,r,d,f,ke()))a.push(e);for(s+=u.diffA,c+=u.diffB;l<t.length;){let e=t[l];if(e.fromA+s>p&&e.fromB+c>m)break;l++}}return a}var Re={scanLimit:500},ze=a.fromClass(class{constructor(e){({deco:this.deco,gutter:this.gutter}=Je(e))}update(e){(e.docChanged||e.viewportChanged||Be(e.startState,e.state)||Ve(e.startState,e.state))&&({deco:this.deco,gutter:this.gutter}=Je(e.view))}},{decorations:e=>e.deco}),K=v.low(c({class:`cm-changeGutter`,markers:e=>e.plugin(ze)?.gutter||m.empty}));function Be(e,t){return e.field(U,!1)!=t.field(U,!1)}function Ve(e,t){return e.facet(V)!=t.facet(V)}var He=o.line({class:`cm-changedLine`}),Ue=o.mark({class:`cm-changedText`}),We=o.mark({tagName:`ins`,class:`cm-insertedLine`}),Ge=o.mark({tagName:`del`,class:`cm-deletedLine`}),Ke=new class extends b{constructor(){super(...arguments),this.elementClass=`cm-changedLineGutter`}};function qe(e,t,n,r,i,a){let o=n?e.fromA:e.fromB,s=n?e.toA:e.toB,c=0;if(o!=s){i.add(o,o,He),i.add(o,s,n?Ge:We),a&&a.add(o,o,Ke);for(let l=t.iterRange(o,s-1),u=o;!l.next().done;){if(l.lineBreak){u++,i.add(u,u,He),a&&a.add(u,u,Ke);continue}let t=u+l.value.length;if(r)for(;c<e.changes.length;){let r=e.changes[c],a=o+(n?r.fromA:r.fromB),s=o+(n?r.toA:r.toB),l=Math.max(u,a),d=Math.min(t,s);if(l<d&&i.add(l,d,Ue),s<t)c++;else break}u=t}}}function Je(e){let t=e.state.field(U),{side:n,highlightChanges:r,markGutter:i,overrideChunk:a}=e.state.facet(V),o=n==`a`,s=new C,c=i?new C:null,{from:l,to:u}=e.viewport;for(let n of t){if((o?n.fromA:n.fromB)>=u)break;(o?n.toA:n.toB)>l&&(!a||!a(e.state,n,s,c))&&qe(n,e.state.doc,o,r,s,c)}return{deco:s.finish(),gutter:c&&c.finish()}}var q=class extends y{constructor(e){super(),this.height=e}eq(e){return this.height==e.height}toDOM(){let e=document.createElement(`div`);return e.className=`cm-mergeSpacer`,e.style.height=this.height+`px`,e}updateDOM(e){return e.style.height=this.height+`px`,!0}get estimatedHeight(){return this.height}ignoreEvent(){return!1}},J=E.define({map:(e,t)=>e.map(t)}),Y=h.define({create:()=>o.none,update:(e,t)=>{for(let e of t.effects)if(e.is(J))return e.value;return e.map(t.changes)},provide:e=>l.decorations.from(e)}),X=.01;function Ye(e,t){if(e.size!=t.size)return!1;let n=e.iter(),r=t.iter();for(;n.value;){if(n.from!=r.from||Math.abs(n.value.spec.widget.height-r.value.spec.widget.height)>1)return!1;n.next(),r.next()}return!0}function Xe(e,t,n){let r=new C,i=new C,a=e.state.field(Y).iter(),s=t.state.field(Y).iter(),c=0,l=0,u=0,d=0,f=e.viewport,p=t.viewport;for(let m=0;;m++){let h=m<n.length?n[m]:null,g=h?h.fromA:e.state.doc.length,_=h?h.fromB:t.state.doc.length;if(c<g){let n=e.lineBlockAt(c).top+u-(t.lineBlockAt(l).top+d);n<-X?(u-=n,r.add(c,c,o.widget({widget:new q(-n),block:!0,side:-1}))):n>X&&(d+=n,i.add(l,l,o.widget({widget:new q(n),block:!0,side:-1})))}if(g>c+1e3&&c<f.from&&g>f.from&&l<p.from&&_>p.from){let e=Math.min(f.from-c,p.from-l);c+=e,l+=e,m--}else if(h)c=h.toA,l=h.toB;else break;for(;a.value&&a.from<c;)u-=a.value.spec.widget.height,a.next();for(;s.value&&s.from<l;)d-=s.value.spec.widget.height,s.next()}for(;a.value;)u-=a.value.spec.widget.height,a.next();for(;s.value;)d-=s.value.spec.widget.height,s.next();let m=e.contentHeight+u-(t.contentHeight+d);m<X?r.add(e.state.doc.length,e.state.doc.length,o.widget({widget:new q(-m),block:!0,side:1})):m>X&&i.add(t.state.doc.length,t.state.doc.length,o.widget({widget:new q(m),block:!0,side:1}));let h=r.finish(),g=i.finish();Ye(h,e.state.field(Y))||e.dispatch({effects:J.of(h)}),Ye(g,t.state.field(Y))||t.dispatch({effects:J.of(g)})}var Z=E.define({map:(e,t)=>t.mapPos(e)}),Ze=class extends y{constructor(e){super(),this.lines=e}eq(e){return this.lines==e.lines}toDOM(e){let t=document.createElement(`div`);return t.className=`cm-collapsedLines`,t.textContent=e.state.phrase(`$ unchanged lines`,this.lines),t.addEventListener(`click`,t=>{let n=e.posAtDOM(t.target);e.dispatch({effects:Z.of(n)});let{side:r,sibling:i}=e.state.facet(V);i&&i().dispatch({effects:Z.of(Qe(n,e.state.field(U),r==`a`))})}),t}ignoreEvent(e){return e instanceof MouseEvent}get estimatedHeight(){return 27}get type(){return`collapsed-unchanged-code`}};function Qe(e,t,n){let r=0,i=0;for(let a=0;;a++){let o=a<t.length?t[a]:null;if(!o||(n?o.fromA:o.fromB)>=e)return i+(e-r);[r,i]=n?[o.toA,o.toB]:[o.toB,o.toA]}}var $e=h.define({create(e){return o.none},update(e,t){e=e.map(t.changes);for(let n of t.effects)n.is(Z)&&(e=e.update({filter:e=>e!=n.value}));return e},provide:e=>l.decorations.from(e)});function et({margin:e=3,minSize:t=4}){return $e.init(n=>tt(n,e,t))}function tt(e,t,n){let r=new C,i=e.facet(V).side==`a`,a=e.field(U),s=1;for(let c=0;;c++){let l=c<a.length?a[c]:null,u=c?s+t:1,d=l?e.doc.lineAt(i?l.fromA:l.fromB).number-1-t:e.doc.lines,f=d-u+1;if(f>=n&&r.add(e.doc.line(u).from,e.doc.line(d).to,o.replace({widget:new Ze(f),block:!0})),!l)break;s=e.doc.lineAt(Math.min(e.doc.length,i?l.toA:l.toB)).number}return r.finish()}var nt=l.styleModule.of(new d({".cm-mergeView":{overflowY:`auto`},".cm-mergeViewEditors":{display:`flex`,alignItems:`stretch`},".cm-mergeViewEditor":{flexGrow:1,flexBasis:0,overflow:`hidden`},".cm-merge-revert":{width:`1.6em`,flexGrow:0,flexShrink:0,position:`relative`},".cm-merge-revert button":{position:`absolute`,display:`block`,width:`100%`,boxSizing:`border-box`,textAlign:`center`,background:`none`,border:`none`,font:`inherit`,cursor:`pointer`}})),rt=l.baseTheme({".cm-mergeView & .cm-scroller, .cm-mergeView &":{height:`auto !important`,overflowY:`visible !important`},"&.cm-merge-a .cm-changedLine, .cm-deletedChunk":{backgroundColor:`rgba(160, 128, 100, .08)`},"&.cm-merge-b .cm-changedLine, .cm-inlineChangedLine":{backgroundColor:`rgba(100, 160, 128, .08)`},"&light.cm-merge-a .cm-changedText, &light .cm-deletedChunk .cm-deletedText":{background:`linear-gradient(#ee443366, #ee443366) bottom/100% 2px no-repeat`},"&dark.cm-merge-a .cm-changedText, &dark .cm-deletedChunk .cm-deletedText":{background:`linear-gradient(#ffaa9966, #ffaa9966) bottom/100% 2px no-repeat`},"&light.cm-merge-b .cm-changedText":{background:`linear-gradient(#22bb22aa, #22bb22aa) bottom/100% 2px no-repeat`},"&dark.cm-merge-b .cm-changedText":{background:`linear-gradient(#88ff88aa, #88ff88aa) bottom/100% 2px no-repeat`},"&.cm-merge-b .cm-deletedText":{background:`#ff000033`},".cm-insertedLine, .cm-deletedLine, .cm-deletedLine del":{textDecoration:`none`},".cm-deletedChunk":{paddingLeft:`6px`,"& .cm-chunkButtons":{position:`absolute`,insetInlineEnd:`5px`},"& button":{border:`none`,cursor:`pointer`,color:`white`,margin:`0 2px`,borderRadius:`3px`,"&[name=accept]":{background:`#2a2`},"&[name=reject]":{background:`#d43`}}},".cm-collapsedLines":{padding:`5px 5px 5px 10px`,cursor:`pointer`,"&:before":{content:`"⦚"`,marginInlineEnd:`7px`},"&:after":{content:`"⦚"`,marginInlineStart:`7px`}},"&light .cm-collapsedLines":{color:`#444`,background:`linear-gradient(to bottom, transparent 0, #f3f3f3 30%, #f3f3f3 70%, transparent 100%)`},"&dark .cm-collapsedLines":{color:`#ddd`,background:`linear-gradient(to bottom, transparent 0, #222 30%, #222 70%, transparent 100%)`},".cm-changeGutter":{width:`3px`,paddingLeft:`1px`},"&light.cm-merge-a .cm-changedLineGutter, &light .cm-deletedLineGutter":{background:`#e43`},"&dark.cm-merge-a .cm-changedLineGutter, &dark .cm-deletedLineGutter":{background:`#fa9`},"&light.cm-merge-b .cm-changedLineGutter":{background:`#2b2`},"&dark.cm-merge-b .cm-changedLineGutter":{background:`#8f8`},".cm-inlineChangedLineGutter":{background:`#75d`}}),it=new g,Q=new g,at=class{constructor(e){this.revertDOM=null,this.revertToA=!1,this.revertToLeft=!1,this.measuring=-1,this.diffConf=e.diffConfig||Re;let t=[v.low(ze),rt,nt,Y,l.updateListener.of(e=>{this.measuring<0&&(e.heightChanged||e.viewportChanged)&&!e.transactions.some(e=>e.effects.some(e=>e.is(J)))&&this.measure()})],n=[V.of({side:`a`,sibling:()=>this.b,highlightChanges:e.highlightChanges!==!1,markGutter:e.gutter!==!1})];e.gutter!==!1&&n.push(K);let r=ee.create({doc:e.a.doc,selection:e.a.selection,extensions:[e.a.extensions||[],l.editorAttributes.of({class:`cm-merge-a`}),Q.of(n),t]}),i=[V.of({side:`b`,sibling:()=>this.a,highlightChanges:e.highlightChanges!==!1,markGutter:e.gutter!==!1})];e.gutter!==!1&&i.push(K);let a=ee.create({doc:e.b.doc,selection:e.b.selection,extensions:[e.b.extensions||[],l.editorAttributes.of({class:`cm-merge-b`}),Q.of(i),t]});this.chunks=W.build(r.doc,a.doc,this.diffConf);let o=[U.init(()=>this.chunks),it.of(e.collapseUnchanged?et(e.collapseUnchanged):[])];r=r.update({effects:E.appendConfig.of(o)}).state,a=a.update({effects:E.appendConfig.of(o)}).state,this.dom=document.createElement(`div`),this.dom.className=`cm-mergeView`,this.editorDOM=this.dom.appendChild(document.createElement(`div`)),this.editorDOM.className=`cm-mergeViewEditors`;let s=e.orientation||`a-b`,c=document.createElement(`div`);c.className=`cm-mergeViewEditor`;let u=document.createElement(`div`);u.className=`cm-mergeViewEditor`,this.editorDOM.appendChild(s==`a-b`?c:u),this.editorDOM.appendChild(s==`a-b`?u:c),this.a=new l({state:r,parent:c,root:e.root,dispatchTransactions:e=>this.dispatch(e,this.a)}),this.b=new l({state:a,parent:u,root:e.root,dispatchTransactions:e=>this.dispatch(e,this.b)}),this.setupRevertControls(!!e.revertControls,e.revertControls==`b-to-a`,e.renderRevertControl),e.parent&&e.parent.appendChild(this.dom),this.scheduleMeasure()}dispatch(e,t){if(e.some(e=>e.docChanged)){let n=e[e.length-1],r=e.reduce((e,t)=>e.compose(t.changes),u.empty(e[0].startState.doc.length));this.chunks=t==this.a?W.updateA(this.chunks,n.newDoc,this.b.state.doc,r,this.diffConf):W.updateB(this.chunks,this.a.state.doc,n.newDoc,r,this.diffConf),t.update([...e,n.state.update({effects:H.of(this.chunks)})]);let i=t==this.a?this.b:this.a;i.update([i.state.update({effects:H.of(this.chunks)})]),this.scheduleMeasure()}else t.update(e)}reconfigure(e){if(`diffConfig`in e&&(this.diffConf=e.diffConfig),`orientation`in e){let t=e.orientation!=`b-a`;if(t!=(this.editorDOM.firstChild==this.a.dom.parentNode)){let e=this.a.dom.parentNode,n=this.b.dom.parentNode;e.remove(),n.remove(),this.editorDOM.insertBefore(t?e:n,this.editorDOM.firstChild),this.editorDOM.appendChild(t?n:e),this.revertToLeft=!this.revertToLeft,this.revertDOM&&(this.revertDOM.textContent=``)}}if(`revertControls`in e||`renderRevertControl`in e){let t=!!this.revertDOM,n=this.revertToA,r=this.renderRevert;`revertControls`in e&&(t=!!e.revertControls,n=e.revertControls==`b-to-a`),`renderRevertControl`in e&&(r=e.renderRevertControl),this.setupRevertControls(t,n,r)}let t=`highlightChanges`in e,n=`gutter`in e,r=`collapseUnchanged`in e;if(t||n||r){let i=[],a=[];if(t||n){let r=this.a.state.facet(V),o=n?e.gutter!==!1:r.markGutter,s=t?e.highlightChanges!==!1:r.highlightChanges;i.push(Q.reconfigure([V.of({side:`a`,sibling:()=>this.b,highlightChanges:s,markGutter:o}),o?K:[]])),a.push(Q.reconfigure([V.of({side:`b`,sibling:()=>this.a,highlightChanges:s,markGutter:o}),o?K:[]]))}if(r){let t=it.reconfigure(e.collapseUnchanged?et(e.collapseUnchanged):[]);i.push(t),a.push(t)}this.a.dispatch({effects:i}),this.b.dispatch({effects:a})}this.scheduleMeasure()}setupRevertControls(e,t,n){this.revertToA=t,this.revertToLeft=this.revertToA==(this.editorDOM.firstChild==this.a.dom.parentNode),this.renderRevert=n,!e&&this.revertDOM?(this.revertDOM.remove(),this.revertDOM=null):e&&!this.revertDOM?(this.revertDOM=this.editorDOM.insertBefore(document.createElement(`div`),this.editorDOM.firstChild.nextSibling),this.revertDOM.addEventListener(`mousedown`,e=>this.revertClicked(e)),this.revertDOM.className=`cm-merge-revert`):this.revertDOM&&(this.revertDOM.textContent=``)}scheduleMeasure(){this.measuring<0&&(this.measuring=(this.dom.ownerDocument.defaultView||window).requestAnimationFrame(()=>{this.measuring=-1,this.measure()}))}measure(){Xe(this.a,this.b,this.chunks),this.revertDOM&&this.updateRevertButtons()}updateRevertButtons(){let e=this.revertDOM,t=e.firstChild,n=this.a.viewport,r=this.b.viewport;for(let i=0;i<this.chunks.length;i++){let a=this.chunks[i];if(a.fromA>n.to||a.fromB>r.to)break;if(a.fromA<n.from||a.fromB<r.from)continue;let o=this.a.lineBlockAt(a.fromA).top+`px`;for(;t&&+t.dataset.chunk<i;)t=ot(t);t&&t.dataset.chunk==String(i)?(t.style.top!=o&&(t.style.top=o),t=t.nextSibling):e.insertBefore(this.renderRevertButton(o,i),t)}for(;t;)t=ot(t)}renderRevertButton(e,t){let n;if(this.renderRevert)n=this.renderRevert();else{n=document.createElement(`button`);let e=this.a.state.phrase(`Revert this chunk`);n.setAttribute(`aria-label`,e),n.setAttribute(`title`,e),n.textContent=this.revertToLeft?`⇜`:`⇝`}return n.style.top=e,n.setAttribute(`data-chunk`,String(t)),n}revertClicked(e){let t=e.target,n;for(;t&&t.parentNode!=this.revertDOM;)t=t.parentNode;if(t&&(n=this.chunks[t.dataset.chunk])){let[t,r,i,a,o,s]=this.revertToA?[this.b,this.a,n.fromB,n.toB,n.fromA,n.toA]:[this.a,this.b,n.fromA,n.toA,n.fromB,n.toB],c=t.state.sliceDoc(i,Math.max(i,a-1));i!=a&&s<=r.state.doc.length&&(c+=t.state.lineBreak),r.dispatch({changes:{from:o,to:Math.min(r.state.doc.length,s),insert:c},userEvent:`revert`}),e.preventDefault()}}destroy(){this.a.destroy(),this.b.destroy(),this.measuring>-1&&(this.dom.ownerDocument.defaultView||window).cancelAnimationFrame(this.measuring),this.dom.remove()}};function ot(e){let t=e.nextSibling;return e.remove(),t}var $=r();function st(e){switch(e.split(`.`).pop()?.toLowerCase()??``){case`js`:case`jsx`:return S({jsx:!0});case`ts`:case`tsx`:return S({jsx:!0,typescript:!0});case`py`:return p();case`html`:return w();case`css`:case`scss`:return _();case`json`:return x();case`md`:case`mdx`:return D();default:return null}}function ct({metadata:e}){let t=e?.filePath,n=e?.projectName,r=e?.ref1,a=e?.ref2,o=e?.file1,c=e?.file2,u=e?.original,d=e?.modified,p=u!=null||d!=null,m=!!(o&&c),[h,g]=(0,k.useState)(null),[_,v]=(0,k.useState)(null),[y,b]=(0,k.useState)(!p),[x,S]=(0,k.useState)(null),[C,w]=(0,k.useState)(`both`),{wordWrap:T,toggleWordWrap:E}=oe(),D=(0,k.useRef)(null),A=(0,k.useRef)(null);(0,k.useEffect)(()=>{if(p||!n)return;if(b(!0),S(null),o&&c){let e=new URLSearchParams;e.set(`file1`,o),e.set(`file2`,c),ne.get(`${O(n)}/files/compare?${e.toString()}`).then(e=>{v(e),b(!1)}).catch(e=>{S(e instanceof Error?e.message:`Failed to compare files`),b(!1)});return}let e;if(t){let i=new URLSearchParams;i.set(`file`,t),r&&i.set(`ref`,r),e=`${O(n)}/git/file-diff?${i.toString()}`}else if(r||a){let t=new URLSearchParams;r&&t.set(`ref1`,r),a&&t.set(`ref2`,a),e=`${O(n)}/git/diff?${t.toString()}`}else e=`${O(n)}/git/diff`;ne.get(e).then(e=>{g(e.diff),b(!1)}).catch(e=>{S(e instanceof Error?e.message:`Failed to load diff`),b(!1)})},[t,n,r,a,o,c]);let{original:j,modified:M}=(0,k.useMemo)(()=>p?{original:u??``,modified:d??``}:m&&_?_:h?lt(h):{original:``,modified:``},[h,p,u,d,m,_]),N=(0,k.useMemo)(()=>{let e=t??c??o;if(!e)return[];let n=st(e);return n?[n]:[]},[t,o,c]);if((0,k.useEffect)(()=>{let e=D.current;if(!e||y||x||!j&&!M)return;A.current&&=(A.current.destroy(),null),window.innerWidth;let t=[...N,te,l.editable.of(!1),ee.readOnly.of(!0),s(),...T?[l.lineWrapping]:[],l.theme({"&":{fontSize:`13px`,fontFamily:`var(--font-mono)`},"& .cm-changedText":{textDecoration:`none !important`,borderBottom:`none !important`,textDecorationLine:`none !important`,backgroundColor:`rgba(16, 185, 129, 0.4) !important`,borderRadius:`2px`},"& .cm-deletedChunk .cm-changedText":{backgroundColor:`rgba(239, 68, 68, 0.4) !important`}})],n=new at({parent:e,a:{doc:j,extensions:t},b:{doc:M,extensions:t},orientation:`a-b`,revertControls:void 0,highlightChanges:!0,gutter:!0});A.current=n;let r=n.a.dom.querySelector(`.cm-scroller`),i=n.b.dom.querySelector(`.cm-scroller`),a=!1,o=(e,t)=>{a||=(a=!0,t.scrollLeft=e.scrollLeft,!1)},c=()=>r&&i&&o(r,i),u=()=>r&&i&&o(i,r);return r?.addEventListener(`scroll`,c),i?.addEventListener(`scroll`,u),()=>{r?.removeEventListener(`scroll`,c),i?.removeEventListener(`scroll`,u),n.destroy(),A.current=null}},[j,M,N,y,x,T]),(0,k.useEffect)(()=>{let e=A.current;if(!e)return;let t=e.a.dom.closest(`.cm-mergeViewEditor`)??e.a.dom.parentElement,n=e.b.dom.closest(`.cm-mergeViewEditor`)??e.b.dom.parentElement,r=D.current?.querySelector(`.cm-mergeViewGutter`);t&&(t.style.display=C===`right`?`none`:``,t.style.flex=C===`left`?`1`:``),n&&(n.style.display=C===`left`?`none`:``,n.style.flex=C===`right`?`1`:``),r&&(r.style.display=C===`both`?``:`none`)},[C,j,M]),!n&&!p)return(0,$.jsx)(`div`,{className:`flex items-center justify-center h-full text-muted-foreground text-sm`,children:`No project selected.`});if(y)return(0,$.jsxs)(`div`,{className:`flex items-center justify-center h-full gap-2 text-muted-foreground`,children:[(0,$.jsx)(re,{className:`size-5 animate-spin`}),(0,$.jsx)(`span`,{className:`text-sm`,children:`Loading diff...`})]});if(x)return(0,$.jsx)(`div`,{className:`flex items-center justify-center h-full text-destructive text-sm`,children:x});if(!p&&!m&&(!h||h.trim()===``)&&!j&&!M)return(0,$.jsxs)(`div`,{className:`flex flex-col items-center justify-center h-full gap-2 text-muted-foreground`,children:[(0,$.jsx)(ie,{className:`size-8`}),(0,$.jsx)(`p`,{className:`text-sm`,children:`No changes detected`}),t&&(0,$.jsx)(`p`,{className:`text-xs font-mono`,children:t})]});let P=(0,$.jsxs)(`div`,{className:`flex items-center gap-0.5 shrink-0`,children:[(0,$.jsx)(`button`,{type:`button`,onClick:()=>w(C===`left`?`both`:`left`),className:`p-1 rounded hover:bg-muted transition-colors ${C===`left`?`bg-muted text-foreground`:``}`,title:`Expand original`,children:(0,$.jsx)(ae,{className:`size-3.5`})}),(0,$.jsx)(`button`,{type:`button`,onClick:()=>w(`both`),className:`p-1 rounded hover:bg-muted transition-colors ${C===`both`?`bg-muted text-foreground`:``}`,title:`Side by side`,children:(0,$.jsx)(i,{className:`size-3.5`})}),(0,$.jsx)(`button`,{type:`button`,onClick:()=>w(C===`right`?`both`:`right`),className:`p-1 rounded hover:bg-muted transition-colors ${C===`right`?`bg-muted text-foreground`:``}`,title:`Expand modified`,children:(0,$.jsx)(se,{className:`size-3.5`})}),(0,$.jsx)(`div`,{className:`w-px h-3.5 bg-border mx-0.5 shrink-0`}),(0,$.jsx)(`button`,{type:`button`,onClick:E,title:`Toggle word wrap`,className:`p-1 rounded hover:bg-muted transition-colors ${T?`bg-muted text-foreground`:``}`,children:(0,$.jsx)(f,{className:`size-3.5`})})]});return(0,$.jsxs)(`div`,{className:`flex flex-col h-full`,children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-2 px-3 py-1.5 border-b text-xs text-muted-foreground`,children:[(0,$.jsx)(ie,{className:`size-3.5`}),m?(0,$.jsxs)(`span`,{className:`font-mono truncate flex-1`,children:[o,` vs `,c]}):(0,$.jsxs)(`span`,{className:`flex-1 truncate`,children:[(0,$.jsx)(`span`,{className:`font-mono`,children:t??`Working tree changes`}),(r||a)&&(0,$.jsxs)(`span`,{children:[` (`,r?.slice(0,7)??`HEAD`,` vs `,a?.slice(0,7)??`working tree`,`)`]})]}),(0,$.jsx)(`div`,{className:`hidden md:block`,children:P})]}),(0,$.jsx)(`div`,{ref:D,className:`flex-1 overflow-auto touch-pinch-zoom [&_.cm-mergeView]:h-full`,style:{WebkitOverflowScrolling:`touch`}}),(0,$.jsx)(`div`,{className:`md:hidden flex justify-center border-t py-1 bg-background shrink-0`,children:P})]})}function lt(e){let t=e.split(`
|
|
2
|
+
`),n=[],r=[],i=!1;for(let e of t)if(!(e.startsWith(`diff --git`)||e.startsWith(`diff --no-index`)||e.startsWith(`index `)||e.startsWith(`new file`)||e.startsWith(`deleted file`)||e.startsWith(`old mode`)||e.startsWith(`new mode`)||e.startsWith(`---`)||e.startsWith(`+++`)||e.startsWith(`Binary files`)||e.startsWith(`\\ No newline`))){if(e.startsWith(`@@`)){i=!0;continue}if(i){if(e.startsWith(`-`))n.push(e.slice(1));else if(e.startsWith(`+`))r.push(e.slice(1));else if(e.startsWith(` `)||e===``){let t=e.startsWith(` `)?e.slice(1):e;n.push(t),r.push(t)}}}return{original:n.join(`
|
|
3
|
+
`),modified:r.join(`
|
|
4
|
+
`)}}export{ct as DiffViewer};
|