diff --git a/viewer-ui/dist/assets/index-BSV4RY-E.js b/viewer-ui/dist/assets/index-Bxl3aB0i.js similarity index 91% rename from viewer-ui/dist/assets/index-BSV4RY-E.js rename to viewer-ui/dist/assets/index-Bxl3aB0i.js index 813e6f4a..cff2c6cf 100644 --- a/viewer-ui/dist/assets/index-BSV4RY-E.js +++ b/viewer-ui/dist/assets/index-Bxl3aB0i.js @@ -7,5 +7,5 @@ import{n as e,t}from"./jsx-runtime-EIAPxkjE.js";import{t as n}from"./react-BPk_w `+c[r].replace(` at new `,` at `);return e.displayName&&u.includes(``)&&(u=u.replace(``,e.displayName)),u}while(1<=r&&0<=i);break}}}finally{Le=!1,Error.prepareStackTrace=n}return(n=e?e.displayName||e.name:``)?Ie(n):``}function ze(e,t){switch(e.tag){case 26:case 27:case 5:return Ie(e.type);case 16:return Ie(`Lazy`);case 13:return e.child!==t&&t!==null?Ie(`Suspense Fallback`):Ie(`Suspense`);case 19:return Ie(`SuspenseList`);case 0:case 15:return Re(e.type,!1);case 11:return Re(e.type.render,!1);case 1:return Re(e.type,!0);case 31:return Ie(`Activity`);case 30:return Ie(`ViewTransition`);default:return``}}function Be(e){try{var t=``,n=null;do t+=ze(e,n),n=e,e=e.return;while(e);return t}catch(e){return` Error generating stack: `+e.message+` `+e.stack}}var Ve=Object.prototype.hasOwnProperty,He=t.unstable_scheduleCallback,Ue=t.unstable_cancelCallback,We=t.unstable_shouldYield,Ge=t.unstable_requestPaint,Ke=t.unstable_now,qe=t.unstable_getCurrentPriorityLevel,Je=t.unstable_ImmediatePriority,Ye=t.unstable_UserBlockingPriority,Xe=t.unstable_NormalPriority,Ze=t.unstable_LowPriority,Qe=t.unstable_IdlePriority,$e=t.log,et=t.unstable_setDisableYieldValue,tt=null,nt=null;function rt(e){if(typeof $e==`function`&&et(e),nt&&typeof nt.setStrictMode==`function`)try{nt.setStrictMode(tt,e)}catch{}}var it=Math.clz32?Math.clz32:st,at=Math.log,ot=Math.LN2;function st(e){return e>>>=0,e===0?32:31-(at(e)/ot|0)|0}var ct=256,lt=262144,ut=4194304;function dt(e){var t=e&42;if(t!==0)return t;switch(e&-e){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:return 64;case 128:return 128;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:return e&-e;case 262144:case 524288:case 1048576:case 2097152:return e&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return e&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return e}}function ft(e,t,n){var r=e.pendingLanes;if(r===0)return 0;var i=0,a=e.suspendedLanes,o=e.pingedLanes;e=e.warmLanes;var s=r&134217727;return s===0?(s=r&~a,s===0?o===0?n||(n=r&~e,n!==0&&(i=dt(n))):i=dt(o):i=dt(s)):(r=s&~a,r===0?(o&=s,o===0?n||(n=s&~e,n!==0&&(i=dt(n))):i=dt(o)):i=dt(r)),i===0?0:t!==0&&t!==i&&(t&a)===0&&(a=i&-i,n=t&-t,a>=n||a===32&&n&4194048)?t:i}function pt(e,t){return(e.pendingLanes&~(e.suspendedLanes&~e.pingedLanes)&t)===0}function mt(e,t){t&8&&(t|=t&32);var n=e.entangledLanes;if(n!==0)for(e=e.entanglements,n&=t;0n;n++)t.push(e);return t}function vt(e,t){e.pendingLanes|=t,t!==268435456&&(e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0)}function yt(e,t,n,r,i,a){var o=e.pendingLanes;e.pendingLanes=n,e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0,e.expiredLanes&=n,e.entangledLanes&=n,e.errorRecoveryDisabledLanes&=n,e.shellSuspendCounter=0;var s=e.entanglements,c=e.expirationTimes,l=e.hiddenUpdates;for(n=o&~n;0=vr),xr=` `,Sr=!1;function Cr(e,t){switch(e){case`keyup`:return gr.indexOf(t.keyCode)!==-1;case`keydown`:return t.keyCode!==229;case`keypress`:case`mousedown`:case`focusout`:return!0;default:return!1}}function wr(e){return e=e.detail,typeof e==`object`&&`data`in e?e.data:null}var Tr=!1;function Er(e,t){switch(e){case`compositionend`:return wr(t);case`keypress`:return t.which===32?(Sr=!0,xr):null;case`textInput`:return e=t.data,e===xr&&Sr?null:e;default:return null}}function Dr(e,t){if(Tr)return e===`compositionend`||!_r&&Cr(e,t)?(e=zn(),Rn=Ln=In=null,Tr=!1,e):null;switch(e){case`paste`:return null;case`keypress`:if(!(t.ctrlKey||t.altKey||t.metaKey)||t.ctrlKey&&t.altKey){if(t.char&&1=t)return{node:n,offset:t-e};e=r}a:{for(;n;){if(n.nextSibling){n=n.nextSibling;break a}n=n.parentNode}n=void 0}n=Xr(n)}}function Qr(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?Qr(e,t.parentNode):`contains`in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function $r(e){e=e!=null&&e.ownerDocument!=null&&e.ownerDocument.defaultView!=null?e.ownerDocument.defaultView:window;for(var t=Yr(e.document);t instanceof e.HTMLIFrameElement;){try{var n=typeof t.contentWindow.location.href==`string`}catch{n=!1}if(n)e=t.contentWindow;else break;t=Yr(e.document)}return t}function ei(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t&&(t===`input`&&(e.type===`text`||e.type===`search`||e.type===`tel`||e.type===`url`||e.type===`password`)||t===`textarea`||e.contentEditable===`true`)}var ti=Nn&&`documentMode`in document&&11>=document.documentMode,ni=null,ri=null,ii=null,ai=!1;function oi(e,t,n){var r=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;ai||ni==null||ni!==Yr(r)||(r=ni,`selectionStart`in r&&ei(r)?r={start:r.selectionStart,end:r.selectionEnd}:(r=(r.ownerDocument&&r.ownerDocument.defaultView||window).getSelection(),r={anchorNode:r.anchorNode,anchorOffset:r.anchorOffset,focusNode:r.focusNode,focusOffset:r.focusOffset}),ii&&Jr(ii,r)||(ii=r,r=Jf(ri,`onSelect`),0>=o,i-=o,na=1<<32-it(t)+i|n<h?(g=d,d=null):g=d.sibling;var _=p(i,d,s[h],c);if(_===null){d===null&&(d=g);break}e&&d&&_.alternate===null&&t(i,d),a=o(_,a,h),u===null?l=_:u.sibling=_,u=_,d=g}if(h===s.length)return n(i,d),F&&ia(i,h),l;if(d===null){for(;hg?(_=h,h=null):_=h.sibling;var y=p(i,h,v.value,l);if(y===null){h===null&&(h=_);break}e&&h&&y.alternate===null&&t(i,h),s=o(y,s,g),d===null?u=y:d.sibling=y,d=y,h=_}if(v.done)return n(i,h),F&&ia(i,g),u;if(h===null){for(;!v.done;g++,v=c.next())v=f(i,v.value,l),v!==null&&(s=o(v,s,g),d===null?u=v:d.sibling=v,d=v);return F&&ia(i,g),u}for(h=r(h);!v.done;g++,v=c.next())v=m(h,i,g,v.value,l),v!==null&&(e&&(_=v.alternate,_!==null&&h.delete(_.key===null?g:_.key)),s=o(v,s,g),d===null?u=v:d.sibling=v,d=v);return e&&h.forEach(function(e){return t(i,e)}),F&&ia(i,g),u}function _(e,r,o,c){if(typeof o==`object`&&o&&o.type===re&&o.key===null&&o.props.ref===void 0&&(o=o.props.children),typeof o==`object`&&o){switch(o.$$typeof){case te:a:{for(var l=o.key;r!==null;){if(r.key===l){if(l=o.type,l===re){if(r.tag===7){n(e,r.sibling),c=i(r,o.props.children),po(c,o),c.return=e,e=c;break a}}else if(r.elementType===l||typeof l==`object`&&l&&l.$$typeof===de&&ao(l)===r.type){n(e,r.sibling),c=i(r,o.props),po(c,o),c.return=e,e=c;break a}n(e,r);break}t(e,r),r=r.sibling}o.type===re?(c=Ui(o.props.children,e.mode,c,o.key),po(c,o),c.return=e,e=c):(c=Hi(o.type,o.key,o.props,null,e.mode,c),po(c,o),c.return=e,e=c)}return s(e);case ne:a:{for(l=o.key;r!==null;){if(r.key===l){if(r.tag===4&&r.stateNode.containerInfo===o.containerInfo&&r.stateNode.implementation===o.implementation){n(e,r.sibling),c=i(r,o.children||[]),c.return=e,e=c;break a}n(e,r);break}t(e,r),r=r.sibling}c=Ki(o,e.mode,c),c.return=e,e=c}return s(e);case de:return o=ao(o),_(e,r,o,c)}if(Se(o))return h(e,r,o,c);if(ye(o)){if(l=ye(o),typeof l!=`function`)throw Error(a(150));return o=l.call(o),g(e,r,o,c)}if(typeof o.then==`function`)return _(e,r,fo(o),c);if(o.$$typeof===se)return _(e,r,ja(e,o),c);mo(e,o)}return typeof o==`string`&&o!==``||typeof o==`number`||typeof o==`bigint`?(o=``+o,r!==null&&r.tag===6?(n(e,r.sibling),c=i(r,o),c.return=e,e=c):(n(e,r),c=Wi(o,e.mode,c),c.return=e,e=c),s(e)):n(e,r)}return function(e,t,n,r){try{uo=0;var i=_(e,t,n,r);return lo=null,i}catch(t){if(t===$a||t===to)throw t;var a=Ri(29,t,null,e.mode);return a.lanes=r,a.return=e,a}}}var go=ho(!0),_o=ho(!1),vo=!1;function yo(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function bo(e,t){e=e.updateQueue,t.updateQueue===e&&(t.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,callbacks:null})}function xo(e){return{lane:e,tag:0,payload:null,callback:null,next:null}}function So(e,t,n){var r=e.updateQueue;if(r===null)return null;if(r=r.shared,W&2){var i=r.pending;return i===null?t.next=t:(t.next=i.next,i.next=t),r.pending=t,t=Fi(e),Pi(e,null,n),t}return ji(e,r,t,n),Fi(e)}function Co(e,t,n){if(t=t.updateQueue,t!==null&&(t=t.shared,n&4194048)){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,xt(e,n)}}function wo(e,t){var n=e.updateQueue,r=e.alternate;if(r!==null&&(r=r.updateQueue,n===r)){var i=null,a=null;if(n=n.firstBaseUpdate,n!==null){do{var o={lane:n.lane,tag:n.tag,payload:n.payload,callback:null,next:null};a===null?i=a=o:a=a.next=o,n=n.next}while(n!==null);a===null?i=a=t:a=a.next=t}else i=a=t;n={baseState:r.baseState,firstBaseUpdate:i,lastBaseUpdate:a,shared:r.shared,callbacks:r.callbacks},e.updateQueue=n}else e=n.lastBaseUpdate,e===null?n.firstBaseUpdate=t:e.next=t,n.lastBaseUpdate=t}var To=!1;function Eo(){if(To){var e=Wa;if(e!==null)throw e}}function Do(e,t,n,r){To=!1;var i=e.updateQueue;vo=!1;var a=i.firstBaseUpdate,o=i.lastBaseUpdate,s=i.shared.pending;if(s!==null){i.shared.pending=null;var c=s,l=c.next;c.next=null,o===null?a=l:o.next=l,o=c;var u=e.alternate;u!==null&&(u=u.updateQueue,s=u.lastBaseUpdate,s!==o&&(s===null?u.firstBaseUpdate=l:s.next=l,u.lastBaseUpdate=c))}if(a!==null){var d=i.baseState;o=0,u=l=c=null,s=a;do{var f=s.lane&-536870913,p=f!==s.lane;if(p?(q&f)===f:(r&f)===f){f!==0&&f===Ua&&(To=!0),u!==null&&(u=u.next={lane:0,tag:s.tag,payload:s.payload,callback:null,next:null});a:{var m=e,h=s;f=t;var g=n;switch(h.tag){case 1:if(m=h.payload,typeof m==`function`){d=m.call(g,d,f);break a}d=m;break a;case 3:m.flags=m.flags&-65537|128;case 0:if(m=h.payload,f=typeof m==`function`?m.call(g,d,f):m,f==null)break a;d=T({},d,f);break a;case 2:vo=!0}}f=s.callback,f!==null&&(e.flags|=64,p&&(e.flags|=8192),p=i.callbacks,p===null?i.callbacks=[f]:p.push(f))}else p={lane:f,tag:s.tag,payload:s.payload,callback:s.callback,next:null},u===null?(l=u=p,c=d):u=u.next=p,o|=f;if(s=s.next,s===null){if(s=i.shared.pending,s===null)break;p=s,s=p.next,p.next=null,i.lastBaseUpdate=p,i.shared.pending=null}}while(1);u===null&&(c=d),i.baseState=c,i.firstBaseUpdate=l,i.lastBaseUpdate=u,a===null&&(i.shared.lanes=0),sd|=o,e.lanes=o,e.memoizedState=d}}function Oo(e,t){if(typeof e!=`function`)throw Error(a(191,e));e.call(t)}function ko(e,t){var n=e.callbacks;if(n!==null)for(e.callbacks=null,e=0;ea?a:8;var o=D.T,s={};s.types=o===null?null:o.types,D.T=s,pc(e,!1,t,n);try{var c=i(),l=D.S;l!==null&&l(s,c),typeof c==`object`&&c&&typeof c.then==`function`?fc(e,t,qa(c,r),jd(e)):fc(e,t,r,jd(e))}catch(n){fc(e,t,{then:function(){},status:`rejected`,reason:n},jd())}finally{O.p=a,o!==null&&s.types!==null&&(o.types=s.types),D.T=o}}function nc(){}function rc(e,t,n,r){if(e.tag!==5)throw Error(a(476));var i=ic(e).queue;tc(e,i,t,Ce,n===null?nc:function(){return ac(e),n(r)})}function ic(e){var t=e.memoizedState;if(t!==null)return t;t={memoizedState:Ce,baseState:Ce,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:ms,lastRenderedState:Ce},next:null};var n={};return t.next={memoizedState:n,baseState:n,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:ms,lastRenderedState:n},next:null},e.memoizedState=t,e=e.alternate,e!==null&&(e.memoizedState=t),t}function ac(e){var t=ic(e);t.next===null&&(t=e.alternate.memoizedState),fc(e,t.next.queue,{},jd())}function oc(){return Aa(sh)}function sc(){return B().memoizedState}function cc(){return B().memoizedState}function lc(e){for(var t=e.return;t!==null;){switch(t.tag){case 24:case 3:var n=jd();e=xo(n);var r=So(t,e,n);r!==null&&(Pd(r,t,n),Co(r,t,n)),t={cache:Ia()},e.payload=t;return}t=t.return}}function uc(e,t,n){var r=jd();n={lane:r,revertLane:0,gesture:null,action:n,hasEagerState:!1,eagerState:null,next:null},mc(e)?hc(t,n):(n=Mi(e,t,n,r),n!==null&&(Pd(n,e,r),gc(n,t,r)))}function dc(e,t,n){fc(e,t,n,jd())}function fc(e,t,n,r){var i={lane:r,revertLane:0,gesture:null,action:n,hasEagerState:!1,eagerState:null,next:null};if(mc(e))hc(t,i);else{var a=e.alternate;if(e.lanes===0&&(a===null||a.lanes===0)&&(a=t.lastRenderedReducer,a!==null))try{var o=t.lastRenderedState,s=a(o,n);if(i.hasEagerState=!0,i.eagerState=s,qr(s,o))return ji(e,t,i,0),G===null&&Ai(),!1}catch{}if(n=Mi(e,t,i,r),n!==null)return Pd(n,e,r),gc(n,t,r),!0}return!1}function pc(e,t,n,r){if(r={lane:2,revertLane:Pf(),gesture:null,action:r,hasEagerState:!1,eagerState:null,next:null},mc(e)){if(t)throw Error(a(479))}else t=Mi(e,n,r,2),t!==null&&Pd(t,e,2)}function mc(e){var t=e.alternate;return e===L||t!==null&&t===L}function hc(e,t){Yo=Jo=!0;var n=e.pending;n===null?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function gc(e,t,n){if(n&4194048){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,xt(e,n)}}var _c={readContext:Aa,use:fs,useCallback:z,useContext:z,useEffect:z,useImperativeHandle:z,useLayoutEffect:z,useInsertionEffect:z,useMemo:z,useReducer:z,useRef:z,useState:z,useDebugValue:z,useDeferredValue:z,useTransition:z,useSyncExternalStore:z,useId:z,useHostTransitionStatus:z,useFormState:z,useActionState:z,useOptimistic:z,useMemoCache:z,useCacheRefresh:z,useEffectEvent:z},vc={readContext:Aa,use:fs,useCallback:function(e,t){return ls().memoizedState=[e,t===void 0?null:t],e},useContext:Aa,useEffect:Hs,useImperativeHandle:function(e,t,n){n=n==null?null:n.concat([e]),Bs(4194308,4,Js.bind(null,t,e),n)},useLayoutEffect:function(e,t){return Bs(4194308,4,e,t)},useInsertionEffect:function(e,t){Bs(4,2,e,t)},useMemo:function(e,t){var n=ls();t=t===void 0?null:t;var r=e();if(Xo){rt(!0);try{e()}finally{rt(!1)}}return n.memoizedState=[r,t],r},useReducer:function(e,t,n){var r=ls();if(n!==void 0){var i=n(t);if(Xo){rt(!0);try{n(t)}finally{rt(!1)}}}else i=t;return r.memoizedState=r.baseState=i,e={pending:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:i},r.queue=e,e=e.dispatch=uc.bind(null,L,e),[r.memoizedState,e]},useRef:function(e){var t=ls();return e={current:e},t.memoizedState=e},useState:function(e){e=ws(e);var t=e.queue,n=dc.bind(null,L,t);return t.dispatch=n,[e.memoizedState,n]},useDebugValue:Xs,useDeferredValue:function(e,t){return $s(ls(),e,t)},useTransition:function(){var e=ws(!1);return e=tc.bind(null,L,e.queue,!0,!1),ls().memoizedState=e,[!1,e]},useSyncExternalStore:function(e,t,n){var r=L,i=ls();if(F){if(n===void 0)throw Error(a(407));n=n()}else{if(n=t(),G===null)throw Error(a(349));q&127||ys(r,t,n)}i.memoizedState=n;var o={value:n,getSnapshot:t};return i.queue=o,Hs(xs.bind(null,r,o,e),[e]),r.flags|=2048,Rs(9,{destroy:void 0},bs.bind(null,r,o,n,t),null),n},useId:function(){var e=ls(),t=G.identifierPrefix;if(F){var n=ra,r=na;n=(r&~(1<<32-it(r)-1)).toString(32)+n,t=`_`+t+`R_`+n,n=Zo++,0<\/script>`,o=o.removeChild(o.firstChild);break;case`select`:o=typeof r.is==`string`?s.createElement(`select`,{is:r.is}):s.createElement(`select`),r.multiple?o.multiple=!0:r.size&&(o.size=r.size);break;default:o=typeof r.is==`string`?s.createElement(i,{is:r.is}):s.createElement(i)}}o[Ot]=t,o[kt]=r;a:for(s=t.child;s!==null;){if(s.tag===5||s.tag===6)o.appendChild(s.stateNode);else if(s.tag!==4&&s.tag!==27&&s.child!==null){s.child.return=s,s=s.child;continue}if(s===t)break a;for(;s.sibling===null;){if(s.return===null||s.return===t)break a;s=s.return}s.sibling.return=s.return,s=s.sibling}t.stateNode=o;a:switch(np(o,i,r),i){case`button`:case`input`:case`select`:case`textarea`:r=!!r.autoFocus;break a;case`img`:r=!0;break a;default:r=!1}r&&gl(t)}}return V(t),t.subtreeFlags&=-33554433,_l(t,t.type,e===null?null:e.memoizedProps,t.pendingProps,n),null;case 6:if(e&&t.stateNode!=null)e.memoizedProps!==r&&gl(t);else{if(typeof r!=`string`&&t.stateNode===null)throw Error(a(166));if(e=Ae.current,ga(t)){if(e=t.stateNode,n=t.memoizedProps,r=null,i=la,i!==null)switch(i.tag){case 27:case 5:r=i.memoizedProps}e[Ot]=t,e=!!(e.nodeValue===n||r!==null&&!0===r.suppressHydrationWarning||ep(e.nodeValue,n)),e||pa(t,!0)}else e=lp(e).createTextNode(r),e[Ot]=t,t.stateNode=e}return V(t),null;case 31:if(n=t.memoizedState,e===null||e.memoizedState!==null){if(r=ga(t),n!==null){if(e===null){if(!r)throw Error(a(318));if(e=t.memoizedState,e=e===null?null:e.dehydrated,!e)throw Error(a(557));e[Ot]=t}else _a(),!(t.flags&128)&&(t.memoizedState=null),t.flags|=4;V(t),e=!1}else n=va(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=n),e=!0;if(!e)return t.flags&256?(Vo(t),t):(Vo(t),null);if(t.flags&128)throw Error(a(558))}return V(t),null;case 13:if(r=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(i=ga(t),r!==null&&r.dehydrated!==null){if(e===null){if(!i)throw Error(a(318));if(i=t.memoizedState,i=i===null?null:i.dehydrated,!i)throw Error(a(317));i[Ot]=t}else _a(),!(t.flags&128)&&(t.memoizedState=null),t.flags|=4;V(t),i=!1}else i=va(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=i),i=!0;if(!i)return t.flags&256?(Vo(t),t):(Vo(t),null)}return Vo(t),t.flags&128?(t.lanes=n,t):(n=r!==null,e=e!==null&&e.memoizedState!==null,n&&(r=t.child,i=null,r.alternate!==null&&r.alternate.memoizedState!==null&&r.alternate.memoizedState.cachePool!==null&&(i=r.alternate.memoizedState.cachePool.pool),o=null,r.memoizedState!==null&&r.memoizedState.cachePool!==null&&(o=r.memoizedState.cachePool.pool),o!==i&&(r.flags|=2048)),n!==e&&n&&(t.child.flags|=8192),yl(t,t.updateQueue),V(t),null);case 4:return Me(),e===null&&Wf(t.stateNode.containerInfo),t.flags|=67108864,V(t),null;case 10:return wa(t.type),V(t),null;case 19:if(Wo(t),r=t.memoizedState,r===null)return V(t),null;if(i=!!(t.flags&128),o=r.rendering,o===null){if(i)bl(r,!1);else{if(Y!==0||e!==null&&e.flags&128)for(e=t.child;e!==null;){if(o=Go(e),o!==null){for(t.flags|=128,bl(r,!1),e=o.updateQueue,t.updateQueue=e,yl(t,e),t.subtreeFlags=0,e=n,n=t.child;n!==null;)Vi(n,e),n=n.sibling;return Uo(t,Ho.current&1|2),F&&ia(t,r.treeForkCount),t.child}e=e.sibling}r.tail!==null&&Ke()>_d&&(t.flags|=128,i=!0,bl(r,!1),t.lanes=4194304)}}else{if(!i){if(e=Go(o),e!==null){if(t.flags|=128,i=!0,e=e.updateQueue,t.updateQueue=e,yl(t,e),bl(r,!0),r.tail===null&&r.tailMode!==`collapsed`&&r.tailMode!==`visible`&&!o.alternate&&!F)return V(t),null}else 2*Ke()-r.renderingStartTime>_d&&n!==536870912&&(t.flags|=128,i=!0,bl(r,!1),t.lanes=4194304)}r.isBackwards?(o.sibling=t.child,t.child=o):(e=r.last,e===null?t.child=o:e.sibling=o,r.last=o)}if(r.tail!==null){e=r.tail;a:{for(n=e;n!==null;){if(n.alternate!==null){n=!1;break a}n=n.sibling}n=!0}return r.rendering=e,r.tail=e.sibling,r.renderingStartTime=Ke(),e.sibling=null,o=Ho.current,o=i?o&1|2:o&1,r.tailMode===`visible`||r.tailMode===`collapsed`||!n||F?Uo(t,o):(n=o,k(Fo,t),k(Ho,n),Io===null&&(Io=t)),F&&ia(t,r.treeForkCount),e}return V(t),null;case 22:case 23:return Vo(t),Po(),r=t.memoizedState!==null,e===null?r&&(t.flags|=8192):e.memoizedState!==null!==r&&(t.flags|=8192),r?n&536870912&&!(t.flags&128)&&(V(t),t.subtreeFlags&6&&(t.flags|=8192)):V(t),n=t.updateQueue,n!==null&&yl(t,n.retryQueue),n=null,e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(n=e.memoizedState.cachePool.pool),r=null,t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(r=t.memoizedState.cachePool.pool),r!==n&&(t.flags|=2048),e!==null&&De(Ya),null;case 24:return n=null,e!==null&&(n=e.memoizedState.cache),t.memoizedState.cache!==n&&(t.flags|=2048),wa(I),V(t),null;case 25:return null;case 30:return t.flags|=33554432,V(t),null}throw Error(a(156,t.tag))}function Sl(e,t){switch(sa(t),t.tag){case 1:return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return wa(I),Me(),e=t.flags,e&65536&&!(e&128)?(t.flags=e&-65537|128,t):null;case 26:case 27:case 5:return Fe(t),null;case 31:if(t.memoizedState!==null){if(Vo(t),t.alternate===null)throw Error(a(340));_a()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 13:if(Vo(t),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(a(340));_a()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return Wo(t),e=t.flags,e&65536?(t.flags=e&-65537|128,e=t.memoizedState,e!==null&&(e.rendering=null,e.tail=null),t.flags|=4,t):null;case 4:return Me(),null;case 10:return wa(t.type),null;case 22:case 23:return Vo(t),Po(),e!==null&&De(Ya),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 24:return wa(I),null;case 25:return null;default:return null}}function Cl(e,t){switch(sa(t),t.tag){case 3:wa(I),Me();break;case 26:case 27:case 5:Fe(t);break;case 4:Me();break;case 31:t.memoizedState!==null&&Vo(t);break;case 13:Vo(t);break;case 19:Wo(t);break;case 10:wa(t.type);break;case 22:case 23:Vo(t),Po(),e!==null&&De(Ya);break;case 24:wa(I)}}function wl(e,t){try{var n=t.updateQueue,r=n===null?null:n.lastEffect;if(r!==null){var i=r.next;n=i;do{if((n.tag&e)===e){r=void 0;var a=n.create,o=n.inst;r=a(),o.destroy=r}n=n.next}while(n!==i)}}catch(e){Z(t,t.return,e)}}function Tl(e,t,n){try{var r=t.updateQueue,i=r===null?null:r.lastEffect;if(i!==null){var a=i.next;r=a;do{if((r.tag&e)===e){var o=r.inst,s=o.destroy;if(s!==void 0){o.destroy=void 0,i=t;var c=n,l=s;try{l()}catch(e){Z(i,c,e)}}}r=r.next}while(r!==a)}}catch(e){Z(t,t.return,e)}}function El(e){var t=e.updateQueue;if(t!==null){var n=e.stateNode;try{ko(t,n)}catch(t){Z(e,e.return,t)}}}function Dl(e,t,n){n.props=Tc(e.type,e.memoizedProps),n.state=e.memoizedState;try{n.componentWillUnmount()}catch(n){Z(e,t,n)}}function Ol(e,t){try{var n=e.ref;if(n!==null){switch(e.tag){case 26:case 27:case 5:var r=e.stateNode;break;case 30:var i=e.stateNode,a=Ci(e.memoizedProps,i);(i.ref===null||i.ref.name!==a)&&(i.ref=Pp(a)),r=i.ref;break;case 7:if(e.stateNode===null){var o=new Fp(e);p(e.child,!1,Qp,o,void 0,void 0),e.stateNode=o}r=e.stateNode;break;default:r=e.stateNode}typeof n==`function`?e.refCleanup=n(r):n.current=r}}catch(n){Z(e,t,n)}}function kl(e,t){var n=e.ref,r=e.refCleanup;if(n!==null){if(typeof r==`function`)try{r()}catch(n){Z(e,t,n)}finally{e.refCleanup=null,e=e.alternate,e!=null&&(e.refCleanup=null)}else if(typeof n==`function`)try{n(null)}catch(n){Z(e,t,n)}else n.current=null}}function Al(e,t){if((e.tag===5||e.tag===27||e.tag===6)&&e.alternate===null&&t!==null)for(var n=0;n title`))),np(r,t,n),r[Ot]=e,Ht(r),t=r;break a;case`link`:if(o=Gm(`link`,`href`,i).get(t+(n.href||``))){for(s=0;sg&&(o=g,g=h,h=o);var _=Zr(s,h),v=Zr(s,g);if(_&&v&&(p.rangeCount!==1||p.anchorNode!==_.node||p.anchorOffset!==_.offset||p.focusNode!==v.node||p.focusOffset!==v.offset)){var y=d.createRange();y.setStart(_.node,_.offset),p.removeAllRanges(),h>g?(p.addRange(y),p.extend(v.node,v.offset)):(y.setEnd(v.node,v.offset),p.addRange(y))}}}}for(d=[],p=s;p=p.parentNode;)p.nodeType===1&&d.push({element:p,left:p.scrollLeft,top:p.scrollTop});for(typeof s.focus==`function`&&s.focus(),s=0;sn?32:n,D.T=null,n=wd,wd=null;var o=bd,s=Sd;if(X=0,xd=bd=null,Sd=0,W&6)throw Error(a(331));var c=W;if(W|=4,Zu(o.current),Uu(o,o.current,s,n),W=c,Df(0,!1),nt&&typeof nt.onPostCommitFiberRoot==`function`)try{nt.onPostCommitFiberRoot(tt,o)}catch{}return!0}finally{O.p=i,D.T=r,uf(e,t)}}function pf(e,t,n){t=Ji(n,t),t=jc(e.stateNode,t,2),e=So(e,t,2),e!==null&&(vt(e,2),Ef(e))}function Z(e,t,n){if(e.tag===3)pf(e,e,n);else for(;t!==null;){if(t.tag===3){pf(t,e,n);break}if(t.tag===1){var r=t.stateNode;if(typeof t.type.getDerivedStateFromError==`function`||typeof r.componentDidCatch==`function`&&(yd===null||!yd.has(r))){e=Ji(n,e),n=Mc(2),r=So(t,n,2),r!==null&&(Nc(n,r,t,e),vt(r,2),Ef(r));break}}t=t.return}}function mf(e,t,n){var r=e.pingCache;if(r===null){r=e.pingCache=new td;var i=new Set;r.set(t,i)}else i=r.get(t),i===void 0&&(i=new Set,r.set(t,i));i.has(n)||(ad=!0,i.add(n),e=hf.bind(null,e,t,n),t.then(e,e))}function hf(e,t,n){var r=e.pingCache;r!==null&&r.delete(t),e.pingedLanes|=e.suspendedLanes&n,e.warmLanes&=~n,G===e&&(q&n)===n&&(Y===4||Y===3&&(q&62914560)===q&&300>Ke()-hd?W&2?ld|=n:Vd(e,0):ld|=n,dd===q&&(dd=0)),Ef(e)}function gf(e,t){t===0&&(t=gt()),e=Ni(e,t),e!==null&&(vt(e,t),Ef(e))}function _f(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),gf(e,n)}function vf(e,t){var n=0;switch(e.tag){case 31:case 13:var r=e.stateNode,i=e.memoizedState;i!==null&&(n=i.retryLane);break;case 19:r=e.stateNode;break;case 22:r=e.stateNode._retryCache;break;default:throw Error(a(314))}r!==null&&r.delete(t),gf(e,n)}function yf(e,t){return He(e,t)}var bf=null,xf=null,Sf=!1,Cf=!1,wf=!1,Tf=0;function Ef(e){e!==xf&&e.next===null&&(xf===null?bf=xf=e:xf=xf.next=e),Cf=!0,Sf||(Sf=!0,Nf())}function Df(e,t){if(!wf&&Cf){wf=!0;do for(var n=!1,r=bf;r!==null;){if(!t){if(e!==0){var i=r.pendingLanes;if(i===0)var a=0;else{var o=r.suspendedLanes,s=r.pingedLanes;a=(1<<31-it(42|e)+1)-1,a&=i&~(o&~s),a=a&201326741?a&201326741|1:a?a|2:0}a!==0&&(n=!0,Mf(r,a))}else a=q,a=ft(r,r===G?a:0,r.cancelPendingCommit!==null||r.timeoutHandle!==-1),!(a&3)||pt(r,a)||(n=!0,Mf(r,a))}r=r.next}while(n);wf=!1}}function Of(){kf()}function kf(){Cf=Sf=!1;var e=0;Tf!==0&&hp()&&(e=Tf);for(var t=Ke(),n=null,r=bf;r!==null;){var i=r.next,a=Af(r,t);a===0?(r.next=null,n===null?bf=i:n.next=i,i===null&&(xf=n)):(n=r,(e!==0||a&3)&&(Cf=!0)),r=i}X!==0&&X!==5||Df(e,!1),Tf!==0&&(Tf=0)}function Af(e,t){for(var n=e.suspendedLanes,r=e.pingedLanes,i=e.expirationTimes,a=e.pendingLanes&-62914561;0s)break;var u=c.transferSize,d=c.initiatorType;u&&ap(d)&&(c=c.responseEnd,o+=u*(c$m){s.length=o;break}f=new Promise(jp.bind(f)),s.push(f)}}}if(0`u`?null:document;function Tm(e,t,n){var r=wm;if(r&&typeof t==`string`&&t){var i=ln(t);i=`link[rel="`+e+`"][href="`+i+`"]`,typeof n==`string`&&(i+=`[crossorigin="`+n+`"]`),ym.has(i)||(ym.add(i),e={rel:e,crossOrigin:n,href:t},r.querySelector(i)===null&&(t=r.createElement(`link`),np(t,`link`,e),Ht(t),r.head.appendChild(t)))}}function Em(e){xm.D(e),Tm(`dns-prefetch`,e,null)}function Dm(e,t){xm.C(e,t),Tm(`preconnect`,e,t)}function Om(e,t,n){xm.L(e,t,n);var r=wm;if(r&&e&&t){var i=`link[rel="preload"][as="`+ln(t)+`"]`;t===`image`&&n&&n.imageSrcSet?(i+=`[imagesrcset="`+ln(n.imageSrcSet)+`"]`,typeof n.imageSizes==`string`&&(i+=`[imagesizes="`+ln(n.imageSizes)+`"]`)):i+=`[href="`+ln(e)+`"]`;var a=i;switch(t){case`style`:a=Pm(e);break;case`script`:a=Rm(e)}if(!(vm.has(a)||(e=T({rel:`preload`,href:t===`image`&&n&&n.imageSrcSet?void 0:e,as:t},n),vm.set(a,e),r.querySelector(i)!==null||t===`style`&&r.querySelector(Fm(a))||t===`script`&&r.querySelector(zm(a))))){var o=r.createElement(`link`);np(o,`link`,e),t===`style`&&(o[It]=!0,o.onload=o.onerror=function(){Ut(o)}),Ht(o),r.head.appendChild(o)}}}function km(e,t){xm.m(e,t);var n=wm;if(n&&e){var r=t&&typeof t.as==`string`?t.as:`script`,i=`link[rel="modulepreload"][as="`+ln(r)+`"][href="`+ln(e)+`"]`,a=i;switch(r){case`audioworklet`:case`paintworklet`:case`serviceworker`:case`sharedworker`:case`worker`:case`script`:a=Rm(e)}if(!vm.has(a)&&(e=T({rel:`modulepreload`,href:e},t),vm.set(a,e),n.querySelector(i)===null)){switch(r){case`audioworklet`:case`paintworklet`:case`serviceworker`:case`sharedworker`:case`worker`:case`script`:if(n.querySelector(zm(a)))return}r=n.createElement(`link`),np(r,`link`,e),Ht(r),n.head.appendChild(r)}}}function Am(e,t,n){xm.S(e,t,n);var r=wm;if(r&&e){var i=Vt(r).hoistableStyles,a=Pm(e);t||=`default`;var o=i.get(a);if(!o){var s={loading:0,preload:null};if(o=r.querySelector(Fm(a)))s.loading=5;else{e=T({rel:`stylesheet`,href:e,"data-precedence":t},n),(n=vm.get(a))&&Hm(e,n);var c=o=r.createElement(`link`);Ht(c),np(c,`link`,e),c._p=new Promise(function(e,t){c.onload=e,c.onerror=t}),c.addEventListener(`load`,function(){s.loading|=1}),c.addEventListener(`error`,function(){s.loading|=2}),s.loading|=4,Vm(o,t,r)}o={type:`stylesheet`,instance:o,count:1,state:s},i.set(a,o)}}}function jm(e,t){xm.X(e,t);var n=wm;if(n&&e){var r=Vt(n).hoistableScripts,i=Rm(e),a=r.get(i);a||(a=n.querySelector(zm(i)),a||(e=T({src:e,async:!0},t),(t=vm.get(i))&&Um(e,t),a=n.createElement(`script`),Ht(a),np(a,`link`,e),n.head.appendChild(a)),a={type:`script`,instance:a,count:1,state:null},r.set(i,a))}}function Mm(e,t){xm.M(e,t);var n=wm;if(n&&e){var r=Vt(n).hoistableScripts,i=Rm(e),a=r.get(i);a||(a=n.querySelector(zm(i)),a||(e=T({src:e,async:!0,type:`module`},t),(t=vm.get(i))&&Um(e,t),a=n.createElement(`script`),Ht(a),np(a,`link`,e),n.head.appendChild(a)),a={type:`script`,instance:a,count:1,state:null},r.set(i,a))}}function Nm(e,t,n,r){var i=(i=Ae.current)?bm(i):null;if(!i)throw Error(a(446));switch(e){case`meta`:case`title`:return null;case`style`:return typeof n.precedence==`string`&&typeof n.href==`string`?(n=Pm(n.href),t=Vt(i).hoistableStyles,r=t.get(n),r||(r={type:`style`,instance:null,count:0,state:null},t.set(n,r)),r):{type:`void`,instance:null,count:0,state:null};case`link`:if(n.rel===`stylesheet`&&typeof n.href==`string`&&typeof n.precedence==`string`){e=Pm(n.href);var o=Vt(i).hoistableStyles,s=o.get(e);if(s||(i=i.ownerDocument||i,s={type:`stylesheet`,instance:null,count:0,state:{loading:0,preload:null}},o.set(e,s),(o=i.querySelector(Fm(e)))?o._p||(s.instance=o,s.state.loading=5):(o=vm.get(e),o||(o={rel:`preload`,as:`style`,href:n.href,crossOrigin:n.crossOrigin,integrity:n.integrity,media:n.media,hrefLang:n.hrefLang,referrerPolicy:n.referrerPolicy},vm.set(e,o)),Lm(i,e,o,s.state))),t&&r===null)throw Error(a(528,``));return s}if(t&&r!==null)throw Error(a(529,``));return null;case`script`:return t=n.async,n=n.src,typeof n==`string`&&t&&typeof t!=`function`&&typeof t!=`symbol`?(n=Rm(n),t=Vt(i).hoistableScripts,r=t.get(n),r||(r={type:`script`,instance:null,count:0,state:null},t.set(n,r)),r):{type:`void`,instance:null,count:0,state:null};default:throw Error(a(444,e))}}function Pm(e){return`href="`+ln(e)+`"`}function Fm(e){return`link[rel="stylesheet"][`+e+`]`}function Im(e){return T({},e,{"data-precedence":e.precedence,precedence:null})}function Lm(e,t,n,r){if(t=e.querySelector(`link[rel="preload"][as="style"][`+t+`]`)){if(!0!==t[It]){r.loading=1;return}}else t=e.createElement(`link`),t[It]=!0,t.onload=t.onerror=Ut.bind(null,t),np(t,`link`,n),Ht(t),e.head.appendChild(t);r.preload=t,t.addEventListener(`load`,function(){return r.loading|=1}),t.addEventListener(`error`,function(){return r.loading|=2})}function Rm(e){return`[src="`+ln(e)+`"]`}function zm(e){return`script[async]`+e}function Bm(e,t,n){if(t.count++,t.instance===null)switch(t.type){case`style`:var r=e.querySelector(`style[data-href~="`+ln(n.href)+`"]`);if(r)return t.instance=r,Ht(r),r;var i=T({},n,{"data-href":n.href,"data-precedence":n.precedence,href:null,precedence:null});return r=(e.ownerDocument||e).createElement(`style`),Ht(r),np(r,`style`,i),Vm(r,n.precedence,e),t.instance=r;case`stylesheet`:i=Pm(n.href);var o=e.querySelector(Fm(i));if(o)return t.state.loading|=4,t.instance=o,Ht(o),o;r=Im(n),(i=vm.get(i))&&Hm(r,i),o=(e.ownerDocument||e).createElement(`link`),Ht(o);var s=o;return s._p=new Promise(function(e,t){s.onload=e,s.onerror=t}),np(o,`link`,r),t.state.loading|=4,Vm(o,n.precedence,e),t.instance=o;case`script`:return o=Rm(n.src),(i=e.querySelector(zm(o)))?(t.instance=i,Ht(i),i):(r=n,(i=vm.get(o))&&(r=T({},n),Um(r,i)),e=e.ownerDocument||e,i=e.createElement(`script`),Ht(i),np(i,`link`,r),e.head.appendChild(i),t.instance=i);case`void`:return null;default:throw Error(a(443,t.type))}else t.type===`stylesheet`&&!(t.state.loading&4)&&(r=t.instance,t.state.loading|=4,Vm(r,n.precedence,e));return t.instance}function Vm(e,t,n){for(var r=n.querySelectorAll(`link[rel="stylesheet"][data-precedence],style[data-precedence]`),i=r.length?r[r.length-1]:null,a=i,o=0;o title`):null)}function qm(e,t,n){if(n===1||t.itemProp!=null)return!1;switch(e){case`meta`:case`title`:return!0;case`style`:if(typeof t.precedence!=`string`||typeof t.href!=`string`||t.href===``)break;return!0;case`link`:if(typeof t.rel!=`string`||typeof t.href!=`string`||t.href===``||t.onLoad||t.onError)break;switch(t.rel){case`stylesheet`:return e=t.disabled,typeof t.precedence==`string`&&e==null;default:return!0}case`script`:if(t.async&&typeof t.async!=`function`&&typeof t.async!=`symbol`&&!t.onLoad&&!t.onError&&t.src&&typeof t.src==`string`)return!0}return!1}function Jm(e,t){return e===`img`&&t.src!=null&&t.src!==``&&t.onLoad==null&&t.loading!==`lazy`}function Ym(e){return!(e.type===`stylesheet`&&!(e.state.loading&3))}function Xm(e){return(e.width||100)*(e.height||100)*(typeof devicePixelRatio==`number`?devicePixelRatio:1)*.25}function Zm(e,t){typeof t.decode==`function`&&(e.imgCount++,t.complete||(e.imgBytes+=Xm(t),e.suspenseyImages.push(t)),e=rh.bind(e),t.decode().then(e,e))}function Qm(e,t,n,r){if(n.type===`stylesheet`&&(typeof r.media!=`string`||!1!==matchMedia(r.media).matches)&&!(n.state.loading&4)){if(n.instance===null){var i=Pm(r.href),a=t.querySelector(Fm(i));if(a){t=a._p,typeof t==`object`&&t&&typeof t.then==`function`&&(e.count++,e=nh.bind(e),t.then(e,e)),n.state.loading|=4,n.instance=a,Ht(a);return}a=t.ownerDocument||t,r=Im(r),(i=vm.get(i))&&Hm(r,i),a=a.createElement(`link`),Ht(a);var o=a;o._p=new Promise(function(e,t){o.onload=e,o.onerror=t}),np(a,`link`,r),n.instance=a}e.stylesheets===null&&(e.stylesheets=new Map),e.stylesheets.set(n,t),(t=n.state.preload)&&!(n.state.loading&3)&&(e.count++,n=nh.bind(e),t.addEventListener(`load`,n),t.addEventListener(`error`,n))}}var $m=0;function eh(e,t){return e.stylesheets&&e.count===0&&ah(e,e.stylesheets),0$m?50:800)+t);return e.unsuspend=n,function(){e.unsuspend=null,clearTimeout(r),clearTimeout(i)}}:null}function th(e){if(e.count===0&&(e.imgCount===0||!e.waitingForImages)){if(e.stylesheets)ah(e,e.stylesheets);else if(e.unsuspend){var t=e.unsuspend;e.unsuspend=null,t()}}}function nh(){this.count--,th(this)}function rh(){this.imgCount--,th(this)}var ih=null;function ah(e,t){e.stylesheets=null,e.unsuspend!==null&&(e.count++,ih=new Map,t.forEach(oh,e),ih=null,nh.call(e))}function oh(e,t){if(!(t.state.loading&4)){var n=ih.get(e);if(n)var r=n.get(null);else{n=new Map,ih.set(e,n);for(var i=e.querySelectorAll(`link[data-precedence],style[data-precedence]`),a=0;a{function n(){if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<`u`&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE==`function`)try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(n)}catch(e){console.error(e)}}n(),t.exports=Pe()}))(),j=n(),M=t();function Ie({onClose:e,onOpened:t,canClone:n,cloning:r,onClone:i}){let[a,o]=(0,j.useState)(null),[s,c]=(0,j.useState)(null),[l,u]=(0,j.useState)(null),[d,f]=(0,j.useState)(!1),[p,m]=(0,j.useState)(``),[h,g]=(0,j.useState)(!1),[_,v]=(0,j.useState)(``),[y,b]=(0,j.useState)(0);(0,j.useEffect)(()=>{let e=!1;return A.browse(a??void 0).then(t=>{e||(c(t),u(null))}).catch(t=>{e||u(t instanceof Error?t.message:`could not browse`)}),()=>{e=!0}},[a,y]);let x=e=>o(`${s.path.replace(/\/$/,``)}/${e}`),S=async()=>{if(s){f(!0);try{t(await A.open(s.path))}catch(e){E.error(e instanceof Error?e.message:`could not open`),f(!1)}}},C=async()=>{if(!s)return;let e=p.trim();if(e){g(!0);try{await A.mkdir(s.path,e),m(``),b(e=>e+1)}catch(e){E.error(e instanceof Error?e.message:`could not create folder`)}finally{g(!1)}}};return(0,M.jsx)(`div`,{className:`nc-fade-in fixed inset-0 z-50 flex items-start justify-center bg-black/60 p-4 md:pt-[8vh]`,onClick:e,children:(0,M.jsxs)(`div`,{className:`nc-rise-in flex max-h-[min(80vh,calc(var(--nc-visual-viewport-height,100vh)-8vh-1rem))] w-[34rem] max-w-full flex-col rounded-lg border border-ink-700 bg-ink-900`,onClick:e=>e.stopPropagation(),children:[(0,M.jsxs)(`div`,{className:`flex shrink-0 items-center gap-2 border-b border-ink-700 px-3 py-2`,children:[(0,M.jsx)(`span`,{className:`font-medium text-ink-50`,children:`Open a project`}),(0,M.jsx)(`button`,{onClick:e,"aria-label":`close`,className:`ml-auto flex h-6 w-6 items-center justify-center rounded-sm text-ink-400 hover:text-ink-200`,children:(0,M.jsx)(pe,{})})]}),(0,M.jsx)(`div`,{className:`shrink-0 truncate border-b border-ink-700 px-3 py-1.5 text-ink-400`,children:s?.path??`…`}),(0,M.jsxs)(`ul`,{className:`h-72 min-h-0 overflow-y-auto`,children:[s?.parent&&(0,M.jsx)(`li`,{children:(0,M.jsx)(`button`,{onClick:()=>o(s.parent),className:`w-full px-3 py-1 text-left text-ink-400 hover:bg-ink-850`,children:`../`})}),s?.entries.map(e=>(0,M.jsx)(`li`,{children:(0,M.jsxs)(`button`,{onClick:()=>x(e.name),className:`flex w-full items-center gap-2 px-3 py-1 text-left hover:bg-ink-850`,children:[(0,M.jsxs)(`span`,{className:`truncate text-accent`,children:[e.name,`/`]}),e.is_repo&&(0,M.jsx)(`span`,{className:`rounded-sm bg-ink-700 px-1 text-2xs text-ink-200`,children:`git`})]})},e.name)),s&&s.entries.length===0&&(0,M.jsx)(`li`,{className:`px-3 py-1 text-ink-400`,children:`No sub-folders.`})]}),l&&(0,M.jsx)(`p`,{className:`shrink-0 px-3 py-1 text-removed`,children:l}),(0,M.jsxs)(`div`,{className:`flex shrink-0 items-stretch gap-2 border-t border-ink-700 px-3 py-2`,children:[(0,M.jsx)(`input`,{value:p,onChange:e=>m(e.target.value),onKeyDown:e=>{e.key===`Enter`&&C()},placeholder:`New folder name`,"aria-label":`new folder name`,className:`min-w-0 flex-1 rounded-sm border border-ink-700 bg-ink-950 px-2 py-1 text-ink-50 placeholder:text-ink-400 focus:border-ink-600 focus:outline-none`}),(0,M.jsx)(`button`,{onClick:C,disabled:!s||!p.trim()||h,"aria-busy":h,className:`shrink-0 rounded-sm border border-ink-700 px-2 py-1 text-ink-200 hover:bg-ink-850 disabled:opacity-50`,children:(0,M.jsx)(Ee,{busy:h,children:`Create`})})]}),(0,M.jsxs)(`div`,{className:`flex shrink-0 items-stretch gap-2 border-t border-ink-700 px-3 py-2`,children:[(0,M.jsx)(`input`,{value:_,onChange:e=>v(e.target.value),onKeyDown:e=>{e.key===`Enter`&&s&&i(s.path,_)},disabled:!n,placeholder:n?`Clone a git URL here`:`git is not installed on the server`,"aria-label":`git URL to clone`,spellCheck:!1,autoCapitalize:`none`,autoCorrect:`off`,className:`min-w-0 flex-1 rounded-sm border border-ink-700 bg-ink-950 px-2 py-1 text-ink-50 placeholder:text-ink-400 focus:border-ink-600 focus:outline-none disabled:opacity-50`}),(0,M.jsx)(`button`,{onClick:()=>s&&i(s.path,_),disabled:!n||!s||!_.trim()||r,"aria-busy":r,title:n?void 0:`the server has no git on its PATH`,className:`shrink-0 rounded-sm border border-ink-700 px-2 py-1 text-ink-200 hover:bg-ink-850 disabled:opacity-50`,children:(0,M.jsx)(Ee,{busy:r,children:`Clone`})})]}),(0,M.jsxs)(`div`,{className:`flex shrink-0 items-center gap-2 border-t border-ink-700 px-3 py-2`,children:[(0,M.jsx)(`span`,{className:`truncate text-ink-400`,children:s?s.path:``}),(0,M.jsx)(`button`,{onClick:S,disabled:!s||d,"aria-busy":d,className:`ml-auto shrink-0 rounded-sm bg-ink-50 px-3 py-1 font-semibold text-ink-950 hover:bg-white disabled:opacity-50`,children:(0,M.jsx)(Ee,{busy:d,children:`Open`})})]})]})})}var Le=`data:image/svg+xml,%3c?xml%20version='1.0'%20encoding='utf-8'?%3e%3csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='12%2057%201150%201150'%20role='img'%20aria-label='Black%20crow'%3e%3ctitle%3eBlack%20crow%3c/title%3e%3cdesc%3eMonochrome%20black%20crow%20silhouette%20on%20a%20transparent%20background,%20framed%20so%20the%20bird%20sits%20centred%20for%20use%20as%20an%20inline%20mark%20on%20a%20square%20tile.%3c/desc%3e%3cg%20fill-rule='evenodd'%20clip-rule='evenodd'%3e%3cpath%20fill='%23000000'%20d='M%20882%20147%20L%20859%20136%20L%20844%20131%20L%20831%20129%20L%20830%20128%20L%20815%20127%20L%20814%20126%20L%20796%20126%20L%20795%20127%20L%20786%20127%20L%20785%20128%20L%20775%20129%20L%20752%20136%20L%20732%20146%20L%20713%20160%20L%20701%20172%20L%20684%20172%20L%20683%20173%20L%20673%20173%20L%20672%20174%20L%20650%20176%20L%20649%20177%20L%20627%20181%20L%20602%20190%20L%20589%20197%20L%20579%20204%20L%20562%20221%20L%20562%20223%20L%20565%20223%20L%20578%20228%20L%20581%20228%20L%20612%20238%20L%20672%20252%20L%20684%20258%20L%20698%20271%20L%20702%20278%20L%20705%20288%20L%20705%20294%20L%20703%20301%20L%20699%20308%20L%20688%20318%20L%20630%20347%20L%20593%20372%20L%20561%20399%20L%20544%20416%20L%20522%20441%20L%20492%20481%20L%20461%20531%20L%20438%20576%20L%20431%20594%20L%20425%20602%20L%20405%20635%20L%20387%20668%20L%20385%20676%20L%20390%20679%20L%20368%20705%20L%20330%20755%20L%20306%20790%20L%20296%20808%20L%20289%20818%20L%20280%20838%20L%20280%20843%20L%20283%20845%20L%20292%20843%20L%20297%20840%20L%20299%20840%20L%20321%20828%20L%20322%20830%20L%20311%20844%20L%20288%20878%20L%20287%20881%20L%20259%20924%20L%20235%20965%20L%20205%201023%20L%20205%201025%20L%20197%201042%20L%20191%201061%20L%20191%201071%20L%20192%201072%20L%20198%201071%20L%20220%201056%20L%20242%201038%20L%20300%20986%20L%20302%20987%20L%20265%201040%20L%20264%201043%20L%20246%201070%20L%20235%201090%20L%20227%201112%20L%20227%201123%20L%20229%201128%20L%20234%201133%20L%20239%201135%20L%20255%201135%20L%20274%201129%20L%20279%201134%20L%20286%201137%20L%20290%201137%20L%20291%201138%20L%20310%201138%20L%20311%201137%20L%20317%201137%20L%20318%201136%20L%20326%201135%20L%20344%201129%20L%20369%201116%20L%20395%201097%20L%20420%201073%20L%20445%201042%20L%20457%201024%20L%20461%201016%20L%20464%201013%20L%20468%201011%20L%20489%20994%20L%20595%20901%20L%20601%20906%20L%20606%20913%20L%20614%20921%20L%20637%20949%20L%20639%20953%20L%20639%20956%20L%20636%20960%20L%20634%20961%20L%20619%20962%20L%20613%20965%20L%20605%20974%20L%20602%20982%20L%20602%20994%20L%20605%201001%20L%20608%201004%20L%20609%201004%20L%20609%20999%20L%20612%20992%20L%20616%20988%20L%20620%20986%20L%20627%20986%20L%20635%20983%20L%20645%20983%20L%20646%20982%20L%20655%20982%20L%20668%20986%20L%20676%20990%20L%20682%20996%20L%20685%201003%20L%20688%201006%20L%20696%201009%20L%20697%201012%20L%20697%201024%20L%20693%201033%20L%20693%201035%20L%20695%201035%20L%20700%201032%20L%20707%201025%20L%20710%201020%20L%20713%201010%20L%20713%201003%20L%20711%20998%20L%20711%20994%20L%20712%20993%20L%20719%201003%20L%20723%201005%20L%20727%201005%20L%20730%201011%20L%20730%201022%20L%20727%201031%20L%20728%201033%20L%20740%201021%20L%20743%201014%20L%20744%201003%20L%20747%20999%20L%20749%20992%20L%20748%20977%20L%20744%20968%20L%20740%20963%20L%20741%20962%20L%20755%20961%20L%20768%20964%20L%20777%20969%20L%20783%20975%20L%20786%20981%20L%20789%20984%20L%20795%20987%20L%20799%20987%20L%20801%20991%20L%20801%20997%20L%20802%20998%20L%20799%201013%20L%20802%201012%20L%20808%201007%20L%20813%201000%20L%20816%20991%20L%20816%20981%20L%20814%20976%20L%20814%20968%20L%20815%20967%20L%20819%20970%20L%20823%20970%20L%20826%20973%20L%20829%20980%20L%20830%20993%20L%20834%20990%20L%20838%20979%20L%20838%20968%20L%20832%20951%20L%20822%20940%20L%20815%20936%20L%20803%20933%20L%20776%20935%20L%20763%20931%20L%20753%20922%20L%20731%20898%20L%20703%20865%20L%20703%20863%20L%20710%20853%20L%20711%20855%20L%20707%20862%20L%20709%20862%20L%20718%20857%20L%20754%20832%20L%20793%20799%20L%20818%20774%20L%20849%20737%20L%20850%20741%20L%20845%20755%20L%20847%20755%20L%20861%20743%20L%20881%20721%20L%20906%20686%20L%20918%20665%20L%20933%20635%20L%20951%20590%20L%20971%20525%20L%20971%20521%20L%20974%20512%20L%20974%20508%20L%20978%20493%20L%20979%20482%20L%20980%20481%20L%20981%20466%20L%20982%20465%20L%20983%20441%20L%20982%20440%20L%20982%20428%20L%20981%20427%20L%20980%20414%20L%20978%20409%20L%20976%20397%20L%20970%20381%20L%20971%20379%20L%20974%20383%20L%20976%20381%20L%20977%20334%20L%20976%20333%20L%20976%20322%20L%20975%20321%20L%20974%20307%20L%20973%20306%20L%20973%20301%20L%20972%20300%20L%20969%20280%20L%20958%20243%20L%20949%20224%20L%20949%20222%20L%20939%20204%20L%20922%20181%20L%20903%20162%20Z%20M%20625%20888%20L%20656%20874%20L%20658%20874%20L%20665%20870%20L%20725%20930%20L%20728%20934%20L%20728%20940%20L%20723%20943%20L%20714%20944%20L%20707%20950%20L%20683%20951%20L%20673%20947%20L%20659%20932%20Z%20M%20787%20182%20L%20792%20182%20L%20796%20187%20L%20795%20192%20L%20791%20195%20L%20788%20195%20L%20783%20191%20L%20783%20186%20Z'/%3e%3cpath%20fill='%23000000'%20d='M%20895%20156%20L%20863%20138%20L%20838%20130%20L%20819%20127%20L%20789%20127%20L%20777%20129%20L%20753%20136%20L%20736%20144%20L%20717%20157%20L%20702%20172%20L%20652%20176%20L%20628%20181%20L%20607%20188%20L%20585%20200%20L%20562%20222%20L%20613%20238%20L%20670%20251%20L%20683%20257%20L%20697%20269%20L%20705%20286%20L%20705%20296%20L%20703%20302%20L%20698%20310%20L%20687%20319%20L%20631%20347%20L%20591%20374%20L%20568%20393%20L%20538%20423%20L%20520%20444%20L%20481%20498%20L%20457%20539%20L%20437%20579%20L%20432%20593%20L%20413%20622%20L%20386%20671%20L%20386%20677%20L%20390%20677%20L%20391%20679%20L%20374%20698%20L%20334%20750%20L%20307%20789%20L%20290%20817%20L%20280%20839%20L%20281%20844%20L%20291%20843%20L%20323%20826%20L%20325%20827%20L%20289%20877%20L%20237%20962%20L%20209%201015%20L%20198%201040%20L%20191%201063%20L%20191%201070%20L%20194%201072%20L%20213%201061%20L%20259%201023%20L%20302%20984%20L%20303%20985%20L%20262%201045%20L%20245%201072%20L%20233%201095%20L%20227%201114%20L%20228%201126%20L%20233%201132%20L%20242%201135%20L%20252%201135%20L%20274%201128%20L%20278%201133%20L%20288%201137%20L%20313%201137%20L%20343%201129%20L%20373%201113%20L%20398%201094%20L%20424%201068%20L%20441%201047%20L%20465%201012%20L%20520%20967%20L%20595%20900%20L%20611%20917%20L%20639%20952%20L%20639%20957%20L%20637%20960%20L%20632%20962%20L%20618%20963%20L%20611%20967%20L%20606%20973%20L%20602%20983%20L%20602%20992%20L%20608%201004%20L%20611%20993%20L%20619%20986%20L%20626%20986%20L%20643%20982%20L%20656%20982%20L%20675%20989%20L%20683%20997%20L%20688%201006%20L%20696%201009%20L%20697%201025%20L%20693%201034%20L%20694%201035%20L%20701%201031%20L%20710%201019%20L%20712%201013%20L%20712%20993%20L%20720%201003%20L%20727%201005%20L%20730%201009%20L%20730%201025%20L%20727%201032%20L%20732%201030%20L%20739%201022%20L%20743%201013%20L%20743%201004%20L%20749%20991%20L%20748%20978%20L%20740%20964%20L%20743%20961%20L%20757%20961%20L%20769%20964%20L%20781%20972%20L%20791%20985%20L%20798%20986%20L%20802%20994%20L%20802%201003%20L%20799%201013%20L%20810%201004%20L%20815%20994%20L%20816%20983%20L%20814%20977%20L%20814%20965%20L%20818%20969%20L%20825%20971%20L%20830%20983%20L%20830%20993%20L%20833%20991%20L%20837%20982%20L%20838%20969%20L%20834%20956%20L%20825%20943%20L%20820%20939%20L%20807%20934%20L%20774%20935%20L%20762%20931%20L%20736%20904%20L%20702%20864%20L%20715%20845%20L%20716%20847%20L%20707%20862%20L%20719%20856%20L%20744%20839%20L%20786%20805%20L%20824%20767%20L%20851%20733%20L%20852%20735%20L%20846%20755%20L%20853%20750%20L%20883%20718%20L%20906%20685%20L%20927%20647%20L%20951%20589%20L%20968%20535%20L%20976%20502%20L%20982%20461%20L%20981%20422%20L%20976%20398%20L%20968%20378%20L%20969%20376%20L%20975%20383%20L%20977%20341%20L%20970%20286%20L%20958%20244%20L%20945%20215%20L%20925%20185%20L%20906%20165%20Z%20M%20625%20888%20L%20665%20870%20L%20728%20933%20L%20729%20940%20L%20726%20943%20L%20715%20944%20L%20708%20950%20L%20692%20952%20L%20678%20950%20L%20672%20947%20L%20662%20936%20Z%20M%20785%20183%20L%20792%20182%20L%20796%20186%20L%20796%20191%20L%20791%20195%20L%20785%20194%20L%20783%20191%20L%20783%20186%20Z'/%3e%3cpath%20fill='%23000000'%20d='M%20896%20157%20L%20869%20141%20L%20837%20130%20L%20817%20127%20L%20792%20127%20L%20778%20129%20L%20751%20137%20L%20733%20146%20L%20715%20159%20L%20702%20172%20L%20653%20176%20L%20610%20187%20L%20581%20203%20L%20562%20222%20L%20625%20241%20L%20671%20251%20L%20683%20257%20L%20698%20270%20L%20705%20285%20L%20704%20300%20L%20699%20309%20L%20689%20318%20L%20628%20349%20L%20581%20382%20L%20540%20421%20L%20517%20448%20L%20478%20503%20L%20456%20541%20L%20439%20575%20L%20432%20593%20L%20412%20624%20L%20388%20667%20L%20386%20676%20L%20390%20677%20L%20391%20679%20L%20363%20712%20L%20332%20753%20L%20289%20819%20L%20281%20836%20L%20281%20844%20L%20293%20842%20L%20323%20826%20L%20325%20827%20L%20284%20885%20L%20236%20964%20L%20205%201024%20L%20197%201043%20L%20191%201064%20L%20191%201070%20L%20197%201071%20L%20210%201063%20L%20253%201028%20L%20303%20983%20L%20304%20984%20L%20259%201050%20L%20235%201091%20L%20227%201115%20L%20228%201125%20L%20232%201131%20L%20238%201134%20L%20249%201135%20L%20261%201133%20L%20274%201128%20L%20278%201133%20L%20289%201137%20L%20312%201137%20L%20342%201129%20L%20368%201116%20L%20399%201093%20L%20423%201069%20L%20443%201044%20L%20463%201013%20L%20493%20990%20L%20595%20900%20L%20612%20918%20L%20639%20952%20L%20639%20957%20L%20636%20961%20L%20616%20964%20L%20606%20973%20L%20602%20984%20L%20602%20991%20L%20608%201004%20L%20611%20993%20L%20621%20985%20L%20625%20986%20L%20639%20982%20L%20657%20982%20L%20677%20990%20L%20685%201002%20L%20690%201007%20L%20697%201010%20L%20698%201021%20L%20693%201034%20L%20694%201035%20L%20705%201027%20L%20710%201018%20L%20712%201011%20L%20712%201001%20L%20710%20994%20L%20712%20993%20L%20720%201003%20L%20729%201006%20L%20731%201020%20L%20728%201032%20L%20738%201023%20L%20743%201012%20L%20743%201003%20L%20748%20994%20L%20747%20976%20L%20740%20964%20L%20743%20961%20L%20759%20961%20L%20767%20963%20L%20780%20971%20L%20790%20984%20L%20799%20986%20L%20802%20992%20L%20802%201004%20L%20799%201012%20L%20803%201011%20L%20810%201004%20L%20815%20994%20L%20814%20965%20L%20818%20969%20L%20823%20969%20L%20830%20982%20L%20830%20992%20L%20832%20992%20L%20837%20982%20L%20837%20965%20L%20831%20950%20L%20821%20940%20L%20806%20934%20L%20772%20935%20L%20762%20931%20L%20733%20901%20L%20702%20863%20L%20717%20842%20L%20718%20844%20L%20707%20862%20L%20738%20843%20L%20780%20810%20L%20822%20769%20L%20851%20733%20L%20852%20735%20L%20846%20755%20L%20855%20748%20L%20882%20719%20L%20904%20688%20L%20930%20640%20L%20950%20591%20L%20967%20538%20L%20978%20490%20L%20982%20459%20L%20982%20434%20L%20976%20399%20L%20967%20376%20L%20969%20375%20L%20975%20383%20L%20976%20329%20L%20971%20293%20L%20960%20250%20L%20942%20210%20L%20923%20183%20Z%20M%20625%20888%20L%20665%20870%20L%20729%20934%20L%20729%20940%20L%20726%20943%20L%20716%20944%20L%20708%20950%20L%20695%20952%20L%20677%20950%20L%20666%20941%20Z%20M%20786%20182%20L%20790%20181%20L%20794%20183%20L%20797%20188%20L%20792%20195%20L%20787%20195%20L%20782%20190%20L%20782%20187%20Z'/%3e%3cpath%20fill='%23000000'%20d='M%20893%20155%20L%20873%20143%20L%20841%20131%20L%20816%20127%20L%20794%20127%20L%20779%20129%20L%20754%20136%20L%20735%20145%20L%20715%20159%20L%20702%20172%20L%20648%20177%20L%20629%20181%20L%20608%20188%20L%20584%20201%20L%20562%20222%20L%20614%20238%20L%20671%20251%20L%20685%20258%20L%20698%20270%20L%20704%20281%20L%20706%20292%20L%20703%20303%20L%20699%20309%20L%20686%20320%20L%20628%20349%20L%20590%20375%20L%20565%20396%20L%20543%20418%20L%20518%20447%20L%20490%20485%20L%20460%20534%20L%20441%20571%20L%20431%20595%20L%20405%20636%20L%20386%20672%20L%20386%20676%20L%20390%20677%20L%20391%20679%20L%20371%20702%20L%20335%20749%20L%20291%20816%20L%20280%20840%20L%20282%20844%20L%20298%20840%20L%20324%20825%20L%20326%20826%20L%20294%20870%20L%20235%20966%20L%20206%201022%20L%20198%201041%20L%20191%201065%20L%20191%201070%20L%20196%201071%20L%20214%201060%20L%20254%201027%20L%20303%20983%20L%20304%20984%20L%20256%201055%20L%20232%201098%20L%20227%201115%20L%20228%201125%20L%20232%201131%20L%20239%201134%20L%20248%201135%20L%20264%201132%20L%20274%201128%20L%20280%201134%20L%20289%201137%20L%20311%201137%20L%20339%201130%20L%20371%201114%20L%20401%201091%20L%20422%201070%20L%20440%201048%20L%20463%201013%20L%20487%20995%20L%20595%20900%20L%20613%20919%20L%20639%20951%20L%20639%20958%20L%20636%20961%20L%20619%20963%20L%20613%20966%20L%20605%20975%20L%20602%20991%20L%20604%20998%20L%20608%201003%20L%20611%20993%20L%20620%20985%20L%20624%20986%20L%20632%20983%20L%20647%20981%20L%20658%20982%20L%20677%20990%20L%20689%201006%20L%20697%201009%20L%20698%201021%20L%20694%201035%20L%20703%201029%20L%20710%201018%20L%20712%201010%20L%20712%201002%20L%20710%20997%20L%20711%20992%20L%20720%201003%20L%20728%201005%20L%20730%201008%20L%20731%201021%20L%20728%201032%20L%20738%201023%20L%20742%201014%20L%20743%201003%20L%20748%20994%20L%20748%20980%20L%20742%20966%20L%20739%20963%20L%20741%20961%20L%20753%20960%20L%20770%20964%20L%20780%20971%20L%20790%20984%20L%20799%20986%20L%20802%20992%20L%20802%201005%20L%20799%201012%20L%20804%201010%20L%20809%201005%20L%20815%20993%20L%20813%20964%20L%20817%20968%20L%20823%20969%20L%20826%20972%20L%20830%20982%20L%20831%20992%20L%20834%20989%20L%20838%20975%20L%20837%20966%20L%20831%20950%20L%20821%20940%20L%20804%20934%20L%20779%20936%20L%20763%20932%20L%20731%20899%20L%20702%20865%20L%20702%20863%20L%20717%20842%20L%20718%20844%20L%20708%20862%20L%20749%20835%20L%20781%20809%20L%20820%20771%20L%20851%20733%20L%20852%20736%20L%20846%20755%20L%20857%20746%20L%20881%20720%20L%20907%20683%20L%20928%20644%20L%20945%20604%20L%20967%20537%20L%20978%20489%20L%20982%20455%20L%20982%20437%20L%20979%20413%20L%20975%20396%20L%20967%20377%20L%20968%20374%20L%20975%20382%20L%20976%20332%20L%20972%20299%20L%20962%20257%20L%20954%20235%20L%20943%20212%20L%20923%20183%20Z%20M%20624%20888%20L%20666%20870%20L%20729%20934%20L%20729%20940%20L%20726%20943%20L%20716%20944%20L%20706%20951%20L%20684%20952%20L%20677%20950%20L%20665%20940%20Z%20M%20701%20220%20L%20710%20219%20L%20717%20221%20L%20704%20223%20L%20704%20221%20Z%20M%20666%20217%20L%20679%20216%20L%20689%20218%20L%20685%20220%20L%20675%20220%20Z%20M%20658%20210%20L%20661%20208%20L%20686%20205%20L%20706%20206%20L%20725%20209%20L%20733%20217%20L%20741%20220%20L%20738%20221%20L%20696%20214%20L%20661%20212%20Z%20M%20788%20181%20L%20793%20182%20L%20797%20188%20L%20792%20195%20L%20786%20195%20L%20782%20190%20L%20783%20185%20Z'/%3e%3cpath%20fill='%23000000'%20d='M%20893%20155%20L%20864%20139%20L%20836%20130%20L%20813%20127%20L%20796%20127%20L%20774%20130%20L%20749%20138%20L%20735%20145%20L%20720%20155%20L%20702%20172%20L%20687%20173%20L%20700%20174%20L%20694%20181%20L%20674%20184%20L%20670%20180%20L%20665%20183%20L%20657%20184%20L%20639%20196%20L%20641%20198%20L%20647%20198%20L%20648%20194%20L%20654%20193%20L%20686%20204%20L%20724%20208%20L%20740%20213%20L%20751%20222%20L%20750%20223%20L%20693%20214%20L%20671%20212%20L%20639%20212%20L%20636%20211%20L%20634%20207%20L%20629%20207%20L%20626%20210%20L%20617%20210%20L%20614%20208%20L%20604%20207%20L%20594%20213%20L%20582%20216%20L%20580%20214%20L%20581%20210%20L%20576%20208%20L%20586%20200%20L%20565%20218%20L%20563%20222%20L%20618%20239%20L%20671%20251%20L%20682%20256%20L%20689%20261%20L%20702%20276%20L%20706%20288%20L%20704%20301%20L%20700%20308%20L%20683%20322%20L%20630%20348%20L%20585%20379%20L%20563%20398%20L%20523%20441%20L%20497%20475%20L%20459%20536%20L%20443%20567%20L%20431%20595%20L%20411%20626%20L%20387%20670%20L%20386%20676%20L%20390%20677%20L%20391%20679%20L%20368%20706%20L%20333%20752%20L%20290%20818%20L%20281%20837%20L%20282%20844%20L%20300%20839%20L%20324%20825%20L%20326%20826%20L%20285%20884%20L%20242%20954%20L%20207%201020%20L%20192%201060%20L%20192%201071%20L%20196%201071%20L%20211%201062%20L%20240%201039%20L%20303%20983%20L%20305%20984%20L%20277%201023%20L%20242%201078%20L%20228%201110%20L%20227%201119%20L%20231%201130%20L%20239%201134%20L%20255%201134%20L%20274%201128%20L%20280%201134%20L%20285%201136%20L%20310%201137%20L%20339%201130%20L%20374%201112%20L%20394%201097%20L%20421%201071%20L%20445%201041%20L%20463%201013%20L%20488%20994%20L%20595%20900%20L%20614%20920%20L%20639%20951%20L%20639%20958%20L%20636%20961%20L%20619%20963%20L%20613%20966%20L%20607%20972%20L%20603%20980%20L%20602%20989%20L%20603%20995%20L%20608%201003%20L%20610%20994%20L%20620%20985%20L%20623%20986%20L%20631%20983%20L%20647%20981%20L%20665%20984%20L%20676%20989%20L%20689%201006%20L%20695%201007%20L%20697%201009%20L%20698%201023%20L%20694%201035%20L%20699%201032%20L%20709%201020%20L%20712%201010%20L%20710%20997%20L%20711%20992%20L%20719%201002%20L%20725%201005%20L%20727%201004%20L%20730%201008%20L%20731%201022%20L%20728%201032%20L%20739%201021%20L%20743%201010%20L%20743%201003%20L%20748%20993%20L%20748%20981%20L%20746%20974%20L%20739%20963%20L%20741%20961%20L%20755%20960%20L%20770%20964%20L%20779%20970%20L%20789%20983%20L%20799%20986%20L%20802%20992%20L%20802%201005%20L%20799%201012%20L%20808%201006%20L%20815%20993%20L%20813%20964%20L%20817%20968%20L%20825%20970%20L%20829%20978%20L%20831%20992%20L%20837%20981%20L%20837%20966%20L%20832%20952%20L%20822%20941%20L%20813%20936%20L%20803%20934%20L%20776%20936%20L%20763%20932%20L%20723%20890%20L%20702%20865%20L%20702%20863%20L%20717%20841%20L%20719%20842%20L%20708%20862%20L%20742%20840%20L%20782%20808%20L%20818%20773%20L%20851%20733%20L%20852%20736%20L%20846%20754%20L%20850%20752%20L%20881%20720%20L%20905%20686%20L%20932%20635%20L%20950%20590%20L%20969%20529%20L%20977%20494%20L%20982%20454%20L%20980%20419%20L%20975%20396%20L%20967%20377%20L%20968%20374%20L%20975%20382%20L%20976%20334%20L%20969%20284%20L%20959%20248%20L%20941%20209%20L%20921%20181%20Z%20M%20624%20888%20L%20666%20870%20L%20729%20934%20L%20729%20941%20L%20724%20944%20L%20716%20944%20L%20707%20951%20L%20683%20952%20L%20673%20948%20L%20659%20933%20Z%20M%20563%20618%20L%20569%20614%20L%20579%20621%20L%20576%20626%20L%20572%20627%20L%20568%20623%20L%20565%20623%20Z%20M%20575%20603%20L%20578%20603%20L%20588%20613%20L%20588%20619%20L%20585%20621%20L%20582%20620%20L%20575%20613%20L%20576%20612%20L%20573%20605%20Z%20M%20748%20398%20L%20752%20412%20L%20752%20432%20L%20748%20444%20L%20732%20470%20L%20716%20484%20L%20698%20493%20L%20685%20494%20L%20682%20491%20L%20707%20445%20L%20685%20473%20L%20667%20492%20L%20647%20508%20L%20632%20517%20L%20619%20519%20L%20615%20517%20L%20615%20513%20L%20643%20470%20L%20603%20514%20L%20589%20526%20L%20569%20538%20L%20558%20540%20L%20554%20539%20L%20552%20535%20L%20577%20498%20L%20549%20528%20L%20526%20546%20L%20508%20554%20L%20498%20555%20L%20495%20552%20L%20501%20541%20L%20482%20555%20L%20471%20558%20L%20464%20558%20L%20461%20560%20L%20460%20559%20L%20461%20555%20L%20469%20547%20L%20473%20537%20L%20491%20512%20L%20511%20497%20L%20582%20434%20L%20617%20408%20L%20632%20399%20L%20659%20386%20L%20677%20380%20L%20695%20377%20L%20712%20377%20L%20725%20380%20L%20739%20388%20Z%20M%20625%20216%20L%20683%20216%20L%20737%20222%20L%20742%20224%20L%20733%20226%20L%20721%20225%20L%20713%20230%20L%20711%20228%20L%20706%20228%20L%20694%20237%20L%20690%20233%20L%20690%20225%20L%20679%20228%20L%20674%20232%20L%20668%20232%20L%20659%20229%20L%20649%20222%20L%20632%20219%20L%20632%20217%20Z%20M%20788%20181%20L%20793%20182%20L%20797%20187%20L%20795%20193%20L%20792%20195%20L%20786%20195%20L%20782%20190%20L%20783%20185%20Z'/%3e%3cpath%20fill='%23000000'%20d='M%20607%20972%20L%20603%20981%20L%20603%20995%20L%20608%201003%20L%20610%20994%20L%20616%20987%20L%20620%20985%20L%20627%20985%20L%20635%20982%20L%20655%20981%20L%20676%20989%20L%20683%20996%20L%20689%201006%20L%20695%201007%20L%20697%201009%20L%20698%201024%20L%20694%201034%20L%20699%201032%20L%20706%201025%20L%20712%201010%20L%20710%20994%20L%20709%20997%20L%20706%20994%20L%20700%20994%20L%20694%20997%20L%20672%20976%20L%20658%20974%20L%20647%20967%20L%20642%20974%20L%20638%20974%20L%20636%20972%20L%20636%20961%20L%20629%20963%20L%20631%20972%20L%20625%20977%20L%20620%20977%20L%20613%20967%20L%20614%20966%20Z%20M%20686%20966%20L%20704%20980%20L%20719%201002%20L%20727%201004%20L%20730%201007%20L%20731%201023%20L%20728%201032%20L%20731%201030%20L%20741%201017%20L%20743%201003%20L%20748%20992%20L%20748%20981%20L%20742%20967%20L%20740%20965%20L%20742%20968%20L%20735%20972%20L%20726%20965%20L%20705%20960%20L%20724%20968%20L%20740%20983%20L%20742%20987%20L%20740%20991%20L%20732%20991%20L%20728%20996%20L%20726%20996%20L%20721%20992%20L%20713%20979%20Z%20M%20784%20943%20L%20784%20946%20L%20798%20950%20L%20819%20969%20L%20825%20970%20L%20830%20981%20L%20831%20992%20L%20837%20981%20L%20837%20966%20L%20829%20948%20L%20825%20944%20L%20830%20950%20L%20821%20957%20L%20813%20951%20L%20794%20942%20Z%20M%20659%20933%20L%20662%20937%20L%20658%20942%20L%20658%20945%20L%20663%20947%20L%20666%20945%20L%20667%20946%20L%20668%20944%20L%20670%20946%20Z%20M%20643%20913%20L%20647%20918%20L%20644%20921%20L%20642%20928%20L%20629%20938%20L%20627%20936%20L%20636%20947%20L%20634%20945%20L%20641%20933%20L%20651%20923%20L%20657%20930%20Z%20M%20936%20310%20L%20934%20309%20L%20945%20338%20L%20949%20368%20L%20949%20381%20L%20947%20383%20L%20935%20367%20L%20914%20348%20L%20929%20377%20L%20934%20397%20L%20936%20414%20L%20935%20440%20L%20933%20442%20L%20930%20440%20L%20924%20419%20L%20912%20395%20L%20909%20393%20L%20910%20410%20L%20907%20433%20L%20899%20458%20L%20895%20462%20L%20893%20460%20L%20892%20445%20L%20888%20427%20L%20873%20390%20L%20873%20416%20L%20871%20430%20L%20866%20448%20L%20862%20454%20L%20859%20452%20L%20853%20433%20L%20842%20410%20L%20823%20382%20L%20807%20365%20L%20805%20366%20L%20811%20394%20L%20812%20416%20L%20810%20425%20L%20806%20428%20L%20801%20423%20L%20790%20403%20L%20772%20383%20L%20759%20372%20L%20733%20357%20L%20724%20355%20L%20705%20346%20L%20693%20344%20L%20669%20344%20L%20646%20349%20L%20636%20353%20L%20662%20349%20L%20677%20349%20L%20699%20353%20L%20708%20356%20L%20725%20366%20L%20736%20376%20L%20745%20389%20L%20753%20415%20L%20752%20442%20L%20743%20476%20L%20723%20520%20L%20693%20569%20L%20646%20631%20L%20605%20676%20L%20568%20709%20L%20565%20710%20L%20562%20706%20L%20562%20692%20L%20567%20665%20L%20578%20636%20L%20602%20619%20L%20622%20602%20L%20645%20578%20L%20670%20546%20L%20630%20588%20L%20603%20610%20L%20574%20628%20L%20560%20633%20L%20556%20633%20L%20555%20631%20L%20563%20617%20L%20596%20572%20L%20647%20509%20L%20636%20515%20L%20562%20609%20L%20541%20630%20L%20520%20645%20L%20502%20653%20L%20490%20653%20L%20536%20590%20L%20513%20617%20L%20478%20651%20L%20454%20665%20L%20440%20669%20L%20436%20667%20L%20488%20596%20L%20459%20630%20L%20436%20653%20L%20411%20671%20L%20392%20678%20L%20372%20701%20L%20319%20772%20L%20289%20820%20L%20281%20838%20L%20282%20844%20L%20295%20841%20L%20324%20825%20L%20326%20826%20L%20289%20878%20L%20242%20954%20L%20209%201016%20L%20193%201056%20L%20191%201069%20L%20192%201071%20L%20196%201071%20L%20219%201056%20L%20303%20983%20L%20305%20984%20L%20255%201057%20L%20234%201094%20L%20228%201111%20L%20228%201124%20L%20234%201132%20L%20240%201134%20L%20254%201134%20L%20275%201128%20L%20279%201133%20L%20291%201137%20L%20316%201136%20L%20344%201128%20L%20364%201118%20L%20389%201101%20L%20403%201089%20L%20427%201064%20L%20447%201038%20L%20463%201013%20L%20489%20993%20L%20594%20901%20L%20595%20899%20L%20593%20894%20L%20588%20891%20L%20567%20868%20L%20569%20865%20L%20576%20867%20L%20586%20873%20L%20589%20867%20L%20607%20867%20L%20619%20880%20L%20622%20887%20L%20626%20891%20L%20624%20889%20L%20626%20886%20L%20666%20870%20L%20705%20909%20L%20710%20905%20L%20713%20905%20L%20716%20908%20L%20716%20911%20L%20712%20916%20L%20728%20932%20L%20730%20939%20L%20727%20943%20L%20717%20944%20L%20710%20949%20L%20712%20948%20L%20725%20951%20L%20739%20963%20L%20740%20961%20L%20756%20960%20L%20774%20966%20L%20784%20975%20L%20789%20983%20L%20800%20987%20L%20802%20991%20L%20802%201005%20L%20799%201012%20L%20806%201008%20L%20811%201002%20L%20815%20993%20L%20813%20968%20L%20812%20973%20L%20807%20971%20L%20796%20976%20L%20791%20973%20L%20788%20967%20L%20779%20958%20L%20767%20952%20L%20762%20941%20L%20756%20940%20L%20751%20932%20L%20749%20931%20L%20743%20936%20L%20738%20936%20L%20736%20933%20L%20741%20925%20L%20739%20915%20L%20742%20912%20L%20745%20914%20L%20702%20865%20L%20702%20863%20L%20717%20841%20L%20719%20842%20L%20709%20861%20L%20746%20837%20L%20783%20807%20L%20826%20764%20L%20851%20732%20L%20853%20734%20L%20846%20754%20L%20851%20751%20L%20874%20728%20L%20890%20708%20L%20908%20681%20L%20938%20621%20L%20960%20560%20L%20971%20521%20L%20979%20481%20L%20982%20444%20L%20977%20405%20L%20970%20382%20L%20966%20375%20L%20968%20374%20L%20974%20381%20L%20975%20368%20L%20974%20372%20L%20968%20364%20L%20966%20354%20L%20957%20337%20Z%20M%20247%201077%20L%20251%201085%20L%20246%201088%20L%20245%201091%20L%20240%201092%20L%20239%201085%20L%20241%201081%20Z%20M%20370%20935%20L%20371%20937%20L%20326%20997%20L%20301%201034%20L%20289%201044%20L%20286%201042%20L%20283%201045%20L%20277%201045%20L%20273%201043%20L%20264%201052%20L%20261%201049%20L%20270%201037%20L%20271%201038%20L%20281%201027%20L%20293%201010%20L%20326%20971%20Z%20M%20726%20921%20L%20728%20921%20L%20731%20926%20L%20729%20933%20L%20722%20926%20Z%20M%20729%20897%20L%20734%20902%20L%20732%20906%20L%20726%20902%20L%20726%20899%20Z%20M%20715%20882%20L%20720%20886%20L%20718%20890%20L%20711%20887%20Z%20M%20605%20762%20L%20608%20761%20L%20607%20760%20L%20609%20757%20L%20610%20759%20L%20617%20761%20L%20620%20764%20L%20611%20770%20L%20607%20770%20L%20606%20765%20L%20608%20765%20Z%20M%20611%20754%20L%20617%20750%20L%20620%20751%20L%20621%20749%20L%20625%20749%20L%20628%20752%20L%20628%20756%20L%20623%20761%20Z%20M%20549%20710%20L%20551%20713%20L%20551%20722%20L%20506%20774%20L%20403%20878%20L%20309%20963%20L%20307%20961%20L%20313%20953%20L%20322%20945%20L%20340%20922%20L%20375%20885%20Z%20M%20695%20704%20L%20696%20708%20L%20698%20709%20L%20695%20710%20L%20695%20713%20L%20692%20715%20L%20688%20710%20Z%20M%20704%20694%20L%20706%20695%20L%20706%20698%20L%20710%20698%20L%20713%20703%20L%20708%20708%20L%20707%20714%20L%20705%20716%20L%20701%20716%20L%20697%20708%20L%20699%20706%20L%20697%20705%20L%20701%20701%20L%20704%20705%20L%20706%20704%20L%20706%20700%20L%20702%20697%20Z%20M%20552%20678%20L%20554%20681%20L%20552%20701%20L%20465%20787%20L%20361%20883%20L%20316%20927%20L%20253%20993%20L%20211%201042%20L%20211%201036%20L%20222%201011%20L%20261%20942%20L%20292%20898%20L%20338%20843%20L%20374%20807%20L%20387%20807%20L%20403%20801%20L%20419%20792%20L%20456%20766%20L%20500%20728%20Z%20M%20704%20654%20L%20706%20658%20L%20711%20658%20L%20714%20661%20L%20715%20673%20L%20713%20676%20L%20705%20676%20L%20702%20674%20L%20704%20677%20L%20704%20681%20L%20702%20682%20L%20704%20685%20L%20700%20686%20L%20694%20678%20L%20691%20678%20L%20688%20674%20L%20692%20670%20L%20692%20664%20L%20694%20661%20Z%20M%20565%20642%20L%20558%20663%20L%20545%20677%20L%20494%20726%20L%20443%20767%20L%20401%20792%20L%20392%20795%20L%20387%20794%20L%20405%20766%20L%20455%20707%20L%20388%20767%20L%20355%20794%20L%20304%20827%20L%20299%20826%20L%20302%20817%20L%20316%20795%20L%20360%20739%20L%20398%20700%20L%20425%20677%20L%20428%20679%20L%20443%20679%20L%20461%20673%20L%20476%20664%20L%20493%20666%20L%20517%20657%20L%20542%20641%20L%20546%20643%20Z%20M%20563%20221%20L%20572%20225%20L%20571%20223%20L%20574%20220%20L%20585%20217%20L%20596%20218%20L%20607%20215%20L%20653%20214%20L%20706%20218%20L%20749%20224%20L%20749%20226%20L%20735%20233%20L%20732%20238%20L%20732%20249%20L%20693%20242%20L%20620%20239%20L%20672%20251%20L%20688%20260%20L%20701%20274%20L%20706%20287%20L%20704%20301%20L%20707%20297%20L%20711%20300%20L%20713%20309%20L%20720%20324%20L%20723%20327%20L%20724%20308%20L%20726%20304%20L%20735%20318%20L%20757%20341%20L%20753%20319%20L%20754%20313%20L%20760%20317%20L%20786%20345%20L%20784%20324%20L%20775%20300%20L%20779%20300%20L%20800%20317%20L%20800%20312%20L%20787%20283%20L%20772%20264%20L%20778%20263%20L%20800%20271%20L%20803%20270%20L%20770%20236%20L%20772%20234%20L%20797%20234%20L%20807%20230%20L%20801%20230%20L%20800%20228%20L%20811%20218%20L%20818%20203%20L%20818%20193%20L%20812%20179%20L%20798%20168%20L%20784%20166%20L%20760%20173%20L%20747%20173%20L%20712%20163%20L%20718%20157%20L%20703%20171%20L%20711%20173%20L%20720%20178%20L%20723%20182%20L%20720%20186%20L%20695%20190%20L%20680%20190%20L%20670%20193%20L%20656%20193%20L%20687%20204%20L%20729%20209%20L%20742%20214%20L%20753%20223%20L%20752%20224%20L%20729%20219%20L%20669%20212%20L%20610%20213%20L%20576%20218%20L%20565%20221%20L%20565%20219%20Z%20M%20771%20189%20L%20772%20201%20L%20775%20207%20L%20780%20212%20L%20787%20215%20L%20796%20216%20L%20796%20218%20L%20784%20219%20L%20776%20215%20L%20771%20210%20L%20768%20204%20L%20768%20194%20Z%20M%20788%20181%20L%20793%20182%20L%20797%20187%20L%20796%20192%20L%20790%20196%20L%20786%20195%20L%20782%20191%20L%20782%20186%20Z'/%3e%3c/g%3e%3c/svg%3e`;function Re({className:e}){return(0,M.jsx)(`span`,{className:`block overflow-hidden rounded-[20.7%] bg-accent ${e??``}`,children:(0,M.jsx)(`img`,{src:Le,alt:``,"aria-hidden":`true`,className:`h-full w-full`})})}function ze(){return(0,M.jsxs)(M.Fragment,{children:[(0,M.jsx)(Re,{className:`h-[22px] w-[22px] shrink-0`}),(0,M.jsx)(`span`,{className:`hidden text-[16px] font-medium tracking-[0.04em] text-ink-50 md:inline`,children:`nightcrow`})]})}function Be({open:e}){return(0,M.jsx)(`svg`,{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2.5`,strokeLinecap:`round`,strokeLinejoin:`round`,"aria-hidden":`true`,focusable:`false`,className:`h-3.5 w-3.5 shrink-0 transition-transform ${e?`rotate-90`:``}`,children:(0,M.jsx)(`path`,{d:`m9 18 6-6-6-6`})})}function Ve({className:e=`h-4 w-4`}){return(0,M.jsxs)(`svg`,{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,"aria-hidden":`true`,focusable:`false`,className:`shrink-0 ${e}`,children:[(0,M.jsx)(`path`,{d:`M3 6h.01`}),(0,M.jsx)(`path`,{d:`M3 12h.01`}),(0,M.jsx)(`path`,{d:`M3 18h.01`}),(0,M.jsx)(`path`,{d:`M8 6h13`}),(0,M.jsx)(`path`,{d:`M8 12h13`}),(0,M.jsx)(`path`,{d:`M8 18h13`})]})}function He({className:e=`h-4 w-4`}){return(0,M.jsxs)(`svg`,{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,"aria-hidden":`true`,focusable:`false`,className:`shrink-0 ${e}`,children:[(0,M.jsx)(`path`,{d:`M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z`}),(0,M.jsx)(`path`,{d:`M14 2v4a2 2 0 0 0 2 2h4`}),(0,M.jsx)(`path`,{d:`M10 9H8`}),(0,M.jsx)(`path`,{d:`M16 13H8`}),(0,M.jsx)(`path`,{d:`M16 17H8`})]})}function Ue({className:e=`h-4 w-4`}){return(0,M.jsxs)(`svg`,{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,"aria-hidden":`true`,focusable:`false`,className:`shrink-0 ${e}`,children:[(0,M.jsx)(`path`,{d:`m4 17 6-6-6-6`}),(0,M.jsx)(`path`,{d:`M12 19h8`})]})}function We({repos:e,currentId:t,onSelect:n,onCloseProject:r,onOpenPicker:i,className:a=``}){let[o,s]=(0,j.useState)(!1),c=S(),l=(0,j.useRef)(null),u=e.find(e=>e.id===t);return(0,j.useEffect)(()=>{if(!o)return;let e=e=>{e.key===`Escape`&&(s(!1),l.current?.focus())};return document.addEventListener(`keydown`,e),()=>document.removeEventListener(`keydown`,e)},[o]),(0,M.jsxs)(`div`,{className:`relative min-w-0 flex-1 ${a}`,children:[(0,M.jsxs)(`button`,{ref:l,onClick:()=>s(e=>!e),"aria-haspopup":`menu`,"aria-expanded":o,title:u?.display_path??`Select a project`,className:`flex min-w-0 max-w-full items-center gap-1 rounded-sm bg-ink-700 py-0.5 pl-2 pr-1 text-ink-50`,children:[(0,M.jsx)(`span`,{className:`truncate`,children:u?.name??`No project`}),(0,M.jsx)(Be,{open:o})]}),o&&(0,M.jsxs)(M.Fragment,{children:[(0,M.jsx)(`div`,{className:`fixed inset-0 z-40`,onClick:()=>s(!1)}),(0,M.jsxs)(`div`,{role:`menu`,className:`nc-pop-in origin-top-left absolute left-0 z-50 mt-1 max-h-[70vh] w-56 max-w-[80vw] overflow-y-auto rounded-md border border-ink-700 bg-ink-900 py-1 shadow-lg`,children:[e.length===0&&(0,M.jsx)(`p`,{className:`px-3 py-1.5 text-ink-400`,children:`No projects open.`}),e.map(e=>(0,M.jsxs)(`div`,{className:`flex items-center ${e.id===t?`bg-ink-700 text-ink-50`:`text-ink-200`}`,children:[(0,M.jsx)(`button`,{role:`menuitem`,onClick:()=>{n(e.id),s(!1)},title:e.display_path,className:`min-w-0 flex-1 truncate py-1.5 pl-3 pr-1 text-left hover:text-accent`,children:e.name}),(0,M.jsx)(`button`,{onClick:()=>r(e.id),"aria-label":`close ${e.name}`,...e.id===t?c(`project.close`,`Close project`):{title:`Close project`},className:`mr-1 flex h-6 w-6 shrink-0 items-center justify-center rounded-sm text-ink-400 hover:text-removed`,children:(0,M.jsx)(pe,{className:`h-3.5 w-3.5`})})]},e.id)),(0,M.jsx)(`div`,{className:`my-1 border-t border-ink-800`}),(0,M.jsxs)(`button`,{role:`menuitem`,onClick:()=>{i(),s(!1)},...c(`project.openDialog`,`Open a project`),className:`flex w-full items-center gap-1 px-3 py-1.5 text-left text-ink-400 hover:text-ink-200`,children:[(0,M.jsx)(re,{className:`h-3.5 w-3.5`}),`open`]})]})]})]})}function Ge({side:e,repos:t,repo:n,onSelectRepo:r,onCloseRepo:i,onOpenPicker:o,draggingRepo:s,dragOverRepo:c,onRepoDragStart:l,onRepoDragMove:f,onRepoDragEnd:p}){let m=S(),h=d(),g=t.length>1?[`project.previous`,`project.next`]:[],_=e=>e!==null,v=g.map(e=>w(e,h)).filter(_),y=g.map(e=>u(e,h)).filter(_),b=e===`left`;return(0,M.jsxs)(M.Fragment,{children:[(0,M.jsx)(`nav`,{"aria-keyshortcuts":v.length>0?v.join(` `):void 0,title:y.length>0?`Previous or next project (${y.join(`, `)})`:void 0,className:b?`hidden min-h-0 flex-1 flex-col overflow-y-auto md:flex`:`hidden items-stretch self-stretch overflow-x-auto pl-1 md:flex`,children:t.map(e=>(0,M.jsxs)(`div`,{"data-repo-id":e.id,onPointerDown:t=>l(t,e.id),onPointerMove:f,onPointerUp:p,onPointerCancel:p,onLostPointerCapture:p,"data-active":e.id===n,className:`nc-title-target flex items-center whitespace-nowrap ${b?`min-w-0 border-b border-ink-700`:`border-r border-ink-700`} ${t.length>1?`touch-none`:``} ${s===e.id?`opacity-60`:``} ${c===e.id?`bg-ink-800 ring-1 ring-inset ring-accent`:``} ${e.id===n?b?`bg-ink-900 text-ink-50 shadow-[inset_1px_0_0_0_var(--color-accent)]`:`bg-ink-950 text-ink-50 shadow-[inset_0_-1px_0_0_var(--color-accent)]`:`text-ink-400 hover:bg-ink-850 hover:text-ink-200`}`,title:e.display_path,children:[(0,M.jsx)(`button`,{onClick:()=>{r(e.id)},"aria-label":e.name,className:`self-stretch pl-3 pr-1 text-left ${b?`min-w-0 flex-1 py-2`:``}`,children:(0,M.jsx)(Te,{title:e.name,className:b?``:a})}),(0,M.jsx)(`button`,{onClick:t=>{t.stopPropagation(),i(e.id)},"data-tab-close":!0,...e.id===n?m(`project.close`,`Close project`):{title:`Close project`},"aria-label":`close ${e.name}`,className:`mr-1 flex h-6 w-6 shrink-0 items-center justify-center rounded-sm text-ink-400 hover:text-removed`,children:(0,M.jsx)(pe,{className:`h-3.5 w-3.5`})})]},e.id))}),(0,M.jsxs)(`button`,{onClick:o,...m(`project.openDialog`,`Open a project`),className:`hidden shrink-0 items-center gap-1 rounded-sm px-2 py-0.5 text-ink-400 hover:text-accent md:inline-flex ${b?`mx-1 my-2 justify-center`:``}`,children:[(0,M.jsx)(re,{className:`h-3.5 w-3.5`}),`open`]})]})}var Ke={key:()=>Ae(`/api/push/key`).then(e=>e.public_key),subscribe:e=>k(`/api/push/subscribe`,e),unsubscribe:e=>k(`/api/push/unsubscribe`,{endpoint:e}),status:e=>k(`/api/push/status`,{endpoint:e}).then(e=>e.subscribed),test:e=>k(`/api/push/test`,{endpoint:e})};function qe(){let e=navigator;return{secure:window.isSecureContext,serviceWorker:`serviceWorker`in navigator?navigator.serviceWorker:void 0,hasPushManager:`PushManager`in window,permission:()=>typeof Notification>`u`?void 0:Notification.permission,requestPermission:()=>Notification.requestPermission(),isIos:/iPhone|iPad|iPod/.test(navigator.userAgent)||/Macintosh/.test(navigator.userAgent)&&navigator.maxTouchPoints>1,standalone:e.standalone===!0||window.matchMedia?.(`(display-mode: standalone)`).matches===!0}}function Je(e){return e.secure?e.isIos&&!e.standalone?`needs-install`:!e.serviceWorker||!e.hasPushManager||e.permission()===void 0?`unsupported`:e.permission()===`denied`?`denied`:null:`insecure`}function Ye(e){e.secure&&e.serviceWorker&&e.serviceWorker.register(`./sw.js`).catch(()=>{})}async function Xe(e){return(await e.serviceWorker.ready).pushManager.getSubscription()}async function Ze(e){let t=Je(e);if(t)return t;let n=await Xe(e);return n?await Ke.status(n.endpoint)?`on`:(await n.unsubscribe().catch(()=>!1),`off`):`off`}async function Qe(e){let t=Je(e);if(t)return t;let n=await e.requestPermission();if(n===`denied`)return`denied`;if(n!==`granted`)return`off`;let r;try{r=await Ke.key()}catch{return`unavailable`}let i=await e.serviceWorker.ready;await(await i.pushManager.getSubscription())?.unsubscribe();let a=await i.pushManager.subscribe({userVisibleOnly:!0,applicationServerKey:tt(r)});return await Ke.subscribe(a.toJSON()),`on`}async function $e(e){let t=await Xe(e);return t&&(await Ke.unsubscribe(t.endpoint).catch(()=>void 0),await t.unsubscribe().catch(()=>!1)),Je(e)??`off`}async function et(e){let t=await Xe(e);if(!t)throw Error(`notifications are off in this browser`);await Ke.test(t.endpoint)}function tt(e){let t=e.replace(/-/g,`+`).replace(/_/g,`/`),n=t+`=`.repeat((4-t.length%4)%4),r=atob(n),i=new Uint8Array(new ArrayBuffer(r.length));for(let e=0;e{let e=!1;return Ze(a).then(t=>!e&&n(t)).catch(()=>!e&&n(`off`)),()=>{e=!0}},[a]);let o=(0,j.useCallback)(async(e,t)=>{i(!0);try{let t=await e();return t&&n(t),!0}catch(e){return E.error(e instanceof Error?`${t}: ${e.message}`:t),!1}finally{i(!1)}},[]);return{state:t,busy:r,enable:()=>o(()=>Qe(a),`could not turn notifications on`),disable:()=>o(()=>$e(a),`could not turn notifications off`),test:async()=>{await o(()=>et(a),`could not send a test`)&&E.info(`Test notification sent`)}}}var rt={unsupported:`This browser does not support notifications.`,insecure:`Notifications need HTTPS or localhost. See the notifications guide for tailscale serve.`,"needs-install":`On iPhone and iPad, add nightcrow to the Home Screen and open it from there first.`,denied:`Notifications are blocked for this site. Allow them in the browser's site settings.`,unavailable:`The server could not load its notification key. Check the daemon log.`},it=`rounded-sm px-2 py-1 text-ink-200 hover:bg-ink-700 disabled:cursor-progress disabled:text-ink-400 disabled:hover:bg-transparent`;function at(){let{state:e,busy:t,enable:n,disable:r,test:i}=nt(),a=e?rt[e]:void 0;return(0,M.jsxs)(`section`,{"aria-labelledby":`nc-notifications-title`,className:`border-t border-ink-800 px-3 py-2`,children:[(0,M.jsx)(`h3`,{id:`nc-notifications-title`,className:`mb-1 text-xs uppercase tracking-wide text-ink-400`,children:`Notifications`}),(0,M.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,M.jsx)(`span`,{className:`min-w-0 flex-1 text-ink-200`,children:`When a terminal asks for you`}),(e===`off`||e===`on`)&&(0,M.jsx)(`button`,{type:`button`,role:`switch`,"aria-checked":e===`on`,"aria-busy":t,disabled:t,onClick:e===`on`?r:n,className:it,children:e===`on`?`On`:`Off`}),e===null&&(0,M.jsx)(`span`,{className:`text-ink-400`,children:`…`})]}),a&&(0,M.jsx)(`p`,{className:`mt-1 text-xs text-ink-400`,children:a}),e===`on`&&(0,M.jsx)(`button`,{type:`button`,disabled:t,onClick:i,className:`mt-1 ${it}`,children:`Send a test notification`})]})}var ot=`nc-settings-title`,st=`nc-settings-dialog`,ct=`nc-screen-scale`;function lt({accent:e,next:t,cycle:n,onReloadConfig:r,reloading:a,onShowShortcuts:o}){let[s,l]=(0,j.useState)(!1),u=(0,j.useRef)(null),d=(0,j.useRef)(null),{scale:f,setScale:p}=i(),m=S();(0,j.useLayoutEffect)(()=>{if(!s)return;let e=d.current;if(!e)return;e.querySelector(`[data-initial-focus]`)?.focus();let t=()=>[...e.querySelectorAll(`a[href], button:not(:disabled), select:not(:disabled), input:not(:disabled), [tabindex]:not([tabindex="-1"])`)],n=n=>{if(n.key===`Escape`){n.preventDefault(),l(!1),u.current?.focus();return}if(n.key!==`Tab`)return;let r=t(),i=r[0],a=r.at(-1);!i||!a?(n.preventDefault(),e.focus()):n.shiftKey&&document.activeElement===i?(n.preventDefault(),a.focus()):!n.shiftKey&&document.activeElement===a&&(n.preventDefault(),i.focus())},r=t=>{let n=t.target;n instanceof Node&&!e.contains(n)&&!u.current?.contains(n)&&l(!1)};return document.addEventListener(`keydown`,n),document.addEventListener(`pointerdown`,r),()=>{document.removeEventListener(`keydown`,n),document.removeEventListener(`pointerdown`,r)}},[s]);let g=()=>{l(!1),u.current?.focus(),o()};return(0,M.jsxs)(M.Fragment,{children:[(0,M.jsx)(`button`,{ref:u,type:`button`,onClick:()=>l(e=>!e),"aria-label":`Settings`,"aria-haspopup":`dialog`,"aria-expanded":s,"aria-controls":st,title:`Settings`,className:`ml-auto flex h-6 w-6 shrink-0 items-center justify-center rounded-sm text-ink-400 hover:text-accent`,children:(0,M.jsx)(oe,{className:`h-3.5 w-3.5`})}),s&&(0,M.jsxs)(`div`,{ref:d,id:st,role:`dialog`,"aria-labelledby":ot,tabIndex:-1,className:`nc-pop-in origin-top-right fixed right-2 top-[calc(var(--nc-header-h)+8px)] z-50 flex max-h-[calc(100vh-3.75rem)] w-72 max-w-[calc(100vw-1rem)] flex-col overflow-y-auto rounded-md border border-ink-700 bg-ink-900 shadow-xl focus:outline-none`,style:{maxHeight:`calc(100dvh - 3.75rem)`},children:[(0,M.jsx)(`div`,{className:`border-b border-ink-700 px-3 py-2`,children:(0,M.jsx)(`h2`,{id:ot,className:`font-medium text-ink-50`,children:`Settings`})}),(0,M.jsxs)(`section`,{"aria-labelledby":`nc-appearance-title`,className:`px-3 py-2`,children:[(0,M.jsx)(`h3`,{id:`nc-appearance-title`,className:`mb-1 text-xs uppercase tracking-wide text-ink-400`,children:`Appearance`}),(0,M.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,M.jsx)(`span`,{className:`min-w-0 flex-1 text-ink-200`,children:`Accent colour`}),(0,M.jsxs)(`button`,{type:`button`,"data-initial-focus":!0,onClick:n,...m(`session.cycleAccent`,`Accent: ${e.name} (click for ${t.name})`),"aria-label":`accent colour: ${e.name}, click for ${t.name}`,className:`flex items-center gap-1.5 rounded-sm px-2 py-1 text-ink-200 hover:bg-ink-700`,children:[(0,M.jsx)(`span`,{"aria-hidden":`true`,className:`h-3 w-3 rounded-full bg-accent ring-1 ring-ink-600`}),e.name]})]}),(0,M.jsxs)(`div`,{className:`mt-2 flex items-center gap-2`,children:[(0,M.jsx)(`label`,{htmlFor:ct,className:`min-w-0 flex-1 text-ink-200`,children:`Screen scale`}),(0,M.jsxs)(`div`,{className:`relative`,children:[(0,M.jsx)(`select`,{id:ct,"aria-label":`Screen scale`,value:f,onChange:e=>p(Number(e.currentTarget.value)),className:`appearance-none rounded-sm border border-ink-700 bg-ink-850 py-1 pl-2 pr-7 text-ink-50 focus:border-accent focus:outline-none`,children:c.map(e=>(0,M.jsxs)(`option`,{value:e,children:[e,`%`]},e))}),(0,M.jsx)(`span`,{className:`pointer-events-none absolute inset-y-0 right-2 flex items-center text-ink-400`,children:(0,M.jsx)(Be,{open:!0})})]})]})]}),(0,M.jsx)(at,{}),(0,M.jsxs)(`div`,{className:`border-t border-ink-800 px-3 py-2`,children:[(0,M.jsxs)(`button`,{type:`button`,onClick:r,disabled:a,"aria-busy":a,...m(`session.reloadConfig`,`Reload config.toml on the server (does not reload this page)`),"aria-label":`reload the server config`,className:`flex w-full items-center gap-2 rounded-sm py-1.5 text-left text-ink-200 hover:bg-ink-700 disabled:cursor-progress disabled:text-ink-400 disabled:hover:bg-transparent`,children:[(0,M.jsx)(ge,{className:`h-3.5 w-3.5 ${a?`animate-spin`:``}`}),`Reload config.toml`]}),(0,M.jsxs)(`button`,{type:`button`,onClick:g,...m(`help.shortcuts`,`Keyboard shortcuts`),"aria-label":`keyboard shortcuts`,className:`mt-1 flex w-full items-center gap-2 rounded-sm py-1.5 text-left text-ink-200 hover:bg-ink-700`,children:[(0,M.jsx)(h,{className:`h-3.5 w-3.5`}),`Keyboard shortcuts`]})]})]})]})}function ut(e){return e===`top`||e===`left`?e:null}function dt(e){return e===`top`?`left`:`top`}function ft({repos:e,repo:t,onSelectRepo:n,onCloseRepo:r,onOpenPicker:i,cloning:a,accent:o,next:s,cycle:c,draggingRepo:l,dragOverRepo:u,onRepoDragStart:d,onRepoDragMove:p,onRepoDragEnd:m,onReloadConfig:h,reloading:g,onShowShortcuts:_,tabStrip:v}){return(0,M.jsxs)(`header`,{className:`flex h-(--nc-header-h) items-center gap-2 border-b border-chrome-line bg-ink-900 px-[12.8px]`,children:[(0,M.jsx)(`div`,{className:`flex shrink-0 items-center gap-2`,children:(0,M.jsx)(ze,{})}),(0,M.jsx)(We,{className:`md:hidden`,repos:e,currentId:t,onSelect:n,onCloseProject:r,onOpenPicker:i}),v.side===`top`&&(0,M.jsx)(Ge,{side:`top`,repos:e,repo:t,onSelectRepo:n,onCloseRepo:r,onOpenPicker:i,draggingRepo:l,dragOverRepo:u,onRepoDragStart:d,onRepoDragMove:p,onRepoDragEnd:m}),a&&(0,M.jsxs)(`span`,{role:`status`,title:`A clone is running on the server`,className:`flex shrink-0 items-center gap-1.5 px-2 py-0.5 text-ink-400`,children:[(0,M.jsx)(`span`,{"aria-hidden":`true`,className:`h-1.5 w-1.5 animate-pulse rounded-full bg-accent`}),`Cloning…`]}),(0,M.jsx)(lt,{accent:o,next:s,cycle:c,onReloadConfig:h,reloading:g,onShowShortcuts:_}),(0,M.jsx)(`button`,{onClick:v.toggle,title:`Project tabs ${v.side===`top`?`across the top`:`down the left`} (click to move them ${dt(v.side)})`,"aria-label":`project tabs: ${v.side}, click for ${dt(v.side)}`,"aria-pressed":v.side===`left`,className:`ml-1 hidden h-6 w-6 shrink-0 items-center justify-center rounded-sm text-ink-400 hover:text-accent md:flex`,children:(0,M.jsx)(f,{side:v.side})}),(0,M.jsx)(`a`,{href:`/logout`,title:`Sign out`,"aria-label":`sign out`,className:`ml-1 flex h-6 w-6 shrink-0 items-center justify-center rounded-sm text-ink-400 hover:text-accent`,children:(0,M.jsx)(be,{className:`h-3.5 w-3.5`})})]})}var pt=[`w-3/5`,`w-2/5`,`w-4/5`,`w-1/2`,`w-3/4`,`w-1/3`,`w-2/3`];function mt({className:e=``}){return(0,M.jsx)(`span`,{"aria-hidden":`true`,className:`nc-skeleton block h-2.5 rounded-xs ${e}`})}function ht({rows:e=6,as:t=`div`,className:n=``}){let r=t;return(0,M.jsx)(M.Fragment,{children:Array.from({length:e},(e,t)=>(0,M.jsxs)(r,{"aria-hidden":`true`,className:`flex items-center gap-2 px-3 py-1.5 ${n}`,children:[(0,M.jsx)(mt,{className:`w-3 shrink-0`}),(0,M.jsx)(mt,{className:pt[t%pt.length]})]},t))})}function gt(){return(0,M.jsxs)(`div`,{"aria-busy":`true`,"aria-label":`Loading`,className:`flex h-full flex-col`,children:[(0,M.jsxs)(`div`,{className:`flex h-(--nc-header-h) shrink-0 items-center gap-2 border-b border-chrome-line bg-ink-900 px-[12.8px]`,children:[(0,M.jsx)(mt,{className:`h-[22px] w-[22px] shrink-0 rounded-sm`}),(0,M.jsx)(mt,{className:`hidden w-24 md:block`}),(0,M.jsx)(mt,{className:`w-28 md:hidden`}),(0,M.jsx)(mt,{className:`ml-auto h-4 w-4 shrink-0`}),(0,M.jsx)(mt,{className:`ml-1 h-4 w-4 shrink-0`})]}),(0,M.jsxs)(`div`,{className:`grid min-h-0 flex-1 grid-cols-1 grid-rows-[minmax(0,1fr)] md:grid-cols-[18rem_minmax(0,1fr)] md:grid-rows-[minmax(0,3fr)_minmax(0,2fr)]`,children:[(0,M.jsx)(`div`,{className:`overflow-hidden border-chrome-line py-2 md:border-r`,children:(0,M.jsx)(ht,{rows:10})}),(0,M.jsx)(`div`,{className:`hidden overflow-hidden py-2 md:block`,children:(0,M.jsx)(ht,{rows:14})}),(0,M.jsxs)(`div`,{className:`hidden overflow-hidden border-t border-chrome-line md:col-span-2 md:block`,children:[(0,M.jsxs)(`div`,{className:`flex h-8 items-center gap-2 border-b border-chrome-line px-3`,children:[(0,M.jsx)(mt,{className:`w-30`}),(0,M.jsx)(mt,{className:`w-30`})]}),(0,M.jsx)(`div`,{className:`py-2`,children:(0,M.jsx)(ht,{rows:5})})]})]}),(0,M.jsx)(`div`,{className:`flex shrink-0 border-t border-chrome-line bg-ink-900 md:hidden`,children:[0,1,2].map(e=>(0,M.jsxs)(`div`,{className:`flex min-h-11 flex-1 flex-col items-center justify-center gap-1 py-1`,children:[(0,M.jsx)(mt,{className:`h-5 w-5`}),(0,M.jsx)(mt,{className:`h-2 w-10`})]},e))})]})}function _t({onSuccess:e}){let[t,n]=(0,j.useState)(``),[r,i]=(0,j.useState)(null),[a,o]=(0,j.useState)(!1);return(0,M.jsx)(`div`,{className:`flex h-full items-center justify-center p-6`,children:(0,M.jsxs)(`form`,{onSubmit:async n=>{n.preventDefault(),o(!0),i(null);try{await A.login(t),e()}catch(e){i(e instanceof Error?e.message:`login failed`)}finally{o(!1)}},className:`w-[17rem] max-w-[86vw]`,children:[(0,M.jsx)(Re,{className:`mx-auto mb-3 block h-10 w-10`}),(0,M.jsx)(`h1`,{className:`text-center text-lg font-medium tracking-wide text-ink-50`,children:`nightcrow`}),(0,M.jsx)(`p`,{className:`mt-1 mb-5 text-center text-caption text-ink-400 uppercase`,children:`web viewer`}),r&&(0,M.jsx)(`p`,{className:`mb-2.5 text-center text-removed`,children:r}),(0,M.jsx)(`input`,{type:`password`,autoFocus:!0,value:t,onChange:e=>n(e.target.value),placeholder:`password`,className:`mb-2 w-full rounded-sm border border-ink-700 bg-ink-900 px-2.5 py-1.5 outline-none placeholder:text-ink-400 focus:border-accent focus:ring-[3px] focus:ring-accent/15`}),(0,M.jsx)(`button`,{"aria-busy":a,type:`submit`,disabled:a,className:`w-full rounded-sm bg-ink-50 py-1.5 font-semibold text-ink-950 hover:bg-white disabled:opacity-50`,children:(0,M.jsx)(Ee,{busy:a,children:`Sign in`})})]})})}var vt=`nightcrow.sidebarWidth`,yt=.5;function bt(e){return Math.min(Math.max(Math.round(e),280),720)}function xt(e){let t=720;try{t=Math.min(t,Math.round(window.innerWidth*yt))}catch{}return Math.min(Math.max(Math.round(e),280),Math.max(t,280))}function St(){try{let e=Number(localStorage.getItem(vt));return Number.isFinite(e)&&e>0?bt(e):460}catch{return 460}}function Ct(e){try{localStorage.setItem(vt,String(e))}catch{}}function wt(){let[e,t]=(0,j.useState)(St),n=(0,j.useCallback)(e=>{let n=xt(e);t(n),Ct(n)},[]);return{width:e,resize:n,commit:n,reset:(0,j.useCallback)(()=>{let e=bt(460);t(e),Ct(e)},[])}}var Tt=`[data-terminal-panel]`,Et=`dialog[open], [role="dialog"], [aria-modal="true"]`,Dt=`input, textarea, select, [contenteditable], [role="textbox"], [role="searchbox"], [role="combobox"]`,Ot=`data-focus-region`;function kt(e){return{"data-focus-region":e,tabIndex:-1}}function At(e){if(!(e instanceof Element)||e.closest(`[data-terminal-panel]`))return null;let t=e.closest(Dt)??e;return{tagName:t.tagName,isContentEditable:Pt(t),role:t.getAttribute(`role`),type:Ft(t),inDialog:e.closest(Et)!==null}}function jt(e=document){return Mt(e)===`terminal`}function Mt(e=document){let t=e.activeElement;if(!t)return null;if(t.closest(`[data-terminal-panel]`))return`terminal`;let n=t.closest(`[${Ot}]`)?.getAttribute(Ot);return n===`list`||n===`content`?n:null}function Nt(e,t=document){let n=t.querySelector(`[${Ot}="${e}"]`);if(!n)return!1;let r=x(t.activeElement,t.querySelector(Tt));return o(r)?(n.focus(),!0):!1}function Pt(e){let t=e.getAttribute(`contenteditable`);return t===null?e.isContentEditable===!0:t!==`false`}function Ft(e){return e.tagName===`INPUT`?e.type?.toLowerCase()??null:null}function It(){let e=new Map;return{start(t){let n=(e.get(t)??0)+1;return e.set(t,n),n},isCurrent(t,n){return e.get(t)===n}}}var Lt={children:{},expanded:new Set};function Rt(e,t,n){return{...e,children:{...e.children,[t]:n}}}function zt(e,t){let n=new Set(e);return n.delete(t)||n.add(t),n}function Bt(e,t){return{...e,expanded:zt(e.expanded,t)}}function Vt(e,t){let n=new Set(e.expanded);return t.forEach(e=>n.add(e)),{...e,expanded:n}}function Ht(e){let t=[],n=``;for(let r of e.split(`/`))n=n?`${n}/${r}`:r,t.push(n);return t}var Ut=180,Wt={items:[],truncated:!1};function Gt({repo:e,authed:t,tab:n,filter:r,filterOpen:i,handle:a}){let[o,s]=(0,j.useState)(Lt),[c,l]=(0,j.useState)(Wt),[u,d]=(0,j.useState)(!1),[f]=(0,j.useState)(It);(0,j.useEffect)(()=>{if(!e||!t||n!==`tree`||!i||!r){l(Wt),d(!1);return}d(!0);let o=!0,s=setTimeout(()=>{A.treeSearch(e,r).then(e=>{o&&l({items:e.matches,truncated:e.truncated})}).catch(e=>{o&&a(e)}).finally(()=>{o&&d(!1)})},Ut);return()=>{o=!1,clearTimeout(s)}},[e,t,n,r,i,a]);let p=(0,j.useCallback)((t,n)=>{if(!e)return;let r=f.start(t);A.tree(e,t).then(e=>{f.isCurrent(t,r)&&s(n=>Rt(n,t,e.entries))}).catch(e=>{if(!f.isCurrent(t,r)||n?.restoring)return je(e)?a(e):void 0;a(e)})},[e,a,f]);(0,j.useEffect)(()=>{e&&t&&n===`tree`&&p(``)},[e,t,n,p]);let m=(0,j.useCallback)(e=>{let t=!o.expanded.has(e);s(t=>Bt(t,e)),t&&!(e in o.children)&&p(e)},[o,p]),h=(0,j.useCallback)(e=>{s(t=>({...t,expanded:new Set(e)})),e.forEach(e=>{e in o.children||p(e,{restoring:!0})})},[o,p]),g=(0,j.useCallback)(e=>{let t=Ht(e);s(e=>Vt(e,t)),t.forEach(e=>{e in o.children||p(e)})},[o,p]);return{treeChildren:o.children,treeExpanded:o.expanded,treeMatches:c.items,treeTruncated:c.truncated,treeSearchLoading:u,loadTreeChildren:p,toggleTreeDir:m,revealTreeDir:g,seedTreeExpanded:h}}function Kt(e,t){let n=[],r=(i,a)=>{for(let o of e[i]??[]){let e=i?`${i}/${o.name}`:o.name;n.push({path:e,name:o.name,is_dir:o.is_dir,depth:a}),o.is_dir&&t.has(e)&&r(e,a+1)}};return r(``,0),n}var qt=[`status`,`log`,`tree`],Jt={status:`Show the working-tree status`,log:`Show the commit log`,tree:`Show the file tree`};function Yt(e){return e===`log`?`view.toggleLog`:e===`tree`?`view.toggleTree`:null}function Xt({tab:e,onChoose:t,filterOpen:n,onToggleFilter:r}){let i=S();return(0,M.jsxs)(`div`,{className:`flex shrink-0 items-stretch border-b border-chrome-line px-2`,children:[qt.map(n=>{let r=Yt(n);return(0,M.jsx)(`button`,{onClick:()=>t(n),"aria-current":n===e?`page`:void 0,...r&&n!==e?i(r,Jt[n]):{title:Jt[n]},className:`px-2 py-1.5 ${n===e?`text-ink-50 shadow-[inset_0_-1px_0_0_var(--color-accent)]`:`text-ink-400 hover:text-ink-200`}`,children:n},n)}),(0,M.jsx)(`button`,{onClick:r,"aria-pressed":n,title:n?`Hide the filter`:`Filter the list`,"aria-label":n?`Hide the filter`:`Filter the list`,className:`my-1 ml-auto flex shrink-0 items-center rounded-sm px-1.5 hover:text-accent ${n?`text-ink-50`:`text-ink-400`}`,children:(0,M.jsx)(Se,{})})]})}function Zt({path:e,from:t,className:n}){return(0,M.jsx)(`span`,{className:`whitespace-nowrap ${n??``}`,title:t?`${t} → ${e}`:e,children:t?`${t} → ${e}`:e})}var N=1e3;function Qt(e,t){return e===void 0||e<=0?0:e-t}function $t(e,t,n){let r=Qt(t,n);return e===null||Math.abs(r-e)>=1e3?r:e}function en(e,t,n){if(e===void 0)return`cool`;let r=Math.max(0,t-e);return r>=n?`cool`:r<5e3?`fresh`:`warm`}function tn(e,t,n){return e.some(e=>en(e,t,n)!==`cool`)}var nn={fresh:`text-accent font-bold`,warm:`text-accent`,cool:``};function rn(e,t,n){let[r,i]=(0,j.useState)(()=>Date.now()+n);return(0,j.useEffect)(()=>{if(t<=0||!e)return;let r=e.map(e=>e.mtime),a=Date.now()+n;if(i(a),!tn(r,a,t))return;let o=setInterval(()=>{let e=Date.now()+n;i(e),tn(r,e,t)||clearInterval(o)},N);return()=>clearInterval(o)},[e,t,n]),r}function an(e){return e.startsWith(`not a git repository`)?`Not a git repository. Run git init here to track changes.`:`Status unavailable: ${e}`}function on(e){let t=Math.max(0,Math.floor(Date.now()/1e3-e));return t<60?`${t}s`:t<3600?`${Math.floor(t/60)}m`:t<86400?`${Math.floor(t/3600)}h`:t<2592e3?`${Math.floor(t/86400)}d`:t<31536e3?`${Math.floor(t/2592e3)}mo`:`${Math.floor(t/31536e3)}y`}function sn(e){return e===`+`?`bg-added/10`:e===`-`?`bg-removed/10`:``}function cn(e){return e===`?`?`text-ink-400`:e===`D`?`text-removed`:e===`A`?`text-added`:`text-accent`}function ln({status:e,files:t,now:n,hotWindowMs:r,openDiff:i}){return e===null?(0,M.jsx)(ht,{as:`li`,rows:8}):e.unavailable===void 0?(0,M.jsxs)(M.Fragment,{children:[t.map(e=>(0,M.jsx)(`li`,{children:(0,M.jsxs)(`button`,{onClick:()=>i(e.path),className:`flex w-max min-w-full gap-2 px-3 py-0.5 text-left hover:bg-ink-850`,children:[(0,M.jsxs)(`span`,{className:`shrink-0`,children:[(0,M.jsx)(`span`,{className:cn(e.index),children:e.index===` `?` `:e.index}),(0,M.jsx)(`span`,{className:cn(e.worktree),children:e.worktree===` `?` `:e.worktree})]}),(0,M.jsx)(Zt,{path:e.path,from:e.old_path,className:nn[en(e.mtime,n,r)]})]})},e.path)),e.truncated&&(0,M.jsxs)(`li`,{className:`px-3 py-1 text-accent`,children:[`Showing the first `,e.files.length,` changed files.`]})]}):(0,M.jsx)(`li`,{className:`nc-fade-in px-3 py-1 text-ink-400`,children:an(e.unavailable)})}var un={merge:`MERGING`,rebase:`REBASING`,"cherry-pick":`CHERRY-PICKING`,revert:`REVERTING`,bisect:`BISECTING`,am:`APPLYING`};function dn(e){let t=e?.operation,n=t?t.step!==void 0&&t.total!==void 0?`${un[t.kind]} ${t.step}/${t.total}`:un[t.kind]:null,r=e?.conflicts??0,i=r===0?null:r===1?`1 conflict`:`${r} conflicts`;return n&&i?`${n} · ${i}`:n??i}function fn(e){return e.kind===`head`&&e.name!==`HEAD`?`HEAD → ${e.name}`:e.name}function pn(e){switch(e){case`head`:return`border-accent text-accent font-medium`;case`local`:return`border-added/60 text-added`;case`tag`:return`border-ink-600 text-ink-200`;case`remote`:return`border-ink-700 text-ink-400`}}function mn({visibleCommits:e,decorations:t,commits:n,commitDrillDown:r,visibleCommitFiles:i,logDone:a,logStalled:o,logPagingPaused:s,setLogStalled:c,logSentinelRef:l,openCommitFiles:u,openCommit:d,openCommitFileDiff:f,setCommitDrillDown:p,setPaneEmpty:m,bumpPaneRequest:h}){return(0,M.jsxs)(M.Fragment,{children:[!r&&e.map(e=>{let n=t.divergenceOf(e.oid);return(0,M.jsx)(`li`,{children:(0,M.jsxs)(`button`,{onClick:()=>void u(e),title:`${e.author} · ${e.summary}`,className:`flex w-max min-w-full items-baseline gap-2 px-3 py-0.5 text-left hover:bg-ink-850`,children:[(0,M.jsx)(`span`,{className:`w-2 shrink-0 ${n===`behind`?`text-accent`:`text-added`}`,title:n===`ahead`?`Not on the upstream yet`:n===`behind`?`On the upstream, not here yet`:void 0,children:n===`ahead`?`↑`:n===`behind`?`↓`:``}),(0,M.jsx)(`span`,{className:`shrink-0 text-accent`,children:e.short_id}),(0,M.jsx)(`span`,{className:`w-10 shrink-0 text-right text-ink-400`,children:on(e.time)}),(0,M.jsx)(`span`,{className:`max-w-[6rem] shrink-0 truncate text-ink-400`,children:e.author}),t.refsOf(e.oid)?.map(e=>(0,M.jsx)(`span`,{className:`shrink-0 self-center rounded-sm border px-1 text-2xs ${pn(e.kind)}`,children:fn(e)},`${e.kind}:${e.name}`)),(0,M.jsx)(`span`,{className:`whitespace-nowrap ${e.merge?`text-ink-400`:``}`,children:e.summary})]})},e.oid)}),!r&&t.truncated&&(0,M.jsx)(`li`,{className:`px-3 py-1 text-2xs text-ink-400`,children:`Too many refs to mark them all — some branch, tag or upstream marks are not shown.`}),!r&&!a&&!o&&!s&&(0,M.jsxs)(`li`,{ref:l,className:`flex flex-col gap-2 px-3 py-1.5`,"aria-hidden":`true`,children:[(0,M.jsx)(mt,{className:`w-3/5`}),(0,M.jsx)(mt,{className:`w-2/5`}),(0,M.jsx)(mt,{className:`w-1/2`})]}),!r&&!a&&!o&&s&&(0,M.jsxs)(`li`,{className:`px-3 py-1 text-ink-400`,children:[`filtering `,n.length,` loaded commits — clear the filter to load more`]}),!r&&o&&(0,M.jsx)(`li`,{className:`px-3 py-1`,children:(0,M.jsx)(`button`,{onClick:()=>c(!1),className:`text-ink-400 hover:text-accent`,children:`could not load more — retry`})}),r&&(0,M.jsxs)(M.Fragment,{children:[(0,M.jsxs)(`li`,{className:`sticky top-0 z-10 flex w-max min-w-full items-center gap-1 bg-ink-900 px-2 py-1 text-ink-400`,children:[(0,M.jsx)(`button`,{onClick:()=>{h(),p(null),m()},className:`rounded-sm px-1 hover:text-accent`,title:`Back to commit log`,children:`< log`}),(0,M.jsx)(`span`,{className:`text-ink-600`,children:`·`}),(0,M.jsx)(`span`,{className:`shrink-0 text-accent`,children:r.commit.short_id}),(0,M.jsx)(`button`,{onClick:()=>d(r.commit.oid),className:`rounded-sm px-1 hover:text-accent`,title:`Show the complete commit diff`,children:`all changes`})]}),i.map(e=>(0,M.jsx)(`li`,{children:(0,M.jsxs)(`button`,{onClick:()=>f(r.commit.oid,e.path),className:`flex w-max min-w-full gap-2 px-3 py-0.5 text-left hover:bg-ink-850`,children:[(0,M.jsx)(`span`,{className:cn(e.index),children:e.index}),(0,M.jsx)(Zt,{path:e.path,from:e.old_path})]})},e.path)),r.files.length===0&&(0,M.jsx)(`li`,{className:`px-3 py-2 text-ink-400`,children:`No changed files.`}),r.files.length>0&&i.length===0&&(0,M.jsx)(`li`,{className:`px-3 py-2 text-ink-400`,children:`No matching files.`}),r.truncated&&(0,M.jsxs)(`li`,{className:`px-3 py-1 text-accent`,children:[`Showing the first `,r.files.length,` files.`]})]})]})}function hn({treeSearching:e,treeMatches:t,treeTruncated:n,treeSearchLoading:r,treeRows:i,treeExpanded:a,openFile:o,revealTreeDir:s,toggleTreeDir:c}){return e?(0,M.jsxs)(M.Fragment,{children:[t.map(e=>(0,M.jsx)(`li`,{children:(0,M.jsx)(`button`,{onClick:()=>{e.is_dir?s(e.path):o(e.path)},title:e.path,className:`w-max min-w-full whitespace-nowrap px-3 py-0.5 text-left hover:bg-ink-850`,children:e.is_dir?(0,M.jsxs)(`span`,{className:`text-accent`,children:[e.path,`/`]}):e.path})},e.path)),t.length===0&&(0,M.jsx)(`li`,{className:`px-3 py-0.5 text-ink-400`,children:r?`searching…`:`no matches`}),n&&(0,M.jsxs)(`li`,{className:`px-3 py-0.5 text-ink-400`,children:[`showing the first `,t.length,` matches`]})]}):(0,M.jsx)(M.Fragment,{children:i.map(e=>(0,M.jsx)(`li`,{children:(0,M.jsxs)(`button`,{onClick:()=>e.is_dir?c(e.path):o(e.path),title:e.path,style:{paddingLeft:`${e.depth*.75+.5}rem`},className:`flex w-max min-w-full items-center gap-1 py-0.5 pr-3 text-left hover:bg-ink-850`,children:[e.is_dir?(0,M.jsx)(Be,{open:a.has(e.path)}):(0,M.jsx)(`span`,{className:`h-3.5 w-3.5 shrink-0`}),(0,M.jsx)(`span`,{className:`whitespace-nowrap ${e.is_dir?`text-accent`:``}`,children:e.is_dir?`${e.name}/`:e.name})]})},e.path))})}function gn(e){let{tab:t,chooseTab:n,filter:r,setFilter:i,filterOpen:a,setFilterOpen:o,status:s,files:c,now:l,hotWindowMs:u,openDiff:d,openFile:f,openCommit:p,openCommitFileDiff:m,openCommitFiles:h,repo:g,authed:_,handle:v,sidebarRef:y,draggingSidebar:b,onSidebarDragStart:x,onSidebarDragMove:S,onSidebarDragEnd:C,onSidebarDragCancel:w,filesMax:T,bumpPaneRequest:ee,commits:te,logDone:ne,logStalled:re,setLogStalled:ie,commitDrillDown:ae,setCommitDrillDown:oe,logSentinelRef:se,visibleCommits:ce,decorations:E,logPagingPaused:le,visibleCommitFiles:ue,mobileView:de,restoreTree:fe,restoreKnown:pe,onTreeExpanded:me,clearPane:he,touched:ge}=e,_e=Gt({repo:g,authed:_,tab:t,filter:r,filterOpen:a,handle:v}),ve=t===`tree`&&a&&r!==``,ye=Kt(_e.treeChildren,_e.treeExpanded),{seedTreeExpanded:be}=_e,xe=(0,j.useRef)(!1);(0,j.useEffect)(()=>{xe.current||pe&&!ge&&t===`tree`&&(xe.current=!0,fe.length!==0&&be(fe))},[t,pe,ge,fe,be]);let Se=e=>{me([...zt(_e.treeExpanded,e)]),_e.toggleTreeDir(e)},D=e=>{let t=new Set(_e.treeExpanded);Ht(e).forEach(e=>t.add(e)),me([...t]),_e.revealTreeDir(e)},O=()=>{a&&i(``),o(e=>!e)};return(0,M.jsxs)(`section`,{ref:y,...kt(`list`),className:`nc-fade-in relative min-h-0 flex-col overflow-hidden ${de===`files`?`flex`:`hidden md:flex`} ${T?`md:flex`:`border-chrome-line md:border-r`}`,children:[!T&&(0,M.jsx)(`div`,{role:`separator`,"aria-orientation":`vertical`,"aria-label":`Resize the file sidebar (double-click to reset)`,title:`Drag to resize · double-click to reset`,onPointerDown:x,onPointerMove:S,onPointerUp:C,onPointerCancel:w,onLostPointerCapture:C,className:`absolute -right-px top-0 z-20 hidden h-full w-1.5 cursor-col-resize touch-none md:block ${b?`bg-accent`:`hover:bg-accent`}`}),(0,M.jsx)(Xt,{tab:t,onChoose:n,filterOpen:a,onToggleFilter:O}),a&&(0,M.jsx)(`input`,{value:r,onChange:e=>i(e.target.value),placeholder:`filter…`,autoFocus:!0,className:`mx-2 mb-1 shrink-0 rounded-sm bg-ink-850 px-2 py-1 outline-none placeholder:text-ink-400 focus:ring-1 focus:ring-accent`}),(0,M.jsxs)(`ul`,{className:`nc-content min-h-0 flex-1 overflow-auto`,children:[t===`status`&&(0,M.jsx)(ln,{status:s,files:c,now:l,hotWindowMs:u,openDiff:d}),t===`log`&&(0,M.jsx)(mn,{visibleCommits:ce,decorations:E,commits:te,commitDrillDown:ae,visibleCommitFiles:ue,logDone:ne,logStalled:re,logPagingPaused:le,setLogStalled:ie,logSentinelRef:se,openCommitFiles:h,openCommit:p,openCommitFileDiff:m,setCommitDrillDown:oe,setPaneEmpty:he,bumpPaneRequest:ee}),t===`tree`&&(0,M.jsx)(hn,{treeSearching:ve,treeMatches:_e.treeMatches,treeTruncated:_e.treeTruncated,treeSearchLoading:_e.treeSearchLoading,treeRows:ye,treeExpanded:_e.treeExpanded,openFile:f,revealTreeDir:D,toggleTreeDir:Se})]})]})}function _n(e){let t=[],n=[],r=[],i=()=>{let e=Math.max(n.length,r.length);for(let i=0;i{t(e=>e===`split`?`unified`:`split`)},[])}}var yn=[`.md`,`.markdown`],bn=[`.html`,`.htm`];function xn(e){let t=e.toLowerCase();return yn.some(e=>t.endsWith(e))}function Sn(e){let t=e.toLowerCase();return bn.some(e=>t.endsWith(e))}function Cn(e){return xn(e)||Sn(e)}function wn(e){return e.map(e=>e.map(e=>e.t).join(``)).join(` +`).replace(Qf,``)}function ep(e,t){return t=$f(t),$f(e)===t}function $(e,t,n,r,i,o){switch(n){case`children`:if(typeof r==`string`)t===`body`||t===`textarea`&&r===``||gn(e,r);else if(typeof r==`number`||typeof r==`bigint`)t!==`body`&&gn(e,``+r);else return;break;case`className`:en(e,`class`,r);break;case`tabIndex`:en(e,`tabindex`,r);break;case`dir`:case`role`:case`viewBox`:case`width`:case`height`:en(e,n,r);break;case`style`:yn(e,r,o);return;case`data`:if(t!==`object`){en(e,`data`,r);break}case`src`:case`href`:if(r===``&&(t!==`a`||n!==`href`)||r==null||typeof r==`function`||typeof r==`symbol`||typeof r==`boolean`){e.removeAttribute(n);break}r=Cn(r),e.setAttribute(n,r);break;case`action`:case`formAction`:if(typeof r==`function`){e.setAttribute(n,`javascript:throw new Error('A React form was unexpectedly submitted. If you called form.submit() manually, consider using form.requestSubmit() instead. If you\\'re trying to use event.stopPropagation() in a submit event handler, consider also calling event.preventDefault().')`);break}if(typeof o==`function`&&(n===`formAction`?(t!==`input`&&$(e,t,`name`,i.name,i,null),$(e,t,`formEncType`,i.formEncType,i,null),$(e,t,`formMethod`,i.formMethod,i,null),$(e,t,`formTarget`,i.formTarget,i,null)):($(e,t,`encType`,i.encType,i,null),$(e,t,`method`,i.method,i,null),$(e,t,`target`,i.target,i,null))),r==null||typeof r==`symbol`||typeof r==`boolean`){e.removeAttribute(n);break}r=Cn(r),e.setAttribute(n,r);break;case`onClick`:r!=null&&(e.onclick=wn);return;case`onScroll`:r!=null&&Q(`scroll`,e);return;case`onScrollEnd`:r!=null&&Q(`scrollend`,e);return;case`dangerouslySetInnerHTML`:if(r!=null){if(typeof r!=`object`||!(`__html`in r))throw Error(a(61));if(n=r.__html,n!=null){if(i.children!=null)throw Error(a(60));o?.__html!==n&&(e.innerHTML=n)}}break;case`multiple`:e.multiple=r&&typeof r!=`function`&&typeof r!=`symbol`;break;case`muted`:e.muted=r&&typeof r!=`function`&&typeof r!=`symbol`;break;case`suppressContentEditableWarning`:case`suppressHydrationWarning`:case`defaultValue`:case`defaultChecked`:case`innerHTML`:case`ref`:break;case`autoFocus`:break;case`xlinkHref`:if(r==null||typeof r==`function`||typeof r==`boolean`||typeof r==`symbol`){e.removeAttribute(`xlink:href`);break}n=Cn(r),e.setAttributeNS(`http://www.w3.org/1999/xlink`,`xlink:href`,n);break;case`contentEditable`:case`spellCheck`:case`draggable`:case`value`:case`autoReverse`:case`externalResourcesRequired`:case`focusable`:case`preserveAlpha`:r!=null&&typeof r!=`function`&&typeof r!=`symbol`?e.setAttribute(n,r):e.removeAttribute(n);break;case`inert`:case`allowFullScreen`:case`async`:case`autoPlay`:case`controls`:case`credentialless`:case`default`:case`defer`:case`disabled`:case`disablePictureInPicture`:case`disableRemotePlayback`:case`formNoValidate`:case`hidden`:case`loop`:case`noModule`:case`noValidate`:case`open`:case`playsInline`:case`readOnly`:case`required`:case`reversed`:case`scoped`:case`seamless`:case`itemScope`:r&&typeof r!=`function`&&typeof r!=`symbol`?e.setAttribute(n,``):e.removeAttribute(n);break;case`capture`:case`download`:!0===r?e.setAttribute(n,``):!1!==r&&r!=null&&typeof r!=`function`&&typeof r!=`symbol`?e.setAttribute(n,r):e.removeAttribute(n);break;case`cols`:case`rows`:case`size`:case`span`:r!=null&&typeof r!=`function`&&typeof r!=`symbol`&&!isNaN(r)&&1<=r?e.setAttribute(n,r):e.removeAttribute(n);break;case`rowSpan`:case`start`:r==null||typeof r==`function`||typeof r==`symbol`||isNaN(r)?e.removeAttribute(n):e.setAttribute(n,r);break;case`popover`:Q(`beforetoggle`,e),Q(`toggle`,e),$t(e,`popover`,r);break;case`xlinkActuate`:tn(e,`http://www.w3.org/1999/xlink`,`xlink:actuate`,r);break;case`xlinkArcrole`:tn(e,`http://www.w3.org/1999/xlink`,`xlink:arcrole`,r);break;case`xlinkRole`:tn(e,`http://www.w3.org/1999/xlink`,`xlink:role`,r);break;case`xlinkShow`:tn(e,`http://www.w3.org/1999/xlink`,`xlink:show`,r);break;case`xlinkTitle`:tn(e,`http://www.w3.org/1999/xlink`,`xlink:title`,r);break;case`xlinkType`:tn(e,`http://www.w3.org/1999/xlink`,`xlink:type`,r);break;case`xmlBase`:tn(e,`http://www.w3.org/XML/1998/namespace`,`xml:base`,r);break;case`xmlLang`:tn(e,`http://www.w3.org/XML/1998/namespace`,`xml:lang`,r);break;case`xmlSpace`:tn(e,`http://www.w3.org/XML/1998/namespace`,`xml:space`,r);break;case`is`:$t(e,`is`,r);break;case`innerText`:case`textContent`:return;default:if(!(2s)break;var u=c.transferSize,d=c.initiatorType;u&&ap(d)&&(c=c.responseEnd,o+=u*(c$m){s.length=o;break}f=new Promise(jp.bind(f)),s.push(f)}}}if(0`u`?null:document;function Tm(e,t,n){var r=wm;if(r&&typeof t==`string`&&t){var i=ln(t);i=`link[rel="`+e+`"][href="`+i+`"]`,typeof n==`string`&&(i+=`[crossorigin="`+n+`"]`),ym.has(i)||(ym.add(i),e={rel:e,crossOrigin:n,href:t},r.querySelector(i)===null&&(t=r.createElement(`link`),np(t,`link`,e),Ht(t),r.head.appendChild(t)))}}function Em(e){xm.D(e),Tm(`dns-prefetch`,e,null)}function Dm(e,t){xm.C(e,t),Tm(`preconnect`,e,t)}function Om(e,t,n){xm.L(e,t,n);var r=wm;if(r&&e&&t){var i=`link[rel="preload"][as="`+ln(t)+`"]`;t===`image`&&n&&n.imageSrcSet?(i+=`[imagesrcset="`+ln(n.imageSrcSet)+`"]`,typeof n.imageSizes==`string`&&(i+=`[imagesizes="`+ln(n.imageSizes)+`"]`)):i+=`[href="`+ln(e)+`"]`;var a=i;switch(t){case`style`:a=Pm(e);break;case`script`:a=Rm(e)}if(!(vm.has(a)||(e=T({rel:`preload`,href:t===`image`&&n&&n.imageSrcSet?void 0:e,as:t},n),vm.set(a,e),r.querySelector(i)!==null||t===`style`&&r.querySelector(Fm(a))||t===`script`&&r.querySelector(zm(a))))){var o=r.createElement(`link`);np(o,`link`,e),t===`style`&&(o[It]=!0,o.onload=o.onerror=function(){Ut(o)}),Ht(o),r.head.appendChild(o)}}}function km(e,t){xm.m(e,t);var n=wm;if(n&&e){var r=t&&typeof t.as==`string`?t.as:`script`,i=`link[rel="modulepreload"][as="`+ln(r)+`"][href="`+ln(e)+`"]`,a=i;switch(r){case`audioworklet`:case`paintworklet`:case`serviceworker`:case`sharedworker`:case`worker`:case`script`:a=Rm(e)}if(!vm.has(a)&&(e=T({rel:`modulepreload`,href:e},t),vm.set(a,e),n.querySelector(i)===null)){switch(r){case`audioworklet`:case`paintworklet`:case`serviceworker`:case`sharedworker`:case`worker`:case`script`:if(n.querySelector(zm(a)))return}r=n.createElement(`link`),np(r,`link`,e),Ht(r),n.head.appendChild(r)}}}function Am(e,t,n){xm.S(e,t,n);var r=wm;if(r&&e){var i=Vt(r).hoistableStyles,a=Pm(e);t||=`default`;var o=i.get(a);if(!o){var s={loading:0,preload:null};if(o=r.querySelector(Fm(a)))s.loading=5;else{e=T({rel:`stylesheet`,href:e,"data-precedence":t},n),(n=vm.get(a))&&Hm(e,n);var c=o=r.createElement(`link`);Ht(c),np(c,`link`,e),c._p=new Promise(function(e,t){c.onload=e,c.onerror=t}),c.addEventListener(`load`,function(){s.loading|=1}),c.addEventListener(`error`,function(){s.loading|=2}),s.loading|=4,Vm(o,t,r)}o={type:`stylesheet`,instance:o,count:1,state:s},i.set(a,o)}}}function jm(e,t){xm.X(e,t);var n=wm;if(n&&e){var r=Vt(n).hoistableScripts,i=Rm(e),a=r.get(i);a||(a=n.querySelector(zm(i)),a||(e=T({src:e,async:!0},t),(t=vm.get(i))&&Um(e,t),a=n.createElement(`script`),Ht(a),np(a,`link`,e),n.head.appendChild(a)),a={type:`script`,instance:a,count:1,state:null},r.set(i,a))}}function Mm(e,t){xm.M(e,t);var n=wm;if(n&&e){var r=Vt(n).hoistableScripts,i=Rm(e),a=r.get(i);a||(a=n.querySelector(zm(i)),a||(e=T({src:e,async:!0,type:`module`},t),(t=vm.get(i))&&Um(e,t),a=n.createElement(`script`),Ht(a),np(a,`link`,e),n.head.appendChild(a)),a={type:`script`,instance:a,count:1,state:null},r.set(i,a))}}function Nm(e,t,n,r){var i=(i=Ae.current)?bm(i):null;if(!i)throw Error(a(446));switch(e){case`meta`:case`title`:return null;case`style`:return typeof n.precedence==`string`&&typeof n.href==`string`?(n=Pm(n.href),t=Vt(i).hoistableStyles,r=t.get(n),r||(r={type:`style`,instance:null,count:0,state:null},t.set(n,r)),r):{type:`void`,instance:null,count:0,state:null};case`link`:if(n.rel===`stylesheet`&&typeof n.href==`string`&&typeof n.precedence==`string`){e=Pm(n.href);var o=Vt(i).hoistableStyles,s=o.get(e);if(s||(i=i.ownerDocument||i,s={type:`stylesheet`,instance:null,count:0,state:{loading:0,preload:null}},o.set(e,s),(o=i.querySelector(Fm(e)))?o._p||(s.instance=o,s.state.loading=5):(o=vm.get(e),o||(o={rel:`preload`,as:`style`,href:n.href,crossOrigin:n.crossOrigin,integrity:n.integrity,media:n.media,hrefLang:n.hrefLang,referrerPolicy:n.referrerPolicy},vm.set(e,o)),Lm(i,e,o,s.state))),t&&r===null)throw Error(a(528,``));return s}if(t&&r!==null)throw Error(a(529,``));return null;case`script`:return t=n.async,n=n.src,typeof n==`string`&&t&&typeof t!=`function`&&typeof t!=`symbol`?(n=Rm(n),t=Vt(i).hoistableScripts,r=t.get(n),r||(r={type:`script`,instance:null,count:0,state:null},t.set(n,r)),r):{type:`void`,instance:null,count:0,state:null};default:throw Error(a(444,e))}}function Pm(e){return`href="`+ln(e)+`"`}function Fm(e){return`link[rel="stylesheet"][`+e+`]`}function Im(e){return T({},e,{"data-precedence":e.precedence,precedence:null})}function Lm(e,t,n,r){if(t=e.querySelector(`link[rel="preload"][as="style"][`+t+`]`)){if(!0!==t[It]){r.loading=1;return}}else t=e.createElement(`link`),t[It]=!0,t.onload=t.onerror=Ut.bind(null,t),np(t,`link`,n),Ht(t),e.head.appendChild(t);r.preload=t,t.addEventListener(`load`,function(){return r.loading|=1}),t.addEventListener(`error`,function(){return r.loading|=2})}function Rm(e){return`[src="`+ln(e)+`"]`}function zm(e){return`script[async]`+e}function Bm(e,t,n){if(t.count++,t.instance===null)switch(t.type){case`style`:var r=e.querySelector(`style[data-href~="`+ln(n.href)+`"]`);if(r)return t.instance=r,Ht(r),r;var i=T({},n,{"data-href":n.href,"data-precedence":n.precedence,href:null,precedence:null});return r=(e.ownerDocument||e).createElement(`style`),Ht(r),np(r,`style`,i),Vm(r,n.precedence,e),t.instance=r;case`stylesheet`:i=Pm(n.href);var o=e.querySelector(Fm(i));if(o)return t.state.loading|=4,t.instance=o,Ht(o),o;r=Im(n),(i=vm.get(i))&&Hm(r,i),o=(e.ownerDocument||e).createElement(`link`),Ht(o);var s=o;return s._p=new Promise(function(e,t){s.onload=e,s.onerror=t}),np(o,`link`,r),t.state.loading|=4,Vm(o,n.precedence,e),t.instance=o;case`script`:return o=Rm(n.src),(i=e.querySelector(zm(o)))?(t.instance=i,Ht(i),i):(r=n,(i=vm.get(o))&&(r=T({},n),Um(r,i)),e=e.ownerDocument||e,i=e.createElement(`script`),Ht(i),np(i,`link`,r),e.head.appendChild(i),t.instance=i);case`void`:return null;default:throw Error(a(443,t.type))}else t.type===`stylesheet`&&!(t.state.loading&4)&&(r=t.instance,t.state.loading|=4,Vm(r,n.precedence,e));return t.instance}function Vm(e,t,n){for(var r=n.querySelectorAll(`link[rel="stylesheet"][data-precedence],style[data-precedence]`),i=r.length?r[r.length-1]:null,a=i,o=0;o title`):null)}function qm(e,t,n){if(n===1||t.itemProp!=null)return!1;switch(e){case`meta`:case`title`:return!0;case`style`:if(typeof t.precedence!=`string`||typeof t.href!=`string`||t.href===``)break;return!0;case`link`:if(typeof t.rel!=`string`||typeof t.href!=`string`||t.href===``||t.onLoad||t.onError)break;switch(t.rel){case`stylesheet`:return e=t.disabled,typeof t.precedence==`string`&&e==null;default:return!0}case`script`:if(t.async&&typeof t.async!=`function`&&typeof t.async!=`symbol`&&!t.onLoad&&!t.onError&&t.src&&typeof t.src==`string`)return!0}return!1}function Jm(e,t){return e===`img`&&t.src!=null&&t.src!==``&&t.onLoad==null&&t.loading!==`lazy`}function Ym(e){return!(e.type===`stylesheet`&&!(e.state.loading&3))}function Xm(e){return(e.width||100)*(e.height||100)*(typeof devicePixelRatio==`number`?devicePixelRatio:1)*.25}function Zm(e,t){typeof t.decode==`function`&&(e.imgCount++,t.complete||(e.imgBytes+=Xm(t),e.suspenseyImages.push(t)),e=rh.bind(e),t.decode().then(e,e))}function Qm(e,t,n,r){if(n.type===`stylesheet`&&(typeof r.media!=`string`||!1!==matchMedia(r.media).matches)&&!(n.state.loading&4)){if(n.instance===null){var i=Pm(r.href),a=t.querySelector(Fm(i));if(a){t=a._p,typeof t==`object`&&t&&typeof t.then==`function`&&(e.count++,e=nh.bind(e),t.then(e,e)),n.state.loading|=4,n.instance=a,Ht(a);return}a=t.ownerDocument||t,r=Im(r),(i=vm.get(i))&&Hm(r,i),a=a.createElement(`link`),Ht(a);var o=a;o._p=new Promise(function(e,t){o.onload=e,o.onerror=t}),np(a,`link`,r),n.instance=a}e.stylesheets===null&&(e.stylesheets=new Map),e.stylesheets.set(n,t),(t=n.state.preload)&&!(n.state.loading&3)&&(e.count++,n=nh.bind(e),t.addEventListener(`load`,n),t.addEventListener(`error`,n))}}var $m=0;function eh(e,t){return e.stylesheets&&e.count===0&&ah(e,e.stylesheets),0$m?50:800)+t);return e.unsuspend=n,function(){e.unsuspend=null,clearTimeout(r),clearTimeout(i)}}:null}function th(e){if(e.count===0&&(e.imgCount===0||!e.waitingForImages)){if(e.stylesheets)ah(e,e.stylesheets);else if(e.unsuspend){var t=e.unsuspend;e.unsuspend=null,t()}}}function nh(){this.count--,th(this)}function rh(){this.imgCount--,th(this)}var ih=null;function ah(e,t){e.stylesheets=null,e.unsuspend!==null&&(e.count++,ih=new Map,t.forEach(oh,e),ih=null,nh.call(e))}function oh(e,t){if(!(t.state.loading&4)){var n=ih.get(e);if(n)var r=n.get(null);else{n=new Map,ih.set(e,n);for(var i=e.querySelectorAll(`link[data-precedence],style[data-precedence]`),a=0;a{function n(){if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<`u`&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE==`function`)try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(n)}catch(e){console.error(e)}}n(),t.exports=Pe()}))(),j=n(),M=t();function Ie({onClose:e,onOpened:t,canClone:n,cloning:r,onClone:i}){let[a,o]=(0,j.useState)(null),[s,c]=(0,j.useState)(null),[l,u]=(0,j.useState)(null),[d,f]=(0,j.useState)(!1),[p,m]=(0,j.useState)(``),[h,g]=(0,j.useState)(!1),[_,v]=(0,j.useState)(``),[y,b]=(0,j.useState)(0);(0,j.useEffect)(()=>{let e=!1;return A.browse(a??void 0).then(t=>{e||(c(t),u(null))}).catch(t=>{e||u(t instanceof Error?t.message:`could not browse`)}),()=>{e=!0}},[a,y]);let x=e=>o(`${s.path.replace(/\/$/,``)}/${e}`),S=async()=>{if(s){f(!0);try{t(await A.open(s.path))}catch(e){E.error(e instanceof Error?e.message:`could not open`),f(!1)}}},C=async()=>{if(!s)return;let e=p.trim();if(e){g(!0);try{await A.mkdir(s.path,e),m(``),b(e=>e+1)}catch(e){E.error(e instanceof Error?e.message:`could not create folder`)}finally{g(!1)}}};return(0,M.jsx)(`div`,{className:`nc-fade-in fixed inset-0 z-50 flex items-start justify-center bg-black/60 p-4 md:pt-[8vh]`,onClick:e,children:(0,M.jsxs)(`div`,{className:`nc-rise-in flex max-h-[min(80vh,calc(var(--nc-visual-viewport-height,100vh)-8vh-1rem))] w-[34rem] max-w-full flex-col rounded-lg border border-ink-700 bg-ink-900`,onClick:e=>e.stopPropagation(),children:[(0,M.jsxs)(`div`,{className:`flex shrink-0 items-center gap-2 border-b border-ink-700 px-3 py-2`,children:[(0,M.jsx)(`span`,{className:`font-medium text-ink-50`,children:`Open a project`}),(0,M.jsx)(`button`,{onClick:e,"aria-label":`close`,className:`ml-auto flex h-6 w-6 items-center justify-center rounded-sm text-ink-400 hover:text-ink-200`,children:(0,M.jsx)(pe,{})})]}),(0,M.jsx)(`div`,{className:`shrink-0 truncate border-b border-ink-700 px-3 py-1.5 text-ink-400`,children:s?.path??`…`}),(0,M.jsxs)(`ul`,{className:`h-72 min-h-0 overflow-y-auto`,children:[s?.parent&&(0,M.jsx)(`li`,{children:(0,M.jsx)(`button`,{onClick:()=>o(s.parent),className:`w-full px-3 py-1 text-left text-ink-400 hover:bg-ink-850`,children:`../`})}),s?.entries.map(e=>(0,M.jsx)(`li`,{children:(0,M.jsxs)(`button`,{onClick:()=>x(e.name),className:`flex w-full items-center gap-2 px-3 py-1 text-left hover:bg-ink-850`,children:[(0,M.jsxs)(`span`,{className:`truncate text-accent`,children:[e.name,`/`]}),e.is_repo&&(0,M.jsx)(`span`,{className:`rounded-sm bg-ink-700 px-1 text-2xs text-ink-200`,children:`git`})]})},e.name)),s&&s.entries.length===0&&(0,M.jsx)(`li`,{className:`px-3 py-1 text-ink-400`,children:`No sub-folders.`})]}),l&&(0,M.jsx)(`p`,{className:`shrink-0 px-3 py-1 text-removed`,children:l}),(0,M.jsxs)(`div`,{className:`flex shrink-0 items-stretch gap-2 border-t border-ink-700 px-3 py-2`,children:[(0,M.jsx)(`input`,{value:p,onChange:e=>m(e.target.value),onKeyDown:e=>{e.key===`Enter`&&C()},placeholder:`New folder name`,"aria-label":`new folder name`,className:`min-w-0 flex-1 rounded-sm border border-ink-700 bg-ink-950 px-2 py-1 text-ink-50 placeholder:text-ink-400 focus:border-ink-600 focus:outline-none`}),(0,M.jsx)(`button`,{onClick:C,disabled:!s||!p.trim()||h,"aria-busy":h,className:`shrink-0 rounded-sm border border-ink-700 px-2 py-1 text-ink-200 hover:bg-ink-850 disabled:opacity-50`,children:(0,M.jsx)(Ee,{busy:h,children:`Create`})})]}),(0,M.jsxs)(`div`,{className:`flex shrink-0 items-stretch gap-2 border-t border-ink-700 px-3 py-2`,children:[(0,M.jsx)(`input`,{value:_,onChange:e=>v(e.target.value),onKeyDown:e=>{e.key===`Enter`&&s&&i(s.path,_)},disabled:!n,placeholder:n?`Clone a git URL here`:`git is not installed on the server`,"aria-label":`git URL to clone`,spellCheck:!1,autoCapitalize:`none`,autoCorrect:`off`,className:`min-w-0 flex-1 rounded-sm border border-ink-700 bg-ink-950 px-2 py-1 text-ink-50 placeholder:text-ink-400 focus:border-ink-600 focus:outline-none disabled:opacity-50`}),(0,M.jsx)(`button`,{onClick:()=>s&&i(s.path,_),disabled:!n||!s||!_.trim()||r,"aria-busy":r,title:n?void 0:`the server has no git on its PATH`,className:`shrink-0 rounded-sm border border-ink-700 px-2 py-1 text-ink-200 hover:bg-ink-850 disabled:opacity-50`,children:(0,M.jsx)(Ee,{busy:r,children:`Clone`})})]}),(0,M.jsxs)(`div`,{className:`flex shrink-0 items-center gap-2 border-t border-ink-700 px-3 py-2`,children:[(0,M.jsx)(`span`,{className:`truncate text-ink-400`,children:s?s.path:``}),(0,M.jsx)(`button`,{onClick:S,disabled:!s||d,"aria-busy":d,className:`ml-auto shrink-0 rounded-sm bg-ink-50 px-3 py-1 font-semibold text-ink-950 hover:bg-white disabled:opacity-50`,children:(0,M.jsx)(Ee,{busy:d,children:`Open`})})]})]})})}var Le=`data:image/svg+xml,%3c?xml%20version='1.0'%20encoding='utf-8'?%3e%3csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='12%2057%201150%201150'%20role='img'%20aria-label='Black%20crow'%3e%3ctitle%3eBlack%20crow%3c/title%3e%3cdesc%3eMonochrome%20black%20crow%20silhouette%20on%20a%20transparent%20background,%20framed%20so%20the%20bird%20sits%20centred%20for%20use%20as%20an%20inline%20mark%20on%20a%20square%20tile.%3c/desc%3e%3cg%20fill-rule='evenodd'%20clip-rule='evenodd'%3e%3cpath%20fill='%23000000'%20d='M%20882%20147%20L%20859%20136%20L%20844%20131%20L%20831%20129%20L%20830%20128%20L%20815%20127%20L%20814%20126%20L%20796%20126%20L%20795%20127%20L%20786%20127%20L%20785%20128%20L%20775%20129%20L%20752%20136%20L%20732%20146%20L%20713%20160%20L%20701%20172%20L%20684%20172%20L%20683%20173%20L%20673%20173%20L%20672%20174%20L%20650%20176%20L%20649%20177%20L%20627%20181%20L%20602%20190%20L%20589%20197%20L%20579%20204%20L%20562%20221%20L%20562%20223%20L%20565%20223%20L%20578%20228%20L%20581%20228%20L%20612%20238%20L%20672%20252%20L%20684%20258%20L%20698%20271%20L%20702%20278%20L%20705%20288%20L%20705%20294%20L%20703%20301%20L%20699%20308%20L%20688%20318%20L%20630%20347%20L%20593%20372%20L%20561%20399%20L%20544%20416%20L%20522%20441%20L%20492%20481%20L%20461%20531%20L%20438%20576%20L%20431%20594%20L%20425%20602%20L%20405%20635%20L%20387%20668%20L%20385%20676%20L%20390%20679%20L%20368%20705%20L%20330%20755%20L%20306%20790%20L%20296%20808%20L%20289%20818%20L%20280%20838%20L%20280%20843%20L%20283%20845%20L%20292%20843%20L%20297%20840%20L%20299%20840%20L%20321%20828%20L%20322%20830%20L%20311%20844%20L%20288%20878%20L%20287%20881%20L%20259%20924%20L%20235%20965%20L%20205%201023%20L%20205%201025%20L%20197%201042%20L%20191%201061%20L%20191%201071%20L%20192%201072%20L%20198%201071%20L%20220%201056%20L%20242%201038%20L%20300%20986%20L%20302%20987%20L%20265%201040%20L%20264%201043%20L%20246%201070%20L%20235%201090%20L%20227%201112%20L%20227%201123%20L%20229%201128%20L%20234%201133%20L%20239%201135%20L%20255%201135%20L%20274%201129%20L%20279%201134%20L%20286%201137%20L%20290%201137%20L%20291%201138%20L%20310%201138%20L%20311%201137%20L%20317%201137%20L%20318%201136%20L%20326%201135%20L%20344%201129%20L%20369%201116%20L%20395%201097%20L%20420%201073%20L%20445%201042%20L%20457%201024%20L%20461%201016%20L%20464%201013%20L%20468%201011%20L%20489%20994%20L%20595%20901%20L%20601%20906%20L%20606%20913%20L%20614%20921%20L%20637%20949%20L%20639%20953%20L%20639%20956%20L%20636%20960%20L%20634%20961%20L%20619%20962%20L%20613%20965%20L%20605%20974%20L%20602%20982%20L%20602%20994%20L%20605%201001%20L%20608%201004%20L%20609%201004%20L%20609%20999%20L%20612%20992%20L%20616%20988%20L%20620%20986%20L%20627%20986%20L%20635%20983%20L%20645%20983%20L%20646%20982%20L%20655%20982%20L%20668%20986%20L%20676%20990%20L%20682%20996%20L%20685%201003%20L%20688%201006%20L%20696%201009%20L%20697%201012%20L%20697%201024%20L%20693%201033%20L%20693%201035%20L%20695%201035%20L%20700%201032%20L%20707%201025%20L%20710%201020%20L%20713%201010%20L%20713%201003%20L%20711%20998%20L%20711%20994%20L%20712%20993%20L%20719%201003%20L%20723%201005%20L%20727%201005%20L%20730%201011%20L%20730%201022%20L%20727%201031%20L%20728%201033%20L%20740%201021%20L%20743%201014%20L%20744%201003%20L%20747%20999%20L%20749%20992%20L%20748%20977%20L%20744%20968%20L%20740%20963%20L%20741%20962%20L%20755%20961%20L%20768%20964%20L%20777%20969%20L%20783%20975%20L%20786%20981%20L%20789%20984%20L%20795%20987%20L%20799%20987%20L%20801%20991%20L%20801%20997%20L%20802%20998%20L%20799%201013%20L%20802%201012%20L%20808%201007%20L%20813%201000%20L%20816%20991%20L%20816%20981%20L%20814%20976%20L%20814%20968%20L%20815%20967%20L%20819%20970%20L%20823%20970%20L%20826%20973%20L%20829%20980%20L%20830%20993%20L%20834%20990%20L%20838%20979%20L%20838%20968%20L%20832%20951%20L%20822%20940%20L%20815%20936%20L%20803%20933%20L%20776%20935%20L%20763%20931%20L%20753%20922%20L%20731%20898%20L%20703%20865%20L%20703%20863%20L%20710%20853%20L%20711%20855%20L%20707%20862%20L%20709%20862%20L%20718%20857%20L%20754%20832%20L%20793%20799%20L%20818%20774%20L%20849%20737%20L%20850%20741%20L%20845%20755%20L%20847%20755%20L%20861%20743%20L%20881%20721%20L%20906%20686%20L%20918%20665%20L%20933%20635%20L%20951%20590%20L%20971%20525%20L%20971%20521%20L%20974%20512%20L%20974%20508%20L%20978%20493%20L%20979%20482%20L%20980%20481%20L%20981%20466%20L%20982%20465%20L%20983%20441%20L%20982%20440%20L%20982%20428%20L%20981%20427%20L%20980%20414%20L%20978%20409%20L%20976%20397%20L%20970%20381%20L%20971%20379%20L%20974%20383%20L%20976%20381%20L%20977%20334%20L%20976%20333%20L%20976%20322%20L%20975%20321%20L%20974%20307%20L%20973%20306%20L%20973%20301%20L%20972%20300%20L%20969%20280%20L%20958%20243%20L%20949%20224%20L%20949%20222%20L%20939%20204%20L%20922%20181%20L%20903%20162%20Z%20M%20625%20888%20L%20656%20874%20L%20658%20874%20L%20665%20870%20L%20725%20930%20L%20728%20934%20L%20728%20940%20L%20723%20943%20L%20714%20944%20L%20707%20950%20L%20683%20951%20L%20673%20947%20L%20659%20932%20Z%20M%20787%20182%20L%20792%20182%20L%20796%20187%20L%20795%20192%20L%20791%20195%20L%20788%20195%20L%20783%20191%20L%20783%20186%20Z'/%3e%3cpath%20fill='%23000000'%20d='M%20895%20156%20L%20863%20138%20L%20838%20130%20L%20819%20127%20L%20789%20127%20L%20777%20129%20L%20753%20136%20L%20736%20144%20L%20717%20157%20L%20702%20172%20L%20652%20176%20L%20628%20181%20L%20607%20188%20L%20585%20200%20L%20562%20222%20L%20613%20238%20L%20670%20251%20L%20683%20257%20L%20697%20269%20L%20705%20286%20L%20705%20296%20L%20703%20302%20L%20698%20310%20L%20687%20319%20L%20631%20347%20L%20591%20374%20L%20568%20393%20L%20538%20423%20L%20520%20444%20L%20481%20498%20L%20457%20539%20L%20437%20579%20L%20432%20593%20L%20413%20622%20L%20386%20671%20L%20386%20677%20L%20390%20677%20L%20391%20679%20L%20374%20698%20L%20334%20750%20L%20307%20789%20L%20290%20817%20L%20280%20839%20L%20281%20844%20L%20291%20843%20L%20323%20826%20L%20325%20827%20L%20289%20877%20L%20237%20962%20L%20209%201015%20L%20198%201040%20L%20191%201063%20L%20191%201070%20L%20194%201072%20L%20213%201061%20L%20259%201023%20L%20302%20984%20L%20303%20985%20L%20262%201045%20L%20245%201072%20L%20233%201095%20L%20227%201114%20L%20228%201126%20L%20233%201132%20L%20242%201135%20L%20252%201135%20L%20274%201128%20L%20278%201133%20L%20288%201137%20L%20313%201137%20L%20343%201129%20L%20373%201113%20L%20398%201094%20L%20424%201068%20L%20441%201047%20L%20465%201012%20L%20520%20967%20L%20595%20900%20L%20611%20917%20L%20639%20952%20L%20639%20957%20L%20637%20960%20L%20632%20962%20L%20618%20963%20L%20611%20967%20L%20606%20973%20L%20602%20983%20L%20602%20992%20L%20608%201004%20L%20611%20993%20L%20619%20986%20L%20626%20986%20L%20643%20982%20L%20656%20982%20L%20675%20989%20L%20683%20997%20L%20688%201006%20L%20696%201009%20L%20697%201025%20L%20693%201034%20L%20694%201035%20L%20701%201031%20L%20710%201019%20L%20712%201013%20L%20712%20993%20L%20720%201003%20L%20727%201005%20L%20730%201009%20L%20730%201025%20L%20727%201032%20L%20732%201030%20L%20739%201022%20L%20743%201013%20L%20743%201004%20L%20749%20991%20L%20748%20978%20L%20740%20964%20L%20743%20961%20L%20757%20961%20L%20769%20964%20L%20781%20972%20L%20791%20985%20L%20798%20986%20L%20802%20994%20L%20802%201003%20L%20799%201013%20L%20810%201004%20L%20815%20994%20L%20816%20983%20L%20814%20977%20L%20814%20965%20L%20818%20969%20L%20825%20971%20L%20830%20983%20L%20830%20993%20L%20833%20991%20L%20837%20982%20L%20838%20969%20L%20834%20956%20L%20825%20943%20L%20820%20939%20L%20807%20934%20L%20774%20935%20L%20762%20931%20L%20736%20904%20L%20702%20864%20L%20715%20845%20L%20716%20847%20L%20707%20862%20L%20719%20856%20L%20744%20839%20L%20786%20805%20L%20824%20767%20L%20851%20733%20L%20852%20735%20L%20846%20755%20L%20853%20750%20L%20883%20718%20L%20906%20685%20L%20927%20647%20L%20951%20589%20L%20968%20535%20L%20976%20502%20L%20982%20461%20L%20981%20422%20L%20976%20398%20L%20968%20378%20L%20969%20376%20L%20975%20383%20L%20977%20341%20L%20970%20286%20L%20958%20244%20L%20945%20215%20L%20925%20185%20L%20906%20165%20Z%20M%20625%20888%20L%20665%20870%20L%20728%20933%20L%20729%20940%20L%20726%20943%20L%20715%20944%20L%20708%20950%20L%20692%20952%20L%20678%20950%20L%20672%20947%20L%20662%20936%20Z%20M%20785%20183%20L%20792%20182%20L%20796%20186%20L%20796%20191%20L%20791%20195%20L%20785%20194%20L%20783%20191%20L%20783%20186%20Z'/%3e%3cpath%20fill='%23000000'%20d='M%20896%20157%20L%20869%20141%20L%20837%20130%20L%20817%20127%20L%20792%20127%20L%20778%20129%20L%20751%20137%20L%20733%20146%20L%20715%20159%20L%20702%20172%20L%20653%20176%20L%20610%20187%20L%20581%20203%20L%20562%20222%20L%20625%20241%20L%20671%20251%20L%20683%20257%20L%20698%20270%20L%20705%20285%20L%20704%20300%20L%20699%20309%20L%20689%20318%20L%20628%20349%20L%20581%20382%20L%20540%20421%20L%20517%20448%20L%20478%20503%20L%20456%20541%20L%20439%20575%20L%20432%20593%20L%20412%20624%20L%20388%20667%20L%20386%20676%20L%20390%20677%20L%20391%20679%20L%20363%20712%20L%20332%20753%20L%20289%20819%20L%20281%20836%20L%20281%20844%20L%20293%20842%20L%20323%20826%20L%20325%20827%20L%20284%20885%20L%20236%20964%20L%20205%201024%20L%20197%201043%20L%20191%201064%20L%20191%201070%20L%20197%201071%20L%20210%201063%20L%20253%201028%20L%20303%20983%20L%20304%20984%20L%20259%201050%20L%20235%201091%20L%20227%201115%20L%20228%201125%20L%20232%201131%20L%20238%201134%20L%20249%201135%20L%20261%201133%20L%20274%201128%20L%20278%201133%20L%20289%201137%20L%20312%201137%20L%20342%201129%20L%20368%201116%20L%20399%201093%20L%20423%201069%20L%20443%201044%20L%20463%201013%20L%20493%20990%20L%20595%20900%20L%20612%20918%20L%20639%20952%20L%20639%20957%20L%20636%20961%20L%20616%20964%20L%20606%20973%20L%20602%20984%20L%20602%20991%20L%20608%201004%20L%20611%20993%20L%20621%20985%20L%20625%20986%20L%20639%20982%20L%20657%20982%20L%20677%20990%20L%20685%201002%20L%20690%201007%20L%20697%201010%20L%20698%201021%20L%20693%201034%20L%20694%201035%20L%20705%201027%20L%20710%201018%20L%20712%201011%20L%20712%201001%20L%20710%20994%20L%20712%20993%20L%20720%201003%20L%20729%201006%20L%20731%201020%20L%20728%201032%20L%20738%201023%20L%20743%201012%20L%20743%201003%20L%20748%20994%20L%20747%20976%20L%20740%20964%20L%20743%20961%20L%20759%20961%20L%20767%20963%20L%20780%20971%20L%20790%20984%20L%20799%20986%20L%20802%20992%20L%20802%201004%20L%20799%201012%20L%20803%201011%20L%20810%201004%20L%20815%20994%20L%20814%20965%20L%20818%20969%20L%20823%20969%20L%20830%20982%20L%20830%20992%20L%20832%20992%20L%20837%20982%20L%20837%20965%20L%20831%20950%20L%20821%20940%20L%20806%20934%20L%20772%20935%20L%20762%20931%20L%20733%20901%20L%20702%20863%20L%20717%20842%20L%20718%20844%20L%20707%20862%20L%20738%20843%20L%20780%20810%20L%20822%20769%20L%20851%20733%20L%20852%20735%20L%20846%20755%20L%20855%20748%20L%20882%20719%20L%20904%20688%20L%20930%20640%20L%20950%20591%20L%20967%20538%20L%20978%20490%20L%20982%20459%20L%20982%20434%20L%20976%20399%20L%20967%20376%20L%20969%20375%20L%20975%20383%20L%20976%20329%20L%20971%20293%20L%20960%20250%20L%20942%20210%20L%20923%20183%20Z%20M%20625%20888%20L%20665%20870%20L%20729%20934%20L%20729%20940%20L%20726%20943%20L%20716%20944%20L%20708%20950%20L%20695%20952%20L%20677%20950%20L%20666%20941%20Z%20M%20786%20182%20L%20790%20181%20L%20794%20183%20L%20797%20188%20L%20792%20195%20L%20787%20195%20L%20782%20190%20L%20782%20187%20Z'/%3e%3cpath%20fill='%23000000'%20d='M%20893%20155%20L%20873%20143%20L%20841%20131%20L%20816%20127%20L%20794%20127%20L%20779%20129%20L%20754%20136%20L%20735%20145%20L%20715%20159%20L%20702%20172%20L%20648%20177%20L%20629%20181%20L%20608%20188%20L%20584%20201%20L%20562%20222%20L%20614%20238%20L%20671%20251%20L%20685%20258%20L%20698%20270%20L%20704%20281%20L%20706%20292%20L%20703%20303%20L%20699%20309%20L%20686%20320%20L%20628%20349%20L%20590%20375%20L%20565%20396%20L%20543%20418%20L%20518%20447%20L%20490%20485%20L%20460%20534%20L%20441%20571%20L%20431%20595%20L%20405%20636%20L%20386%20672%20L%20386%20676%20L%20390%20677%20L%20391%20679%20L%20371%20702%20L%20335%20749%20L%20291%20816%20L%20280%20840%20L%20282%20844%20L%20298%20840%20L%20324%20825%20L%20326%20826%20L%20294%20870%20L%20235%20966%20L%20206%201022%20L%20198%201041%20L%20191%201065%20L%20191%201070%20L%20196%201071%20L%20214%201060%20L%20254%201027%20L%20303%20983%20L%20304%20984%20L%20256%201055%20L%20232%201098%20L%20227%201115%20L%20228%201125%20L%20232%201131%20L%20239%201134%20L%20248%201135%20L%20264%201132%20L%20274%201128%20L%20280%201134%20L%20289%201137%20L%20311%201137%20L%20339%201130%20L%20371%201114%20L%20401%201091%20L%20422%201070%20L%20440%201048%20L%20463%201013%20L%20487%20995%20L%20595%20900%20L%20613%20919%20L%20639%20951%20L%20639%20958%20L%20636%20961%20L%20619%20963%20L%20613%20966%20L%20605%20975%20L%20602%20991%20L%20604%20998%20L%20608%201003%20L%20611%20993%20L%20620%20985%20L%20624%20986%20L%20632%20983%20L%20647%20981%20L%20658%20982%20L%20677%20990%20L%20689%201006%20L%20697%201009%20L%20698%201021%20L%20694%201035%20L%20703%201029%20L%20710%201018%20L%20712%201010%20L%20712%201002%20L%20710%20997%20L%20711%20992%20L%20720%201003%20L%20728%201005%20L%20730%201008%20L%20731%201021%20L%20728%201032%20L%20738%201023%20L%20742%201014%20L%20743%201003%20L%20748%20994%20L%20748%20980%20L%20742%20966%20L%20739%20963%20L%20741%20961%20L%20753%20960%20L%20770%20964%20L%20780%20971%20L%20790%20984%20L%20799%20986%20L%20802%20992%20L%20802%201005%20L%20799%201012%20L%20804%201010%20L%20809%201005%20L%20815%20993%20L%20813%20964%20L%20817%20968%20L%20823%20969%20L%20826%20972%20L%20830%20982%20L%20831%20992%20L%20834%20989%20L%20838%20975%20L%20837%20966%20L%20831%20950%20L%20821%20940%20L%20804%20934%20L%20779%20936%20L%20763%20932%20L%20731%20899%20L%20702%20865%20L%20702%20863%20L%20717%20842%20L%20718%20844%20L%20708%20862%20L%20749%20835%20L%20781%20809%20L%20820%20771%20L%20851%20733%20L%20852%20736%20L%20846%20755%20L%20857%20746%20L%20881%20720%20L%20907%20683%20L%20928%20644%20L%20945%20604%20L%20967%20537%20L%20978%20489%20L%20982%20455%20L%20982%20437%20L%20979%20413%20L%20975%20396%20L%20967%20377%20L%20968%20374%20L%20975%20382%20L%20976%20332%20L%20972%20299%20L%20962%20257%20L%20954%20235%20L%20943%20212%20L%20923%20183%20Z%20M%20624%20888%20L%20666%20870%20L%20729%20934%20L%20729%20940%20L%20726%20943%20L%20716%20944%20L%20706%20951%20L%20684%20952%20L%20677%20950%20L%20665%20940%20Z%20M%20701%20220%20L%20710%20219%20L%20717%20221%20L%20704%20223%20L%20704%20221%20Z%20M%20666%20217%20L%20679%20216%20L%20689%20218%20L%20685%20220%20L%20675%20220%20Z%20M%20658%20210%20L%20661%20208%20L%20686%20205%20L%20706%20206%20L%20725%20209%20L%20733%20217%20L%20741%20220%20L%20738%20221%20L%20696%20214%20L%20661%20212%20Z%20M%20788%20181%20L%20793%20182%20L%20797%20188%20L%20792%20195%20L%20786%20195%20L%20782%20190%20L%20783%20185%20Z'/%3e%3cpath%20fill='%23000000'%20d='M%20893%20155%20L%20864%20139%20L%20836%20130%20L%20813%20127%20L%20796%20127%20L%20774%20130%20L%20749%20138%20L%20735%20145%20L%20720%20155%20L%20702%20172%20L%20687%20173%20L%20700%20174%20L%20694%20181%20L%20674%20184%20L%20670%20180%20L%20665%20183%20L%20657%20184%20L%20639%20196%20L%20641%20198%20L%20647%20198%20L%20648%20194%20L%20654%20193%20L%20686%20204%20L%20724%20208%20L%20740%20213%20L%20751%20222%20L%20750%20223%20L%20693%20214%20L%20671%20212%20L%20639%20212%20L%20636%20211%20L%20634%20207%20L%20629%20207%20L%20626%20210%20L%20617%20210%20L%20614%20208%20L%20604%20207%20L%20594%20213%20L%20582%20216%20L%20580%20214%20L%20581%20210%20L%20576%20208%20L%20586%20200%20L%20565%20218%20L%20563%20222%20L%20618%20239%20L%20671%20251%20L%20682%20256%20L%20689%20261%20L%20702%20276%20L%20706%20288%20L%20704%20301%20L%20700%20308%20L%20683%20322%20L%20630%20348%20L%20585%20379%20L%20563%20398%20L%20523%20441%20L%20497%20475%20L%20459%20536%20L%20443%20567%20L%20431%20595%20L%20411%20626%20L%20387%20670%20L%20386%20676%20L%20390%20677%20L%20391%20679%20L%20368%20706%20L%20333%20752%20L%20290%20818%20L%20281%20837%20L%20282%20844%20L%20300%20839%20L%20324%20825%20L%20326%20826%20L%20285%20884%20L%20242%20954%20L%20207%201020%20L%20192%201060%20L%20192%201071%20L%20196%201071%20L%20211%201062%20L%20240%201039%20L%20303%20983%20L%20305%20984%20L%20277%201023%20L%20242%201078%20L%20228%201110%20L%20227%201119%20L%20231%201130%20L%20239%201134%20L%20255%201134%20L%20274%201128%20L%20280%201134%20L%20285%201136%20L%20310%201137%20L%20339%201130%20L%20374%201112%20L%20394%201097%20L%20421%201071%20L%20445%201041%20L%20463%201013%20L%20488%20994%20L%20595%20900%20L%20614%20920%20L%20639%20951%20L%20639%20958%20L%20636%20961%20L%20619%20963%20L%20613%20966%20L%20607%20972%20L%20603%20980%20L%20602%20989%20L%20603%20995%20L%20608%201003%20L%20610%20994%20L%20620%20985%20L%20623%20986%20L%20631%20983%20L%20647%20981%20L%20665%20984%20L%20676%20989%20L%20689%201006%20L%20695%201007%20L%20697%201009%20L%20698%201023%20L%20694%201035%20L%20699%201032%20L%20709%201020%20L%20712%201010%20L%20710%20997%20L%20711%20992%20L%20719%201002%20L%20725%201005%20L%20727%201004%20L%20730%201008%20L%20731%201022%20L%20728%201032%20L%20739%201021%20L%20743%201010%20L%20743%201003%20L%20748%20993%20L%20748%20981%20L%20746%20974%20L%20739%20963%20L%20741%20961%20L%20755%20960%20L%20770%20964%20L%20779%20970%20L%20789%20983%20L%20799%20986%20L%20802%20992%20L%20802%201005%20L%20799%201012%20L%20808%201006%20L%20815%20993%20L%20813%20964%20L%20817%20968%20L%20825%20970%20L%20829%20978%20L%20831%20992%20L%20837%20981%20L%20837%20966%20L%20832%20952%20L%20822%20941%20L%20813%20936%20L%20803%20934%20L%20776%20936%20L%20763%20932%20L%20723%20890%20L%20702%20865%20L%20702%20863%20L%20717%20841%20L%20719%20842%20L%20708%20862%20L%20742%20840%20L%20782%20808%20L%20818%20773%20L%20851%20733%20L%20852%20736%20L%20846%20754%20L%20850%20752%20L%20881%20720%20L%20905%20686%20L%20932%20635%20L%20950%20590%20L%20969%20529%20L%20977%20494%20L%20982%20454%20L%20980%20419%20L%20975%20396%20L%20967%20377%20L%20968%20374%20L%20975%20382%20L%20976%20334%20L%20969%20284%20L%20959%20248%20L%20941%20209%20L%20921%20181%20Z%20M%20624%20888%20L%20666%20870%20L%20729%20934%20L%20729%20941%20L%20724%20944%20L%20716%20944%20L%20707%20951%20L%20683%20952%20L%20673%20948%20L%20659%20933%20Z%20M%20563%20618%20L%20569%20614%20L%20579%20621%20L%20576%20626%20L%20572%20627%20L%20568%20623%20L%20565%20623%20Z%20M%20575%20603%20L%20578%20603%20L%20588%20613%20L%20588%20619%20L%20585%20621%20L%20582%20620%20L%20575%20613%20L%20576%20612%20L%20573%20605%20Z%20M%20748%20398%20L%20752%20412%20L%20752%20432%20L%20748%20444%20L%20732%20470%20L%20716%20484%20L%20698%20493%20L%20685%20494%20L%20682%20491%20L%20707%20445%20L%20685%20473%20L%20667%20492%20L%20647%20508%20L%20632%20517%20L%20619%20519%20L%20615%20517%20L%20615%20513%20L%20643%20470%20L%20603%20514%20L%20589%20526%20L%20569%20538%20L%20558%20540%20L%20554%20539%20L%20552%20535%20L%20577%20498%20L%20549%20528%20L%20526%20546%20L%20508%20554%20L%20498%20555%20L%20495%20552%20L%20501%20541%20L%20482%20555%20L%20471%20558%20L%20464%20558%20L%20461%20560%20L%20460%20559%20L%20461%20555%20L%20469%20547%20L%20473%20537%20L%20491%20512%20L%20511%20497%20L%20582%20434%20L%20617%20408%20L%20632%20399%20L%20659%20386%20L%20677%20380%20L%20695%20377%20L%20712%20377%20L%20725%20380%20L%20739%20388%20Z%20M%20625%20216%20L%20683%20216%20L%20737%20222%20L%20742%20224%20L%20733%20226%20L%20721%20225%20L%20713%20230%20L%20711%20228%20L%20706%20228%20L%20694%20237%20L%20690%20233%20L%20690%20225%20L%20679%20228%20L%20674%20232%20L%20668%20232%20L%20659%20229%20L%20649%20222%20L%20632%20219%20L%20632%20217%20Z%20M%20788%20181%20L%20793%20182%20L%20797%20187%20L%20795%20193%20L%20792%20195%20L%20786%20195%20L%20782%20190%20L%20783%20185%20Z'/%3e%3cpath%20fill='%23000000'%20d='M%20607%20972%20L%20603%20981%20L%20603%20995%20L%20608%201003%20L%20610%20994%20L%20616%20987%20L%20620%20985%20L%20627%20985%20L%20635%20982%20L%20655%20981%20L%20676%20989%20L%20683%20996%20L%20689%201006%20L%20695%201007%20L%20697%201009%20L%20698%201024%20L%20694%201034%20L%20699%201032%20L%20706%201025%20L%20712%201010%20L%20710%20994%20L%20709%20997%20L%20706%20994%20L%20700%20994%20L%20694%20997%20L%20672%20976%20L%20658%20974%20L%20647%20967%20L%20642%20974%20L%20638%20974%20L%20636%20972%20L%20636%20961%20L%20629%20963%20L%20631%20972%20L%20625%20977%20L%20620%20977%20L%20613%20967%20L%20614%20966%20Z%20M%20686%20966%20L%20704%20980%20L%20719%201002%20L%20727%201004%20L%20730%201007%20L%20731%201023%20L%20728%201032%20L%20731%201030%20L%20741%201017%20L%20743%201003%20L%20748%20992%20L%20748%20981%20L%20742%20967%20L%20740%20965%20L%20742%20968%20L%20735%20972%20L%20726%20965%20L%20705%20960%20L%20724%20968%20L%20740%20983%20L%20742%20987%20L%20740%20991%20L%20732%20991%20L%20728%20996%20L%20726%20996%20L%20721%20992%20L%20713%20979%20Z%20M%20784%20943%20L%20784%20946%20L%20798%20950%20L%20819%20969%20L%20825%20970%20L%20830%20981%20L%20831%20992%20L%20837%20981%20L%20837%20966%20L%20829%20948%20L%20825%20944%20L%20830%20950%20L%20821%20957%20L%20813%20951%20L%20794%20942%20Z%20M%20659%20933%20L%20662%20937%20L%20658%20942%20L%20658%20945%20L%20663%20947%20L%20666%20945%20L%20667%20946%20L%20668%20944%20L%20670%20946%20Z%20M%20643%20913%20L%20647%20918%20L%20644%20921%20L%20642%20928%20L%20629%20938%20L%20627%20936%20L%20636%20947%20L%20634%20945%20L%20641%20933%20L%20651%20923%20L%20657%20930%20Z%20M%20936%20310%20L%20934%20309%20L%20945%20338%20L%20949%20368%20L%20949%20381%20L%20947%20383%20L%20935%20367%20L%20914%20348%20L%20929%20377%20L%20934%20397%20L%20936%20414%20L%20935%20440%20L%20933%20442%20L%20930%20440%20L%20924%20419%20L%20912%20395%20L%20909%20393%20L%20910%20410%20L%20907%20433%20L%20899%20458%20L%20895%20462%20L%20893%20460%20L%20892%20445%20L%20888%20427%20L%20873%20390%20L%20873%20416%20L%20871%20430%20L%20866%20448%20L%20862%20454%20L%20859%20452%20L%20853%20433%20L%20842%20410%20L%20823%20382%20L%20807%20365%20L%20805%20366%20L%20811%20394%20L%20812%20416%20L%20810%20425%20L%20806%20428%20L%20801%20423%20L%20790%20403%20L%20772%20383%20L%20759%20372%20L%20733%20357%20L%20724%20355%20L%20705%20346%20L%20693%20344%20L%20669%20344%20L%20646%20349%20L%20636%20353%20L%20662%20349%20L%20677%20349%20L%20699%20353%20L%20708%20356%20L%20725%20366%20L%20736%20376%20L%20745%20389%20L%20753%20415%20L%20752%20442%20L%20743%20476%20L%20723%20520%20L%20693%20569%20L%20646%20631%20L%20605%20676%20L%20568%20709%20L%20565%20710%20L%20562%20706%20L%20562%20692%20L%20567%20665%20L%20578%20636%20L%20602%20619%20L%20622%20602%20L%20645%20578%20L%20670%20546%20L%20630%20588%20L%20603%20610%20L%20574%20628%20L%20560%20633%20L%20556%20633%20L%20555%20631%20L%20563%20617%20L%20596%20572%20L%20647%20509%20L%20636%20515%20L%20562%20609%20L%20541%20630%20L%20520%20645%20L%20502%20653%20L%20490%20653%20L%20536%20590%20L%20513%20617%20L%20478%20651%20L%20454%20665%20L%20440%20669%20L%20436%20667%20L%20488%20596%20L%20459%20630%20L%20436%20653%20L%20411%20671%20L%20392%20678%20L%20372%20701%20L%20319%20772%20L%20289%20820%20L%20281%20838%20L%20282%20844%20L%20295%20841%20L%20324%20825%20L%20326%20826%20L%20289%20878%20L%20242%20954%20L%20209%201016%20L%20193%201056%20L%20191%201069%20L%20192%201071%20L%20196%201071%20L%20219%201056%20L%20303%20983%20L%20305%20984%20L%20255%201057%20L%20234%201094%20L%20228%201111%20L%20228%201124%20L%20234%201132%20L%20240%201134%20L%20254%201134%20L%20275%201128%20L%20279%201133%20L%20291%201137%20L%20316%201136%20L%20344%201128%20L%20364%201118%20L%20389%201101%20L%20403%201089%20L%20427%201064%20L%20447%201038%20L%20463%201013%20L%20489%20993%20L%20594%20901%20L%20595%20899%20L%20593%20894%20L%20588%20891%20L%20567%20868%20L%20569%20865%20L%20576%20867%20L%20586%20873%20L%20589%20867%20L%20607%20867%20L%20619%20880%20L%20622%20887%20L%20626%20891%20L%20624%20889%20L%20626%20886%20L%20666%20870%20L%20705%20909%20L%20710%20905%20L%20713%20905%20L%20716%20908%20L%20716%20911%20L%20712%20916%20L%20728%20932%20L%20730%20939%20L%20727%20943%20L%20717%20944%20L%20710%20949%20L%20712%20948%20L%20725%20951%20L%20739%20963%20L%20740%20961%20L%20756%20960%20L%20774%20966%20L%20784%20975%20L%20789%20983%20L%20800%20987%20L%20802%20991%20L%20802%201005%20L%20799%201012%20L%20806%201008%20L%20811%201002%20L%20815%20993%20L%20813%20968%20L%20812%20973%20L%20807%20971%20L%20796%20976%20L%20791%20973%20L%20788%20967%20L%20779%20958%20L%20767%20952%20L%20762%20941%20L%20756%20940%20L%20751%20932%20L%20749%20931%20L%20743%20936%20L%20738%20936%20L%20736%20933%20L%20741%20925%20L%20739%20915%20L%20742%20912%20L%20745%20914%20L%20702%20865%20L%20702%20863%20L%20717%20841%20L%20719%20842%20L%20709%20861%20L%20746%20837%20L%20783%20807%20L%20826%20764%20L%20851%20732%20L%20853%20734%20L%20846%20754%20L%20851%20751%20L%20874%20728%20L%20890%20708%20L%20908%20681%20L%20938%20621%20L%20960%20560%20L%20971%20521%20L%20979%20481%20L%20982%20444%20L%20977%20405%20L%20970%20382%20L%20966%20375%20L%20968%20374%20L%20974%20381%20L%20975%20368%20L%20974%20372%20L%20968%20364%20L%20966%20354%20L%20957%20337%20Z%20M%20247%201077%20L%20251%201085%20L%20246%201088%20L%20245%201091%20L%20240%201092%20L%20239%201085%20L%20241%201081%20Z%20M%20370%20935%20L%20371%20937%20L%20326%20997%20L%20301%201034%20L%20289%201044%20L%20286%201042%20L%20283%201045%20L%20277%201045%20L%20273%201043%20L%20264%201052%20L%20261%201049%20L%20270%201037%20L%20271%201038%20L%20281%201027%20L%20293%201010%20L%20326%20971%20Z%20M%20726%20921%20L%20728%20921%20L%20731%20926%20L%20729%20933%20L%20722%20926%20Z%20M%20729%20897%20L%20734%20902%20L%20732%20906%20L%20726%20902%20L%20726%20899%20Z%20M%20715%20882%20L%20720%20886%20L%20718%20890%20L%20711%20887%20Z%20M%20605%20762%20L%20608%20761%20L%20607%20760%20L%20609%20757%20L%20610%20759%20L%20617%20761%20L%20620%20764%20L%20611%20770%20L%20607%20770%20L%20606%20765%20L%20608%20765%20Z%20M%20611%20754%20L%20617%20750%20L%20620%20751%20L%20621%20749%20L%20625%20749%20L%20628%20752%20L%20628%20756%20L%20623%20761%20Z%20M%20549%20710%20L%20551%20713%20L%20551%20722%20L%20506%20774%20L%20403%20878%20L%20309%20963%20L%20307%20961%20L%20313%20953%20L%20322%20945%20L%20340%20922%20L%20375%20885%20Z%20M%20695%20704%20L%20696%20708%20L%20698%20709%20L%20695%20710%20L%20695%20713%20L%20692%20715%20L%20688%20710%20Z%20M%20704%20694%20L%20706%20695%20L%20706%20698%20L%20710%20698%20L%20713%20703%20L%20708%20708%20L%20707%20714%20L%20705%20716%20L%20701%20716%20L%20697%20708%20L%20699%20706%20L%20697%20705%20L%20701%20701%20L%20704%20705%20L%20706%20704%20L%20706%20700%20L%20702%20697%20Z%20M%20552%20678%20L%20554%20681%20L%20552%20701%20L%20465%20787%20L%20361%20883%20L%20316%20927%20L%20253%20993%20L%20211%201042%20L%20211%201036%20L%20222%201011%20L%20261%20942%20L%20292%20898%20L%20338%20843%20L%20374%20807%20L%20387%20807%20L%20403%20801%20L%20419%20792%20L%20456%20766%20L%20500%20728%20Z%20M%20704%20654%20L%20706%20658%20L%20711%20658%20L%20714%20661%20L%20715%20673%20L%20713%20676%20L%20705%20676%20L%20702%20674%20L%20704%20677%20L%20704%20681%20L%20702%20682%20L%20704%20685%20L%20700%20686%20L%20694%20678%20L%20691%20678%20L%20688%20674%20L%20692%20670%20L%20692%20664%20L%20694%20661%20Z%20M%20565%20642%20L%20558%20663%20L%20545%20677%20L%20494%20726%20L%20443%20767%20L%20401%20792%20L%20392%20795%20L%20387%20794%20L%20405%20766%20L%20455%20707%20L%20388%20767%20L%20355%20794%20L%20304%20827%20L%20299%20826%20L%20302%20817%20L%20316%20795%20L%20360%20739%20L%20398%20700%20L%20425%20677%20L%20428%20679%20L%20443%20679%20L%20461%20673%20L%20476%20664%20L%20493%20666%20L%20517%20657%20L%20542%20641%20L%20546%20643%20Z%20M%20563%20221%20L%20572%20225%20L%20571%20223%20L%20574%20220%20L%20585%20217%20L%20596%20218%20L%20607%20215%20L%20653%20214%20L%20706%20218%20L%20749%20224%20L%20749%20226%20L%20735%20233%20L%20732%20238%20L%20732%20249%20L%20693%20242%20L%20620%20239%20L%20672%20251%20L%20688%20260%20L%20701%20274%20L%20706%20287%20L%20704%20301%20L%20707%20297%20L%20711%20300%20L%20713%20309%20L%20720%20324%20L%20723%20327%20L%20724%20308%20L%20726%20304%20L%20735%20318%20L%20757%20341%20L%20753%20319%20L%20754%20313%20L%20760%20317%20L%20786%20345%20L%20784%20324%20L%20775%20300%20L%20779%20300%20L%20800%20317%20L%20800%20312%20L%20787%20283%20L%20772%20264%20L%20778%20263%20L%20800%20271%20L%20803%20270%20L%20770%20236%20L%20772%20234%20L%20797%20234%20L%20807%20230%20L%20801%20230%20L%20800%20228%20L%20811%20218%20L%20818%20203%20L%20818%20193%20L%20812%20179%20L%20798%20168%20L%20784%20166%20L%20760%20173%20L%20747%20173%20L%20712%20163%20L%20718%20157%20L%20703%20171%20L%20711%20173%20L%20720%20178%20L%20723%20182%20L%20720%20186%20L%20695%20190%20L%20680%20190%20L%20670%20193%20L%20656%20193%20L%20687%20204%20L%20729%20209%20L%20742%20214%20L%20753%20223%20L%20752%20224%20L%20729%20219%20L%20669%20212%20L%20610%20213%20L%20576%20218%20L%20565%20221%20L%20565%20219%20Z%20M%20771%20189%20L%20772%20201%20L%20775%20207%20L%20780%20212%20L%20787%20215%20L%20796%20216%20L%20796%20218%20L%20784%20219%20L%20776%20215%20L%20771%20210%20L%20768%20204%20L%20768%20194%20Z%20M%20788%20181%20L%20793%20182%20L%20797%20187%20L%20796%20192%20L%20790%20196%20L%20786%20195%20L%20782%20191%20L%20782%20186%20Z'/%3e%3c/g%3e%3c/svg%3e`;function Re({className:e}){return(0,M.jsx)(`span`,{className:`block overflow-hidden rounded-[20.7%] bg-accent ${e??``}`,children:(0,M.jsx)(`img`,{src:Le,alt:``,"aria-hidden":`true`,className:`h-full w-full`})})}function ze(){return(0,M.jsxs)(M.Fragment,{children:[(0,M.jsx)(Re,{className:`h-[22px] w-[22px] shrink-0`}),(0,M.jsx)(`span`,{className:`hidden text-[16px] font-medium tracking-[0.04em] text-ink-50 md:inline`,children:`nightcrow`})]})}function Be({open:e}){return(0,M.jsx)(`svg`,{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2.5`,strokeLinecap:`round`,strokeLinejoin:`round`,"aria-hidden":`true`,focusable:`false`,className:`h-3.5 w-3.5 shrink-0 transition-transform ${e?`rotate-90`:``}`,children:(0,M.jsx)(`path`,{d:`m9 18 6-6-6-6`})})}function Ve({className:e=`h-4 w-4`}){return(0,M.jsxs)(`svg`,{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,"aria-hidden":`true`,focusable:`false`,className:`shrink-0 ${e}`,children:[(0,M.jsx)(`path`,{d:`M3 6h.01`}),(0,M.jsx)(`path`,{d:`M3 12h.01`}),(0,M.jsx)(`path`,{d:`M3 18h.01`}),(0,M.jsx)(`path`,{d:`M8 6h13`}),(0,M.jsx)(`path`,{d:`M8 12h13`}),(0,M.jsx)(`path`,{d:`M8 18h13`})]})}function He({className:e=`h-4 w-4`}){return(0,M.jsxs)(`svg`,{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,"aria-hidden":`true`,focusable:`false`,className:`shrink-0 ${e}`,children:[(0,M.jsx)(`path`,{d:`M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z`}),(0,M.jsx)(`path`,{d:`M14 2v4a2 2 0 0 0 2 2h4`}),(0,M.jsx)(`path`,{d:`M10 9H8`}),(0,M.jsx)(`path`,{d:`M16 13H8`}),(0,M.jsx)(`path`,{d:`M16 17H8`})]})}function Ue({className:e=`h-4 w-4`}){return(0,M.jsxs)(`svg`,{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,"aria-hidden":`true`,focusable:`false`,className:`shrink-0 ${e}`,children:[(0,M.jsx)(`path`,{d:`m4 17 6-6-6-6`}),(0,M.jsx)(`path`,{d:`M12 19h8`})]})}function We({repos:e,currentId:t,onSelect:n,onCloseProject:r,onOpenPicker:i,className:a=``}){let[o,s]=(0,j.useState)(!1),c=S(),l=(0,j.useRef)(null),u=e.find(e=>e.id===t);return(0,j.useEffect)(()=>{if(!o)return;let e=e=>{e.key===`Escape`&&(s(!1),l.current?.focus())};return document.addEventListener(`keydown`,e),()=>document.removeEventListener(`keydown`,e)},[o]),(0,M.jsxs)(`div`,{className:`relative min-w-0 flex-1 ${a}`,children:[(0,M.jsxs)(`button`,{ref:l,onClick:()=>s(e=>!e),"aria-haspopup":`menu`,"aria-expanded":o,title:u?.display_path??`Select a project`,className:`flex min-w-0 max-w-full items-center gap-1 rounded-sm bg-ink-700 py-0.5 pl-2 pr-1 text-ink-50`,children:[(0,M.jsx)(`span`,{className:`truncate`,children:u?.name??`No project`}),(0,M.jsx)(Be,{open:o})]}),o&&(0,M.jsxs)(M.Fragment,{children:[(0,M.jsx)(`div`,{className:`fixed inset-0 z-40`,onClick:()=>s(!1)}),(0,M.jsxs)(`div`,{role:`menu`,className:`nc-pop-in origin-top-left absolute left-0 z-50 mt-1 max-h-[70vh] w-56 max-w-[80vw] overflow-y-auto rounded-md border border-ink-700 bg-ink-900 py-1 shadow-lg`,children:[e.length===0&&(0,M.jsx)(`p`,{className:`px-3 py-1.5 text-ink-400`,children:`No projects open.`}),e.map(e=>(0,M.jsxs)(`div`,{className:`flex items-center ${e.id===t?`bg-ink-700 text-ink-50`:`text-ink-200`}`,children:[(0,M.jsx)(`button`,{role:`menuitem`,onClick:()=>{n(e.id),s(!1)},title:e.display_path,className:`min-w-0 flex-1 truncate py-1.5 pl-3 pr-1 text-left hover:text-accent`,children:e.name}),(0,M.jsx)(`button`,{onClick:()=>r(e.id),"aria-label":`close ${e.name}`,...e.id===t?c(`project.close`,`Close project`):{title:`Close project`},className:`mr-1 flex h-6 w-6 shrink-0 items-center justify-center rounded-sm text-ink-400 hover:text-removed`,children:(0,M.jsx)(pe,{className:`h-3.5 w-3.5`})})]},e.id)),(0,M.jsx)(`div`,{className:`my-1 border-t border-ink-800`}),(0,M.jsxs)(`button`,{role:`menuitem`,onClick:()=>{i(),s(!1)},...c(`project.openDialog`,`Open a project`),className:`flex w-full items-center gap-1 px-3 py-1.5 text-left text-ink-400 hover:text-ink-200`,children:[(0,M.jsx)(re,{className:`h-3.5 w-3.5`}),`open`]})]})]})]})}function Ge({side:e,repos:t,repo:n,onSelectRepo:r,onCloseRepo:i,onOpenPicker:o,draggingRepo:s,dragOverRepo:c,onRepoDragStart:l,onRepoDragMove:f,onRepoDragEnd:p}){let m=S(),h=d(),g=t.length>1?[`project.previous`,`project.next`]:[],_=e=>e!==null,v=g.map(e=>w(e,h)).filter(_),y=g.map(e=>u(e,h)).filter(_),b=e===`left`;return(0,M.jsxs)(M.Fragment,{children:[(0,M.jsx)(`nav`,{"aria-keyshortcuts":v.length>0?v.join(` `):void 0,title:y.length>0?`Previous or next project (${y.join(`, `)})`:void 0,className:b?`hidden min-h-0 flex-1 flex-col overflow-y-auto md:flex`:`hidden items-stretch self-stretch overflow-x-auto pl-1 md:flex`,children:t.map(e=>(0,M.jsxs)(`div`,{"data-repo-id":e.id,onPointerDown:t=>l(t,e.id),onPointerMove:f,onPointerUp:p,onPointerCancel:p,onLostPointerCapture:p,"data-active":e.id===n,className:`nc-title-target flex items-center whitespace-nowrap ${b?`min-w-0 border-b border-ink-700`:`border-r border-ink-700`} ${t.length>1?`touch-none`:``} ${s===e.id?`opacity-60`:``} ${c===e.id?`bg-ink-800 ring-1 ring-inset ring-accent`:``} ${e.id===n?b?`bg-ink-900 text-ink-50 shadow-[inset_1px_0_0_0_var(--color-accent)]`:`bg-ink-950 text-ink-50 shadow-[inset_0_-1px_0_0_var(--color-accent)]`:`text-ink-400 hover:bg-ink-850 hover:text-ink-200`}`,title:e.display_path,children:[(0,M.jsx)(`button`,{onClick:()=>{r(e.id)},"aria-label":e.name,className:`self-stretch pl-3 pr-1 text-left ${b?`min-w-0 flex-1 py-2`:``}`,children:(0,M.jsx)(Te,{title:e.name,className:b?``:a})}),(0,M.jsx)(`button`,{onClick:t=>{t.stopPropagation(),i(e.id)},"data-tab-close":!0,...e.id===n?m(`project.close`,`Close project`):{title:`Close project`},"aria-label":`close ${e.name}`,className:`mr-1 flex h-6 w-6 shrink-0 items-center justify-center rounded-sm text-ink-400 hover:text-removed`,children:(0,M.jsx)(pe,{})})]},e.id))}),(0,M.jsxs)(`button`,{onClick:o,...m(`project.openDialog`,`Open a project`),className:`hidden shrink-0 items-center gap-1 rounded-sm px-2 py-0.5 text-ink-400 hover:text-accent md:inline-flex ${b?`mx-1 my-2 justify-center`:``}`,children:[(0,M.jsx)(re,{className:`h-3.5 w-3.5`}),`open`]})]})}var Ke={key:()=>Ae(`/api/push/key`).then(e=>e.public_key),subscribe:e=>k(`/api/push/subscribe`,e),unsubscribe:e=>k(`/api/push/unsubscribe`,{endpoint:e}),status:e=>k(`/api/push/status`,{endpoint:e}).then(e=>e.subscribed),test:e=>k(`/api/push/test`,{endpoint:e})};function qe(){let e=navigator;return{secure:window.isSecureContext,serviceWorker:`serviceWorker`in navigator?navigator.serviceWorker:void 0,hasPushManager:`PushManager`in window,permission:()=>typeof Notification>`u`?void 0:Notification.permission,requestPermission:()=>Notification.requestPermission(),isIos:/iPhone|iPad|iPod/.test(navigator.userAgent)||/Macintosh/.test(navigator.userAgent)&&navigator.maxTouchPoints>1,standalone:e.standalone===!0||window.matchMedia?.(`(display-mode: standalone)`).matches===!0}}function Je(e){return e.secure?e.isIos&&!e.standalone?`needs-install`:!e.serviceWorker||!e.hasPushManager||e.permission()===void 0?`unsupported`:e.permission()===`denied`?`denied`:null:`insecure`}function Ye(e){e.secure&&e.serviceWorker&&e.serviceWorker.register(`./sw.js`).catch(()=>{})}async function Xe(e){return(await e.serviceWorker.ready).pushManager.getSubscription()}async function Ze(e){let t=Je(e);if(t)return t;let n=await Xe(e);return n?await Ke.status(n.endpoint)?`on`:(await n.unsubscribe().catch(()=>!1),`off`):`off`}async function Qe(e){let t=Je(e);if(t)return t;let n=await e.requestPermission();if(n===`denied`)return`denied`;if(n!==`granted`)return`off`;let r;try{r=await Ke.key()}catch{return`unavailable`}let i=await e.serviceWorker.ready;await(await i.pushManager.getSubscription())?.unsubscribe();let a=await i.pushManager.subscribe({userVisibleOnly:!0,applicationServerKey:tt(r)});return await Ke.subscribe(a.toJSON()),`on`}async function $e(e){let t=await Xe(e);return t&&(await Ke.unsubscribe(t.endpoint).catch(()=>void 0),await t.unsubscribe().catch(()=>!1)),Je(e)??`off`}async function et(e){let t=await Xe(e);if(!t)throw Error(`notifications are off in this browser`);await Ke.test(t.endpoint)}function tt(e){let t=e.replace(/-/g,`+`).replace(/_/g,`/`),n=t+`=`.repeat((4-t.length%4)%4),r=atob(n),i=new Uint8Array(new ArrayBuffer(r.length));for(let e=0;e{let e=!1;return Ze(a).then(t=>!e&&n(t)).catch(()=>!e&&n(`off`)),()=>{e=!0}},[a]);let o=(0,j.useCallback)(async(e,t)=>{i(!0);try{let t=await e();return t&&n(t),!0}catch(e){return E.error(e instanceof Error?`${t}: ${e.message}`:t),!1}finally{i(!1)}},[]);return{state:t,busy:r,enable:()=>o(()=>Qe(a),`could not turn notifications on`),disable:()=>o(()=>$e(a),`could not turn notifications off`),test:async()=>{await o(()=>et(a),`could not send a test`)&&E.info(`Test notification sent`)}}}var rt={unsupported:`This browser does not support notifications.`,insecure:`Notifications need HTTPS or localhost. See the notifications guide for tailscale serve.`,"needs-install":`On iPhone and iPad, add nightcrow to the Home Screen and open it from there first.`,denied:`Notifications are blocked for this site. Allow them in the browser's site settings.`,unavailable:`The server could not load its notification key. Check the daemon log.`},it=`rounded-sm px-2 py-1 text-ink-200 hover:bg-ink-700 disabled:cursor-progress disabled:text-ink-400 disabled:hover:bg-transparent`;function at(){let{state:e,busy:t,enable:n,disable:r,test:i}=nt(),a=e?rt[e]:void 0;return(0,M.jsxs)(`section`,{"aria-labelledby":`nc-notifications-title`,className:`border-t border-ink-800 px-3 py-2`,children:[(0,M.jsx)(`h3`,{id:`nc-notifications-title`,className:`mb-1 text-xs uppercase tracking-wide text-ink-400`,children:`Notifications`}),(0,M.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,M.jsx)(`span`,{className:`min-w-0 flex-1 text-ink-200`,children:`When a terminal asks for you`}),(e===`off`||e===`on`)&&(0,M.jsx)(`button`,{type:`button`,role:`switch`,"aria-checked":e===`on`,"aria-busy":t,disabled:t,onClick:e===`on`?r:n,className:it,children:e===`on`?`On`:`Off`}),e===null&&(0,M.jsx)(`span`,{className:`text-ink-400`,children:`…`})]}),a&&(0,M.jsx)(`p`,{className:`mt-1 text-xs text-ink-400`,children:a}),e===`on`&&(0,M.jsx)(`button`,{type:`button`,disabled:t,onClick:i,className:`mt-1 ${it}`,children:`Send a test notification`})]})}var ot=`nc-settings-title`,st=`nc-settings-dialog`,ct=`nc-screen-scale`;function lt({accent:e,next:t,cycle:n,onReloadConfig:r,reloading:a,onShowShortcuts:o}){let[s,l]=(0,j.useState)(!1),u=(0,j.useRef)(null),d=(0,j.useRef)(null),{scale:f,setScale:p}=i(),m=S();(0,j.useLayoutEffect)(()=>{if(!s)return;let e=d.current;if(!e)return;e.querySelector(`[data-initial-focus]`)?.focus();let t=()=>[...e.querySelectorAll(`a[href], button:not(:disabled), select:not(:disabled), input:not(:disabled), [tabindex]:not([tabindex="-1"])`)],n=n=>{if(n.key===`Escape`){n.preventDefault(),l(!1),u.current?.focus();return}if(n.key!==`Tab`)return;let r=t(),i=r[0],a=r.at(-1);!i||!a?(n.preventDefault(),e.focus()):n.shiftKey&&document.activeElement===i?(n.preventDefault(),a.focus()):!n.shiftKey&&document.activeElement===a&&(n.preventDefault(),i.focus())},r=t=>{let n=t.target;n instanceof Node&&!e.contains(n)&&!u.current?.contains(n)&&l(!1)};return document.addEventListener(`keydown`,n),document.addEventListener(`pointerdown`,r),()=>{document.removeEventListener(`keydown`,n),document.removeEventListener(`pointerdown`,r)}},[s]);let g=()=>{l(!1),u.current?.focus(),o()};return(0,M.jsxs)(M.Fragment,{children:[(0,M.jsx)(`button`,{ref:u,type:`button`,onClick:()=>l(e=>!e),"aria-label":`Settings`,"aria-haspopup":`dialog`,"aria-expanded":s,"aria-controls":st,title:`Settings`,className:`ml-auto flex h-6 w-6 shrink-0 items-center justify-center rounded-sm text-ink-400 hover:text-accent`,children:(0,M.jsx)(oe,{})}),s&&(0,M.jsxs)(`div`,{ref:d,id:st,role:`dialog`,"aria-labelledby":ot,tabIndex:-1,className:`nc-pop-in origin-top-right fixed right-2 top-[calc(var(--nc-header-h)+8px)] z-50 flex max-h-[calc(100vh-3.75rem)] w-72 max-w-[calc(100vw-1rem)] flex-col overflow-y-auto rounded-md border border-ink-700 bg-ink-900 shadow-xl focus:outline-none`,style:{maxHeight:`calc(100dvh - 3.75rem)`},children:[(0,M.jsx)(`div`,{className:`border-b border-ink-700 px-3 py-2`,children:(0,M.jsx)(`h2`,{id:ot,className:`font-medium text-ink-50`,children:`Settings`})}),(0,M.jsxs)(`section`,{"aria-labelledby":`nc-appearance-title`,className:`px-3 py-2`,children:[(0,M.jsx)(`h3`,{id:`nc-appearance-title`,className:`mb-1 text-xs uppercase tracking-wide text-ink-400`,children:`Appearance`}),(0,M.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,M.jsx)(`span`,{className:`min-w-0 flex-1 text-ink-200`,children:`Accent colour`}),(0,M.jsxs)(`button`,{type:`button`,"data-initial-focus":!0,onClick:n,...m(`session.cycleAccent`,`Accent: ${e.name} (click for ${t.name})`),"aria-label":`accent colour: ${e.name}, click for ${t.name}`,className:`flex items-center gap-1.5 rounded-sm px-2 py-1 text-ink-200 hover:bg-ink-700`,children:[(0,M.jsx)(`span`,{"aria-hidden":`true`,className:`h-3 w-3 rounded-full bg-accent ring-1 ring-ink-600`}),e.name]})]}),(0,M.jsxs)(`div`,{className:`mt-2 flex items-center gap-2`,children:[(0,M.jsx)(`label`,{htmlFor:ct,className:`min-w-0 flex-1 text-ink-200`,children:`Screen scale`}),(0,M.jsxs)(`div`,{className:`relative`,children:[(0,M.jsx)(`select`,{id:ct,"aria-label":`Screen scale`,value:f,onChange:e=>p(Number(e.currentTarget.value)),className:`appearance-none rounded-sm border border-ink-700 bg-ink-850 py-1 pl-2 pr-7 text-ink-50 focus:border-accent focus:outline-none`,children:c.map(e=>(0,M.jsxs)(`option`,{value:e,children:[e,`%`]},e))}),(0,M.jsx)(`span`,{className:`pointer-events-none absolute inset-y-0 right-2 flex items-center text-ink-400`,children:(0,M.jsx)(Be,{open:!0})})]})]})]}),(0,M.jsx)(at,{}),(0,M.jsxs)(`div`,{className:`border-t border-ink-800 px-3 py-2`,children:[(0,M.jsxs)(`button`,{type:`button`,onClick:r,disabled:a,"aria-busy":a,...m(`session.reloadConfig`,`Reload config.toml on the server (does not reload this page)`),"aria-label":`reload the server config`,className:`flex w-full items-center gap-2 rounded-sm py-1.5 text-left text-ink-200 hover:bg-ink-700 disabled:cursor-progress disabled:text-ink-400 disabled:hover:bg-transparent`,children:[(0,M.jsx)(ge,{className:`h-3.5 w-3.5 ${a?`animate-spin`:``}`}),`Reload config.toml`]}),(0,M.jsxs)(`button`,{type:`button`,onClick:g,...m(`help.shortcuts`,`Keyboard shortcuts`),"aria-label":`keyboard shortcuts`,className:`mt-1 flex w-full items-center gap-2 rounded-sm py-1.5 text-left text-ink-200 hover:bg-ink-700`,children:[(0,M.jsx)(h,{className:`h-3.5 w-3.5`}),`Keyboard shortcuts`]})]})]})]})}function ut(e){return e===`top`||e===`left`?e:null}function dt(e){return e===`top`?`left`:`top`}function ft({repos:e,repo:t,onSelectRepo:n,onCloseRepo:r,onOpenPicker:i,cloning:a,accent:o,next:s,cycle:c,draggingRepo:l,dragOverRepo:u,onRepoDragStart:d,onRepoDragMove:p,onRepoDragEnd:m,onReloadConfig:h,reloading:g,onShowShortcuts:_,tabStrip:v}){return(0,M.jsxs)(`header`,{className:`flex h-(--nc-header-h) items-center gap-2 border-b border-chrome-line bg-ink-900 px-[12.8px]`,children:[(0,M.jsx)(`div`,{className:`flex shrink-0 items-center gap-2`,children:(0,M.jsx)(ze,{})}),(0,M.jsx)(We,{className:`md:hidden`,repos:e,currentId:t,onSelect:n,onCloseProject:r,onOpenPicker:i}),v.side===`top`&&(0,M.jsx)(Ge,{side:`top`,repos:e,repo:t,onSelectRepo:n,onCloseRepo:r,onOpenPicker:i,draggingRepo:l,dragOverRepo:u,onRepoDragStart:d,onRepoDragMove:p,onRepoDragEnd:m}),a&&(0,M.jsxs)(`span`,{role:`status`,title:`A clone is running on the server`,className:`flex shrink-0 items-center gap-1.5 px-2 py-0.5 text-ink-400`,children:[(0,M.jsx)(`span`,{"aria-hidden":`true`,className:`h-1.5 w-1.5 animate-pulse rounded-full bg-accent`}),`Cloning…`]}),(0,M.jsx)(lt,{accent:o,next:s,cycle:c,onReloadConfig:h,reloading:g,onShowShortcuts:_}),(0,M.jsx)(`button`,{onClick:v.toggle,title:`Project tabs ${v.side===`top`?`across the top`:`down the left`} (click to move them ${dt(v.side)})`,"aria-label":`project tabs: ${v.side}, click for ${dt(v.side)}`,"aria-pressed":v.side===`left`,className:`ml-1 hidden h-6 w-6 shrink-0 items-center justify-center rounded-sm text-ink-400 hover:text-accent md:flex`,children:(0,M.jsx)(f,{side:v.side})}),(0,M.jsx)(`a`,{href:`/logout`,title:`Sign out`,"aria-label":`sign out`,className:`ml-1 flex h-6 w-6 shrink-0 items-center justify-center rounded-sm text-ink-400 hover:text-accent`,children:(0,M.jsx)(be,{})})]})}var pt=[`w-3/5`,`w-2/5`,`w-4/5`,`w-1/2`,`w-3/4`,`w-1/3`,`w-2/3`];function mt({className:e=``}){return(0,M.jsx)(`span`,{"aria-hidden":`true`,className:`nc-skeleton block h-2.5 rounded-xs ${e}`})}function ht({rows:e=6,as:t=`div`,className:n=``}){let r=t;return(0,M.jsx)(M.Fragment,{children:Array.from({length:e},(e,t)=>(0,M.jsxs)(r,{"aria-hidden":`true`,className:`flex items-center gap-2 px-3 py-1.5 ${n}`,children:[(0,M.jsx)(mt,{className:`w-3 shrink-0`}),(0,M.jsx)(mt,{className:pt[t%pt.length]})]},t))})}function gt(){return(0,M.jsxs)(`div`,{"aria-busy":`true`,"aria-label":`Loading`,className:`flex h-full flex-col`,children:[(0,M.jsxs)(`div`,{className:`flex h-(--nc-header-h) shrink-0 items-center gap-2 border-b border-chrome-line bg-ink-900 px-[12.8px]`,children:[(0,M.jsx)(mt,{className:`h-[22px] w-[22px] shrink-0 rounded-sm`}),(0,M.jsx)(mt,{className:`hidden w-24 md:block`}),(0,M.jsx)(mt,{className:`w-28 md:hidden`}),(0,M.jsx)(mt,{className:`ml-auto h-4 w-4 shrink-0`}),(0,M.jsx)(mt,{className:`ml-1 h-4 w-4 shrink-0`})]}),(0,M.jsxs)(`div`,{className:`grid min-h-0 flex-1 grid-cols-1 grid-rows-[minmax(0,1fr)] md:grid-cols-[18rem_minmax(0,1fr)] md:grid-rows-[minmax(0,3fr)_minmax(0,2fr)]`,children:[(0,M.jsx)(`div`,{className:`overflow-hidden border-chrome-line py-2 md:border-r`,children:(0,M.jsx)(ht,{rows:10})}),(0,M.jsx)(`div`,{className:`hidden overflow-hidden py-2 md:block`,children:(0,M.jsx)(ht,{rows:14})}),(0,M.jsxs)(`div`,{className:`hidden overflow-hidden border-t border-chrome-line md:col-span-2 md:block`,children:[(0,M.jsxs)(`div`,{className:`flex h-8 items-center gap-2 border-b border-chrome-line px-3`,children:[(0,M.jsx)(mt,{className:`w-30`}),(0,M.jsx)(mt,{className:`w-30`})]}),(0,M.jsx)(`div`,{className:`py-2`,children:(0,M.jsx)(ht,{rows:5})})]})]}),(0,M.jsx)(`div`,{className:`flex shrink-0 border-t border-chrome-line bg-ink-900 md:hidden`,children:[0,1,2].map(e=>(0,M.jsxs)(`div`,{className:`flex min-h-11 flex-1 flex-col items-center justify-center gap-1 py-1`,children:[(0,M.jsx)(mt,{className:`h-5 w-5`}),(0,M.jsx)(mt,{className:`h-2 w-10`})]},e))})]})}function _t({onSuccess:e}){let[t,n]=(0,j.useState)(``),[r,i]=(0,j.useState)(null),[a,o]=(0,j.useState)(!1);return(0,M.jsx)(`div`,{className:`flex h-full items-center justify-center p-6`,children:(0,M.jsxs)(`form`,{onSubmit:async n=>{n.preventDefault(),o(!0),i(null);try{await A.login(t),e()}catch(e){i(e instanceof Error?e.message:`login failed`)}finally{o(!1)}},className:`w-[17rem] max-w-[86vw]`,children:[(0,M.jsx)(Re,{className:`mx-auto mb-3 block h-10 w-10`}),(0,M.jsx)(`h1`,{className:`text-center text-lg font-medium tracking-wide text-ink-50`,children:`nightcrow`}),(0,M.jsx)(`p`,{className:`mt-1 mb-5 text-center text-caption text-ink-400 uppercase`,children:`web viewer`}),r&&(0,M.jsx)(`p`,{className:`mb-2.5 text-center text-removed`,children:r}),(0,M.jsx)(`input`,{type:`password`,autoFocus:!0,value:t,onChange:e=>n(e.target.value),placeholder:`password`,className:`mb-2 w-full rounded-sm border border-ink-700 bg-ink-900 px-2.5 py-1.5 outline-none placeholder:text-ink-400 focus:border-accent focus:ring-[3px] focus:ring-accent/15`}),(0,M.jsx)(`button`,{"aria-busy":a,type:`submit`,disabled:a,className:`w-full rounded-sm bg-ink-50 py-1.5 font-semibold text-ink-950 hover:bg-white disabled:opacity-50`,children:(0,M.jsx)(Ee,{busy:a,children:`Sign in`})})]})})}var vt=`nightcrow.sidebarWidth`,yt=.5;function bt(e){return Math.min(Math.max(Math.round(e),280),720)}function xt(e){let t=720;try{t=Math.min(t,Math.round(window.innerWidth*yt))}catch{}return Math.min(Math.max(Math.round(e),280),Math.max(t,280))}function St(){try{let e=Number(localStorage.getItem(vt));return Number.isFinite(e)&&e>0?bt(e):460}catch{return 460}}function Ct(e){try{localStorage.setItem(vt,String(e))}catch{}}function wt(){let[e,t]=(0,j.useState)(St),n=(0,j.useCallback)(e=>{let n=xt(e);t(n),Ct(n)},[]);return{width:e,resize:n,commit:n,reset:(0,j.useCallback)(()=>{let e=bt(460);t(e),Ct(e)},[])}}var Tt=`[data-terminal-panel]`,Et=`dialog[open], [role="dialog"], [aria-modal="true"]`,Dt=`input, textarea, select, [contenteditable], [role="textbox"], [role="searchbox"], [role="combobox"]`,Ot=`data-focus-region`;function kt(e){return{"data-focus-region":e,tabIndex:-1}}function At(e){if(!(e instanceof Element)||e.closest(`[data-terminal-panel]`))return null;let t=e.closest(Dt)??e;return{tagName:t.tagName,isContentEditable:Pt(t),role:t.getAttribute(`role`),type:Ft(t),inDialog:e.closest(Et)!==null}}function jt(e=document){return Mt(e)===`terminal`}function Mt(e=document){let t=e.activeElement;if(!t)return null;if(t.closest(`[data-terminal-panel]`))return`terminal`;let n=t.closest(`[${Ot}]`)?.getAttribute(Ot);return n===`list`||n===`content`?n:null}function Nt(e,t=document){let n=t.querySelector(`[${Ot}="${e}"]`);if(!n)return!1;let r=x(t.activeElement,t.querySelector(Tt));return o(r)?(n.focus(),!0):!1}function Pt(e){let t=e.getAttribute(`contenteditable`);return t===null?e.isContentEditable===!0:t!==`false`}function Ft(e){return e.tagName===`INPUT`?e.type?.toLowerCase()??null:null}function It(){let e=new Map;return{start(t){let n=(e.get(t)??0)+1;return e.set(t,n),n},isCurrent(t,n){return e.get(t)===n}}}var Lt={children:{},expanded:new Set};function Rt(e,t,n){return{...e,children:{...e.children,[t]:n}}}function zt(e,t){let n=new Set(e);return n.delete(t)||n.add(t),n}function Bt(e,t){return{...e,expanded:zt(e.expanded,t)}}function Vt(e,t){let n=new Set(e.expanded);return t.forEach(e=>n.add(e)),{...e,expanded:n}}function Ht(e){let t=[],n=``;for(let r of e.split(`/`))n=n?`${n}/${r}`:r,t.push(n);return t}var Ut=180,Wt={items:[],truncated:!1};function Gt({repo:e,authed:t,tab:n,filter:r,filterOpen:i,handle:a}){let[o,s]=(0,j.useState)(Lt),[c,l]=(0,j.useState)(Wt),[u,d]=(0,j.useState)(!1),[f]=(0,j.useState)(It);(0,j.useEffect)(()=>{if(!e||!t||n!==`tree`||!i||!r){l(Wt),d(!1);return}d(!0);let o=!0,s=setTimeout(()=>{A.treeSearch(e,r).then(e=>{o&&l({items:e.matches,truncated:e.truncated})}).catch(e=>{o&&a(e)}).finally(()=>{o&&d(!1)})},Ut);return()=>{o=!1,clearTimeout(s)}},[e,t,n,r,i,a]);let p=(0,j.useCallback)((t,n)=>{if(!e)return;let r=f.start(t);A.tree(e,t).then(e=>{f.isCurrent(t,r)&&s(n=>Rt(n,t,e.entries))}).catch(e=>{if(!f.isCurrent(t,r)||n?.restoring)return je(e)?a(e):void 0;a(e)})},[e,a,f]);(0,j.useEffect)(()=>{e&&t&&n===`tree`&&p(``)},[e,t,n,p]);let m=(0,j.useCallback)(e=>{let t=!o.expanded.has(e);s(t=>Bt(t,e)),t&&!(e in o.children)&&p(e)},[o,p]),h=(0,j.useCallback)(e=>{s(t=>({...t,expanded:new Set(e)})),e.forEach(e=>{e in o.children||p(e,{restoring:!0})})},[o,p]),g=(0,j.useCallback)(e=>{let t=Ht(e);s(e=>Vt(e,t)),t.forEach(e=>{e in o.children||p(e)})},[o,p]);return{treeChildren:o.children,treeExpanded:o.expanded,treeMatches:c.items,treeTruncated:c.truncated,treeSearchLoading:u,loadTreeChildren:p,toggleTreeDir:m,revealTreeDir:g,seedTreeExpanded:h}}function Kt(e,t){let n=[],r=(i,a)=>{for(let o of e[i]??[]){let e=i?`${i}/${o.name}`:o.name;n.push({path:e,name:o.name,is_dir:o.is_dir,depth:a}),o.is_dir&&t.has(e)&&r(e,a+1)}};return r(``,0),n}var qt=[`status`,`log`,`tree`],Jt={status:`Show the working-tree status`,log:`Show the commit log`,tree:`Show the file tree`};function Yt(e){return e===`log`?`view.toggleLog`:e===`tree`?`view.toggleTree`:null}function Xt({tab:e,onChoose:t,filterOpen:n,onToggleFilter:r}){let i=S();return(0,M.jsxs)(`div`,{className:`flex shrink-0 items-stretch border-b border-chrome-line px-2`,children:[qt.map(n=>{let r=Yt(n);return(0,M.jsx)(`button`,{onClick:()=>t(n),"aria-current":n===e?`page`:void 0,...r&&n!==e?i(r,Jt[n]):{title:Jt[n]},className:`px-2 py-1.5 ${n===e?`text-ink-50 shadow-[inset_0_-1px_0_0_var(--color-accent)]`:`text-ink-400 hover:text-ink-200`}`,children:n},n)}),(0,M.jsx)(`button`,{onClick:r,"aria-pressed":n,title:n?`Hide the filter`:`Filter the list`,"aria-label":n?`Hide the filter`:`Filter the list`,className:`my-1 ml-auto flex shrink-0 items-center rounded-sm px-1.5 hover:text-accent ${n?`text-ink-50`:`text-ink-400`}`,children:(0,M.jsx)(Se,{})})]})}function Zt({path:e,from:t,className:n}){return(0,M.jsx)(`span`,{className:`whitespace-nowrap ${n??``}`,title:t?`${t} → ${e}`:e,children:t?`${t} → ${e}`:e})}var N=1e3;function Qt(e,t){return e===void 0||e<=0?0:e-t}function $t(e,t,n){let r=Qt(t,n);return e===null||Math.abs(r-e)>=1e3?r:e}function en(e,t,n){if(e===void 0)return`cool`;let r=Math.max(0,t-e);return r>=n?`cool`:r<5e3?`fresh`:`warm`}function tn(e,t,n){return e.some(e=>en(e,t,n)!==`cool`)}var nn={fresh:`text-accent font-bold`,warm:`text-accent`,cool:``};function rn(e,t,n){let[r,i]=(0,j.useState)(()=>Date.now()+n);return(0,j.useEffect)(()=>{if(t<=0||!e)return;let r=e.map(e=>e.mtime),a=Date.now()+n;if(i(a),!tn(r,a,t))return;let o=setInterval(()=>{let e=Date.now()+n;i(e),tn(r,e,t)||clearInterval(o)},N);return()=>clearInterval(o)},[e,t,n]),r}function an(e){return e.startsWith(`not a git repository`)?`Not a git repository. Run git init here to track changes.`:`Status unavailable: ${e}`}function on(e){let t=Math.max(0,Math.floor(Date.now()/1e3-e));return t<60?`${t}s`:t<3600?`${Math.floor(t/60)}m`:t<86400?`${Math.floor(t/3600)}h`:t<2592e3?`${Math.floor(t/86400)}d`:t<31536e3?`${Math.floor(t/2592e3)}mo`:`${Math.floor(t/31536e3)}y`}function sn(e){return e===`+`?`bg-added/10`:e===`-`?`bg-removed/10`:``}function cn(e){return e===`?`?`text-ink-400`:e===`D`?`text-removed`:e===`A`?`text-added`:`text-accent`}function ln({status:e,files:t,now:n,hotWindowMs:r,openDiff:i}){return e===null?(0,M.jsx)(ht,{as:`li`,rows:8}):e.unavailable===void 0?(0,M.jsxs)(M.Fragment,{children:[t.map(e=>(0,M.jsx)(`li`,{children:(0,M.jsxs)(`button`,{onClick:()=>i(e.path),className:`flex w-max min-w-full gap-2 px-3 py-0.5 text-left hover:bg-ink-850`,children:[(0,M.jsxs)(`span`,{className:`shrink-0`,children:[(0,M.jsx)(`span`,{className:cn(e.index),children:e.index===` `?` `:e.index}),(0,M.jsx)(`span`,{className:cn(e.worktree),children:e.worktree===` `?` `:e.worktree})]}),(0,M.jsx)(Zt,{path:e.path,from:e.old_path,className:nn[en(e.mtime,n,r)]})]})},e.path)),e.truncated&&(0,M.jsxs)(`li`,{className:`px-3 py-1 text-accent`,children:[`Showing the first `,e.files.length,` changed files.`]})]}):(0,M.jsx)(`li`,{className:`nc-fade-in px-3 py-1 text-ink-400`,children:an(e.unavailable)})}var un={merge:`MERGING`,rebase:`REBASING`,"cherry-pick":`CHERRY-PICKING`,revert:`REVERTING`,bisect:`BISECTING`,am:`APPLYING`};function dn(e){let t=e?.operation,n=t?t.step!==void 0&&t.total!==void 0?`${un[t.kind]} ${t.step}/${t.total}`:un[t.kind]:null,r=e?.conflicts??0,i=r===0?null:r===1?`1 conflict`:`${r} conflicts`;return n&&i?`${n} · ${i}`:n??i}function fn(e){return e.kind===`head`&&e.name!==`HEAD`?`HEAD → ${e.name}`:e.name}function pn(e){switch(e){case`head`:return`border-accent text-accent font-medium`;case`local`:return`border-added/60 text-added`;case`tag`:return`border-ink-600 text-ink-200`;case`remote`:return`border-ink-700 text-ink-400`}}function mn({visibleCommits:e,decorations:t,commits:n,commitDrillDown:r,visibleCommitFiles:i,logDone:a,logStalled:o,logPagingPaused:s,setLogStalled:c,logSentinelRef:l,openCommitFiles:u,openCommit:d,openCommitFileDiff:f,setCommitDrillDown:p,setPaneEmpty:m,bumpPaneRequest:h}){return(0,M.jsxs)(M.Fragment,{children:[!r&&e.map(e=>{let n=t.divergenceOf(e.oid);return(0,M.jsx)(`li`,{children:(0,M.jsxs)(`button`,{onClick:()=>void u(e),title:`${e.author} · ${e.summary}`,className:`flex w-max min-w-full items-baseline gap-2 px-3 py-0.5 text-left hover:bg-ink-850`,children:[(0,M.jsx)(`span`,{className:`w-2 shrink-0 ${n===`behind`?`text-accent`:`text-added`}`,title:n===`ahead`?`Not on the upstream yet`:n===`behind`?`On the upstream, not here yet`:void 0,children:n===`ahead`?`↑`:n===`behind`?`↓`:``}),(0,M.jsx)(`span`,{className:`shrink-0 text-accent`,children:e.short_id}),(0,M.jsx)(`span`,{className:`w-10 shrink-0 text-right text-ink-400`,children:on(e.time)}),(0,M.jsx)(`span`,{className:`max-w-[6rem] shrink-0 truncate text-ink-400`,children:e.author}),t.refsOf(e.oid)?.map(e=>(0,M.jsx)(`span`,{className:`shrink-0 self-center rounded-sm border px-1 text-2xs ${pn(e.kind)}`,children:fn(e)},`${e.kind}:${e.name}`)),(0,M.jsx)(`span`,{className:`whitespace-nowrap ${e.merge?`text-ink-400`:``}`,children:e.summary})]})},e.oid)}),!r&&t.truncated&&(0,M.jsx)(`li`,{className:`px-3 py-1 text-2xs text-ink-400`,children:`Too many refs to mark them all — some branch, tag or upstream marks are not shown.`}),!r&&!a&&!o&&!s&&(0,M.jsxs)(`li`,{ref:l,className:`flex flex-col gap-2 px-3 py-1.5`,"aria-hidden":`true`,children:[(0,M.jsx)(mt,{className:`w-3/5`}),(0,M.jsx)(mt,{className:`w-2/5`}),(0,M.jsx)(mt,{className:`w-1/2`})]}),!r&&!a&&!o&&s&&(0,M.jsxs)(`li`,{className:`px-3 py-1 text-ink-400`,children:[`filtering `,n.length,` loaded commits — clear the filter to load more`]}),!r&&o&&(0,M.jsx)(`li`,{className:`px-3 py-1`,children:(0,M.jsx)(`button`,{onClick:()=>c(!1),className:`text-ink-400 hover:text-accent`,children:`could not load more — retry`})}),r&&(0,M.jsxs)(M.Fragment,{children:[(0,M.jsxs)(`li`,{className:`sticky top-0 z-10 flex w-max min-w-full items-center gap-1 bg-ink-900 px-2 py-1 text-ink-400`,children:[(0,M.jsx)(`button`,{onClick:()=>{h(),p(null),m()},className:`rounded-sm px-1 hover:text-accent`,title:`Back to commit log`,children:`< log`}),(0,M.jsx)(`span`,{className:`text-ink-600`,children:`·`}),(0,M.jsx)(`span`,{className:`shrink-0 text-accent`,children:r.commit.short_id}),(0,M.jsx)(`button`,{onClick:()=>d(r.commit.oid),className:`rounded-sm px-1 hover:text-accent`,title:`Show the complete commit diff`,children:`all changes`})]}),i.map(e=>(0,M.jsx)(`li`,{children:(0,M.jsxs)(`button`,{onClick:()=>f(r.commit.oid,e.path),className:`flex w-max min-w-full gap-2 px-3 py-0.5 text-left hover:bg-ink-850`,children:[(0,M.jsx)(`span`,{className:cn(e.index),children:e.index}),(0,M.jsx)(Zt,{path:e.path,from:e.old_path})]})},e.path)),r.files.length===0&&(0,M.jsx)(`li`,{className:`px-3 py-2 text-ink-400`,children:`No changed files.`}),r.files.length>0&&i.length===0&&(0,M.jsx)(`li`,{className:`px-3 py-2 text-ink-400`,children:`No matching files.`}),r.truncated&&(0,M.jsxs)(`li`,{className:`px-3 py-1 text-accent`,children:[`Showing the first `,r.files.length,` files.`]})]})]})}function hn({treeSearching:e,treeMatches:t,treeTruncated:n,treeSearchLoading:r,treeRows:i,treeExpanded:a,openFile:o,revealTreeDir:s,toggleTreeDir:c}){return e?(0,M.jsxs)(M.Fragment,{children:[t.map(e=>(0,M.jsx)(`li`,{children:(0,M.jsx)(`button`,{onClick:()=>{e.is_dir?s(e.path):o(e.path)},title:e.path,className:`w-max min-w-full whitespace-nowrap px-3 py-0.5 text-left hover:bg-ink-850`,children:e.is_dir?(0,M.jsxs)(`span`,{className:`text-accent`,children:[e.path,`/`]}):e.path})},e.path)),t.length===0&&(0,M.jsx)(`li`,{className:`px-3 py-0.5 text-ink-400`,children:r?`searching…`:`no matches`}),n&&(0,M.jsxs)(`li`,{className:`px-3 py-0.5 text-ink-400`,children:[`showing the first `,t.length,` matches`]})]}):(0,M.jsx)(M.Fragment,{children:i.map(e=>(0,M.jsx)(`li`,{children:(0,M.jsxs)(`button`,{onClick:()=>e.is_dir?c(e.path):o(e.path),title:e.path,style:{paddingLeft:`${e.depth*.75+.5}rem`},className:`flex w-max min-w-full items-center gap-1 py-0.5 pr-3 text-left hover:bg-ink-850`,children:[e.is_dir?(0,M.jsx)(Be,{open:a.has(e.path)}):(0,M.jsx)(`span`,{className:`h-3.5 w-3.5 shrink-0`}),(0,M.jsx)(`span`,{className:`whitespace-nowrap ${e.is_dir?`text-accent`:``}`,children:e.is_dir?`${e.name}/`:e.name})]})},e.path))})}function gn(e){let{tab:t,chooseTab:n,filter:r,setFilter:i,filterOpen:a,setFilterOpen:o,status:s,files:c,now:l,hotWindowMs:u,openDiff:d,openFile:f,openCommit:p,openCommitFileDiff:m,openCommitFiles:h,repo:g,authed:_,handle:v,sidebarRef:y,draggingSidebar:b,onSidebarDragStart:x,onSidebarDragMove:S,onSidebarDragEnd:C,onSidebarDragCancel:w,filesMax:T,bumpPaneRequest:ee,commits:te,logDone:ne,logStalled:re,setLogStalled:ie,commitDrillDown:ae,setCommitDrillDown:oe,logSentinelRef:se,visibleCommits:ce,decorations:E,logPagingPaused:le,visibleCommitFiles:ue,mobileView:de,restoreTree:fe,restoreKnown:pe,onTreeExpanded:me,clearPane:he,touched:ge}=e,_e=Gt({repo:g,authed:_,tab:t,filter:r,filterOpen:a,handle:v}),ve=t===`tree`&&a&&r!==``,ye=Kt(_e.treeChildren,_e.treeExpanded),{seedTreeExpanded:be}=_e,xe=(0,j.useRef)(!1);(0,j.useEffect)(()=>{xe.current||pe&&!ge&&t===`tree`&&(xe.current=!0,fe.length!==0&&be(fe))},[t,pe,ge,fe,be]);let Se=e=>{me([...zt(_e.treeExpanded,e)]),_e.toggleTreeDir(e)},D=e=>{let t=new Set(_e.treeExpanded);Ht(e).forEach(e=>t.add(e)),me([...t]),_e.revealTreeDir(e)},O=()=>{a&&i(``),o(e=>!e)};return(0,M.jsxs)(`section`,{ref:y,...kt(`list`),className:`nc-fade-in relative min-h-0 flex-col overflow-hidden ${de===`files`?`flex`:`hidden md:flex`} ${T?`md:flex`:`border-chrome-line md:border-r`}`,children:[!T&&(0,M.jsx)(`div`,{role:`separator`,"aria-orientation":`vertical`,"aria-label":`Resize the file sidebar (double-click to reset)`,title:`Drag to resize · double-click to reset`,onPointerDown:x,onPointerMove:S,onPointerUp:C,onPointerCancel:w,onLostPointerCapture:C,className:`absolute -right-px top-0 z-20 hidden h-full w-1.5 cursor-col-resize touch-none md:block ${b?`bg-accent`:`hover:bg-accent`}`}),(0,M.jsx)(Xt,{tab:t,onChoose:n,filterOpen:a,onToggleFilter:O}),a&&(0,M.jsx)(`input`,{value:r,onChange:e=>i(e.target.value),placeholder:`filter…`,autoFocus:!0,className:`mx-2 mb-1 shrink-0 rounded-sm bg-ink-850 px-2 py-1 outline-none placeholder:text-ink-400 focus:ring-1 focus:ring-accent`}),(0,M.jsxs)(`ul`,{className:`nc-content min-h-0 flex-1 overflow-auto`,children:[t===`status`&&(0,M.jsx)(ln,{status:s,files:c,now:l,hotWindowMs:u,openDiff:d}),t===`log`&&(0,M.jsx)(mn,{visibleCommits:ce,decorations:E,commits:te,commitDrillDown:ae,visibleCommitFiles:ue,logDone:ne,logStalled:re,logPagingPaused:le,setLogStalled:ie,logSentinelRef:se,openCommitFiles:h,openCommit:p,openCommitFileDiff:m,setCommitDrillDown:oe,setPaneEmpty:he,bumpPaneRequest:ee}),t===`tree`&&(0,M.jsx)(hn,{treeSearching:ve,treeMatches:_e.treeMatches,treeTruncated:_e.treeTruncated,treeSearchLoading:_e.treeSearchLoading,treeRows:ye,treeExpanded:_e.treeExpanded,openFile:f,revealTreeDir:D,toggleTreeDir:Se})]})]})}function _n(e){let t=[],n=[],r=[],i=()=>{let e=Math.max(n.length,r.length);for(let i=0;i{t(e=>e===`split`?`unified`:`split`)},[])}}var yn=[`.md`,`.markdown`],bn=[`.html`,`.htm`];function xn(e){let t=e.toLowerCase();return yn.some(e=>t.endsWith(e))}function Sn(e){let t=e.toLowerCase();return bn.some(e=>t.endsWith(e))}function Cn(e){return xn(e)||Sn(e)}function wn(e){return e.map(e=>e.map(e=>e.t).join(``)).join(` `)}function Tn(e,t=0){if(new Set(e.hunks.map(t=>t.file_path??e.path)).size>1)return null;for(let n of e.hunks.slice(Math.max(0,t)))for(let e of n.lines)if(e.new_lineno!==void 0)return e.new_lineno;return null}function En(e){return Math.max(0,e-1-2)}function Dn(e,t){return t<=0?null:Math.min(e,t)}function On(e,t){let n=0;return e.forEach((e,r)=>{e<=t&&(n=r)}),n}var kn=600;function An(e){let[t,n]=(0,j.useState)({scrollTop:0,height:kn}),r=(0,j.useCallback)(()=>{let t=e.current;if(!t)return;let r={scrollTop:t.scrollTop,height:t.clientHeight||kn};n(e=>e.scrollTop===r.scrollTop&&e.height===r.height?e:r)},[e]);return(0,j.useLayoutEffect)(()=>{r();let t=e.current;if(!t||typeof ResizeObserver>`u`)return;let n=new ResizeObserver(r);return n.observe(t),()=>n.disconnect()},[e,r]),{viewport:t,refresh:r}}function jn(e,t,n,r=20,i=12){let a=Math.max(1,Math.ceil(n/r)),o=Math.min(Math.floor(Math.max(0,t)/r),Math.max(0,e-a)),s=o+a,c=Math.max(0,Math.min(e,o-i)),l=Math.max(c,Math.min(e,s+i));return{start:c,end:l,before:c*r,after:(e-l)*r}}function Mn(e){return Math.max(0,e-1)*20}function Nn(e){return e.kind===`empty`||!e.source?null:{want:e.kind===`diff`?`file`:`diff`,source:e.source}}function Pn(e){return e.index!==`D`&&e.worktree!==`D`}function Fn(e){return e.hunks.some(e=>e.lines.some(e=>e.old_lineno!==void 0||e.new_lineno!==void 0))}function In(e){return e.kind===`workdir`?`workdir:${e.path}`:`commit:${e.oid}:${e.path}`}function Ln({pane:e,previewRendered:t,setPreviewRendered:n,filesMax:r,setMaximized:i,onShowOtherFace:a,canEdit:o,editing:s,onToggleEdit:c}){let u=vn(),d=S();return(0,M.jsxs)(`div`,{className:`ml-auto flex shrink-0 items-center gap-1`,children:[Nn(e)&&(0,M.jsx)(`button`,{onClick:a,"aria-pressed":e.kind===`file`,title:e.kind===`file`?`Back to the diff`:`Open the whole file at this change`,"aria-label":e.kind===`file`?`Back to the diff`:`Open the whole file at this change`,className:`flex shrink-0 items-center rounded-sm px-1.5 py-0.5 hover:text-accent ${e.kind===`file`?`text-accent`:``}`,children:(0,M.jsx)(b,{})}),e.kind===`diff`&&(0,M.jsx)(`button`,{onClick:u.toggle,"aria-pressed":u.layout===`split`,title:u.layout===`split`?`Switch to unified diff`:`Switch to split diff`,"aria-label":u.layout===`split`?`Switch to unified diff`:`Switch to split diff`,className:`flex shrink-0 items-center rounded-sm px-1.5 py-0.5 hover:text-accent ${u.layout===`split`?`text-accent`:``}`,children:(0,M.jsx)(l,{})}),o&&(0,M.jsx)(`button`,{onClick:c,"aria-pressed":s,title:s?`Stop editing`:`Edit this page's text`,"aria-label":s?`Stop editing`:`Edit this page's text`,className:`flex shrink-0 items-center rounded-sm px-1.5 py-0.5 hover:text-accent ${s?`text-accent`:``}`,children:(0,M.jsx)(de,{})}),e.kind===`file`&&Cn(e.value.path)&&!s&&(0,M.jsx)(`button`,{onClick:()=>n(e=>!e),"aria-pressed":t,title:t?`Show raw source`:`Show the rendered page`,"aria-label":t?`Show raw source`:`Show the rendered page`,className:`flex shrink-0 items-center rounded-sm px-1.5 py-0.5 hover:text-accent ${t?`text-accent`:``}`,children:(0,M.jsx)(v,{})}),(0,M.jsx)(`button`,{onClick:()=>i(r?`none`:`files`),"aria-pressed":r,...d(`view.toggleMaximize`,r?`Restore the layout`:`Maximize the file pane`),"aria-label":r?`Restore the layout`:`Maximize the file pane`,className:`hidden shrink-0 items-center rounded-sm px-1.5 py-0.5 hover:text-accent md:flex`,children:(0,M.jsx)(g,{maximized:r})})]})}var Rn=3;function zn(e){let t=e<1?1:String(Math.floor(e)).length;return Math.max(t,Rn)}function Bn(e){let t=0;for(let n of e)for(let e of n.lines)t=Math.max(t,e.old_lineno??0,e.new_lineno??0);return zn(t)}function Vn({nos:e,digits:t,tint:n=``,stickyClass:r=`sticky left-0`}){return(0,M.jsx)(`span`,{className:`${r} shrink-0 select-none bg-ink-950`,children:(0,M.jsx)(`span`,{className:`flex gap-[1ch] px-[1ch] text-ink-400 ${n}`,children:e.map((e,n)=>(0,M.jsx)(`span`,{className:`text-right`,style:{width:`${t}ch`},children:e??``},n))})})}function Hn(){let e=`(min-width: 768px)`,[t,n]=(0,j.useState)(()=>window.matchMedia(e).matches);return(0,j.useEffect)(()=>{let t=window.matchMedia(e),r=()=>n(t.matches);return t.addEventListener(`change`,r),()=>t.removeEventListener(`change`,r)},[]),t}function Un(e,t,n){return e.hunks.flatMap((e,r)=>{let i={kind:`header`,hunk:r,text:`${e.file_path?`${e.file_path} `:``}${e.header}`};if(!t)return[i,...e.lines.map(e=>({kind:`unified`,hunk:r,line:e}))];let a=_n(e.lines);return n?[i,...a.map(({left:e,right:t})=>({kind:`pair`,hunk:r,left:e,right:t}))]:[i,...a.map(({left:e})=>({kind:`side`,hunk:r,line:e,side:`old`,border:!1})),...a.map(({right:e},t)=>({kind:`side`,hunk:r,line:e,side:`new`,border:t===0}))]})}function Wn({line:e}){return(0,M.jsxs)(`span`,{className:`whitespace-pre pr-3`,children:[(0,M.jsx)(`span`,{className:`select-none text-ink-400`,children:e.kind}),e.spans.map((e,t)=>(0,M.jsx)(`span`,{style:{color:e.c},children:e.t},t))]})}function Gn({line:e,side:t,digits:n,stickyClass:r}){let i=e?sn(e.kind):`bg-ink-900/40`;return(0,M.jsxs)(`div`,{className:`flex min-w-0 flex-1 ${i}`,children:[(0,M.jsx)(Vn,{nos:[e?t===`old`?e.old_lineno:e.new_lineno:void 0],digits:n,tint:i,stickyClass:r}),e?(0,M.jsx)(Wn,{line:e}):(0,M.jsx)(`span`,{className:`pr-3`,children:` `})]})}function Kn({diff:e,split:t,viewport:n}){let r=Hn(),i=(0,j.useMemo)(()=>Un(e,t,r),[e,t,r]),a=Bn(e.hunks),o=jn(i.length,n.scrollTop,n.height);return(0,M.jsxs)(`div`,{className:`min-w-full py-1`,"data-virtual-count":i.length,children:[(0,M.jsx)(`div`,{"aria-hidden":`true`,style:{height:o.before}}),i.slice(o.start,o.end).map((e,t)=>{let n=o.start+t,r={"data-hunk":e.hunk,"data-virtual-row":n};if(e.kind===`header`)return(0,M.jsx)(`div`,{...r,className:`h-5 bg-ink-850 px-3 text-ink-400`,children:e.text},n);if(e.kind===`unified`){let t=sn(e.line.kind);return(0,M.jsxs)(`div`,{...r,className:`flex h-5 w-max min-w-full ${t}`,children:[(0,M.jsx)(Vn,{nos:[e.line.old_lineno,e.line.new_lineno],digits:a,tint:t}),(0,M.jsx)(Wn,{line:e.line})]},n)}return e.kind===`pair`?(0,M.jsxs)(`div`,{...r,className:`flex h-5 min-w-full`,children:[(0,M.jsx)(Gn,{line:e.left,side:`old`,digits:a}),(0,M.jsx)(`div`,{className:`flex min-w-0 flex-1 border-l border-ink-800`,children:(0,M.jsx)(Gn,{line:e.right,side:`new`,digits:a,stickyClass:`sticky left-1/2`})})]},n):(0,M.jsx)(`div`,{...r,className:`flex h-5 min-w-full ${e.border?`border-t border-ink-800`:``}`,children:(0,M.jsx)(Gn,{line:e.line,side:e.side,digits:a})},n)}),(0,M.jsx)(`div`,{"aria-hidden":`true`,style:{height:o.after}})]})}function qn({line:e}){return(0,M.jsxs)(M.Fragment,{children:[(0,M.jsx)(`span`,{className:`text-ink-400 select-none`,children:e.kind}),e.spans.map((e,t)=>(0,M.jsx)(`span`,{style:{color:e.c},children:e.t},t))]})}function Jn({line:e,digits:t,side:n}){if(e===null)return(0,M.jsxs)(`div`,{className:`flex bg-ink-900/40`,children:[(0,M.jsx)(Vn,{nos:[void 0],digits:t,tint:`bg-ink-900/40`}),(0,M.jsx)(`span`,{className:`whitespace-pre pr-3`,children:` `})]});let r=sn(e.kind);return(0,M.jsxs)(`div`,{className:`flex ${r}`,children:[(0,M.jsx)(Vn,{nos:[n===`old`?e.old_lineno:e.new_lineno],digits:t,tint:r}),(0,M.jsx)(`span`,{className:`whitespace-pre pr-3`,children:(0,M.jsx)(qn,{line:e})})]})}function Yn({cells:e,digits:t,side:n,border:r}){return(0,M.jsx)(`div`,{className:`min-w-0 flex-none overflow-x-auto md:flex-1 md:basis-1/2 ${r?`border-t border-ink-800 md:border-t-0 md:border-l`:``}`,children:(0,M.jsx)(`div`,{className:`w-max min-w-full`,children:e.map((e,r)=>(0,M.jsx)(Jn,{line:e,digits:t,side:n},r))})})}function Xn({lines:e,digits:t}){let n=_n(e);return(0,M.jsxs)(`div`,{className:`flex flex-col md:flex-row`,children:[(0,M.jsx)(Yn,{cells:n.map(e=>e.left),digits:t,side:`old`,border:!1}),(0,M.jsx)(Yn,{cells:n.map(e=>e.right),digits:t,side:`new`,border:!0})]})}function Zn({diff:e,split:t,viewport:n={scrollTop:0,height:600}}){if(e.hunks.reduce((e,t)=>e+t.lines.length,0)>200)return(0,M.jsxs)(M.Fragment,{children:[(0,M.jsx)(Kn,{diff:e,split:t,viewport:n}),e.truncated&&(0,M.jsx)(`p`,{className:`p-3 text-accent`,children:`Diff truncated — it exceeded the server's size ceiling.`})]});let r=Bn(e.hunks);return(0,M.jsxs)(`div`,{className:`p-1`,children:[e.hunks.length===0&&(0,M.jsx)(`p`,{className:`p-3 text-ink-400`,children:`No changes.`}),e.hunks.map((e,n)=>{let i=(0,M.jsxs)(`div`,{className:`bg-ink-850 px-3 py-0.5 text-ink-400`,children:[e.file_path?`${e.file_path} `:``,e.header]});return(0,M.jsx)(`div`,{"data-hunk":n,className:`mb-2`,children:t?(0,M.jsxs)(M.Fragment,{children:[i,(0,M.jsx)(Xn,{lines:e.lines,digits:r})]}):(0,M.jsxs)(`div`,{className:`w-max min-w-full`,children:[i,e.lines.map((e,t)=>{let n=sn(e.kind);return(0,M.jsxs)(`div`,{className:`flex ${n}`,children:[(0,M.jsx)(Vn,{nos:[e.old_lineno,e.new_lineno],digits:r,tint:n}),(0,M.jsx)(`span`,{className:`whitespace-pre pr-3`,children:(0,M.jsx)(qn,{line:e})})]},t)})]})},n)}),e.truncated&&(0,M.jsx)(`p`,{className:`p-3 text-accent`,children:`Diff truncated — it exceeded the server's size ceiling.`})]})}var Qn=[`failed to fetch dynamically imported module`,`error loading dynamically imported module`,`importing a module script failed`,`unable to preload css`];function $n(e){let t=e instanceof Error?e.message:typeof e==`string`?e:``;if(!t)return!1;let n=t.toLowerCase();return Qn.some(e=>n.includes(e))}var er=class extends j.Component{state={error:null,failed:!1};static getDerivedStateFromError(e){return{error:e,failed:!0}}componentDidCatch(e,t){console.error(`nightcrow: a subtree failed to render`,e,t)}render(){return this.state.failed?(0,M.jsx)(tr,{chunk:$n(this.state.error),region:this.props.region,className:this.props.className}):this.props.children}};function tr({chunk:e,region:t,className:n}){return(0,M.jsxs)(`div`,{role:`alert`,className:`h-full min-h-0 flex-col items-start gap-3 p-4 text-ink-400 ${n??`flex`}`,children:[e?(0,M.jsxs)(M.Fragment,{children:[(0,M.jsx)(`p`,{className:`text-accent`,children:`Part of the app could not be loaded.`}),(0,M.jsx)(`p`,{children:`Most likely the server was updated while this tab was open, and reloading picks up the current version. If the reload fails too, the server is not reachable from here. Either way nothing on the server is affected — the session, its repositories, and its terminals are untouched.`})]}):(0,M.jsxs)(M.Fragment,{children:[(0,M.jsx)(`p`,{className:`text-removed`,children:t?`The ${t} could not be rendered.`:`Something went wrong.`}),(0,M.jsx)(`p`,{children:`The details are in the browser console.`})]}),(0,M.jsx)(`button`,{onClick:()=>window.location.reload(),className:`rounded-sm border border-ink-700 px-2 py-1 text-ink-200 hover:border-accent hover:text-accent`,children:`Reload`})]})}function nr({lines:e}){let t=zn(e.length);return(0,M.jsx)(`pre`,{className:`w-max min-w-full py-2 text-ink-200`,children:e.map((e,n)=>(0,M.jsxs)(`div`,{"data-line":n+1,className:`flex`,children:[(0,M.jsx)(Vn,{nos:[n+1],digits:t}),(0,M.jsx)(`span`,{className:`whitespace-pre pr-3`,children:e.length===0?` `:e.map((e,t)=>(0,M.jsx)(`span`,{style:{color:e.c},children:e.t},t))})]},n))})}function rr({lines:e,viewport:t}){let n=zn(e.length),r=jn(e.length,t.scrollTop,t.height);return(0,M.jsxs)(`pre`,{className:`w-max min-w-full`,"data-virtual-count":e.length,children:[(0,M.jsx)(`div`,{"aria-hidden":`true`,style:{height:r.before}}),e.slice(r.start,r.end).map((e,t)=>{let i=r.start+t;return(0,M.jsxs)(`div`,{"data-line":i+1,"data-virtual-row":i,className:`flex h-5 text-ink-200`,children:[(0,M.jsx)(Vn,{nos:[i+1],digits:n}),(0,M.jsx)(`span`,{className:`whitespace-pre pr-3`,children:e.length===0?` `:e.map((e,t)=>(0,M.jsx)(`span`,{style:{color:e.c},children:e.t},t))})]},i)}),(0,M.jsx)(`div`,{"aria-hidden":`true`,style:{height:r.after}})]})}var ir=`modulepreload`,ar=function(e,t){return new URL(e,t).href},or={},sr=function(e){return e.pathname.endsWith(`.css`)},cr=function(e,t,n){if(t in e)return e[t];let r=n();if(!r){e[t]=void 0;return}let i=r.then(()=>{e[t]=void 0},n=>{throw e[t]=void 0,n});return e[t]=i,i},lr=function(e,t,n){let r=Promise.resolve();if(t&&t.length>0){let e,i=document.querySelector(`meta[property=csp-nonce]`),a=i?.nonce||i?.getAttribute(`nonce`);function o(e){return Promise.all(e.map(e=>Promise.resolve(e).then(e=>({status:`fulfilled`,value:e}),e=>({status:`rejected`,reason:e}))))}function s(e){return import.meta.resolve?new URL(import.meta.resolve(e)):new URL(e,import.meta.url)}r=o(t.map(t=>{t=ar(t,n);let r=s(t),i=sr(r);return cr(or,r.href,()=>{if(e===void 0){e={all:new Set,styles:new Set};let t=document.getElementsByTagName(`link`);for(let n=t.length-1;n>=0;n--){let r=t[n];e.all.add(r.href),r.rel===`stylesheet`&&e.styles.add(r.href)}}if((i?e.styles:e.all).has(r.href))return;let t=document.createElement(`link`);if(t.rel=i?`stylesheet`:ir,i||(t.as=`script`),t.crossOrigin=``,t.href=r.href,a&&t.setAttribute(`nonce`,a),document.head.appendChild(t),i)return new Promise((e,n)=>{t.addEventListener(`load`,e),t.addEventListener(`error`,()=>n(Error(`Unable to preload CSS for ${r}`)))})})}).filter(e=>e!==void 0))}function i(e){let t=new Event(`vite:preloadError`,{cancelable:!0});if(t.payload=e,window.dispatchEvent(t),!t.defaultPrevented)throw e}return r.then(t=>{for(let e of t||[])e.status===`rejected`&&i(e.reason);return e().catch(i)})};function ur(e,t){return`${e??``}\u0000${In(t)}`}var dr=(0,j.lazy)(()=>lr(()=>import(`./Markdown-DEJAds14.js`).then(e=>({default:e.MarkdownView})),__vite__mapDeps([0,1,2,3]),import.meta.url)),fr=(0,j.lazy)(()=>lr(()=>import(`./Html-DGFy4jGa.js`).then(e=>({default:e.HtmlView})),__vite__mapDeps([4,1]),import.meta.url)),pr=(0,j.lazy)(()=>lr(()=>import(`./HtmlEditor-CrB2hwHy.js`).then(e=>({default:e.HtmlEditor})),__vite__mapDeps([5,1,2,6,7]),import.meta.url));function mr({repo:e,pane:t,loading:n=!1,previewRendered:r,setPreviewRendered:i,filesMax:a,setMaximized:o,showOtherFace:s,status:c,className:l=``}){let u=vn(),[d,f]=(0,j.useState)(!1),p=t.kind===`file`?t.value.path:null,m=t.kind===`file`&&t.source?.kind===`commit`,h=e!==null&&p!==null&&!m&&Sn(p),g=(0,j.useRef)(null),{viewport:_,refresh:v}=An(g),y=t.kind===`file`?t.anchor:void 0,b=(0,j.useRef)(null),x=()=>{let n=g.current;if(!n)return 0;let r=n.getBoundingClientRect().top,i=Array.from(n.querySelectorAll(`[data-hunk]`),e=>({offset:e.getBoundingClientRect().top-r+n.scrollTop,hunk:Number(e.dataset.hunk??0)}));return t.kind===`diff`&&t.source&&(b.current={key:ur(e,t.source),top:n.scrollTop,left:n.scrollLeft}),i[On(i.map(e=>e.offset),n.scrollTop)]?.hunk??0};return(0,j.useEffect)(()=>{let n=g.current;if(!n)return;if(t.kind===`diff`&&t.source){let r=b.current;r&&r.key===ur(e,t.source)&&(n.scrollTop=r.top,n.scrollLeft=r.left,b.current=null,v());return}if(y===void 0||t.kind!==`file`)return;let r=Dn(y,t.value.lines.length);if(r===null)return;if(t.value.lines.length>200){n.scrollTop=Mn(r),v();return}let i=n.querySelector(`[data-line="${r}"]`);i&&(n.scrollTop+=i.getBoundingClientRect().top-n.getBoundingClientRect().top,v())},[t,y,e,v]),(0,j.useEffect)(()=>{f(!1)},[e,p,m]),(0,M.jsxs)(`section`,{...kt(`content`),className:`min-h-0 min-w-0 flex-col ${l}`,children:[(0,M.jsxs)(`div`,{className:`flex shrink-0 items-center gap-2 bg-ink-850 px-3 py-0.5 text-ink-400`,children:[t.kind===`file`&&(0,M.jsx)(Zt,{path:t.value.path,className:`min-w-0 truncate`}),(0,M.jsx)(Ln,{pane:t,previewRendered:r,setPreviewRendered:i,filesMax:a,setMaximized:o,onShowOtherFace:()=>s(x()),canEdit:h,editing:d&&h,onToggleEdit:()=>f(e=>!e)})]}),(0,M.jsx)(`div`,{ref:g,onScroll:v,className:`nc-content min-h-0 flex-1 overflow-auto`,children:n?(0,M.jsx)(`div`,{"aria-busy":`true`,"aria-label":`Loading`,className:`py-2`,children:(0,M.jsx)(ht,{rows:12})}):(0,M.jsxs)(M.Fragment,{children:[t.kind===`empty`&&(c===null?(0,M.jsx)(`div`,{"aria-busy":`true`,"aria-label":`Loading`,className:`py-2`,children:(0,M.jsx)(ht,{rows:12})}):c.unavailable===void 0?(0,M.jsx)(`p`,{className:`nc-fade-in p-4 text-ink-400`,children:`Select a file or commit.`}):(0,M.jsx)(`p`,{className:`nc-fade-in p-4 text-ink-400`,children:an(c.unavailable)})),t.kind===`file`&&(0,M.jsxs)(M.Fragment,{children:[d&&h&&e!==null&&p!==null?(0,M.jsx)(er,{region:`preview`,children:(0,M.jsx)(j.Suspense,{fallback:(0,M.jsx)(`div`,{"aria-busy":`true`,"aria-label":`Opening the editor`,className:`py-2`,children:(0,M.jsx)(ht,{rows:12})}),children:(0,M.jsx)(pr,{repo:e,path:p})})},`edit:${p}`):Cn(t.value.path)&&r?(0,M.jsx)(er,{region:`preview`,children:(0,M.jsx)(j.Suspense,{fallback:(0,M.jsx)(`div`,{"aria-busy":`true`,"aria-label":`Rendering`,className:`py-2`,children:(0,M.jsx)(ht,{rows:12})}),children:Sn(t.value.path)&&e!==null?(0,M.jsx)(fr,{src:A.previewUrl(e,t.value.path,t.source?.kind===`commit`?t.source.oid:void 0)}):(0,M.jsx)(dr,{source:wn(t.value.lines)})})},t.value.path):t.value.lines.length>200?(0,M.jsx)(rr,{lines:t.value.lines,viewport:_}):(0,M.jsx)(nr,{lines:t.value.lines}),t.value.truncated&&(0,M.jsx)(`p`,{className:`p-3 text-accent`,children:`File truncated — it exceeded the server's size ceiling.`})]}),t.kind===`diff`&&(0,M.jsx)(Zn,{diff:t.value,split:u.layout===`split`,viewport:_})]})})]})}var hr=[{key:`files`,label:`Repo`,icon:Ve},{key:`diff`,label:`Content`,icon:He},{key:`terminal`,label:`Terminal`,icon:Ue}];function gr({view:e,onSelect:t}){return(0,M.jsx)(`nav`,{"aria-label":`Switch view`,className:`flex shrink-0 items-stretch border-t border-chrome-line bg-ink-900 md:hidden`,children:hr.map(({key:n,label:r,icon:i})=>(0,M.jsxs)(`button`,{onClick:()=>t(n),"aria-current":e===n?`page`:void 0,className:`flex min-h-11 flex-1 flex-col items-center justify-center gap-0.5 py-1 text-xs ${e===n?`text-accent`:`text-ink-400`}`,children:[(0,M.jsx)(i,{className:`h-5 w-5`}),r]},n))})}var _r=(0,j.lazy)(()=>lr(()=>import(`./Terminal-D1zALCZX.js`).then(e=>({default:e.TerminalPanel})),__vite__mapDeps([8,1,2,9,7]),import.meta.url));function vr({repository:{id:e,current:t,status:n},sidebar:r,filePane:i,layout:{sidebarWidth:a,sidebarRef:o,draggingSidebar:s,onSidebarDragStart:c,onSidebarDragMove:l,onSidebarDragEnd:u,onSidebarDragCancel:d,upperRef:f,lowerRef:p,draggingUpper:m,onUpperDragStart:h,onUpperDragMove:g,onUpperDragEnd:_,onUpperDragCancel:v,maximized:y,setMaximized:b,mobileView:x,setMobileView:S}}){let C=y===`files`;return(0,j.useEffect)(()=>d,[e,d]),(0,j.useEffect)(()=>v,[v]),(0,M.jsxs)(M.Fragment,{children:[s&&(0,M.jsx)(`div`,{className:`fixed inset-0 z-50 cursor-col-resize`}),m&&(0,M.jsx)(`div`,{className:`fixed inset-0 z-50 cursor-row-resize`}),(0,M.jsxs)(`main`,{ref:f,className:`grid min-h-0 grid-cols-1 md:grid-cols-[var(--nc-sidebar)_minmax(0,1fr)] ${x===`terminal`?`hidden md:grid`:``} ${s||m?`select-none`:``}`,style:{"--nc-sidebar":C?`0px`:`min(${a}px, ${yt*100}vw)`},children:[(0,M.jsx)(gn,{...r,repo:e,status:n,sidebarRef:o,draggingSidebar:s,onSidebarDragStart:c,onSidebarDragMove:l,onSidebarDragEnd:u,onSidebarDragCancel:d,filesMax:C,mobileView:x},e),(0,M.jsx)(mr,{...i,filesMax:C,setMaximized:b,status:n,className:`nc-fade-in ${x===`diff`?`flex`:`hidden md:flex`}`})]}),(0,M.jsx)(er,{region:`terminal panel`,className:x===`terminal`?`flex`:`hidden md:flex`,children:(0,M.jsx)(j.Suspense,{fallback:(0,M.jsx)(`div`,{className:`min-h-0 border-t border-chrome-line ${x===`terminal`?`block`:`hidden md:block`}`}),children:(0,M.jsx)(_r,{repo:e,maximized:y===`terminal`,onToggleMaximized:()=>b(e=>e===`terminal`?`none`:`terminal`),className:`nc-fade-in ${x===`terminal`?`flex`:`hidden md:flex`} ${y===`files`?`overflow-hidden`:``}`,sectionRef:p,showDivider:y===`none`,draggingUpper:m,onUpperDragStart:h,onUpperDragMove:g,onUpperDragEnd:_,onUpperDragCancel:v})})}),(0,M.jsx)(gr,{view:x,onSelect:S}),(0,M.jsxs)(`footer`,{className:`flex shrink-0 items-center gap-3 border-t border-chrome-line bg-ink-900 px-3 py-1 text-ink-400`,children:[(0,M.jsx)(`span`,{className:`min-w-0 shrink-[1000] truncate`,children:t?.display_path}),n?.branch&&(0,M.jsx)(`span`,{className:`max-w-[50%] shrink-0 truncate text-accent`,children:n.branch}),dn(n)&&(0,M.jsx)(`span`,{className:`shrink-0 font-medium text-removed`,role:`status`,children:dn(n)}),n?.tracking&&(0,M.jsxs)(`span`,{className:`shrink-0`,children:[`↑`,n.tracking.ahead,` ↓`,n.tracking.behind]}),(0,M.jsx)(`span`,{className:`ml-auto shrink-0`,children:n?(0,M.jsx)(`span`,{className:`text-added`,children:`● live`}):`connecting…`})]})]})}function yr({settings:e}){let{leaderText:t,conflict:n,setLeader:r,disable:i,reset:a}=e,[o,s]=(0,j.useState)(t),[c,l]=(0,j.useState)(null);(0,j.useEffect)(()=>{s(t),l(null)},[t]);let u=()=>{r(o)?l(null):l(`"${o}" is not a chord. Write it as Ctrl+F, Alt+Space or Ctrl+Shift+ArrowLeft.`)};return(0,M.jsxs)(`section`,{className:`shrink-0 border-b border-ink-700 px-3 py-2`,children:[(0,M.jsxs)(`p`,{className:`text-ink-400`,children:[`Leader chord:`,` `,t?(0,M.jsx)(`kbd`,{className:`rounded-sm border border-ink-600 bg-ink-850 px-1.5 py-0.5 font-mono text-ink-50`,children:t}):(0,M.jsx)(`span`,{className:`text-ink-200`,children:`switched off`})]}),(0,M.jsxs)(`div`,{className:`mt-1.5 flex items-stretch gap-2`,children:[(0,M.jsx)(`input`,{value:o,onChange:e=>s(e.target.value),onKeyDown:e=>{e.key===`Enter`&&u()},placeholder:`Ctrl+F`,"aria-label":`leader chord`,spellCheck:!1,autoCapitalize:`none`,autoCorrect:`off`,className:`min-w-0 flex-1 rounded-sm border border-ink-700 bg-ink-950 px-2 py-1 font-mono text-ink-50 placeholder:text-ink-400 focus:border-ink-600 focus:outline-none`}),(0,M.jsx)(`button`,{type:`button`,onClick:u,className:`shrink-0 rounded-sm border border-ink-700 px-2 py-1 text-ink-200 hover:bg-ink-850`,children:`Rebind`}),(0,M.jsx)(`button`,{type:`button`,onClick:i,title:`Leave the leader unbound. Standalone chords keep working.`,className:`shrink-0 rounded-sm border border-ink-700 px-2 py-1 text-ink-200 hover:bg-ink-850`,children:`Switch off`}),(0,M.jsx)(`button`,{type:`button`,onClick:a,title:`Back to the leader the TUI ships with`,className:`shrink-0 rounded-sm border border-ink-700 px-2 py-1 text-ink-200 hover:bg-ink-850`,children:`Reset`})]}),c&&(0,M.jsx)(`p`,{role:`alert`,className:`mt-1 text-removed`,children:c}),n&&(0,M.jsxs)(`p`,{role:`status`,className:`mt-1 text-accent`,children:[n,` Rebind it above if you would rather keep that key.`]})]})}function br({keys:e}){return e?(0,M.jsx)(`span`,{className:`flex shrink-0 items-center gap-1`,children:e.map((e,t)=>(0,M.jsxs)(`span`,{className:`flex items-center gap-1`,children:[t>0&&(0,M.jsx)(`span`,{className:`text-ink-400`,children:`then`}),(0,M.jsx)(`kbd`,{className:`rounded-sm border border-ink-600 bg-ink-850 px-1.5 py-0.5 font-mono text-ink-50`,children:e})]},e))}):(0,M.jsx)(`span`,{className:`shrink-0 text-ink-400`,children:`no key — the leader is switched off`})}function xr({action:e,keys:t,ariaKeys:n,available:r,onRun:i}){let a=`flex w-full flex-col gap-0.5 rounded-sm px-3 py-1.5 text-left ${r?``:`opacity-50`}`,o=(0,M.jsxs)(M.Fragment,{children:[(0,M.jsxs)(`span`,{className:`flex w-full items-baseline gap-2`,children:[(0,M.jsx)(`span`,{className:`min-w-0 flex-1 text-ink-50`,children:e.label}),e.support===`reinterpreted`&&(0,M.jsx)(`span`,{className:`shrink-0 rounded-sm bg-ink-700 px-1 text-2xs uppercase tracking-wide text-ink-200`,children:`reinterpreted`}),e.support===`browserOnly`&&(0,M.jsx)(`span`,{className:`shrink-0 rounded-sm bg-ink-700 px-1 text-2xs uppercase tracking-wide text-ink-200`,children:`browser only`}),!r&&(0,M.jsx)(`span`,{className:`shrink-0 text-2xs uppercase tracking-wide text-ink-400`,children:`not available here`}),(0,M.jsx)(br,{keys:t})]}),e.note&&(0,M.jsx)(`span`,{className:`text-ink-400`,children:e.note})]}),s={"data-shortcut-action":e.id,"aria-disabled":!r||void 0,"aria-keyshortcuts":n??void 0};return e.keyboardOnly?(0,M.jsx)(`li`,{children:(0,M.jsx)(`div`,{...s,className:a,children:o})}):(0,M.jsx)(`li`,{children:(0,M.jsx)(`button`,{type:`button`,...s,onClick:()=>{r&&i()},className:`${a} ${r?`hover:bg-ink-850`:``}`,children:o})})}var Sr={terminal:`Terminal`,project:`Projects`,view:`Layout and views`,focus:`Focus`,session:`Session`,help:`Help`},Cr=(()=>{let e=[];for(let t of ve){let n=e.find(e=>e.group===t.group);n?n.actions.push(t):e.push({group:t.group,actions:[t]})}return e})(),wr=`nc-shortcut-help-title`;function Tr({onClose:e,leader:t}){let n=ie(),r=we(),i=(0,j.useRef)(null),a=(0,j.useRef)(!1);(0,j.useEffect)(()=>{let e=document.activeElement;return i.current?.focus(),()=>{a.current||e instanceof HTMLElement&&e.isConnected&&e.focus()}},[]),(0,j.useEffect)(()=>{let t=t=>{t.key===`Escape`&&e()};return document.addEventListener(`keydown`,t),()=>document.removeEventListener(`keydown`,t)},[e]);let o=t=>{a.current=!0,n?.runAction(t.id),e()};return(0,M.jsx)(`div`,{className:`nc-fade-in fixed inset-0 z-50 flex items-center justify-center bg-black/60 p-4`,onClick:e,children:(0,M.jsxs)(`div`,{ref:i,role:`dialog`,"aria-modal":`true`,"aria-labelledby":wr,tabIndex:-1,className:`nc-rise-in flex max-h-[85vh] w-[40rem] max-w-full flex-col rounded-lg border border-ink-700 bg-ink-900 focus:outline-none`,onClick:e=>e.stopPropagation(),children:[(0,M.jsxs)(`div`,{className:`flex shrink-0 items-center gap-2 border-b border-ink-700 px-3 py-2`,children:[(0,M.jsx)(`span`,{id:wr,className:`font-medium text-ink-50`,children:`Keyboard shortcuts`}),(0,M.jsx)(`button`,{type:`button`,onClick:e,"aria-label":`close`,className:`ml-auto flex h-6 w-6 items-center justify-center rounded-sm text-ink-400 hover:text-ink-200`,children:(0,M.jsx)(pe,{})})]}),(0,M.jsx)(yr,{settings:t}),(0,M.jsxs)(`div`,{className:`min-h-0 flex-1 overflow-y-auto py-1`,children:[Cr.map(({group:e,actions:n})=>(0,M.jsxs)(`section`,{children:[(0,M.jsx)(`h3`,{className:`px-3 py-1 text-caption uppercase text-ink-400`,children:Sr[e]}),(0,M.jsx)(`ul`,{children:n.map(e=>(0,M.jsx)(xr,{action:e,keys:m(e.id,t.leader),ariaKeys:w(e.id,t.leader),available:r(e.id),onRun:()=>o(e)},e.id))})]},e)),(0,M.jsxs)(`section`,{children:[(0,M.jsx)(`h3`,{className:`px-3 py-1 text-caption uppercase text-ink-400`,children:`Not bound in the browser`}),(0,M.jsx)(`ul`,{children:p.map(e=>(0,M.jsxs)(`li`,{className:`px-3 py-1.5`,children:[(0,M.jsxs)(`span`,{className:`flex items-baseline gap-2`,children:[(0,M.jsx)(`span`,{className:`min-w-0 flex-1 text-ink-200`,children:e.label}),(0,M.jsx)(`kbd`,{className:`shrink-0 rounded-sm border border-ink-700 bg-ink-850 px-1.5 py-0.5 font-mono text-ink-400`,children:e.leader})]}),(0,M.jsx)(`span`,{className:`text-ink-400`,children:e.reason})]},e.leader))})]})]})]})})}var Er=[`terminal.newPane`,`terminal.closePane`,`view.toggleMaximize`,`project.openDialog`,`help.shortcuts`],Dr={keys:`3-9,0`,label:`pane 1-8`,click:null},Or={keys:`3-9,0`,label:`swap active pane with this pane`,click:null},kr={keys:`esc`,label:`cancel`,click:null};function Ar(e,t,n){return e.armed&&e.swapPending?{chip:`SWAP`,segments:[Or,kr]}:e.armed?{chip:`PREFIX`,segments:Mr(n)}:t?{chip:null,segments:jr(t,n)}:{chip:null,segments:Nr(n)}}function jr(e,t){let n=r(e),i=[{keys:n,label:`leader`,click:{kind:`arm`}}];for(let e of ve)Er.includes(e.id)&&t(e.id)&&i.push(Pr(e,`${n} ${e.leader}`));return i}function Mr(e){let t=[],n=!1;for(let r of ve)r.leader!==void 0&&e(r.id)&&(T(r.id)===null?t.push(Pr(r,r.leader)):(n||t.push(Dr),n=!0));return t.push(kr),t}function Nr(e){let t=[{keys:`leader`,label:`switched off`,click:{kind:`run`,action:`help.shortcuts`}}];for(let n of ve)n.chord!==void 0&&e(n.id)&&t.push(Pr(n,n.chord));return t}function Pr(e,t){return{keys:t,label:e.hint,click:{kind:`run`,action:e.id}}}var Fr=`shrink-0 whitespace-nowrap`;function Ir({state:e,onClick:t}){let n=Ar(e,d(),we());return(0,M.jsxs)(`div`,{role:`toolbar`,"aria-label":`Keyboard hints`,className:`hidden shrink-0 items-center gap-1 overflow-hidden border-t border-chrome-line bg-ink-900 px-2 py-0.5 text-xs text-ink-400 md:flex`,children:[n.chip&&(0,M.jsx)(`span`,{"data-hint-chip":n.chip,className:`shrink-0 bg-accent px-1 font-bold text-ink-950`,children:n.chip}),n.segments.map((e,n)=>(0,M.jsxs)(j.Fragment,{children:[n>0&&(0,M.jsx)(`span`,{className:`shrink-0 text-ink-600`,children:`|`}),(0,M.jsx)(Lr,{segment:e,onClick:t})]},`${e.keys} ${e.label}`))]})}function Lr({segment:e,onClick:t}){let n=(0,M.jsxs)(M.Fragment,{children:[(0,M.jsx)(`span`,{className:`text-ink-200`,children:e.keys}),`: `,e.label]});if(!e.click)return(0,M.jsx)(`span`,{className:Fr,children:n});let r=e.click;return(0,M.jsx)(`button`,{type:`button`,"data-hint-action":r.kind===`run`?r.action:`arm`,onPointerDown:e=>e.preventDefault(),onClick:()=>t(r),className:`${Fr} rounded-sm hover:text-accent`,children:n})}function Rr(e,t){return e?`grid-rows-[minmax(0,1fr)_auto_auto] ${t===`terminal`?`md:grid-rows-[minmax(0,0fr)_minmax(0,1fr)_auto_auto]`:t===`files`?`md:grid-rows-[minmax(0,1fr)_minmax(0,0fr)_auto_auto]`:`md:grid-rows-[minmax(0,var(--nc-upper))_minmax(0,var(--nc-lower))_auto_auto]`}`:`grid-rows-[1fr]`}function zr(e,t){let n=Br(e);if(n.length===0)return null;let r=e.at,i=r===null?-1:n.findIndex(e=>Vr(e,r)),a;return a=i===-1?t>0?n[0]:n[n.length-1]:n[(i+t+n.length)%n.length],r!==null&&Vr(a,r)?null:a}function Br({paneCount:e,maximized:t,narrow:n,mobileView:r}){let i={kind:`list`},a={kind:`content`},o=Array.from({length:e},(e,t)=>({kind:`pane`,index:t}));if(n)switch(r){case`files`:return[i];case`diff`:return[a];case`terminal`:return o}switch(t){case`terminal`:return o;case`files`:return[i,a];case`none`:return[i,a,...o]}}function Vr(e,t){return e.kind===t.kind?e.kind!==`pane`||t.kind!==`pane`||e.index===t.index:!1}function Hr(e,t,n){if(e.length<=1||t===null)return null;let r=e.indexOf(t);return r<0?null:e[(r+n+e.length)%e.length]}var Ur={armed:!1},Wr={kind:`none`};function Gr(e=Wr){return{state:Ur,effect:e}}function Kr(e,t){switch(t.kind){case`blur`:case`focusChange`:case`dialogOpen`:case`repoChange`:case`socketReconnect`:case`disabled`:case`suppressed`:case`cancel`:return Gr();case`consumed`:return Gr();case`arm`:return{state:{armed:!0,swapPending:!1},effect:Wr};case`literalLeader`:return Gr({kind:`sendLiteralLeader`,data:t.data});case`action`:return qr(e,t.action.id);case`ignore`:return{state:e,effect:Wr}}}function qr(e,t){if(e.armed&&e.swapPending){let e=T(t);return e===null?Gr():Gr({kind:`swapWith`,pane:e})}return t===`terminal.swapPanePrompt`?{state:{armed:!0,swapPending:!0},effect:Wr}:Gr({kind:`run`,action:t})}var Jr=ve.flatMap(e=>{if(!e.chord)return[];let t=he(e.chord);return t?[{spec:t,action:e}]:[]}),Yr=new Set([`Shift`,`Control`,`Alt`,`Meta`]),Xr=229,Zr=new Set([`Process`,`Unidentified`]),Qr={kind:`ignore`};function $r(e){return e.isComposing===!0||e.keyCode===Xr||Zr.has(e.key)}function ei(e){return e.key===`Escape`||e.ctrlKey&&!e.shiftKey&&!e.altKey&&!e.metaKey&&e.key.toLowerCase()===`c`}function ti(e,t){if(e.type!==`keydown`||$r(e)||e.repeat===!0||t.suppressed)return Qr;if(t.armed){if(ei(e))return{kind:`cancel`};if(t.leader&&y(t.leader,e))return{kind:`literalLeader`,data:D(t.leader)??``};if(e.key.length===1){let t=ee(e.key);if(t)return{kind:`action`,action:t}}return Yr.has(e.key)?Qr:{kind:`consumed`}}if(t.leader&&y(t.leader,e))return{kind:`arm`};for(let{spec:t,action:n}of Jr)if(y(t,e))return{kind:`action`,action:n};return Qr}var ni=new Set([`checkbox`,`radio`,`button`,`submit`,`reset`,`image`,`range`,`color`,`file`]),ri=new Set([`textbox`,`searchbox`,`combobox`]);function ii(e){if(!e)return!1;if(e.isContentEditable===!0)return!0;let t=e.role?.toLowerCase()??``;if(ri.has(t))return!0;switch(e.tagName.toUpperCase()){case`INPUT`:return!ni.has(e.type?.toLowerCase()??`text`);case`TEXTAREA`:case`SELECT`:return!0;default:return!1}}function ai(e){return e.dialogOpen||e.composing||e.target?.inDialog===!0?!0:ii(e.target)}function oi(e,t=!0){let n=(0,j.useRef)(e);n.current=e,(0,j.useEffect)(()=>{if(!t)return;let e=e=>{n.current(e)&&(e.preventDefault(),e.stopPropagation(),e.stopImmediatePropagation())};return document.addEventListener(`keydown`,e,{capture:!0}),()=>document.removeEventListener(`keydown`,e,{capture:!0})},[t])}function si({enabled:e,leader:t,dialogOpen:n,repo:r}){let i=ie(),a=(0,j.useRef)(Ur),[o,s]=(0,j.useState)(Ur),c=(0,j.useRef)(i);c.current=i;let l=(0,j.useCallback)(e=>{let t=Kr(a.current,e);a.current=t.state,s(t.state);let n=c.current;n&&ci(t.effect,n)},[]);oi((0,j.useCallback)(e=>{let r=ai({target:At(e.target),dialogOpen:n,composing:e.isComposing===!0}),i=ti(e,{leader:t,armed:a.current.armed,suppressed:r});return r?(l({kind:`suppressed`}),!1):(l(i),i.kind!==`ignore`)},[n,t,l]),e&&i!==null),(0,j.useEffect)(()=>{if(!e)return;let t=()=>l({kind:`blur`}),n=e=>{let t=At(e.target);(ii(t)||t?.inDialog===!0)&&l({kind:`focusChange`})};return window.addEventListener(`blur`,t),document.addEventListener(`focusin`,n,{capture:!0}),()=>{window.removeEventListener(`blur`,t),document.removeEventListener(`focusin`,n,{capture:!0})}},[e,l]),(0,j.useEffect)(()=>{n&&l({kind:`dialogOpen`})},[n,l]),(0,j.useEffect)(()=>{e||l({kind:`disabled`})},[e,l]);let u=(0,j.useRef)(r);return(0,j.useEffect)(()=>{u.current!==r&&(u.current=r,l({kind:`repoChange`}))},[r,l]),(0,j.useEffect)(()=>{if(i)return i.onDisarm(()=>l({kind:`socketReconnect`}))},[i,l]),(0,j.useEffect)(()=>{l({kind:`cancel`})},[t,l]),{state:o,arm:(0,j.useCallback)(()=>l({kind:`arm`}),[l]),disarm:(0,j.useCallback)(()=>l({kind:`cancel`}),[l])}}function ci(e,t){switch(e.kind){case`none`:return;case`run`:t.runAction(e.action);return;case`swapWith`:t.swapPanes(e.pane);return;case`sendLiteralLeader`:e.data&&t.sendLiteralLeader(e.data);return}}var li=`nightcrow.shortcut.leader`;function ui(){let[e,t]=(0,j.useState)(di),n=(0,j.useCallback)(e=>{t(e),pi(e===null?null:r(e))},[]),i=(0,j.useCallback)(e=>{let t=he(e);return t?(n(t),!0):!1},[n]),a=(0,j.useCallback)(()=>n(null),[n]),o=(0,j.useCallback)(()=>n(te),[n]);return{leader:e,leaderText:e?r(e):``,conflict:e?ce(e):null,setLeader:i,disable:a,reset:o}}function di(){let e=fi();return e?e.leader===null?null:he(e.leader)??te:te}function fi(){try{let e=localStorage.getItem(li);if(!e)return null;let t=JSON.parse(e);if(!t||typeof t!=`object`||Array.isArray(t))return null;let n=t.leader;return n===null?{leader:null}:typeof n==`string`?{leader:n}:null}catch{return null}}function pi(e){try{localStorage.setItem(li,JSON.stringify({leader:e}))}catch{}}function mi({enabled:e,repo:t,repos:n,selectRepo:r,closeRepo:i,openPicker:a,pickerOpen:o,cycleAccent:s,reloadConfig:c,tab:l,chooseTab:u,maximized:d,setMaximized:f,mobileView:p}){let m=ie(),h=ui(),[g,_]=(0,j.useState)(!1),v=(0,j.useCallback)(()=>_(!0),[]),y=(0,j.useCallback)(()=>_(!1),[]),b=(0,j.useCallback)(e=>{let i=Hr(n.map(e=>e.id),t,e);i!==null&&r(i)},[n,t,r]),x=m?.zoomActivePane,S=(0,j.useCallback)(()=>{jt()?(f(e=>e===`terminal`?`none`:`terminal`),x?.()):f(e=>e===`files`?`none`:`files`)},[f,x]),C=(0,j.useCallback)(e=>{let t=m?.paneCursor()??null,n=Mt(),r=null;n===`terminal`?t&&t.index>=0&&(r={kind:`pane`,index:t.index}):n!==null&&(r={kind:n});let i=zr({at:r,paneCount:t?.count??0,maximized:d,narrow:window.innerWidth<768,mobileView:p},e);i!==null&&(i.kind===`pane`?m?.focusPaneAt(i.index):Nt(i.kind))},[m,d,p]),w=(0,j.useMemo)(()=>{let e={"project.openDialog":a,"session.cycleAccent":s,"session.reloadConfig":c,"help.shortcuts":v};return n.length>1&&(e[`project.previous`]=()=>b(-1),e[`project.next`]=()=>b(1)),t===null||(e[`project.close`]=()=>i(t),e[`view.toggleLog`]=()=>u(l===`log`?`status`:`log`),e[`view.toggleTree`]=()=>u(l===`tree`?`status`:`tree`),e[`view.toggleMaximize`]=S,e[`focus.list`]=()=>void Nt(`list`),e[`focus.content`]=()=>void Nt(`content`),e[`focus.previous`]=()=>C(-1),e[`focus.next`]=()=>C(1)),e},[a,s,c,v,n.length,b,t,l,i,u,S,C]);Ce(w);let T=si({enabled:e,leader:h.leader,dialogOpen:o||g,repo:t}),{arm:ee,disarm:te}=T,ne=(0,j.useCallback)(e=>{e.kind===`arm`?ee():(te(),m?.runAction(e.action))},[ee,te,m]);return{shortcutHelp:{open:g,show:v,hide:y},settings:h,hint:{state:T.state,onClick:ne}}}var hi=1e3,gi=3,_i=2e3;function vi(e,t){let[n,r]=(0,j.useState)(!1),i=(0,j.useRef)(!1),a=(0,j.useRef)(!1);(0,j.useEffect)(()=>(a.current=!1,()=>{a.current=!0}),[]);let o=(0,j.useCallback)(async t=>{for(;!a.current;){if(await new Promise(e=>setTimeout(e,hi)),a.current)return;let n;try{n=await A.cloneStatus(t)}catch(e){if(je(e)){i.current=!1,a.current||r(!1);return}if(e instanceof De&&e.status===404){if(a.current)return;E.error(`the clone's progress is no longer available`),i.current=!1,r(!1);return}continue}if(a.current)return;if(n.state===`done`){try{let t=await A.open(n.path);if(a.current)return;e(t)}catch(e){if(a.current)return;E.error(e instanceof Error?e.message:`could not open`)}finally{i.current=!1,a.current||r(!1)}return}if(n.state===`failed`){E.error(n.message),i.current=!1,r(!1);return}}},[e]),s=(0,j.useCallback)(async(e=()=>!1)=>{for(let t=0;t0&&await new Promise(e=>setTimeout(e,_i)),i.current||e()||a.current)return;let n;try{({job:n}=await A.runningClone())}catch(e){if(je(e))return;continue}if(n===null||e()||a.current||i.current)return;i.current=!0,r(!0),o(n);return}},[o]);return(0,j.useEffect)(()=>{if(!t)return;let e=!1;return s(()=>e),()=>{e=!0}},[t,s]),{busy:n,start:(0,j.useCallback)(async(e,t)=>{if(t.trim()&&!i.current){i.current=!0,r(!0);try{let{job:n}=await A.clone(e,t.trim());await o(n)}catch(e){if(i.current=!1,a.current)return;let t=e instanceof De&&e.status>=400;E.error(t?e.message:`could not confirm the clone started — check this folder before retrying`),r(!1),s()}}},[o,s])}}function yi(e,t,n,r=!1){return r&&n&&t.includes(n)?n:e&&t.includes(e)?e:n&&t.includes(n)?n:t[0]??null}function bi(e){let t=!1,n=null,r=()=>{if(t||n===null)return;let i=n;n=null,t=!0,e(i).catch(()=>{}).finally(()=>{t=!1,r()})};return e=>{n=e,r()}}function xi(e,t){return e?.enabled===t.enabled&&e.window_secs===t.window_secs?e:t}function Si(e,t){return e.length===t.length&&e.every((e,n)=>{let r=t[n];return e.id===r.id&&e.name===r.name&&e.display_path===r.display_path})?e:t}var Ci=`The viewer was updated on the server.`,wi=null,Ti=null,Ei=null;function Di(e,t){return e===null||t===null?!1:e!==t}function Oi(e){wi=e}function ki(e){Di(wi,e)?Ti!==e&&(Ti=e,Ei=E.info(Ci,{sticky:!0,action:{label:`Reload`,run:()=>window.location.reload()}})):e===wi&&Ti!==null&&(Ei!==null&&O(Ei),Ti=null,Ei=null)}var Ai=3e3;function ji({authed:e,setAuthed:t,handle:n,adoptAccent:r,adoptUpperPct:i,adoptMaximized:a,adoptViews:o,upperDraggingRef:s,accentWrites:c,upperPctWrites:l,maximizedWrites:u,viewWrites:d,resumeTick:f,orderWrites:p,repoDraggingRef:m,reorderInFlightRef:h,pendingReorderRef:g}){let[_,v]=(0,j.useState)([]),[y,b]=(0,j.useState)(null),[x,S]=(0,j.useState)(null),[C,w]=(0,j.useState)(null),[T,ee]=(0,j.useState)(!1),[te,ne]=(0,j.useState)(!0),{current:re}=(0,j.useRef)(bi(A.setActiveRepo)),ie=(0,j.useRef)(null),ae=(0,j.useRef)(null);return(0,j.useEffect)(()=>{if(e===!1)return;let f=!1,_,y=new AbortController,x=()=>{let e=c.current,C=l.current,T=u.current,te=d.current,re=p.current;return A.repos(y.signal).then(n=>{let{repos:y,hot:oe,accent:se,upper_pct:ce,active_repo:E,maximized:le,last_view:ue,now_ms:de,can_clone:fe,viewer_build:pe}=n;if(f)return;ki(pe),S(e=>xi(e,oe)),ne(fe),w(e=>$t(e,de,Date.now())),c.current===e&&r(se),l.current===C&&!s.current&&i(ce),u.current===T&&a(le),d.current===te&&o(ue??{},y.map(e=>e.id)),t(!0),ee(!0);let me=h.current||g.current!==null;p.current===re&&!m.current&&!me?v(e=>Si(e,y)):v(e=>{let t=xe(y.map(e=>e.id),e.map(e=>e.id)),n=new Map(y.map(e=>[e.id,e]));return Si(e,t.map(e=>n.get(e)).filter(Boolean))});let he=y.map(e=>e.id),ge=E!==ie.current;ie.current=E??null,ge&&E&&he.includes(E)&&(ae.current=E),b(e=>yi(e,he,E,ge)),f||(_=setTimeout(x,Ai))}).catch(e=>{f||(je(e)?(t(!1),ee(!1)):(ke(e)||n(e),_=setTimeout(x,Ai)))})};return x(),()=>{f=!0,y.abort(),_&&clearTimeout(_)}},[e,t,n,r,i,f,c,l,u,d,s,a,o,p,m,h,g]),(0,j.useEffect)(()=>{y?y!==ae.current&&(ae.current=null,re(y)):ae.current=null},[y,re]),{repos:_,setRepos:v,repo:y,setRepo:b,hot:x,clockSkewMs:C,reposLoaded:T,canClone:te}}var Mi=4;function Ni({ids:e,onReorder:t,draggingRef:n}){let r=(0,j.useRef)(null),i=(0,j.useRef)(null),a=(0,j.useRef)(null),[o,s]=(0,j.useState)(null),[c,l]=(0,j.useState)(null);return{dragging:o,target:c,onStart:(t,a)=>{t.target.closest(`button[data-tab-close]`)||t.button!==0||e.length<2||(r.current=a,i.current={x:t.clientX,y:t.clientY},n.current=!1)},onMove:e=>{let t=r.current,o=i.current;if(t===null||o===null)return;if(!n.current&&e.buttons===0){r.current=null,i.current=null;return}if(!n.current&&Math.hypot(e.clientX-o.x,e.clientY-o.y){let o=r.current,c=a.current;o!==null&&n.current&&c!==null&&t(ae(e,o,c)),r.current=null,i.current=null,a.current=null,n.current=!1,s(null),l(null)}}}function Pi({repos:e,setRepos:t,handle:n,writesRef:r,draggingRef:i,inFlightRef:a,pendingRef:o}){let s=(0,j.useCallback)(()=>{if(a.current||o.current===null)return;let e=o.current;o.current=null,a.current=!0;let i=r.current;A.reorderRepos(e).then(e=>{r.current===i&&t(e)}).catch(n).finally(()=>{a.current=!1,s()})},[n,t,a,o,r]),c=(0,j.useCallback)(e=>{r.current+=1,t(t=>{let n=xe(t.map(e=>e.id),e),r=new Map(t.map(e=>[e.id,e]));return n.map(e=>r.get(e)).filter(Boolean)}),o.current=e,s()},[s,t,o,r]);return{...Ni({ids:e.map(e=>e.id),onReorder:c,draggingRef:i}),writesRef:r,draggingRef:i,inFlightRef:a,pendingRef:o}}function Fi({authed:e,setAuthed:t,handle:n,resumeTick:r,adoptAccent:i,adoptUpperPct:a,adoptMaximized:o,adoptViews:s,accentWrites:c,upperPctWrites:l,maximizedWrites:u,viewWrites:d,upperDraggingRef:f}){let p=(0,j.useRef)(0),m=(0,j.useRef)(!1),h=(0,j.useRef)(!1),g=(0,j.useRef)(null),_=ji({authed:e,setAuthed:t,handle:n,adoptAccent:i,adoptUpperPct:a,adoptMaximized:o,adoptViews:s,upperDraggingRef:f,accentWrites:c,upperPctWrites:l,maximizedWrites:u,viewWrites:d,resumeTick:r,orderWrites:p,repoDraggingRef:m,reorderInFlightRef:h,pendingReorderRef:g}),{dragging:v,target:y,onStart:b,onMove:x,onEnd:S}=Pi({repos:_.repos,setRepos:_.setRepos,handle:n,writesRef:p,draggingRef:m,inFlightRef:h,pendingRef:g});return{..._,orderWrites:p,draggingRepo:v,dragOverRepo:y,onRepoDragStart:b,onRepoDragMove:x,onRepoDragEnd:S}}function Ii(){let[e,t]=(0,j.useState)(!1),n=(0,j.useRef)(!1);return{reload:(0,j.useCallback)(async()=>{if(!n.current){n.current=!0,t(!0);try{E.success(await A.reloadConfig())}catch(e){E.error(e instanceof Error?e.message:`could not reload the config`)}finally{n.current=!1,t(!1)}}},[]),pending:e}}function Li(e,t){let n=e.indexOf(t);return n===-1?e[0]??null:e[n+1]??e[n-1]??null}function Ri({repo:e,repos:t,setRepos:n,setRepo:r,setPane:i,setTab:a,setPickerOpen:o,handle:s,orderWrites:c}){let l=(0,j.useRef)(t);l.current=t;let u=(0,j.useRef)(e);return u.current=e,{selectOpenedRepo:(0,j.useCallback)(e=>{c.current+=1,n(t=>t.some(t=>t.id===e.id)?t:[...t,e]),r(e.id),e.id!==u.current&&(i({kind:`empty`}),a(`status`)),o(!1)},[n,r,i,a,o,c]),closeRepo:(0,j.useCallback)(async e=>{try{await A.close(e),c.current+=1;let t=Li(l.current.map(e=>e.id),e);n(t=>t.filter(t=>t.id!==e)),r(n=>n===e?t:n)}catch(e){s(e)}},[n,r,s,c])}}function zi(e,t,n){return t!==e&&(n.bumpPaneRequest(),e===`log`&&n.leaveLog(),n.recordTab(t),n.forgetPane(),!0)}function Bi(e,t,n,r,i){(0,j.useLayoutEffect)(()=>{t&&(e.some(e=>e.oid===t.commit.oid)||(r(),n(null),i()))},[e,t,n,r,i])}var Vi=5e3,Hi={refs:{},ahead:[],behind:[],truncated:!1};function Ui({repo:e,authed:t,tab:n,head:r,branch:i,refs:a,upstream:o}){let[s,c]=(0,j.useState)({key:``,value:Hi}),[l,u]=(0,j.useState)(0),d=e&&r!==void 0?`${e}|${r??``}|${i??``}|${a??``}|${o??``}`:``,f=(0,j.useRef)(s.key);f.current=s.key,(0,j.useEffect)(()=>{if(!e||!t||n!==`log`||d===``||f.current===d)return;let r=new AbortController,i;return A.logDecorations(e,r.signal).then(e=>c({key:d,value:e})).catch(()=>{r.signal.aborted||(i=setTimeout(()=>u(e=>e+1),Vi))}),()=>{r.abort(),i&&clearTimeout(i)}},[e,t,n,d,l]);let p=s.key.startsWith(`${e}|`)?s.value:Hi;return(0,j.useMemo)(()=>{let e=new Set(p.ahead),t=new Set(p.behind);return{refsOf:e=>p.refs[e],divergenceOf:n=>e.has(n)?`ahead`:t.has(n)?`behind`:void 0,truncated:p.truncated}},[p])}function Wi(e,t,n){let r=!e.truncated||e.head===void 0,i=t[0]?.oid,a=i===void 0?-1:e.commits.findIndex(e=>e.oid===i),o=a<0?[]:e.commits.slice(a);return a>=0&&o.length<=t.length&&o.every((e,n)=>e.oid===t[n].oid)?{commits:a===0?t:[...e.commits.slice(0,a),...t],anchor:e.head??null,done:n||r,mode:`prepend`}:{commits:e.commits,anchor:e.head??null,done:r,mode:`replace`}}function Gi({repo:e,authed:t,tab:n,filter:r,head:i,handle:a}){let[o,s]=(0,j.useState)([]),[c,l]=(0,j.useState)(!1),[u,d]=(0,j.useState)(!1),f=(0,j.useRef)(null),p=(0,j.useRef)(!1),m=(0,j.useRef)(!1),h=(0,j.useRef)(0),g=(0,j.useRef)(void 0),_=(0,j.useRef)(void 0),v=(0,j.useCallback)(()=>{h.current+=1,p.current=!1,m.current=!1,s([]),f.current=null,l(!1),d(!1),g.current=void 0,_.current=void 0},[]),[y,b]=(0,j.useState)(null),x=(0,j.useRef)(o);x.current=o;let S=(0,j.useRef)(c);S.current=c;let C=(0,j.useRef)(i);C.current=i;let w=(0,j.useCallback)(async t=>{if(!e)return;_.current=C.current,h.current+=1;let n=h.current;p.current=!0,m.current=!0;try{let r=await A.log(e);if(n!==h.current)return;let i=t??{commits:x.current,done:S.current},a=Wi(r,i.commits,i.done);s(a.commits),f.current=a.anchor,g.current=a.anchor,a.anchor===C.current&&(_.current=void 0),l(a.done),d(!1)}catch(e){n===h.current&&(_.current=void 0,a(e),d(!0))}finally{n===h.current&&(p.current=!1,m.current=!1)}},[e,a]),T=(0,j.useCallback)(async()=>{if(!e||p.current)return;p.current=!0;let t=h.current;try{let n=f.current,r=await A.log(e,n===null?void 0:{from:n,skip:x.current.length});if(t!==h.current)return;if(s(e=>[...e,...r.commits]),f.current=r.head??null,l(!r.truncated||r.head===void 0),n===null){g.current=r.head??null;let e=C.current;e!==void 0&&e!==(r.head??null)&&w({commits:r.commits,done:!r.truncated||r.head===void 0})}}catch(e){t===h.current&&(a(e),d(!0))}finally{t===h.current&&(p.current=!1)}},[e,a,w]);(0,j.useEffect)(()=>{e&&t&&n===`log`&&o.length===0&&!c&&!u&&T()},[e,t,n,o.length,c,u,T]),(0,j.useEffect)(()=>{if(!e||!t||n!==`log`||i===void 0||u)return;let r=g.current;r!==void 0&&(r===i?m.current||(_.current=void 0):_.current!==i&&w())},[e,t,n,i,u,w]);let ee=o.filter(e=>e.summary.toLowerCase().includes(r.toLowerCase())),te=r!==``,ne=(0,j.useRef)(null);return(0,j.useEffect)(()=>{let e=ne.current;if(!e)return;let t=new IntersectionObserver(e=>{e.some(e=>e.isIntersecting)&&T()},{root:e.closest(`ul`),rootMargin:`400px`});return t.observe(e),()=>t.disconnect()},[T,c,u,te,y,n,ee.length]),{commits:o,logDone:c,logStalled:u,setLogStalled:d,commitDrillDown:y,setCommitDrillDown:b,resetLog:v,logSentinelRef:ne,visibleCommits:ee,logPagingPaused:te}}function Ki({repo:e,authed:t,resumeTick:n,tab:r,pane:i,setPane:a,handle:o,paneRequestRef:s}){let[c,l]=(0,j.useState)(null),u=(0,j.useRef)(i);u.current=i;let d=(0,j.useRef)(r);return d.current=r,(0,j.useLayoutEffect)(()=>{l(null)},[e,t]),(0,j.useEffect)(()=>{if(e&&t)return Oe(e,l,({reason:e})=>l({files:[],truncated:!1,unavailable:e}))},[e,t,n]),(0,j.useEffect)(()=>{if(!e||!c)return;let t=u.current;if(d.current!==`status`||t.kind!==`diff`)return;let n=t.value.path,r=c.files.find(e=>e.path===n);if(!r){a({kind:`empty`});return}let i=s.current,l=!0,f=()=>{let e=u.current;return l&&i===s.current&&e.kind===`diff`&&e.value.path===n};return A.diff(e,n).then(e=>{f()&&a({kind:`diff`,value:e,source:Pn(r)&&Fn(e)?{kind:`workdir`,path:n}:void 0})}).catch(e=>{f()&&o(e)}),()=>{l=!1}},[c,e,o,u,d,s,a]),{status:c,paneRef:u,tabRef:d}}function qi({repo:e,authed:t,hot:n,clockSkewMs:r,resumeTick:i,handle:a}){let[o,s]=(0,j.useState)(`status`),[c,l]=(0,j.useState)(``),[u,d]=(0,j.useState)(!1),[f,p]=(0,j.useState)({kind:`empty`}),[m,h]=(0,j.useState)(e);m!==e&&(h(e),p({kind:`empty`}),s(`status`));let g=(0,j.useRef)(0),_=(0,j.useCallback)(()=>{g.current+=1},[]),v=(0,j.useCallback)(()=>p({kind:`empty`}),[]),{status:y}=Ki({repo:e,authed:t,resumeTick:i,tab:o,pane:f,setPane:p,handle:a,paneRequestRef:g}),b=n?.enabled?n.window_secs*1e3:0,x=rn(y?.files,b,r??0),S=Gi({repo:e,authed:t,tab:o,filter:c,head:y?y.head??null:void 0,handle:a}),C=Ui({repo:e,authed:t,tab:o,head:y?y.head??null:void 0,branch:y?.branch,refs:y?.refs,upstream:y?.tracking?.upstream}),w=S.setCommitDrillDown,T=S.resetLog;(0,j.useLayoutEffect)(()=>{_(),w(null),T()},[e,_,w,T]);let ee=c.toLowerCase(),te=(0,j.useMemo)(()=>(y?.files??[]).filter(e=>e.path.toLowerCase().includes(ee)),[y?.files,ee]),ne=(0,j.useMemo)(()=>(S.commitDrillDown?.files??[]).filter(e=>e.path.toLowerCase().includes(ee)||e.old_path?.toLowerCase().includes(ee)),[S.commitDrillDown?.files,ee]);return{screen:{tab:o,setTab:s,filter:c,setFilter:l,filterOpen:u,setFilterOpen:d,pane:f,setPane:p},request:{paneRequestRef:g,bumpPaneRequest:_,clearPane:v},status:{value:y,files:te,now:x,hotWindowMs:b},log:{...S,decorations:C,visibleCommitFiles:ne}}}var Ji=`nightcrow.mobileView`;function Yi(e){return e===`diff`||e===`terminal`||e===`files`?e:`files`}function Xi(){try{return Yi(localStorage.getItem(Ji))}catch{return`files`}}function Zi(){let[e,t]=(0,j.useState)(Xi);return{mobileView:e,setMobileView:(0,j.useCallback)(e=>{try{localStorage.setItem(Ji,e)}catch{}t(e)},[])}}function Qi({repo:e,handle:t,setPane:n,paneRequestRef:r,setCommitDrillDown:i,setMobileView:a,setPreviewRendered:o,statusRef:s,track:c}){let l=(0,j.useCallback)(e=>{let t=s.current?.files.find(t=>t.path===e);return t?Pn(t):!1},[s]);return{openDiff:(0,j.useCallback)((i,o)=>{if(!e)return;o?.restoring||a(`diff`);let s=r.current+=1;c(s,A.diff(e,i)).then(e=>{s===r.current&&n({kind:`diff`,value:e,source:l(i)&&Fn(e)?{kind:`workdir`,path:i}:void 0})}).catch(e=>{if(s!==r.current)return je(e)?t(e):void 0;if(!o?.restoring)return t(e);je(e)&&t(e),n({kind:`empty`})})},[e,t,n,r,a,l,c]),openFile:(0,j.useCallback)((i,s)=>{if(!e)return;s?.restoring||a(`diff`),o(!0);let l=r.current+=1;c(l,A.file(e,i)).then(e=>{l===r.current&&n({kind:`file`,value:e})}).catch(e=>{if(l!==r.current)return je(e)?t(e):void 0;if(!s?.restoring)return t(e);je(e)&&t(e),n({kind:`empty`})})},[e,t,n,r,a,o,c]),openCommit:(0,j.useCallback)(i=>{if(!e)return;a(`diff`);let o=r.current+=1;c(o,A.commit(e,i)).then(e=>{o===r.current&&n({kind:`diff`,value:e})}).catch(e=>{o===r.current&&t(e)})},[e,t,n,r,a,c]),openCommitFileDiff:(0,j.useCallback)((i,o,s)=>{if(!e)return;s?.restoring||a(`diff`);let l=r.current+=1;c(l,A.commitFileDiff(e,i,o)).then(e=>{l===r.current&&n({kind:`diff`,value:e,source:Fn(e)?{kind:`commit`,oid:i,path:o}:void 0})}).catch(e=>{if(l!==r.current)return je(e)?t(e):void 0;if(!s?.restoring)return t(e);je(e)&&t(e),n({kind:`empty`})})},[e,t,n,r,a,c]),openCommitFiles:(0,j.useCallback)(async o=>{if(!e)return;a(`diff`);let s=r.current+=1;try{let t=await c(s,A.commitFiles(e,o.oid));if(s!==r.current)return;if(i({commit:o,...t}),t.files.length===0){n({kind:`empty`});return}let a=await c(s,A.commit(e,o.oid));s===r.current&&n({kind:`diff`,value:a})}catch(e){s===r.current&&t(e)}},[e,t,n,r,i,a,c]),showOtherFace:(0,j.useCallback)((i,a=0)=>{let s=Nn(i);if(!e||!s)return;let{source:u}=s,d=s.want===`file`,f=d&&i.kind===`diff`?Tn(i.value,a):null,p=r.current+=1,m=u.kind===`workdir`?d?A.file(e,u.path):A.diff(e,u.path):d?A.commitFile(e,u.oid,u.path):A.commitFileDiff(e,u.oid,u.path);d&&o(!1),c(p,m).then(e=>{p===r.current&&n(d?{kind:`file`,value:e,source:u,anchor:f===null?void 0:En(f)+1}:{kind:`diff`,value:e,source:Fn(e)&&(u.kind!==`workdir`||l(u.path))?u:void 0})}).catch(e=>{p===r.current&&t(e)})},[e,t,n,r,o,l,c])}}function $i(){let[e,t]=(0,j.useState)(null),n=(0,j.useCallback)((e,n)=>{t(e);let r=()=>t(t=>t===e?null:t);return n.then(r,r),n},[]);return{loading:e!==null,track:n}}function ea({repo:e,handle:t,pane:n,setPane:r,paneRequestRef:i,setCommitDrillDown:a,status:o}){let{mobileView:s,setMobileView:c}=Zi(),[l,u]=(0,j.useState)(!0),{loading:d,track:f}=$i(),p=(0,j.useRef)(o);p.current=o;let{openDiff:m,openFile:h,openCommit:g,openCommitFileDiff:_,openCommitFiles:v,showOtherFace:y}=Qi({repo:e,handle:t,setPane:r,paneRequestRef:i,setCommitDrillDown:a,setMobileView:c,setPreviewRendered:u,statusRef:p,track:f}),b=(0,j.useMemo)(()=>({openDiff:m,openFile:h,openCommit:g,openCommitFileDiff:_,openCommitFiles:v,showOtherFace:y}),[m,h,g,_,v,y]);return(0,j.useMemo)(()=>({openers:b,pane:n,setPane:r,paneLoading:d,previewRendered:l,setPreviewRendered:u,mobileView:s,setMobileView:c}),[b,n,r,d,l,s,c])}var ta=[`status`,`log`,`tree`];function na(){return{tab:`status`,file:null,tree_expanded:[]}}function ra(e,t){return{path:e,commit:null,face:t}}function ia(e,t,n){return{path:t,commit:e,face:n}}function aa(e){return[...e].sort().slice(0,200)}function oa(e){let t=e?.file;return!t||!t.path?{kind:`none`}:t.commit?{kind:`commitDiff`,oid:t.commit,path:t.path}:t.face===`source`?{kind:`file`,path:t.path}:{kind:`diff`,path:t.path}}function sa(e){let t=e?.tab;return t&&ta.includes(t)?t:`status`}function ca(e,t){return e?e.tab===t.tab&&e.tree_expanded.length===t.tree_expanded.length&&e.tree_expanded.every((e,n)=>e===t.tree_expanded[n])&&la(e.file,t.file):!1}function la(e,t){return!e||!t?e===t:e.path===t.path&&e.commit===t.commit&&e.face===t.face}function P({repo:e,known:t,remembered:n,latest:r,remember:i,setTab:a,openDiff:o,openFile:s,openCommitFileDiff:c}){let l=(0,j.useRef)(null),u=(0,j.useRef)(null),d=(0,j.useRef)(new Map),[f,p]=(0,j.useState)(!1),m=(0,j.useRef)(!1);(0,j.useEffect)(()=>{if(u.current!==e&&(u.current=e,l.current=null,m.current=!1,p(!1)),!e||!t||l.current===e)return;l.current=e;let r=d.current.get(e);d.current.delete(e);let f=r?{...n??na(),...r}:n;if(r&&i(e,f),m.current)return;a(sa(f));let h=oa(f);if(h.kind===`none`)return;let g={restoring:!0};h.kind===`diff`?o(h.path,g):h.kind===`file`?s(h.path,g):c(h.oid,h.path,g)},[e,t,n,i,a,o,s,c]);let h=(0,j.useCallback)(t=>{if(e){if(m.current=!0,p(!0),l.current!==e){let n=d.current.get(e);d.current.set(e,{...n,...t})}else i(e,{...r(e)??na(),...t})}},[e,r,i]);return{touched:f,noteTab:(0,j.useCallback)(e=>h({tab:e}),[h]),noteFile:(0,j.useCallback)(e=>h({file:e}),[h]),noteTree:(0,j.useCallback)(e=>h({tree_expanded:aa(e)}),[h])}}function F({repo:e,known:t,remembered:n,latest:r,remember:i,setTab:a,clearPane:o,openers:s}){let c=P({repo:e,known:t,remembered:n,latest:r,remember:i,setTab:a,openDiff:s.openDiff,openFile:s.openFile,openCommitFileDiff:s.openCommitFileDiff}),{noteFile:l,noteTab:u,noteTree:d}=c,f=(0,j.useCallback)(e=>{u(e),a(e)},[u,a]),p=(0,j.useCallback)(()=>{l(null),o()},[l,o]),m=(0,j.useMemo)(()=>({openDiff:e=>{l(ra(e,`diff`)),s.openDiff(e)},openFile:e=>{l(ra(e,`source`)),s.openFile(e)},openCommit:e=>{l(null),s.openCommit(e)},openCommitFiles:e=>(l(null),s.openCommitFiles(e)),openCommitFileDiff:(e,t)=>{l(ia(e,t,`diff`)),s.openCommitFileDiff(e,t)}}),[s,l]),h=(0,j.useCallback)((e,t)=>{l(e.kind===`commit`?ia(e.oid,e.path,t):ra(e.path,t))},[l]);return{...c,noteTree:d,chooseTab:f,forgetPane:p,asked:m,noteOtherFace:h}}function ua({project:e,view:t,layout:n}){let{repo:r,repos:i,authed:a,hot:o,clockSkewMs:s,resumeTick:c,handle:l}=e,u=qi({repo:r,authed:a,hot:o,clockSkewMs:s,resumeTick:c,handle:l}),d=ea({repo:r,handle:l,pane:u.screen.pane,setPane:u.screen.setPane,paneRequestRef:u.request.paneRequestRef,setCommitDrillDown:u.log.setCommitDrillDown,status:u.status.value}),f=F({repo:r,known:t.known,remembered:t.remembered,latest:t.latest,remember:t.remember,setTab:u.screen.setTab,clearPane:u.request.clearPane,openers:d.openers}),p=u.screen.tab,{bumpPaneRequest:m}=u.request,{setCommitDrillDown:h,resetLog:g}=u.log,{chooseTab:_,forgetPane:v}=f,y=(0,j.useCallback)(e=>void zi(p,e,{bumpPaneRequest:m,leaveLog:()=>{h(null),g()},recordTab:_,forgetPane:v}),[p,m,h,g,_,v]);Bi(u.log.commits,u.log.commitDrillDown,u.log.setCommitDrillDown,u.request.bumpPaneRequest,f.forgetPane);let b=n.maximizedPanelOf(r),x=n.setMaximizedFor,S=(0,j.useCallback)(e=>x(r,e),[r,x]),C=d.pane,w=d.openers.showOtherFace,T=f.noteOtherFace,ee=(0,j.useCallback)(e=>{let t=Nn(C);t&&T(t.source,t.want===`file`?`source`:`diff`),w(C,e)},[C,T,w]);return{setPane:d.setPane,setTab:u.screen.setTab,clearPane:u.request.clearPane,maximized:b,tab:p,chooseTab:y,setMaximized:S,repoShell:r?{repository:{id:r,current:i.find(e=>e.id===r),status:u.status.value},sidebar:{tab:u.screen.tab,filter:u.screen.filter,setFilter:u.screen.setFilter,filterOpen:u.screen.filterOpen,setFilterOpen:u.screen.setFilterOpen,files:u.status.files,now:u.status.now,hotWindowMs:u.status.hotWindowMs,...d.openers,...f.asked,chooseTab:y,authed:a,handle:l,bumpPaneRequest:u.request.bumpPaneRequest,...u.log,restoreTree:t.remembered?.tree_expanded??[],restoreKnown:t.known,onTreeExpanded:f.noteTree,clearPane:f.forgetPane,touched:f.touched},filePane:{repo:r,pane:d.pane,loading:d.paneLoading,previewRendered:d.previewRendered,setPreviewRendered:d.setPreviewRendered,showOtherFace:ee},layout:{...n.shell,maximized:b,setMaximized:S,mobileView:d.mobileView,setMobileView:d.setMobileView}}:null}}function da(){let[e,t]=(0,j.useState)(0);return(0,j.useEffect)(()=>{let e=()=>{document.visibilityState===`visible`&&t(e=>e+1)};return document.addEventListener(`visibilitychange`,e),window.addEventListener(`online`,e),()=>{document.removeEventListener(`visibilitychange`,e),window.removeEventListener(`online`,e)}},[]),e}var fa=[{name:`yellow`,color:`#d9a441`},{name:`cyan`,color:`#03c4db`},{name:`green`,color:`#77c47a`},{name:`magenta`,color:`#dc8fd5`},{name:`blue`,color:`#87acfd`}],pa=`nightcrow.viewer.accent`;function ma(e){if(!Number.isFinite(e))return 0;let t=fa.length;return(Math.trunc(e)%t+t)%t}function ha(){try{let e=localStorage.getItem(pa);return e===null?0:ma(Number(e))}catch{return 0}}function ga(e){try{localStorage.setItem(pa,String(e))}catch{}}function _a(){let[e,t]=(0,j.useState)(ha);(0,j.useLayoutEffect)(()=>{document.documentElement.style.setProperty(`--color-accent`,fa[e].color)},[e]);let n=(0,j.useCallback)(()=>{t(e=>{let t=ma(e+1);return ga(t),A.setAccent(t).catch(()=>{}),t})},[]),r=(0,j.useCallback)(e=>{t(t=>{let n=ma(e);return n===t?t:(ga(n),n)})},[]);return{accent:fa[e],next:fa[ma(e+1)],cycle:n,adopt:r}}function va(e){return Number.isFinite(e)?Math.min(Math.max(e,20),85):55}function ya(e){return Math.round(va(e))}function ba(e,t,n,r){let i=n-t;return va(i<=0?r:(e-t)/i*100)}var xa=`nightcrow.upperPct`;function Sa(){try{let e=Number(localStorage.getItem(xa));return Number.isFinite(e)&&e>0?ya(e):55}catch{return 55}}function Ca(e){try{localStorage.setItem(xa,String(e))}catch{}}function wa(){let[e,t]=(0,j.useState)(Sa);return{pct:e,resize:(0,j.useCallback)(e=>{t(va(e))},[]),commit:(0,j.useCallback)(e=>{let n=ya(e);t(n),Ca(n),A.setUpperPct(n).catch(()=>{})},[]),reset:(0,j.useCallback)(()=>{t(55),Ca(55),A.setUpperPct(55).catch(()=>{})},[]),adopt:(0,j.useCallback)(e=>{t(t=>{let n=ya(e);return n===t?t:(Ca(n),n)})},[])}}function Ta(){let[e,t]=(0,j.useState)({}),n=(0,j.useRef)(e),r=(0,j.useCallback)(e=>{n.current=e,t(e)},[]),i=(0,j.useRef)(0),a=(0,j.useRef)(new Map),o=(0,j.useCallback)(e=>{let t=a.current.get(e);if(t)return t;let n=bi(t=>A.setMaximized(e,t===`none`?null:t));return a.current.set(e,n),n},[]),s=(0,j.useCallback)((e,t)=>{if(e==null)return;let a=n.current,s=typeof t==`function`?t(a[e]??`none`):t;i.current+=1,o(e)(s);let{[e]:c,...l}=a;r(s===`none`?l:{...a,[e]:s})},[o,r]);return{panelOf:(0,j.useCallback)(t=>t!=null&&e[t]||`none`,[e]),setFor:s,adopt:(0,j.useCallback)(e=>{Ea(n.current,e)||r(e)},[r]),writes:i}}function Ea(e,t){let n=Object.keys(e);return n.length===Object.keys(t).length&&n.every(n=>e[n]===t[n])}function Da(){let[e,t]=(0,j.useState)({}),n=(0,j.useRef)(e),r=(0,j.useCallback)(e=>{n.current=e,t(e)},[]),i=(0,j.useRef)(0),a=(0,j.useRef)(new Map),o=(0,j.useCallback)(e=>{let t=a.current.get(e);if(t)return t;let n=bi(t=>A.setRepoView(e,t));return a.current.set(e,n),n},[]),s=(0,j.useCallback)((e,t)=>{e!=null&&(ca(n.current[e],t)||(i.current+=1,o(e)(t),r({...n.current,[e]:t})))},[o,r]),c=(0,j.useCallback)(t=>t==null?void 0:e[t],[e]),l=(0,j.useCallback)(e=>n.current[e],[]),u=(0,j.useRef)(new Set),[d,f]=(0,j.useState)(0);return{viewOf:c,rememberedFor:l,remember:s,adopt:(0,j.useCallback)((e,t)=>{let i=u.current;(i.size!==t.length||t.some(e=>!i.has(e)))&&(u.current=new Set(t),f(e=>e+1)),!Oa(n.current,e)&&r(e)},[r]),covers:(0,j.useCallback)(e=>e!=null&&u.current.has(e),[d]),writes:i}}function Oa(e,t){let n=Object.keys(e);return n.length===Object.keys(t).length&&n.every(n=>t[n]!==void 0&&ca(e[n],t[n]))}function ka(){let{accent:e,next:t,cycle:n,adopt:r}=_a(),{width:i,resize:a,commit:o,reset:s}=wt(),{pct:c,resize:l,commit:u,reset:d,adopt:f}=wa(),p=Ta(),m=Da(),h=(0,j.useRef)(0),g=(0,j.useRef)(0);return{accent:e,next:t,cycle:(0,j.useCallback)(()=>{h.current+=1,n()},[n]),adoptAccent:r,accentWrites:h,sidebarWidth:i,resizeSidebar:a,commitSidebarWidth:o,resetSidebarWidth:s,upperPct:c,resizeUpperPct:l,commitUpperPct:(0,j.useCallback)(e=>{g.current+=1,u(e)},[u]),resetUpperPct:(0,j.useCallback)(()=>{g.current+=1,d()},[d]),bumpUpperPctWrites:(0,j.useCallback)(()=>{g.current+=1},[]),adoptUpperPct:f,upperPctWrites:g,maximizedPanelOf:p.panelOf,setMaximizedFor:p.setFor,adoptMaximized:p.adopt,maximizedWrites:p.writes,viewOf:m.viewOf,rememberedViewFor:m.rememberedFor,rememberView:m.remember,adoptViews:m.adopt,viewCovers:m.covers,viewWrites:m.writes}}var Aa=400;function ja({value:e,valueAt:t,onGestureStart:n,resize:r,commit:i,reset:a,axis:o}){let s=(0,j.useRef)(0),c=(0,j.useRef)(0),l=(0,j.useRef)(!1),u=(0,j.useRef)(!1),d=(0,j.useRef)(0),[f,p]=(0,j.useState)(!1);return{dragging:f,onDragStart:(0,j.useCallback)(t=>{t.button===0&&t.isPrimary&&n()&&(s.current=o===`x`?t.clientX:t.clientY,c.current=e,l.current=!0,u.current=!1,p(!0),t.currentTarget.setPointerCapture(t.pointerId),t.preventDefault())},[e,n,o]),onDragMove:(0,j.useCallback)(e=>{if(!l.current)return;let n=o===`x`?e.clientX:e.clientY;if(!u.current&&Math.abs(n-s.current)<3)return;let i=t(e);i!==null&&(u.current=!0,c.current=i,r(i))},[t,r,o]),onDragEnd:(0,j.useCallback)(()=>{if(!l.current)return;if(l.current=!1,p(!1),u.current){i(c.current),d.current=0;return}let e=Date.now();e-d.current{l.current=!1,u.current=!1,d.current=0,p(!1)},[]),draggingRef:l}}function Ma({sidebarRef:e,sidebarWidth:t,resizeSidebar:n,commitSidebarWidth:r,resetSidebarWidth:i}){let a=(0,j.useRef)(0),o=(0,j.useCallback)(()=>{let t=e.current?.getBoundingClientRect().left;return t!==void 0&&(a.current=t,!0)},[e]),{dragging:s,onDragStart:c,onDragMove:l,onDragEnd:u,onDragCancel:d}=ja({value:t,valueAt:(0,j.useCallback)(e=>e.clientX-a.current,[]),onGestureStart:o,resize:n,commit:r,reset:i,axis:`x`});return{draggingSidebar:s,onSidebarDragStart:c,onSidebarDragMove:l,onSidebarDragEnd:u,onSidebarDragCancel:d}}function Na({upperRef:e,lowerRef:t,upperPct:n,resizeUpperPct:r,commitUpperPct:i,resetUpperPct:a,bumpUpperPctWrites:o}){let s=(0,j.useRef)(0),c=(0,j.useRef)(0),l=(0,j.useCallback)(()=>{let n=e.current?.getBoundingClientRect().top,r=t.current?.getBoundingClientRect().bottom;return n===void 0||r===void 0?!1:(s.current=n,c.current=r,o(),!0)},[e,t,o]),{dragging:u,onDragStart:d,onDragMove:f,onDragEnd:p,onDragCancel:m,draggingRef:h}=ja({value:n,valueAt:(0,j.useCallback)(e=>ba(e.clientY,s.current,c.current,n),[n]),onGestureStart:l,resize:r,commit:i,reset:a,axis:`y`});return{draggingUpper:u,onUpperDragStart:d,onUpperDragMove:f,onUpperDragEnd:p,onUpperDragCancel:m,upperDraggingRef:h}}function Pa(){let{accent:e,next:t,cycle:n,adoptAccent:r,accentWrites:i,sidebarWidth:a,resizeSidebar:o,commitSidebarWidth:s,resetSidebarWidth:c,upperPct:l,resizeUpperPct:u,commitUpperPct:d,resetUpperPct:f,bumpUpperPctWrites:p,adoptUpperPct:m,upperPctWrites:h,maximizedPanelOf:g,setMaximizedFor:_,adoptMaximized:v,maximizedWrites:y,viewOf:b,rememberedViewFor:x,rememberView:S,adoptViews:C,viewCovers:w,viewWrites:T}=ka(),ee=(0,j.useRef)(null),te=(0,j.useRef)(null),ne=(0,j.useRef)(null),re=Ma({sidebarRef:ee,sidebarWidth:a,resizeSidebar:o,commitSidebarWidth:s,resetSidebarWidth:c}),ie=Na({upperRef:te,lowerRef:ne,upperPct:l,resizeUpperPct:u,commitUpperPct:d,resetUpperPct:f,bumpUpperPctWrites:p});return{accent:e,next:t,cycle:n,upperPct:l,maximizedPanelOf:g,setMaximizedFor:_,viewOf:b,rememberedViewFor:x,rememberView:S,viewCovers:w,shell:{sidebarWidth:a,sidebarRef:ee,upperRef:te,lowerRef:ne,draggingSidebar:re.draggingSidebar,onSidebarDragStart:re.onSidebarDragStart,onSidebarDragMove:re.onSidebarDragMove,onSidebarDragEnd:re.onSidebarDragEnd,onSidebarDragCancel:re.onSidebarDragCancel,draggingUpper:ie.draggingUpper,onUpperDragStart:ie.onUpperDragStart,onUpperDragMove:ie.onUpperDragMove,onUpperDragEnd:ie.onUpperDragEnd,onUpperDragCancel:ie.onUpperDragCancel},guards:{adoptAccent:r,adoptUpperPct:m,adoptMaximized:v,adoptViews:C,accentWrites:i,upperPctWrites:h,maximizedWrites:y,viewWrites:T,upperDraggingRef:ie.upperDraggingRef}}}var Fa=`nightcrow.tabStripSide`;function I(){try{return ut(localStorage.getItem(Fa))??`top`}catch{return`top`}}function Ia(e){try{localStorage.setItem(Fa,e)}catch{}}function La(){let[e,t]=(0,j.useState)(I);return{side:e,toggle:(0,j.useCallback)(()=>{t(e=>{let t=dt(e);return Ia(t),t})},[])}}function Ra(){let[e,t]=(0,j.useState)(null),[n,r]=(0,j.useState)(!1),[i,a]=(0,j.useState)(null),o=(0,j.useCallback)(e=>{je(e)?t(!1):E.error(e instanceof Error?e.message:`request failed`)},[]),s=da(),c=Pa(),l=La(),u=Fi({authed:e,setAuthed:t,handle:o,resumeTick:s,...c.guards}),d=ua({project:{repo:u.repo,repos:u.repos,authed:e,hot:u.hot,clockSkewMs:u.clockSkewMs,resumeTick:s,handle:o},view:{known:c.viewCovers(u.repo),remembered:c.viewOf(u.repo),latest:c.rememberedViewFor,remember:c.rememberView},layout:{shell:c.shell,maximizedPanelOf:c.maximizedPanelOf,setMaximizedFor:c.setMaximizedFor}}),{selectOpenedRepo:f,closeRepo:p}=Ri({repo:u.repo,repos:u.repos,setRepos:u.setRepos,setRepo:u.setRepo,setPane:d.setPane,setTab:d.setTab,setPickerOpen:r,handle:o,orderWrites:u.orderWrites}),{busy:m,start:h}=vi(f,e===!0),g=u.repo,_=u.setRepo,v=d.clearPane,y=(0,j.useCallback)(e=>{e!==g&&(_(e),v())},[g,_,v]),b=u.repos.find(e=>e.id===i),x=(0,j.useCallback)(()=>a(null),[]),S=(0,j.useCallback)(()=>r(!0),[]),C=(0,j.useCallback)(()=>r(!1),[]),w=Ii(),T=mi({enabled:e===!0,repo:u.repo,repos:u.repos,selectRepo:y,closeRepo:p,openPicker:S,pickerOpen:n,cycleAccent:c.cycle,reloadConfig:w.reload,tab:d.tab,chooseTab:d.chooseTab,maximized:d.maximized,setMaximized:d.setMaximized,mobileView:d.repoShell?.layout.mobileView??`files`});return{authed:e,login:(0,j.useCallback)(()=>t(null),[]),reposLoaded:u.reposLoaded,rows:Rr(u.repo,d.maximized),upperPct:c.upperPct,header:{repos:u.repos,repo:u.repo,onSelectRepo:y,onCloseRepo:a,onOpenPicker:S,cloning:m,accent:c.accent,next:c.next,cycle:c.cycle,draggingRepo:u.draggingRepo,dragOverRepo:u.dragOverRepo,onRepoDragStart:u.onRepoDragStart,onRepoDragMove:u.onRepoDragMove,onRepoDragEnd:u.onRepoDragEnd,onReloadConfig:w.reload,reloading:w.pending,tabStrip:l},tabStrip:l,shortcutHelp:T.shortcutHelp,leader:T.settings,hint:T.hint,repoShell:d.repoShell,closeConfirm:b?{label:b.name,detail:`Its terminals and the processes running in them will be terminated.`,onConfirm:()=>{a(null),p(b.id)},onCancel:x}:null,picker:n?{onClose:C,onOpened:f,canClone:u.canClone,cloning:m,onClone:h}:null}}function za(){let e=Ra();return e.authed===null?(0,M.jsx)(gt,{}):e.authed?e.reposLoaded?(0,M.jsx)(s,{children:(0,M.jsx)(le,{children:(0,M.jsx)(C,{leader:e.leader.leader,children:(0,M.jsxs)(`div`,{className:`nc-fade-in flex h-full flex-col`,children:[(0,M.jsx)(ft,{...e.header,onShowShortcuts:e.shortcutHelp.show}),(0,M.jsxs)(`div`,{className:`flex min-h-0 flex-1`,children:[e.tabStrip.side===`left`&&(0,M.jsx)(`aside`,{className:`hidden w-48 shrink-0 flex-col border-r border-chrome-line bg-ink-950 md:flex`,children:(0,M.jsx)(Ge,{side:`left`,...e.header})}),(0,M.jsxs)(`div`,{className:`grid min-h-0 min-w-0 flex-1 grid-cols-[minmax(0,1fr)] ${e.rows}`,style:{"--nc-upper":`${e.upperPct}fr`,"--nc-lower":`${100-e.upperPct}fr`},children:[e.repoShell?(0,M.jsxs)(M.Fragment,{children:[(0,M.jsx)(vr,{...e.repoShell}),(0,M.jsx)(Ir,{...e.hint})]}):(0,M.jsxs)(`div`,{className:`flex items-center justify-center p-6 text-center text-ink-400`,children:[(0,M.jsxs)(`span`,{className:`md:hidden`,children:[`No repository open. Tap`,` `,(0,M.jsx)(`span`,{className:`text-ink-200`,children:`No project`}),` above, then`,` `,(0,M.jsx)(`span`,{className:`text-ink-200`,children:`+ open`}),`, to add one.`]}),(0,M.jsxs)(`span`,{className:`hidden md:inline`,children:[`No repository open. Click`,` `,(0,M.jsx)(`span`,{className:`text-ink-200`,children:`+ open`}),` `,e.tabStrip.side===`left`?`beside`:`above`,` to add one.`]})]}),e.picker&&(0,M.jsx)(Ie,{...e.picker}),e.closeConfirm&&(0,M.jsx)(_e,{...e.closeConfirm}),e.shortcutHelp.open&&(0,M.jsx)(Tr,{onClose:e.shortcutHelp.hide,leader:e.leader})]})]})]})})})}):(0,M.jsx)(gt,{}):(0,M.jsx)(_t,{onSuccess:e.login})}var Ba={error:7e3,info:5e3,success:5e3},Va={error:`text-removed`,info:`text-accent`,success:`text-added`};function Ha(){let[e,t]=(0,j.useState)([]);return(0,j.useEffect)(()=>se(t),[]),e.length===0?null:(0,M.jsx)(`div`,{className:`pointer-events-none fixed right-3 top-3 z-[60] flex w-80 max-w-[calc(100vw-1.5rem)] flex-col gap-2`,"aria-live":`polite`,children:e.map(e=>(0,M.jsx)(Ua,{toast:e},e.id))})}function Ua({toast:e}){let[t,n]=(0,j.useState)(!1);return(0,j.useEffect)(()=>{if(t||e.sticky)return;let n=setTimeout(()=>O(e.id),Ba[e.kind]);return()=>clearTimeout(n)},[e.id,e.kind,e.bump,e.sticky,t]),(0,M.jsxs)(`div`,{role:e.kind===`error`?`alert`:`status`,className:`nc-slide-in pointer-events-auto flex items-start gap-2 rounded-md border border-ink-700 bg-ink-850 px-3 py-2 text-xs shadow-lg`,onMouseEnter:()=>n(!0),onMouseLeave:()=>n(!1),children:[(0,M.jsx)(`span`,{className:`min-w-0 flex-1 break-words ${Va[e.kind]}`,children:e.message}),e.action&&(0,M.jsx)(`button`,{type:`button`,onClick:e.action.run,className:`shrink-0 rounded-sm border border-ink-700 px-1.5 py-0.5 text-ink-200 hover:border-accent hover:text-accent`,children:e.action.label}),(0,M.jsx)(`button`,{type:`button`,onClick:()=>O(e.id),"aria-label":`dismiss`,className:`mt-0.5 flex h-4 w-4 shrink-0 items-center justify-center rounded-sm text-ink-400 hover:bg-ink-700 hover:text-ink-200`,children:(0,M.jsx)(pe,{className:`h-3 w-3`})})]})}function Wa(e){let t=new URLSearchParams(e),n=t.get(`notice-repo`);if(!n)return null;let r=t.get(`notice-pane`);return{repo:n,pane:r!==null&&/^\d+$/.test(r)?Number(r):null}}async function Ga(e,t,n){let r=Wa(e.search);if(!r)return;let i=new URL(e.href);i.searchParams.delete(`notice-repo`),i.searchParams.delete(`notice-pane`),t.replaceState(t.state,``,i.pathname+i.search+i.hash),r.pane!==null&&ye(r.repo,r.pane),await n(r.repo).catch(()=>void 0)}ue(document.documentElement,window),_(fe()),Oi(document.querySelector(`meta[name="nightcrow-build"]`)?.getAttribute(`content`)||null),Ye(qe()),await Ga(window.location,window.history,A.setActiveRepo);var Ka=1500;await Promise.race([document.fonts?.load(`400 12px "JetBrains Mono"`).catch(()=>void 0),new Promise(e=>setTimeout(e,Ka))]),(0,Fe.createRoot)(document.getElementById(`root`)).render((0,M.jsxs)(j.StrictMode,{children:[(0,M.jsx)(er,{children:(0,M.jsx)(ne,{children:(0,M.jsx)(za,{})})}),(0,M.jsx)(Ha,{})]})); \ No newline at end of file diff --git a/viewer-ui/dist/index.html b/viewer-ui/dist/index.html index d0fdaa21..a1d8b6eb 100644 --- a/viewer-ui/dist/index.html +++ b/viewer-ui/dist/index.html @@ -14,7 +14,7 @@ nightcrow - + diff --git a/viewer-ui/src/components/repository/ProjectStrip.tsx b/viewer-ui/src/components/repository/ProjectStrip.tsx index 223d675e..520d27ca 100644 --- a/viewer-ui/src/components/repository/ProjectStrip.tsx +++ b/viewer-ui/src/components/repository/ProjectStrip.tsx @@ -133,7 +133,7 @@ export function ProjectStrip({ aria-label={`close ${r.name}`} className="mr-1 flex h-6 w-6 shrink-0 items-center justify-center rounded-sm text-ink-400 hover:text-removed" > - + ))} diff --git a/viewer-ui/src/components/shell/Header.tsx b/viewer-ui/src/components/shell/Header.tsx index 27a630ce..fbf0f1e0 100644 --- a/viewer-ui/src/components/shell/Header.tsx +++ b/viewer-ui/src/components/shell/Header.tsx @@ -132,7 +132,7 @@ export function Header({ aria-label="sign out" className="ml-1 flex h-6 w-6 shrink-0 items-center justify-center rounded-sm text-ink-400 hover:text-accent" > - + ); diff --git a/viewer-ui/src/components/shell/SettingsMenu.tsx b/viewer-ui/src/components/shell/SettingsMenu.tsx index 959866d5..f975de5f 100644 --- a/viewer-ui/src/components/shell/SettingsMenu.tsx +++ b/viewer-ui/src/components/shell/SettingsMenu.tsx @@ -102,7 +102,7 @@ export function SettingsMenu({ title="Settings" className="ml-auto flex h-6 w-6 shrink-0 items-center justify-center rounded-sm text-ink-400 hover:text-accent" > - + {open && (