@cmmd-center/forge 0.13.129 → 0.13.130
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/bin.cjs +3 -2
- package/dist/bin.mjs +27 -26
- package/dist/client/assets/CanvasPanel-BBU-hosR.js +441 -0
- package/dist/client/assets/CompositeItem-DTyKsv13.js +2 -0
- package/dist/client/assets/CompositeList-Bc8TYCyy.js +2 -0
- package/dist/client/assets/DiffPanel-Mun9aNQu.js +64 -0
- package/dist/client/assets/{DiffPanel.logic-Dh302-U7.js → DiffPanel.logic-64OYDD5i.js} +2 -2
- package/dist/client/assets/{DiffWorkerPoolProvider-BzvZD9OT.js → DiffWorkerPoolProvider-BWe6U2yc.js} +53 -53
- package/dist/client/assets/PullRequestCodePanel-BB0oFGFq.js +5 -0
- package/dist/client/assets/ThemeEditorPanel-DHyAZtjN.js +2 -0
- package/dist/client/assets/Virtualizer-IjnQIg2n.js +2 -0
- package/dist/client/assets/{WorkerPoolContext-CCKWNBEN.js → WorkerPoolContext-CsSzcB1w.js} +46 -46
- package/dist/client/assets/canvasStateStore-DYt9MgFu.js +2 -0
- package/dist/client/assets/chevron-left-1XbEOuXj.js +2 -0
- package/dist/client/assets/chevron-right-DAF000Jz.js +2 -0
- package/dist/client/assets/{cmmdAuthRedirect-BUp02n05.js → cmmdAuthRedirect-B2FNK6pk.js} +2 -2
- package/dist/client/assets/{cmmdForgeRuntimeListResource-CX0gRiLq.js → cmmdForgeRuntimeListResource-Cq3OVsLZ.js} +9 -9
- package/dist/client/assets/{currentForgeWorkspaceStore-CJOllEQU.js → currentForgeWorkspaceStore-wQ-H1MIm.js} +2 -2
- package/dist/client/assets/debouncer-BEV7Iuwb.js +2 -0
- package/dist/client/assets/dialog-mwxYKYq-.js +2 -0
- package/dist/client/assets/getPseudoElementBounds-DJTX-eyW.js +2 -0
- package/dist/client/assets/index-MArBFUuB.js +301 -0
- package/dist/client/assets/index-whRqBJFC.css +1 -0
- package/dist/client/assets/minus-_j91i8bf.js +2 -0
- package/dist/client/assets/popover-BMHhFoom.js +2 -0
- package/dist/client/assets/react-D4GEJ3ir.js +2 -0
- package/dist/client/assets/scroll-area-9mmf9iy-.js +2 -0
- package/dist/client/assets/sidebarV2CustomSnoozeDialog-vLvqIwRU.js +2 -0
- package/dist/client/assets/{src-CFUzoLms.js → src-DICOHE3E.js} +2 -2
- package/dist/client/assets/switch-DpGoyzXB.js +2 -0
- package/dist/client/assets/themePalette-BII_gGLK.js +5 -0
- package/dist/client/assets/{toggle-CYJl9GZL.js → toggle-CiTk7ztA.js} +2 -2
- package/dist/client/assets/toggle-group-B0GQb1vL.js +2 -0
- package/dist/client/assets/tooltip-DlvXFVEM.js +2 -0
- package/dist/client/assets/useOpenInteractionType-KsRrk6uH.js +2 -0
- package/dist/client/assets/{utils-BQ72yH0H.js → utils-BWD4ATf-.js} +2 -2
- package/dist/client/index.html +29 -20
- package/dist/forge-build.json +1 -1
- package/dist/{open-yHTUkd2Y.mjs → open-2-reBrpv.mjs} +3 -3
- package/package.json +1 -1
- package/dist/client/assets/CanvasPanel-j0yQxyEH.js +0 -441
- package/dist/client/assets/CompositeItem-BxPZ_9BJ.js +0 -2
- package/dist/client/assets/DiffPanel-CPgmGVox.js +0 -64
- package/dist/client/assets/PullRequestCodePanel-DF0mftTO.js +0 -5
- package/dist/client/assets/ThemeEditorPanel-DCsxTx0Q.js +0 -2
- package/dist/client/assets/Virtualizer-DWobWo_j.js +0 -2
- package/dist/client/assets/canvasStateStore-DKtQcBVc.js +0 -2
- package/dist/client/assets/debouncer-BmyJL8Gi.js +0 -2
- package/dist/client/assets/index-CSBFknn_.css +0 -1
- package/dist/client/assets/index-YlFfIivj.js +0 -301
- package/dist/client/assets/popover-lOfV58pL.js +0 -2
- package/dist/client/assets/scroll-area-BxupGCij.js +0 -2
- package/dist/client/assets/switch-wFSVBlXv.js +0 -2
- package/dist/client/assets/themePalette-NfQV9Yfl.js +0 -5
- package/dist/client/assets/toggle-group-DB8Zelac.js +0 -2
- package/dist/client/assets/useOpenInteractionType-B983ff5H.js +0 -2
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{r as e,t}from"./rolldown-runtime-hePW80VL.js";import{Wa as n}from"./Stream-mUTFnSY9.js";var r=t((e=>{var t=n();function r(e,t){return e===t&&(e!==0||1/e==1/t)||e!==e&&t!==t}var i=typeof Object.is==`function`?Object.is:r,a=t.useState,o=t.useEffect,s=t.useLayoutEffect,c=t.useDebugValue;function l(e,t){var n=t(),r=a({inst:{value:n,getSnapshot:t}}),i=r[0].inst,l=r[1];return s(function(){i.value=n,i.getSnapshot=t,u(i)&&l({inst:i})},[e,n,t]),o(function(){return u(i)&&l({inst:i}),e(function(){u(i)&&l({inst:i})})},[e]),c(n),n}function u(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!i(e,n)}catch{return!0}}function d(e,t){return t()}var f=typeof window>`u`||window.document===void 0||window.document.createElement===void 0?d:l;e.useSyncExternalStore=t.useSyncExternalStore===void 0?f:t.useSyncExternalStore})),i=t(((e,t)=>{t.exports=r()})),a=t((e=>{var t=n(),r=i();function a(e,t){return e===t&&(e!==0||1/e==1/t)||e!==e&&t!==t}var o=typeof Object.is==`function`?Object.is:a,s=r.useSyncExternalStore,c=t.useRef,l=t.useEffect,u=t.useMemo,d=t.useDebugValue;e.useSyncExternalStoreWithSelector=function(e,t,n,r,i){var a=c(null);if(a.current===null){var f={hasValue:!1,value:null};a.current=f}else f=a.current;a=u(function(){function e(e){if(!a){if(a=!0,s=e,e=r(e),i!==void 0&&f.hasValue){var t=f.value;if(i(t,e))return c=t}return c=e}if(t=c,o(s,e))return t;var n=r(e);return i!==void 0&&i(t,n)?(s=e,t):(s=e,c=n)}var a=!1,s,c,l=n===void 0?null:n;return[function(){return e(t())},l===null?void 0:function(){return e(l())}]},[t,n,r,i]);var p=s(e,a[0],a[1]);return l(function(){f.hasValue=!0,f.value=p},[p]),d(p),p}})),o=t(((e,t)=>{t.exports=a()}));function s(e,t){if(e&&!t)return e;if(!e&&t)return t;if(e||t)return{...e,...t}}var c={};function l(e,t,n,r,i){if(!n&&!r&&!i&&!e)return d(t);let a=d(e);return t&&(a=f(a,t)),n&&(a=f(a,n)),r&&(a=f(a,r)),i&&(a=f(a,i)),a}function u(e){if(e.length===0)return c;if(e.length===1)return d(e[0]);let t=d(e[0]);for(let n=1;n<e.length;n+=1)t=f(t,e[n]);return t}function d(e){return g(e)?{..._(e,c)}:p(e)}function f(e,t){return g(t)?_(t,e):m(e,t)}function p(e){let t={...e};for(let e in t){let n=t[e];h(e,n)&&(t[e]=y(n))}return t}function m(e,t){if(!t)return e;for(let n in t){let r=t[n];switch(n){case`style`:e[n]=s(e.style,r);break;case`className`:e[n]=ee(e.className,r);break;default:e[n]=h(n,r)?v(e[n],r):r}}return e}function h(e,t){let n=e.charCodeAt(0),r=e.charCodeAt(1),i=e.charCodeAt(2);return n===111&&r===110&&i>=65&&i<=90&&(typeof t==`function`||t===void 0)}function g(e){return typeof e==`function`}function _(e,t){return g(e)?e(t):e??c}function v(e,t){return t?e?(...n)=>{let r=n[0];if(x(r)){let i=r;b(i);let a=t(...n);return i.baseUIHandlerPrevented||e?.(...n),a}let i=t(...n);return e?.(...n),i}:y(t):e}function y(e){return e&&((...t)=>{let n=t[0];return x(n)&&b(n),e(...t)})}function b(e){return e.preventBaseUIHandler=()=>{e.baseUIHandlerPrevented=!0},e}function ee(e,t){return t?e?t+` `+e:t:e}function x(e){return typeof e==`object`&&!!e&&`nativeEvent`in e}var S=e(n(),1);function te(e,t){return function(n,...r){let i=new URL(e);return i.searchParams.set(`code`,n.toString()),r.forEach(e=>i.searchParams.append(`args[]`,e)),`${t} error #${n}; visit ${i} for the full message.`}}var C=te(`https://base-ui.com/production-error`,`Base UI`),ne={};function w(e,t){let n=S.useRef(ne);return n.current===ne&&(n.current=e(t)),n}function T(e,t,n,r){let i=w(ie).current;return ae(i,e,t,n,r)&&se(i,[e,t,n,r]),i.callback}function re(e){let t=w(ie).current;return oe(t,e)&&se(t,e),t.callback}function ie(){return{callback:null,cleanup:null,refs:[]}}function ae(e,t,n,r,i){return e.refs[0]!==t||e.refs[1]!==n||e.refs[2]!==r||e.refs[3]!==i}function oe(e,t){return e.refs.length!==t.length||e.refs.some((e,n)=>e!==t[n])}function se(e,t){if(e.refs=t,t.every(e=>e==null)){e.callback=null;return}e.callback=n=>{if(e.cleanup&&=(e.cleanup(),null),n!=null){let r=Array(t.length).fill(null);for(let e=0;e<t.length;e+=1){let i=t[e];if(i!=null)switch(typeof i){case`function`:{let t=i(n);typeof t==`function`&&(r[e]=t);break}case`object`:i.current=n}}e.cleanup=()=>{for(let e=0;e<t.length;e+=1){let n=t[e];if(n!=null)switch(typeof n){case`function`:{let t=r[e];typeof t==`function`?t():n(null);break}case`object`:n.current=null}}}}}}var ce=19;function le(e){return ce>=e}function ue(e){if(!S.isValidElement(e))return null;let t=e,n=t.props;return(le(19)?n?.ref:t.ref)??null}function de(){}var E=Object.freeze([]),D=Object.freeze({});function fe(e,t){let n={};for(let r in e){let i=e[r];if(t?.hasOwnProperty(r)){let e=t[r](i);e!=null&&Object.assign(n,e);continue}i===!0?n[`data-${r.toLowerCase()}`]=``:i&&(n[`data-${r.toLowerCase()}`]=i.toString())}return n}function pe(e,t){return typeof e==`function`?e(t):e}function me(e,t){return typeof e==`function`?e(t):e}function he(e,t,n={}){let r=t.render,i=ge(t,n);return n.enabled===!1?null:ye(e,r,i,n.state??D)}function ge(e,t={}){let{className:n,style:r,render:i}=e,{state:a=D,ref:o,props:c,stateAttributesMapping:l,enabled:u=!0}=t,d=u?pe(n,a):void 0,f=u?me(r,a):void 0,p=u?fe(a,l):D,m=u&&c?_e(c):void 0,h=u?s(p,m)??{}:D;return typeof document<`u`&&(u?h.ref=Array.isArray(o)?re([h.ref,ue(i),...o]):T(h.ref,ue(i),o):T(null,null)),u?(d!==void 0&&(h.className=ee(h.className,d)),f!==void 0&&(h.style=s(h.style,f)),h):D}function _e(e){return Array.isArray(e)?u(e):l(void 0,e)}var ve=Symbol.for(`react.lazy`);function ye(e,t,n,r){if(t){if(typeof t==`function`)return t(n,r);let e=l(n,t.props);e.ref=n.ref;let i=t;return i?.$$typeof===ve&&(i=S.Children.toArray(t)[0]),S.cloneElement(i,e)}if(e&&typeof e==`string`)return be(e,n);throw Error(C(8))}function be(e,t){return e===`button`?(0,S.createElement)(`button`,{type:`button`,...t,key:t.key}):e===`img`?(0,S.createElement)(`img`,{alt:``,...t,key:t.key}):S.createElement(e,t)}var xe=(...e)=>e.filter((e,t,n)=>!!e&&e.trim()!==``&&n.indexOf(e)===t).join(` `).trim(),Se=e=>e.replace(/([a-z0-9])([A-Z])/g,`$1-$2`).toLowerCase(),Ce=e=>e.replace(/^([A-Z])|[\s-_]+(\w)/g,(e,t,n)=>n?n.toUpperCase():t.toLowerCase()),we=e=>{let t=Ce(e);return t.charAt(0).toUpperCase()+t.slice(1)},Te={xmlns:`http://www.w3.org/2000/svg`,width:24,height:24,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:2,strokeLinecap:`round`,strokeLinejoin:`round`},Ee=e=>{for(let t in e)if(t.startsWith(`aria-`)||t===`role`||t===`title`)return!0;return!1},De=(0,S.createContext)({}),Oe=()=>(0,S.useContext)(De),ke=(0,S.forwardRef)(({color:e,size:t,strokeWidth:n,absoluteStrokeWidth:r,className:i=``,children:a,iconNode:o,...s},c)=>{let{size:l=24,strokeWidth:u=2,absoluteStrokeWidth:d=!1,color:f=`currentColor`,className:p=``}=Oe()??{},m=r??d?Number(n??u)*24/Number(t??l):n??u;return(0,S.createElement)(`svg`,{ref:c,...Te,width:t??l??Te.width,height:t??l??Te.height,stroke:e??f,strokeWidth:m,className:xe(`lucide`,p,i),...!a&&!Ee(s)&&{"aria-hidden":`true`},...s},[...o.map(([e,t])=>(0,S.createElement)(e,t)),...Array.isArray(a)?a:[a]])}),Ae=(e,t)=>{let n=(0,S.forwardRef)(({className:n,...r},i)=>(0,S.createElement)(ke,{ref:i,iconNode:t,className:xe(`lucide-${Se(we(e))}`,`lucide-${e}`,n),...r}));return n.displayName=we(e),n},je=typeof document<`u`?S.useLayoutEffect:()=>{};function Me(){return typeof navigator>`u`?{userAgent:``,platform:``,maxTouchPoints:0}:{userAgent:navigator.userAgent,platform:navigator.platform??``,maxTouchPoints:navigator.maxTouchPoints??0}}var{userAgent:Ne,platform:Pe,maxTouchPoints:Fe}=Me(),O=Ne.toLowerCase(),k=Pe.toLowerCase(),A=/^i(os$|p)/.test(k)||k===`macintel`&&Fe>1,Ie=`android`,j=k===Ie||O.includes(Ie),Le=!A&&k.startsWith(`mac`);k.startsWith(`win`),!j&&/^(linux|chrome os)/.test(k);var Re=Le||A,ze=/jsdom|happydom/.test(O);function M(e){e.preventDefault(),e.stopPropagation()}function Be(e){return`nativeEvent`in e}function Ve(e){return e.pointerType===``&&e.isTrusted?!0:j&&e.pointerType?e.type===`click`&&e.buttons===1:e.detail===0&&!e.pointerType}function He(e){return ze?!1:!j&&e.width===0&&e.height===0||j&&e.width===1&&e.height===1&&e.pressure===0&&e.detail===0&&e.pointerType===`mouse`||e.width<1&&e.height<1&&e.pressure===0&&e.detail===0&&e.pointerType===`touch`}function Ue(e,t){let n=[`mouse`,`pen`];return t||n.push(``,void 0),n.includes(e)}function We(e){let t=e.type;return t===`click`||t===`mousedown`||t===`keydown`||t===`keyup`}function N(){return typeof window<`u`}function P(e){return Ke(e)?(e.nodeName||``).toLowerCase():`#document`}function F(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function Ge(e){return((Ke(e)?e.ownerDocument:e.document)||window.document)?.documentElement}function Ke(e){return N()?e instanceof Node||e instanceof F(e).Node:!1}function qe(e){return N()?e instanceof Element||e instanceof F(e).Element:!1}function I(e){return N()?e instanceof HTMLElement||e instanceof F(e).HTMLElement:!1}function L(e){return!N()||typeof ShadowRoot>`u`?!1:e instanceof ShadowRoot||e instanceof F(e).ShadowRoot}function Je(e){let{overflow:t,overflowX:n,overflowY:r,display:i}=z(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&i!==`inline`&&i!==`contents`}function Ye(e){return/^(table|td|th)$/.test(P(e))}function Xe(e){try{if(e.matches(`:popover-open`))return!0}catch{}try{return e.matches(`:modal`)}catch{return!1}}var Ze=/transform|translate|scale|rotate|perspective|filter/,Qe=/paint|layout|strict|content/,R=e=>!!e&&e!==`none`,$e;function et(e){let t=qe(e)?z(e):e;return R(t.transform)||R(t.translate)||R(t.scale)||R(t.rotate)||R(t.perspective)||!nt()&&(R(t.backdropFilter)||R(t.filter))||Ze.test(t.willChange||``)||Qe.test(t.contain||``)}function tt(e){let t=B(e);for(;I(t)&&!rt(t);){if(et(t))return t;if(Xe(t))return null;t=B(t)}return null}function nt(){return $e??=typeof CSS<`u`&&CSS.supports&&CSS.supports(`-webkit-backdrop-filter`,`none`),$e}function rt(e){return/^(html|body|#document)$/.test(P(e))}function z(e){return F(e).getComputedStyle(e)}function it(e){return qe(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function B(e){if(P(e)===`html`)return e;let t=e.assignedSlot||e.parentNode||L(e)&&e.host||Ge(e);return L(t)?t.host:t}function at(e){let t=B(e);return rt(t)?(e.ownerDocument||e).body:I(t)&&Je(t)?t:at(t)}function V(e,t,n){t===void 0&&(t=[]),n===void 0&&(n=!0);let r=at(e),i=r===e.ownerDocument?.body,a=F(r);if(i){let e=ot(a);return t.concat(a,a.visualViewport||[],Je(r)?r:[],e&&n?V(e):[])}return t.concat(r,V(r,[],n))}function ot(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}var st=`data-base-ui-focusable`,ct=`input:not([type='hidden']):not([disabled]),[contenteditable]:not([contenteditable='false']),textarea:not([disabled])`,lt=`ArrowLeft`,ut=`ArrowRight`,dt=`ArrowUp`,ft=`ArrowDown`;function pt(e){let t=e.activeElement;for(;t?.shadowRoot?.activeElement!=null;)t=t.shadowRoot.activeElement;return t}function mt(e,t){if(!e||!t)return!1;let n=t.getRootNode?.();if(e.contains(t))return!0;if(n&&L(n)){let n=t;for(;n;){if(e===n)return!0;n=n.parentNode||n.host}}return!1}function ht(e){return`composedPath`in e?e.composedPath()[0]:e.target}var gt=`none`,_t=`trigger-press`,vt=`trigger-hover`,yt=`trigger-focus`,bt=`outside-press`,xt=`item-press`,St=`close-press`,Ct=`clear-press`,wt=`chip-remove-press`,Tt=`input-change`,Et=`input-clear`,Dt=`input-press`,Ot=`focus-out`,kt=`escape-key`,At=`list-navigation`,jt=`keyboard`,Mt=`pointer`,Nt=`cancel-open`,Pt=`sibling-open`,Ft=`disabled`,It=`imperative-action`,Lt=`window-resize`;function Rt(e,t,n,r){let i=!1,a=!1,o=r??D;return{reason:e,event:t??new Event(`base-ui`),cancel(){i=!0},allowPropagation(){a=!0},get isCanceled(){return i},get isPropagationAllowed(){return a},trigger:n,...o}}function zt(e,t,n){let r=n??D;return{reason:e,event:t??new Event(`base-ui`),...r}}var H={...S},U=H.useInsertionEffect,Bt=U&&U!==H.useLayoutEffect?U:e=>e();function Vt(e){let t=w(Ht).current;return t.next=e,Bt(t.effect),t.trampoline}function Ht(){let e={next:void 0,callback:Ut,trampoline:(...t)=>e.callback?.(...t),effect:()=>{e.callback=e.next}};return e}function Ut(){}var Wt=Math.min,Gt=Math.max,Kt=Math.round,W=Math.floor,qt=e=>({x:e,y:e}),Jt={left:`right`,right:`left`,bottom:`top`,top:`bottom`};function Yt(e,t,n){return Gt(e,Wt(t,n))}function Xt(e,t){return typeof e==`function`?e(t):e}function G(e){return e.split(`-`)[0]}function K(e){return e.split(`-`)[1]}function Zt(e){return e===`x`?`y`:`x`}function Qt(e){return e===`y`?`height`:`width`}function $t(e){let t=e[0];return t===`t`||t===`b`?`y`:`x`}function en(e){return Zt($t(e))}function tn(e,t,n){n===void 0&&(n=!1);let r=K(e),i=en(e),a=Qt(i),o=i===`x`?r===(n?`end`:`start`)?`right`:`left`:r===`start`?`bottom`:`top`;return t.reference[a]>t.floating[a]&&(o=J(o)),[o,J(o)]}function nn(e){let t=J(e);return[q(e),t,q(t)]}function q(e){return e.includes(`start`)?e.replace(`start`,`end`):e.replace(`end`,`start`)}var rn=[`left`,`right`],an=[`right`,`left`],on=[`top`,`bottom`],sn=[`bottom`,`top`];function cn(e,t,n){switch(e){case`top`:case`bottom`:return n?t?an:rn:t?rn:an;case`left`:case`right`:return t?on:sn;default:return[]}}function ln(e,t,n,r){let i=K(e),a=cn(G(e),n===`start`,r);return i&&(a=a.map(e=>e+`-`+i),t&&(a=a.concat(a.map(q)))),a}function J(e){let t=G(e);return Jt[t]+e.slice(t.length)}function un(e){return{top:e.top??0,right:e.right??0,bottom:e.bottom??0,left:e.left??0}}function dn(e){return typeof e==`number`?{top:e,right:e,bottom:e,left:e}:un(e)}function fn(e){let{x:t,y:n,width:r,height:i}=e;return{width:r,height:i,top:n,left:t,right:t+r,bottom:n+i,x:t,y:n}}function Y(e,t,n){return Math.floor(e/t)!==n}function pn(e,t){return t<0||t>=e.length}function mn(e,t){return X(e.current,{disabledIndices:t})}function hn(e,t){return X(e.current,{decrement:!0,startingIndex:e.current.length,disabledIndices:t})}function X(e,{startingIndex:t=-1,decrement:n=!1,disabledIndices:r,amount:i=1}={}){let a=t;do a+=n?-i:i;while(a>=0&&a<=e.length-1&&Z(e,a,r));return a}function gn(e,{event:t,orientation:n,loopFocus:r,onLoop:i,rtl:a,cols:o,disabledIndices:s,minIndex:c,maxIndex:l,prevIndex:u,stopEvent:d=!1}){let f=u,p;if(t.key===`ArrowUp`?p=`up`:t.key===`ArrowDown`&&(p=`down`),p){let n=[],a=[],m=!1,h=0;{let t=null,r=-1;e.forEach((e,i)=>{if(e==null)return;h+=1;let o=e.closest(`[role="row"]`);o&&(m=!0),(o!==t||r===-1)&&(t=o,r+=1,n[r]=[]),n[r].push(i),a[i]=r})}let g=!1,_=0;if(m)for(let e of n){let t=e.length;t>_&&(_=t),t!==o&&(g=!0)}let v=g&&h<e.length,y=_||o,b=o=>{if(!g||u===-1)return;let c=a[u];if(c==null)return;let l=n[c].indexOf(u),d=o===`up`?-1:1;for(let o=c+d,f=0;f<n.length;f+=1,o+=d){if(o<0||o>=n.length){if(!r||v)return;if(o=o<0?n.length-1:0,i){let e=Math.min(l,n[o].length-1),r=i(t,u,n[o][e]??n[o][0]);o=a[r]??o}}let c=n[o];for(let t=Math.min(l,c.length-1);t>=0;--t){let n=c[t];if(!Z(e,n,s))return n}}},ee=t=>{if(!v||u===-1)return;let n=u%y,i=t===`up`?-y:y,a=l-l%y,o=W(l/y)+1;for(let t=u-n+i,c=0;c<o;c+=1,t+=i){if(t<0||t>l){if(!r)return;t=t<0?a:0}let i=Math.min(t+y-1,l);for(let r=Math.min(t+n,i);r>=t;--r)if(!Z(e,r,s))return r}};d&&M(t);let x=b(p)??ee(p);if(x!==void 0)f=x;else if(u===-1)f=p===`up`?l:c;else if(f=X(e,{startingIndex:u,amount:y,decrement:p===`up`,disabledIndices:s}),r){if(p===`up`&&(u-y<c||f<0)){let e=u%y,n=l%y,r=l-(n-e);f=n===e?l:n>e?r:r-y,i&&(f=i(t,u,f))}p===`down`&&u+y>l&&(f=X(e,{startingIndex:u%y-y,amount:y,disabledIndices:s}),i&&(f=i(t,u,f)))}pn(e,f)&&(f=u)}if(n===`both`){let n=W(u/o);t.key===(a?`ArrowLeft`:`ArrowRight`)&&(d&&M(t),u%o===o-1?r&&(f=X(e,{startingIndex:u-u%o-1,disabledIndices:s}),i&&(f=i(t,u,f))):(f=X(e,{startingIndex:u,disabledIndices:s}),r&&Y(f,o,n)&&(f=X(e,{startingIndex:u-u%o-1,disabledIndices:s}),i&&(f=i(t,u,f)))),Y(f,o,n)&&(f=u)),t.key===(a?`ArrowRight`:`ArrowLeft`)&&(d&&M(t),u%o===0?r&&(f=X(e,{startingIndex:u+(o-u%o),decrement:!0,disabledIndices:s}),i&&(f=i(t,u,f))):(f=X(e,{startingIndex:u,decrement:!0,disabledIndices:s}),r&&Y(f,o,n)&&(f=X(e,{startingIndex:u+(o-u%o),decrement:!0,disabledIndices:s}),i&&(f=i(t,u,f)))),Y(f,o,n)&&(f=u));let c=W(l/o)===n;pn(e,f)&&(r&&c?(f=t.key===(a?`ArrowRight`:`ArrowLeft`)?l:X(e,{startingIndex:u-u%o-1,disabledIndices:s}),i&&(f=i(t,u,f))):f=u)}return f}function Z(e,t,n){if(typeof n==`function`?n(t):n?.includes(t)??!1)return!0;let r=e[t];return r?!vn(r)||r.matches(`:disabled`)?!0:!n&&(r.hasAttribute(`disabled`)||r.getAttribute(`aria-disabled`)===`true`):!1}function _n(e){return e.visibility===`hidden`||e.visibility===`collapse`}function vn(e,t=e?z(e):null){return!e||!e.isConnected||!t||_n(t)?!1:typeof e.checkVisibility==`function`?e.checkVisibility():t.display!==`none`&&t.display!==`contents`}var yn=0;function bn(e,t=`mui`){let[n,r]=S.useState(e),i=e||n;return S.useEffect(()=>{n??(yn+=1,r(`${t}-${yn}`))},[n,t]),i}var xn=H.useId;function Sn(e,t){if(xn!==void 0){let n=xn();return e??(t?`${t}-${n}`:n)}return bn(e,t)}function Cn(e){return Sn(e,`base-ui`)}var wn=S.createContext(void 0);function Tn(){return S.useContext(wn)?.direction??`ltr`}var En=S.createContext(void 0);function Dn(e=!1){let t=S.useContext(En);if(t===void 0&&!e)throw Error(C(16));return t}function On(e){let{focusableWhenDisabled:t,disabled:n,composite:r=!1,tabIndex:i=0,isNativeButton:a}=e,o=r&&t!==!1,s=r&&t===!1;return{props:S.useMemo(()=>{let e={onKeyDown(e){n&&t&&e.key!==`Tab`&&e.preventDefault()}};return r||(e.tabIndex=i,!a&&n&&(e.tabIndex=t?i:-1)),(a&&(t||o)||!a&&n)&&(e[`aria-disabled`]=n),a&&(!t||s)&&(e.disabled=n),e},[r,n,t,o,s,a,i])}}function Q(e,t,{detail:n=0}={}){e.dispatchEvent(new(F(e)).PointerEvent(`click`,{bubbles:!0,cancelable:!0,composed:!0,detail:n,shiftKey:t.shiftKey,ctrlKey:t.ctrlKey,altKey:t.altKey,metaKey:t.metaKey}))}function kn(e={}){let{disabled:t=!1,focusableWhenDisabled:n,tabIndex:r=0,native:i=!0,composite:a}=e,o=S.useRef(null),s=Dn(!0),c=a??s!==void 0,{props:u}=On({focusableWhenDisabled:n,disabled:t,composite:c,tabIndex:r,isNativeButton:i}),d=S.useCallback(()=>{let e=o.current;An(e)&&c&&t&&u.disabled===void 0&&e.disabled&&(e.disabled=!1)},[t,u.disabled,c]);return je(d,[d]),{getButtonProps:S.useCallback((e={})=>{let{onClick:n,onMouseDown:r,onKeyUp:a,onKeyDown:o,onPointerDown:s,...d}=e;return l({onClick(e){if(t){e.preventDefault();return}n?.(e)},onMouseDown(e){t||r?.(e)},onKeyDown(e){if(t||(b(e),o?.(e),e.baseUIHandlerPrevented))return;let n=e.target===e.currentTarget,r=e.currentTarget,a=An(r),s=!i&&jn(r),l=n&&(i?a:!s),u=e.key===`Enter`,d=e.key===` `,f=r.getAttribute(`role`),p=f?.startsWith(`menuitem`)||f===`option`||f===`gridcell`;if(n&&c&&d){if(e.defaultPrevented&&p)return;e.preventDefault(),(!i||a)&&(e.preventBaseUIHandler(),Q(r,e));return}if(!l||i||!d&&!u){n&&s&&d&&e.preventDefault();return}e.defaultPrevented||(e.preventDefault(),u&&(e.preventBaseUIHandler(),Q(r,e)))},onKeyUp(e){if(!t){if(b(e),a?.(e),e.target===e.currentTarget&&i&&c&&An(e.currentTarget)&&e.key===` `){e.preventDefault();return}e.baseUIHandlerPrevented||e.target===e.currentTarget&&!i&&!c&&!e.defaultPrevented&&e.key===` `&&(e.preventBaseUIHandler(),Q(e.currentTarget,e))}},onPointerDown(e){if(t){e.preventDefault();return}s?.(e)}},i?{type:`button`}:{role:`button`},u,d)},[t,u,c,i]),buttonRef:Vt(e=>{o.current=e,d()})}}function An(e){return I(e)&&e.tagName===`BUTTON`}function jn(e){return I(e)&&e.tagName===`A`&&!!e.href}function Mn({controlled:e,default:t,name:n,state:r=`value`}){let{current:i}=S.useRef(e!==void 0),[a,o]=S.useState(t);return[i?e:a,S.useCallback(e=>{i||o(e)},[])]}var Nn=`ArrowUp`,Pn=`ArrowDown`,Fn=`ArrowLeft`,In=`ArrowRight`,Ln=`Home`,Rn=new Set([Nn,Pn,Fn,In,Ln,`End`]),zn=[`Shift`,`Control`,`Alt`,`Meta`];function Bn(e){return I(e)&&e.tagName===`INPUT`}function Vn(e){return!!(Bn(e)&&e.selectionStart!=null||I(e)&&e.tagName===`TEXTAREA`)}function Hn(e,t,n,r){if(!e||!t||!t.scrollTo)return;let i=e.scrollLeft,a=e.scrollTop,o=e.clientWidth<e.scrollWidth,s=e.clientHeight<e.scrollHeight;if(o&&r!==`vertical`){let r=Un(e,t,`left`),a=$(e),o=$(t);n===`ltr`&&(r+t.offsetWidth+o.scrollMarginRight>e.scrollLeft+e.clientWidth-a.scrollPaddingRight?i=r+t.offsetWidth+o.scrollMarginRight-e.clientWidth+a.scrollPaddingRight:r-o.scrollMarginLeft<e.scrollLeft+a.scrollPaddingLeft&&(i=r-o.scrollMarginLeft-a.scrollPaddingLeft)),n===`rtl`&&(r-o.scrollMarginLeft<e.scrollLeft+a.scrollPaddingLeft?i=r-o.scrollMarginLeft-a.scrollPaddingLeft:r+t.offsetWidth+o.scrollMarginRight>e.scrollLeft+e.clientWidth-a.scrollPaddingRight&&(i=r+t.offsetWidth+o.scrollMarginRight-e.clientWidth+a.scrollPaddingRight))}if(s&&r!==`horizontal`){let n=Un(e,t,`top`),r=$(e),i=$(t);n-i.scrollMarginTop<e.scrollTop+r.scrollPaddingTop?a=n-i.scrollMarginTop-r.scrollPaddingTop:n+t.offsetHeight+i.scrollMarginBottom>e.scrollTop+e.clientHeight-r.scrollPaddingBottom&&(a=n+t.offsetHeight+i.scrollMarginBottom-e.clientHeight+r.scrollPaddingBottom)}e.scrollTo({left:i,top:a,behavior:`auto`})}function Un(e,t,n){let r=n===`left`?`offsetLeft`:`offsetTop`,i=0;for(;t.offsetParent&&(i+=t[r],t.offsetParent!==e);)t=t.offsetParent;return i}function $(e){let t=getComputedStyle(e);return{scrollMarginTop:parseFloat(t.scrollMarginTop)||0,scrollMarginRight:parseFloat(t.scrollMarginRight)||0,scrollMarginBottom:parseFloat(t.scrollMarginBottom)||0,scrollMarginLeft:parseFloat(t.scrollMarginLeft)||0,scrollPaddingTop:parseFloat(t.scrollPaddingTop)||0,scrollPaddingRight:parseFloat(t.scrollPaddingRight)||0,scrollPaddingBottom:parseFloat(t.scrollPaddingBottom)||0,scrollPaddingLeft:parseFloat(t.scrollPaddingLeft)||0}}var Wn=S.createContext({register:()=>{},unregister:()=>{},subscribeMapChange:()=>()=>{},nextIndexRef:{current:0}});function Gn(){return S.useContext(Wn)}function Kn(e={}){let{guess:t,label:n,metadata:r,textRef:i,index:a}=e,{register:o,unregister:s,subscribeMapChange:c,nextIndexRef:l}=Gn(),u=S.useRef(-1),[d,f]=S.useState(a==null&&t?()=>{if(u.current===-1){let e=l.current;l.current+=1,u.current=e}return u.current}:-1),p=a??d,m=S.useRef(null),h=S.useCallback(e=>{let t=m.current;t&&s(t),m.current=e,e&&o(e,{metadata:r??null,index:a??null,label:n,textRef:i})},[a,o,s,r,n,i]);return je(()=>{if(a==null)return c(e=>{let t=m.current?e.get(m.current)?.index:null;t!=null&&f(t)})},[a,c]),{ref:h,index:p}}var qn=S.createContext(void 0);function Jn(e){let t=S.useContext(qn);if(t===void 0&&!e)throw Error(C(69));return t}function Yn(e={}){let{highlightItemOnHover:t,highlightedIndex:n,onHighlightedIndexChange:r}=Dn(),{ref:i,index:a}=Kn(e),o=n===a,s=S.useRef(null),c=T(i,s);return{compositeProps:{tabIndex:o?0:-1,onFocus(){r(a)},onMouseMove(){let e=s.current;if(!t||!e)return;let n=e.hasAttribute(`disabled`)||e.ariaDisabled===`true`;!o&&!n&&e.focus()}},compositeRef:c,index:a}}function Xn(e){let{render:t,className:n,style:r,state:i=D,props:a=E,refs:o=E,metadata:s,stateAttributesMapping:c,tag:l=`div`,...u}=e,{compositeProps:d,compositeRef:f}=Yn({metadata:s});return he(l,e,{state:i,ref:[f,...o],props:[d,...a,u],stateAttributesMapping:c})}export{Ct as $,ze as $t,qt as A,Ge as At,J as B,rt as Bt,gn as C,lt as Ct,pn as D,ct as Dt,vn as E,st as Et,tn as F,B as Ft,Wt as G,Xe as Gt,G as H,Je as Ht,Qt as I,F as It,Vt as J,Ue as Jt,fn as K,nt as Kt,nn as L,et as Lt,W as M,P as Mt,K as N,it as Nt,Z as O,z as Ot,en as P,V as Pt,wt as Q,M as Qt,Zt as R,qe as Rt,X as S,ft as St,mn as T,dt as Tt,$t as U,L as Ut,dn as V,Ke as Vt,Gt as W,Ye as Wt,zt as X,Ve as Xt,Rt as Y,Be as Yt,Nt as Z,He as Zt,En as _,o as _n,_t,Pn as a,je as an,Tt as at,Cn as b,mt as bt,Nn as c,me as cn,xt as ct,zn as d,de as dn,gt as dt,j as en,St as et,Vn as f,le as fn,bt as ft,Q as g,l as gn,vt as gt,kn as h,C as hn,yt as ht,Wn as i,O as in,It as it,Xt as j,ot as jt,Yt as k,tt as kt,Rn as l,E as ln,jt as lt,Mn as m,w as mn,Pt as mt,Jn as n,A as nn,kt as nt,Fn as o,Ae as on,Et as ot,Hn as p,T as pn,Mt as pt,Kt as q,We as qt,Kn as r,Le as rn,Ot as rt,In as s,he as sn,Dt as st,Xn as t,Re as tn,Ft as tt,Ln as u,D as un,At as ut,Dn as v,i as vn,Lt as vt,hn as w,ut as wt,Sn as x,ht as xt,Tn as y,pt as yt,ln as z,I as zt};
|
|
2
|
-
//# sourceMappingURL=CompositeItem-BxPZ_9BJ.js.map
|
|
@@ -1,64 +0,0 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-hePW80VL.js";import{Ha as t,Mi as n,Ua as r,Wa as i}from"./Stream-mUTFnSY9.js";import{Gr as a,Lr as o,Ls as s,Nn as c,Qn as l,Tn as u,Vn as d,Wn as f,Yo as p,c as m,d as h,fi as g,fn as _,kn as v,m as y,mi as b,ns as x,o as S,qn as C,qt as w,s as T,t as E,ts as D,u as O,zn as k}from"./WorkerPoolContext-CCKWNBEN.js";import{a as A,c as j,i as M,l as N,n as P,o as F,r as I,s as L,t as R,u as z}from"./Virtualizer-DWobWo_j.js";import{H as B,Hn as ee,Wn as te,j as V}from"./cmmdForgeRuntimeListResource-CX0gRiLq.js";import{On as H,at as U,ot as W}from"./src-CFUzoLms.js";import"./cmmdAuthRedirect-BUp02n05.js";import{t as G}from"./utils-BQ72yH0H.js";import{a as K,c as ne,d as re,h as ie,i as ae,l as oe,m as se,n as ce,o as q,p as le,r as ue,s as de,t as fe,u as pe}from"./DiffPanel.logic-Dh302-U7.js";import{n as me,t as J}from"./toggle-group-DB8Zelac.js";var Y=e(i(),1),he=typeof window>`u`?Y.useEffect:Y.useLayoutEffect;function ge({fileDiff:e,options:t,editorOptions:n,lineAnnotations:r,selectedLines:i,prerenderedHTML:a,metrics:o,hasGutterRenderUtility:s,hasCustomHeader:c,disableWorkerPool:l,edit:u}){let d=P(),f=i!==void 0,p=(0,Y.useContext)(E),h=T(),g=(0,Y.useRef)(null),_=m(n=>{if(n!=null){if(g.current!=null)throw Error(`useFileDiffInstance: An instance should not already exist when a node is created`);d==null?g.current=new re(X({controlledSelection:f,hasCustomHeader:c,hasGutterRenderUtility:s,options:t}),l?void 0:p,!0):g.current=new pe(X({controlledSelection:f,hasCustomHeader:c,hasGutterRenderUtility:s,options:t}),d,o,l?void 0:p,!0),g.current.hydrate({fileDiff:e,fileContainer:n,lineAnnotations:r,prerenderedHTML:a})}else{if(g.current==null)throw Error(`useFileDiffInstance: A FileDiff instance should exist when unmounting`);g.current.cleanUp(),g.current=null}});return he(()=>{let{current:n}=g;if(n==null)return;let a=X({controlledSelection:f,hasCustomHeader:c,hasGutterRenderUtility:s,options:t}),o=a!==void 0&&!w(n.options,a);n.setOptions(a),n.render({forceRender:o,fileDiff:e,lineAnnotations:r}),i!==void 0&&n.setSelectedLines(i)}),he(()=>{if(u&&g.current!=null){if(h===void 0)throw Error(`FileDiff: EditContext is not attached`);let e=h(n??{});if(e==null)throw Error(`FileDiff: EditProvider.createEditor must return an editor instance`);try{return e.edit(g.current)}catch(t){throw e.cleanUp(),t}}},[u]),{ref:_,getHoveredLine:(0,Y.useCallback)(()=>g.current?.getHoveredLine(),[])}}function X({options:e,controlledSelection:t,hasCustomHeader:n,hasGutterRenderUtility:r}){return t||r||n?{...e,controlledSelection:t,renderCustomHeader:n?S:e?.renderCustomHeader,renderGutterUtility:r?S:e?.renderGutterUtility}:e}var Z=r();function _e({fileDiff:e,options:t,editorOptions:n,metrics:r,lineAnnotations:i,selectedLines:a,className:o,style:s,prerenderedHTML:c,renderAnnotation:l,renderCustomHeader:u,renderHeaderPrefix:d,renderHeaderFilenameSuffix:f,renderHeaderMetadata:p,renderGutterUtility:m,disableWorkerPool:h=!1,edit:g=!1}){let{ref:v,getHoveredLine:y}=ge({fileDiff:e,options:t,editorOptions:n,metrics:r,lineAnnotations:i,selectedLines:a,prerenderedHTML:c,hasGutterRenderUtility:m!=null,hasCustomHeader:u!=null,disableWorkerPool:h,edit:g});return(0,Z.jsx)(_,{ref:v,className:o,style:s,children:I(oe({fileDiff:e,renderCustomHeader:u,renderHeaderPrefix:d,renderHeaderFilenameSuffix:f,renderHeaderMetadata:p,renderAnnotation:l,renderGutterUtility:m,lineAnnotations:i,getHoveredLine:y}),c)})}var Q=t();function ve(e){return e.fromTurnCount===0?H(U)({threadId:e.threadId,toTurnCount:e.toTurnCount}).pipe(n(e=>({kind:`fullThreadDiff`,input:e}))):H(W)({threadId:e.threadId,fromTurnCount:e.fromTurnCount,toTurnCount:e.toTurnCount}).pipe(n(e=>({kind:`turnDiff`,input:e})))}function ye(e){return e instanceof Error?e.message:typeof e==`string`?e:``}function be(e){let t=ye(e).trim();if(t.length===0)return`Failed to load checkpoint diff.`;let n=t.toLowerCase();if(n.includes(`not a git repository`))return`Turn diffs are unavailable because this project is not a git repository.`;if(n.includes(`checkpoint unavailable for thread`)||n.includes(`checkpoint invariant violation`)){let e=t.indexOf(`:`);if(e>=0){let n=t.slice(e+1).trim();if(n.length>0)return n}}return t}function xe(e){let t=ye(e).toLowerCase();return t.includes(`exceeds current turn count`)||t.includes(`checkpoint is unavailable for turn`)||t.includes(`filesystem checkpoint is unavailable`)}function Se(e){let t=ve(e);return D({queryKey:p.checkpointDiff(e),queryFn:async({signal:n})=>{if(!e.environmentId||!e.threadId||t._tag===`None`)throw Error(`Checkpoint diff is unavailable.`);let r=l(e.environmentId);try{return t.value.kind===`fullThreadDiff`?await r.orchestration.getFullThreadDiff(t.value.input,{signal:n}):await r.orchestration.getTurnDiff(t.value.input,{signal:n})}catch(e){throw Error(be(e),{cause:e})}},enabled:(e.enabled??!0)&&!!e.environmentId&&!!e.threadId&&t._tag===`Some`,staleTime:1/0,retry:(e,t)=>xe(t)?e<12:e<3,retryDelay:(e,t)=>xe(t)?Math.min(5e3,250*2**(e-1)):Math.min(1e3,100*2**(e-1))})}function Ce(e){if(!(!e.canScrollLeft&&!e.canScrollRight))return{maskImage:`linear-gradient(to right, ${e.canScrollLeft?`transparent 24px, black 72px`:`black`}, ${e.canScrollRight?`black calc(100% - 72px), transparent calc(100% - 24px)`:`black`})`}}function we(e){return e instanceof Error?e.message:e?`Failed to load checkpoint diff.`:null}function Te(e){return{environmentId:e.environmentId??null,threadId:e.threadId,fromTurnCount:e.range?.fromTurnCount??null,toTurnCount:e.range?.toTurnCount??null,cacheScope:e.selectedTurnId?`turn:${e.selectedTurnId}`:e.conversationCacheScope,enabled:e.enabled}}function Ee(){let e=(0,Q.c)(8),t=(0,Y.useRef)(null),[n,r]=(0,Y.useState)(!1),[i,a]=(0,Y.useState)(!1),o;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(o=()=>{let e=t.current;if(!e){r(!1),a(!1);return}let n=de({scrollLeft:e.scrollLeft,scrollWidth:e.scrollWidth,clientWidth:e.clientWidth});r(n.canScrollLeft),a(n.canScrollRight)},e[0]=o):o=e[0];let s=o,c;e[1]===Symbol.for(`react.memo_cache_sentinel`)?(c=e=>{t.current?.scrollBy({left:e,behavior:`smooth`})},e[1]=c):c=e[1];let l=c,u;e[2]===Symbol.for(`react.memo_cache_sentinel`)?(u=e=>{let n=t.current;n&&ne({scrollWidth:n.scrollWidth,clientWidth:n.clientWidth,deltaX:e.deltaX,deltaY:e.deltaY})&&(e.preventDefault(),n.scrollBy({left:e.deltaY,behavior:`auto`}))},e[2]=u):u=e[2];let d=u,f,p;e[3]===Symbol.for(`react.memo_cache_sentinel`)?(f=()=>{let e=t.current;if(!e)return;let n=window.requestAnimationFrame(s),r=()=>s();e.addEventListener(`scroll`,r,{passive:!0});let i=new ResizeObserver(()=>s());return i.observe(e),()=>{window.cancelAnimationFrame(n),e.removeEventListener(`scroll`,r),i.disconnect()}},p=[s],e[3]=f,e[4]=p):(f=e[3],p=e[4]),(0,Y.useEffect)(f,p);let m;return e[5]!==n||e[6]!==i?(m={ref:t,canScrollLeft:n,canScrollRight:i,scrollBy:l,onWheel:d,remeasure:s},e[5]=n,e[6]=i,e[7]=m):m=e[7],m}function De(e,t){let n=(0,Q.c)(5),r;n[0]===e.current?r=n[1]:(r=()=>{(e.current?.querySelector(`[data-turn-chip-selected='true']`))?.scrollIntoView({block:`nearest`,inline:`nearest`,behavior:`smooth`})},n[0]=e.current,n[1]=r);let i;n[2]!==e||n[3]!==t?(i=[e,t],n[2]=e,n[3]=t,n[4]=i):i=n[4],(0,Y.useEffect)(r,i)}var Oe=`
|
|
2
|
-
[data-diffs-header],
|
|
3
|
-
[data-diff],
|
|
4
|
-
[data-file],
|
|
5
|
-
[data-error-wrapper],
|
|
6
|
-
[data-virtualizer-buffer] {
|
|
7
|
-
--diffs-bg: color-mix(in srgb, var(--card) 90%, var(--background)) !important;
|
|
8
|
-
--diffs-light-bg: color-mix(in srgb, var(--card) 90%, var(--background)) !important;
|
|
9
|
-
--diffs-dark-bg: color-mix(in srgb, var(--card) 90%, var(--background)) !important;
|
|
10
|
-
--diffs-token-light-bg: transparent;
|
|
11
|
-
--diffs-token-dark-bg: transparent;
|
|
12
|
-
|
|
13
|
-
--diffs-bg-context-override: color-mix(in srgb, var(--background) 97%, var(--foreground));
|
|
14
|
-
--diffs-bg-hover-override: color-mix(in srgb, var(--background) 94%, var(--foreground));
|
|
15
|
-
--diffs-bg-separator-override: color-mix(in srgb, var(--background) 95%, var(--foreground));
|
|
16
|
-
--diffs-bg-buffer-override: color-mix(in srgb, var(--background) 90%, var(--foreground));
|
|
17
|
-
|
|
18
|
-
--diffs-bg-addition-override: color-mix(in srgb, var(--background) 92%, var(--success));
|
|
19
|
-
--diffs-bg-addition-number-override: color-mix(in srgb, var(--background) 88%, var(--success));
|
|
20
|
-
--diffs-bg-addition-hover-override: color-mix(in srgb, var(--background) 85%, var(--success));
|
|
21
|
-
--diffs-bg-addition-emphasis-override: color-mix(in srgb, var(--background) 80%, var(--success));
|
|
22
|
-
|
|
23
|
-
--diffs-bg-deletion-override: color-mix(in srgb, var(--background) 92%, var(--destructive));
|
|
24
|
-
--diffs-bg-deletion-number-override: color-mix(in srgb, var(--background) 88%, var(--destructive));
|
|
25
|
-
--diffs-bg-deletion-hover-override: color-mix(in srgb, var(--background) 85%, var(--destructive));
|
|
26
|
-
--diffs-bg-deletion-emphasis-override: color-mix(
|
|
27
|
-
in srgb,
|
|
28
|
-
var(--background) 80%,
|
|
29
|
-
var(--destructive)
|
|
30
|
-
);
|
|
31
|
-
|
|
32
|
-
background-color: var(--diffs-bg) !important;
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
[data-file-info] {
|
|
36
|
-
background-color: color-mix(in srgb, var(--card) 94%, var(--foreground)) !important;
|
|
37
|
-
border-block-color: var(--border) !important;
|
|
38
|
-
color: var(--foreground) !important;
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
[data-diffs-header] {
|
|
42
|
-
position: sticky !important;
|
|
43
|
-
top: 0;
|
|
44
|
-
z-index: 4;
|
|
45
|
-
background-color: color-mix(in srgb, var(--card) 94%, var(--foreground)) !important;
|
|
46
|
-
border-bottom: 1px solid var(--border) !important;
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
[data-title] {
|
|
50
|
-
cursor: pointer;
|
|
51
|
-
transition:
|
|
52
|
-
color 120ms ease,
|
|
53
|
-
text-decoration-color 120ms ease;
|
|
54
|
-
text-decoration: underline;
|
|
55
|
-
text-decoration-color: transparent;
|
|
56
|
-
text-underline-offset: 2px;
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
[data-title]:hover {
|
|
60
|
-
color: color-mix(in srgb, var(--foreground) 84%, var(--primary)) !important;
|
|
61
|
-
text-decoration-color: currentColor;
|
|
62
|
-
}
|
|
63
|
-
`;function ke(e){let t=(0,Q.c)(44),{mode:n}=e,r=n===void 0?`inline`:n,{resolvedTheme:i}=c(),o=a(),[s,l]=(0,Y.useState)(`stacked`),[d,f]=(0,Y.useState)(o.diffWordWrap),p=(0,Y.useRef)(null),m=(0,Y.useRef)(!1),g=Ee(),{activeCwd:_,activeThread:y,bodyState:b,diffOpen:x,inferredCheckpointTurnCountByTurnId:S,orderedTurnDiffSummaries:w,renderableFiles:T,renderablePatch:E,selectedFilePath:D,selectedTurn:O,selectedTurnId:A}=Le(i),j,M;t[0]!==x||t[1]!==o.diffWordWrap?(j=()=>{x&&!m.current&&f(o.diffWordWrap),m.current=x},M=[x,o.diffWordWrap],t[0]=x,t[1]=o.diffWordWrap,t[2]=j,t[3]=M):(j=t[2],M=t[3]),(0,Y.useEffect)(j,M);let N;t[4]===D?N=t[5]:(N=()=>{!D||!p.current||Array.from(p.current.querySelectorAll(`[data-diff-file-path]`)).find(e=>e.dataset.diffFilePath===D)?.scrollIntoView({block:`nearest`})},t[4]=D,t[5]=N);let P;t[6]!==T||t[7]!==D?(P=[D,T],t[6]=T,t[7]=D,t[8]=P):P=t[8],(0,Y.useEffect)(N,P);let F;t[9]===_?F=t[10]:(F=e=>{let t=k();if(!t)return;let n=_?u(e,_):e;v(t,n).catch(Ae)},t[9]=_,t[10]=F);let I=F,L;t[11]===y?L=t[12]:(L=e=>{y&&C.getState().openDiff(te(ee(y.environmentId,y.id)),e)},t[11]=y,t[12]=L);let R=L,z;t[13]===y?z=t[14]:(z=()=>{y&&C.getState().openDiff(te(ee(y.environmentId,y.id)))},t[13]=y,t[14]=z);let B=z,V;t[15]===g.remeasure?V=t[16]:(V=()=>{let e=window.requestAnimationFrame(g.remeasure);return()=>window.cancelAnimationFrame(e)},t[15]=g.remeasure,t[16]=V);let H;t[17]!==w||t[18]!==A||t[19]!==g.remeasure?(H=[w,A,g.remeasure],t[17]=w,t[18]=A,t[19]=g.remeasure,t[20]=H):H=t[20],(0,Y.useEffect)(V,H),De(g.ref,O?.turnId??A);let U;t[21]!==s||t[22]!==d||t[23]!==S||t[24]!==w||t[25]!==R||t[26]!==B||t[27]!==O||t[28]!==A||t[29]!==o||t[30]!==g?(U=(0,Z.jsx)(je,{diffRenderMode:s,diffWordWrap:d,inferredCheckpointTurnCountByTurnId:S,orderedTurnDiffSummaries:w,selectTurn:R,selectWholeConversation:B,selectedTurn:O,selectedTurnId:A,setDiffRenderMode:l,setDiffWordWrap:f,settings:o,turnStrip:g}),t[21]=s,t[22]=d,t[23]=S,t[24]=w,t[25]=R,t[26]=B,t[27]=O,t[28]=A,t[29]=o,t[30]=g,t[31]=U):U=t[31];let W=U,G;t[32]!==b||t[33]!==s||t[34]!==d||t[35]!==I||t[36]!==T||t[37]!==E||t[38]!==i?(G=(0,Z.jsx)(Me,{bodyState:b,diffRenderMode:s,diffWordWrap:d,openDiffFileInEditor:I,patchViewportRef:p,renderableFiles:T,renderablePatch:E,resolvedTheme:i}),t[32]=b,t[33]=s,t[34]=d,t[35]=I,t[36]=T,t[37]=E,t[38]=i,t[39]=G):G=t[39];let K;return t[40]!==W||t[41]!==r||t[42]!==G?(K=(0,Z.jsx)(h,{mode:r,header:W,children:G}),t[40]=W,t[41]=r,t[42]=G,t[43]=K):K=t[43],K}function Ae(e){console.warn(`Failed to open diff file in editor.`,e)}function je(e){let t=(0,Q.c)(59),{diffRenderMode:n,diffWordWrap:r,inferredCheckpointTurnCountByTurnId:i,orderedTurnDiffSummaries:a,selectTurn:o,selectWholeConversation:s,selectedTurn:c,selectedTurnId:l,setDiffRenderMode:u,setDiffWordWrap:d,settings:f,turnStrip:p}=e,m,h;t[0]===p?(m=t[1],h=t[2]):(m=(0,Z.jsx)(Be,{direction:`left`,strip:p}),h=(0,Z.jsx)(Be,{direction:`right`,strip:p}),t[0]=p,t[1]=m,t[2]=h);let g=p.ref,_;t[3]!==p.canScrollLeft||t[4]!==p.canScrollRight?(_=Ce({canScrollLeft:p.canScrollLeft,canScrollRight:p.canScrollRight}),t[3]=p.canScrollLeft,t[4]=p.canScrollRight,t[5]=_):_=t[5];let v=p.onWheel,y=l===null,b=l===null?`border-border bg-accent text-accent-foreground`:`border-border/70 bg-background/70 text-muted-foreground/80 hover:border-border hover:text-foreground/80`,x;t[6]===b?x=t[7]:(x=G(`rounded-md border px-2 py-1 text-left transition-colors`,b),t[6]=b,t[7]=x);let S;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(S=(0,Z.jsx)(`div`,{className:`text-[10px] leading-tight font-medium`,children:`All turns`}),t[8]=S):S=t[8];let C;t[9]===x?C=t[10]:(C=(0,Z.jsx)(`div`,{className:x,children:S}),t[9]=x,t[10]=C);let w;t[11]!==s||t[12]!==C||t[13]!==y?(w=(0,Z.jsx)(`button`,{type:`button`,className:`shrink-0 rounded-md`,onClick:s,"data-turn-chip-selected":y,children:C}),t[11]=s,t[12]=C,t[13]=y,t[14]=w):w=t[14];let T;if(t[15]!==i||t[16]!==a||t[17]!==o||t[18]!==c?.turnId||t[19]!==f){let e;t[21]!==i||t[22]!==o||t[23]!==c?.turnId||t[24]!==f?(e=e=>(0,Z.jsx)(Ve,{summary:e,selected:e.turnId===c?.turnId,turnCount:e.checkpointTurnCount??i[e.turnId],timestampFormat:f.timestampFormat,onSelect:o},e.turnId),t[21]=i,t[22]=o,t[23]=c?.turnId,t[24]=f,t[25]=e):e=t[25],T=a.map(e),t[15]=i,t[16]=a,t[17]=o,t[18]=c?.turnId,t[19]=f,t[20]=T}else T=t[20];let E;t[26]!==w||t[27]!==T||t[28]!==_||t[29]!==p.onWheel||t[30]!==p.ref?(E=(0,Z.jsxs)(`div`,{ref:g,className:`turn-chip-strip flex gap-1 overflow-x-auto px-8 py-0.5`,style:_,onWheel:v,children:[w,T]}),t[26]=w,t[27]=T,t[28]=_,t[29]=p.onWheel,t[30]=p.ref,t[31]=E):E=t[31];let D;t[32]!==m||t[33]!==E||t[34]!==h?(D=(0,Z.jsxs)(`div`,{className:`relative min-w-0 flex-1 [-webkit-app-region:no-drag]`,children:[m,h,E]}),t[32]=m,t[33]=E,t[34]=h,t[35]=D):D=t[35];let O;t[36]===n?O=t[37]:(O=[n],t[36]=n,t[37]=O);let k;t[38]===u?k=t[39]:(k=e=>{let t=e[0];(t===`stacked`||t===`split`)&&u(t)},t[38]=u,t[39]=k);let A;t[40]===Symbol.for(`react.memo_cache_sentinel`)?(A=(0,Z.jsx)(J,{"aria-label":`Stacked diff view`,value:`stacked`,children:(0,Z.jsx)(se,{className:`size-3`})}),t[40]=A):A=t[40];let j;t[41]===Symbol.for(`react.memo_cache_sentinel`)?(j=(0,Z.jsx)(J,{"aria-label":`Split diff view`,value:`split`,children:(0,Z.jsx)(ie,{className:`size-3`})}),t[41]=j):j=t[41];let M;t[42]!==O||t[43]!==k?(M=(0,Z.jsxs)(me,{className:`shrink-0`,variant:`outline`,size:`xs`,value:O,onValueChange:k,children:[A,j]}),t[42]=O,t[43]=k,t[44]=M):M=t[44];let N=r?`Disable diff line wrapping`:`Enable diff line wrapping`,P=r?`Disable line wrapping`:`Enable line wrapping`,F;t[45]===d?F=t[46]:(F=e=>{d(!!e)},t[45]=d,t[46]=F);let I;t[47]===Symbol.for(`react.memo_cache_sentinel`)?(I=(0,Z.jsx)(le,{className:`size-3`}),t[47]=I):I=t[47];let L;t[48]!==r||t[49]!==N||t[50]!==P||t[51]!==F?(L=(0,Z.jsx)(J,{"aria-label":N,title:P,variant:`outline`,size:`xs`,pressed:r,onPressedChange:F,children:I}),t[48]=r,t[49]=N,t[50]=P,t[51]=F,t[52]=L):L=t[52];let R;t[53]!==M||t[54]!==L?(R=(0,Z.jsxs)(`div`,{className:`flex shrink-0 items-center gap-1 [-webkit-app-region:no-drag]`,children:[M,L]}),t[53]=M,t[54]=L,t[55]=R):R=t[55];let z;return t[56]!==D||t[57]!==R?(z=(0,Z.jsxs)(Z.Fragment,{children:[D,R]}),t[56]=D,t[57]=R,t[58]=z):z=t[58],z}function Me(e){let t=(0,Q.c)(18),{bodyState:n,diffRenderMode:r,diffWordWrap:i,openDiffFileInEditor:a,patchViewportRef:o,renderableFiles:s,renderablePatch:c,resolvedTheme:l}=e;if(n.kind===`no-thread`){let e;return t[0]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsx)($,{children:`Select a thread to inspect turn diffs.`}),t[0]=e):e=t[0],e}if(n.kind===`not-git-repo`){let e;return t[1]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsx)($,{children:`Turn diffs are unavailable because this project is not a git repository.`}),t[1]=e):e=t[1],e}if(n.kind===`no-completed-turns`){let e;return t[2]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsx)($,{children:`No completed turns yet.`}),t[2]=e):e=t[2],e}let u;t[3]!==n.error||t[4]!==c?(u=n.error&&!c&&(0,Z.jsx)(`div`,{className:`px-3`,children:(0,Z.jsx)(`p`,{className:`mb-2 text-[11px] text-destructive-foreground`,children:n.error})}),t[3]=n.error,t[4]=c,t[5]=u):u=t[5];let d;t[6]!==n||t[7]!==r||t[8]!==i||t[9]!==a||t[10]!==s||t[11]!==c||t[12]!==l?(d=c?c.kind===`files`?(0,Z.jsx)(R,{className:`diff-render-surface h-full min-h-0 overflow-auto px-2 pb-2`,config:{overscrollSize:600,intersectionObserverMargin:1200},children:s.map(e=>{let t=q(e),n=`${fe(e)}:${l}`;return(0,Z.jsx)(`div`,{"data-diff-file-path":t,className:`diff-render-file mb-2 rounded-md first:mt-2 last:mb-0`,onClickCapture:e=>{(e.nativeEvent.composedPath?.()??[]).some(Ne)&&a(t)},children:(0,Z.jsx)(_e,{fileDiff:e,options:{diffStyle:r===`split`?`split`:`unified`,lineDiffType:`none`,overflow:i?`wrap`:`scroll`,theme:y(l),themeType:l,unsafeCSS:Oe}})},n)})}):(0,Z.jsx)(`div`,{className:`h-full overflow-auto p-2`,children:(0,Z.jsxs)(`div`,{className:`space-y-2`,children:[(0,Z.jsx)(`p`,{className:`text-[11px] text-muted-foreground/75`,children:c.reason}),(0,Z.jsx)(`pre`,{className:G(`max-h-[72vh] rounded-md border border-border/70 bg-background/70 p-3 font-mono text-[11px] leading-relaxed text-muted-foreground/90`,i?`overflow-auto whitespace-pre-wrap wrap-break-word`:`overflow-auto`),children:c.text})]})}):(0,Z.jsx)(Re,{bodyState:n}),t[6]=n,t[7]=r,t[8]=i,t[9]=a,t[10]=s,t[11]=c,t[12]=l,t[13]=d):d=t[13];let f;return t[14]!==o||t[15]!==u||t[16]!==d?(f=(0,Z.jsx)(Z.Fragment,{children:(0,Z.jsxs)(`div`,{ref:o,className:`diff-panel-viewport min-h-0 min-w-0 flex-1 overflow-hidden`,children:[u,d]})}),t[14]=o,t[15]=u,t[16]=d,t[17]=f):f=t[17],f}function Ne(e){return e instanceof Element&&e.hasAttribute(`data-title`)}function $(e){let t=(0,Q.c)(2),{children:n}=e,r;return t[0]===n?r=t[1]:(r=(0,Z.jsx)(`div`,{className:`flex flex-1 items-center justify-center px-5 text-center text-xs text-muted-foreground/70`,children:n}),t[0]=n,t[1]=r),r}function Pe(){let e=(0,Q.c)(19),t;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t={strict:!1,select:Ie},e[0]=t):t=e[0];let n=s(t),r;e[1]===Symbol.for(`react.memo_cache_sentinel`)?(r={strict:!1,select:Fe},e[1]=r):r=e[1];let i=z(r),a=i.rightPanel===`diff`,c=n?.threadId??null,l,u;e[2]===n?u=e[3]:(u=o(n),e[2]=n,e[3]=u),l=u;let f=B(l),p=He(f),m=f?.worktreePath,h=p?.cwd,g;e[4]!==m||e[5]!==h?(g=F({threadWorktreePath:m,projectCwd:h}),e[4]=m,e[5]=h,e[6]=g):g=e[6];let _=g,v=f?.environmentId??null,y=_??null,b;e[7]!==v||e[8]!==y?(b={environmentId:v,cwd:y},e[7]=v,e[8]=y,e[9]=b):b=e[9];let x=d(b),S;e[10]===x.data?S=e[11]:(S=L(x.data),e[10]=x.data,e[11]=S);let C=S,w;return e[12]!==_||e[13]!==f||e[14]!==c||e[15]!==a||e[16]!==i||e[17]!==C?(w={activeThread:f,activeThreadId:c,activeCwd:_,isGitRepo:C,diffSearch:i,diffOpen:a},e[12]=_,e[13]=f,e[14]=c,e[15]=a,e[16]=i,e[17]=C,e[18]=w):w=e[18],w}function Fe(e){return A(e)}function Ie(e){return g(e)}function Le(e){let{activeThread:t,activeThreadId:n,activeCwd:r,isGitRepo:i,diffSearch:a,diffOpen:o}=Pe(),{turnDiffSummaries:s,inferredCheckpointTurnCountByTurnId:c}=M(t),l=a.diffTurnId??null,u=l===null?null:a.diffFilePath??null,{activeCheckpointRange:d,conversationCacheScope:f,orderedTurnDiffSummaries:p,selectedTurn:m}=(0,Y.useMemo)(()=>K({summaries:s,inferredCheckpointTurnCountByTurnId:c,selectedTurnId:l}),[c,l,s]),h=x(Se(Te({environmentId:t?.environmentId,threadId:n,range:d,selectedTurnId:m?.turnId,conversationCacheScope:f,enabled:i}))),g=h.isLoading,_=we(h.error),v=h.data?.diff,y=typeof v==`string`&&v.trim().length===0,{emptyDiffMessage:b}=(0,Y.useMemo)(()=>ae(m),[m]),S=(0,Y.useMemo)(()=>ce(v,`diff-panel:${e}`),[e,v]),C=(0,Y.useMemo)(()=>Ue(S),[S]);return{activeCwd:r,activeThread:t,bodyState:ue({hasActiveThread:!!t,isGitRepo:i,turnSummaryCount:p.length,checkpointDiffError:_,hasRenderablePatch:!!S,isLoadingCheckpointDiff:g,hasNoNetChanges:y,emptyDiffMessage:b}),diffOpen:o,inferredCheckpointTurnCountByTurnId:c,orderedTurnDiffSummaries:p,renderableFiles:C,renderablePatch:S,selectedFilePath:u,selectedTurn:m,selectedTurnId:l}}function Re(e){let t=(0,Q.c)(4),{bodyState:n}=e;if(n.kind===`loading`){let e;return t[0]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsx)(O,{label:`Loading checkpoint diff...`}),t[0]=e):e=t[0],e}let r;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,Z.jsx)(j,{className:`size-7 text-muted-foreground/25`}),t[1]=r):r=t[1];let i=n.kind===`empty`?n.message:`No diff is available for this range.`,a;return t[2]===i?a=t[3]:(a=(0,Z.jsxs)(`div`,{className:`flex h-full flex-col items-center justify-center gap-2 px-5 py-2 text-center`,children:[r,(0,Z.jsx)(`p`,{className:`text-xs text-muted-foreground/70`,children:i})]}),t[2]=i,t[3]=a),a}var ze=180;function Be(e){let t=(0,Q.c)(14),{direction:n,strip:r}=e,i=n===`left`,a=i?r.canScrollLeft:r.canScrollRight,o=i?N:b,s=i?`left-0`:`right-0`,c=a?`border-border/70 hover:border-border hover:text-foreground`:`cursor-not-allowed border-border/40 text-muted-foreground/40`,l;t[0]!==s||t[1]!==c?(l=G(`absolute top-1/2 z-20 inline-flex size-6 -translate-y-1/2 items-center justify-center rounded-md border bg-background/90 text-muted-foreground transition-colors`,s,c),t[0]=s,t[1]=c,t[2]=l):l=t[2];let u;t[3]!==i||t[4]!==r?(u=()=>r.scrollBy(i?-180:ze),t[3]=i,t[4]=r,t[5]=u):u=t[5];let d=!a,f=`Scroll turn list ${n}`,p;t[6]===o?p=t[7]:(p=(0,Z.jsx)(o,{className:`size-3.5`}),t[6]=o,t[7]=p);let m;return t[8]!==l||t[9]!==u||t[10]!==d||t[11]!==f||t[12]!==p?(m=(0,Z.jsx)(`button`,{type:`button`,className:l,onClick:u,disabled:d,"aria-label":f,children:p}),t[8]=l,t[9]=u,t[10]=d,t[11]=f,t[12]=p,t[13]=m):m=t[13],m}function Ve(e){let t=(0,Q.c)(23),{summary:n,selected:r,turnCount:i,timestampFormat:a,onSelect:o}=e,s;t[0]!==o||t[1]!==n.turnId?(s=()=>o(n.turnId),t[0]=o,t[1]=n.turnId,t[2]=s):s=t[2];let c=n.turnId,l=r?`border-border bg-accent text-accent-foreground`:`border-border/70 bg-background/70 text-muted-foreground/80 hover:border-border hover:text-foreground/80`,u;t[3]===l?u=t[4]:(u=G(`rounded-md border px-2 py-1 text-left transition-colors`,l),t[3]=l,t[4]=u);let d=i??`?`,p;t[5]===d?p=t[6]:(p=(0,Z.jsxs)(`span`,{className:`text-[10px] leading-tight font-medium`,children:[`Turn `,d]}),t[5]=d,t[6]=p);let m;t[7]!==n.completedAt||t[8]!==a?(m=f(n.completedAt,a),t[7]=n.completedAt,t[8]=a,t[9]=m):m=t[9];let h;t[10]===m?h=t[11]:(h=(0,Z.jsx)(`span`,{className:`text-[9px] leading-tight opacity-70`,children:m}),t[10]=m,t[11]=h);let g;t[12]!==p||t[13]!==h?(g=(0,Z.jsxs)(`div`,{className:`flex items-center gap-1`,children:[p,h]}),t[12]=p,t[13]=h,t[14]=g):g=t[14];let _;t[15]!==u||t[16]!==g?(_=(0,Z.jsx)(`div`,{className:u,children:g}),t[15]=u,t[16]=g,t[17]=_):_=t[17];let v;return t[18]!==r||t[19]!==n.turnId||t[20]!==s||t[21]!==_?(v=(0,Z.jsx)(`button`,{type:`button`,className:`shrink-0 rounded-md`,onClick:s,title:c,"data-turn-chip-selected":r,children:_}),t[18]=r,t[19]=n.turnId,t[20]=s,t[21]=_,t[22]=v):v=t[22],v}function He(e){let t=(0,Q.c)(3),n=e?.environmentId,r=e?.projectId,i;return t[0]!==n||t[1]!==r?(i=e=>n&&r?V(e,{environmentId:n,projectId:r}):void 0,t[0]=n,t[1]=r,t[2]=i):i=t[2],B(i)}function Ue(e){return!e||e.kind!==`files`?[]:e.files.toSorted((e,t)=>q(e).localeCompare(q(t),void 0,{numeric:!0,sensitivity:`base`}))}export{ke as default};
|
|
64
|
-
//# sourceMappingURL=DiffPanel-CPgmGVox.js.map
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-hePW80VL.js";import{Ha as t,Ua as n,Wa as r}from"./Stream-mUTFnSY9.js";import{Ft as i}from"./useOpenInteractionType-B983ff5H.js";import{Dn as a,E as o,L as s,b as c,c as l,f as u,fn as d,gn as f,jn as p,l as m,n as h,p as g,s as _,t as v,u as y,un as b,v as x,wn as S}from"./DiffWorkerPoolProvider-BzvZD9OT.js";import{$t as C,Gt as w,I as T,Jt as E,Kt as D,Nn as O,Xt as k,Yt as A,Zt as j,c as M,cn as N,dn as P,en as F,fn as I,in as L,m as R,mi as z,ps as B,qt as ee,rn as V,rs as te,s as ne,sn as H,t as U,u as W}from"./WorkerPoolContext-CCKWNBEN.js";import{rn as G}from"./cmmdForgeRuntimeListResource-CX0gRiLq.js";import{t as re}from"./utils-BQ72yH0H.js";import{s as K}from"./scroll-area-BxupGCij.js";import{o as ie}from"./debouncer-BmyJL8Gi.js";import{S as ae}from"./popover-lOfV58pL.js";import{f as oe,h as se,l as q,m as ce,n as le,o as J,p as ue,t as de,u as fe}from"./DiffPanel.logic-Dh302-U7.js";function pe(e,t){return te(e,p,t)}function me(){return typeof window>`u`||typeof window.matchMedia!=`function`?!1:window.matchMedia(`(prefers-reduced-motion: reduce)`).matches}function he(e,t){return e==null||t==null?e===t:e.header!==t.header||e.footer!==t.footer?!1:ge(e.items,t.items)}function ge(e,t){if(e==null||t==null)return e===t;if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++){let r=e[n],i=t[n];if(r==null||i==null||r.id!==i.id||r.type!==i.type||r.element!==i.element||r.instance!==i.instance||r.version!==i.version)return!1}return!0}function _e(e,t,n){let r=document.createElement(`div`);return r.style.display=`flow-root`,e===`header`?(r.setAttribute(F,``),t.before(r)):(r.setAttribute(C,``),t.after(r)),n?.observe(r),r}function Y(e){let t=window.devicePixelRatio??1;return Math.round(e*t)/t}var ve=`theme.disableLineNumbers.overflow.themeType.disableFileHeader.disableVirtualizationBuffers.preferredHighlighter.useCSSClasses.useTokenTransformer.tokenizeMaxLineLength.tokenizeMaxLength.unsafeCSS.diffStyle.diffIndicators.disableBackground.expandUnchanged.loadDiffFiles.collapsedContextThreshold.lineDiffType.maxLineDiffLength.expansionLineCount.lineHoverHighlight.enableTokenInteractionsOnWhitespace.enableGutterUtility.__debugPointerEvents.enableLineSelection.controlledSelection.disableErrorHandling`.split(`.`),ye=[`theme`,`disableLineNumbers`,`overflow`,`themeType`,`disableFileHeader`,`disableVirtualizationBuffers`,`preferredHighlighter`,`useCSSClasses`,`useTokenTransformer`,`tokenizeMaxLineLength`,`tokenizeMaxLength`,`unsafeCSS`,`lineHoverHighlight`,`enableTokenInteractionsOnWhitespace`,`enableGutterUtility`,`__debugPointerEvents`,`enableLineSelection`,`controlledSelection`,`disableErrorHandling`],be=[`renderCustomHeader`,`renderHeaderPrefix`,`renderHeaderFilenameSuffix`,`renderHeaderMetadata`,`renderAnnotation`,`renderGutterUtility`,`onPostRender`,`onGutterUtilityClick`,`onLineClick`,`onLineNumberClick`,`onLineEnter`,`onLineLeave`,`onTokenClick`,`onTokenEnter`,`onTokenLeave`],xe=[`onLineSelected`,`onLineSelectionStart`,`onLineSelectionChange`,`onLineSelectionEnd`],Se=Symbol(`CodeView.itemOptionsState`);function Ce(e,t){Object.defineProperty(e,Se,{configurable:!1,enumerable:!1,value:t})}function we(e){return e[Se]}function X(e,t,n){Object.defineProperty(e,t,{configurable:!1,enumerable:!0,get(){return n(this)}})}var Te=120,Ee=1,De=`--diffs-overflow-override`,Oe=12e6,ke=1e6,Ae=2e6,je=1e7,Me=11e6;function Ne(e){if(e==null)throw Error(`CodeView: createEditor is required for items with edit: true`)}var Pe=(()=>{let{navigator:e}=globalThis,t=e.userAgent,n=/iP(?:hone|ad|od)/.test(t),r=e.platform===`MacIntel`&&e.maxTouchPoints>1;return(n||r)&&/AppleWebKit/.test(t)&&/Safari/.test(t)&&!/(CriOS|FxiOS|EdgiOS|OPiOS)/.test(t)})(),Fe=class e{static __STOP=!1;static __lastScrollPosition=0;type=`advanced`;config={overscrollSize:200,intersectionObserverMargin:0,resizeDebugging:!1};items=[];idToItem=new Map;selectedLines=null;itemEditors=new Map;attachedEditors=new Set;instanceToItem=new Map;layoutDirtyIndex;pendingLayoutReset;renderOptionsRevision=0;slotCoordinator;slotSnapshot;scrollListeners=new Set;scrollHeight=0;containerHeight=-1;scrollTop=0;scrollPageOffset=0;scrollDirty=!0;scrollInteractionFixTimer;pointerEventsDisabled=!1;codeOverflowFix=!1;height=0;heightDirty=!0;windowSpecs={top:0,bottom:0};renderState={scrollTop:-1,firstIndex:-1,lastIndex:-1,stickyHeight:0,stickyTop:-1,stickyBottom:-1};itemMetricsCache=V;fileOptionsPrototype;diffOptionsPrototype;pendingScrollTarget;pendingLayoutAnchor;shouldFixContainerFocus=!1;scrollAnimation;root;resizeObserver;container=document.createElement(`div`);stickyContainer=document.createElement(`div`);stickyOffset=document.createElement(`div`);header={element:void 0,render:void 0,height:0};footer={element:void 0,render:void 0,height:0};elementPool=[];elementPoolVersion=0;elementPoolTracker=new WeakMap;pendingElementPool=[];options;workerManager;isReadySubscription;isContainerManaged;constructor(e={theme:N},t,n=!1){this.options=e,this.computeMetricsCache(e.itemMetrics),this.fileOptionsPrototype=this.createFileOptionsPrototype(),this.diffOptionsPrototype=this.createDiffOptionsPrototype(),this.workerManager=t,this.isContainerManaged=n,this.stickyOffset.style.contain=`layout size`,this.stickyContainer.style.position=`sticky`,this.stickyContainer.style.width=`100%`,this.stickyContainer.style.contain=`layout style inline-size`,this.stickyContainer.style.isolation=`isolate`,this.stickyContainer.style.display=`flex`,this.stickyContainer.style.flexDirection=`column`}getLayout(){return this.options.layout??L}getItemTopOffset(){return this.getLayout().paddingTop+this.header.height}computeMetricsCache(e){return this.itemMetricsCache={hunkLineCount:e?.hunkLineCount??V.hunkLineCount,lineHeight:e?.lineHeight??V.lineHeight,diffHeaderHeight:e?.diffHeaderHeight??V.diffHeaderHeight,hunkSeparatorHeight:e?.hunkSeparatorHeight,spacing:e?.spacing??V.spacing,paddingTop:e?.paddingTop,paddingBottom:e?.paddingBottom},this.itemMetricsCache}getSmoothScrollSettings(){return this.options.smoothScrollSettings??H}shouldDisablePointerEvents(){return this.options.pointerEventsOnScroll!==!0}shouldValidateItemHeights(){return P&&this.options.__devOnlyValidateItemHeights===!0}validateRenderedItemHeight(e){if(!this.shouldValidateItemHeights()||e.element==null)return;let t=e.instance.getAdvancedStickySpecs();if(t==null)return;let n=t.height,r=e.element.getBoundingClientRect().height;n!==r&&console.error(`CodeView: reconciled item height does not match DOM height`,{id:e.item.id,type:e.type,index:e.index,version:e.version,expectedHeight:n,actualHeight:r,delta:r-n,stickyTopOffset:t.topOffset,virtualizedHeight:e.instance.getVirtualizedHeight(),top:e.top,scrollTop:this.getScrollTop(),windowSpecs:{...this.windowSpecs},element:e.element,instance:e.instance})}validateStickyContainerHeight(){if(!this.shouldValidateItemHeights())return;let{firstIndex:e,lastIndex:t,stickyHeight:n,stickyTop:r,stickyBottom:i}=this.renderState;if(e===-1||t===-1)return;let a=this.stickyContainer.getBoundingClientRect().height;Math.abs(a-n)<Ee||console.error(`CodeView: sticky container height does not match computed layout`,{computedStickyHeight:n,actualStickyHeight:a,delta:a-n,stickyTop:r,stickyBottom:i,firstIndex:e,lastIndex:t,firstStickySpecs:this.items[e]?.instance.getAdvancedStickySpecs(),lastStickySpecs:this.items[t]?.instance.getAdvancedStickySpecs(),scrollTop:this.getScrollTop(),scrollPageOffset:this.scrollPageOffset,windowSpecs:{...this.windowSpecs},stickyContainer:this.stickyContainer})}clearScrollInteractionTimer(){this.scrollInteractionFixTimer!=null&&(clearTimeout(this.scrollInteractionFixTimer),this.scrollInteractionFixTimer=void 0)}suspendScrollInteractions(){this.clearScrollInteractionTimer(),this.shouldDisablePointerEvents()&&!this.pointerEventsDisabled&&(this.stickyContainer.style.pointerEvents=`none`,this.pointerEventsDisabled=!0),Pe&&!this.codeOverflowFix&&(this.stickyContainer.style.setProperty(De,`hidden`),this.codeOverflowFix=!0),this.scrollInteractionFixTimer=setTimeout(this.restoreScrollInteractions,Te)}restoreScrollInteractions=()=>{this.clearScrollInteractionTimer(),this.pointerEventsDisabled&&=(this.stickyContainer.style.removeProperty(`pointer-events`),!1),this.codeOverflowFix&&=(this.stickyContainer.style.setProperty(De,`auto`),!1)};syncLayout(){let{gap:e,paddingBottom:t,paddingTop:n}=this.getLayout();this.stickyContainer.style.gap=`${e}px`,this.container?.style.setProperty(`margin-top`,`${n}px`),this.container?.style.setProperty(`margin-bottom`,`${t}px`)}reconcileHeaderFooterHosts(){let e=this.reconcileHost(`header`),t=this.reconcileHost(`footer`);return e||t}reconcileHost(e){let{root:t,container:n}=this;if(t==null||n==null)return!1;let r=e===`header`?this.header:this.footer,i=e===`header`?this.options.renderCodeViewHeader:this.options.renderCodeViewFooter;if(i==null)return r.element!=null&&(this.resizeObserver?.unobserve(r.element),r.element.remove(),r.element=void 0,r.render=void 0,this.setHostHeight(r,0),!1);if(r.element!=null&&i===r.render)return!1;let a=r.element??_e(e,n,this.resizeObserver);r.element=a;let o=i();return o==null?!this.isContainerManaged&&a.children.length>0&&(a.textContent=``):a.replaceChildren(o),r.render=i,!0}setHostHeight(e,t){e.height!==t&&(e.height=t,this.scrollDirty=!0)}measureMountedHosts(){this.header.element!=null&&this.setHostHeight(this.header,this.header.element.getBoundingClientRect().height),this.footer.element!=null&&this.setHostHeight(this.footer,this.footer.element.getBoundingClientRect().height)}setup(t){if(this.root!=null)throw Error(`CodeView.setup: already setup`);this.workerManager?.subscribeToThemeChanges(this),this.root=t,this.root.style.overflowAnchor=`none`,this.root.hasAttribute(`tabindex`)||(this.root.tabIndex=-1),this.container??=document.createElement(`div`),this.container.style.contain=`layout style`,this.syncLayout(),this.container.appendChild(this.stickyOffset),this.container.appendChild(this.stickyContainer),this.root.appendChild(this.container),this.scrollDirty=!0,this.heightDirty=!0,this.resizeObserver=new ResizeObserver(this.handleResize),this.resizeObserver.observe(this.stickyContainer),this.root.addEventListener(`scroll`,this.handleScroll,{passive:!0}),this.root.addEventListener(`wheel`,this.clearPendingScroll,{passive:!0}),this.root.addEventListener(`touchstart`,this.clearPendingScroll,{passive:!0}),this.root.addEventListener(`pointerdown`,this.clearPendingScroll,{passive:!0}),this.root.addEventListener(`keydown`,this.clearPendingScroll,{passive:!0}),this.resizeObserver.observe(this.root),this.render(!0),window.__INSTANCE=this,window.__TOGGLE=()=>{e.__STOP?(e.__STOP=!1,this.scrollTo({type:`position`,position:e.__lastScrollPosition,behavior:`instant`})):(e.__lastScrollPosition=this.getScrollTop(),e.__STOP=!0)}}reset(){k(this.computeRenderRangeAndEmit),this.clearReadySubscription(),this.restoreScrollInteractions(),this.cleanAllRenderedItems();for(let e of this.itemEditors.values())e.editor.cleanUp();this.itemEditors.clear(),this.attachedEditors.clear(),this.selectedLines=null,this.items.length=0,this.idToItem.clear(),this.instanceToItem.clear(),this.layoutDirtyIndex=void 0,this.pendingLayoutReset=void 0,this.stickyContainer.textContent=``,this.stickyOffset.style.height=``,this.container?.style.removeProperty(`height`),this.containerHeight=-1,this.windowSpecs={top:0,bottom:0},this.pendingLayoutAnchor=void 0,this.shouldFixContainerFocus=!1,this.height=0,this.scrollTop=0,this.scrollPageOffset=0,this.scrollHeight=0,this.scrollDirty=!0,this.heightDirty=!0,this.resetRenderState(),this.isContainerManaged||this.flushSlotCoordinator()}cleanUp(){this.reset(),this.clearElementPool(),this.restoreScrollInteractions(),this.workerManager?.unsubscribeToThemeChanges(this),this.resizeObserver?.disconnect(),this.resizeObserver=void 0,this.root?.removeEventListener(`scroll`,this.handleScroll),this.root?.removeEventListener(`wheel`,this.clearPendingScroll),this.root?.removeEventListener(`touchstart`,this.clearPendingScroll),this.root?.removeEventListener(`pointerdown`,this.clearPendingScroll),this.root?.removeEventListener(`keydown`,this.clearPendingScroll),this.root?.style.removeProperty(`overflow-anchor`),this.container?.remove(),this.stickyOffset.remove(),this.stickyContainer.remove(),this.stickyContainer.textContent=``,this.header.element?.remove(),this.header.element=void 0,this.header.render=void 0,this.header.height=0,this.footer.element?.remove(),this.footer.element=void 0,this.footer.render=void 0,this.footer.height=0,this.root=void 0,this.container=void 0}cleanAllRenderedItems(){if(this.renderState.firstIndex!==-1)for(let e=this.renderState.firstIndex;e<=this.renderState.lastIndex;e++){let t=this.items[e];if(t==null)throw Error(`CodeView.cleanAllRenderedItems: Item does not exist at index: ${e}`);this.releaseRenderedItem(t)}}primeScrollTarget(e){e.type!==`position`&&this.idToItem.get(e.id)?.instance.primeHighlightCache()}getElementPoolLimit(){let e=this.getHeight()+this.config.overscrollSize*2,{diffHeaderHeight:t}=this.itemMetricsCache;return Math.max(8,Math.ceil(e/Math.max(t,10))+1)*(this.isContainerManaged?2:1)}acquireElement(){this.promotePendingPooledElements();let e=this.elementPool.pop();for(;e!=null&&!this.isElementPoolGenerationCurrent(e);)e=this.elementPool.pop();return e??=document.createElement(I),this.markElementPoolGenerationCurrent(e),e}releaseRenderedItem(e){let{element:t}=e;t!=null&&this.renderedItemOwnsFocus(t)&&(this.shouldFixContainerFocus=!0),e.instance.cleanUp(!0),this.attachedEditors.delete(e.item.id),e.element=void 0,t!=null&&(t.remove(),this.cleanElement(t),this.queueElementForPool(t))}renderedItemOwnsFocus(e){let{activeElement:t}=document;return t===e||e.contains(t)||e.shadowRoot?.activeElement!=null}fixContainerFocus(){this.shouldFixContainerFocus&&(this.shouldFixContainerFocus=!1,this.root?.focus({preventScroll:!0}))}cleanElement(e){let{shadowRoot:t}=e;if(t!=null)for(let e of Array.from(t.children))Be(e)||e.remove();this.isContainerManaged||e.replaceChildren()}queueElementForPool(e){let t=this.getElementPoolLimit();!this.isElementPoolGenerationCurrent(e)||this.getElementPoolSize()>=t||(this.isElementClean(e)?this.elementPool.push(e):this.pendingElementPool.push(e))}promotePendingPooledElements(){if(this.pendingElementPool.length===0)return;let{pendingElementPool:e}=this;this.pendingElementPool=[];let t=this.getElementPoolLimit();for(let n of e)this.isElementPoolGenerationCurrent(n)&&this.isElementClean(n)&&this.elementPool.length<t?this.elementPool.push(n):this.isElementPoolGenerationCurrent(n)&&this.getElementPoolSize()<t&&this.pendingElementPool.push(n)}isElementClean(e){return e.childNodes.length===0}getElementPoolSize(){return this.elementPool.length+this.pendingElementPool.length}clearElementPool(){this.elementPool.length=0,this.pendingElementPool.length=0}invalidateElementPool(){this.elementPoolVersion++,this.clearElementPool()}markElementPoolGenerationCurrent(e){this.elementPoolTracker.set(e,this.elementPoolVersion)}isElementPoolGenerationCurrent(e){return this.elementPoolTracker.get(e)===this.elementPoolVersion}resolveEffectiveScrollBehavior(e,t){return me()?`instant`:e.behavior===`smooth-auto`?Math.abs(t-this.getScrollTop())<=this.getHeight()*10?`smooth`:`instant`:e.behavior??`instant`}scrollTo(e){if(this.root==null)return;let t=this.normalizeScrollTarget(e);if(t==null)return;let n=this.resolveScrollTargetTop(t);n!=null&&(this.primeScrollTarget(t),this.resolveEffectiveScrollBehavior(t,n)===`smooth`?this.scrollAnimation??={position:this.getScrollTop(),velocity:0,lastTimestamp:performance.now()}:this.scrollAnimation=void 0,this.suspendScrollInteractions(),this.pendingLayoutAnchor=void 0,this.pendingScrollTarget=t,this.render())}setSelectedLines(e,t){this.applySelectedLines(e,t)}getSelectedLines(){return this.selectedLines}clearSelectedLines(e){this.applySelectedLines(null,e)}getItem(e){return this.idToItem.get(e)?.item}getEditor(e){return this.itemEditors.get(e)?.editor}updateItem(e){let t=this.idToItem.get(e.id);return t==null?(console.error(`CodeView.updateItem: unknown item id "${e.id}"`),!1):this.syncItemRecord(t,e)?(this.markItemLayoutDirty(t),this.scrollDirty=!0,this.render(),this.syncItemEditors(),this.syncSelection(),!0):!1}updateItemId(e,t){if(e===t)return!0;let n=this.idToItem.get(e);if(n==null)return console.error(`CodeView.updateItemId: unknown item id "${e}"`),!1;if(this.idToItem.has(t))return console.error(`CodeView.updateItemId: duplicate item id "${t}"`),!1;this.idToItem.delete(e),n.item.id=t,this.idToItem.set(t,n),this.updateItemOptionsId(n.instance.options,t),this.selectedLines?.id===e&&(this.selectedLines={...this.selectedLines,id:t},this.options.onSelectedLinesChange?.(this.selectedLines));let r=this.itemEditors.get(e);return r!=null&&(r.state.id=t,this.itemEditors.delete(e),this.itemEditors.set(t,r),this.attachedEditors.delete(e)&&this.attachedEditors.add(t)),this.renamePendingScrollTarget(e,t),this.renamePendingLayoutAnchor(e,t),this.render(),!0}addItem(e){this.addItems([e])}addItems(e){this.appendItemsInternal(e),this.syncItemEditors(),this.syncSelection()}removeItem(e){let t=this.idToItem.get(e);if(t==null)return console.error(`CodeView.removeItem: unknown item id "${e}"`),!1;let n=[];for(let e of this.items)e!==t&&n.push(e.item);return this.setItems(n),!0}setItems(e){let t;this.items.length===0?this.appendItemsInternal(e):this.tryAppendItems(e)||(t=this.reconcileItems(e)),this.syncItemEditors(t),this.syncSelection()}appendItemsInternal(e,t=!0){if(e.length===0)return;let n=this.getLayout(),r=this.items.length===0?0:this.scrollHeight+n.gap,i=r;for(let t=0;t<e.length;t++){let i=e[t];if(i==null)throw Error(`CodeView.appendItemsInternal: missing input item`);if(this.idToItem.has(i.id))throw Error(`CodeView.addItem: duplicate id "${i.id}"`);let a=this.createItem(i,this.items.length,r);this.items.push(a),this.idToItem.set(a.item.id,a),this.instanceToItem.set(a.instance,a),a.height=Ie(a),r+=a.height+n.gap}this.scrollHeight=r-n.gap,this.scrollDirty=!0,t&&(this.canSkipRenderForAppend(i)?this.syncContainerHeight():this.render())}canSkipRenderForAppend(e){return this.container!=null&&this.renderState.firstIndex!==-1&&this.pendingScrollTarget==null&&this.scrollAnimation==null&&this.layoutDirtyIndex==null&&e>this.windowSpecs.bottom}onThemeChange(){this.invalidateElementPool()}setOptions(e){if(e==null)return;this.capturePendingLayoutAnchor();let{options:t}=this,n=this.getLayout(),{itemMetricsCache:r}=this;Le(t,e)&&this.invalidateElementPool(),this.options=e;let i=this.computeMetricsCache(e.itemMetrics),a=!A(r,i),o=!A(n,this.getLayout());o&&this.syncLayout();let s=a||Re(t,e);if(s){let n=this.pendingLayoutReset;this.pendingLayoutReset={metrics:a?i:n?.metrics,resetFileLayoutCache:!0,resetDiffLayoutCache:!0,includeEstimatedDiffHeights:n?.includeEstimatedDiffHeights===!0||a||ze(t,e)}}(o||s)&&(this.markLayoutDirtyFromIndex(0),this.scrollDirty=!0),ee(t,e)||this.renderOptionsRevision++,this.syncItemEditors();let c=t.renderCodeViewHeader!==e.renderCodeViewHeader||t.renderCodeViewFooter!==e.renderCodeViewFooter;!this.isContainerManaged&&(this.items.length>0||c)&&this.render()}capturePendingLayoutAnchor(e=this.idToItem){this.root!=null&&this.items.length!==0&&this.pendingScrollTarget==null&&(this.pendingLayoutAnchor=this.getScrollAnchor(this.getScrollTop(),e))}render(t=!1){e.__STOP||(t?(k(this.computeRenderRangeAndEmit),this.computeRenderRangeAndEmit()):j(this.computeRenderRangeAndEmit))}isReady(){let{workerManager:e}=this;return e==null||e.isInitialized()||e.getStats().workersFailed?(this.clearReadySubscription(),!0):(this.isReadySubscription??=e.subscribeToStatChanges(e=>{e.managerState!==`initialized`&&!e.workersFailed||(this.clearReadySubscription(),this.render(!0))}),e.getStats().managerState===`waiting`&&e.initialize().catch(()=>{}),!1)}clearReadySubscription(){this.isReadySubscription!=null&&(this.isReadySubscription(),this.isReadySubscription=void 0)}instanceChanged(e,t){let n=this.instanceToItem.get(e);if(n==null)throw Error(`CodeView.instanceChanged: An instance has changed that is not registered`);t&&this.markItemLayoutDirty(n),this.render()}getWindowSpecs(){return this.windowSpecs}getContainerElement(){return this.root}getHeaderElement(){return this.header.element}getFooterElement(){return this.footer.element}getRenderedItems(){let{firstIndex:e,lastIndex:t}=this.renderState;if(e===-1||t===-1||t<e)return[];let n=[];for(let r=e;r<=t;r++){let e=this.items[r];e?.element!=null&&(e.type===`diff`?n.push({id:e.item.id,type:`diff`,item:e.item,version:e.version,element:e.element,instance:e.instance}):n.push({id:e.item.id,type:`file`,item:e.item,version:e.version,element:e.element,instance:e.instance}))}return n}setSlotCoordinator(e){return e!==this.slotCoordinator&&(this.slotCoordinator=e,this.slotSnapshot=void 0,!0)}getSlotSnapshot(e){return this.buildSlotSnapshot(e)}buildSlotSnapshot(e){let t=Ke(this.getRenderedItems(),e),{element:n}=this.header,{element:r}=this.footer;if(t!=null||n!=null||r!=null)return{items:t,header:n,footer:r}}subscribeToScroll(e){return this.scrollListeners.add(e),()=>{this.scrollListeners.delete(e)}}getLocalTopForInstance(e){let t=this.instanceToItem.get(e);if(t==null)throw Error(`CodeView.getLocalTopForInstance: unknown virtualized instance`);return t.top}getTopForItem(e){let t=this.idToItem.get(e);if(t!=null)return t.top+this.getItemTopOffset()}createItem(e,t,n){let{itemMetricsCache:r}=this;if(e.type===`diff`){let i=new fe(this.createDiffOptions(e.id),this,r,this.workerManager,this.isContainerManaged);return{type:`diff`,item:e,version:e.version,index:t,top:n,height:0,element:void 0,renderedOptionsRevision:this.renderOptionsRevision,instance:i}}let i=new s(this.createFileOptions(e.id),this,r,this.workerManager,this.isContainerManaged);return{type:`file`,item:e,version:e.version,index:t,top:n,height:0,element:void 0,renderedOptionsRevision:this.renderOptionsRevision,instance:i}}applySelectedLines(e,t){let{selectedLines:n}=this;e==null&&n==null||e!=null&&n?.id===e.id&&D(n.range,e.range)||(n!=null&&n.id!==e?.id&&this.idToItem.get(n.id)?.instance.setSelectedLines(null,{notify:!1}),this.selectedLines=e,this.idToItem.get(e?.id??``)?.instance.setSelectedLines(e?.range??null,t))}syncSelection(){if(this.selectedLines==null)return;let e=this.idToItem.get(this.selectedLines.id);if(e==null){this.selectedLines=null,this.options.onSelectedLinesChange?.(null);return}e.instance.setSelectedLines(this.selectedLines.range,{notify:!1})}isItemInEditMode(e){return e.item.edit===!0&&e.item.collapsed!==!0}attachItemEditor(e){let{id:t}=e.item,{createEditor:n}=this.options;if(e.element==null||this.attachedEditors.has(t)||!this.isItemInEditMode(e))return;let r=this.itemEditors.get(t),i=!1;try{if(r==null){Ne(n);let e={id:t},a=n({onChange:(t,n)=>{let r=this.idToItem.get(e.id);r!=null&&(e.lastChange={item:r.item,file:t,lineAnnotations:n},this.options.onItemEditChange?.(r.item,t,n))}});if(a==null)return;r={editor:a,state:e},this.itemEditors.set(t,r),i=!0}r.editor.edit(e.instance),this.attachedEditors.add(t)}catch(n){throw i&&r!=null&&(this.itemEditors.delete(t),r.editor.cleanUp()),this.releaseRenderedItem(e),n}}syncItemEditors(e){if(this.itemEditors.size===0)return;let t=[];for(let[n,r]of this.itemEditors){let i=this.idToItem.get(n),a=e?.get(n);if(a==null&&i!=null&&this.isItemInEditMode(i))continue;r.editor.cleanUp(),this.itemEditors.delete(n),this.attachedEditors.delete(n);let{lastChange:o}=r.state,s=a==null?i?.item??o?.item:o?.item??a.item;s?.type===`diff`&&(a==null&&i!=null&&i.type===`diff`&&i.instance.completeEditSession()&&(this.markItemLayoutDirty(i),this.render()),oe(s.fileDiff)),o!=null&&t.push(a!=null||i==null?o:{...o,item:i.item})}for(let{item:e,file:n,lineAnnotations:r}of t)this.options.onItemEditComplete?.(e,n,r)}renamePendingScrollTarget(e,t){let{pendingScrollTarget:n}=this;n!=null&&n.type!==`position`&&n.id===e&&(this.pendingScrollTarget={...n,id:t})}renamePendingLayoutAnchor(e,t){this.pendingLayoutAnchor?.id===e&&(this.pendingLayoutAnchor.id=t)}createFileOptionsPrototype(){let e={};for(let t of ye)X(e,t,()=>this.options[t]);X(e,`stickyHeader`,()=>this.options.stickyHeaders),X(e,`collapsed`,e=>{let t=we(e);if(t!=null)return this.getItemOptions(t,`file`)?.item.collapsed});for(let t of be)this.defineItemSharedCallback(e,`file`,t);for(let t of xe)this.defineItemSelectionCallback(e,`file`,t);return e}createDiffOptionsPrototype(){let e={};for(let t of ve)X(e,t,()=>this.options[t]);X(e,`stickyHeader`,()=>this.options.stickyHeaders),X(e,`hunkSeparators`,()=>this.options.hunkSeparators),X(e,`collapsed`,e=>{let t=we(e);if(t!=null)return this.getItemOptions(t,`diff`)?.item.collapsed});for(let t of be)this.defineItemSharedCallback(e,`diff`,t);for(let t of xe)this.defineItemSelectionCallback(e,`diff`,t);return e}createFileOptions(e){let t=Object.create(this.fileOptionsPrototype);return Ce(t,{id:e}),t}createDiffOptions(e){let t=Object.create(this.diffOptionsPrototype);return Ce(t,{id:e}),t}updateItemOptionsId(e,t){let n=we(e);if(n==null)throw Error(`CodeView.updateItemOptionsId: No valid state`);n.id=t}getItemOptions(e,t){let n=this.idToItem.get(e.id);if(n!=null&&n.type===t)return n}defineItemSharedCallback(e,t,n){X(e,n,e=>{if(this.options[n]==null)return;let r=we(e);if(r==null)return;let i=r.callbackCache??={},a=i[n];return a??(a=((...e)=>{let i=this.getItemOptions(r,t);if(i==null)return;let a=this.options[n];return a?.(...e,i)}),i[n]=a),a})}defineItemSelectionCallback(e,t,n){X(e,n,e=>{let r=we(e);if(r==null)return;let i=r.callbackCache??={},a=i[n];return a??(a=(e=>{let i=this.getItemOptions(r,t);if(i==null)return;let a=e==null?null:{id:i.item.id,range:e};this.options.controlledSelection!==!0&&(e!=null||this.selectedLines?.id===i.item.id)&&this.applySelectedLines(a,{notify:!1}),this.options.onSelectedLinesChange?.(a);let o=this.options[n];return o?.(e,i)}),i[n]=a),a})}markLayoutDirtyFromIndex(e){this.layoutDirtyIndex=Math.min(this.layoutDirtyIndex??e,e)}markItemLayoutDirty(e){if(this.items[e.index]!==e)throw Error(`CodeView.markItemLayoutDirty: unknown item id "${e.item.id}"`);this.markLayoutDirtyFromIndex(e.index)}tryAppendItems(e){if(e.length<=this.items.length)return!1;for(let t=0;t<this.items.length;t++){let n=this.items[t];if(n==null)throw Error(`CodeView.tryAppendItems: missing existing item`);let r=e[t];if(r==null||n.item.id!==r.id||n.type!==r.type)return!1}for(let t=0;t<this.items.length;t++){let n=this.items[t];if(n==null)throw Error(`CodeView.tryAppendItems: missing existing item`);let r=e[t];if(r==null)throw Error(`CodeView.tryAppendItems: append candidate missing prefix item`);this.syncItemRecord(n,r)&&this.markLayoutDirtyFromIndex(t)}return this.appendItemsInternal(e.slice(this.items.length),!1),this.scrollDirty=!0,this.render(),!0}reconcileItems(e){let{items:t,idToItem:n}=this,r=new Set(t),i=[],a=new Map,o=new Map,s=new Map,c;for(let s=0;s<e.length;s++){let l=e[s];if(l==null)throw Error(`CodeView.reconcileItems: missing input item`);if(a.has(l.id))throw Error(`CodeView.setItems: duplicate id "${l.id}"`);let u=n.get(l.id),d=u!=null&&u.type===l.type?u:this.createItem(l,s,0);d.index=s,u!=null&&u.type===l.type?(r.delete(u),this.syncItemRecord(d,l)&&(c=Math.min(c??s,s))):c=Math.min(c??s,s),t[s]!==d&&(c=Math.min(c??s,s)),i.push(d),a.set(l.id,d),o.set(d.instance,d)}if(c==null){if(r.size===0)return;c=Math.max(i.length-1,0)}this.capturePendingLayoutAnchor(a);for(let e=0;e<t.length;e++){let n=t[e];if(n==null||!r.has(n))continue;s.set(n.item.id,n),this.releaseRenderedItem(n);let a=Math.max(i.length-1,0);c=Math.min(c??a,a)}return this.items=i,this.idToItem=a,this.instanceToItem=o,this.renderState.firstIndex>=i.length?this.resetRenderState():this.renderState.lastIndex>=i.length&&(this.renderState.lastIndex=i.length-1),this.markLayoutDirtyFromIndex(c),this.scrollDirty=!0,this.render(),s.size>0?s:void 0}syncItemRecord(e,t){if(e.type!==t.type)throw Error(`CodeView.syncItemRecord: type mismatch for id "${t.id}"`);return e.version!==t.version&&(e.item=t,e.version=t.version,e.renderedOptionsRevision=-1,!0)}getMaxScrollTopForHeight(e){let{paddingBottom:t,paddingTop:n}=this.getLayout();return Math.max(n+this.header.height+e+this.footer.height+t-this.getHeight(),0)}getMaxScrollTop(){return this.getMaxScrollTopForHeight(this.getScrollHeight())}shouldRebaseScroll(){return this.getMaxScrollTop()>Me}getPagedScrollHeight(){return this.shouldRebaseScroll()?Math.min(this.getScrollHeight(),Oe):this.getScrollHeight()}getMaxPagedScrollTop(){return this.getMaxScrollTopForHeight(this.getPagedScrollHeight())}clampPagedScrollTop(e){let t=this.getMaxPagedScrollTop();return Math.max(0,Math.min(e,t))}clampScrollTop(e){let t=this.getMaxScrollTop();return Math.max(0,Math.min(e,t))}getMaxScrollPageOffset(){return Math.max(this.getMaxScrollTop()-this.getMaxPagedScrollTop(),0)}clampScrollPageOffset(e){let t=this.getMaxScrollPageOffset();return Math.max(0,Math.min(e,t))}resolveScrollPageWindow(e,t){let n=Y(this.clampPagedScrollTop(t)),r=this.clampScrollPageOffset(e-n);return n=Y(this.clampPagedScrollTop(e-r)),r=this.clampScrollPageOffset(e-n),{pagedScrollTop:n,scrollPageOffset:r}}resolvePagedScrollPosition(e){if(!this.shouldRebaseScroll())return{pagedScrollTop:this.clampPagedScrollTop(e),scrollPageOffset:0};let t=this.clampScrollPageOffset(this.scrollPageOffset),n=e-t,r=this.getMaxPagedScrollTop(),i=this.getMaxScrollPageOffset(),a=n>Me&&t<i,o=n<ke&&t>0;return n<0||n>r||a||o?this.resolveScrollPageWindow(e,o?Math.min(je,r):Ae):{pagedScrollTop:Y(this.clampPagedScrollTop(n)),scrollPageOffset:t}}needsScrollPageUpdate(e){let t=Y(this.clampScrollTop(e)),{scrollPageOffset:n}=this.resolvePagedScrollPosition(t);return n!==this.scrollPageOffset}getPagedLayoutTop(e){return this.shouldRebaseScroll()?Math.max(e-this.scrollPageOffset,0):e}getStickyHeaderOffset(){return this.options.stickyHeaders===!0&&this.options.disableFileHeader!==!0?this.itemMetricsCache.diffHeaderHeight:0}getScrollTargetRect(e){let t=this.idToItem.get(e.id);if(t==null){console.warn(`CodeView.scrollTo: unknown item id "${e.id}"`);return}if(e.type===`item`)return{top:t.top,height:t.height};if(e.type===`range`){let n=this.getRangeScrollPosition(t,e);if(n==null){console.warn(`CodeView.scrollTo: unable to resolve range ${Ve(e.range)} for item "${e.id}"`);return}return{top:t.top+n.top,height:n.height}}let n=this.getLineScrollPosition(t,e);if(n==null){console.warn(`CodeView.scrollTo: unable to resolve line ${e.lineNumber} for item "${e.id}"`);return}return{top:t.top+n.top,height:n.height}}normalizeScrollTarget(e){if(e.type===`position`||e.align!==`nearest`)return e;let t=this.getScrollTargetRect(e);if(t==null)return;let n=e.offset??0,r=this.getItemTopOffset()+t.top,i=r+t.height,a=this.getScrollTop(),o=a+(e.type===`line`||e.type===`range`?this.getStickyHeaderOffset():0),s=a+this.getHeight();if(!(r-n<=o&&i+n>=s)){if(r-n<o)return{...e,align:`start`};if(i+n>s)return{...e,align:`end`}}}resolveScrollTargetTop(e){if(e.type===`position`){let t=this.clampScrollTop(e.position);return t===e.position?this.clampScrollTop(e.position-this.getStickyHeaderOffset()):t}let t=this.idToItem.get(e.id);if(t==null){console.warn(`CodeView.scrollTo: unknown item id "${e.id}"`);return}if(e.type===`item`)return this.clampScrollTop(this.resolveAlignedScrollPosition(t.top,t.height,e.align,e.offset));if(e.type===`range`){let n=this.getRangeScrollPosition(t,e);if(n==null){console.warn(`CodeView.scrollTo: unable to resolve range ${Ve(e.range)} for item "${e.id}"`);return}return this.clampScrollTop(this.resolveAlignedScrollPosition(t.top+n.top,n.height,e.align,e.offset,this.getStickyHeaderOffset()))}let n=this.getLineScrollPosition(t,e);if(n==null){console.warn(`CodeView.scrollTo: unable to resolve line ${e.lineNumber} for item "${e.id}"`);return}return this.clampScrollTop(this.resolveAlignedScrollPosition(t.top+n.top,n.height,e.align,e.offset,this.getStickyHeaderOffset()))}resolveAlignedScrollPosition(e,t,n,r=0,i=0){e+=this.getItemTopOffset();let a=this.getHeight();return n===`center`&&t+r<a?e-(a-t)/2+r:n===`end`?e-(a-t)+r:e-i-r}getLineScrollPosition(e,t){return e.type===`diff`?e.instance.getLinePosition(t.lineNumber,t.side):e.instance.getLinePosition(t.lineNumber)}getRangeScrollPosition(e,t){let{range:n}=t,r=this.getLineScrollPosition(e,{type:`line`,id:t.id,lineNumber:n.start,side:n.side}),i=this.getLineScrollPosition(e,{type:`line`,id:t.id,lineNumber:n.end,side:n.endSide??n.side});if(r==null||i==null)return;let a=r.top,o=a+r.height,s=i.top,c=s+i.height,l=Math.min(a,s);return{top:l,height:Math.max(o,c)-l}}computeTargetScrollTopForFrame(e,t){if(this.pendingScrollTarget==null)return e;let n=this.resolveScrollTargetTop(this.pendingScrollTarget);if(n==null)return e;let{scrollAnimation:r}=this;return r==null?n:this.computeSpringStep(r,n,t).position}computeSpringStep(e,t,n){let r=Math.max(0,n-e.lastTimestamp),{omega:i}=this.getSmoothScrollSettings(),a=Math.exp(-i*r),o=e.position-t,s=e.velocity+i*o;return{position:t+(o+s*r)*a,velocity:(s*(1-i*r)-i*o)*a}}advanceScrollAnimation(e,t){if(this.pendingScrollTarget==null)return;let n=this.resolveScrollTargetTop(this.pendingScrollTarget);if(n==null){this.pendingScrollTarget=void 0,this.scrollAnimation=void 0;return}let r=this.scrollAnimation;if(r==null)return n;r.position+=t;let{position:i,velocity:a}=this.computeSpringStep(r,n,e);r.lastTimestamp=e,r.position=i,r.velocity=a;let{positionEpsilon:o,velocityEpsilon:s}=this.getSmoothScrollSettings();return Math.abs(n-i)<=o&&Math.abs(a)<=s?(r.position=n,r.velocity=0,this.scrollAnimation=void 0,n):r.position}computeRenderRangeAndEmit=(t=performance.now())=>{if(e.__STOP||this.container==null||!this.isReady())return;let n=this.getHeight(),r=this.getScrollTop(),i=r,a=this.pendingLayoutAnchor!=null,o=this.getScrollAnchor(i);if(this.layoutDirtyIndex!=null&&(this.recomputeLayout(this.layoutDirtyIndex,this.pendingLayoutReset),this.layoutDirtyIndex=void 0,this.pendingLayoutReset=void 0,a=!0),a&&o!=null){let e=this.resolveAnchoredScrollTop(o);if(e!=null){let t=e-i;i=e,this.scrollAnimation!=null&&(this.scrollAnimation.position+=t)}}a&&(i=this.clampScrollTop(i),this.syncContainerHeight());let s=this.computeTargetScrollTopForFrame(i,t),c=!a&&(this.renderState.scrollTop===-1||Math.abs(s-this.renderState.scrollTop)>n+this.config.overscrollSize*2);c&&(o=void 0),this.windowSpecs=w({scrollTop:s-this.header.height,height:n,scrollHeight:this.getScrollHeight(),fitPerfectly:c,fitPerfectlyOverscroll:this.getFitPerfectlyOverscroll(),overscrollSize:this.config.overscrollSize});let l=r;(this.pendingScrollTarget!=null&&s!==l||this.needsScrollPageUpdate(s))&&(this.applyScrollFix(s,l,this.windowSpecs),l=s);let{top:u,bottom:d}=this.windowSpecs,{firstIndex:f,lastIndex:p}=this.renderState;if(f>=0)for(let e=f;e<=p;e++){let t=this.items[e];if(t==null)throw Error(`CodeView.computeRenderRangeAndEmit: No item at index: ${e}`);t.top>u-t.height&&t.top<=d||this.releaseRenderedItem(t)}let m=this.reconcileHeaderFooterHosts(),h,g=new Set,_=this.findFirstVisibleIndex(u),v=this.findLastVisibleIndex(d);for(let e=_;e<=v;e++){let t=this.items[e];if(t==null)throw Error(`CodeView.computeRenderRangeAndEmit: missing item`);let{instance:n}=t;t.element==null?(t.element=this.acquireElement(),We(this.stickyContainer,t.element,h),n.virtualizedSetup(),Ue(t,t.element)&&(t.renderedOptionsRevision=this.renderOptionsRevision,g.add(t)),h=t.element):(We(this.stickyContainer,t.element,h),Ue(t,void 0,t.renderedOptionsRevision!==this.renderOptionsRevision)&&(t.renderedOptionsRevision=this.renderOptionsRevision,g.add(t)),h=t.element),t.item.edit===!0&&this.attachItemEditor(t)}this.renderState.firstIndex=_<=v?_:-1,this.renderState.lastIndex=v,this.flushSlotCoordinator(),this.flushManagers(g),m&&this.measureMountedHosts(),this.reconcileRenderedItems(g),this.syncContainerHeight(),this.updateStickyPositioning();let y=o==null?void 0:this.resolveAnchoredScrollTop(o);o===this.pendingLayoutAnchor&&(this.pendingLayoutAnchor=void 0);let b=y==null?0:y-i,x=s,S=!1;if(this.pendingScrollTarget!=null){let e=this.advanceScrollAnimation(t,b);e==null?x=i:(x=e,S=!0)}else x=y??s;x!==l&&(this.applyScrollFix(x,l,this.windowSpecs),l=x),S&&this.pendingScrollTarget!=null&&this.isPendingTargetSettled(this.pendingScrollTarget)&&(this.pendingScrollTarget=void 0,this.scrollAnimation=void 0),this.renderState.scrollTop=Y(l),this.updateStickyPositioning(),this.validateStickyContainerHeight(),this.fixContainerFocus(),(c||this.scrollAnimation!=null)&&this.render()};flushManagers(e){for(let t of e)t.instance.flushManagers()}syncContainerHeight(){let e=this.getPagedScrollHeight();this.container!=null&&this.containerHeight!==e&&(this.container.style.height=`${e}px`,this.containerHeight=e)}getStickyBounds(e){let{firstIndex:t,lastIndex:n}=e==null?this.renderState:{firstIndex:this.findFirstVisibleIndex(e.top),lastIndex:this.findLastVisibleIndex(e.bottom)};if(t===-1||n===-1||t>n)return;let r=this.items[t]?.instance.getAdvancedStickySpecs(e),i=this.items[n]?.instance.getAdvancedStickySpecs(e);if(r!=null&&i!=null)return{stickyTop:this.getPagedLayoutTop(Math.max(r.topOffset,0)),stickyBottom:this.getPagedLayoutTop(i.topOffset+i.height)}}applyStickyPositioning({stickyTop:e,stickyBottom:t}){let n=this.getHeight(),{itemMetricsCache:r}=this,i=t-e;this.renderState.stickyHeight=i,this.renderState.stickyTop=e,this.renderState.stickyBottom=t,this.stickyOffset.style.height=`${e}px`;let a=(Math.random()*r.lineHeight>>0)*-1,o=-Math.max(i+a,0)+n;this.stickyContainer.style.top=`${o}px`,this.stickyContainer.style.bottom=`${o+r.diffHeaderHeight}px`}syncPagedScrollScaffolding(e){this.syncContainerHeight();let t=this.getStickyBounds(e);t!=null&&this.applyStickyPositioning(t)}reconcileRenderedItems(e){let{firstIndex:t,lastIndex:n}=this.renderState;if(t===-1)return;let r=-1,i=!1;for(let a=t;a<this.items.length&&!(!i&&a>n);a++){let t=this.items[a];if(t==null)throw Error(`CodeView.reconcileRenderedItems: Invalid item`);r===-1?r=t.top:t.top!==r&&(t.top=r,t.instance.syncVirtualizedTop(),i=!0),(e==null?a<=n:e.has(t))&&(t.instance.reconcileHeights()&&(i=!0,t.height=t.instance.getVirtualizedHeight()),this.validateRenderedItemHeight(t)),r+=t.instance.getVirtualizedHeight(),a<this.items.length-1&&(r+=this.getLayout().gap)}i&&r!=null&&(this.scrollDirty=!0,this.scrollHeight=r)}updateStickyPositioning(){let e=this.getStickyBounds();if(e==null){this.renderState.firstIndex===-1&&(this.stickyOffset.style.height=``);return}let{stickyTop:t,stickyBottom:n}=e;(n-t!==this.renderState.stickyHeight||t!==this.renderState.stickyTop||n!==this.renderState.stickyBottom)&&this.applyStickyPositioning(e)}handleScroll=()=>{e.__STOP||(this.suspendScrollInteractions(),this.scrollDirty=!0,this.notifyScroll(),this.render())};clearPendingScroll=()=>{this.pendingScrollTarget=void 0,this.pendingLayoutAnchor=void 0,this.scrollAnimation=void 0};handleResize=e=>{let t=!1;for(let n of e)if(n.target===this.stickyContainer){let e=n.borderBoxSize[0].blockSize;if(Math.abs(e-this.renderState.stickyHeight)>=Ee){let e=this.getScrollTop(),n=this.getScrollAnchor(e);this.reconcileRenderedItems(),this.updateStickyPositioning();let r=n==null?void 0:this.resolveAnchoredScrollTop(n);if(r!=null){let t=r-e;this.applyScrollFix(r,e,this.windowSpecs),this.scrollAnimation!=null&&(this.scrollAnimation.position+=t)}this.pendingScrollTarget!=null&&this.isPendingTargetSettled(this.pendingScrollTarget)&&(this.pendingScrollTarget=void 0,this.scrollAnimation=void 0),t=!0}}else if(n.target===this.header.element||n.target===this.footer.element){let e=n.target===this.header.element?this.header:this.footer,r=n.borderBoxSize[0].blockSize;if(r!==e.height){let n=this.getScrollTop(),i=this.getScrollAnchor(n);this.setHostHeight(e,r);let a=i==null?void 0:this.resolveAnchoredScrollTop(i);if(a!=null){let e=a-n;this.applyScrollFix(a,n,this.windowSpecs),this.scrollAnimation!=null&&(this.scrollAnimation.position+=e)}this.pendingScrollTarget!=null&&this.isPendingTargetSettled(this.pendingScrollTarget)&&(this.pendingScrollTarget=void 0,this.scrollAnimation=void 0),t=!0}}else this.scrollDirty=!0,this.heightDirty=!0,t=!0;t&&this.render(!0)};getScrollAnchorViewportTop(e,t){return e<t?t+this.getStickyHeaderOffset():t}getScrollAnchor(e,t=this.idToItem){let n,{pendingLayoutAnchor:r}=this;if(r!=null){let e=this.idToItem.get(r.id);if(e!=null&&t.get(r.id)===e)return r;e!=null&&(n=e)}if(e<=0)return;let{firstIndex:i,lastIndex:a,stickyTop:o,stickyBottom:s}=this.renderState;if(i===-1||a===-1)return;let c=this.getHeight();if(o!==-1&&s!==-1){for(let r=i;r<=a;r++){let i=this.items[r];if(i==null)continue;let a=this.getItemTopOffset()+i.top;if(a+i.height<=e)continue;if(a>=e+c)break;if(t.get(i.item.id)!==i){n??=i;continue}if(a>=e)return{type:`item`,id:i.item.id,viewportOffset:a-e};let o=this.getScrollAnchorViewportTop(a,e)-a,s=i.instance.getNumericScrollAnchor(o);if(s!=null){let t=a+s.top;return{type:`line`,id:i.item.id,lineNumber:s.lineNumber,side:s.side,viewportOffset:t-e}}}if(n!=null)for(let e=n.index+1;e<this.items.length;e++){let n=this.items[e];if(n!=null&&t.get(n.item.id)===n)return{type:`item`,id:n.item.id,viewportOffset:0}}}}resolveAnchoredScrollTop(e){let t=this.idToItem.get(e.id);if(t==null)return;let n=this.getItemTopOffset();if(e.type===`item`){let r=n+t.top;return this.clampScrollTop(r-e.viewportOffset)}let r=t.type===`diff`?t.instance.getLinePosition(e.lineNumber,e.side):t.instance.getLinePosition(e.lineNumber);if(r==null)return;let i=n+t.top+r.top;return this.clampScrollTop(i-e.viewportOffset)}applyScrollFix(e,t,n){if(this.root==null)return;let r=Y(this.clampScrollTop(e)),i=Y(t),{scrollPageOffset:a}=this,o=Y(this.clampPagedScrollTop(i-a)),{pagedScrollTop:s,scrollPageOffset:c}=this.resolvePagedScrollPosition(r),l=s,u=a!==c;r===this.renderState.scrollTop&&r===i&&l===o&&!u||(this.suspendScrollInteractions(),(l!==o||u)&&(this.scrollPageOffset=c,this.syncPagedScrollScaffolding(n)),l!==o&&this.root.scrollTo({top:l,behavior:`instant`}),this.renderState.scrollTop=r,this.scrollTop=r,this.scrollDirty=!1)}isPendingTargetSettled(e){let t=this.resolveScrollTargetTop(e);return t==null||Y(this.getScrollTop())===Y(t)}getScrollTop(){if(!this.scrollDirty)return this.scrollTop;this.scrollDirty=!1;let e=this.root?.scrollTop??0;return this.scrollTop=this.clampScrollTop(e+this.scrollPageOffset),this.scrollTop}getHeight(){return this.heightDirty?(this.heightDirty=!1,this.height=this.root?.getBoundingClientRect().height??0,this.height):this.height}getScrollHeight(){return this.scrollHeight}flushSlotCoordinator(){if(this.slotCoordinator==null)return;let e=this.buildSlotSnapshot(this.slotCoordinator);he(this.slotSnapshot,e)||(this.slotSnapshot=e,this.slotCoordinator.onSnapshotChange(e))}notifyScroll(){if(this.scrollListeners.size===0)return;let e=this.getScrollTop();for(let t of this.scrollListeners)t(e,this)}findFirstVisibleIndex(e){let t=0,n=this.items.length-1,r=this.items.length;for(;t<=n;){let i=t+n>>1,a=this.items[i];if(a==null)throw Error(`CodeView.findFirstVisibleIndex: invalid item index`);a.top+a.height>e?(r=i,n=i-1):t=i+1}return r}findLastVisibleIndex(e){let t=0,n=this.items.length-1,r=-1;for(;t<=n;){let i=t+n>>1,a=this.items[i];if(a==null)throw Error(`CodeView.findLastVisibleIndex: invalid item index`);a.top<=e?(r=i,t=i+1):n=i-1}return r}recomputeLayout(e=0,t){if(this.items.length===0){this.scrollHeight=0;return}let n=this.getLayout(),r=0;if(e>0){let t=this.items[e-1];if(t==null)throw Error(`CodeView.recomputeLayout: invalid dirty index`);r=t.top+t.height+n.gap}for(let i=e;i<this.items.length;i++){let e=this.items[i];if(e==null)throw Error(`CodeView.recomputeLayout: invalid item index`);if(e.top=r,e.type===`diff`){let n=e.instance.consumeCodeViewLayoutChanges(e.item.fileDiff);n!=null&&Object.assign(e.item.fileDiff,n),e.height=e.instance.prepareCodeViewItem(e.item.fileDiff,r,t,e.item.annotations??[])}else e.height=e.instance.prepareCodeViewItem(e.item.file,r,t,e.item.annotations??[]);r+=e.height,i<this.items.length-1&&(r+=n.gap)}r!==this.scrollHeight&&(this.scrollDirty=!0),this.scrollHeight=r}resetRenderState(){this.renderState.scrollTop=-1,this.renderState.firstIndex=-1,this.renderState.lastIndex=-1,this.renderState.stickyHeight=0,this.renderState.stickyTop=-1,this.renderState.stickyBottom=-1}getFitPerfectlyOverscroll(){return this.getLayout().gap+this.itemMetricsCache.diffHeaderHeight}};function Ie(e){return e.instance.cleanUp(!0),e.type===`diff`?e.instance.prepareCodeViewItem(e.item.fileDiff,e.top,void 0,e.item.annotations??[]):e.instance.prepareCodeViewItem(e.item.file,e.top,void 0,e.item.annotations??[])}function Le(e,t){return!E(e.theme??N,t.theme??N)||(e.themeType??`system`)!==(t.themeType??`system`)||e.unsafeCSS!==t.unsafeCSS}function Re(e,t){return(e.overflow??`scroll`)!==(t.overflow??`scroll`)||(e.disableLineNumbers??!1)!==(t.disableLineNumbers??!1)||(e.disableFileHeader??!1)!==(t.disableFileHeader??!1)||e.unsafeCSS!==t.unsafeCSS||(e.diffStyle??`split`)!==(t.diffStyle??`split`)||(e.diffIndicators??`bars`)!==(t.diffIndicators??`bars`)||(e.hunkSeparators??`line-info`)!==(t.hunkSeparators??`line-info`)||(e.expandUnchanged??!1)!==(t.expandUnchanged??!1)||(e.collapsedContextThreshold??1)!==(t.collapsedContextThreshold??1)}function ze(e,t){return(e.disableFileHeader??!1)!==(t.disableFileHeader??!1)||(e.hunkSeparators??`line-info`)!==(t.hunkSeparators??`line-info`)||(e.expandUnchanged??!1)!==(t.expandUnchanged??!1)||(e.collapsedContextThreshold??1)!==(t.collapsedContextThreshold??1)}function Be(e){return e instanceof SVGElement||T(e)&&(e.hasAttribute(`data-core-css`)||e.hasAttribute(`data-theme-css`)||e.hasAttribute(`data-unsafe-css`))}function Ve(e){let t=He(e.start,e.side),n=He(e.end,e.endSide??e.side);return t===n?t:`${t}-${n}`}function He(e,t){return t==null?`${e}`:`${t===`deletions`?`D`:`A`}${e}`}function Ue(e,t,n=!1){return e.type===`diff`?e.instance.render({deferManagers:!0,fileContainer:t,fileDiff:e.item.fileDiff,forceRender:n,lineAnnotations:e.item.annotations??[]}):e.instance.render({deferManagers:!0,fileContainer:t,file:e.item.file,forceRender:n,lineAnnotations:e.item.annotations??[]})}function We(e,t,n){if(n==null){e.firstChild!==t&&e.prepend(t);return}n.nextSibling!==t&&n.after(t)}function Ge(e){return(e.annotations?.length??0)>0}function Ke(e,{hasHeaderRenderers:t,hasAnnotationRenderer:n,hasGutterRenderer:r}){if(e.length===0)return;if(t||r)return e;if(!n)return;let i=[];for(let t of e)Ge(t.item)&&i.push(t);return i.length>0?i:void 0}var Z=e(r(),1),qe=e(i(),1),Q=n(),Je=typeof window>`u`?Z.useEffect:Z.useLayoutEffect;function Ye(e){return{instance:void 0,items:void 0,controlled:e,managedOptions:void 0,disableFlushSync:!1,slotCoordinator:void 0}}function Xe(e,t){let{className:n,containerRef:r,disableWorkerPool:i=!1,editorOptions:a,initialItems:o,items:s,onItemEditChange:c,onItemEditComplete:l,onScroll:u,onSelectedLinesChange:d,options:f,renderAnnotation:p,renderCodeViewFooter:m,renderCodeViewHeader:h,renderCustomHeader:g,renderGutterUtility:_,renderHeaderFilenameSuffix:v,renderHeaderMetadata:y,renderHeaderPrefix:b,selectedLines:x,style:S}=e,C=s!==void 0,w=ne(),T=(0,Z.useContext)(U),E=(0,Z.useRef)(Ye(C)),D=g!=null,O=p!=null,k=_!=null,A=D||b!=null||v!=null||y!=null,j=A||O||k,N=h!=null,P=m!=null,F=M(e=>{d?.(e)}),I=x!==void 0,L=M(e=>{if(w==null)throw Error(`CodeView: EditContext is not attached`);let t=w({...a,...e});if(t==null)throw Error(`CodeView: EditProvider.createEditor must return an editor instance`);return t}),R=M((e,t,n)=>{c?.(e,t,n)}),z=M((e,t,n)=>{l?.(e,t,n)}),B=(0,Z.useMemo)(()=>nt({options:f,hasCustomHeader:D,hasGutterRenderer:k,hasCodeViewHeader:N,hasCodeViewFooter:P,onSelectedLinesChange:d==null?void 0:F,controlledSelection:I,createEditor:w==null?void 0:L,onItemEditChange:c==null?void 0:R,onItemEditComplete:l==null?void 0:z}),[w,I,L,R,z,F,P,N,D,k,c,l,d,f]),[V]=(0,Z.useState)(()=>tt()),[,te]=(0,Z.useState)({}),H=M(e=>{E.current.instance!=null&&(e==null||e!==E.current.instance.getContainerElement())&&(E.current.instance.cleanUp(),V.publish(void 0),E.current=Ye(C)),e!=null&&e!==E.current.instance?.getContainerElement()&&(E.current.instance=new Fe(B,i?void 0:T,!0),E.current.instance.setup(e)),typeof r==`function`?r(e):r!=null&&(r.current=e)}),W=M(e=>{E.current.disableFlushSync?V.publish(e):(0,qe.flushSync)(()=>{V.publish(e)})}),G=(0,Z.useMemo)(()=>{if(!(!A&&!O&&!k&&!N&&!P))return{hasHeaderRenderers:A,hasAnnotationRenderer:O,hasGutterRenderer:k,onSnapshotChange:W}},[W,O,k,A,N,P]);return Je(()=>u==null?void 0:E.current.instance?.subscribeToScroll(u)),Je(()=>{let{instance:e,controlled:t,items:n,managedOptions:r,slotCoordinator:i}=E.current;if(e!=null)try{E.current.disableFlushSync=!0;let a=!1;if(ee(B,r)||(E.current.managedOptions=B,e.setOptions(B),a=!0),t!==C){console.error(`CodeView: cannot switch between controlled and uncontrolled modes. Remount with a new key instead.`);return}if(C)s!==n&&($e(n,s)?E.current.items=s:Qe(n,s)?(E.current.items=s,e.addItems(s.slice(n.length))):(E.current.items=s,e.setItems(s),a=!0));else if(n==null){let t=o??[];E.current.items=t,t.length>0&&(e.setItems(t),a=!0)}x!==void 0&&e.setSelectedLines(x,{notify:!1});let c=e.setSlotCoordinator(G),l=!1;G!==i&&((G==null||i==null)&&(l=!0),E.current.slotCoordinator=G),(a||c)&&e.render(!0),c&&G==null&&V.publish(void 0),l&&te({})}finally{E.current.disableFlushSync=!1}}),(0,Z.useImperativeHandle)(t,()=>({addItems(e){let{controlled:t,instance:n}=E.current;et(t,`addItems`),n==null?console.error(`CodeView.addItems: no valid instance to append items with`,e):n.addItems(e)},getItem(e){let{instance:t}=E.current;if(t==null){console.error(`CodeView.getItem: no valid instance exists`,e);return}return t.getItem(e)},removeItem(e){let{controlled:t,instance:n}=E.current;return et(t,`removeItem`),n==null?(console.error(`CodeView.removeItem: no valid instance to remove item from`,e),!1):n.removeItem(e)},updateItem(e){let{controlled:t,instance:n}=E.current;return et(t,`updateItem`),n==null?(console.error(`CodeView.updateItem: no valid instance to update item with`,e),!1):n.updateItem(e)},updateItemId(e,t){let{controlled:n,instance:r}=E.current;return et(n,`updateItemId`),r==null?(console.error(`CodeView.updateItemId: no valid instance to update item id with`,e,t),!1):r.updateItemId(e,t)},scrollTo(e){let{instance:t}=E.current;t==null?console.error(`CodeView.scrollTo: no valid instance to scroll with`,e):t.scrollTo(e)},setSelectedLines(e){let{instance:t}=E.current;t==null?console.error(`CodeView.setSelectedLines: no valid instance to update selection with`,e):(t.setSelectedLines(e,{notify:!1}),F(e))},getSelectedLines(){let{instance:e}=E.current;return e==null?(console.error(`CodeView.getSelectedLines: no valid instance exists`),null):e.getSelectedLines()},clearSelectedLines(){let{instance:e}=E.current;e==null?console.error(`CodeView.clearSelectedLines: no valid instance to update selection with`):(e.clearSelectedLines({notify:!1}),F(null))},getEditor(e){let{instance:t}=E.current;if(t==null){console.error(`CodeView.getEditor: no valid instance exists`,e);return}return t.getEditor(e)},getInstance(){return E.current.instance}}),[F]),(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`div`,{ref:H,className:n,style:S}),(j||N||P)&&(0,Q.jsx)(rt,{managedContentStore:V,renderCustomHeader:g,renderHeaderPrefix:b,renderHeaderFilenameSuffix:v,renderHeaderMetadata:y,renderAnnotation:p,renderGutterUtility:_,renderCodeViewHeader:h,renderCodeViewFooter:m})]})}var Ze=(0,Z.forwardRef)(Xe);function Qe(e,t){if(e==null||t.length<=e.length)return!1;if(e.length===0)return!0;for(let n=0;n<e.length;n++)if(t[n]!==e[n])return!1;return!0}function $e(e,t){if(e==null||e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!==t[n])return!1;return!0}function et(e,t){if(e)throw Error(`CodeView.${t} cannot be used when CodeView is controlled. Use initialItems for imperative item updates.`)}function tt(){let e,t=new Set;return{getSnapshot(){return e},publish(n){if(!he(e,n)){e=n;for(let e of t)e()}},subscribe(e){return t.add(e),()=>{t.delete(e)}}}}function nt({options:e,hasCustomHeader:t,hasGutterRenderer:n,hasCodeViewHeader:r,hasCodeViewFooter:i,onSelectedLinesChange:a,controlledSelection:o,createEditor:s,onItemEditChange:c,onItemEditComplete:l}){let u={...e,controlledSelection:o,onSelectedLinesChange:a,createEditor:s};return c!=null&&(u.onItemEditChange=c),l!=null&&(u.onItemEditComplete=l),t&&(u.renderCustomHeader=at),n&&(u.renderGutterUtility=at),r&&(u.renderCodeViewHeader=at),i&&(u.renderCodeViewFooter=at),u}var rt=(0,Z.memo)(function({managedContentStore:e,renderCustomHeader:t,renderHeaderPrefix:n,renderHeaderFilenameSuffix:r,renderHeaderMetadata:i,renderAnnotation:a,renderGutterUtility:o,renderCodeViewHeader:s,renderCodeViewFooter:c}){"use no memo";let l=M(t=>e.subscribe(t)),u=M(()=>e.getSnapshot()),d=(0,Z.useSyncExternalStore)(l,u,u),f=``;for(let e of d?.items??[])f+=`${e.id}:${e.version}:${e.type}`;return(0,Q.jsxs)(Q.Fragment,{children:[(0,Z.useMemo)(()=>d?.items?.map(e=>(0,qe.createPortal)(it({renderedItem:e,renderCustomHeader:t,renderHeaderPrefix:n,renderHeaderFilenameSuffix:r,renderHeaderMetadata:i,renderAnnotation:a,renderGutterUtility:o}),e.element,e.id)),[t,n,r,i,a,o,f]),(0,Z.useMemo)(()=>s!=null&&d?.header!=null?(0,qe.createPortal)(s(),d.header):null,[s,d?.header]),(0,Z.useMemo)(()=>c!=null&&d?.footer!=null?(0,qe.createPortal)(c(),d.footer):null,[c,d?.footer])]})});function it({renderedItem:e,renderCustomHeader:t,renderHeaderPrefix:n,renderHeaderFilenameSuffix:r,renderHeaderMetadata:i,renderAnnotation:a,renderGutterUtility:o}){if(e.type===`diff`){let{item:s,instance:c}=e;return q({fileDiff:s.fileDiff,renderCustomHeader:t==null?void 0:()=>t(s),renderHeaderPrefix:n==null?void 0:()=>n(s),renderHeaderFilenameSuffix:r==null?void 0:()=>r(s),renderHeaderMetadata:i==null?void 0:()=>i(s),renderAnnotation:a==null?void 0:e=>a(e,s),lineAnnotations:s.annotations,renderGutterUtility:o==null?void 0:e=>o(e,s),getHoveredLine:c.getHoveredLine})}{let{item:s,instance:c}=e;return h({file:s.file,renderCustomHeader:t==null?void 0:()=>t(s),renderHeaderPrefix:n==null?void 0:()=>n(s),renderHeaderFilenameSuffix:r==null?void 0:()=>r(s),renderHeaderMetadata:i==null?void 0:()=>i(s),renderAnnotation:a==null?void 0:e=>a(e,s),lineAnnotations:s.annotations,renderGutterUtility:o==null?void 0:e=>o(e,s),getHoveredLine:c.getHoveredLine})}}function at(){}var $=t(),ot=0;function st(){return ot+=1,`pending-review-comment-${ot}`}function ct(e,t){return`${e}/${t.projectId}/${t.repository}#${t.number}`}var lt=[],ut=ie()(e=>({drafts:{},summaries:{},addComment:(t,n)=>e(e=>({drafts:{...e.drafts,[t]:[...e.drafts[t]??lt,n]}})),removeComment:(t,n)=>e(e=>{let r=(e.drafts[t]??lt).filter(e=>e.id!==n);if(r.length>0)return{drafts:{...e.drafts,[t]:r}};let{[t]:i,...a}=e.drafts;return{drafts:a}}),removeComments:(t,n)=>e(e=>{let r=new Set(n),i=(e.drafts[t]??lt).filter(e=>!r.has(e.id));if(i.length>0)return{drafts:{...e.drafts,[t]:i}};let{[t]:a,...o}=e.drafts;return{drafts:o}}),clear:t=>e(e=>{let{[t]:n,...r}=e.drafts;return{drafts:r}}),setSummary:(t,n)=>e(e=>({summaries:{...e.summaries,[t]:n}})),clearSummary:(t,n)=>e(e=>{if(e.summaries[t]!==n)return e;let{[t]:r,...i}=e.summaries;return{summaries:i}})}));function dt(e){let t=(0,$.c)(2),n;return t[0]===e?n=t[1]:(n=t=>t.drafts[ct(e.environmentId,e)]??lt,t[0]=e,t[1]=n),ut(n)}function ft(e){return[...e].toSorted((e,t)=>t.committedDate.localeCompare(e.committedDate))}function pt(e,t,n){let r=e.slice(0,n),i=e.find(e=>e.oid===t);return i!==void 0&&!r.includes(i)?[...r,i]:r}function mt(e){let t=(0,$.c)(60),[n,r]=(0,Z.useState)(10),i,a,o,s,c,l,u,f,p;if(t[0]!==e||t[1]!==n){i=ft(e.commits);let r=pt(i,e.selectedCommitOid,n);p=`flex shrink-0 items-center gap-2 overflow-x-auto border-b border-border/60 px-3 py-2`,u=`min-w-40 flex-1`,t[11]===Symbol.for(`react.memo_cache_sentinel`)?(f=(0,Q.jsx)(`span`,{className:`sr-only`,children:`Diff scope`}),t[11]=f):f=t[11],a=`max-w-full rounded-md border border-border bg-background px-2 py-1 text-xs`,o=e.selectedCommitOid??``,t[12]===e?s=t[13]:(s=t=>e.onSelectedCommitChange(t.target.value||null),t[12]=e,t[13]=s),t[14]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,Q.jsx)(`option`,{value:``,children:`All commits`}),t[14]=c):c=t[14],l=r.map(gt),t[0]=e,t[1]=n,t[2]=i,t[3]=a,t[4]=o,t[5]=s,t[6]=c,t[7]=l,t[8]=u,t[9]=f,t[10]=p}else i=t[2],a=t[3],o=t[4],s=t[5],c=t[6],l=t[7],u=t[8],f=t[9],p=t[10];let m;t[15]!==a||t[16]!==o||t[17]!==s||t[18]!==c||t[19]!==l?(m=(0,Q.jsxs)(`select`,{className:a,value:o,onChange:s,children:[c,l]}),t[15]=a,t[16]=o,t[17]=s,t[18]=c,t[19]=l,t[20]=m):m=t[20];let h;t[21]!==u||t[22]!==f||t[23]!==m?(h=(0,Q.jsxs)(`label`,{className:u,children:[f,m]}),t[21]=u,t[22]=f,t[23]=m,t[24]=h):h=t[24];let g;t[25]!==i.length||t[26]!==n?(g=n<i.length?(0,Q.jsx)(K,{type:`button`,size:`xs`,variant:`ghost`,onClick:()=>r(ht),children:`More commits`}):null,t[25]=i.length,t[26]=n,t[27]=g):g=t[27];let _;t[28]===e.onToggleAll?_=t[29]:(_=(0,Q.jsx)(K,{type:`button`,size:`icon-sm`,variant:`ghost`,"aria-label":`Toggle all files`,onClick:e.onToggleAll,children:`⌄`}),t[28]=e.onToggleAll,t[29]=_);let v=e.diffStyle===`unified`,y;t[30]===e?y=t[31]:(y=()=>e.onDiffStyleChange(`unified`),t[30]=e,t[31]=y);let b;t[32]===Symbol.for(`react.memo_cache_sentinel`)?(b=(0,Q.jsx)(ce,{className:`size-3.5`}),t[32]=b):b=t[32];let x;t[33]!==v||t[34]!==y?(x=(0,Q.jsx)(K,{type:`button`,size:`icon-sm`,variant:`ghost`,"aria-label":`Unified diff view`,"aria-pressed":v,onClick:y,children:b}),t[33]=v,t[34]=y,t[35]=x):x=t[35];let S=e.diffStyle===`split`,C;t[36]===e?C=t[37]:(C=()=>e.onDiffStyleChange(`split`),t[36]=e,t[37]=C);let w;t[38]===Symbol.for(`react.memo_cache_sentinel`)?(w=(0,Q.jsx)(se,{className:`size-3.5`}),t[38]=w):w=t[38];let T;t[39]!==S||t[40]!==C?(T=(0,Q.jsx)(K,{type:`button`,size:`icon-sm`,variant:`ghost`,"aria-label":`Split diff view`,"aria-pressed":S,onClick:C,children:w}),t[39]=S,t[40]=C,t[41]=T):T=t[41];let E;t[42]===e?E=t[43]:(E=()=>e.onWordWrapChange(!e.wordWrap),t[42]=e,t[43]=E);let D;t[44]===Symbol.for(`react.memo_cache_sentinel`)?(D=(0,Q.jsx)(ue,{className:`size-3.5`}),t[44]=D):D=t[44];let O;t[45]!==e.wordWrap||t[46]!==E?(O=(0,Q.jsx)(K,{type:`button`,size:`icon-sm`,variant:`ghost`,"aria-label":`Toggle line wrapping`,"aria-pressed":e.wordWrap,onClick:E,children:D}),t[45]=e.wordWrap,t[46]=E,t[47]=O):O=t[47];let k;t[48]===Symbol.for(`react.memo_cache_sentinel`)?(k=(0,Q.jsx)(d,{className:`size-3.5`}),t[48]=k):k=t[48];let A;t[49]===e.onRefresh?A=t[50]:(A=(0,Q.jsx)(K,{type:`button`,size:`icon-sm`,variant:`ghost`,"aria-label":`Refresh pull request diff`,onClick:e.onRefresh,children:k}),t[49]=e.onRefresh,t[50]=A);let j;return t[51]!==g||t[52]!==_||t[53]!==x||t[54]!==T||t[55]!==O||t[56]!==A||t[57]!==p||t[58]!==h?(j=(0,Q.jsxs)(`header`,{className:p,children:[h,g,_,x,T,O,A]}),t[51]=g,t[52]=_,t[53]=x,t[54]=T,t[55]=O,t[56]=A,t[57]=p,t[58]=h,t[59]=j):j=t[59],j}function ht(e){return e+10}function gt(e){return(0,Q.jsx)(`option`,{value:e.oid,children:`${e.messageHeadline} (${e.oid.slice(0,7)})`},e.oid)}var _t=new Set([`pnpm-lock.yaml`,`yarn.lock`,`package-lock.json`,`bun.lockb`,`Cargo.lock`,`go.sum`,`composer.lock`,`Gemfile.lock`]),vt=new Set([`__snapshots__`,`__generated__`,`dist`,`build`,`vendor`]),yt=new Set([`__tests__`,`tests`,`test`]),bt=[`.ts`,`.tsx`,`.js`,`.jsx`,`.mjs`,`.cjs`];function xt(e){let t=e.split(`/`),n=t.at(-1)??``;return _t.has(n)||n.endsWith(`.snap`)||n.endsWith(`.min.js`)||n.endsWith(`.min.css`)||/\.generated\./.test(n)||t.slice(0,-1).some(e=>vt.has(e))?`generated`:/\.(?:test|spec)\./.test(n)||t.slice(0,-1).some(e=>yt.has(e))?`test`:`source`}function St(e){let t=e.lastIndexOf(`.`);return t>e.lastIndexOf(`/`)?e.slice(0,t):e}function Ct(e){return St(e.split(`/`).at(-1)??``)}function wt(e,t){let n=e.split(`/`).slice(0,-1);for(let e of t.split(`/`))e!==`.`&&e!==``&&(e===`..`?n.pop():n.push(e));return n.join(`/`)}var Tt=/(?:\bfrom|\bimport|\brequire\s*\()\s*\(?\s*["']([^"']+)["']/g;function Et(e,t,n,r){let i=t.startsWith(`.`)?wt(e,t):t,a=bt.find(e=>i.endsWith(e)),o=a===void 0?i:i.slice(0,-a.length),s=n.get(o)??n.get(`${o}/index`)??r.get(Ct(o));return s===e?void 0:s}function Dt(e){return Tt.lastIndex=0,Array.from(e.matchAll(Tt),e=>e[1]??``)}function Ot(e,t,n,r){let i=new Set;for(let a of t.flatMap(Dt)){let t=Et(e,a,n,r);t!==void 0&&i.add(t)}return i}function kt(e,t){let n=new Set(e),r=[],i=e.toSorted((e,t)=>e.localeCompare(t));for(;n.size>0;){let e=i.filter(e=>n.has(e)),a=e.find(e=>[...t.get(e)??[]].every(e=>!n.has(e)))??e[0];n.delete(a),r.push(a)}return r}function At(e){return(e.split(`/`).at(-1)??``).replace(/\.(?:test|spec)\..*$/,``).replace(/\.[^.]+$/,``)}function jt(e){let t=new Map;for(let n of e)t.set(J(n),n);let n=new Map;for(let e of t.keys())n.set(e,xt(e));let r=[...t.keys()].filter(e=>n.get(e)===`source`),i=new Map,a=new Set,o=new Map;for(let e of r){i.set(St(e),e);let t=Ct(e);o.has(t)&&a.add(t),o.set(t,e)}for(let e of a)o.delete(e);let s=new Map;for(let e of r){let n=t.get(e);s.set(e,Ot(e,[...n.additionLines,...n.deletionLines],i,o))}let c=kt(r,s),l=new Map;c.forEach((e,t)=>{let n=Ct(e);l.has(n)||l.set(n,t)});let u=[...t.keys()].filter(e=>n.get(e)===`test`).toSorted((e,t)=>(l.get(At(e))??2**53-1)-(l.get(At(t))??2**53-1)||e.localeCompare(t)),d=[...t.keys()].filter(e=>n.get(e)===`generated`).toSorted((e,t)=>e.localeCompare(t));return[...c,...u,...d].map(e=>t.get(e))}function Mt(e,t){return t?.[e]===!0}function Nt(e,t){return e.reduce((e,n)=>Mt(n,t)?e+1:e,0)}var Pt=`forge:pr-files-viewed:v1`,Ft=200;function It(e){return`${e.projectId}:${e.projectRepositoryId??0}:${e.repository.toLowerCase()}#${e.number}`}var Lt=new Map;function Rt(e){if(typeof e!=`object`||!e)return null;let t=Object.create(null);for(let[n,r]of Object.entries(e))n.length>0&&typeof r==`boolean`&&(t[n]=r);return Object.keys(t).length>0?t:null}function zt(e){if(typeof e!=`object`||!e)return{};let t=Object.create(null),n=Object.entries(e).slice(-200);for(let[e,r]of n){if(e.length===0||typeof r!=`object`||!r)continue;let n=Rt(r.viewedByPath);n!==null&&(t[e]={viewedByPath:n})}return t}function Bt(){if(typeof window>`u`)return{ok:!0,value:{}};try{let e=window.localStorage.getItem(Pt);return{ok:!0,value:e===null?{}:zt(JSON.parse(e))}}catch{return{ok:!1}}}function Vt(){let e=Bt();return e.ok?e.value:{}}function Ht(e){if(Lt.size===0)return e;let t={...e};for(let[e,n]of Lt)t[e]={viewedByPath:{...t[e]?.viewedByPath,...n.viewedByPath}};return t}function Ut(e){if(typeof window>`u`)return!0;try{return window.localStorage.setItem(Pt,JSON.stringify(e)),!0}catch{return!1}}function Wt(e){let t=Object.keys(e);return t.length<=Ft?e:Object.fromEntries(t.slice(-200).map(t=>[t,e[t]]))}function Gt(e,t,n,r){if(e[t]?.viewedByPath[n]===r)return e;let{[t]:i,...a}=e;return Wt({...a,[t]:{viewedByPath:{...e[t]?.viewedByPath,[n]:r}}})}var Kt=ie(e=>({byPullRequest:Vt(),setFileViewed:(t,n,r)=>e(e=>{let i=Bt(),a=i.ok?Ht(i.value):e.byPullRequest,o=Gt(a,t,n,r);return o===a?(i.ok&&Lt.size>0&&Ut(o)&&Lt.clear(),e.byPullRequest[t]?.viewedByPath[n]===r&&Lt.size===0?e:{byPullRequest:a}):(Ut(o)?Lt.clear():Lt.set(t,o[t]),{byPullRequest:o})})}));function qt(e){let t=(0,$.c)(19),{reference:n,enabled:r,paths:i}=e,a,o;t[0]===n?o=t[1]:(o=It(n),t[0]=n,t[1]=o),a=o;let s=a,c;t[2]===s?c=t[3]:(c=e=>e.byPullRequest[s]?.viewedByPath,t[2]=s,t[3]=c);let l=Kt(c),u=Kt(Jt),d;t[4]!==r||t[5]!==l?(d=e=>r&&Mt(e,l??null),t[4]=r,t[5]=l,t[6]=d):d=t[6];let f=d,p;t[7]!==r||t[8]!==s||t[9]!==u?(p=(e,t)=>{r&&u(s,e,t)},t[7]=r,t[8]=s,t[9]=u,t[10]=p):p=t[10];let m=p,h,g;t[11]!==r||t[12]!==i||t[13]!==l?(g=r?Nt(i,l??null):0,t[11]=r,t[12]=i,t[13]=l,t[14]=g):g=t[14],h=g;let _=h,v,y;return t[15]!==f||t[16]!==m||t[17]!==_?(y={isViewed:f,setViewed:m,viewedCount:_},t[15]=f,t[16]=m,t[17]=_,t[18]=y):y=t[18],v=y,v}function Jt(e){return e.setFileViewed}function Yt(e,t,n){return e.hunks.some(e=>t===`left`?n>=e.deletionStart&&n<e.deletionStart+e.deletionCount:n>=e.additionStart&&n<e.additionStart+e.additionCount)}function Xt(e,t,n){let r=t!==`expanded`;return n.has(e)?!r:r}function Zt(e,t,n,r){let i=t-(n===`left`?r.oldLine:r.newLine);return i>=0&&i<e.lines?{kind:`context`,oldLine:r.oldLine+i,newLine:r.newLine+i,side:n}:null}function Qt(e,t,n,r){let i=n===`left`?r.oldLine:r.newLine,a=n===`left`?e.deletions:e.additions;return t>=i&&t<i+a?n===`left`?{kind:`deleted`,oldLine:t}:{kind:`added`,newLine:t}:null}function $t(e,t){return e.type===`context`?{oldLine:t.oldLine+e.lines,newLine:t.newLine+e.lines}:{oldLine:t.oldLine+e.deletions,newLine:t.newLine+e.additions}}function en(e,t,n){let r={oldLine:e.deletionStart,newLine:e.additionStart};for(let i of e.hunkContent){let e=i.type===`context`?Zt(i,t,n,r):Qt(i,t,n,r);if(e!==null)return e;r=$t(i,r)}return null}function tn(e,t,n){let r=n===`deletions`?`left`:`right`;for(let n of e.hunks){let e=en(n,t,r);if(e!==null)return e}return null}function nn(e){let t=(0,$.c)(7),n;return t[0]!==e.annotation.comment||t[1]!==e.annotation.kind||t[2]!==e.annotation.thread||t[3]!==e.environmentId||t[4]!==e.permissions||t[5]!==e.reference?(n=e.annotation.kind===`thread`?(0,Q.jsx)(y,{environmentId:e.environmentId,reference:e.reference,thread:e.annotation.thread,canReply:e.permissions.canReply,canResolve:e.permissions.canResolve,reactionsEnabled:e.permissions.reactionsEnabled}):(0,Q.jsx)(rn,{body:e.annotation.comment.body}),t[0]=e.annotation.comment,t[1]=e.annotation.kind,t[2]=e.annotation.thread,t[3]=e.environmentId,t[4]=e.permissions,t[5]=e.reference,t[6]=n):n=t[6],n}function rn(e){let t=(0,$.c)(3),n;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,Q.jsx)(`p`,{className:`text-xs font-medium text-info-foreground`,children:`Pending review comment`}),t[0]=n):n=t[0];let r;return t[1]===e.body?r=t[2]:(r=(0,Q.jsxs)(`article`,{className:`rounded-md border border-info-border bg-info-surface p-3`,children:[n,(0,Q.jsx)(g,{text:e.body,className:`mt-1`})]}),t[1]=e.body,t[2]=r),r}function an(e){let t=(0,$.c)(10),n;t[0]!==e.file||t[1]!==e.omittedStats?(n=on(e.file,e.omittedStats),t[0]=e.file,t[1]=e.omittedStats,t[2]=n):n=t[2];let{additions:r,deletions:i}=n,a;t[3]===r?a=t[4]:(a=(0,Q.jsxs)(`span`,{className:`text-success-foreground`,children:[`+`,r]}),t[3]=r,t[4]=a);let o;t[5]===i?o=t[6]:(o=(0,Q.jsxs)(`span`,{className:`text-destructive-foreground`,children:[`−`,i]}),t[5]=i,t[6]=o);let s;return t[7]!==a||t[8]!==o?(s=(0,Q.jsxs)(`span`,{className:`flex gap-1 font-mono text-[11px] tabular-nums`,children:[a,o]}),t[7]=a,t[8]=o,t[9]=s):s=t[9],s}function on(e,t){let n=e.hunks.reduce((e,t)=>({additions:e.additions+t.additionLines,deletions:e.deletions+t.deletionLines}),{additions:0,deletions:0});return n.additions===0&&n.deletions===0?t.get(J(e))??n:n}function sn(e){let t=(0,$.c)(9),n=e.item.collapsed===!0,r=n?`Expand file`:`Collapse file`,i=!n,a;t[0]===e?a=t[1]:(a=()=>e.onToggleFile(e.item.id),t[0]=e,t[1]=a);let o;t[2]===n?o=t[3]:(o=n?(0,Q.jsx)(z,{className:`size-3.5`}):(0,Q.jsx)(ae,{className:`size-3.5`}),t[2]=n,t[3]=o);let s;return t[4]!==r||t[5]!==i||t[6]!==a||t[7]!==o?(s=(0,Q.jsx)(K,{type:`button`,size:`icon-sm`,variant:`ghost`,"aria-label":r,"aria-expanded":i,onClick:a,children:o}),t[4]=r,t[5]=i,t[6]=a,t[7]=o,t[8]=s):s=t[8],s}function cn(e){let t=(0,$.c)(16),n;t[0]!==e.path||t[1]!==e.view?(n=e.view.isViewed(e.path),t[0]=e.path,t[1]=e.view,t[2]=n):n=t[2];let r=n,i=r?`true`:`false`,o=r?`Mark ${e.path} as not viewed`:`Mark ${e.path} as viewed`,s;t[3]!==e.path||t[4]!==e.view||t[5]!==r?(s=()=>e.view.setViewed(e.path,!r),t[3]=e.path,t[4]=e.view,t[5]=r,t[6]=s):s=t[6];let c=r?`border-success-border bg-success-surface text-success-foreground`:`border-border text-muted-foreground hover:text-foreground`,l;t[7]===c?l=t[8]:(l=re(`inline-flex size-5 shrink-0 items-center justify-center rounded-sm border`,c),t[7]=c,t[8]=l);let u;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(u=(0,Q.jsx)(a,{"aria-hidden":!0,className:`size-3`}),t[9]=u):u=t[9];let d;return t[10]!==i||t[11]!==o||t[12]!==s||t[13]!==l||t[14]!==r?(d=(0,Q.jsx)(`button`,{type:`button`,"data-slot":`pr-file-viewed-toggle`,"data-viewed":i,"aria-pressed":r,"aria-label":o,onClick:s,className:l,children:u}),t[10]=i,t[11]=o,t[12]=s,t[13]=l,t[14]=r,t[15]=d):d=t[15],d}function ln(e){let t=(0,$.c)(2),n;return t[0]===e.threads?n=t[1]:(n=e.threads.length>0?(0,Q.jsxs)(`section`,{className:`border-b border-warning-border bg-warning-surface px-3 py-2 text-xs text-warning-foreground`,children:[(0,Q.jsxs)(`p`,{className:`flex items-center gap-1.5 font-medium`,children:[(0,Q.jsx)(b,{className:`size-3.5`}),`Conversations not on the diff loaded so far`]}),e.threads.map(un)]}):null,t[0]=e.threads,t[1]=n),n}function un(e){return(0,Q.jsxs)(`p`,{className:`mt-1 truncate`,children:[e.path,e.line===null?``:`:${e.line}`,e.isOutdated?` · outdated`:``]},e.id)}function dn(e){let t=(0,$.c)(2),n;return t[0]===e.children?n=t[1]:(n=(0,Q.jsx)(`div`,{className:`flex h-full items-center justify-center p-6 text-center text-sm text-muted-foreground`,children:e.children}),t[0]=e.children,t[1]=n),n}function fn(e){let t=(0,$.c)(7),n,r;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(n={diffHeaderHeight:32,hunkSeparatorHeight:24,spacing:0,paddingTop:0,paddingBottom:8},r={paddingTop:0,paddingBottom:0,gap:0},t[0]=n,t[1]=r):(n=t[0],r=t[1]);let i;t[2]===e.options?i=t[3]:(i={...e.options,unsafeCSS:`[data-diffs-header]{position:sticky!important;top:0;z-index:4;background:var(--background)!important;border-bottom:1px solid var(--border)!important}`,itemMetrics:n,layout:r},t[2]=e.options,t[3]=i);let a;return t[4]!==e||t[5]!==i?(a=(0,Q.jsx)(Ze,{...e,options:i}),t[4]=e,t[5]=i,t[6]=a):a=t[6],a}function pn(e){return[...e.threads.flatMap(t=>hn(e.file,t)),...e.pendingComments.flatMap(t=>_n(e.file,t))]}function mn(e,t){return e.some(e=>gn(e,t))}function hn(e,t){return gn(e,t)?[{side:yn(t.side),lineNumber:t.line,metadata:{kind:`thread`,thread:t}}]:[]}function gn(e,t){return[!t.isOutdated,t.line!==null,J(e)===t.path,t.line!==null&&Yt(e,t.side,t.line)].every(Boolean)}function _n(e,t){if(J(e)!==t.path)return[];let n=vn(t);return n===null||!Yt(e,n.side,n.line)?[]:[{side:yn(n.side),lineNumber:n.line,metadata:{kind:`pending`,comment:t}}]}function vn(e){switch(e.position.kind){case`added`:return{side:`right`,line:e.position.newLine};case`deleted`:return{side:`left`,line:e.position.oldLine};case`context`:return e.position.side===`left`?{side:`left`,line:e.position.oldLine}:{side:`right`,line:e.position.newLine}}}function yn(e){return e===`left`?`deletions`:`additions`}function bn(e){return xn[Sn(e)](e)}var xn={loading:()=>(0,Q.jsx)(W,{label:`Loading pull request diff…`}),error:e=>(0,Q.jsx)(dn,{children:e.error?.message??`Pull request diff could not be loaded.`}),empty:()=>(0,Q.jsx)(dn,{children:`This pull request has no file changes.`}),loaded:e=>(0,Q.jsx)(Dn,{...e})};function Sn(e){return Cn(e)?`loading`:wn(e)?`error`:Tn(e)?`empty`:`loaded`}function Cn(e){return e.loading&&e.slices.length===0}function wn(e){return e.error!==null&&e.slices.length===0}function Tn(e){return!En({itemCount:e.items.length,rawCount:e.raw.length,withheld:e.withheld})}function En(e){return e.itemCount>0||e.rawCount>0||e.withheld}function Dn(e){let t=(0,$.c)(12),n,r;t[0]===e?(n=t[1],r=t[2]):(n=(0,Q.jsx)(On,{...e}),r=e.items.length>0?(0,Q.jsx)(jn,{...e}):null,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===e.raw?i=t[4]:(i=(0,Q.jsx)(Pn,{raw:e.raw}),t[3]=e.raw,t[4]=i);let a;t[5]===e?a=t[6]:(a=(0,Q.jsx)(Fn,{...e}),t[5]=e,t[6]=a);let o;return t[7]!==n||t[8]!==r||t[9]!==i||t[10]!==a?(o=(0,Q.jsxs)(`div`,{className:`min-h-0 flex-1 overflow-auto`,children:[n,r,i,a]}),t[7]=n,t[8]=r,t[9]=i,t[10]=a,t[11]=o):o=t[11],o}function On(e){let t=(0,$.c)(18),n;t[0]!==e.activity?.reviewThreads||t[1]!==e.files?(n=e.activity?.reviewThreads.filter(t=>!mn(e.files,t)),t[0]=e.activity?.reviewThreads,t[1]=e.files,t[2]=n):n=t[2];let r=n,i;t[3]!==e.fileCount||t[4]!==e.filesViewed?(i=e.filesViewed!==void 0&&e.fileCount!==void 0&&e.filesViewed.viewedCount>0?(0,Q.jsxs)(`section`,{className:`border-b border-border/60 px-3 py-2 text-xs text-muted-foreground`,"aria-live":`polite`,children:[e.filesViewed.viewedCount,` of `,e.fileCount,` files viewed`]}):null,t[3]=e.fileCount,t[4]=e.filesViewed,t[5]=i):i=t[5];let a;t[6]===e?a=t[7]:(a=e.error===null?null:(0,Q.jsx)(kn,{...e,error:e.error}),t[6]=e,t[7]=a);let o;t[8]!==e.omittedFileCount||t[9]!==e.withheld?(o=e.withheld?(0,Q.jsx)(An,{omittedFileCount:e.omittedFileCount}):null,t[8]=e.omittedFileCount,t[9]=e.withheld,t[10]=o):o=t[10];let s;t[11]===r?s=t[12]:(s=r===void 0?null:(0,Q.jsx)(ln,{threads:r}),t[11]=r,t[12]=s);let c;return t[13]!==i||t[14]!==a||t[15]!==o||t[16]!==s?(c=(0,Q.jsxs)(Q.Fragment,{children:[i,a,o,s]}),t[13]=i,t[14]=a,t[15]=o,t[16]=s,t[17]=c):c=t[17],c}function kn(e){let t=(0,$.c)(8),n;t[0]===e.error.message?n=t[1]:(n=(0,Q.jsxs)(`span`,{children:[`More diff content could not be loaded: `,e.error.message]}),t[0]=e.error.message,t[1]=n);let r;t[2]!==e.hasNextPage||t[3]!==e.onLoadNextPage?(r=e.hasNextPage?(0,Q.jsx)(K,{type:`button`,size:`xs`,variant:`outline`,onClick:e.onLoadNextPage,children:`Retry`}):null,t[2]=e.hasNextPage,t[3]=e.onLoadNextPage,t[4]=r):r=t[4];let i;return t[5]!==n||t[6]!==r?(i=(0,Q.jsxs)(`section`,{className:`flex items-center justify-between gap-2 border-b border-destructive-border bg-destructive-surface px-3 py-2 text-xs text-destructive-foreground`,children:[n,r]}),t[5]=n,t[6]=r,t[7]=i):i=t[7],i}function An(e){let t=(0,$.c)(2),n=e.omittedFileCount>0?` ${e.omittedFileCount} file statistics remain available.`:``,r;return t[0]===n?r=t[1]:(r=(0,Q.jsxs)(`section`,{className:`border-b border-warning-border bg-warning-surface px-3 py-2 text-xs text-warning-foreground`,children:[`Binary or oversized content was withheld by the provider.`,n]}),t[0]=n,t[1]=r),r}function jn(e){let t=(0,$.c)(15),n;t[0]===e.onToggleFile?n=t[1]:(n=t=>Mn(t,e.onToggleFile),t[0]=e.onToggleFile,t[1]=n);let r;t[2]!==e.filesViewed||t[3]!==e.omittedStats?(r=t=>(0,Q.jsxs)(Q.Fragment,{children:[e.filesViewed!==void 0&&t.type===`diff`?(0,Q.jsx)(cn,{path:J(t.fileDiff),view:e.filesViewed}):null,Nn(t,e.omittedStats)]}),t[2]=e.filesViewed,t[3]=e.omittedStats,t[4]=r):r=t[4];let i;t[5]!==e.annotationPermissions||t[6]!==e.environmentId||t[7]!==e.reference?(i=t=>(0,Q.jsx)(nn,{annotation:t.metadata,environmentId:e.environmentId,reference:e.reference,permissions:e.annotationPermissions}),t[5]=e.annotationPermissions,t[6]=e.environmentId,t[7]=e.reference,t[8]=i):i=t[8];let a;return t[9]!==e.items||t[10]!==e.viewOptions||t[11]!==n||t[12]!==r||t[13]!==i?(a=(0,Q.jsx)(fn,{className:`h-full min-h-0 [scrollbar-gutter:stable]`,items:e.items,options:e.viewOptions,renderHeaderPrefix:n,renderHeaderMetadata:r,renderAnnotation:i}),t[9]=e.items,t[10]=e.viewOptions,t[11]=n,t[12]=r,t[13]=i,t[14]=a):a=t[14],a}function Mn(e,t){return(0,Q.jsx)(sn,{item:e,onToggleFile:t})}function Nn(e,t){return e.type===`diff`?(0,Q.jsx)(an,{file:e.fileDiff,omittedStats:t}):null}function Pn(e){return e.raw.map(e=>(0,Q.jsxs)(`pre`,{className:`m-3 whitespace-pre-wrap break-words rounded-md border border-warning-border bg-warning-surface p-3 font-mono text-xs text-warning-foreground`,children:[e.reason,`
|
|
2
|
-
|
|
3
|
-
`,e.text]},`${e.reason}:${e.text.slice(0,32)}`))}function Fn(e){let t=(0,$.c)(5),n;return t[0]!==e.continuationRef||t[1]!==e.hasNextPage||t[2]!==e.loadingNextPage||t[3]!==e.onLoadNextPage?(n=e.hasNextPage?(0,Q.jsx)(`div`,{ref:e.continuationRef,className:`flex justify-center p-3`,children:(0,Q.jsx)(K,{type:`button`,size:`sm`,variant:`outline`,disabled:e.loadingNextPage,onClick:e.onLoadNextPage,children:e.loadingNextPage?`Loading more files…`:`Load more files`})}):null,t[0]=e.continuationRef,t[1]=e.hasNextPage,t[2]=e.loadingNextPage,t[3]=e.onLoadNextPage,t[4]=n):n=t[4],n}function In(e){let t=(0,Z.useRef)(null),{resolvedTheme:n}=O(),r=(0,Z.useMemo)(()=>Rn(e.slices),[e.slices]),i=(0,Z.useMemo)(()=>zn(r),[r]),a=(0,Z.useMemo)(()=>i.map(e=>J(e)),[i]),o=qt({reference:e.reference,enabled:a.length>0,paths:a}),s=Ln(i,e),c=(0,Z.useMemo)(()=>Wn(e.onLoadFileContents,e.revisionKey),[e.onLoadFileContents,e.revisionKey]);return Jn({target:t,hasNextPage:e.hasNextPage,loadingNextPage:e.loadingNextPage,error:e.error,onLoadNextPage:e.onLoadNextPage}),(0,Q.jsx)(bn,{...e,continuationRef:t,files:i,filesViewed:o,fileCount:a.length,raw:Bn(r),withheld:e.slices.some(e=>e.truncated),omittedFileCount:Vn(e.slices),omittedStats:Hn(e.slices),items:s,viewOptions:Un(e,c,n)})}function Ln(e,t){return e.map((e,n)=>{let r=de(e);return{id:r,type:`diff`,fileDiff:e,collapsed:Xt(r,t.collapsedOverride,t.toggledFiles),annotations:pn({file:e,threads:t.activity?.reviewThreads??[],pendingComments:t.pendingComments}),version:n}})}function Rn(e){return e.map(e=>le(e.patch))}function zn(e){return jt(e.flatMap(e=>e?.kind===`files`?e.files:[]))}function Bn(e){return e.flatMap(e=>e?.kind===`raw`?[e]:[])}function Vn(e){return e.reduce((e,t)=>e+(t.omittedFileStats?.length??0),0)}function Hn(e){return new Map(e.flatMap(e=>e.omittedFileStats??[]).map(e=>[e.path,e]))}function Un(e,t,n){return{diffStyle:e.diffStyle,overflow:e.wordWrap?`wrap`:`scroll`,theme:R(n),themeType:n,stickyHeaders:!0,loadDiffFiles:t,enableLineSelection:e.onSelectLines!==void 0,...e.onSelectLines===void 0?{}:{onLineSelectionEnd:Gn(e.onSelectLines)}}}function Wn(e,t){return async n=>{let r=J(n),i=n.prevName?J({name:n.prevName}):r,a=await e({changeType:n.type,oldPath:i,newPath:r});return{oldFile:n.type===`rename-pure`?null:{name:i,contents:a.oldContents,cacheKey:`${t}:old:${i}`},newFile:{name:r,contents:a.newContents,cacheKey:`${t}:new:${r}`}}}}function Gn(e){return(t,n)=>{let r=Kn(t,n.item);r!==null&&e(r)}}function Kn(e,t){return e===null||t.type!==`diff`?null:qn(e,t.fileDiff)}function qn(e,t){let n=tn(t,e.end,e.endSide??e.side);return n===null?null:{path:J(t),oldPath:t.prevName?J({name:t.prevName}):null,start:e.start,end:e.end,position:n}}function Jn(e){let t=(0,$.c)(12),{target:n,hasNextPage:r,loadingNextPage:i,error:a,onLoadNextPage:o}=e,s;t[0]!==a||t[1]!==r||t[2]!==i||t[3]!==o||t[4]!==n.current?(s=()=>{let e=n.current;if(!Xn(e,{hasNextPage:r,loadingNextPage:i,error:a,onLoadNextPage:o}))return;let t=new IntersectionObserver(e=>{e.some(Yn)&&o()},{rootMargin:`240px`});return t.observe(e),()=>t.disconnect()},t[0]=a,t[1]=r,t[2]=i,t[3]=o,t[4]=n.current,t[5]=s):s=t[5];let c;t[6]!==a||t[7]!==r||t[8]!==i||t[9]!==o||t[10]!==n?(c=[a,r,i,o,n],t[6]=a,t[7]=r,t[8]=i,t[9]=o,t[10]=n,t[11]=c):c=t[11],(0,Z.useEffect)(s,c)}function Yn(e){return e.isIntersecting}function Xn(e,t){return[e!==null,t.hasNextPage,!t.loadingNextPage,t.error===null].every(Boolean)}function Zn(e){return[e.isDetailFresh,e.selectedCommitOid===null,e.detail.capabilities.review.inlineComment,e.detail.viewerPermissions.comment].every(Boolean)}function Qn(e){return e.isDetailFresh?e.detail.capabilities.review.verdicts.filter(t=>e.detail.viewerPermissions.verdicts.includes(t)):[]}function $n(e){let t=e.selectedCommitOid??`head`;return`${e.reference.projectId}:${e.reference.repository}#${e.reference.number}:${e.detail.updatedAt}:${t}`}function er(e){let t=(0,$.c)(22),n;t[0]===e?n=t[1]:(n=t=>nr(t,e),t[0]=e,t[1]=n);let r=e.anchor.end===e.anchor.start?``:`–${e.anchor.end}`,i;t[2]!==e.anchor.path||t[3]!==e.anchor.start||t[4]!==r?(i=(0,Q.jsxs)(`p`,{className:`mb-2 text-xs text-muted-foreground`,children:[`Comment on `,e.anchor.path,`:`,e.anchor.start,r]}),t[2]=e.anchor.path,t[3]=e.anchor.start,t[4]=r,t[5]=i):i=t[5];let a;t[6]!==e.body||t[7]!==e.onBodyChange?(a=(0,Q.jsx)(c,{value:e.body,ariaLabel:`Inline review comment`,placeholder:`Add a line comment…`,density:`compact`,onChange:e.onBodyChange}),t[6]=e.body,t[7]=e.onBodyChange,t[8]=a):a=t[8];let o;t[9]===e.onCancel?o=t[10]:(o=(0,Q.jsx)(K,{type:`button`,size:`sm`,variant:`ghost`,onClick:e.onCancel,children:`Cancel`}),t[9]=e.onCancel,t[10]=o);let s=e.body.trim().length===0,l;t[11]!==e.onAdd||t[12]!==s?(l=(0,Q.jsx)(K,{type:`button`,size:`sm`,disabled:s,onClick:e.onAdd,children:`Add to review`}),t[11]=e.onAdd,t[12]=s,t[13]=l):l=t[13];let u;t[14]!==o||t[15]!==l?(u=(0,Q.jsxs)(`div`,{className:`mt-2 flex justify-end gap-2`,children:[o,l]}),t[14]=o,t[15]=l,t[16]=u):u=t[16];let d;return t[17]!==n||t[18]!==i||t[19]!==a||t[20]!==u?(d=(0,Q.jsxs)(`aside`,{className:`absolute inset-x-3 bottom-3 z-20 rounded-lg border border-border bg-card p-3 shadow-lg`,onPointerDown:tr,onKeyDown:n,children:[i,a,u]}),t[17]=n,t[18]=i,t[19]=a,t[20]=u,t[21]=d):d=t[21],d}function tr(e){return e.stopPropagation()}function nr(e,t){if(e.key===`Escape`){e.preventDefault(),t.onCancel();return}rr(e)&&t.body.trim().length>0&&(e.preventDefault(),t.onAdd())}function rr(e){return e.key===`Enter`&&[e.metaKey,e.ctrlKey].some(Boolean)}var ir=[{value:`comment`,label:`Comment`},{value:`approve`,label:`Approve`},{value:`request-changes`,label:`Request changes`}];function ar(e,t,n,r){return!r&&(e===`approve`||t.trim().length>0||n.length>0)}function or(e){let[t,n]=(0,Z.useState)(!1),[r,i]=(0,Z.useState)(null),o=async r=>{if(ar(r,e.body,e.pendingComments,t)){n(!0),i(null);try{await e.onSubmit({verdict:r,body:e.body,comments:e.pendingComments})}catch(e){i(e instanceof Error?e.message:`Review could not be submitted.`)}finally{n(!1)}}};return(0,Q.jsxs)(`aside`,{className:`absolute inset-x-3 bottom-3 z-10 rounded-lg border border-border bg-card shadow-lg`,children:[(0,Q.jsxs)(`div`,{className:`flex items-center justify-between border-b border-border/60 px-3 py-2 text-xs text-muted-foreground`,children:[(0,Q.jsx)(`span`,{children:e.pendingComments.length===0?`Review`:`${e.pendingComments.length} line comments pending`}),(0,Q.jsx)(K,{type:`button`,size:`xs`,variant:`ghost`,onClick:e.onClose,children:`Close`})]}),(0,Q.jsxs)(`div`,{className:`p-3`,children:[(0,Q.jsx)(c,{value:e.body,ariaLabel:`Review summary`,placeholder:`Summarize your review (optional)`,density:`compact`,disabled:t,onChange:e.onBodyChange}),r===null?null:(0,Q.jsxs)(`p`,{role:`alert`,className:`mt-2 text-xs text-destructive-foreground`,children:[`Review could not be submitted: `,r]}),(0,Q.jsx)(`div`,{className:`mt-2 flex flex-wrap justify-end gap-2`,children:ir.filter(t=>e.verdicts.includes(t.value)).map(e=>(0,Q.jsxs)(K,{type:`button`,size:`sm`,variant:e.value===`comment`?`outline`:`default`,disabled:t,onClick:()=>void o(e.value),children:[e.value===`approve`?(0,Q.jsx)(a,{className:`size-3.5`}):e.value===`comment`?(0,Q.jsx)(f,{className:`size-3.5`}):(0,Q.jsx)(S,{className:`size-3.5`}),e.label]},e.value))})]})]})}function sr(e){let t=(0,$.c)(3),n=dr(e),r;return t[0]!==n||t[1]!==e?(r=(0,Q.jsx)(cr,{props:e,model:n}),t[0]=n,t[1]=e,t[2]=r):r=t[2],r}function cr(e){let t=(0,$.c)(2),n;return t[0]===e?n=t[1]:(n=(0,Q.jsx)(v,{children:(0,Q.jsxs)(`div`,{className:`flex h-full min-h-0 flex-col bg-background`,children:[(0,Q.jsx)(lr,{...e}),(0,Q.jsx)(ur,{...e}),(0,Q.jsx)(Sr,{...e})]})}),t[0]=e,t[1]=n),n}function lr(e){let t=(0,$.c)(12),{props:n,model:r}=e,i;t[0]===n.activity?.commits?i=t[1]:(i=n.activity?.commits??[],t[0]=n.activity?.commits,t[1]=i);let a;return t[2]!==r.diffStyle||t[3]!==r.setDiffStyle||t[4]!==r.setWordWrap||t[5]!==r.toggleAll||t[6]!==r.wordWrap||t[7]!==n.onRefresh||t[8]!==n.onSelectedCommitChange||t[9]!==n.selectedCommitOid||t[10]!==i?(a=(0,Q.jsx)(mt,{commits:i,selectedCommitOid:n.selectedCommitOid,diffStyle:r.diffStyle,wordWrap:r.wordWrap,onSelectedCommitChange:n.onSelectedCommitChange,onDiffStyleChange:r.setDiffStyle,onWordWrapChange:r.setWordWrap,onToggleAll:r.toggleAll,onRefresh:n.onRefresh}),t[2]=r.diffStyle,t[3]=r.setDiffStyle,t[4]=r.setWordWrap,t[5]=r.toggleAll,t[6]=r.wordWrap,t[7]=n.onRefresh,t[8]=n.onSelectedCommitChange,t[9]=n.selectedCommitOid,t[10]=i,t[11]=a):a=t[11],a}function ur(e){let t=(0,$.c)(27),{props:n,model:r}=e,i;t[0]===r.onSelectLines?i=t[1]:(i=r.onSelectLines===void 0?{}:{onSelectLines:r.onSelectLines},t[0]=r.onSelectLines,t[1]=i);let a=i,o=n.environmentId,s=n.reference,c=n.selectedCommitOid===null?n.activity:void 0,l;t[2]!==r.pendingComments||t[3]!==n.selectedCommitOid?(l=n.selectedCommitOid===null?r.pendingComments:[],t[2]=r.pendingComments,t[3]=n.selectedCommitOid,t[4]=l):l=t[4];let u=r.annotationPermissions,d=n.slices,f=n.loading,p=n.error,m=n.hasNextPage,h=n.loadingNextPage,g=r.collapsedOverride,_=r.toggledFiles,v=r.diffStyle,y=r.wordWrap,b;t[5]===n?b=t[6]:(b=$n(n),t[5]=n,t[6]=b);let x;return t[7]!==r.annotationPermissions||t[8]!==r.collapsedOverride||t[9]!==r.diffStyle||t[10]!==r.toggleFile||t[11]!==r.toggledFiles||t[12]!==r.wordWrap||t[13]!==n.environmentId||t[14]!==n.error||t[15]!==n.hasNextPage||t[16]!==n.loading||t[17]!==n.loadingNextPage||t[18]!==n.onLoadFileContents||t[19]!==n.onLoadNextPage||t[20]!==n.reference||t[21]!==n.slices||t[22]!==a||t[23]!==b||t[24]!==c||t[25]!==l?(x=(0,Q.jsx)(In,{environmentId:o,reference:s,activity:c,pendingComments:l,annotationPermissions:u,slices:d,loading:f,error:p,hasNextPage:m,loadingNextPage:h,collapsedOverride:g,toggledFiles:_,diffStyle:v,wordWrap:y,revisionKey:b,onToggleFile:r.toggleFile,onLoadNextPage:n.onLoadNextPage,onLoadFileContents:n.onLoadFileContents,...a}),t[7]=r.annotationPermissions,t[8]=r.collapsedOverride,t[9]=r.diffStyle,t[10]=r.toggleFile,t[11]=r.toggledFiles,t[12]=r.wordWrap,t[13]=n.environmentId,t[14]=n.error,t[15]=n.hasNextPage,t[16]=n.loading,t[17]=n.loadingNextPage,t[18]=n.onLoadFileContents,t[19]=n.onLoadNextPage,t[20]=n.reference,t[21]=n.slices,t[22]=a,t[23]=b,t[24]=c,t[25]=l,t[26]=x):x=t[26],x}function dr(e){let t=(0,$.c)(98),[n,r]=(0,Z.useState)(null),[i,a]=(0,Z.useState)(_r),[o,s]=(0,Z.useState)(`unified`),[c,u]=(0,Z.useState)(!0),[d,f]=(0,Z.useState)(!1),[p,h]=(0,Z.useState)(null),[g,v]=(0,Z.useState)(``),y;t[0]!==e.environmentId||t[1]!==e.reference?(y=ct(e.environmentId,e.reference),t[0]=e.environmentId,t[1]=e.reference,t[2]=y):y=t[2];let b=y,x;t[3]!==e.environmentId||t[4]!==e.reference?(x={environmentId:e.environmentId,...e.reference},t[3]=e.environmentId,t[4]=e.reference,t[5]=x):x=t[5];let S=dt(x),C=ut(gr),w=ut(hr),T=ut(mr),E;t[6]===b?E=t[7]:(E=e=>e.summaries[b]??``,t[6]=b,t[7]=E);let D=ut(E),O=ut(pr),k=ut(fr),A,j,M,N,P,F,I,L,R,z,B,ee,V,te,ne,H,U,W,G,re,K,ie,ae,oe,se;if(t[8]!==w||t[9]!==k||t[10]!==n||t[11]!==o||t[12]!==p||t[13]!==g||t[14]!==S||t[15]!==e||t[16]!==T||t[17]!==D||t[18]!==b||t[19]!==d||t[20]!==O||t[21]!==i||t[22]!==c){let y=Zn(e),x;t[48]!==e.detail||t[49]!==e.isDetailFresh?(x=l(e.detail,e.isDetailFresh),t[48]=e.detail,t[49]=e.isDetailFresh,t[50]=x):x=t[50];let C;t[51]!==e.detail||t[52]!==e.isDetailFresh?(C=m(e.detail,e.isDetailFresh),t[51]=e.detail,t[52]=e.isDetailFresh,t[53]=C):C=t[53];let E;t[54]!==e.detail||t[55]!==e.isDetailFresh?(E=_(e.detail,e.isDetailFresh),t[54]=e.detail,t[55]=e.isDetailFresh,t[56]=E):E=t[56];let q;t[57]!==x||t[58]!==C||t[59]!==E?(q={canReply:x,canResolve:C,reactionsEnabled:E},t[57]=x,t[58]=C,t[59]=E,t[60]=q):q=t[60];let ce=q,le;t[61]===e?le=t[62]:(le=Qn(e),t[61]=e,t[62]=le);let J=le,ue;t[63]===Symbol.for(`react.memo_cache_sentinel`)?(ue=()=>{h(null),v(``)},t[63]=ue):ue=t[63],A=ue,G=n,re=i,K=o,ie=c,ae=d,oe=p,se=g,j=b,M=S,N=ce,P=D,F=J,I=s,L=u,R=f,z=v,B=O,ee=w,V=T,te=k,ne=A,t[64]===Symbol.for(`react.memo_cache_sentinel`)?(H=()=>{r(vr),a(new Set)},U=e=>a(t=>br(t,e)),t[64]=H,t[65]=U):(H=t[64],U=t[65]),W=yr(y,h,e.onSelectLines),t[8]=w,t[9]=k,t[10]=n,t[11]=o,t[12]=p,t[13]=g,t[14]=S,t[15]=e,t[16]=T,t[17]=D,t[18]=b,t[19]=d,t[20]=O,t[21]=i,t[22]=c,t[23]=A,t[24]=j,t[25]=M,t[26]=N,t[27]=P,t[28]=F,t[29]=I,t[30]=L,t[31]=R,t[32]=z,t[33]=B,t[34]=ee,t[35]=V,t[36]=te,t[37]=ne,t[38]=H,t[39]=U,t[40]=W,t[41]=G,t[42]=re,t[43]=K,t[44]=ie,t[45]=ae,t[46]=oe,t[47]=se}else A=t[23],j=t[24],M=t[25],N=t[26],P=t[27],F=t[28],I=t[29],L=t[30],R=t[31],z=t[32],B=t[33],ee=t[34],V=t[35],te=t[36],ne=t[37],H=t[38],U=t[39],W=t[40],G=t[41],re=t[42],K=t[43],ie=t[44],ae=t[45],oe=t[46],se=t[47];let q;t[66]!==C||t[67]!==p||t[68]!==g||t[69]!==A||t[70]!==b?(q=()=>xr({draftAnchor:p,draftBody:g,reviewKey:b,addComment:C,resetDraft:A}),t[66]=C,t[67]=p,t[68]=g,t[69]=A,t[70]=b,t[71]=q):q=t[71];let ce;return t[72]!==j||t[73]!==M||t[74]!==N||t[75]!==P||t[76]!==F||t[77]!==I||t[78]!==L||t[79]!==R||t[80]!==z||t[81]!==B||t[82]!==ee||t[83]!==V||t[84]!==te||t[85]!==ne||t[86]!==H||t[87]!==U||t[88]!==W||t[89]!==q||t[90]!==G||t[91]!==re||t[92]!==K||t[93]!==ie||t[94]!==ae||t[95]!==oe||t[96]!==se?(ce={collapsedOverride:G,toggledFiles:re,diffStyle:K,wordWrap:ie,reviewOpen:ae,draftAnchor:oe,draftBody:se,reviewKey:j,pendingComments:M,annotationPermissions:N,reviewBody:P,verdicts:F,setDiffStyle:I,setWordWrap:L,setReviewOpen:R,setDraftBody:z,setReviewBody:B,clearComments:ee,removeComments:V,clearReviewBody:te,resetDraft:ne,toggleAll:H,toggleFile:U,onSelectLines:W,addDraft:q},t[72]=j,t[73]=M,t[74]=N,t[75]=P,t[76]=F,t[77]=I,t[78]=L,t[79]=R,t[80]=z,t[81]=B,t[82]=ee,t[83]=V,t[84]=te,t[85]=ne,t[86]=H,t[87]=U,t[88]=W,t[89]=q,t[90]=G,t[91]=re,t[92]=K,t[93]=ie,t[94]=ae,t[95]=oe,t[96]=se,t[97]=ce):ce=t[97],ce}function fr(e){return e.clearSummary}function pr(e){return e.setSummary}function mr(e){return e.removeComments}function hr(e){return e.clear}function gr(e){return e.addComment}function _r(){return new Set}function vr(e){return e===`expanded`?`folded`:`expanded`}function yr(e,t,n){if(e)return e=>{t(e),n!==void 0&&n(e)}}function br(e,t){let n=new Set(e);return n.has(t)?n.delete(t):n.add(t),n}function xr(e){let t=e.draftBody.trim();t.length!==0&&e.draftAnchor!==null&&(e.addComment(e.reviewKey,{id:st(),path:e.draftAnchor.path,...e.draftAnchor.oldPath===null?{}:{oldPath:e.draftAnchor.oldPath},position:e.draftAnchor.position,body:t}),e.resetDraft())}function Sr(e){let t=(0,$.c)(11),n;t[0]!==e.model.addDraft||t[1]!==e.model.draftAnchor||t[2]!==e.model.draftBody||t[3]!==e.model.resetDraft||t[4]!==e.model.setDraftBody?(n=e.model.draftAnchor===null?null:(0,Q.jsx)(er,{anchor:e.model.draftAnchor,body:e.model.draftBody,onBodyChange:e.model.setDraftBody,onCancel:e.model.resetDraft,onAdd:e.model.addDraft}),t[0]=e.model.addDraft,t[1]=e.model.draftAnchor,t[2]=e.model.draftBody,t[3]=e.model.resetDraft,t[4]=e.model.setDraftBody,t[5]=n):n=t[5];let r;t[6]===e?r=t[7]:(r=(0,Q.jsx)(Cr,{...e}),t[6]=e,t[7]=r);let i;return t[8]!==n||t[9]!==r?(i=(0,Q.jsxs)(Q.Fragment,{children:[n,r]}),t[8]=n,t[9]=r,t[10]=i):i=t[10],i}function Cr(e){let t=(0,$.c)(21);if(e.model.verdicts.length===0)return null;if(!e.model.reviewOpen){let n;t[0]===e.model?n=t[1]:(n=()=>e.model.setReviewOpen(!0),t[0]=e.model,t[1]=n);let r=e.model.pendingComments.length>0?` (${e.model.pendingComments.length})`:``,i;return t[2]!==n||t[3]!==r?(i=(0,Q.jsxs)(`button`,{type:`button`,className:`absolute bottom-3 right-4 rounded-md bg-foreground px-3 py-1.5 text-xs font-medium text-background shadow-sm hover:opacity-90`,onClick:n,children:[`Review`,r]}),t[2]=n,t[3]=r,t[4]=i):i=t[4],i}let n,r;t[5]===e.model?(n=t[6],r=t[7]):(n=t=>e.model.setReviewBody(e.model.reviewKey,t),r=t=>{t.length===0&&e.model.clearComments(e.model.reviewKey)},t[5]=e.model,t[6]=n,t[7]=r);let i;t[8]!==e.model||t[9]!==e.props?(i=async t=>{await e.props.onSubmitReview(t),e.model.removeComments(e.model.reviewKey,e.model.pendingComments.map(wr)),e.model.clearReviewBody(e.model.reviewKey,t.body),e.model.setReviewOpen(!1)},t[8]=e.model,t[9]=e.props,t[10]=i):i=t[10];let a;t[11]===e.model?a=t[12]:(a=()=>e.model.setReviewOpen(!1),t[11]=e.model,t[12]=a);let o;return t[13]!==e.model.pendingComments||t[14]!==e.model.reviewBody||t[15]!==e.model.verdicts||t[16]!==n||t[17]!==r||t[18]!==i||t[19]!==a?(o=(0,Q.jsx)(or,{verdicts:e.model.verdicts,pendingComments:e.model.pendingComments,body:e.model.reviewBody,onBodyChange:n,onPendingCommentsChange:r,onSubmit:i,onClose:a}),t[13]=e.model.pendingComments,t[14]=e.model.reviewBody,t[15]=e.model.verdicts,t[16]=n,t[17]=r,t[18]=i,t[19]=a,t[20]=o):o=t[20],o}function wr(e){return e.id}function Tr(e){let t=(0,$.c)(27),n=B(),r;t[0]!==e.environmentId||t[1]!==e.reference||t[2]!==e.selectedCommitOid?(r=o({environmentId:e.environmentId,input:{...e.reference,...e.selectedCommitOid===null?{}:{commit:e.selectedCommitOid}}}),t[0]=e.environmentId,t[1]=e.reference,t[2]=e.selectedCommitOid,t[3]=r):r=t[3];let i=r,a=pe(i),s=u(e.environmentId,e.reference),c;t[4]===a.data?.pages?c=t[5]:(c=a.data?.pages??[],t[4]=a.data?.pages,t[5]=c);let l;t[6]===a?l=t[7]:(l=()=>void a.fetchNextPage(),t[6]=a,t[7]=l);let d;t[8]!==i||t[9]!==n?(d=()=>void n.resetQueries({queryKey:i.queryKey,exact:!0}),t[8]=i,t[9]=n,t[10]=d):d=t[10];let f;t[11]!==e.reference||t[12]!==e.selectedCommitOid?(f=async t=>{if(e.reference.projectRepositoryId===void 0)throw Error(`This pull request has no canonical Command repository identity.`);return G.getPullRequestDiffFileContents({projectId:Number(e.reference.projectId),projectRepositoryId:e.reference.projectRepositoryId,number:e.reference.number,...t,...e.selectedCommitOid===null?{}:{commit:e.selectedCommitOid}})},t[11]=e.reference,t[12]=e.selectedCommitOid,t[13]=f):f=t[13];let p;t[14]!==s||t[15]!==e.reference?(p=t=>s.execute(async()=>{if(e.reference.projectRepositoryId===void 0)throw Error(`This pull request has no canonical Command repository identity.`);await G.submitPullRequestReview({projectId:Number(e.reference.projectId),projectRepositoryId:e.reference.projectRepositoryId,number:e.reference.number,idempotencyKey:crypto.randomUUID(),verdict:t.verdict,body:t.body,comments:t.comments.map(Er)})}),t[14]=s,t[15]=e.reference,t[16]=p):p=t[16];let m;return t[17]!==a.error||t[18]!==a.hasNextPage||t[19]!==a.isFetchingNextPage||t[20]!==a.isPending||t[21]!==c||t[22]!==l||t[23]!==d||t[24]!==f||t[25]!==p?(m={slices:c,loading:a.isPending,error:a.error,hasNextPage:a.hasNextPage,loadingNextPage:a.isFetchingNextPage,loadNextPage:l,refresh:d,loadFileContents:f,submitReview:p},t[17]=a.error,t[18]=a.hasNextPage,t[19]=a.isFetchingNextPage,t[20]=a.isPending,t[21]=c,t[22]=l,t[23]=d,t[24]=f,t[25]=p,t[26]=m):m=t[26],m}function Er(e){return{path:e.path,...e.oldPath===void 0?{}:{oldPath:e.oldPath},position:{...e.position},body:e.body}}function Dr(e){let t=(0,$.c)(23),[n,r]=(0,Z.useState)(null),i;t[0]!==e.activity?.commits||t[1]!==n?(i=e.activity?.commits.some(e=>e.oid===n)?n:null,t[0]=e.activity?.commits,t[1]=n,t[2]=i):i=t[2];let a=i,o;t[3]!==e.environmentId||t[4]!==e.reference||t[5]!==a?(o={environmentId:e.environmentId,reference:e.reference,selectedCommitOid:a},t[3]=e.environmentId,t[4]=e.reference,t[5]=a,t[6]=o):o=t[6];let s=Tr(o),c;t[7]!==s.slices||t[8]!==e?(c=t=>e.onSelectLines({...t,patch:x(s.slices.map(Or).join(`
|
|
4
|
-
`),t.path)}),t[7]=s.slices,t[8]=e,t[9]=c):c=t[9];let l;return t[10]!==s.error||t[11]!==s.hasNextPage||t[12]!==s.loadFileContents||t[13]!==s.loadNextPage||t[14]!==s.loading||t[15]!==s.loadingNextPage||t[16]!==s.refresh||t[17]!==s.slices||t[18]!==s.submitReview||t[19]!==e||t[20]!==a||t[21]!==c?(l=(0,Q.jsx)(sr,{...e,selectedCommitOid:a,slices:s.slices,loading:s.loading,error:s.error,hasNextPage:s.hasNextPage,loadingNextPage:s.loadingNextPage,onSelectedCommitChange:r,onLoadNextPage:s.loadNextPage,onRefresh:s.refresh,onLoadFileContents:s.loadFileContents,onSubmitReview:s.submitReview,onSelectLines:c}),t[10]=s.error,t[11]=s.hasNextPage,t[12]=s.loadFileContents,t[13]=s.loadNextPage,t[14]=s.loading,t[15]=s.loadingNextPage,t[16]=s.refresh,t[17]=s.slices,t[18]=s.submitReview,t[19]=e,t[20]=a,t[21]=c,t[22]=l):l=t[22],l}function Or(e){return e.patch}export{Dr as default};
|
|
5
|
-
//# sourceMappingURL=PullRequestCodePanel-DF0mftTO.js.map
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-hePW80VL.js";import{Ha as t,Ua as n,Wa as r}from"./Stream-mUTFnSY9.js";import{s as i}from"./scroll-area-BxupGCij.js";import{a,c as o,l as s,n as c,o as l,t as u,w as d}from"./switch-wFSVBlXv.js";import{d as f,i as p,l as m,m as h,p as g,t as _}from"./themePalette-NfQV9Yfl.js";import{n as v,t as y}from"./toggle-group-DB8Zelac.js";var b=e(r(),1);function x(e){let t=h(e);if(t===null)return null;let n=/^oklch\(([\d.]+) ([\d.]+) ([\d.]+)(?:\s*\/\s*[\d.]+)?\)$/.exec(t);return n===null?null:{L:Number(n[1]),C:Number(n[2]),h:Number(n[3])}}function S(e){let t={L:Math.min(1,Math.max(0,e.L)),C:Math.max(0,e.C),h:(e.h%360+360)%360};return g(`oklch(${t.L} ${t.C} ${t.h})`)}function C(e){let[t=0,n=0,r=0]=[1,3,5].map(t=>Number.parseInt(e.slice(t,t+2),16)/255).map(e=>e<=.04045?e/12.92:((e+.055)/1.055)**2.4);return .2126*t+.7152*n+.0722*r}function w(e,t){let[n,r]=[C(e),C(t)],[i,a]=n>=r?[n,r]:[r,n];return(i+.05)/(a+.05)}var T=4.6;function E(e){let t=x(e);if(t===null)return null;let n=n=>{let r=S({L:n,C:.008,h:t.h});return r===null?0:w(r,e)},r=n(1)>=n(0),i=r?-.005:.005;for(let n=+!!r;n>=0&&n<=1;n+=i){let r=S({L:n,C:.008,h:t.h});if(r!==null&&w(r,e)>=T)return r}return null}function D(e,t){let n=x(e);return n===null?null:S({...n,L:n.L+t})}var O=.035,k=.02;function A(e){let{backgroundHex:t,accentHex:n,appearance:r}=e,i=r===`dark`,a=i?O:k,o=E(t),s=D(t,a),c=D(t,a*1.6),l=D(t,i?-.015:-.035),u=D(t,i?.09:-.09),d=D(n,i?.08:-.04),f={},p=(e,t)=>{t!==null&&(f[e]=t)};return p(`background`,h(t)),p(`foreground`,o),p(`card`,s),p(`cardForeground`,o),p(`popover`,c),p(`popoverForeground`,o),p(`sidebar`,l),p(`sidebarForeground`,o),p(`sidebarBorder`,u),p(`primary`,h(n)),p(`primaryForeground`,E(n)),p(`secondary`,D(t,a*.8)),p(`secondaryForeground`,o),p(`muted`,D(t,i?.05:-.045)),p(`mutedForeground`,o),p(`accent`,d??h(n)),p(`accentForeground`,E(d??n)),p(`border`,u),p(`input`,D(t,i?.12:-.12)),f}var j=[{id:`surfaces`,title:`Surfaces`,roles:[`background`,`card`,`cardForeground`,`popover`,`popoverForeground`]},{id:`sidebar`,title:`Sidebar`,roles:[`sidebar`,`sidebarForeground`,`sidebarBorder`]},{id:`text`,title:`Text`,roles:[`foreground`,`muted`,`mutedForeground`]},{id:`interaction`,title:`Interaction`,roles:[`primary`,`primaryForeground`,`secondary`,`secondaryForeground`,`accent`,`accentForeground`,`border`,`input`]},{id:`status`,title:`Status`,roles:[`destructive`,`destructiveForeground`,`warning`,`warningForeground`,`success`,`successForeground`,`info`,`infoForeground`]}];function M(e){return e.replace(/([A-Z])/g,` $1`).replace(/^./,e=>e.toUpperCase())}function N(e){return M(e)}function P(e){let t=e.editing??e.seed;return{editingId:e.editing?.id??null,name:e.editing?.name??e.seedName??e.seed?.name??``,description:t?.description??``,...t?.collection?{collection:t.collection}:{},appearance:e.initialAppearance,colors:{light:t?.light??{},dark:t?.dark??{}}}}function F(e){let t=e.name.trim();if(t.length===0)return{error:`Name your theme first.`};let n=e.colors[e.appearance],r=e.appearance===`light`?`dark`:`light`,i=e.colors[r];try{return{theme:f({version:1,...e.editingId===null?{}:{id:e.editingId},name:t,appearance:e.appearance,colors:n,...Object.keys(i).length>0?{variants:{[r]:i}}:{},description:e.description,...e.collection?{collection:e.collection}:{}})}}catch(e){return{error:e instanceof Error?e.message:`The theme could not be saved.`}}}function I(e,t){let n=e[t];return n===void 0?null:g(n)}var L=t(),R=n();function z(e){let t=(0,L.c)(24),[n,r]=(0,b.useState)(null),[i,a]=(0,b.useState)(e.hex);i!==e.hex&&(a(e.hex),n!==null&&n.trim().toLowerCase()!==(e.hex??``).toLowerCase()&&r(null));let o=e.hex??`#000000`,s;t[0]===e?s=t[1]:(s=t=>{r(t),/^#(?:[\da-fA-F]{3}|[\da-fA-F]{6})$/.test(t.trim())&&e.onHexChange(t.trim())},t[0]=e,t[1]=s);let c=s,l;t[2]===e.label?l=t[3]:(l=(0,R.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-[13px] text-foreground`,children:e.label}),t[2]=e.label,t[3]=l);let u=`${e.label} color`,d;t[4]===e?d=t[5]:(d=t=>{let n=t.currentTarget.value;r(n),e.onHexChange(h(n)===null?null:n)},t[4]=e,t[5]=d);let f;t[6]!==o||t[7]!==u||t[8]!==d?(f=(0,R.jsx)(`input`,{"aria-label":u,className:`h-7 w-9 shrink-0 cursor-pointer rounded-md border border-border bg-transparent p-0.5`,onChange:d,type:`color`,value:o}),t[6]=o,t[7]=u,t[8]=d,t[9]=f):f=t[9];let p=`${e.label} hex value`,m;t[10]===c?m=t[11]:(m=e=>c(e.currentTarget.value),t[10]=c,t[11]=m);let g=`${e.label}:${e.hex??``}`,_=n??e.hex??``,v;t[12]!==p||t[13]!==m||t[14]!==g||t[15]!==_?(v=(0,R.jsx)(`input`,{"aria-label":p,className:`h-7 w-24 shrink-0 rounded-md border border-border bg-transparent px-2 font-mono text-xs text-foreground`,onChange:m,value:_},g),t[12]=p,t[13]=m,t[14]=g,t[15]=_,t[16]=v):v=t[16];let y;t[17]===e?y=t[18]:(y=e.allowClear===!1||e.hex===null?null:(0,R.jsx)(`button`,{"aria-label":`Clear ${e.label} override`,className:`h-7 shrink-0 rounded-md px-2 text-xs text-muted-foreground hover:bg-accent hover:text-foreground`,onClick:()=>{r(null),e.onHexChange(null)},type:`button`,children:`Reset`}),t[17]=e,t[18]=y);let x;return t[19]!==l||t[20]!==y||t[21]!==f||t[22]!==v?(x=(0,R.jsxs)(`div`,{className:`flex items-center gap-2 py-1`,children:[l,f,v,y]}),t[19]=l,t[20]=y,t[21]=f,t[22]=v,t[23]=x):x=t[23],x}var B=`#fcfcfc`,V=`#171717`;function H(e,t){if(typeof window>`u`)return t;let n=getComputedStyle(document.documentElement).getPropertyValue(e).trim();return g(n)??t}function U(e){let t=e.editingTheme??e.seedTheme,n=e=>{let n=e===`light`?`dark`:`light`;return g(t?.[e].primary??t?.[n].primary??``)??H(`--primary`,`#c2410c`)};return{light:{backgroundHex:g(t?.light.background??``)??B,accentHex:n(`light`)},dark:{backgroundHex:g(t?.dark.background??``)??V,accentHex:n(`dark`)}}}var W=`__theme-editor-preview`;function G(e){return P({editing:e.editingTheme,seed:e.seedTheme,seedName:e.seedName??null,initialAppearance:e.initialAppearance})}function K(e){let[t,n]=(0,b.useState)(()=>G(e)),[r,f]=(0,b.useState)(()=>U({editingTheme:e.editingTheme,seedTheme:e.seedTheme,initialAppearance:e.initialAppearance})),[h,g]=(0,b.useState)(!1),[x,S]=(0,b.useState)(null),C=(0,b.useRef)(!1),w=(0,b.useRef)(e.restorePreview);w.current=e.restorePreview,(0,b.useEffect)(()=>{if(e.open)return _({id:W,name:t.name.trim()===``?`Theme preview`:t.name,description:``,light:t.colors.light,dark:t.colors.dark},t.appearance),()=>{C.current||w.current()}},[t.appearance,t.colors.dark,t.colors.light,t.name,e.open]);let T=(e,t)=>{n(n=>{let r=n.colors[n.appearance],i=t===null?Object.fromEntries(Object.entries(r).filter(([t])=>t!==e)):{...r,[e]:t};return{...n,colors:{...n.colors,[n.appearance]:i}}})},E=()=>{n(e=>({...e,colors:{...e.colors,[e.appearance]:A({backgroundHex:r[e.appearance].backgroundHex,accentHex:r[e.appearance].accentHex,appearance:e.appearance})}})),S(null)},D=()=>{let n=F(t);if(`error`in n){S(n.error);return}try{let r=t.editingId===null,i=r===!0?p(n.theme):m(n.theme);C.current=!0,e.onSaved(i,{created:r}),e.onOpenChange(!1)}catch(e){S(e instanceof Error?e.message:`Could not save the theme.`)}},O=r[t.appearance];return(0,R.jsx)(c,{onOpenChange:t=>{t||e.onOpenChange(!1)},open:e.open,children:(0,R.jsxs)(o,{className:`flex max-h-[min(46rem,calc(100dvh-2rem))] w-[34rem] max-w-[calc(100vw-2rem)] flex-col gap-4`,children:[(0,R.jsx)(l,{children:(0,R.jsx)(s,{children:t.editingId===null?`New theme`:`Edit theme`})}),(0,R.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col gap-4 overflow-y-auto pr-1`,children:[(0,R.jsxs)(`label`,{className:`grid grid-cols-[minmax(0,9rem)_minmax(0,1fr)] items-center gap-3`,children:[(0,R.jsx)(`span`,{className:`text-sm font-medium`,children:`Theme name`}),(0,R.jsx)(d,{maxLength:48,onChange:e=>{let t=e.currentTarget.value;n(e=>({...e,name:t})),S(null)},placeholder:`e.g. Aurora`,value:t.name})]}),(0,R.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,R.jsx)(`span`,{className:`text-sm font-medium`,children:`Editing`}),(0,R.jsxs)(v,{"aria-label":`Appearance being edited`,onValueChange:e=>{let t=e[0];(t===`light`||t===`dark`)&&n(e=>({...e,appearance:t}))},value:[t.appearance],variant:`segmented`,children:[(0,R.jsx)(y,{value:`light`,children:`Light`}),(0,R.jsx)(y,{value:`dark`,children:`Dark`})]}),(0,R.jsxs)(`span`,{className:`ml-auto flex items-center gap-2 text-muted-foreground text-xs`,children:[(0,R.jsx)(u,{"aria-label":`Advanced role editing`,checked:h,onCheckedChange:e=>g(!!e)}),`Advanced`]})]}),(0,R.jsx)(`p`,{className:`text-muted-foreground text-xs`,children:`The preview is live across the app. Browse with the dialog open to judge it.`}),h?null:(0,R.jsxs)(`div`,{className:`flex flex-col gap-2 rounded-xl border border-border p-3`,children:[(0,R.jsx)(`p`,{className:`text-[13px] font-medium text-foreground`,children:`Start from two colors`}),(0,R.jsx)(z,{allowClear:!1,label:`Canvas`,hex:O.backgroundHex,onHexChange:e=>{e!==null&&f(n=>({...n,[t.appearance]:{...n[t.appearance],backgroundHex:e}}))}}),(0,R.jsx)(z,{allowClear:!1,label:`Accent`,hex:O.accentHex,onHexChange:e=>{e!==null&&f(n=>({...n,[t.appearance]:{...n[t.appearance],accentHex:e}}))}}),(0,R.jsx)(i,{className:`self-start`,onClick:E,size:`sm`,variant:`outline`,children:`Derive palette`})]}),h?(0,R.jsx)(`div`,{className:`flex flex-col gap-4`,children:j.map(e=>(0,R.jsxs)(`section`,{children:[(0,R.jsx)(`h3`,{className:`mb-1 text-[13px] font-medium text-muted-foreground`,children:e.title}),e.roles.map(e=>(0,R.jsx)(z,{label:N(e),hex:I(t.colors[t.appearance],e),onHexChange:t=>T(e,t)},e))]},e.id))}):null,x===null?null:(0,R.jsx)(`p`,{className:`text-destructive text-sm`,role:`alert`,children:x})]}),(0,R.jsxs)(a,{children:[(0,R.jsx)(i,{onClick:()=>{e.onOpenChange(!1)},size:`sm`,variant:`outline`,children:`Cancel`}),(0,R.jsx)(i,{onClick:D,size:`sm`,children:`Save theme`})]})]})})}export{K as ThemeEditorPanel};
|
|
2
|
-
//# sourceMappingURL=ThemeEditorPanel-DCsxTx0Q.js.map
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-hePW80VL.js";import{Ha as t,Ua as n,Wa as r}from"./Stream-mUTFnSY9.js";import{Gt as i,Rs as a,Xt as o,Yn as s,Zt as c,gr as l}from"./WorkerPoolContext-CCKWNBEN.js";import{on as u}from"./CompositeItem-BxPZ_9BJ.js";import{Nt as d}from"./src-CFUzoLms.js";function f(e){return a({from:e.from,strict:e.strict,shouldThrow:e.shouldThrow,structuralSharing:e.structuralSharing,select:t=>e.select?e.select(t.search):t.search})}var p=u(`chevron-left`,[[`path`,{d:`m15 18-6-6 6-6`,key:`1wnfg3`}]]),m=u(`file-diff`,[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,key:`1oefj6`}],[`path`,{d:`M9 10h6`,key:`9gxzsh`}],[`path`,{d:`M12 13V7`,key:`h0r20n`}],[`path`,{d:`M9 17h6`,key:`r8uit2`}]]);function h(e){return e.threadWorktreePath??e.projectCwd??void 0}function g(e){return e?.isRepo??!0}var _=n(),v=t();function y(e,t){return e==null||t==null?e===t:e.top===t.top&&e.bottom===t.bottom}var b=1e3,x=b*4,S=[0,1e-6,.99999,1],C={overscrollSize:b,intersectionObserverMargin:x,resizeDebugging:!1},w=0,T=-1,E=class e{static __STOP=!1;static __lastScrollPosition=0;__id=`virtualizer-${++T}`;config;type=`simple`;intersectionObserver;scrollTop=0;height=0;scrollHeight=0;windowSpecs={top:0,bottom:0};root;contentContainer;resizeObserver;observers=new Map;visibleInstances=new Map;visibleInstancesDirty=!1;instancesChanged=new Set;reconcileQueue=new Set;scrollDirty=!0;heightDirty=!0;scrollHeightDirty=!0;renderedObservers=0;connectQueue=new Map;constructor(e){this.config={...C,...e}}setup(t,n){if(this.root==null){this.root=t,this.resizeObserver=new ResizeObserver(this.handleContainerResize),this.intersectionObserver=new IntersectionObserver(this.handleIntersectionChange,{root:this.root,threshold:S,rootMargin:`${this.config.intersectionObserverMargin}px 0px ${this.config.intersectionObserverMargin}px 0px`}),t instanceof Document?this.setupWindow():this.setupElement(n),window.__INSTANCE=this,window.__TOGGLE=()=>{e.__STOP?(e.__STOP=!1,(this.getScrollContainerElement()??window).scrollTo({top:e.__lastScrollPosition}),c(this.computeRenderRangeAndEmit)):(e.__lastScrollPosition=this.getScrollTop(),e.__STOP=!0)};for(let[e,t]of this.connectQueue.entries())this.connect(e,t);this.connectQueue.clear(),this.markDOMDirty(),c(this.computeRenderRangeAndEmit)}}instanceChanged(e,t){this.instancesChanged.add(e),t&&this.markDOMDirty(),c(this.computeRenderRangeAndEmit)}requestHeightReconcile(e){this.reconcileQueue.add(e),c(this.computeRenderRangeAndEmit)}getWindowSpecs(){return this.windowSpecs.top===0&&this.windowSpecs.bottom===0&&(this.windowSpecs=i({scrollTop:this.getScrollTop(),height:this.getHeight(),scrollHeight:this.getScrollHeight(),overscrollSize:this.config.overscrollSize})),this.windowSpecs}getRoot(){return this.root}isInstanceVisible(e,t){let n=this.getScrollTop(),r=this.getHeight(),i=this.config.intersectionObserverMargin,a=n-i,o=n+r+i;return!(e<a-t||e>o)}handleContainerResize=e=>{if(this.root==null)return;let t=!1;for(let n of e){let e=n.borderBoxSize[0].blockSize;this.root instanceof Document?e!==this.scrollHeight&&(this.scrollHeightDirty=!0,t=!0,this.config.resizeDebugging&&(console.log(`Virtualizer: content size change`,this.__id,{sizeChange:e-w,newSize:e}),w=e)):n.target===this.root?e!==this.height&&(this.heightDirty=!0,t=!0):n.target===this.contentContainer&&(this.scrollHeightDirty=!0,t=!0,this.config.resizeDebugging&&(console.log(`Virtualizer: scroller size change`,this.__id,{sizeChange:e-w,newSize:e}),w=e))}t&&c(this.computeRenderRangeAndEmit)};setupWindow(){if(this.root==null||!(this.root instanceof Document))throw Error(`Virtualizer.setupWindow: Invalid setup method`);window.addEventListener(`scroll`,this.handleWindowScroll,{passive:!0}),window.addEventListener(`resize`,this.handleWindowResize,{passive:!0}),this.resizeObserver?.observe(this.root.documentElement)}setupElement(e){if(this.root==null||this.root instanceof Document)throw Error(`Virtualizer.setupElement: Invalid setup method`);this.root.addEventListener(`scroll`,this.handleElementScroll,{passive:!0}),this.resizeObserver?.observe(this.root),e??=this.root.firstElementChild??void 0,e instanceof HTMLElement&&(this.contentContainer=e,this.resizeObserver?.observe(e))}cleanUp(){o(this.computeRenderRangeAndEmit),this.resizeObserver?.disconnect(),this.resizeObserver=void 0,this.intersectionObserver?.disconnect(),this.intersectionObserver=void 0,this.root?.removeEventListener(`scroll`,this.handleElementScroll),window.removeEventListener(`scroll`,this.handleWindowScroll),window.removeEventListener(`resize`,this.handleWindowResize),this.root=void 0,this.contentContainer=void 0,this.observers.clear(),this.visibleInstances.clear(),this.instancesChanged.clear(),this.reconcileQueue.clear(),this.connectQueue.clear(),this.visibleInstancesDirty=!1,this.windowSpecs={top:0,bottom:0},this.scrollTop=0,this.height=0,this.scrollHeight=0,this.scrollDirty=!0,this.heightDirty=!0,this.scrollHeightDirty=!0}getOffsetInScrollContainer(e){return this.getScrollTop()+D(e,this.getScrollContainerElement())}connect(e,t){if(this.observers.has(e))throw Error(`Virtualizer.connect: instance is already connected...`);return this.intersectionObserver==null?this.connectQueue.set(e,t):(this.intersectionObserver.observe(e),this.observers.set(e,t),this.instancesChanged.add(t),this.markDOMDirty(),c(this.computeRenderRangeAndEmit)),()=>this.disconnect(e)}disconnect(e){let t=this.observers.get(e);this.connectQueue.delete(e),t!=null&&(this.intersectionObserver?.unobserve(e),this.observers.delete(e),this.instancesChanged.delete(t),this.reconcileQueue.delete(t),this.visibleInstances.delete(e)&&(this.visibleInstancesDirty=!0),this.markDOMDirty(),c(this.computeRenderRangeAndEmit))}handleWindowResize=()=>{e.__STOP||window.innerHeight===this.height||(this.heightDirty=!0,c(this.computeRenderRangeAndEmit))};handleWindowScroll=()=>{e.__STOP||this.root==null||!(this.root instanceof Document)||(this.scrollDirty=!0,c(this.computeRenderRangeAndEmit))};handleElementScroll=()=>{e.__STOP||this.root==null||this.root instanceof Document||(this.scrollDirty=!0,c(this.computeRenderRangeAndEmit))};computeRenderRangeAndEmit=()=>{if(e.__STOP)return;let t=this.heightDirty||this.scrollHeightDirty,n=this.instancesChanged.size>0;if(this.instancesChanged.size===0){let e=i({scrollTop:this.getScrollTop(),height:this.getHeight(),scrollHeight:this.getScrollHeight(),overscrollSize:this.config.overscrollSize});if(!t&&y(this.windowSpecs,e)&&this.renderedObservers===this.observers.size&&!this.visibleInstancesDirty&&this.reconcileQueue.size===0)return;this.windowSpecs=e}this.visibleInstancesDirty=!1,this.renderedObservers=this.observers.size;let r=this.getScrollAnchor(this.height),a=new Set;for(let e of t?this.observers.values():this.visibleInstances.values())e.onRender(t)&&a.add(e);for(let e of this.instancesChanged)a.has(e)||e.onRender(t)&&a.add(e);this.scrollFix(r);for(let e of a)this.reconcileQueue.delete(e),e.reconcileHeights();for(let e of this.reconcileQueue)e.reconcileHeights()&&(n=!0);this.reconcileQueue.clear(),n||=this.instancesChanged.size>0,n&&this.markDOMDirty(),(n||t)&&c(this.computeRenderRangeAndEmit),a.clear(),this.instancesChanged.clear()};scrollFix(e){if(e==null)return;let t=this.getScrollContainerElement(),{lineIndex:n,lineOffset:r,fileElement:i,fileOffset:a,fileTypeOffset:o}=e;if(n!=null&&r!=null){let e=i.shadowRoot?.querySelector(`[data-line][data-line-index="${n}"]`);if(e instanceof HTMLElement){let n=D(e,t);if(n!==r){let e=n-r;this.applyScrollFix(e)}return}}let s=D(i,t);if(o===`top`)s!==a&&this.applyScrollFix(s-a);else{let e=s+i.getBoundingClientRect().height;e!==a&&this.applyScrollFix(e-a)}}applyScrollFix(e){this.root==null||this.root instanceof Document?window.scrollTo({top:window.scrollY+e,behavior:`instant`}):this.root.scrollTo({top:this.root.scrollTop+e,behavior:`instant`}),this.markDOMDirty()}getScrollAnchor(e){let t=this.getScrollContainerElement(),n;for(let[r]of this.visibleInstances.entries()){let i=D(r,t),a=i+r.offsetHeight,o,s;a<=0?(o=a,s=`bottom`):(o=i,s=`top`);let c,l;if(a>0&&i<e)for(let e of r.shadowRoot?.querySelectorAll(`[data-line][data-line-index]`)??[]){if(!(e instanceof HTMLElement))continue;let n=e.dataset.lineIndex;if(n==null)continue;let r=D(e,t);if(!(r<0)){c=n,l=r;break}}if(n?.lineOffset!=null&&l==null)continue;let u=!1;(n==null||l!=null&&(n.lineOffset==null||l<n.lineOffset)||l==null&&n.lineOffset==null&&(o>=0&&(n.fileOffset<0||o<n.fileOffset)||o<0&&n.fileOffset<0&&o>n.fileOffset))&&(u=!0),u&&(n={fileElement:r,fileTypeOffset:s,fileOffset:o,lineIndex:c,lineOffset:l})}return n}handleIntersectionChange=e=>{this.scrollDirty=!0;for(let{target:t,isIntersecting:n}of e){if(!(t instanceof HTMLElement))throw Error(`Virtualizer.handleIntersectionChange: target not an HTMLElement`);let e=this.observers.get(t);e!=null&&(n&&!this.visibleInstances.has(t)?(e.setVisibility(!0),this.visibleInstances.set(t,e),this.visibleInstancesDirty=!0):!n&&this.visibleInstances.has(t)&&(e.setVisibility(!1),this.visibleInstances.delete(t),this.visibleInstancesDirty=!0))}this.visibleInstancesDirty&&c(this.computeRenderRangeAndEmit)};getScrollTop(){if(!this.scrollDirty)return this.scrollTop;this.scrollDirty=!1;let e=this.root==null?0:this.root instanceof Document?window.scrollY:this.root.scrollTop;return e=this.clampScrollTop(e),this.scrollTop=e,e}scrollTo({top:e,behavior:t=`auto`}){let{root:n}=this;if(n==null)return;let r=this.clampScrollTop(e);n instanceof Document?window.scrollTo({top:r,behavior:t}):n.scrollTo({top:r,behavior:t}),this.scrollDirty=!0,c(this.computeRenderRangeAndEmit)}clampScrollTop(e){return Math.max(0,Math.min(e,this.getScrollHeight()-this.getHeight()))}getScrollHeight(){return this.scrollHeightDirty?(this.scrollHeightDirty=!1,this.scrollHeight=this.root==null?0:this.root instanceof Document?this.root.documentElement.scrollHeight:this.root.scrollHeight,this.scrollHeight):this.scrollHeight}getHeight(){return this.heightDirty?(this.heightDirty=!1,this.height=this.root==null?0:this.root instanceof Document?globalThis.innerHeight:this.root.getBoundingClientRect().height,this.height):this.height}markDOMDirty(){this.scrollDirty=!0,this.scrollHeightDirty=!0,this.heightDirty=!0}getScrollContainerElement(){return this.root==null||this.root instanceof Document?void 0:this.root}};function D(e,t){let n=e.getBoundingClientRect(),r=t?.getBoundingClientRect().top??0;return n.top-r}var O=s.filter(e=>e!==`file`&&e!==`pull-request`);function k(e){return e===`1`||e===1||e===!0}function A(e){return e===`0`||e===0||e===!1}function j(e){if(typeof e!=`string`)return;let t=e.trim();return t.length>0?t:void 0}function M(e){return typeof e==`string`&&O.includes(e)}function N(e){let t=new Set,n=[];for(let r of e)t.has(r)||(t.add(r),n.push(r));return n}function P(e){if(Array.isArray(e))return N(e.filter(M));if(typeof e!=`string`)return[];let t=e.trim();if(t.startsWith(`[`)&&t.endsWith(`]`))try{let e=JSON.parse(t);return Array.isArray(e)?N(e.filter(M)):[]}catch{return[]}return N(t.split(`,`).map(e=>e.trim()).filter(M))}function F(e){if(k(e.canvas))return`canvas`;if(k(e.preview))return`preview`;if(k(e.diff))return`diff`}function I(e,t){let n=P(e.rightPanelTabs),r=N(t&&!n.includes(t)?[...n,t]:n),i=j(e.rightPanelTabs)!==void 0,a=k(e.rightPanelOpen),o=A(e.rightPanelOpen);return{rightPanelOpen:a?!0:!o&&i,rightPanelTabs:r,stated:a||o||i,hasExplicitTabs:i}}function L(e,t){if(t===`preview`){let t=j(e.previewTabId);return t?{previewTabId:t}:{}}if(t!==`diff`)return{};let n=j(e.diffTurnId);if(!n)return{};let r=d.make(n),i=j(e.diffFilePath);return i?{diffTurnId:r,diffFilePath:i}:{diffTurnId:r}}function R(e){let t=(M(e.rightPanel)?e.rightPanel:void 0)??F(e),n=I(e,t);return{...n.stated?{rightPanelOpen:n.rightPanelOpen}:{},...t?{rightPanel:t}:{},...n.hasExplicitTabs&&n.rightPanelTabs.length>0?{rightPanelTabs:n.rightPanelTabs}:{},...L(e,t)}}function z(e){let t=(0,v.c)(6),n;bb0:{if(!e){let e;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(e=[],t[0]=e):e=t[0],n=e;break bb0}n=e.turnDiffSummaries}let r=n,i,a;t[1]===r?a=t[2]:(a=l(r),t[1]=r,t[2]=a),i=a;let o=i,s;return t[3]!==o||t[4]!==r?(s={turnDiffSummaries:r,inferredCheckpointTurnCountByTurnId:o},t[3]=o,t[4]=r,t[5]=s):s=t[5],s}function B(e,t){return typeof window>`u`&&t!=null?(0,_.jsxs)(_.Fragment,{children:[(0,_.jsx)(`template`,{shadowrootmode:`open`,dangerouslySetInnerHTML:{__html:t}}),e]}):(0,_.jsx)(_.Fragment,{children:e})}var V=e(r(),1),H=(0,V.createContext)(void 0);function U({children:e,config:t,className:n,style:r,contentClassName:i,contentStyle:a}){let[o]=(0,V.useState)(()=>typeof window<`u`?new E(t):void 0),s=(0,V.useCallback)(e=>{e==null?o?.cleanUp():o?.setup(e)},[o]);return(0,_.jsx)(H.Provider,{value:o,children:(0,_.jsx)(`div`,{className:n,style:r,ref:s,children:(0,_.jsx)(`div`,{className:i,style:a,children:e})})})}function W(){return(0,V.useContext)(H)}export{R as a,m as c,z as i,p as l,W as n,h as o,B as r,g as s,U as t,f as u};
|
|
2
|
-
//# sourceMappingURL=Virtualizer-DWobWo_j.js.map
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{on as e}from"./CompositeItem-BxPZ_9BJ.js";import{o as t}from"./debouncer-BmyJL8Gi.js";var n=e(`arrow-down`,[[`path`,{d:`M12 5v14`,key:`s699le`}],[`path`,{d:`m19 12-7 7-7-7`,key:`1idqje`}]]),r=e(`arrow-up`,[[`path`,{d:`m5 12 7-7 7 7`,key:`hav0vg`}],[`path`,{d:`M12 19V5`,key:`x0mq9r`}]]),i=e(`chevrons-down`,[[`path`,{d:`m7 6 5 5 5-5`,key:`1lc07p`}],[`path`,{d:`m7 13 5 5 5-5`,key:`1d48rs`}]]),a=e(`chevrons-up`,[[`path`,{d:`m17 11-5-5-5 5`,key:`e8nh98`}],[`path`,{d:`m17 18-5-5-5 5`,key:`2avn1x`}]]),o=e(`circle`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}]]),s=e(`download`,[[`path`,{d:`M12 15V3`,key:`m9g1x1`}],[`path`,{d:`M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4`,key:`ih7n3h`}],[`path`,{d:`m7 10 5 5 5-5`,key:`brsn70`}]]),c=e(`eye-off`,[[`path`,{d:`M10.733 5.076a10.744 10.744 0 0 1 11.205 6.575 1 1 0 0 1 0 .696 10.747 10.747 0 0 1-1.444 2.49`,key:`ct8e1f`}],[`path`,{d:`M14.084 14.158a3 3 0 0 1-4.242-4.242`,key:`151rxh`}],[`path`,{d:`M17.479 17.499a10.75 10.75 0 0 1-15.417-5.151 1 1 0 0 1 0-.696 10.75 10.75 0 0 1 4.446-5.143`,key:`13bj9a`}],[`path`,{d:`m2 2 20 20`,key:`1ooewy`}]]),l=e(`eye`,[[`path`,{d:`M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0`,key:`1nclc0`}],[`circle`,{cx:`12`,cy:`12`,r:`3`,key:`1v7zrd`}]]),u=e(`file-text`,[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,key:`1oefj6`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`path`,{d:`M10 9H8`,key:`b1mrlr`}],[`path`,{d:`M16 13H8`,key:`t4e002`}],[`path`,{d:`M16 17H8`,key:`z1uh3a`}]]),d=e(`minus`,[[`path`,{d:`M5 12h14`,key:`1ays0h`}]]),f=e(`mouse-pointer-2`,[[`path`,{d:`M4.037 4.688a.495.495 0 0 1 .651-.651l16 6.5a.5.5 0 0 1-.063.947l-6.124 1.58a2 2 0 0 0-1.438 1.435l-1.579 6.126a.5.5 0 0 1-.947.063z`,key:`edeuup`}]]),p=e(`palette`,[[`path`,{d:`M12 22a1 1 0 0 1 0-20 10 9 0 0 1 10 9 5 5 0 0 1-5 5h-2.25a1.75 1.75 0 0 0-1.4 2.8l.3.4a1.75 1.75 0 0 1-1.4 2.8z`,key:`e79jfc`}],[`circle`,{cx:`13.5`,cy:`6.5`,r:`.5`,fill:`currentColor`,key:`1okk4w`}],[`circle`,{cx:`17.5`,cy:`10.5`,r:`.5`,fill:`currentColor`,key:`f64h9f`}],[`circle`,{cx:`6.5`,cy:`12.5`,r:`.5`,fill:`currentColor`,key:`qy21gx`}],[`circle`,{cx:`8.5`,cy:`7.5`,r:`.5`,fill:`currentColor`,key:`fotxhn`}]]),m=e(`save`,[[`path`,{d:`M15.2 3a2 2 0 0 1 1.4.6l3.8 3.8a2 2 0 0 1 .6 1.4V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2z`,key:`1c8476`}],[`path`,{d:`M17 21v-7a1 1 0 0 0-1-1H8a1 1 0 0 0-1 1v7`,key:`1ydtos`}],[`path`,{d:`M7 3v4a1 1 0 0 0 1 1h7`,key:`t51u73`}]]),h=e(`square`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}]]),g=e(`undo-2`,[[`path`,{d:`M9 14 4 9l5-5`,key:`102s5s`}],[`path`,{d:`M4 9h10.5a5.5 5.5 0 0 1 5.5 5.5a5.5 5.5 0 0 1-5.5 5.5H11`,key:`f3b9sd`}]]),_={primaryColor:`#6366f1`,secondaryColor:`#8b5cf6`,accentColor:`#f59e0b`,backgroundColor:`#ffffff`,textColor:`#1f2937`,fontFamily:`Inter, sans-serif`,headingFontFamily:`Inter, sans-serif`},v={bold:{bg:`#1f2937`,accent:`#f59e0b`,text:`#ffffff`},minimal:{bg:`#ffffff`,accent:`#6366f1`,text:`#1f2937`},gradient:{bg:`#4f46e5`,accent:`#818cf8`,text:`#ffffff`},split:{bg:`#f8fafc`,accent:`#0ea5e9`,text:`#0f172a`},centered:{bg:`#fef3c7`,accent:`#d97706`,text:`#78350f`}},y=[`bold`,`minimal`,`gradient`,`split`,`centered`];function b(e){let t=e.toLowerCase();return t.includes(`bold`)||t.includes(`sale`)||t.includes(`announcement`)?`bold`:t.includes(`minimal`)||t.includes(`clean`)||t.includes(`simple`)?`minimal`:t.includes(`gradient`)||t.includes(`modern`)||t.includes(`tech`)?`gradient`:t.includes(`split`)||t.includes(`compare`)||t.includes(`versus`)?`split`:t.includes(`warm`)||t.includes(`friendly`)||t.includes(`welcome`)?`centered`:y[Math.floor(Math.random()*y.length)]??`bold`}function x(e){let t=e.replace(/^(create|make|design|generate)\s+(a|an|me)?\s*/i,``).replace(/\s*(instagram|facebook|twitter|linkedin|youtube|social media|post|story|banner|cover|thumbnail)\s*/gi,``).replace(/\s*(about|for|with|featuring)\s*/i,`|`).trim().split(`|`).map(e=>e.trim()).filter(Boolean),n=t[0]??``;if(t.length>=2)return{heading:S(n),subtext:S(t.slice(1).join(` `))};if(n.length>30){let e=n.split(` `),t=Math.ceil(e.length/2);return{heading:S(e.slice(0,t).join(` `)),subtext:S(e.slice(t).join(` `))}}return{heading:n?S(n):`Your Title Here`,subtext:`Add your message`}}function S(e){return e.charAt(0).toUpperCase()+e.slice(1)}function C(e,t,n,r=_){let i=b(e),a=v[i],{heading:o,subtext:s}=x(e),c=t>n;Math.abs(t-n);let l=[];switch(l.push({type:`rect`,left:0,top:0,width:t,height:n,fill:a.bg,selectable:!1,customId:`__bg__`,customName:`Background`}),i){case`bold`:l.push(...w(t,n,a,o,s,r));break;case`minimal`:l.push(...T(t,n,a,o,s,r));break;case`gradient`:l.push(...E(t,n,a,o,s,r));break;case`split`:l.push(...D(t,n,a,o,s,c,r));break;case`centered`:l.push(...O(t,n,a,o,s,r))}return{objects:l}}function w(e,t,n,r,i,a){let o=Math.min(e,t)*.08,s=Math.min(e,t)*.1,c=s*.4;return[{type:`rect`,left:0,top:0,width:e,height:t*.06,fill:n.accent,customName:`Accent Bar`},{type:`textbox`,left:o,top:t*.3,width:e-o*2,text:r.toUpperCase(),fontSize:s,fontFamily:a.headingFontFamily,fontWeight:`900`,fill:n.text,textAlign:`left`,customName:`Heading`},{type:`textbox`,left:o,top:t*.55,width:e-o*2,text:i,fontSize:c,fontFamily:a.fontFamily,fontWeight:`400`,fill:n.accent,textAlign:`left`,customName:`Subtext`},{type:`rect`,left:o,top:t*.85,width:e*.3,height:4,fill:n.accent,customName:`Accent Line`}]}function T(e,t,n,r,i,a){let o=Math.min(e,t)*.08,s=o*.45;return[{type:`rect`,left:e*.04,top:t*.04,width:e*.92,height:t*.92,fill:`transparent`,stroke:n.accent,strokeWidth:2,customName:`Frame`},{type:`textbox`,left:e*.1,top:t*.35,width:e*.8,text:r,fontSize:o,fontFamily:a.headingFontFamily,fontWeight:`600`,fill:n.text,textAlign:`center`,customName:`Heading`},{type:`rect`,left:e*.4,top:t*.52,width:e*.2,height:2,fill:n.accent,customName:`Divider`},{type:`textbox`,left:e*.15,top:t*.58,width:e*.7,text:i,fontSize:s,fontFamily:a.fontFamily,fontWeight:`400`,fill:`#6b7280`,textAlign:`center`,customName:`Subtext`}]}function E(e,t,n,r,i,a){let o=Math.min(e,t)*.09,s=o*.4;return[{type:`rect`,left:0,top:t*.6,width:e,height:t*.4,fill:`rgba(0,0,0,0.3)`,customName:`Overlay`},{type:`ellipse`,left:e*.7,top:-t*.15,rx:e*.25,ry:e*.25,fill:n.accent,opacity:.3,customName:`Deco Circle`},{type:`textbox`,left:e*.08,top:t*.35,width:e*.84,text:r,fontSize:o,fontFamily:a.headingFontFamily,fontWeight:`700`,fill:n.text,textAlign:`center`,customName:`Heading`},{type:`textbox`,left:e*.12,top:t*.65,width:e*.76,text:i,fontSize:s,fontFamily:a.fontFamily,fontWeight:`400`,fill:`rgba(255,255,255,0.85)`,textAlign:`center`,customName:`Subtext`}]}function D(e,t,n,r,i,a,o){let s=Math.min(e,t)*.08,c=s*.45;return a?[{type:`rect`,left:0,top:0,width:e*.45,height:t,fill:n.accent,customName:`Color Panel`},{type:`textbox`,left:e*.52,top:t*.3,width:e*.42,text:r,fontSize:s,fontFamily:o.headingFontFamily,fontWeight:`700`,fill:n.text,textAlign:`left`,customName:`Heading`},{type:`textbox`,left:e*.52,top:t*.55,width:e*.42,text:i,fontSize:c,fontFamily:o.fontFamily,fontWeight:`400`,fill:`#64748b`,textAlign:`left`,customName:`Subtext`}]:[{type:`rect`,left:0,top:0,width:e,height:t*.45,fill:n.accent,customName:`Color Panel`},{type:`textbox`,left:e*.08,top:t*.52,width:e*.84,text:r,fontSize:s,fontFamily:o.headingFontFamily,fontWeight:`700`,fill:n.text,textAlign:`center`,customName:`Heading`},{type:`textbox`,left:e*.12,top:t*.72,width:e*.76,text:i,fontSize:c,fontFamily:o.fontFamily,fontWeight:`400`,fill:`#64748b`,textAlign:`center`,customName:`Subtext`}]}function O(e,t,n,r,i,a){let o=Math.min(e,t)*.09,s=o*.4;return[{type:`rect`,left:e*.1,top:t*.15,width:e*.8,height:t*.7,fill:`rgba(255,255,255,0.7)`,rx:20,ry:20,customName:`Card`},{type:`textbox`,left:e*.15,top:t*.3,width:e*.7,text:r,fontSize:o,fontFamily:a.headingFontFamily,fontWeight:`700`,fill:n.text,textAlign:`center`,customName:`Heading`},{type:`textbox`,left:e*.18,top:t*.55,width:e*.64,text:i,fontSize:s,fontFamily:a.fontFamily,fontWeight:`400`,fill:n.text,textAlign:`center`,opacity:.7,customName:`Subtext`},{type:`rect`,left:e*.3,top:t*.72,width:e*.4,height:Math.min(e,t)*.07,fill:n.accent,rx:8,ry:8,customName:`CTA Button`},{type:`textbox`,left:e*.3,top:t*.725,width:e*.4,text:`Learn More`,fontSize:s*.9,fontFamily:a.fontFamily,fontWeight:`600`,fill:`#ffffff`,textAlign:`center`,customName:`CTA Text`}]}var k=[{id:`ig-post-bold`,name:`Bold Announcement`,category:`social`,presetId:`instagram-post`,style:`bold`,description:`High-impact Instagram post with bold typography`,previewPrompt:`New Product Launch`},{id:`ig-post-minimal`,name:`Clean & Minimal`,category:`social`,presetId:`instagram-post`,style:`minimal`,description:`Minimalist Instagram post with elegant framing`,previewPrompt:`Mindful Living`},{id:`ig-story-gradient`,name:`Gradient Story`,category:`social`,presetId:`instagram-story`,style:`gradient`,description:`Modern gradient Instagram story`,previewPrompt:`Summer Vibes`},{id:`fb-cover-split`,name:`Split Cover`,category:`social`,presetId:`facebook-cover`,style:`split`,description:`Two-tone Facebook cover photo`,previewPrompt:`Welcome to Our Community`},{id:`linkedin-minimal`,name:`Professional Banner`,category:`business`,presetId:`linkedin-banner`,style:`minimal`,description:`Clean LinkedIn banner for professionals`,previewPrompt:`Innovation & Strategy`},{id:`twitter-bold`,name:`Tweet Graphic`,category:`social`,presetId:`twitter-post`,style:`bold`,description:`Eye-catching Twitter/X post graphic`,previewPrompt:`Breaking News`},{id:`yt-gradient`,name:`YouTube Thumbnail`,category:`social`,presetId:`youtube-thumbnail`,style:`gradient`,description:`Vibrant YouTube thumbnail`,previewPrompt:`Top 10 Tips`},{id:`presentation-centered`,name:`Title Slide`,category:`presentation`,presetId:`presentation`,style:`centered`,description:`Warm presentation title slide`,previewPrompt:`Quarterly Review`},{id:`bcard-minimal`,name:`Business Card`,category:`business`,presetId:`business-card`,style:`minimal`,description:`Elegant business card layout`,previewPrompt:`Jane Smith | Designer`},{id:`invoice-split`,name:`Invoice Header`,category:`business`,presetId:`invoice`,style:`split`,description:`Professional invoice header layout`,previewPrompt:`Invoice #1234`},{id:`sale-bold`,name:`Flash Sale`,category:`marketing`,presetId:`instagram-post`,style:`bold`,description:`High-energy sale promotion post`,previewPrompt:`50% Off Everything`},{id:`launch-gradient`,name:`Product Launch`,category:`marketing`,presetId:`instagram-post`,style:`gradient`,description:`Modern product launch announcement`,previewPrompt:`Introducing Our New Product`}];function A(){let e=new Map;for(let t of k){let n=e.get(t.category)??[];n.push(t),e.set(t.category,n)}return e}var j=`forge:canvas-state:v1`;function M(){if(typeof window>`u`)return{};try{let e=localStorage.getItem(j);if(!e)return{};let t=JSON.parse(e),n={savedDesigns:t.savedDesigns??{},artboardPresetId:t.artboardPresetId??null,activeTool:t.activeTool??`select`};return t.brandKit&&(n.brandKit=t.brandKit),n}catch{return{}}}function N(e){if(!(typeof window>`u`))try{let t={savedDesigns:e.savedDesigns,artboardPresetId:e.artboardPresetId,activeTool:e.activeTool,brandKit:e.brandKit};localStorage.setItem(j,JSON.stringify(t))}catch{}}var P=M(),F={activeTool:P.activeTool??`select`,artboardPresetId:P.artboardPresetId??`instagram-post`,artboardWidth:1080,artboardHeight:1080,selectedObjectIds:[],selectedObjectProperties:null,propertiesPanelOpen:!1,historyStack:[],historyIndex:-1,layers:[],zoomLevel:1,savedDesigns:P.savedDesigns??{},brandKit:P.brandKit??_,pendingGeneratePrompt:null},I=t()((e,t)=>({...F,setActiveTool:n=>{e({activeTool:n}),N(t())},setArtboard:(n,r,i)=>{e({artboardPresetId:n,artboardWidth:r,artboardHeight:i}),N(t())},setSelectedObjects:(t,n)=>{e({selectedObjectIds:t,selectedObjectProperties:n,propertiesPanelOpen:t.length>0})},clearSelection:()=>{e({selectedObjectIds:[],selectedObjectProperties:null})},setPropertiesPanelOpen:t=>{e({propertiesPanelOpen:t})},pushHistorySnapshot:t=>{e(e=>{let n=[...e.historyStack.slice(0,e.historyIndex+1),t].slice(-50);return{historyStack:n,historyIndex:n.length-1}})},undo:()=>{let n=t();if(n.historyIndex<=0)return null;let r=n.historyIndex-1;return e({historyIndex:r}),n.historyStack[r]??null},redo:()=>{let n=t();if(n.historyIndex>=n.historyStack.length-1)return null;let r=n.historyIndex+1;return e({historyIndex:r}),n.historyStack[r]??null},setLayers:t=>{e({layers:t})},setZoomLevel:t=>{e({zoomLevel:t})},saveDesign:(n,r,i)=>{e(e=>({savedDesigns:{...e.savedDesigns,[n]:{json:i,name:r,updatedAt:new Date().toISOString()}}})),N(t())},loadDesign:e=>t().savedDesigns[e]?.json??null,deleteDesign:n=>{e(e=>{let{[n]:t,...r}=e.savedDesigns;return{savedDesigns:r}}),N(t())},resetHistory:()=>{e({historyStack:[],historyIndex:-1})},setBrandKit:n=>{e({brandKit:n}),N(t())},updateBrandKit:n=>{e(e=>({brandKit:{...e.brandKit,...n}})),N(t())},requestCanvasGenerate:t=>{e({pendingGeneratePrompt:t})},consumePendingGenerate:()=>{let n=t().pendingGeneratePrompt;return n&&e({pendingGeneratePrompt:null}),n}}));export{a as _,A as a,n as b,m as c,d,u as f,o as g,s as h,C as i,p as l,c as m,k as n,g as o,l as p,_ as r,h as s,I as t,f as u,i as v,r as y};
|
|
2
|
-
//# sourceMappingURL=canvasStateStore-DKtQcBVc.js.map
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-hePW80VL.js";import{Wa as t}from"./Stream-mUTFnSY9.js";var n=e(t(),1),r=e=>{let t,n=new Set,r=(e,r)=>{let i=typeof e==`function`?e(t):e;if(!Object.is(i,t)){let e=t;t=r??(typeof i!=`object`||!i)?i:Object.assign({},t,i),n.forEach(n=>n(t,e))}},i=()=>t,a={setState:r,getState:i,getInitialState:()=>o,subscribe:e=>(n.add(e),()=>n.delete(e))},o=t=e(r,i,a);return a},i=(e=>e?r(e):r),a=e=>e;function o(e,t=a){let r=n.useSyncExternalStore(e.subscribe,n.useCallback(()=>t(e.getState()),[e,t]),n.useCallback(()=>t(e.getInitialState()),[e,t]));return n.useDebugValue(r),r}var s=e=>{let t=i(e),n=e=>o(t,e);return Object.assign(n,t),n},c=(e=>e?s(e):s);function l(e){return typeof e==`function`}function u(e,...t){return l(e)?e(...t):e}function d({update:e,notify:t,unwatched:n}){return{link:r,unlink:i,propagate:a,checkDirty:o,shallowPropagate:s};function r(e,t,n){let r=t.depsTail;if(r!==void 0&&r.dep===e)return;let i=r===void 0?t.deps:r.nextDep;if(i!==void 0&&i.dep===e){i.version=n,t.depsTail=i;return}let a=e.subsTail;if(a!==void 0&&a.version===n&&a.sub===t)return;let o=t.depsTail=e.subsTail={version:n,dep:e,sub:t,prevDep:r,nextDep:i,prevSub:a,nextSub:void 0};i!==void 0&&(i.prevDep=o),r===void 0?t.deps=o:r.nextDep=o,a===void 0?e.subs=o:a.nextSub=o}function i(e,t=e.sub){let r=e.dep,i=e.prevDep,a=e.nextDep,o=e.nextSub,s=e.prevSub;return a===void 0?t.depsTail=i:a.prevDep=i,i===void 0?t.deps=a:i.nextDep=a,o===void 0?r.subsTail=s:o.prevSub=s,s===void 0?(r.subs=o)===void 0&&n(r):s.nextSub=o,a}function a(e){let n=e.nextSub,r;top:do{let i=e.sub,a=i.flags;if(a&60?a&12?a&4?!(a&48)&&c(e,i)?(i.flags=a|40,a&=1):a=0:i.flags=a&-9|32:a=0:i.flags=a|32,a&2&&t(i),a&1){let t=i.subs;if(t!==void 0){let i=(e=t).nextSub;i!==void 0&&(r={value:n,prev:r},n=i);continue}}if((e=n)!==void 0){n=e.nextSub;continue}for(;r!==void 0;)if(e=r.value,r=r.prev,e!==void 0){n=e.nextSub;continue top}break}while(!0)}function o(t,n){let r,i=0,a=!1;top:do{let o=t.dep,c=o.flags;if(n.flags&16)a=!0;else if((c&17)==17){if(e(o)){let e=o.subs;e.nextSub!==void 0&&s(e),a=!0}}else if((c&33)==33){(t.nextSub!==void 0||t.prevSub!==void 0)&&(r={value:t,prev:r}),t=o.deps,n=o,++i;continue}if(!a){let e=t.nextDep;if(e!==void 0){t=e;continue}}for(;i--;){let i=n.subs,o=i.nextSub!==void 0;if(o?(t=r.value,r=r.prev):t=i,a){if(e(n)){o&&s(i),n=t.sub;continue}a=!1}else n.flags&=-33;n=t.sub;let c=t.nextDep;if(c!==void 0){t=c;continue top}}return a}while(!0)}function s(e){do{let n=e.sub,r=n.flags;(r&48)==32&&(n.flags=r|16,(r&6)==2&&t(n))}while((e=e.nextSub)!==void 0)}function c(e,t){let n=t.depsTail;for(;n!==void 0;){if(n===e)return!0;n=n.prevDep}return!1}}function f(e,t,n){let r=typeof e==`object`,i=r?e:void 0;return{next:(r?e.next:e)?.bind(i),error:(r?e.error:t)?.bind(i),complete:(r?e.complete:n)?.bind(i)}}var p=[],m=0,{link:h,unlink:g,propagate:_,checkDirty:v,shallowPropagate:y}=d({update(e){return e._update()},notify(e){p[x++]=e,e.flags&=-3},unwatched(e){e.depsTail!==void 0&&(e.depsTail=void 0,e.flags=17,w(e))}}),b=0,x=0,S,C=0;function w(e){let t=e.depsTail,n=t===void 0?e.deps:t.nextDep;for(;n!==void 0;)n=g(n,e)}function T(){if(!(C>0)){for(;b<x;){let e=p[b];p[b++]=void 0,e.notify()}b=0,x=0}}function E(e,t){let n=typeof e==`function`,r=e,i={_snapshot:n?void 0:e,subs:void 0,subsTail:void 0,deps:void 0,depsTail:void 0,flags:+!n,get(){return S!==void 0&&h(i,S,m),i._snapshot},subscribe(e){let t=f(e),n={current:!1},r=D(()=>{i.get(),n.current?t.next?.(i._snapshot):n.current=!0});return{unsubscribe:()=>{r.stop()}}},_update(e){let a=S,o=t?.compare??Object.is;if(n)S=i,++m,i.depsTail=void 0;else if(e===void 0)return!1;n&&(i.flags=5);try{let t=i._snapshot,a=typeof e==`function`?e(t):e===void 0&&n?r(t):e;return t===void 0||!o(t,a)?(i._snapshot=a,!0):!1}finally{S=a,n&&(i.flags&=-5),w(i)}}};return n?(i.flags=17,i.get=function(){let e=i.flags;if(e&16||e&32&&v(i.deps,i)){if(i._update()){let e=i.subs;e!==void 0&&y(e)}}else e&32&&(i.flags=e&-33);return S!==void 0&&h(i,S,m),i._snapshot}):i.set=function(e){if(i._update(e)){let e=i.subs;e!==void 0&&(_(e),y(e),T())}},i}function D(e){let t=()=>{let t=S;S=n,++m,n.depsTail=void 0,n.flags=6;try{return e()}finally{S=t,n.flags&=-5,w(n)}},n={deps:void 0,depsTail:void 0,subs:void 0,subsTail:void 0,flags:6,notify(){let e=this.flags;e&16||e&32&&v(this.deps,this)?t():this.flags=2},stop(){this.flags=0,this.depsTail=void 0,w(this)}};return t(),n}var O=class{constructor(e,t){this.atom=E(e),this.get=this.get.bind(this),this.setState=this.setState.bind(this),this.subscribe=this.subscribe.bind(this),t&&(this.actions=t(this))}setState(e){this.atom.set(e)}get state(){return this.atom.get()}get(){return this.state}subscribe(e){return this.atom.subscribe(f(e))}},k=class{#e;constructor({pluginId:e}){this.#e=e}getPluginId(){return this.#e}createEventPayload(e,t){return{type:`${this.#e}:${e}`,payload:t,pluginId:this.#e}}emit(e,t){}on(e,t,n){return()=>{}}onAll(e){return()=>{}}onAllPluginEvents(e){return()=>{}}},A=new Map;function j(e,t){A.set(e,t)}function M(e){if(e!==void 0)try{return JSON.parse(JSON.stringify(e))}catch{return null}}function N(e){return typeof e.get==`function`?e.get():e.state}function P(e){return{key:e.key,store:{state:M(N(e.store))},options:M(e.options)}}var F=class extends k{constructor(e){super({pluginId:`pacer`,debug:e?.debug,reconnectEveryMs:1e3})}},I=(e,t)=>{let n=t.key;n&&(j(n,t),L.emit(e,P({...t,key:n})))},L=new F;function R(){return{canLeadingExecute:!0,executionCount:0,isPending:!1,lastArgs:void 0,status:`idle`,maybeExecuteCount:0}}var z={enabled:!0,leading:!1,trailing:!0,wait:0},B=class{#e;constructor(e,t){this.fn=e,this.store=new O(R()),this.setOptions=e=>{this.options={...this.options,...e},this.#n()||this.cancel()},this.#t=e=>{this.store.setState(t=>{let n={...t,...e},{isPending:r}=n;return{...n,status:this.#n()?r?`pending`:`idle`:`disabled`}}),I(`Debouncer`,this)},this.#n=()=>!!u(this.options.enabled,this),this.#r=()=>u(this.options.wait,this),this.maybeExecute=(...e)=>{if(!this.#n())return;this.#t({maybeExecuteCount:this.store.state.maybeExecuteCount+1});let t=!1;this.options.leading&&this.store.state.canLeadingExecute&&(this.#t({canLeadingExecute:!1}),t=!0,this.#i(...e)),this.options.trailing&&this.#t({isPending:!0,lastArgs:e}),this.#e&&clearTimeout(this.#e),this.#e=setTimeout(()=>{this.#t({canLeadingExecute:!0}),this.options.trailing&&!t&&this.#i(...e)},this.#r())},this.#i=(...e)=>{this.#n()&&(this.fn(...e),this.#t({executionCount:this.store.state.executionCount+1,isPending:!1,lastArgs:void 0}),this.options.onExecute?.(e,this))},this.flush=()=>{this.store.state.isPending&&this.store.state.lastArgs&&(this.#a(),this.#i(...this.store.state.lastArgs))},this.#a=()=>{this.#e&&=(clearTimeout(this.#e),void 0)},this.cancel=()=>{this.#a(),this.#t({canLeadingExecute:!0,isPending:!1})},this.reset=()=>{this.#t(R())},this.key=t.key,this.options={...z,...t},this.#t(this.options.initialState??{}),this.key&&L.on(`d-Debouncer`,e=>{e.payload.key===this.key&&(this.#t(e.payload.store.state),this.setOptions(e.payload.options))})}#t;#n;#r;#i;#a};export{u as a,i as c,O as i,I as n,c as o,L as r,o as s,B as t};
|
|
2
|
-
//# sourceMappingURL=debouncer-BmyJL8Gi.js.map
|