diffstalkerd 0.13.10 → 0.13.11

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,5 +1,5 @@
1
1
  var e=Object.create,t=Object.defineProperty,n=Object.getOwnPropertyDescriptor,r=Object.getOwnPropertyNames,i=Object.getPrototypeOf,a=Object.prototype.hasOwnProperty,o=(e,t)=>()=>(t||(e((t={exports:{}}).exports,t),e=null),t.exports),s=(e,i,o,s)=>{if(i&&typeof i==`object`||typeof i==`function`)for(var c=r(i),l=0,u=c.length,d;l<u;l++)d=c[l],!a.call(e,d)&&d!==o&&t(e,d,{get:(e=>i[e]).bind(null,d),enumerable:!(s=n(i,d))||s.enumerable});return e},c=(n,r,o)=>(o=n==null?{}:e(i(n)),s(r||!n||!n.__esModule||!a.call(n,`default`)?t(o,`default`,{value:n,enumerable:!0}):o,n));(function(){let e=document.createElement(`link`).relList;if(e&&e.supports&&e.supports(`modulepreload`))return;for(let e of document.querySelectorAll(`link[rel="modulepreload"]`))n(e);new MutationObserver(e=>{for(let t of e)if(t.type===`childList`)for(let e of t.addedNodes)e.tagName===`LINK`&&e.rel===`modulepreload`&&n(e)}).observe(document,{childList:!0,subtree:!0});function t(e){let t={};return e.integrity&&(t.integrity=e.integrity),e.referrerPolicy&&(t.referrerPolicy=e.referrerPolicy),t.credentials=e.crossOrigin===`use-credentials`?`include`:e.crossOrigin===`anonymous`?`omit`:`same-origin`,t}function n(e){if(e.ep)return;e.ep=!0;let n=t(e);fetch(e.href,n)}})();function l(e){let t=Object.create(null);for(let n of e.split(`,`))t[n]=1;return e=>e in t}var u={},d=[],f=()=>{},p=()=>!1,m=e=>e.charCodeAt(0)===111&&e.charCodeAt(1)===110&&(e.charCodeAt(2)>122||e.charCodeAt(2)<97),h=e=>e.startsWith(`onUpdate:`),g=Object.assign,_=(e,t)=>{let n=e.indexOf(t);n>-1&&e.splice(n,1)},v=Object.prototype.hasOwnProperty,y=(e,t)=>v.call(e,t),b=Array.isArray,x=e=>A(e)===`[object Map]`,S=e=>A(e)===`[object Set]`,C=e=>A(e)===`[object Date]`,w=e=>typeof e==`function`,T=e=>typeof e==`string`,E=e=>typeof e==`symbol`,D=e=>typeof e==`object`&&!!e,O=e=>(D(e)||w(e))&&w(e.then)&&w(e.catch),k=Object.prototype.toString,A=e=>k.call(e),j=e=>A(e).slice(8,-1),M=e=>A(e)===`[object Object]`,N=e=>T(e)&&e!==`NaN`&&e[0]!==`-`&&``+parseInt(e,10)===e,P=l(`,key,ref,ref_for,ref_key,onVnodeBeforeMount,onVnodeMounted,onVnodeBeforeUpdate,onVnodeUpdated,onVnodeBeforeUnmount,onVnodeUnmounted`),F=e=>{let t=Object.create(null);return(n=>t[n]||(t[n]=e(n)))},I=/-\w/g,L=F(e=>e.replace(I,e=>e.slice(1).toUpperCase())),ee=/\B([A-Z])/g,R=F(e=>e.replace(ee,`-$1`).toLowerCase()),te=F(e=>e.charAt(0).toUpperCase()+e.slice(1)),ne=F(e=>e?`on${te(e)}`:``),re=(e,t)=>!Object.is(e,t),ie=(e,...t)=>{for(let n=0;n<e.length;n++)e[n](...t)},ae=(e,t,n,r=!1)=>{Object.defineProperty(e,t,{configurable:!0,enumerable:!1,writable:r,value:n})},oe=e=>{let t=parseFloat(e);return isNaN(t)?e:t},se,ce=()=>se||=typeof globalThis<`u`?globalThis:typeof self<`u`?self:typeof window<`u`?window:typeof global<`u`?global:{};function le(e){if(b(e)){let t={};for(let n=0;n<e.length;n++){let r=e[n],i=T(r)?pe(r):le(r);if(i)for(let e in i)t[e]=i[e]}return t}if(T(e)||D(e))return e}var ue=/;(?![^(]*\))/g,de=/:([^]+)/,fe=/"(?:[^"\\]|\\[^])*"|'(?:[^'\\]|\\[^])*'|\\[^]|\/\*[^]*?\*\//g;function pe(e){let t={};return e.replace(fe,e=>e.startsWith(`/*`)?``:e).split(ue).forEach(e=>{if(e){let n=e.split(de);n.length>1&&(t[n[0].trim()]=n[1].trim())}}),t}function z(e){let t=``;if(T(e))t=e;else if(b(e))for(let n=0;n<e.length;n++){let r=z(e[n]);r&&(t+=r+` `)}else if(D(e))for(let n in e)e[n]&&(t+=n+` `);return t.trim()}var me=`itemscope,allowfullscreen,formnovalidate,ismap,nomodule,novalidate,readonly`,he=l(me);me+``;function ge(e){return!!e||e===``}function _e(e,t,n){if(e.length!==t.length)return!1;let r=!0;for(let i=0;r&&i<e.length;i++)r=xe(e[i],t[i],n);return r}function ve(e,t,n){if(e.size!==t.size)return!1;let r=Array.from(t),i=new Uint8Array(r.length);for(let t of e){let e=-1;for(let a=0;a<r.length;a++)if(!i[a]&&xe(t,r[a],n)){e=a;break}if(e<0)return!1;i[e]=1}return!0}function ye(e,t,n){let r=x(e),i=x(t);if(r||i||(r=S(e),i=S(t),r||i))return r&&i?ve(e,t,n):!1;if(Object.keys(e).length!==Object.keys(t).length)return!1;for(let r in e){let i=e.hasOwnProperty(r),a=t.hasOwnProperty(r);if(i&&!a||!i&&a||!xe(e[r],t[r],n))return!1}return String(e)===String(t)}function be(e,t,n,r){n||=[new Map,new Map];let[i,a]=n;if(i.has(e)||a.has(t))return i.get(e)===t&&a.get(t)===e;i.set(e,t),a.set(t,e);let o=r(e,t,n);return i.delete(e),a.delete(t),o}function xe(e,t,n){if(e===t)return!0;let r=C(e),i=C(t);return r||i?r&&i?e.getTime()===t.getTime():!1:(r=E(e),i=E(t),r||i?e===t:(r=b(e),i=b(t),r||i?r&&i?be(e,t,n,_e):!1:(r=D(e),i=D(t),r||i?!r||!i?!1:be(e,t,n,ye):String(e)===String(t))))}var Se=e=>!!(e&&e.__v_isRef===!0),B=e=>T(e)?e:e==null?``:b(e)||D(e)&&(e.toString===k||!w(e.toString))?Se(e)?B(e.value):JSON.stringify(e,Ce,2):String(e),Ce=(e,t)=>Se(t)?Ce(e,t.value):x(t)?{[`Map(${t.size})`]:[...t.entries()].reduce((e,[t,n],r)=>(e[we(t,r)+` =>`]=n,e),{})}:S(t)?{[`Set(${t.size})`]:[...t.values()].map(e=>we(e))}:E(t)?we(t):D(t)&&!b(t)&&!M(t)?String(t):t,we=(e,t=``)=>E(e)?`Symbol(${e.description??t})`:e,Te,Ee=class{constructor(e=!1){this.detached=e,this._active=!0,this._on=0,this.effects=[],this.cleanups=[],this._isPaused=!1,this._warnOnRun=!0,this.__v_skip=!0,!e&&Te&&(Te.active?(this.parent=Te,this.index=(Te.scopes||(Te.scopes=[])).push(this)-1):(this._active=!1,this._warnOnRun=!1))}get active(){return this._active}pause(){if(this._active){this._isPaused=!0;let e,t;if(this.scopes){let n=this.scopes.slice();for(e=0,t=n.length;e<t;e++)n[e].pause()}for(e=0,t=this.effects.length;e<t;e++)this.effects[e].pause()}}resume(){if(this._active&&this._isPaused){this._isPaused=!1;let e,t;if(this.scopes){let n=this.scopes.slice();for(e=0,t=n.length;e<t;e++)n[e].resume()}let n=this.effects.slice();for(e=0,t=n.length;e<t;e++)n[e].resume()}}run(e){if(this._active){let t=Te;try{return Te=this,e()}finally{Te=t}}}on(){++this._on===1&&(this.prevScope=Te,Te=this)}off(){if(this._on>0&&--this._on===0){if(Te===this)Te=this.prevScope;else{let e=Te;for(;e;){if(e.prevScope===this){e.prevScope=this.prevScope;break}e=e.prevScope}}this.prevScope=void 0}}stop(e){if(this._active){this._active=!1;let t,n;for(t=0,n=this.effects.length;t<n;t++)this.effects[t].stop();for(this.effects.length=0,t=0,n=this.cleanups.length;t<n;t++)this.cleanups[t]();if(this.cleanups.length=0,this.scopes){let e=this.scopes.slice();for(t=0,n=e.length;t<n;t++)e[t].stop(!0);this.scopes.length=0}if(!this.detached&&this.parent&&!e){let e=this.parent.scopes.pop();e&&e!==this&&(this.parent.scopes[this.index]=e,e.index=this.index)}this.parent=void 0}}};function De(e){return new Ee(e)}function Oe(){return Te}function ke(e,t=!1){Te&&Te.cleanups.push(e)}var Ae,je=new WeakSet,Me=class{constructor(e){this.fn=e,this.deps=void 0,this.depsTail=void 0,this.flags=5,this.next=void 0,this.cleanup=void 0,this.scheduler=void 0,Te&&(Te.active?Te.effects.push(this):this.flags&=-2)}pause(){this.flags|=64}resume(){this.flags&64&&(this.flags&=-65,je.has(this)&&(je.delete(this),this.trigger()))}notify(){this.flags&2&&!(this.flags&32)||this.flags&8||Ie(this)}run(){if(!(this.flags&1))return this.fn();this.flags|=2,Ye(this),ze(this);let e=Ae,t=Ge;Ae=this,Ge=!0;try{return this.fn()}finally{Be(this),Ae=e,Ge=t,this.flags&=-3}}stop(){if(this.flags&1){for(let e=this.deps;e;e=e.nextDep)Ue(e);this.deps=this.depsTail=void 0,Ye(this),this.onStop&&this.onStop(),this.flags&=-2}}trigger(){this.flags&64?je.add(this):this.scheduler?this.scheduler():this.runIfDirty()}runIfDirty(){Ve(this)&&this.run()}get dirty(){return Ve(this)}},Ne=0,Pe,Fe;function Ie(e,t=!1){e.flags|=8,t?(e.next=Fe,Fe=e):(e.next=Pe,Pe=e)}function Le(){Ne++}function Re(){if(--Ne>0)return;if(Fe){let e=Fe;for(Fe=void 0;e;){let t=e.next;e.next=void 0,e.flags&=-9,e=t}}let e;for(;Pe;){let t=Pe;for(Pe=void 0;t;){let n=t.next;if(t.next=void 0,t.flags&=-9,t.flags&1)try{t.trigger()}catch(t){e||=t}t=n}}if(e)throw e}function ze(e){for(let t=e.deps;t;t=t.nextDep)t.version=-1,t.prevActiveLink=t.dep.activeLink,t.dep.activeLink=t}function Be(e){let t,n=e.depsTail,r=n;for(;r;){let e=r.prevDep;r.version===-1?(r===n&&(n=e),Ue(r),We(r)):t=r,r.dep.activeLink=r.prevActiveLink,r.prevActiveLink=void 0,r=e}e.deps=t,e.depsTail=n}function Ve(e){for(let t=e.deps;t;t=t.nextDep)if(t.dep.version!==t.version||t.dep.computed&&(He(t.dep.computed)||t.dep.version!==t.version))return!0;return!!e._dirty}function He(e){if(e.flags&4&&!(e.flags&16)||(e.flags&=-17,e.globalVersion===Xe)||(e.globalVersion=Xe,!e.isSSR&&e.flags&128&&(!e.deps&&!e._dirty||!Ve(e))))return;e.flags|=2;let t=e.dep,n=Ae,r=Ge;Ae=e,Ge=!0;try{ze(e);let n=e.fn(e._value);(t.version===0||re(n,e._value))&&(e.flags|=128,e._value=n,t.version++)}catch(e){throw t.version++,e}finally{Ae=n,Ge=r,Be(e),e.flags&=-3}}function Ue(e,t=!1){let{dep:n,prevSub:r,nextSub:i}=e;if(r&&(r.nextSub=i,e.prevSub=void 0),i&&(i.prevSub=r,e.nextSub=void 0),n.subs===e&&(n.subs=r,!r&&n.computed)){n.computed.flags&=-5;for(let e=n.computed.deps;e;e=e.nextDep)Ue(e,!0)}!t&&!--n.sc&&n.map&&n.map.delete(n.key)}function We(e){let{prevDep:t,nextDep:n}=e;t&&(t.nextDep=n,e.prevDep=void 0),n&&(n.prevDep=t,e.nextDep=void 0)}var Ge=!0,Ke=[];function qe(){Ke.push(Ge),Ge=!1}function Je(){let e=Ke.pop();Ge=e===void 0||e}function Ye(e){let{cleanup:t}=e;if(e.cleanup=void 0,t){let e=Ae;Ae=void 0;try{t()}finally{Ae=e}}}var Xe=0,Ze=class{constructor(e,t){this.sub=e,this.dep=t,this.version=t.version,this.nextDep=this.prevDep=this.nextSub=this.prevSub=this.prevActiveLink=void 0}},Qe=class{constructor(e){this.computed=e,this.version=0,this.activeLink=void 0,this.subs=void 0,this.map=void 0,this.key=void 0,this.sc=0,this.__v_skip=!0}track(e){if(!Ae||!Ge||Ae===this.computed)return;let t=this.activeLink;if(t===void 0||t.sub!==Ae)t=this.activeLink=new Ze(Ae,this),Ae.deps?(t.prevDep=Ae.depsTail,Ae.depsTail.nextDep=t,Ae.depsTail=t):Ae.deps=Ae.depsTail=t,$e(t);else if(t.version===-1&&(t.version=this.version,t.nextDep)){let e=t.nextDep;e.prevDep=t.prevDep,t.prevDep&&(t.prevDep.nextDep=e),t.prevDep=Ae.depsTail,t.nextDep=void 0,Ae.depsTail.nextDep=t,Ae.depsTail=t,Ae.deps===t&&(Ae.deps=e)}return t}trigger(e){this.version++,Xe++,this.notify(e)}notify(e){Le();try{for(let e=this.subs;e;e=e.prevSub)e.sub.notify()&&e.sub.dep.notify()}finally{Re()}}};function $e(e){if(e.dep.sc++,e.sub.flags&4){let t=e.dep.computed;if(t&&!e.dep.subs){t.flags|=20;for(let e=t.deps;e;e=e.nextDep)$e(e)}let n=e.dep.subs;n!==e&&(e.prevSub=n,n&&(n.nextSub=e)),e.dep.subs=e}}var et=new WeakMap,tt=Symbol(``),nt=Symbol(``),rt=Symbol(``);function it(e,t,n){if(Ge&&Ae){let t=et.get(e);t||et.set(e,t=new Map);let r=t.get(n);r||(t.set(n,r=new Qe),r.map=t,r.key=n),r.track()}}function at(e,t,n,r,i,a){let o=et.get(e);if(!o){Xe++;return}let s=e=>{e&&e.trigger()};if(Le(),t===`clear`)o.forEach(s);else{let i=b(e),a=i&&N(n);if(i&&n===`length`){let e=Number(r);o.forEach((t,n)=>{(n===`length`||n===rt||!E(n)&&n>=e)&&s(t)})}else switch((n!==void 0||o.has(void 0))&&s(o.get(n)),a&&s(o.get(rt)),t){case`add`:i?a&&s(o.get(`length`)):(s(o.get(tt)),x(e)&&s(o.get(nt)));break;case`delete`:i||(s(o.get(tt)),x(e)&&s(o.get(nt)));break;case`set`:x(e)&&s(o.get(tt))}}Re()}function ot(e,t){let n=et.get(e);return n&&n.get(t)}function st(e){let t=Jt(e);return t===e||(it(t,`iterate`,rt),Kt(e))?t:Gt(e)?Wt(e)?t.map(e=>Zt(Xt(e))):t.map(Zt):t.map(Xt)}function ct(e){return it(e=Jt(e),`iterate`,rt),e}function lt(e,t){return Gt(e)?Zt(Wt(e)?Xt(t):t):Xt(t)}var ut={__proto__:null,[Symbol.iterator](){return dt(this,Symbol.iterator,e=>lt(this,e))},concat(...e){return st(this).concat(...e.map(e=>b(e)?st(e):e))},entries(){return dt(this,`entries`,e=>(e[1]=lt(this,e[1]),e))},every(e,t){return pt(this,`every`,e,t,void 0,arguments)},filter(e,t){return pt(this,`filter`,e,t,e=>e.map(e=>lt(this,e)),arguments)},find(e,t){return pt(this,`find`,e,t,e=>lt(this,e),arguments)},findIndex(e,t){return pt(this,`findIndex`,e,t,void 0,arguments)},findLast(e,t){return pt(this,`findLast`,e,t,e=>lt(this,e),arguments)},findLastIndex(e,t){return pt(this,`findLastIndex`,e,t,void 0,arguments)},forEach(e,t){return pt(this,`forEach`,e,t,void 0,arguments)},includes(...e){return ht(this,`includes`,e)},indexOf(...e){return ht(this,`indexOf`,e)},join(e){return st(this).join(e)},lastIndexOf(...e){return ht(this,`lastIndexOf`,e)},map(e,t){return pt(this,`map`,e,t,void 0,arguments)},pop(){return gt(this,`pop`)},push(...e){return gt(this,`push`,e)},reduce(e,...t){return mt(this,`reduce`,e,t)},reduceRight(e,...t){return mt(this,`reduceRight`,e,t)},shift(){return gt(this,`shift`)},some(e,t){return pt(this,`some`,e,t,void 0,arguments)},splice(...e){return gt(this,`splice`,e)},toReversed(){return st(this).toReversed()},toSorted(e){return st(this).toSorted(e)},toSpliced(...e){return st(this).toSpliced(...e)},unshift(...e){return gt(this,`unshift`,e)},values(){return dt(this,`values`,e=>lt(this,e))}};function dt(e,t,n){let r=ct(e),i=r[t]();return r!==e&&!Kt(e)&&(i._next=i.next,i.next=()=>{let e=i._next();return e.done||(e.value=n(e.value)),e}),i}var ft=Array.prototype;function pt(e,t,n,r,i,a){let o=ct(e),s=o!==e&&!Kt(e),c=o[t];if(c!==ft[t]){let t=c.apply(e,a);return s?Xt(t):t}let l=n;o!==e&&(s?l=function(t,r){return n.call(this,lt(e,t),r,e)}:n.length>2&&(l=function(t,r){return n.call(this,t,r,e)}));let u=c.call(o,l,r);return s&&i?i(u):u}function mt(e,t,n,r){let i=ct(e),a=i!==e&&!Kt(e),o=n,s=!1;i!==e&&(a?(s=r.length===0,o=function(t,r,i){return s&&(s=!1,t=lt(e,t)),n.call(this,t,lt(e,r),i,e)}):n.length>3&&(o=function(t,r,i){return n.call(this,t,r,i,e)}));let c=i[t](o,...r);return s?lt(e,c):c}function ht(e,t,n){let r=Jt(e);it(r,`iterate`,rt);let i=r[t](...n);return(i===-1||i===!1)&&qt(n[0])?(n[0]=Jt(n[0]),r[t](...n)):i}function gt(e,t,n=[]){qe(),Le();let r=Jt(e)[t].apply(e,n);return Re(),Je(),r}var _t=l(`__proto__,__v_isRef,__isVue`),vt=new Set(Object.getOwnPropertyNames(Symbol).filter(e=>e!==`arguments`&&e!==`caller`).map(e=>Symbol[e]).filter(E));function yt(e){E(e)||(e=String(e));let t=Jt(this);return it(t,`has`,e),t.hasOwnProperty(e)}var bt=class{constructor(e=!1,t=!1){this._isReadonly=e,this._isShallow=t}get(e,t,n){if(t===`__v_skip`)return e.__v_skip;let r=this._isReadonly,i=this._isShallow;if(t===`__v_isReactive`)return!r;if(t===`__v_isReadonly`)return r;if(t===`__v_isShallow`)return i;if(t===`__v_raw`)return n===(r?i?Rt:Lt:i?It:Ft).get(e)||Object.getPrototypeOf(e)===Object.getPrototypeOf(n)?e:void 0;let a=b(e);if(!r){let e;if(a&&(e=ut[t]))return e;if(t===`hasOwnProperty`)return yt}let o=Reflect.get(e,t,Qt(e)?e:n);if((E(t)?vt.has(t):_t(t))||(r||it(e,`get`,t),i))return o;if(Qt(o)){let e=a&&N(t)?o:o.value;return r&&D(e)?Ht(e):e}return D(o)?r?Ht(o):Bt(o):o}},xt=class extends bt{constructor(e=!1){super(!1,e)}set(e,t,n,r){let i=e[t],a=b(e)&&N(t);if(!this._isShallow){let e=Gt(i);if(!Kt(n)&&!Gt(n)&&(i=Jt(i),n=Jt(n)),!a&&Qt(i)&&!Qt(n))return e||(i.value=n),!0}let o=a?Number(t)<e.length:y(e,t),s=Reflect.set(e,t,n,Qt(e)?e:r);return e===Jt(r)&&s&&(o?re(n,i)&&at(e,`set`,t,n,i):at(e,`add`,t,n)),s}deleteProperty(e,t){let n=y(e,t),r=e[t],i=Reflect.deleteProperty(e,t);return i&&n&&at(e,`delete`,t,void 0,r),i}has(e,t){let n=Reflect.has(e,t);return(!E(t)||!vt.has(t))&&it(e,`has`,t),n}ownKeys(e){return it(e,`iterate`,b(e)?`length`:tt),Reflect.ownKeys(e)}},St=class extends bt{constructor(e=!1){super(!0,e)}set(e,t){return!0}deleteProperty(e,t){return!0}},Ct=new xt,wt=new St,Tt=new xt(!0),Et=e=>e,Dt=e=>Reflect.getPrototypeOf(e);function Ot(e,t,n){return function(...r){let i=this.__v_raw,a=Jt(i),o=x(a),s=e===`entries`||e===Symbol.iterator&&o,c=e===`keys`&&o,l=i[e](...r),u=n?Et:t?Zt:Xt;return!t&&it(a,`iterate`,c?nt:tt),g(Object.create(l),{next(){let{value:e,done:t}=l.next();return t?{value:e,done:t}:{value:s?[u(e[0]),u(e[1])]:u(e),done:t}}})}}function kt(e){return function(...t){return e===`delete`?!1:e===`clear`?void 0:this}}function At(e,t){let n={get(n){let r=this.__v_raw,i=Jt(r),a=Jt(n);e||(re(n,a)&&it(i,`get`,n),it(i,`get`,a));let{has:o}=Dt(i),s=t?Et:e?Zt:Xt;if(o.call(i,n))return s(r.get(n));if(o.call(i,a))return s(r.get(a));r!==i&&r.get(n)},get size(){let t=this.__v_raw;return!e&&it(Jt(t),`iterate`,tt),t.size},has(t){let n=this.__v_raw,r=Jt(n),i=Jt(t);return e||(re(t,i)&&it(r,`has`,t),it(r,`has`,i)),t===i?n.has(t):n.has(t)||n.has(i)},forEach(n,r){let i=this,a=i.__v_raw,o=Jt(a),s=t?Et:e?Zt:Xt;return!e&&it(o,`iterate`,tt),a.forEach((e,t)=>n.call(r,s(e),s(t),i))}};return g(n,e?{add:kt(`add`),set:kt(`set`),delete:kt(`delete`),clear:kt(`clear`)}:{add(e){let n=Jt(this),r=Dt(n),i=Jt(e),a=!t&&!Kt(e)&&!Gt(e)?i:e;return r.has.call(n,a)||re(e,a)&&r.has.call(n,e)||re(i,a)&&r.has.call(n,i)||(n.add(a),at(n,`add`,a,a)),this},set(e,n){!t&&!Kt(n)&&!Gt(n)&&(n=Jt(n));let r=Jt(this),{has:i,get:a}=Dt(r),o=i.call(r,e);o||=(e=Jt(e),i.call(r,e));let s=a.call(r,e);return r.set(e,n),o?re(n,s)&&at(r,`set`,e,n,s):at(r,`add`,e,n),this},delete(e){let t=Jt(this),{has:n,get:r}=Dt(t),i=n.call(t,e);i||=(e=Jt(e),n.call(t,e));let a=r?r.call(t,e):void 0,o=t.delete(e);return i&&at(t,`delete`,e,void 0,a),o},clear(){let e=Jt(this),t=e.size!==0,n=e.clear();return t&&at(e,`clear`,void 0,void 0,void 0),n}}),[`keys`,`values`,`entries`,Symbol.iterator].forEach(r=>{n[r]=Ot(r,e,t)}),n}function jt(e,t){let n=At(e,t);return(t,r,i)=>r===`__v_isReactive`?!e:r===`__v_isReadonly`?e:r===`__v_raw`?t:Reflect.get(y(n,r)&&r in t?n:t,r,i)}var Mt={get:jt(!1,!1)},Nt={get:jt(!1,!0)},Pt={get:jt(!0,!1)},Ft=new WeakMap,It=new WeakMap,Lt=new WeakMap,Rt=new WeakMap;function zt(e){switch(e){case`Object`:case`Array`:return 1;case`Map`:case`Set`:case`WeakMap`:case`WeakSet`:return 2;default:return 0}}function Bt(e){return Gt(e)?e:Ut(e,!1,Ct,Mt,Ft)}function Vt(e){return Ut(e,!1,Tt,Nt,It)}function Ht(e){return Ut(e,!0,wt,Pt,Lt)}function Ut(e,t,n,r,i){if(!D(e)||e.__v_raw&&!(t&&e.__v_isReactive)||e.__v_skip||!Object.isExtensible(e))return e;let a=i.get(e);if(a)return a;let o=zt(j(e));if(o===0)return e;let s=new Proxy(e,o===2?r:n);return i.set(e,s),s}function Wt(e){return Gt(e)?Wt(e.__v_raw):!!(e&&e.__v_isReactive)}function Gt(e){return!!(e&&e.__v_isReadonly)}function Kt(e){return!!(e&&e.__v_isShallow)}function qt(e){return e?!!e.__v_raw:!1}function Jt(e){let t=e&&e.__v_raw;return t?Jt(t):e}function Yt(e){return!y(e,`__v_skip`)&&Object.isExtensible(e)&&ae(e,`__v_skip`,!0),e}var Xt=e=>D(e)?Bt(e):e,Zt=e=>D(e)?Ht(e):e;function Qt(e){return e?e.__v_isRef===!0:!1}function V(e){return $t(e,!1)}function H(e){return $t(e,!0)}function $t(e,t){return Qt(e)?e:new en(e,t)}var en=class{constructor(e,t){this.dep=new Qe,this.__v_isRef=!0,this.__v_isShallow=!1,this._rawValue=t?e:Jt(e),this._value=t?e:Xt(e),this.__v_isShallow=t}get value(){return this.dep.track(),this._value}set value(e){let t=this._rawValue,n=this.__v_isShallow||Kt(e)||Gt(e);e=n?e:Jt(e),re(e,t)&&(this._rawValue=e,this._value=n?e:Xt(e),this.dep.trigger())}};function U(e){return Qt(e)?e.value:e}var tn={get:(e,t,n)=>t===`__v_raw`?e:U(Reflect.get(e,t,n)),set:(e,t,n,r)=>{let i=e[t];return Qt(i)&&!Qt(n)?(i.value=n,!0):Reflect.set(e,t,n,r)}};function nn(e){return Wt(e)?e:new Proxy(e,tn)}function rn(e){let t=b(e)?Array(e.length):{};for(let n in e)t[n]=cn(e,n);return t}var an=class{constructor(e,t,n){this._object=e,this._defaultValue=n,this.__v_isRef=!0,this._value=void 0,this._key=E(t)?t:String(t),this._raw=Jt(e);let r=!0,i=e;if(!b(e)||E(this._key)||!N(this._key))do r=!qt(i)||Kt(i);while(r&&(i=i.__v_raw));this._shallow=r}get value(){let e=this._object[this._key];return this._shallow&&(e=U(e)),this._value=e===void 0?this._defaultValue:e}set value(e){if(this._shallow&&Qt(this._raw[this._key])){let t=this._object[this._key];if(Qt(t)){t.value=e;return}}this._object[this._key]=e}get dep(){return ot(this._raw,this._key)}},on=class{constructor(e){this._getter=e,this.__v_isRef=!0,this.__v_isReadonly=!0,this._value=void 0}get value(){return this._value=this._getter()}};function sn(e,t,n){return Qt(e)?e:w(e)?new on(e):D(e)&&arguments.length>1?cn(e,t,n):V(e)}function cn(e,t,n){return new an(e,t,n)}var ln=class{constructor(e,t,n){this.fn=e,this.setter=t,this._value=void 0,this.dep=new Qe(this),this.__v_isRef=!0,this.deps=void 0,this.depsTail=void 0,this.flags=16,this.globalVersion=Xe-1,this.next=void 0,this.effect=this,this.__v_isReadonly=!t,this.isSSR=n}notify(){if(this.flags|=16,!(this.flags&8)&&Ae!==this)return Ie(this,!0),!0}get value(){let e=this.dep.track();return He(this),e&&(e.version=this.dep.version),this._value}set value(e){this.setter&&this.setter(e)}};function un(e,t,n=!1){let r,i;return w(e)?r=e:(r=e.get,i=e.set),new ln(r,i,n)}var dn={},fn=new WeakMap,pn=void 0;function mn(e,t=!1,n=pn){if(n){let t=fn.get(n);t||fn.set(n,t=[]),t.push(e)}}function hn(e,t,n=u){let{immediate:r,deep:i,once:a,scheduler:o,augmentJob:s,call:c}=n,l=e=>i?e:Kt(e)||i===!1||i===0?gn(e,1):gn(e),d,p,m,h,g=!1,v=!1;if(Qt(e)?(p=()=>e.value,g=Kt(e)):Wt(e)?(p=()=>l(e),g=!0):b(e)?(v=!0,g=e.some(e=>Wt(e)||Kt(e)),p=()=>e.map(e=>{if(Qt(e))return e.value;if(Wt(e))return l(e);if(w(e))return c?c(e,2):e()})):p=w(e)?t?c?()=>c(e,2):e:()=>{if(m){qe();try{m()}finally{Je()}}let t=pn;pn=d;try{return c?c(e,3,[h]):e(h)}finally{pn=t}}:f,t&&i){let e=p,t=i===!0?1/0:i;p=()=>gn(e(),t)}let y=Oe(),x=()=>{d.stop(),y&&y.active&&_(y.effects,d)};if(a&&t){let e=t;t=(...t)=>{let n=e(...t);return x(),n}}let S=v?Array(e.length).fill(dn):dn,C=e=>{if(d.flags&1&&(d.dirty||e)){if(t){let n=d.run();if(e||i||g||(v?n.some((e,t)=>re(e,S[t])):re(n,S))){m&&m();let e=pn;pn=d;try{let e=[n,S===dn?void 0:v&&S[0]===dn?[]:S,h];S=n,c?c(t,3,e):t(...e)}finally{pn=e}}}else d.run()}};return s&&s(C),d=new Me(p),d.scheduler=o?()=>o(C,!1):C,h=e=>mn(e,!1,d),m=d.onStop=()=>{let e=fn.get(d);if(e){if(c)c(e,4);else for(let t of e)t();fn.delete(d)}},t?r?C(!0):S=d.run():o?o(C.bind(null,!0),!0):d.run(),x.pause=d.pause.bind(d),x.resume=d.resume.bind(d),x.stop=x,x}function gn(e,t=1/0,n){if(t<=0||!D(e)||e.__v_skip||(n||=new Map,(n.get(e)||0)>=t))return e;if(n.set(e,t),t--,Qt(e))gn(e.value,t,n);else if(b(e))for(let r=0;r<e.length;r++)gn(e[r],t,n);else if(S(e)||x(e))e.forEach(e=>{gn(e,t,n)});else if(M(e)){for(let r in e)gn(e[r],t,n);for(let r of Object.getOwnPropertySymbols(e))Object.prototype.propertyIsEnumerable.call(e,r)&&gn(e[r],t,n)}return e}function _n(e,t,n,r){try{return r?e(...r):e()}catch(e){yn(e,t,n)}}function vn(e,t,n,r){if(w(e)){let i=_n(e,t,n,r);return i&&O(i)&&i.catch(e=>{yn(e,t,n)}),i}if(b(e)){let i=[];for(let a=0;a<e.length;a++)i.push(vn(e[a],t,n,r));return i}}function yn(e,t,n,r=!0){let i=t?t.vnode:null,{errorHandler:a,throwUnhandledErrorInProduction:o}=t&&t.appContext.config||u;if(t){let r=t.parent,i=t.proxy,o=`https://vuejs.org/error-reference/#runtime-${n}`;for(;r;){let t=r.ec;if(t){for(let n=0;n<t.length;n++)if(t[n](e,i,o)===!1)return}r=r.parent}if(a){qe(),_n(a,null,10,[e,i,o]),Je();return}}bn(e,n,i,r,o)}function bn(e,t,n,r=!0,i=!1){if(i)throw e;console.error(e)}var xn=[],Sn=-1,Cn=[],wn=null,Tn=0,En=Promise.resolve(),Dn=null;function On(e){let t=Dn||En;return e?t.then(this?e.bind(this):e):t}function kn(e){let t=Sn+1,n=xn.length;for(;t<n;){let r=t+n>>>1,i=xn[r],a=Fn(i);a<e||a===e&&i.flags&2?t=r+1:n=r}return t}function An(e){if(!(e.flags&1)){let t=Fn(e),n=xn[xn.length-1];!n||!(e.flags&2)&&t>=Fn(n)?xn.push(e):xn.splice(kn(t),0,e),e.flags|=1,jn()}}function jn(){Dn||=En.then(In)}function Mn(e){if(!b(e))wn&&e.id===-1?wn.splice(Tn+1,0,e):e.flags&1||(Cn.push(e),e.flags|=1);else for(let t=0;t<e.length;t++)Cn.push(e[t]);jn()}function Nn(e,t,n=Sn+1){for(;n<xn.length;n++){let t=xn[n];if(t&&t.flags&2){if(e&&t.id!==e.uid)continue;xn.splice(n,1),n--,t.flags&4&&(t.flags&=-2),t(),t.flags&4||(t.flags&=-2)}}}function Pn(e){if(Cn.length){let e=[...new Set(Cn)].sort((e,t)=>Fn(e)-Fn(t));if(Cn.length=0,wn){for(let t=0;t<e.length;t++)wn.push(e[t]);return}for(wn=e,Tn=0;Tn<wn.length;Tn++){let e=wn[Tn];e.flags&4&&(e.flags&=-2),e.flags&8||e(),e.flags&=-2}wn=null,Tn=0}}var Fn=e=>e.id==null?e.flags&2?-1:1/0:e.id;function In(e){try{for(Sn=0;Sn<xn.length;Sn++){let e=xn[Sn];e&&!(e.flags&8)&&(e.flags&4&&(e.flags&=-2),_n(e,e.i,e.i?15:14),e.flags&4||(e.flags&=-2))}}finally{for(;Sn<xn.length;Sn++){let e=xn[Sn];e&&(e.flags&=-2)}Sn=-1,xn.length=0,Pn(e),Dn=null,(xn.length||Cn.length)&&In(e)}}var Ln=null,Rn=null;function zn(e){let t=Ln;return Ln=e,Rn=e&&e.type.__scopeId||null,t}function Bn(e,t=Ln,n){if(!t||e._n)return e;let r=(...n)=>{r._d&&ma(-1);let i=zn(t),a=ua.length,o;try{o=e(...n)}finally{for(let e=ua.length;e>a;e--)fa();zn(i),r._d&&ma(1)}return o};return r._n=!0,r._c=!0,r._d=!0,r}function Vn(e,t){if(Ln===null)return e;let n=qa(Ln),r=e.dirs||=[];for(let e=0;e<t.length;e++){let[i,a,o,s=u]=t[e];i&&(w(i)&&(i={mounted:i,updated:i}),i.deep&&gn(a),r.push({dir:i,instance:n,value:a,oldValue:void 0,arg:o,modifiers:s}))}return e}function Hn(e,t,n,r){let i=e.dirs,a=t&&t.dirs;for(let o=0;o<i.length;o++){let s=i[o];a&&(s.oldValue=a[o].value);let c=s.dir[r];c&&(qe(),vn(c,n,8,[e.el,s,e,t]),Je())}}function Un(e,t){if(Na){let n=Na.provides,r=Na.parent&&Na.parent.provides;r===n&&(n=Na.provides=Object.create(r)),n[e]=t}}function Wn(e,t,n=!1){let r=Pa();if(r||_i){let i=_i?_i._context.provides:r?r.parent==null||r.ce?r.vnode.appContext&&r.vnode.appContext.provides:r.parent.provides:void 0;if(i&&e in i)return i[e];if(arguments.length>1)return n&&w(t)?t.call(r&&r.proxy):t}}function Gn(){return!!(Pa()||_i)}var Kn=Symbol.for(`v-scx`),qn=()=>Wn(Kn);function Jn(e,t){return Yn(e,null,t)}function W(e,t,n){return Yn(e,t,n)}function Yn(e,t,n=u){let{immediate:r,deep:i,flush:a,once:o}=n,s=g({},n),c=t&&r||!t&&a!==`post`,l;if(Ba){if(a===`sync`){let e=qn();l=e.__watcherHandles||=[]}else if(!c){let e=()=>{};return e.stop=f,e.resume=f,e.pause=f,e}}let d=Na;s.call=(e,t,n)=>vn(e,d,t,n);let p=!1;a===`post`?s.scheduler=e=>{Ji(e,d&&d.suspense)}:a!==`sync`&&(p=!0,s.scheduler=(e,t)=>{t?e():An(e)}),s.augmentJob=e=>{t&&(e.flags|=4),p&&(e.flags|=2,d&&(e.id=d.uid,e.i=d))};let m=hn(e,t,s);return Ba&&(l?l.push(m):c&&m()),m}function Xn(e,t,n){let r=this.proxy,i=T(e)?e.includes(`.`)?Zn(r,e):()=>r[e]:e.bind(r,r),a;w(t)?a=t:(a=t.handler,n=t);let o=La(this),s=Yn(i,a.bind(r),n);return o(),s}function Zn(e,t){let n=t.split(`.`);return()=>{let t=e;for(let e=0;e<n.length&&t;e++)t=t[n[e]];return t}}var Qn=new WeakMap,$n=Symbol(`_vte`),er=e=>e.__isTeleport,tr=e=>e&&(e.disabled||e.disabled===``),nr=e=>e&&(e.defer||e.defer===``),rr=e=>typeof SVGElement<`u`&&e instanceof SVGElement,ir=e=>typeof MathMLElement==`function`&&e instanceof MathMLElement,ar=(e,t)=>{let n=e&&e.to;return T(n)?t?t(n):null:n},or={name:`Teleport`,__isTeleport:!0,process(e,t,n,r,i,a,o,s,c,l){let{mc:u,pc:d,pbc:f,o:{insert:p,querySelector:m,createText:h,createComment:g,parentNode:_}}=l,v=tr(t.props),{dynamicChildren:y}=t,b=(e,t,n)=>{e.shapeFlag&16&&u(e.children,t,n,i,a,o,s,c)},x=(e=t)=>{let n=tr(e.props),r=e.target=ar(e.props,m),a=dr(r,e,h,p);r&&(o!==`svg`&&rr(r)?o=`svg`:o!==`mathml`&&ir(r)&&(o=`mathml`),i&&i.isCE&&(i.ce._teleportTargets||(i.ce._teleportTargets=new Set)).add(r),n||(b(e,r,a),ur(e,!1)))},S=e=>{let t=()=>{if(Qn.get(e)===t){if(Qn.delete(e),tr(e.props)){let t=_(e.el)||n;b(e,t,e.anchor),ur(e,!0)}x(e)}};Qn.set(e,t),Ji(t,a)};if(e==null){let e=t.el=h(``),i=t.anchor=h(``);if(p(e,n,r),p(i,n,r),nr(t.props)||a&&a.pendingBranch){S(t);return}v&&(b(t,n,i),ur(t,!0)),x()}else{t.el=e.el;let r=t.anchor=e.anchor,u=Qn.get(e);if(u){u.flags|=8,Qn.delete(e),S(t);return}t.targetStart=e.targetStart;let p=t.target=e.target,h=t.targetAnchor=e.targetAnchor,g=tr(e.props),_=g?n:p,b=g?r:h;if(o===`svg`||rr(p)?o=`svg`:(o===`mathml`||ir(p))&&(o=`mathml`),y?(f(e.dynamicChildren,y,_,i,a,o,s),ea(e,t,!0)):c||d(e,t,_,b,i,a,o,s,!1),v)g?t.props&&e.props&&t.props.to!==e.props.to&&(t.props.to=e.props.to):sr(t,n,r,l,1);else if((t.props&&t.props.to)!==(e.props&&e.props.to)){let e=ar(t.props,m);e&&(t.target=e,sr(t,e,null,l,0))}else g&&sr(t,p,h,l,1);ur(t,v)}},remove(e,t,n,{um:r,o:{remove:i}},a){let{shapeFlag:o,children:s,anchor:c,targetStart:l,targetAnchor:u,target:d,props:f}=e,p=tr(f),m=a||!p,h=Qn.get(e);if(h&&(h.flags|=8,Qn.delete(e)),d&&(i(l),i(u)),a&&i(c),!h&&(p||d)&&o&16)for(let e=0;e<s.length;e++){let i=s[e];r(i,t,n,m,!!i.dynamicChildren)}},move:sr,hydrate:cr};function sr(e,t,n,{o:{insert:r},m:i},a=2){a===0&&r(e.targetAnchor,t,n);let{el:o,anchor:s,shapeFlag:c,children:l,props:u}=e,d=a===2;if(d&&r(o,t,n),!Qn.has(e)&&(!d||tr(u))&&c&16)for(let e=0;e<l.length;e++)i(l[e],t,n,2);d&&r(s,t,n)}function cr(e,t,n,r,i,a,{o:{nextSibling:o,parentNode:s,querySelector:c,insert:l,createText:u}},d){function f(e,n){let r=n;for(;r;){if(r&&r.nodeType===8){if(r.data===`teleport start anchor`)t.targetStart=r;else if(r.data===`teleport anchor`){t.targetAnchor=r,e._lpa=t.targetAnchor&&o(t.targetAnchor);break}}r=o(r)}}function p(e,t){t.anchor=d(o(e),t,s(e),n,r,i,a)}let m=t.target=ar(t.props,c),h=tr(t.props);if(m){let c=m._lpa||m.firstChild;t.shapeFlag&16&&(h?(p(e,t),f(m,c),t.targetAnchor||dr(m,t,u,l,s(e)===m?e:null)):(t.anchor=o(e),f(m,c),t.targetAnchor||dr(m,t,u,l),d(c&&o(c),t,m,n,r,i,a))),ur(t,h)}else h&&t.shapeFlag&16&&(p(e,t),t.targetStart=e,t.targetAnchor=o(e));return t.anchor&&o(t.anchor)}var lr=or;function ur(e,t){let n=e.ctx;if(n&&n.ut){let r,i;for(t?(r=e.el,i=e.anchor):(r=e.targetStart,i=e.targetAnchor);r&&r!==i;)r.nodeType===1&&r.setAttribute(`data-v-owner`,n.uid),r=r.nextSibling;n.ut()}}function dr(e,t,n,r,i=null){let a=t.targetStart=n(``),o=t.targetAnchor=n(``);return a[$n]=o,e&&(r(a,e,i),r(o,e,i)),o}var fr=Symbol(`_leaveCb`);function pr(e){let t=e[0];if(e.length>1){for(let n of e)if(n.type!==ca){t=n;break}}return t}function mr(e){if(!Cr(e))return er(e.type)&&e.children?pr(e.children):e;if(e.component)return e.component.subTree;let{shapeFlag:t,children:n}=e;if(n){if(t&16)return n[0];if(t&32&&w(n.default))return n.default()}}function hr(e,t){if(e.shapeFlag&6&&e.component){e.transition=t;let n=e.component.subTree;hr(er(n.type)&&mr(n)||n,t)}else e.shapeFlag&128?(e.ssContent.transition=t.clone(e.ssContent),e.ssFallback.transition=t.clone(e.ssFallback)):e.transition=t}function gr(e,t){return w(e)?g({name:e.name},t,{setup:e}):e}function _r(e){e.ids=[e.ids[0]+e.ids[2]+++`-`,0,0]}function vr(e,t){let n;return!!((n=Object.getOwnPropertyDescriptor(e,t))&&!n.configurable)}var yr=new WeakMap;function br(e,t,n,r,i=!1){if(b(e)){e.forEach((e,a)=>br(e,t&&(b(t)?t[a]:t),n,r,i));return}if(Sr(r)&&!i){r.shapeFlag&512&&r.type.__asyncResolved&&r.component.subTree.component&&br(e,t,n,r.component.subTree);return}let a=r.shapeFlag&4?qa(r.component):r.el,o=i?null:a,{i:s,r:c}=e,l=t&&t.r,d=s.refs===u?s.refs={}:s.refs,f=s.setupState,m=Jt(f),h=f===u?p:e=>!vr(d,e)&&y(m,e),g=(e,t)=>!(t&&vr(d,t));if(l!=null&&l!==c){if(xr(t),T(l))d[l]=null,h(l)&&(f[l]=null);else if(Qt(l)){let e=t;g(l,e.k)&&(l.value=null),e.k&&(d[e.k]=null)}}if(w(c))_n(c,s,12,[o,d]);else{let t=T(c),r=Qt(c);if(t||r){let s=()=>{if(e.f){let n=t?h(c)?f[c]:d[c]:g(c)||!e.k?c.value:d[e.k];if(i)b(n)&&_(n,a);else if(b(n))n.includes(a)||n.push(a);else if(t)d[c]=[a],h(c)&&(f[c]=d[c]);else{let t=[a];g(c,e.k)&&(c.value=t),e.k&&(d[e.k]=t)}}else t?(d[c]=o,h(c)&&(f[c]=o)):r&&(g(c,e.k)&&(c.value=o),e.k&&(d[e.k]=o))};if(o){let t=()=>{s(),yr.delete(e)};t.id=-1,yr.set(e,t),Ji(t,n)}else xr(e),s()}}}function xr(e){let t=yr.get(e);t&&(t.flags|=8,yr.delete(e))}ce().requestIdleCallback,ce().cancelIdleCallback;var Sr=e=>!!e.type.__asyncLoader,Cr=e=>e.type.__isKeepAlive;function wr(e,t){Er(e,`a`,t)}function Tr(e,t){Er(e,`da`,t)}function Er(e,t,n=Na){let r=e.__wdc||=()=>{let t=n;for(;t;){if(t.isDeactivated)return;t=t.parent}return e()};if(Or(t,r,n),n){let e=n.parent;for(;e&&e.parent;)Cr(e.parent.vnode)&&Dr(r,t,n,e),e=e.parent}}function Dr(e,t,n,r){let i=Or(t,e,r,!0);Fr(()=>{_(r[t],i)},n)}function Or(e,t,n=Na,r=!1){if(n){let i=n[e]||(n[e]=[]),a=t.__weh||=(...r)=>{qe();let i=La(n),a=vn(t,n,e,r);return i(),Je(),a};return r?i.unshift(a):i.push(a),a}}var kr=e=>(t,n=Na)=>{(!Ba||e===`sp`)&&Or(e,(...e)=>t(...e),n)},Ar=kr(`bm`),jr=kr(`m`),Mr=kr(`bu`),Nr=kr(`u`),Pr=kr(`bum`),Fr=kr(`um`),Ir=kr(`sp`),Lr=kr(`rtg`),Rr=kr(`rtc`);function zr(e,t=Na){Or(`ec`,e,t)}var Br=`components`,Vr=Symbol.for(`v-ndc`);function Hr(e){return T(e)?Ur(Br,e,!1)||e:e||Vr}function Ur(e,t,n=!0,r=!1){let i=Ln||Na;if(i){let n=i.type;if(e===Br){let e=Ja(n,!1);if(e&&(e===t||e===L(t)||e===te(L(t))))return n}let a=Wr(i[e]||n[e],t)||Wr(i.appContext[e],t);return!a&&r?n:a}}function Wr(e,t){return e&&(e[t]||e[L(t)]||e[te(L(t))])}function G(e,t,n,r){let i,a=n&&n[r],o=b(e);if(o||T(e)){let n=o&&Wt(e),r=!1,s=!1;n&&(r=!Kt(e),s=Gt(e),e=ct(e)),i=Array(e.length);for(let n=0,o=e.length;n<o;n++)i[n]=t(r?s?Zt(Xt(e[n])):Xt(e[n]):e[n],n,void 0,a&&a[n])}else if(typeof e==`number`){i=Array(e);for(let n=0;n<e;n++)i[n]=t(n+1,n,void 0,a&&a[n])}else if(D(e)){if(e[Symbol.iterator])i=Array.from(e,(e,n)=>t(e,n,void 0,a&&a[n]));else{let n=Object.keys(e);i=Array(n.length);for(let r=0,o=n.length;r<o;r++){let o=n[r];i[r]=t(e[o],o,r,a&&a[r])}}}else i=[];return n&&(n[r]=i),i}function Gr(e,t,n,r,i,a){if(n??={},Ln.ce||Ln.parent&&Sr(Ln.parent)&&Ln.parent.ce){let e=a!=null&&n.key==null?g({},n,{key:a}):n,i=Object.keys(e).length>0;return t!=="default"&&(e.name=t),q(),ga(K,null,[X(`slot`,e,r&&r())],i?-2:64)}let o=e[t];o&&o._c&&(o._d=!1);let s=ua.length;q();let c;try{let i=o&&Kr(o(n)),s=n.key||a||i&&i.key;c=ga(K,{key:(s&&!E(s)?s:`_${t}`)+(!i&&r?`_fb`:``)},i||(r?r():[]),i&&e._===1?64:-2)}catch(e){for(let e=ua.length;e>s;e--)fa();throw e}finally{o&&o._c&&(o._d=!0)}return!i&&c.scopeId&&(c.slotScopeIds=[c.scopeId+`-s`]),c}function Kr(e){return e.some(e=>!_a(e)||!(e.type===ca||e.type===K&&!Kr(e.children)))?e:null}function qr(e,t){let n={};for(let r in e)n[t&&/[A-Z]/.test(r)?`on:${r}`:ne(r)]=e[r];return n}var Jr=e=>e?za(e)?qa(e):Jr(e.parent):null,Yr=g(Object.create(null),{$:e=>e,$el:e=>e.vnode.el,$data:e=>e.data,$props:e=>e.props,$attrs:e=>e.attrs,$slots:e=>e.slots,$refs:e=>e.refs,$parent:e=>Jr(e.parent),$root:e=>Jr(e.root),$host:e=>e.ce,$emit:e=>e.emit,$options:e=>ii(e),$forceUpdate:e=>e.f||=()=>{An(e.update)},$nextTick:e=>e.n||=On.bind(e.proxy),$watch:e=>Xn.bind(e)}),Xr=(e,t)=>e!==u&&!e.__isScriptSetup&&y(e,t),Zr={get({_:e},t){if(t===`__v_skip`)return!0;let{ctx:n,setupState:r,data:i,props:a,accessCache:o,type:s,appContext:c}=e;if(t[0]!==`$`){let e=o[t];if(e!==void 0)switch(e){case 1:return r[t];case 2:return i[t];case 4:return n[t];case 3:return a[t]}else if(Xr(r,t))return o[t]=1,r[t];else if(i!==u&&y(i,t))return o[t]=2,i[t];else if(y(a,t))return o[t]=3,a[t];else if(n!==u&&y(n,t))return o[t]=4,n[t];else $r&&(o[t]=0)}let l=Yr[t],d,f;if(l)return t===`$attrs`&&it(e.attrs,`get`,``),l(e);if((d=s.__cssModules)&&(d=d[t]))return d;if(n!==u&&y(n,t))return o[t]=4,n[t];if(f=c.config.globalProperties,y(f,t))return f[t]},set({_:e},t,n){let{data:r,setupState:i,ctx:a}=e;return Xr(i,t)?(i[t]=n,!0):r!==u&&y(r,t)?(r[t]=n,!0):y(e.props,t)||t[0]===`$`&&t.slice(1)in e?!1:(a[t]=n,!0)},has({_:{data:e,setupState:t,accessCache:n,ctx:r,appContext:i,props:a,type:o}},s){let c;return!!(n[s]||e!==u&&s[0]!==`$`&&y(e,s)||Xr(t,s)||y(a,s)||y(r,s)||y(Yr,s)||y(i.config.globalProperties,s)||(c=o.__cssModules)&&c[s])},defineProperty(e,t,n){return n.get==null?y(n,`value`)&&this.set(e,t,n.value,null):e._.accessCache[t]=0,Reflect.defineProperty(e,t,n)}};function Qr(e){return b(e)?e.reduce((e,t)=>(e[t]=null,e),{}):e}var $r=!0;function ei(e){let t=ii(e),n=e.proxy,r=e.ctx;$r=!1,t.beforeCreate&&ni(t.beforeCreate,e,`bc`);let{data:i,computed:a,methods:o,watch:s,provide:c,inject:l,created:u,beforeMount:d,mounted:p,beforeUpdate:m,updated:h,activated:g,deactivated:_,beforeDestroy:v,beforeUnmount:y,destroyed:x,unmounted:S,render:C,renderTracked:T,renderTriggered:E,errorCaptured:O,serverPrefetch:k,expose:A,inheritAttrs:j,components:M,directives:N,filters:P}=t;if(l&&ti(l,r,null),o)for(let e in o){let t=o[e];w(t)&&(r[e]=t.bind(n))}if(i){let t=i.call(n,n);D(t)&&(e.data=Bt(t))}if($r=!0,a)for(let e in a){let t=a[e],i=$({get:w(t)?t.bind(n,n):w(t.get)?t.get.bind(n,n):f,set:!w(t)&&w(t.set)?t.set.bind(n):f});Object.defineProperty(r,e,{enumerable:!0,configurable:!0,get:()=>i.value,set:e=>i.value=e})}if(s)for(let e in s)ri(s[e],r,n,e);if(c){let e=w(c)?c.call(n):c;Reflect.ownKeys(e).forEach(t=>{Un(t,e[t])})}u&&ni(u,e,`c`);function F(e,t){b(t)?t.forEach(t=>e(t.bind(n))):t&&e(t.bind(n))}if(F(Ar,d),F(jr,p),F(Mr,m),F(Nr,h),F(wr,g),F(Tr,_),F(zr,O),F(Rr,T),F(Lr,E),F(Pr,y),F(Fr,S),F(Ir,k),b(A)){if(A.length){let t=e.exposed||={};A.forEach(e=>{Object.defineProperty(t,e,{get:()=>n[e],set:t=>n[e]=t,enumerable:!0})})}else e.exposed||={}}C&&e.render===f&&(e.render=C),j!=null&&(e.inheritAttrs=j),M&&(e.components=M),N&&(e.directives=N),k&&_r(e)}function ti(e,t,n=f){b(e)&&(e=li(e));for(let n in e){let r=e[n],i;i=D(r)?`default`in r?Wn(r.from||n,r.default,!0):Wn(r.from||n):Wn(r),Qt(i)?Object.defineProperty(t,n,{enumerable:!0,configurable:!0,get:()=>i.value,set:e=>i.value=e}):t[n]=i}}function ni(e,t,n){vn(b(e)?e.map(e=>e.bind(t.proxy)):e.bind(t.proxy),t,n)}function ri(e,t,n,r){let i=r.includes(`.`)?Zn(n,r):()=>n[r];if(T(e)){let n=t[e];w(n)&&W(i,n)}else if(w(e))W(i,e.bind(n));else if(D(e)){if(b(e))e.forEach(e=>ri(e,t,n,r));else{let r=w(e.handler)?e.handler.bind(n):t[e.handler];w(r)&&W(i,r,e)}}}function ii(e){let t=e.type,{mixins:n,extends:r}=t,{mixins:i,optionsCache:a,config:{optionMergeStrategies:o}}=e.appContext,s=a.get(t),c;return s?c=s:!i.length&&!n&&!r?c=t:(c={},i.length&&i.forEach(e=>ai(c,e,o,!0)),ai(c,t,o)),D(t)&&a.set(t,c),c}function ai(e,t,n,r=!1){let{mixins:i,extends:a}=t;a&&ai(e,a,n,!0),i&&i.forEach(t=>ai(e,t,n,!0));for(let i in t)if(!(r&&i===`expose`)){let r=oi[i]||n&&n[i];e[i]=r?r(e[i],t[i]):t[i]}return e}var oi={data:si,props:fi,emits:fi,methods:di,computed:di,beforeCreate:ui,created:ui,beforeMount:ui,mounted:ui,beforeUpdate:ui,updated:ui,beforeDestroy:ui,beforeUnmount:ui,destroyed:ui,unmounted:ui,activated:ui,deactivated:ui,errorCaptured:ui,serverPrefetch:ui,components:di,directives:di,watch:pi,provide:si,inject:ci};function si(e,t){return t?e?function(){return g(w(e)?e.call(this,this):e,w(t)?t.call(this,this):t)}:t:e}function ci(e,t){return di(li(e),li(t))}function li(e){if(b(e)){let t={};for(let n=0;n<e.length;n++)t[e[n]]=e[n];return t}return e}function ui(e,t){return e?[...new Set([].concat(e,t))]:t}function di(e,t){return e?g(Object.create(null),e,t):t}function fi(e,t){return e?b(e)&&b(t)?[...new Set([...e,...t])]:g(Object.create(null),Qr(e),Qr(t??{})):t}function pi(e,t){if(!e)return t;if(!t)return e;let n=g(Object.create(null),e);for(let r in t)n[r]=ui(e[r],t[r]);return n}function mi(){return{app:null,config:{isNativeTag:p,performance:!1,globalProperties:{},optionMergeStrategies:{},errorHandler:void 0,warnHandler:void 0,compilerOptions:{}},mixins:[],components:{},directives:{},provides:Object.create(null),optionsCache:new WeakMap,propsCache:new WeakMap,emitsCache:new WeakMap}}var hi=0;function gi(e,t){return function(n,r=null){w(n)||(n=g({},n)),r!=null&&!D(r)&&(r=null);let i=mi(),a=new WeakSet,o=[],s=!1,c=i.app={_uid:hi++,_component:n,_props:r,_container:null,_context:i,_instance:null,version:Xa,get config(){return i.config},set config(e){},use(e,...t){return a.has(e)||(e&&w(e.install)?(a.add(e),e.install(c,...t)):w(e)&&(a.add(e),e(c,...t))),c},mixin(e){return i.mixins.includes(e)||i.mixins.push(e),c},component(e,t){return t?(i.components[e]=t,c):i.components[e]},directive(e,t){return t?(i.directives[e]=t,c):i.directives[e]},mount(a,o,l){if(!s){let u=c._ceVNode||X(n,r);return u.appContext=i,l===!0?l=`svg`:l===!1&&(l=void 0),o&&t?t(u,a):e(u,a,l),s=!0,c._container=a,a.__vue_app__=c,qa(u.component)}},onUnmount(e){o.push(e)},unmount(){s&&(vn(o,c._instance,16),e(null,c._container),delete c._container.__vue_app__)},provide(e,t){return i.provides[e]=t,c},runWithContext(e){let t=_i;_i=c;try{return e()}finally{_i=t}}};return c}}var _i=null,vi=(e,t)=>t===`modelValue`||t===`model-value`?e.modelModifiers:e[`${t}Modifiers`]||e[`${L(t)}Modifiers`]||e[`${R(t)}Modifiers`];function yi(e,t,...n){if(e.isUnmounted)return;let r=e.vnode.props||u,i=n,a=t.startsWith(`update:`),o=a&&vi(r,t.slice(7));o&&(o.trim&&(i=n.map(e=>T(e)?e.trim():e)),o.number&&(i=i.map(oe)));let s,c=r[s=ne(t)]||r[s=ne(L(t))];!c&&a&&(c=r[s=ne(R(t))]),c&&vn(c,e,6,i);let l=r[s+`Once`];if(l){if(!e.emitted)e.emitted={};else if(e.emitted[s])return;e.emitted[s]=!0,vn(l,e,6,i)}}var bi=new WeakMap;function xi(e,t,n=!1){let r=n?bi:t.emitsCache,i=r.get(e);if(i!==void 0)return i;let a=e.emits,o={},s=!1;if(!w(e)){let r=e=>{let n=xi(e,t,!0);n&&(s=!0,g(o,n))};!n&&t.mixins.length&&t.mixins.forEach(r),e.extends&&r(e.extends),e.mixins&&e.mixins.forEach(r)}return!a&&!s?(D(e)&&r.set(e,null),null):(b(a)?a.forEach(e=>o[e]=null):g(o,a),D(e)&&r.set(e,o),o)}function Si(e,t){return!e||!m(t)?!1:(t=t.slice(2),t=t===`Once`?t:t.replace(/Once$/,``),y(e,t[0].toLowerCase()+t.slice(1))||y(e,R(t))||y(e,t))}function Ci(e){let{type:t,vnode:n,proxy:r,withProxy:i,propsOptions:[a],slots:o,attrs:s,emit:c,render:l,renderCache:u,props:d,data:f,setupState:p,ctx:m,inheritAttrs:g}=e,_=zn(e),v,y;try{if(n.shapeFlag&4){let e=i||r,t=e;v=Ta(l.call(t,e,u,d,p,f,m)),y=s}else{let e=t;v=Ta(e.length>1?e(d,{attrs:s,slots:o,emit:c}):e(d,null)),y=t.props?s:wi(s)}}catch(t){ua.length=0,yn(t,e,1),v=X(ca)}let b=v;if(y&&g!==!1){let e=Object.keys(y),{shapeFlag:t}=b;e.length&&t&7&&(a&&e.some(h)&&(y=Ti(y,a)),b=Ca(b,y,!1,!0))}return n.dirs&&(b=Ca(b,null,!1,!0),b.dirs=b.dirs?b.dirs.concat(n.dirs):n.dirs),n.transition&&hr(er(b.type)&&mr(b)||b,n.transition),v=b,zn(_),v}var wi=e=>{let t;for(let n in e)(n===`class`||n===`style`||m(n))&&((t||={})[n]=e[n]);return t},Ti=(e,t)=>{let n={};for(let r in e)(!h(r)||!(r.slice(9)in t))&&(n[r]=e[r]);return n};function Ei(e,t,n){let{props:r,children:i,component:a}=e,{props:o,children:s,patchFlag:c}=t,l=a.emitsOptions;if(t.dirs||t.transition)return!0;if(n&&c>=0){if(c&1024)return!0;if(c&16)return r?Di(r,o,l):!!o;if(c&8){let e=t.dynamicProps;for(let t=0;t<e.length;t++){let n=e[t];if(Oi(o,r,n)&&!Si(l,n))return!0}}}else return(i||s)&&(!s||!s.$stable)?!0:r===o?!1:r?!o||Di(r,o,l):!!o;return!1}function Di(e,t,n){let r=Object.keys(t);if(r.length!==Object.keys(e).length)return!0;for(let i=0;i<r.length;i++){let a=r[i];if(Oi(t,e,a)&&!Si(n,a))return!0}return!1}function Oi(e,t,n){let r=e[n],i=t[n];return n===`style`&&D(r)&&D(i)?!xe(r,i):r!==i}function ki({vnode:e,parent:t,suspense:n},r){for(;t;){let n=t.subTree;if(n.suspense&&n.suspense.activeBranch===e&&(n.suspense.vnode.el=n.el=r,e=n),n===e)(e=t.vnode).el=r,t=t.parent;else break}n&&n.activeBranch===e&&(n.vnode.el=r)}var Ai={},ji=()=>Object.create(Ai),Mi=e=>Object.getPrototypeOf(e)===Ai;function Ni(e,t,n,r=!1){let i={},a=ji();e.propsDefaults=Object.create(null),Fi(e,t,i,a);for(let t in e.propsOptions[0])t in i||(i[t]=void 0);e.props=n?r?i:Vt(i):e.type.props?i:a,e.attrs=a}function Pi(e,t,n,r){let{props:i,attrs:a,vnode:{patchFlag:o}}=e,s=Jt(i),[c]=e.propsOptions,l=!1;if((r||o>0)&&!(o&16)){if(o&8){let n=e.vnode.dynamicProps;for(let r=0;r<n.length;r++){let o=n[r];if(Si(e.emitsOptions,o))continue;let u=t[o];if(c){if(y(a,o))u!==a[o]&&(a[o]=u,l=!0);else{let t=L(o);i[t]=Ii(c,s,t,u,e,!1)}}else u!==a[o]&&(a[o]=u,l=!0)}}}else{Fi(e,t,i,a)&&(l=!0);let r;for(let a in s)(!t||!y(t,a)&&((r=R(a))===a||!y(t,r)))&&(c?n&&(n[a]!==void 0||n[r]!==void 0)&&(i[a]=Ii(c,s,a,void 0,e,!0)):delete i[a]);if(a!==s)for(let e in a)(!t||!y(t,e))&&(delete a[e],l=!0)}l&&at(e.attrs,`set`,``)}function Fi(e,t,n,r){let[i,a]=e.propsOptions,o=!1,s;if(t)for(let c in t){if(P(c))continue;let l=t[c],u;i&&y(i,u=L(c))?!a||!a.includes(u)?n[u]=l:(s||={})[u]=l:Si(e.emitsOptions,c)||(!(c in r)||l!==r[c])&&(r[c]=l,o=!0)}if(a){let t=Jt(n),r=s||u;for(let o=0;o<a.length;o++){let s=a[o];n[s]=Ii(i,t,s,r[s],e,!y(r,s))}}return o}function Ii(e,t,n,r,i,a){let o=e[n];if(o!=null){let e=y(o,`default`);if(e&&r===void 0){let e=o.default;if(o.type!==Function&&!o.skipFactory&&w(e)){let{propsDefaults:a}=i;if(n in a)r=a[n];else{let o=La(i);r=a[n]=e.call(null,t),o()}}else r=e;i.ce&&i.ce._setProp(n,r)}o[0]&&(a&&!e?r=!1:o[1]&&(r===``||r===R(n))&&(r=!0))}return r}var Li=new WeakMap;function Ri(e,t,n=!1){let r=n?Li:t.propsCache,i=r.get(e);if(i)return i;let a=e.props,o={},s=[],c=!1;if(!w(e)){let r=e=>{c=!0;let[n,r]=Ri(e,t,!0);g(o,n),r&&s.push(...r)};!n&&t.mixins.length&&t.mixins.forEach(r),e.extends&&r(e.extends),e.mixins&&e.mixins.forEach(r)}if(!a&&!c)return D(e)&&r.set(e,d),d;if(b(a))for(let e=0;e<a.length;e++){let t=L(a[e]);zi(t)&&(o[t]=u)}else if(a)for(let e in a){let t=L(e);if(zi(t)){let n=a[e],r=o[t]=b(n)||w(n)?{type:n}:g({},n),i=r.type,c=!1,l=!0;if(b(i))for(let e=0;e<i.length;++e){let t=i[e],n=w(t)&&t.name;if(n===`Boolean`){c=!0;break}n===`String`&&(l=!1)}else c=w(i)&&i.name===`Boolean`;r[0]=c,r[1]=l,(c||y(r,`default`))&&s.push(t)}}let l=[o,s];return D(e)&&r.set(e,l),l}function zi(e){return e[0]!==`$`&&!P(e)}var Bi=e=>e===`_`||e===`_ctx`||e===`$stable`,Vi=e=>b(e)?e.map(Ta):[Ta(e)],Hi=(e,t,n)=>{if(t._n)return t;let r=Bn((...e)=>Vi(t(...e)),n);return r._c=!1,r},Ui=(e,t,n)=>{let r=e._ctx;for(let n in e){if(Bi(n))continue;let i=e[n];if(w(i))t[n]=Hi(n,i,r);else if(i!=null){let e=Vi(i);t[n]=()=>e}}},Wi=(e,t)=>{let n=Vi(t);e.slots.default=()=>n},Gi=(e,t,n)=>{for(let r in t)(n||!Bi(r))&&(e[r]=t[r])},Ki=(e,t,n)=>{let r=e.slots=ji();if(e.vnode.shapeFlag&32){let e=t._;e?(Gi(r,t,n),n&&ae(r,`_`,e,!0)):Ui(t,r)}else t&&Wi(e,t)},qi=(e,t,n)=>{let{vnode:r,slots:i}=e,a=!0,o=u;if(r.shapeFlag&32){let e=t._;e?n&&e===1?a=!1:Gi(i,t,n):(a=!t.$stable,Ui(t,i)),o=t}else t&&(Wi(e,t),o={default:1});if(a)for(let e in i)!Bi(e)&&o[e]==null&&delete i[e]},Ji=oa;function Yi(e){return Xi(e)}function Xi(e,t){let n=ce();n.__VUE__=!0;let{insert:r,remove:i,patchProp:a,createElement:o,createText:s,createComment:c,setText:l,setElementText:p,parentNode:m,nextSibling:h,setScopeId:g=f,insertStaticContent:_}=e,v=(e,t,n,r=null,i=null,a=null,o=void 0,s=null,c=!!t.dynamicChildren)=>{if(e===t)return;e&&!va(e,t)&&(r=ue(e),re(e,i,a,!0),e=null),t.patchFlag===-2&&(c=!1,t.dynamicChildren=null),t.dynamicChildren&&e&&e.dynamicChildren&&e.dynamicChildren.hasOnce&&(t.dynamicChildren===d&&(t.dynamicChildren=[]),t.dynamicChildren.hasOnce=!0);let{type:l,ref:u,shapeFlag:f}=t;switch(l){case sa:y(e,t,n,r);break;case ca:b(e,t,n,r);break;case la:e??x(t,n,r,o);break;case K:j(e,t,n,r,i,a,o,s,c);break;default:f&1?w(e,t,n,r,i,a,o,s,c):f&6?M(e,t,n,r,i,a,o,s,c):(f&64||f&128)&&l.process(e,t,n,r,i,a,o,s,c,pe)}u!=null&&i?br(u,e&&e.ref,a,t||e,!t):u==null&&e&&e.ref!=null&&br(e.ref,null,a,e,!0)},y=(e,t,n,i)=>{if(e==null)r(t.el=s(t.children),n,i);else{let n=t.el=e.el;t.children!==e.children&&l(n,t.children)}},b=(e,t,n,i)=>{e==null?r(t.el=c(t.children||``),n,i):t.el=e.el},x=(e,t,n,r)=>{[e.el,e.anchor]=_(e.children,t,n,r,e.el,e.anchor)},S=({el:e,anchor:t},n,i)=>{let a;for(;e&&e!==t;)a=h(e),r(e,n,i),e=a;r(t,n,i)},C=({el:e,anchor:t})=>{let n;for(;e&&e!==t;)n=h(e),i(e),e=n;i(t)},w=(e,t,n,r,i,a,o,s,c)=>{if(t.type===`svg`?o=`svg`:t.type===`math`&&(o=`mathml`),e==null)T(t,n,r,i,a,o,s,c);else{let n=e.el&&e.el._isVueCE?e.el:null;try{n&&n._beginPatch(),O(e,t,i,a,o,s,c)}finally{n&&n._endPatch()}}},T=(e,t,n,i,s,c,l,u)=>{let d,f,{props:m,shapeFlag:h,transition:g,dirs:_}=e;if(d=e.el=o(e.type,c,m&&m.is,m),h&8?p(d,e.children):h&16&&D(e.children,d,null,i,s,Zi(e,c),l,u),_&&Hn(e,null,i,`created`),E(d,e,e.scopeId,l,i),m){for(let e in m)e!==`value`&&!P(e)&&a(d,e,null,m[e],c,i);`value`in m&&a(d,`value`,null,m.value,c),(f=m.onVnodeBeforeMount)&&ka(f,i,e)}_&&Hn(e,null,i,`beforeMount`);let v=$i(s,g);v&&g.beforeEnter(d),r(d,t,n),((f=m&&m.onVnodeMounted)||v||_)&&Ji(()=>{try{f&&ka(f,i,e),v&&g.enter(d),_&&Hn(e,null,i,`mounted`)}finally{}},s)},E=(e,t,n,r,i)=>{if(n&&g(e,n),r)for(let t=0;t<r.length;t++)g(e,r[t]);if(i){let n=i.subTree;if(t===n||aa(n.type)&&(n.ssContent===t||n.ssFallback===t)){let t=i.vnode;E(e,t,t.scopeId,t.slotScopeIds,i.parent)}}},D=(e,t,n,r,i,a,o,s,c=0)=>{for(let l=c;l<e.length;l++){let c=e[l]=s?Ea(e[l]):Ta(e[l]);v(null,c,t,n,r,i,a,o,s)}},O=(e,t,n,r,i,o,s)=>{let c=t.el=e.el,{patchFlag:l,dynamicChildren:d,dirs:f}=t;l|=e.patchFlag&16;let m=e.props||u,h=t.props||u,g;if(n&&Qi(n,!1),(g=h.onVnodeBeforeUpdate)&&ka(g,n,t,e),f&&Hn(t,e,n,`beforeUpdate`),n&&Qi(n,!0),d&&(!e.dynamicChildren||e.dynamicChildren.length!==d.length)&&(l=0,s=!1,d=null),(m.innerHTML&&h.innerHTML==null||m.textContent&&h.textContent==null)&&p(c,``),d?k(e.dynamicChildren,d,c,n,r,Zi(t,i),o):s||ee(e,t,c,null,n,r,Zi(t,i),o,!1),l>0){if(l&16)A(c,m,h,n,i);else if(l&2&&m.class!==h.class&&a(c,`class`,null,h.class,i),l&4&&a(c,`style`,m.style,h.style,i),l&8){let e=t.dynamicProps;for(let t=0;t<e.length;t++){let r=e[t],o=m[r],s=h[r];(s!==o||r===`value`)&&a(c,r,o,s,i,n)}}l&1&&e.children!==t.children&&p(c,t.children)}else!s&&d==null&&A(c,m,h,n,i);((g=h.onVnodeUpdated)||f)&&Ji(()=>{g&&ka(g,n,t,e),f&&Hn(t,e,n,`updated`)},r)},k=(e,t,n,r,i,a,o)=>{for(let s=0;s<t.length;s++){let c=e[s],l=t[s],u=c.el&&(c.type===K||!va(c,l)||c.shapeFlag&198)?m(c.el):n;v(c,l,u,null,r,i,a,o,!0)}},A=(e,t,n,r,i)=>{if(t!==n){if(t!==u)for(let o in t)!P(o)&&!(o in n)&&a(e,o,t[o],null,i,r);for(let o in n){if(P(o))continue;let s=n[o],c=t[o];s!==c&&o!==`value`&&a(e,o,c,s,i,r)}`value`in n&&a(e,`value`,t.value,n.value,i)}},j=(e,t,n,i,a,o,c,l,u)=>{let d=t.el=e?e.el:s(``),f=t.anchor=e?e.anchor:s(``),{patchFlag:p,dynamicChildren:m,slotScopeIds:h}=t;h&&(l=l?l.concat(h):h),e==null?(r(d,n,i),r(f,n,i),D(t.children||[],n,f,a,o,c,l,u)):p>0&&p&64&&m&&e.dynamicChildren&&e.dynamicChildren.length===m.length?(k(e.dynamicChildren,m,n,a,o,c,l),(t.key!=null||a&&t===a.subTree)&&ea(e,t,!0)):ee(e,t,n,f,a,o,c,l,u)},M=(e,t,n,r,i,a,o,s,c)=>{t.slotScopeIds=s,e==null?t.shapeFlag&512?i.ctx.activate(t,n,r,o,c):N(t,n,r,i,a,o,c):F(e,t,c)},N=(e,t,n,r,i,a,o)=>{let s=e.component=Ma(e,r,i);if(Cr(e)&&(s.ctx.renderer=pe),Va(s,!1,o),s.asyncDep){if(i&&i.registerDep(s,I,o),!e.el){let r=s.subTree=X(ca);b(null,r,t,n),e.placeholder=r.el}}else I(s,e,t,n,i,a,o)},F=(e,t,n)=>{let r=t.component=e.component;if(Ei(e,t,n)){if(r.asyncDep&&!r.asyncResolved){t.el=e.el,L(r,t,n);return}r.next=t,r.update()}else t.el=e.el,r.vnode=t},I=(e,t,n,r,i,a,o)=>{let s=()=>{if(e.isMounted){let{next:t,bu:n,u:r,parent:s,vnode:c}=e;{let n=na(e);if(n){t&&(t.el=c.el,L(e,t,o)),n.asyncDep.then(()=>{Ji(()=>{e.isUnmounted||l()},i)});return}}let u=t,d;Qi(e,!1),t?(t.el=c.el,L(e,t,o)):t=c,n&&ie(n),(d=t.props&&t.props.onVnodeBeforeUpdate)&&ka(d,s,t,c),Qi(e,!0);let f=Ci(e),p=e.subTree;e.subTree=f,v(p,f,m(p.el),ue(p),e,i,a),t.el=f.el,u===null&&ki(e,f.el),r&&Ji(r,i),(d=t.props&&t.props.onVnodeUpdated)&&Ji(()=>ka(d,s,t,c),i)}else{let o,{el:s,props:c}=t,{bm:l,m:u,parent:d,root:f,type:p}=e,m=Sr(t);if(Qi(e,!1),l&&ie(l),!m&&(o=c&&c.onVnodeBeforeMount)&&ka(o,d,t),Qi(e,!0),s&&me){let t=()=>{e.subTree=Ci(e),me(s,e.subTree,e,i,null)};m&&p.__asyncHydrate?p.__asyncHydrate(s,e,t):t()}else{f.ce&&f.ce._hasShadowRoot()&&f.ce._injectChildStyle(p,e.parent?e.parent.type:void 0);let o=e.subTree=Ci(e);v(null,o,n,r,e,i,a),t.el=o.el}if(u&&Ji(u,i),!m&&(o=c&&c.onVnodeMounted)){let e=t;Ji(()=>ka(o,d,e),i)}(t.shapeFlag&256||d&&Sr(d.vnode)&&d.vnode.shapeFlag&256)&&e.a&&Ji(e.a,i),e.isMounted=!0,t=n=r=null}};e.scope.on();let c=e.effect=new Me(s);e.scope.off();let l=e.update=c.run.bind(c),u=e.job=c.runIfDirty.bind(c);u.i=e,u.id=e.uid,c.scheduler=()=>An(u),Qi(e,!0),l()},L=(e,t,n)=>{t.component=e;let r=e.vnode.props;e.vnode=t,e.next=null,Pi(e,t.props,r,n),qi(e,t.children,n),qe(),Nn(e),Je()},ee=(e,t,n,r,i,a,o,s,c=!1)=>{let l=e&&e.children,u=e?e.shapeFlag:0,d=t.children,{patchFlag:f,shapeFlag:m}=t;if(f>0){if(f&128){te(l,d,n,r,i,a,o,s,c);return}if(f&256){R(l,d,n,r,i,a,o,s,c);return}}m&8?(u&16&&le(l,i,a),d!==l&&p(n,d)):u&16?m&16?te(l,d,n,r,i,a,o,s,c):le(l,i,a,!0):(u&8&&p(n,``),m&16&&D(d,n,r,i,a,o,s,c))},R=(e,t,n,r,i,a,o,s,c)=>{e||=d,t||=d;let l=e.length,u=t.length,f=Math.min(l,u),p=0;for(;p<f;p++){let r=t[p]=c?Ea(t[p]):Ta(t[p]);v(e[p],r,n,null,i,a,o,s,c)}l>u?le(e,i,a,!0,!1,f):D(t,n,r,i,a,o,s,c,f)},te=(e,t,n,r,i,a,o,s,c)=>{let l=0,u=t.length,f=e.length-1,p=u-1;for(;l<=f&&l<=p;){let r=e[l],u=t[l]=c?Ea(t[l]):Ta(t[l]);if(va(r,u))v(r,u,n,null,i,a,o,s,c);else break;l++}for(;l<=f&&l<=p;){let r=e[f],l=t[p]=c?Ea(t[p]):Ta(t[p]);if(va(r,l))v(r,l,n,null,i,a,o,s,c);else break;f--,p--}if(l>f){if(l<=p){let e=p+1,d=e<u?t[e].el:r;for(;l<=p;)v(null,t[l]=c?Ea(t[l]):Ta(t[l]),n,d,i,a,o,s,c),l++}}else if(l>p)for(;l<=f;)re(e[l],i,a,!0),l++;else{let m=l,h=l,g=new Map;for(l=h;l<=p;l++){let e=t[l]=c?Ea(t[l]):Ta(t[l]);e.key!=null&&g.set(e.key,l)}let _,y=0,b=p-h+1,x=!1,S=0,C=Array(b);for(l=0;l<b;l++)C[l]=0;for(l=m;l<=f;l++){let r=e[l];if(y>=b){re(r,i,a,!0);continue}let u;if(r.key!=null)u=g.get(r.key);else for(_=h;_<=p;_++)if(C[_-h]===0&&va(r,t[_])){u=_;break}u===void 0?re(r,i,a,!0):(C[u-h]=l+1,u>=S?S=u:x=!0,v(r,t[u],n,null,i,a,o,s,c),y++)}let w=x?ta(C):d;for(_=w.length-1,l=b-1;l>=0;l--){let e=h+l,d=t[e],f=t[e+1],p=e+1<u?f.el||ia(f):r;C[l]===0?v(null,d,n,p,i,a,o,s,c):x&&(_<0||l!==w[_]?ne(d,n,p,2):_--)}}},ne=(e,t,n,a,o=null)=>{let{el:s,type:c,transition:l,children:u,shapeFlag:d}=e;if(d&6)ne(e.component.subTree,t,n,a);else if(d&128)e.suspense.move(t,n,a);else if(d&64)c.move(e,t,n,pe);else if(c===K){r(s,t,n);for(let e=0;e<u.length;e++)ne(u[e],t,n,a);r(e.anchor,t,n)}else if(c===la)S(e,t,n);else if(a!==2&&d&1&&l){if(a===0)l.persisted&&!s[fr]?r(s,t,n):(l.beforeEnter(s),r(s,t,n),Ji(()=>l.enter(s),o));else{let{leave:a,delayLeave:o,afterLeave:c}=l,u=()=>{e.ctx.isUnmounted?i(s):r(s,t,n)},d=()=>{let e=s._isLeaving||!!s[fr];s._isLeaving&&s[fr](!0),l.persisted&&!e?u():a(s,()=>{u(),c&&c()})};o?o(s,u,d):d()}}else r(s,t,n)},re=(e,t,n,r=!1,i=!1)=>{let{type:a,props:o,ref:s,children:c,dynamicChildren:l,shapeFlag:u,patchFlag:d,dirs:f,cacheIndex:p,memo:m}=e;if((d===-2||l&&l.hasOnce)&&(i=!1),s!=null&&(qe(),br(s,null,n,e,!0),Je()),p!=null&&(!e.ctx||e.ctx===t)&&(t.renderCache[p]=void 0),u&256){t.ctx.deactivate(e);return}let h=u&1&&f,g=!Sr(e),_;if(g&&(_=o&&o.onVnodeBeforeUnmount)&&ka(_,t,e),u&6)se(e.component,n,r);else{if(u&128){e.suspense.unmount(n,r);return}h&&Hn(e,null,t,`beforeUnmount`),u&64?e.type.remove(e,t,n,pe,r):l&&!l.hasOnce&&(a!==K||d>0&&d&64)?le(l,t,n,!1,!0):(a===K&&d&384||!i&&u&16)&&le(c,t,n),r&&ae(e)}let v=m!=null&&p==null;(g&&(_=o&&o.onVnodeUnmounted)||h||v)&&Ji(()=>{_&&ka(_,t,e),h&&Hn(e,null,t,`unmounted`),v&&(e.el=null)},n)},ae=e=>{let{type:t,el:n,anchor:r,transition:a}=e;if(t===K){oe(n,r);return}if(t===la){C(e),a&&!a.persisted&&a.afterLeave&&a.afterLeave();return}let o=()=>{i(n),a&&!a.persisted&&a.afterLeave&&a.afterLeave()};if(e.shapeFlag&1&&a&&!a.persisted){let{leave:t,delayLeave:r}=a,i=()=>t(n,o);r?r(e.el,o,i):i()}else o()},oe=(e,t)=>{let n;for(;e!==t;)n=h(e),i(e),e=n;i(t)},se=(e,t,n)=>{let{bum:r,scope:i,job:a,subTree:o,um:s,m:c,a:l}=e;ra(c),ra(l),r&&ie(r),i.stop(),a?(a.flags|=8,re(o,e,t,n)):e.vnode.el&&o&&(o.transition=e.vnode.transition,re(o,e,t,n)),s&&Ji(s,t),Ji(()=>{e.isUnmounted=!0},t)},le=(e,t,n,r=!1,i=!1,a=0)=>{for(let o=a;o<e.length;o++)re(e[o],t,n,r,i)},ue=e=>{if(e.shapeFlag&6)return ue(e.component.subTree);if(e.shapeFlag&128)return e.suspense.next();let t=h(e.anchor||e.el),n=t&&t[$n];return n?h(n):t},de=!1,fe=(e,t,n)=>{let r;e==null?t._vnode&&(re(t._vnode,null,null,!0),r=t._vnode.component):v(t._vnode||null,e,t,null,null,null,n),t._vnode=e,de||=(de=!0,Nn(r),Pn(),!1)},pe={p:v,um:re,m:ne,r:ae,mt:N,mc:D,pc:ee,pbc:k,n:ue,o:e},z,me;return t&&([z,me]=t(pe)),{render:fe,hydrate:z,createApp:gi(fe,z)}}function Zi({type:e,props:t},n){return n===`svg`&&e===`foreignObject`||n===`mathml`&&e===`annotation-xml`&&t&&t.encoding&&t.encoding.includes(`html`)?void 0:n}function Qi({effect:e,job:t},n){n?(e.flags|=32,t.flags|=4):(e.flags&=-33,t.flags&=-5)}function $i(e,t){return(!e||e&&!e.pendingBranch)&&t&&!t.persisted}function ea(e,t,n=!1){let r=e.children,i=t.children;if(b(r)&&b(i))for(let e=0;e<r.length;e++){let t=r[e],a=i[e];a.shapeFlag&1&&!a.dynamicChildren&&((a.patchFlag<=0||a.patchFlag===32)&&(a=i[e]=Ea(i[e]),a.el=t.el),!n&&a.patchFlag!==-2&&ea(t,a)),a.type===sa&&(a.patchFlag===-1&&(a=i[e]=Ea(a)),a.el=t.el),a.type===ca&&!a.el&&(a.el=t.el)}}function ta(e){let t=e.slice(),n=[0],r,i,a,o,s,c=e.length;for(r=0;r<c;r++){let c=e[r];if(c!==0){if(i=n[n.length-1],e[i]<c){t[r]=i,n.push(r);continue}for(a=0,o=n.length-1;a<o;)s=a+o>>1,e[n[s]]<c?a=s+1:o=s;c<e[n[a]]&&(a>0&&(t[r]=n[a-1]),n[a]=r)}}for(a=n.length,o=n[a-1];a-->0;)n[a]=o,o=t[o];return n}function na(e){let t=e.subTree.component;if(t)return t.asyncDep&&!t.asyncResolved?t:na(t)}function ra(e){if(e)for(let t=0;t<e.length;t++)e[t].flags|=8}function ia(e){if(e.placeholder)return e.placeholder;let t=e.component;return t?ia(t.subTree):null}var aa=e=>e.__isSuspense;function oa(e,t){t&&t.pendingBranch?b(e)?t.effects.push(...e):t.effects.push(e):Mn(e)}var K=Symbol.for(`v-fgt`),sa=Symbol.for(`v-txt`),ca=Symbol.for(`v-cmt`),la=Symbol.for(`v-stc`),ua=[],da=null;function q(e=!1){ua.push(da=e?null:[])}function fa(){ua.pop(),da=ua[ua.length-1]||null}var pa=1;function ma(e,t=!1){pa+=e,e<0&&da&&t&&(da.hasOnce=!0)}function ha(e){return e.dynamicChildren=pa>0?da||d:null,fa(),pa>0&&da&&da.push(e),e}function J(e,t,n,r,i,a){return ha(Y(e,t,n,r,i,a,!0))}function ga(e,t,n,r,i){return ha(X(e,t,n,r,i,!0))}function _a(e){return e?e.__v_isVNode===!0:!1}function va(e,t){return e.type===t.type&&e.key===t.key}var ya=({key:e})=>e??null,ba=({ref:e,ref_key:t,ref_for:n})=>(typeof e==`number`&&(e=``+e),e==null?null:T(e)||Qt(e)||w(e)?{i:Ln,r:e,k:t,f:!!n}:e);function Y(e,t=null,n=null,r=0,i=null,a=e===K?0:1,o=!1,s=!1){let c={__v_isVNode:!0,__v_skip:!0,type:e,props:t,key:t&&ya(t),ref:t&&ba(t),scopeId:Rn,slotScopeIds:null,children:n,component:null,suspense:null,ssContent:null,ssFallback:null,dirs:null,transition:null,el:null,anchor:null,target:null,targetStart:null,targetAnchor:null,staticCount:0,shapeFlag:a,patchFlag:r,dynamicProps:i,dynamicChildren:null,appContext:null,ctx:Ln};return s?(Da(c,n),a&128&&e.normalize(c)):n&&(c.shapeFlag|=T(n)?8:16),pa>0&&!o&&da&&(c.patchFlag>0||a&6)&&c.patchFlag!==32&&da.push(c),c}var X=xa;function xa(e,t=null,n=null,r=0,i=null,a=!1){if((!e||e===Vr)&&(e=ca),_a(e)){let r=Ca(e,t,!0);return n&&Da(r,n),pa>0&&!a&&da&&(r.shapeFlag&6?da[da.indexOf(e)]=r:da.push(r)),r.patchFlag=-2,r}if(Ya(e)&&(e=e.__vccOpts),t){t=Sa(t);let{class:e,style:n}=t;e&&!T(e)&&(t.class=z(e)),D(n)&&(qt(n)&&!b(n)&&(n=g({},n)),t.style=le(n))}let o=T(e)?1:aa(e)?128:er(e)?64:D(e)?4:w(e)?2:0;return Y(e,t,n,r,i,o,a,!0)}function Sa(e){return e?qt(e)||Mi(e)?g({},e):e:null}function Ca(e,t,n=!1,r=!1){let{props:i,ref:a,patchFlag:o,children:s,transition:c}=e,l=t?Oa(i||{},t):i,u={__v_isVNode:!0,__v_skip:!0,type:e.type,props:l,key:l&&ya(l),ref:t&&t.ref?n&&a?b(a)?a.concat(ba(t)):[a,ba(t)]:ba(t):a,scopeId:e.scopeId,slotScopeIds:e.slotScopeIds,children:s,target:e.target,targetStart:e.targetStart,targetAnchor:e.targetAnchor,staticCount:e.staticCount,shapeFlag:e.shapeFlag,patchFlag:t&&e.type!==K?o===-1?16:o|16:o,dynamicProps:e.dynamicProps,dynamicChildren:e.dynamicChildren,appContext:e.appContext,dirs:e.dirs,transition:c,component:e.component,suspense:e.suspense,ssContent:e.ssContent&&Ca(e.ssContent),ssFallback:e.ssFallback&&Ca(e.ssFallback),placeholder:e.placeholder,el:e.el,anchor:e.anchor,ctx:e.ctx,ce:e.ce,cacheIndex:e.cacheIndex};return c&&r&&hr(u,c.clone(u)),u}function Z(e=` `,t=0){return X(sa,null,e,t)}function wa(e,t){let n=X(la,null,e);return n.staticCount=t,n}function Q(e=``,t=!1){return t?(q(),ga(ca,null,e)):X(ca,null,e)}function Ta(e){return e==null||typeof e==`boolean`?X(ca):b(e)?X(K,null,e.slice()):_a(e)?Ea(e):X(sa,null,String(e))}function Ea(e){return e.el===null&&e.patchFlag!==-1||e.memo?e:Ca(e)}function Da(e,t){let n=0,{shapeFlag:r}=e;if(t==null)t=null;else if(b(t))n=16;else if(typeof t==`object`){if(r&65){let n=t.default;n&&(n._c&&(n._d=!1),Da(e,n()),n._c&&(n._d=!0));return}{n=32;let r=t._;!r&&!Mi(t)?t._ctx=Ln:r===3&&Ln&&(Ln.slots._===1?t._=1:(t._=2,e.patchFlag|=1024))}}else if(w(t)){if(r&65){Da(e,{default:t});return}t={default:t,_ctx:Ln},n=32}else t=String(t),r&64?(n=16,t=[Z(t)]):n=8;e.children=t,e.shapeFlag|=n}function Oa(...e){let t={};for(let n=0;n<e.length;n++){let r=e[n];for(let e in r)if(e===`class`)t.class!==r.class&&(t.class=z([t.class,r.class]));else if(e===`style`)t.style=le([t.style,r.style]);else if(m(e)){let n=t[e],i=r[e];i&&n!==i&&!(b(n)&&n.includes(i))?t[e]=n?[].concat(n,i):i:i==null&&n==null&&!h(e)&&(t[e]=i)}else e!==``&&(t[e]=r[e])}return t}function ka(e,t,n,r=null){vn(e,t,7,[n,r])}var Aa=mi(),ja=0;function Ma(e,t,n){let r=e.type,i=(t?t.appContext:e.appContext)||Aa,a={uid:ja++,vnode:e,type:r,parent:t,appContext:i,root:null,next:null,subTree:null,effect:null,update:null,job:null,scope:new Ee(!0),render:null,proxy:null,exposed:null,exposeProxy:null,withProxy:null,provides:t?t.provides:Object.create(i.provides),ids:t?t.ids:[``,0,0],accessCache:null,renderCache:[],components:null,directives:null,propsOptions:Ri(r,i),emitsOptions:xi(r,i),emit:null,emitted:null,propsDefaults:u,inheritAttrs:r.inheritAttrs,ctx:u,data:u,props:u,attrs:u,slots:u,refs:u,setupState:u,setupContext:null,suspense:n,suspenseId:n?n.pendingId:0,asyncDep:null,asyncResolved:!1,isMounted:!1,isUnmounted:!1,isDeactivated:!1,bc:null,c:null,bm:null,m:null,bu:null,u:null,um:null,bum:null,da:null,a:null,rtg:null,rtc:null,ec:null,sp:null};return a.ctx={_:a},a.root=t?t.root:a,a.emit=yi.bind(null,a),e.ce&&e.ce(a),a}var Na=null,Pa=()=>Na||Ln,Fa,Ia;{let e=ce(),t=(t,n)=>{let r;return(r=e[t])||(r=e[t]=[]),r.push(n),e=>{r.length>1?r.forEach(t=>t(e)):r[0](e)}};Fa=t(`__VUE_INSTANCE_SETTERS__`,e=>Na=e),Ia=t(`__VUE_SSR_SETTERS__`,e=>Ba=e)}var La=e=>{let t=Na;return Fa(e),e.scope.on(),()=>{e.scope.off(),Fa(t)}},Ra=()=>{Na&&Na.scope.off(),Fa(null)};function za(e){return e.vnode.shapeFlag&4}var Ba=!1;function Va(e,t=!1,n=!1){t&&Ia(t);let{props:r,children:i}=e.vnode,a=za(e);Ni(e,r,a,t),Ki(e,i,n||t);let o=a?Ha(e,t):void 0;return t&&Ia(!1),o}function Ha(e,t){let n=e.type;e.accessCache=Object.create(null),e.proxy=new Proxy(e.ctx,Zr);let{setup:r}=n;if(r){qe();let n=e.setupContext=r.length>1?Ka(e):null,i=La(e),a=_n(r,e,0,[e.props,n]),o=O(a);if(Je(),i(),(o||e.sp)&&!Sr(e)&&_r(e),o){if(a.then(Ra,Ra),t)return a.then(n=>{Ia(!0);try{Ua(e,n,t)}finally{Ia(!1)}}).catch(t=>{yn(t,e,0)});e.asyncDep=a}else Ua(e,a,t)}else Wa(e,t)}function Ua(e,t,n){w(t)?e.type.__ssrInlineRender?e.ssrRender=t:e.render=t:D(t)&&(e.setupState=nn(t)),Wa(e,n)}function Wa(e,t,n){let r=e.type;e.render||=r.render||f;{let t=La(e);qe();try{ei(e)}finally{Je(),t()}}}var Ga={get(e,t){return it(e,`get`,``),e[t]}};function Ka(e){return{attrs:new Proxy(e.attrs,Ga),slots:e.slots,emit:e.emit,expose:t=>{e.exposed=t||{}}}}function qa(e){return e.exposed?e.exposeProxy||=new Proxy(nn(Yt(e.exposed)),{get(t,n){if(n in t)return t[n];if(n in Yr)return Yr[n](e)},has(e,t){return t in e||t in Yr}}):e.proxy}function Ja(e,t=!0){return w(e)?e.displayName||e.name:e.name||t&&e.__name}function Ya(e){return w(e)&&`__vccOpts`in e}var $=(e,t)=>un(e,t,Ba),Xa=`3.5.43`,Za=void 0,Qa=typeof window<`u`&&window.trustedTypes;if(Qa)try{Za=Qa.createPolicy(`vue`,{createHTML:e=>e})}catch{}var $a=Za?e=>Za.createHTML(e):e=>e,eo=`http://www.w3.org/2000/svg`,to=`http://www.w3.org/1998/Math/MathML`,no=typeof document<`u`?document:null,ro=no&&no.createElement(`template`),io={insert:(e,t,n)=>{t.insertBefore(e,n||null)},remove:e=>{let t=e.parentNode;t&&t.removeChild(e)},createElement:(e,t,n,r)=>{let i=t===`svg`?no.createElementNS(eo,e):t===`mathml`?no.createElementNS(to,e):n?no.createElement(e,{is:n}):no.createElement(e);return e===`select`&&r&&r.multiple!=null&&i.setAttribute(`multiple`,r.multiple),i},createText:e=>no.createTextNode(e),createComment:e=>no.createComment(e),setText:(e,t)=>{e.nodeValue=t},setElementText:(e,t)=>{e.textContent=t},parentNode:e=>e.parentNode,nextSibling:e=>e.nextSibling,querySelector:e=>no.querySelector(e),setScopeId(e,t){e.setAttribute(t,``)},insertStaticContent(e,t,n,r,i,a){let o=n?n.previousSibling:t.lastChild;if(i&&(i===a||i.nextSibling))for(;t.insertBefore(i.cloneNode(!0),n),i!==a&&(i=i.nextSibling););else{ro.innerHTML=$a(r===`svg`?`<svg>${e}</svg>`:r===`mathml`?`<math>${e}</math>`:e);let i=ro.content;if(r===`svg`||r===`mathml`){let e=i.firstChild;for(;e.firstChild;)i.appendChild(e.firstChild);i.removeChild(e)}t.insertBefore(i,n)}return[o?o.nextSibling:t.firstChild,n?n.previousSibling:t.lastChild]}},ao=Symbol(`_vtc`);function oo(e,t,n){let r=e[ao];r&&(t=(t?[t,...r]:[...r]).join(` `)),t==null?e.removeAttribute(`class`):n?e.setAttribute(`class`,t):e.className=t}var so=Symbol(`_vod`),co=Symbol(`_vsh`),lo={name:`show`,beforeMount(e,{value:t},{transition:n}){e[so]=e.style.display===`none`?``:e.style.display,n&&t?n.beforeEnter(e):uo(e,t)},mounted(e,{value:t},{transition:n}){n&&t&&n.enter(e)},updated(e,{value:t,oldValue:n},{transition:r}){!t!=!n&&(r?t?(r.beforeEnter(e),uo(e,!0),r.enter(e)):r.leave(e,()=>{uo(e,!1)}):uo(e,t))},beforeUnmount(e,{value:t}){uo(e,t)}};function uo(e,t){e.style.display=t?e[so]:`none`,e[co]=!t}var fo=Symbol(``),po=/(?:^|;)\s*display\s*:/;function mo(e,t,n){let r=e.style,i=T(n),a=!1;if(n&&!i){if(t){if(T(t))for(let e of t.split(`;`)){let t=e.slice(0,e.indexOf(`:`)).trim();n[t]??go(r,t,``)}else for(let e in t)n[e]??go(r,e,``)}for(let i in n){i===`display`&&(a=!0);let o=n[i];o==null?go(r,i,``):bo(e,i,!T(t)&&t?t[i]:void 0,o)||go(r,i,o)}}else if(i){if(t!==n){let e=r[fo];e&&(n+=`;`+e),r.cssText=n,a=po.test(n)}}else t&&e.removeAttribute(`style`);so in e&&(e[so]=a?r.display:``,e[co]&&(r.display=`none`))}var ho=/\s*!important$/;function go(e,t,n){if(b(n))n.forEach(n=>go(e,t,n));else if(n??=``,t.startsWith(`--`))ho.test(n)?e.setProperty(t,n.replace(ho,``),`important`):e.setProperty(t,n);else{let r=yo(e,t);ho.test(n)?e.setProperty(R(r),n.replace(ho,``),`important`):e[r]=n}}var _o=[`Webkit`,`Moz`,`ms`],vo={};function yo(e,t){let n=vo[t];if(n)return n;let r=L(t);if(r!==`filter`&&r in e)return vo[t]=r;r=te(r);for(let n=0;n<_o.length;n++){let i=_o[n]+r;if(i in e)return vo[t]=i}return t}function bo(e,t,n,r){return e.tagName===`TEXTAREA`&&(t===`width`||t===`height`)&&T(r)&&n===r}var xo=`http://www.w3.org/1999/xlink`;function So(e,t,n,r,i,a=he(t)){r&&t.startsWith(`xlink:`)?n==null?e.removeAttributeNS(xo,t.slice(6,t.length)):e.setAttributeNS(xo,t,n):n==null||a&&!ge(n)?e.removeAttribute(t):e.setAttribute(t,a?``:E(n)?String(n):n)}function Co(e,t,n,r,i){if(t===`innerHTML`||t===`textContent`){n!=null&&(e[t]=t===`innerHTML`?$a(n):n);return}let a=e.tagName;if(t===`value`&&a!==`PROGRESS`&&!a.includes(`-`)){let r=a===`OPTION`?e.getAttribute(`value`)||``:e.value,i=n==null?e.type===`checkbox`?`on`:``:String(n);(r!==i||!(`_value`in e))&&(e.value=i),n??e.removeAttribute(t),e._value=n;return}let o=!1;if(n===``||n==null){let r=typeof e[t];r===`boolean`?n=ge(n):n==null&&r===`string`?(n=``,o=!0):r===`number`&&(n=0,o=!0)}try{e[t]=n}catch{}o&&e.removeAttribute(i||t)}function wo(e,t,n,r){e.addEventListener(t,n,r)}function To(e,t,n,r){e.removeEventListener(t,n,r)}var Eo=Symbol(`_vei`);function Do(e,t,n,r,i=null){let a=e[Eo]||(e[Eo]={}),o=a[t];if(r&&o)o.value=r;else{let[n,s]=Ao(t);r?wo(e,n,a[t]=Po(r,i),s):o&&(To(e,n,o,s),a[t]=void 0)}}var Oo=/(Once|Passive|Capture)$/,ko=/^on:?(?:Once|Passive|Capture)$/;function Ao(e){let t,n;for(;(n=e.match(Oo))&&!ko.test(e);)t||={},e=e.slice(0,e.length-n[1].length),t[n[1].toLowerCase()]=!0;return[e[2]===`:`?e.slice(3):R(e.slice(2)),t]}var jo=0,Mo=Promise.resolve(),No=()=>jo||=(Mo.then(()=>jo=0),Date.now());function Po(e,t){let n=e=>{if(!e._vts)e._vts=Date.now();else if(e._vts<=n.attached)return;let r=n.value;if(b(r)){let n=e.stopImmediatePropagation;e.stopImmediatePropagation=()=>{n.call(e),e._stopped=!0};let i=r.slice(),a=[e];for(let n=0;n<i.length&&!e._stopped;n++){let e=i[n];e&&vn(e,t,5,a)}}else vn(r,t,5,[e])};return n.value=e,n.attached=No(),n}var Fo=e=>e.charCodeAt(0)===111&&e.charCodeAt(1)===110&&e.charCodeAt(2)>96&&e.charCodeAt(2)<123,Io=(e,t,n,r,i,a)=>{let o=i===`svg`;t===`class`?oo(e,r,o):t===`style`?mo(e,n,r):m(t)?h(t)||Do(e,t,n,r,a):(t[0]===`.`?(t=t.slice(1),1):t[0]===`^`?(t=t.slice(1),0):Lo(e,t,r,o))?(Co(e,t,r),!e.tagName.includes(`-`)&&(t===`value`||t===`checked`||t===`selected`)&&So(e,t,r,o,a,t!==`value`)):e._isVueCE&&(Ro(e,t)||e._def.__asyncLoader&&(/[A-Z]/.test(t)||!T(r)))?Co(e,L(t),r,a,t):(t===`true-value`?e._trueValue=r:t===`false-value`&&(e._falseValue=r),So(e,t,r,o))};function Lo(e,t,n,r){if(r)return!!(t===`innerHTML`||t===`textContent`||t in e&&Fo(t)&&w(n));if(t===`spellcheck`||t===`draggable`||t===`translate`||t===`autocorrect`||t===`sandbox`&&e.tagName===`IFRAME`||t===`form`||t===`list`&&e.tagName===`INPUT`||t===`type`&&e.tagName===`TEXTAREA`)return!1;if(t===`width`||t===`height`){let t=e.tagName;if(t===`IMG`||t===`VIDEO`||t===`CANVAS`||t===`SOURCE`)return!1}return Fo(t)&&T(n)?!1:t in e}function Ro(e,t){let n=e._def.props;if(!n)return!1;let r=L(t);return Array.isArray(n)?n.some(e=>L(e)===r):Object.keys(n).some(e=>L(e)===r)}var zo=e=>{let t=e.props[`onUpdate:modelValue`]||!1;return b(t)?e=>ie(t,e):t};function Bo(e){e.target.composing=!0}function Vo(e){let t=e.target;t.composing&&(t.composing=!1,t.dispatchEvent(new Event(`input`)))}var Ho=Symbol(`_assign`),Uo=Symbol(`_initialValue`);function Wo(e,t,n){return t&&(e=e.trim()),n&&(e=oe(e)),e}var Go={created(e,{modifiers:{lazy:t,trim:n,number:r}},i){e.parentNode&&(e.type===`text`?e[Uo]=e.defaultValue.replace(/[\r\n]/g,``):e.type===`textarea`&&(e[Uo]=e.defaultValue.replace(/\r\n?/g,`
2
- `))),e[Ho]=zo(i);let a=r||i.props&&i.props.type===`number`;wo(e,t?`change`:`input`,t=>{t.target.composing||e[Ho](Wo(e.value,n,a))}),(n||a)&&wo(e,`change`,()=>{e.value=Wo(e.value,n,a)}),t||(wo(e,`compositionstart`,Bo),wo(e,`compositionend`,Vo),wo(e,`change`,Vo))},mounted(e,{value:t,modifiers:{trim:n,number:r}}){let i=t??``,a=e[Uo];delete e[Uo],a!==void 0&&(e.type===`text`||e.type===`textarea`)&&e.value!==a?e[Ho](Wo(e.value,n,r)):e.value=i},beforeUpdate(e,{value:t,oldValue:n,modifiers:{lazy:r,trim:i,number:a}},o){if(e[Ho]=zo(o),e.composing)return;let s=(a||e.type===`number`)&&!/^0\d/.test(e.value)?oe(e.value):e.value,c=t??``;if(s===c)return;let l=e.getRootNode();(l instanceof Document||l instanceof ShadowRoot)&&l.activeElement===e&&e.type!==`range`&&(r&&t===n||i&&e.value.trim()===c)||(e.value=c)}},Ko=[`ctrl`,`shift`,`alt`,`meta`],qo={stop:e=>e.stopPropagation(),prevent:e=>e.preventDefault(),self:e=>e.target!==e.currentTarget,ctrl:e=>!e.ctrlKey,shift:e=>!e.shiftKey,alt:e=>!e.altKey,meta:e=>!e.metaKey,left:e=>`button`in e&&e.button!==0,middle:e=>`button`in e&&e.button!==1,right:e=>`button`in e&&e.button!==2,exact:(e,t)=>Ko.some(n=>e[`${n}Key`]&&!t.includes(n))},Jo=(e,t)=>{if(!e)return e;let n=e._withMods||={},r=t.join(`.`);return n[r]||(n[r]=((n,...r)=>{for(let e=0;e<t.length;e++){let r=qo[t[e]];if(r&&r(n,t))return}return e(n,...r)}))},Yo={esc:`escape`,space:` `,up:`arrow-up`,left:`arrow-left`,right:`arrow-right`,down:`arrow-down`,delete:`backspace`},Xo=(e,t)=>{let n=e._withKeys||={},r=t.join(`.`);return n[r]||(n[r]=(n=>{if(!(`key`in n))return;let r=R(n.key);if(t.some(e=>e===r||Yo[e]===r))return e(n)}))},Zo=g({patchProp:Io},io),Qo;function $o(){return Qo||=Yi(Zo)}var es=((...e)=>{let t=$o().createApp(...e),{mount:n}=t;return t.mount=e=>{let r=ns(e);if(!r)return;let i=t._component;!w(i)&&!i.render&&!i.template&&(i.template=r.innerHTML),r.nodeType===1&&(r.textContent=``);let a=n(r,!1,ts(r));return r instanceof Element&&(r.removeAttribute(`v-cloak`),r.setAttribute(`data-v-app`,``)),a},t});function ts(e){if(e instanceof SVGElement)return`svg`;if(typeof MathMLElement==`function`&&e instanceof MathMLElement)return`mathml`}function ns(e){return T(e)?document.querySelector(e):e}var rs=typeof window<`u`,is,as=e=>is=e,os=Symbol();function ss(e){return e&&typeof e==`object`&&Object.prototype.toString.call(e)===`[object Object]`&&typeof e.toJSON!=`function`}var cs=typeof window==`object`&&window.window===window?window:typeof self==`object`&&self.self===self?self:typeof global==`object`&&global.global===global?global:typeof globalThis==`object`?globalThis:{HTMLElement:null};function ls(e,{autoBom:t=!1}={}){return t&&/^\s*(?:text\/\S*|application\/xml|\S*\/\S*\+xml)\s*;.*charset\s*=\s*utf-8/i.test(e.type)?new Blob([``,e],{type:e.type}):e}function us(e,t,n){let r=new XMLHttpRequest;r.open(`GET`,e),r.responseType=`blob`,r.onload=function(){hs(r.response,t,n)},r.onerror=function(){console.error(`could not download file`)},r.send()}function ds(e){let t=new XMLHttpRequest;t.open(`HEAD`,e,!1);try{t.send()}catch{}return t.status>=200&&t.status<=299}function fs(e){try{e.dispatchEvent(new MouseEvent(`click`))}catch{let t=new MouseEvent(`click`,{bubbles:!0,cancelable:!0,view:window,detail:0,screenX:80,screenY:20,clientX:80,clientY:20,ctrlKey:!1,altKey:!1,shiftKey:!1,metaKey:!1,button:0,relatedTarget:null});e.dispatchEvent(t)}}var ps=typeof navigator==`object`?navigator:{userAgent:``},ms=/Macintosh/.test(ps.userAgent)&&/AppleWebKit/.test(ps.userAgent)&&!/Safari/.test(ps.userAgent),hs=rs?typeof HTMLAnchorElement<`u`&&`download`in HTMLAnchorElement.prototype&&!ms?gs:`msSaveOrOpenBlob`in ps?_s:vs:()=>{};function gs(e,t=`download`,n){let r=document.createElement(`a`);r.download=t,r.rel=`noopener`,typeof e==`string`?(r.href=e,r.origin===location.origin?fs(r):ds(r.href)?us(e,t,n):(r.target=`_blank`,fs(r))):(r.href=URL.createObjectURL(e),setTimeout(function(){URL.revokeObjectURL(r.href)},4e4),setTimeout(function(){fs(r)},0))}function _s(e,t=`download`,n){if(typeof e==`string`){if(ds(e))us(e,t,n);else{let t=document.createElement(`a`);t.href=e,t.target=`_blank`,setTimeout(function(){fs(t)})}}else navigator.msSaveOrOpenBlob(ls(e,n),t)}function vs(e,t,n,r){if(r||=open(``,`_blank`),r&&(r.document.title=r.document.body.innerText=`downloading...`),typeof e==`string`)return us(e,t,n);let i=e.type===`application/octet-stream`,a=/constructor/i.test(String(cs.HTMLElement))||`safari`in cs,o=/CriOS\/[\d]+/.test(navigator.userAgent);if((o||i&&a||ms)&&typeof FileReader<`u`){let t=new FileReader;t.onloadend=function(){let e=t.result;if(typeof e!=`string`)throw r=null,Error(`Wrong reader.result type`);e=o?e:e.replace(/^data:[^;]*;/,`data:attachment/file;`),r?r.location.href=e:location.assign(e),r=null},t.readAsDataURL(e)}else{let t=URL.createObjectURL(e);r?r.location.assign(t):location.href=t,r=null,setTimeout(function(){URL.revokeObjectURL(t)},4e4)}}var{assign:ys}=Object;function bs(){let e=De(!0),t=e.run(()=>V({})),n=[],r=[],i=Yt({install(e){as(i),i._a=e,e.provide(os,i),e.config.globalProperties.$pinia=i,r.forEach(e=>n.push(e)),r=[]},use(e){return this._a?n.push(e):r.push(e),this},_p:n,_a:null,_e:e,_s:new Map,state:t});return i}var xs=()=>{};function Ss(e,t,n,r=xs){e.add(t);let i=()=>{e.delete(t)&&r()};return!n&&Oe()&&ke(i),i}function Cs(e,...t){e.forEach(e=>{e(...t)})}var ws=e=>e(),Ts=Symbol(),Es=Symbol();function Ds(e,t){e instanceof Map&&t instanceof Map?t.forEach((t,n)=>e.set(n,t)):e instanceof Set&&t instanceof Set&&t.forEach(e.add,e);for(let n in t){if(!Object.hasOwn(t,n))continue;let r=t[n],i=e[n];e[n]=ss(i)&&ss(r)&&Object.hasOwn(e,n)&&!Qt(r)&&!Wt(r)?Ds(i,r):r}return e}var Os=Symbol();function ks(e){return!e||typeof e!=`object`||!Object.hasOwn(e,Os)}var{assign:As}=Object;function js(e){return!!(Qt(e)&&e.effect)}function Ms(e,t,n,r){let{state:i,actions:a,getters:o}=t,s=n.state.value[e],c;function l(){return s||(n.state.value[e]=i?i():{}),As(rn(n.state.value[e]),a,Object.keys(o||{}).reduce((t,r)=>(t[r]=Yt($(()=>{as(n);let t=n._s.get(e);return o[r].call(t,t)})),t),{}))}return c=Ns(e,l,t,n,r,!0),c}function Ns(e,t,n={},r,i,a){let o,s=As({actions:{}},n),c={deep:!0},l,u,d=new Set,f=new Set,p,m=r.state.value[e];!a&&!m&&(r.state.value[e]={});let h;function g(t){let n;l=u=!1,typeof t==`function`?(t(r.state.value[e]),n={type:`patch function`,storeId:e,events:p}):(Ds(r.state.value[e],t),n={type:`patch object`,payload:t,storeId:e,events:p});let i=h=Symbol();On().then(()=>{h===i&&(l=!0)}),u=!0,Cs(d,n,r.state.value[e])}let _=a?function(){let{state:e}=n,t=e?e():{};this.$patch(e=>{As(e,t)})}:xs;function v(){o.stop(),d.clear(),f.clear(),r._s.delete(e)}let y=(t,n=``)=>{if(Ts in t)return t[Es]=n,t;let i=function(){as(r);let n=Array.from(arguments),a=new Set,o=new Set;function s(e){a.add(e)}function c(e){o.add(e)}Cs(f,{args:n,name:i[Es],store:b,after:s,onError:c});let l;try{l=t.apply(this&&this.$id===e?this:b,n)}catch(e){throw Cs(o,e),e}return l instanceof Promise?l.then(e=>(Cs(a,e),e)).catch(e=>(Cs(o,e),Promise.reject(e))):(Cs(a,l),l)};return i[Ts]=!0,i[Es]=n,i},b=Bt({_p:r,$id:e,$onAction:Ss.bind(null,f),$patch:g,$reset:_,$subscribe(t,n={}){if(d.has(t))return xs;let i=Ss(d,t,n.detached,()=>a()),a=o.run(()=>W(()=>r.state.value[e],r=>{(n.flush===`sync`?u:l)&&t({storeId:e,type:`direct`,events:p},r)},As({},c,n)));return i},$dispose:v});r._s.set(e,b);let x=(r._a&&r._a.runWithContext||ws)(()=>r._e.run(()=>(o=De()).run(()=>t({action:y}))));for(let t in x){let n=x[t];Qt(n)&&!js(n)||Wt(n)?a||(m&&ks(n)&&(Qt(n)?n.value=m[t]:((n instanceof Set||n instanceof Map)&&n.clear(),Ds(n,m[t]))),r.state.value[e][t]=n):typeof n==`function`&&(x[t]=y(n,t),s.actions[t]=n)}return As(b,x),As(Jt(b),x),Object.defineProperty(b,"$state",{get:()=>r.state.value[e],set:e=>{g(t=>{As(t,e)})}}),r._p.forEach(e=>{let t=o.run(()=>e({store:b,app:r._a,pinia:r,options:s}));As(b,t)}),m&&a&&n.hydrate&&n.hydrate(b.$state,m),l=!0,u=!0,b}function Ps(e,t,n){let r,i=typeof t==`function`;r=i?n:t;function a(n,a){let o=Gn();return n||=o?Wn(os,null):null,n&&as(n),n=is,n._s.has(e)||(i?Ns(e,t,r,n):Ms(e,r,n)),n._s.get(e)}return a.$id=e,a}function Fs(e){let t=Jt(e),n={};for(let r in t){let i=t[r];i?.effect?n[r]=$({get:()=>e[r],set(t){e[r]=t}}):(Qt(i)||Wt(i))&&(n[r]=sn(e,r))}return n}var Is=class extends Error{status;constructor(e,t){super(t),this.name=`DaemonError`,this.status=e}};function Ls(e){return!(e instanceof Is)}function Rs(e){return e instanceof Error?e.message:String(e)}function zs(e,t){if(typeof e==`object`&&e){let t=e.error;if(typeof t==`string`&&t.length>0)return t}return`Daemon request failed with HTTP ${t}`}function Bs(e,t){let n=t instanceof Error?t.message:String(t);return Error(`daemon unreachable (${e}): ${n}`)}async function Vs(e,t,n){let r=n===void 0?null:JSON.stringify(n),i;try{i=await fetch(t,{method:e,headers:{accept:`application/json`,...r===null?{}:{"content-type":`application/json`}},...r===null?{}:{body:r}})}catch(e){throw Bs(`request`,e)}let a;try{a=await i.text()}catch(e){throw Bs(`response body`,e)}let o=i.status,s=null;if(a.length>0)try{s=JSON.parse(a)}catch{throw new Is(o,`Daemon sent invalid JSON (HTTP ${o}): ${a.slice(0,200)}`)}if(o>=200&&o<300)return s;throw new Is(o,zs(s,o))}function Hs(e,t,n){let r=new EventSource(e),i=!1;for(let e of t)r.addEventListener(e,t=>{if(i)return;let r=t.data,a=null;if(typeof r==`string`&&r.length>0)try{a=JSON.parse(r)}catch{n.onError?.();return}n.onEvent(e,a)});return r.onopen=()=>{i||n.onOpen?.()},r.onerror=()=>{i||n.onError?.()},{close(){i||(i=!0,r.close())}}}function Us(e,t){let n=`path=${encodeURIComponent(t.path)}&side=${encodeURIComponent(t.side)}`,r=t.version===void 0?``:`&v=${encodeURIComponent(t.version)}`;return`/repos/${encodeURIComponent(e)}/blob?${n}${r}`}function Ws(e,t,n){let r=`path=${encodeURIComponent(t)}&staged=${n?`true`:`false`}`;return`/repos/${encodeURIComponent(e)}/media?${r}`}var Gs=[`snapshot`,`repo-opened`,`repo-closed`,`follow-change`,`settings-change`,`discovery-change`],Ks=[`repo-snapshot`,`state-change`,`journal-append`,`repo-missing`];function qs(e){return Ks.includes(e)}function Js(e){return{...e,date:new Date(e.date)}}function Ys(e){let t=new URLSearchParams;for(let[n,r]of Object.entries(e))r!==void 0&&t.set(n,String(r));let n=t.toString();return n?`?${n}`:``}var Xs=class{health(){return Vs(`GET`,`/health`)}version(){return Vs(`GET`,`/version`)}getFollow(){return Vs(`GET`,`/follow`)}getSettings(){return Vs(`GET`,`/settings`)}setWatchRoots(e){return Vs(`PUT`,`/settings`,{watchRoots:e})}discovered(){return Vs(`GET`,`/discovered`)}rescanDiscovered(){return Vs(`POST`,`/discovered/rescan`)}browse(e){return Vs(`GET`,`/browse${e===void 0?``:`?path=${encodeURIComponent(e)}`}`)}openRepo(e){return Vs(`POST`,`/repos`,{path:e})}listRepos(){return Vs(`GET`,`/repos`)}async closeRepo(e){await Vs(`DELETE`,this.repoPath(e,``))}releaseRepoOnUnload(e){fetch(this.repoPath(e,``),{method:`DELETE`,keepalive:!0}).catch(()=>{})}worktreesForPath(e){return Vs(`GET`,`/worktrees`+Ys({path:e}))}resolvePath(e){return Vs(`GET`,`/resolve`+Ys({path:e}))}status(e){return Vs(`GET`,this.repoPath(e,`/status`))}diff(e,t={}){return Vs(`GET`,this.repoPath(e,`/diff`)+Ys({path:t.path,staged:t.staged,whole:t.whole}))}stage(e,t){return Vs(`POST`,this.repoPath(e,`/stage`),{path:t})}unstage(e,t){return Vs(`POST`,this.repoPath(e,`/unstage`),{path:t})}async history(e,t){return(await Vs(`GET`,this.repoPath(e,`/history`)+Ys({count:t}))).map(Js)}async getCommit(e,t){return Js(await Vs(`GET`,this.repoPath(e,`/commits/${encodeURIComponent(t)}`)))}commitDiff(e,t,n={}){return Vs(`GET`,this.repoPath(e,`/commits/${encodeURIComponent(t)}/diff`)+Ys({path:n.path,whole:n.whole}))}commitFiles(e,t){return Vs(`GET`,this.repoPath(e,`/commits/${encodeURIComponent(t)}/files`))}compareFileDiff(e,t){return Vs(`GET`,this.repoPath(e,`/compare/file`)+Ys({path:t.path,base:t.base,head:t.head,uncommitted:t.uncommitted,whole:t.whole}))}baseBranches(e){return Vs(`GET`,this.repoPath(e,`/base-branches`))}async compare(e,t={}){let n=await Vs(`GET`,this.repoPath(e,`/compare`)+Ys({base:t.base,head:t.head,staged:t.staged,unstaged:t.unstaged,untracked:t.untracked}));return{...n,commits:n.commits.map(Js)}}compareCount(e,t={}){return Vs(`GET`,this.repoPath(e,`/compare/count`)+Ys({base:t.base,head:t.head}))}compareStack(e,t={}){return Vs(`GET`,this.repoPath(e,`/compare/stack`)+Ys({base:t.base}))}journal(e,t){return Vs(`GET`,this.repoPath(e,`/journal`)+Ys({since:t}))}tree(e,t={}){return Vs(`GET`,this.repoPath(e,`/tree`)+Ys({dir:t.dir,hidden:t.hidden,ignored:t.ignored}))}file(e,t,n={}){return Vs(`GET`,this.repoPath(e,`/file`)+Ys({path:t,symbols:n.symbols}))}files(e){return Vs(`GET`,this.repoPath(e,`/files`))}search(e,t){return Vs(`POST`,this.repoPath(e,`/search`),{query:t})}media(e,t,n){return Vs(`GET`,Ws(e,t,n))}subscribeEvents(e,t){return Hs(t?`/events?repo=${encodeURIComponent(t.id)}`:`/events`,t?[...Gs,...Ks]:Gs,{onEvent:(n,r)=>{t&&qs(n)?this.dispatchRepoEvent(n,r,t.handlers):this.dispatchDaemonEvent(n,r,e)},onOpen:e.onOpen,onError:()=>{e.onError?.(),t?.handlers.onError?.()}})}dispatchRepoEvent(e,t,n){switch(e){case`repo-snapshot`:n.onSnapshot(t);break;case`state-change`:n.onStateChange(t);break;case`journal-append`:n.onJournalAppend?.(t);break;case`repo-missing`:n.onMissing(t)}}dispatchDaemonEvent(e,t,n){switch(e){case`snapshot`:n.onSnapshot(t);break;case`repo-opened`:n.onRepoOpened(t);break;case`repo-closed`:n.onRepoClosed(t);break;case`follow-change`:n.onFollowChange(t);break;case`settings-change`:n.onSettingsChange?.(t);break;case`discovery-change`:n.onDiscoveryChange?.(t)}}repoPath(e,t){return`/repos/${encodeURIComponent(e)}${t}`}};function Zs(e,t,n={}){console.error(`diffstalker: ${e} failed`,{status:t instanceof Is?t.status:null,message:Rs(t),...n,error:t})}function Qs(e,t,n={}){Ls(t)||Zs(e,t,n)}function $s(e){return new Promise(t=>setTimeout(t,e))}var ec=Ps(`settings`,()=>{let e=new Xs,t=H([]),n=H(!0),r=H([]),i=H(!1),a=H(null),o=H(!1),s=$(()=>{let e=new Map;for(let t of r.value)for(let n of t.repos)e.has(n.path)||e.set(n.path,n);return[...e.values()].sort((e,t)=>(t.lastActivity??0)-(e.lastActivity??0)||e.name.localeCompare(t.name))});function c(e){t.value=e.watchRoots,n.value=e.persisted}function l(e){r.value=e.roots}async function u(){try{let[t,n]=await Promise.all([e.getSettings(),e.discovered()]);c(t),l(n),o.value=!0}catch(e){Qs(`load settings`,e)}}async function d(t){i.value=!0,a.value=null;try{return c(await e.setWatchRoots(t)),l(await e.discovered()),!0}catch(e){return Zs(`save watch directories`,e,{watchRoots:t}),a.value=Rs(e),!1}finally{i.value=!1}}async function f(e){let n=t.value,r=await d([...n,e]);return r&&t.value.length===n.length?(a.value=`Already watching ${e}`,!1):r}function p(){a.value=null}function m(e){return d(t.value.filter(t=>t!==e))}async function h(){try{l(await e.rescanDiscovered())}catch(e){Qs(`rescan watch directories`,e)}}return{watchRoots:t,persisted:n,roots:r,saving:i,saveError:a,loaded:o,discoveredRepos:s,applySettings:c,applyDiscovery:l,load:u,clearSaveError:p,addWatchRoot:f,removeWatchRoot:m,rescan:h}});function tc(e){return e.followedRepoId===null||e.followedPath===null?null:{repoId:e.followedRepoId,path:e.followedPath,rawContent:e.followedPath}}var nc=36e5,rc=1e4,ic=Ps(`daemon`,()=>{let e=new Xs,t=H(`connecting`),n=H([]),r=H(null),i=H(!0),a=H(null),o=H(!1),s=H(null),c=H(null),l=H(null),u=H(null),d=null,f=null,p=!1,m=!1,h=null,g=!1,_=null,v=!1,y=!1;function b(e){let t=new Map(n.value.map(e=>[e.id,e.branch]));n.value=e.map(e=>({...e,branch:t.get(e.id)??null}))}function x(e,t=null){n.value.find(t=>t.id===e.id)||(n.value=[...n.value,{...e,branch:t}])}let S={onSnapshot:e=>{t.value=`connected`,l.value=null,b(e),N(),ee(),ec().load(),P(),F()},onRepoOpened:e=>x(e),onRepoClosed:({id:e})=>{n.value=n.value.filter(t=>t.id!==e)},onFollowChange:e=>{if(a.value=e,r.value){let t=n.value.find(t=>t.id===e.repoId)?.path??r.value.followedPath;r.value={...r.value,followedRepoId:e.repoId,followedPath:t}}},onSettingsChange:e=>ec().applySettings(e),onDiscoveryChange:e=>ec().applyDiscovery(e),onError:()=>{t.value!==`disconnected`&&console.warn(`diffstalker: daemon event stream lost; the browser will retry`),t.value=`disconnected`}};function C(){return document.visibilityState===`hidden`}function w(){d?.close(),d=null,D(),E(),C()?p=!0:(p=!1,d=e.subscribeEvents(S,f===null?void 0:T(f)))}function T(e){let{handlers:t}=e;return{id:e.id,handlers:{...t,onSnapshot:e=>{t.onSnapshot(e),m&&(m=!1,t.onResume?.())}}}}function E(){g||(g=!0,document.addEventListener(`visibilitychange`,O))}function D(){h!==null&&(clearTimeout(h),h=null)}function O(){if(C()){if(h!==null||d===null)return;h=setTimeout(()=>{h=null,d?.close(),d=null,p=!0},rc)}else D(),p&&(m=f!==null,w())}function k(){d||p||w()}function A(e,t){f={id:e,handlers:t},m=!1,w()}function j(){f!==null&&(f=null,m=!1,d&&w())}function M(){d?.close(),d=null,p=!1,m=!1,D(),g&&(g=!1,document.removeEventListener(`visibilitychange`,O)),I()}async function N(){try{n.value=await e.listRepos()}catch(e){Qs(`list repos`,e),t.value=`disconnected`}}async function P(){try{let t=await e.version();c.value=t,u.value===null&&t.current!==null&&(u.value=t.current)}catch(e){Qs(`load version`,e)}}function F(){_===null&&(_=setInterval(()=>void P(),nc))}function I(){_!==null&&(clearInterval(_),_=null)}function L(e){let t=r.value?.followedRepoId??null;r.value=e;let n=tc(e);y?n!==null&&n.repoId!==t&&(a.value=n):(y=!0,a.value===null&&n!==null&&(a.value=n))}async function ee(){if(!v){v=!0;try{for(let n=1;n<=3;n++)try{L(await e.getFollow());return}catch(e){if(n<3){await $s(300);continue}Zs(`load follow state`,e,{attempts:n}),t.value=`disconnected`}}finally{v=!1}}}function R(e){x(e),s.value=e.id,l.value=null}async function te(t){try{await e.closeRepo(t)}catch(e){Zs(`release repo`,e,{id:t}),l.value=Rs(e);return}n.value=n.value.filter(e=>e.id!==t),s.value===t&&(s.value=null)}let ne=0;function re(e){ne=Date.now()+e}function ie(){return Date.now()<ne}function ae(){return i.value=!i.value,i.value}let oe=$(()=>n.value.find(e=>e.id===s.value)??null);return{connection:t,repos:n,follow:r,followEnabled:i,lastFollowChange:a,skipInitialFollow:o,suspendFollowNavigation:re,followNavigationSuspended:ie,activeRepoId:s,activeRepo:oe,activeRepoPath:$(()=>oe.value?.path??null),version:c,servedBy:u,daemonUpgraded:$(()=>u.value!==null&&c.value?.current!=null&&c.value.current!==u.value),error:l,connect:k,disconnect:M,attachRepo:A,detachRepo:j,refreshRepos:N,loadFollow:ee,loadVersion:P,trackActive:R,closeRepo:te,toggleFollow:ae}});function ac(e){return e.lines.some(e=>e.type===`header`&&e.content.startsWith(`Large file — diff not shown`))}function oc(e){return e.startsWith(`\\ `)}var sc=new Map([[`a`,7],[`b`,8],[`f`,12],[`n`,10],[`r`,13],[`t`,9],[`v`,11],[`\\`,92],[`"`,34]]);new Map([...sc].map(([e,t])=>[t,e]));function cc(e){if(e.length<2||!e.startsWith(`"`)||!e.endsWith(`"`))return e;let t=e.slice(1,-1),n=new TextEncoder,r=[],i=0;for(;i<t.length;){let e=t.indexOf(`\\`,i);if(e===-1){r.push(...n.encode(t.slice(i)));break}r.push(...n.encode(t.slice(i,e)));let a=/^[0-7]{1,3}/.exec(t.slice(e+1,e+4));if(a!==null){r.push(parseInt(a[0],8)),i=e+1+a[0].length;continue}let o=sc.get(t[e+1]??``);o===void 0?(r.push(92),i=e+1):(r.push(o),i=e+2)}return new TextDecoder().decode(Uint8Array.from(r))}function lc(e){for(let t=e.length-2;t>=0;t--){if(e[t]!==`"`)continue;let n=0;for(let r=t-1;r>=0&&e[r]===`\\`;r--)n++;if(n%2==0)return t}return-1}function uc(e){if(!e.startsWith(`diff --git `))return null;let t=e.slice(11);if(t.endsWith(`"`)){let e=lc(t);if(e===-1)return null;let n=cc(t.slice(e));return n.startsWith(`b/`)?n.slice(2):null}let n=t.lastIndexOf(` b/`);return n===-1?null:t.slice(n+3)}var dc=c(o(((e,t)=>{var n=-1,r=1,i=0;function a(e,t,n,r,a){if(e===t)return e?[[i,e]]:[];if(n!=null){var s=D(e,t,n);if(s)return s}var c=l(e,t),u=e.substring(0,c);e=e.substring(c),t=t.substring(c),c=d(e,t);var f=e.substring(e.length-c);e=e.substring(0,e.length-c),t=t.substring(0,t.length-c);var m=o(e,t);return u&&m.unshift([i,u]),f&&m.push([i,f]),b(m,a),r&&p(m),m}function o(e,t){var o;if(!e)return[[r,t]];if(!t)return[[n,e]];var c=e.length>t.length?e:t,l=e.length>t.length?t:e,u=c.indexOf(l);if(u!==-1)return o=[[r,c.substring(0,u)],[i,l],[r,c.substring(u+l.length)]],e.length>t.length&&(o[0][0]=o[2][0]=n),o;if(l.length===1)return[[n,e],[r,t]];var d=f(e,t);if(d){var p=d[0],m=d[1],h=d[2],g=d[3],_=d[4],v=a(p,h),y=a(m,g);return v.concat([[i,_]],y)}return s(e,t)}function s(e,t){for(var i=e.length,a=t.length,o=Math.ceil((i+a)/2),s=o,l=2*o,u=Array(l),d=Array(l),f=0;f<l;f++)u[f]=-1,d[f]=-1;u[s+1]=0,d[s+1]=0;for(var p=i-a,m=p%2!=0,h=0,g=0,_=0,v=0,y=0;y<o;y++){for(var b=-y+h;b<=y-g;b+=2){for(var x=s+b,S=b===-y||b!==y&&u[x-1]<u[x+1]?u[x+1]:u[x-1]+1,C=S-b;S<i&&C<a&&e.charAt(S)===t.charAt(C);)S++,C++;if(u[x]=S,S>i)g+=2;else if(C>a)h+=2;else if(m){var w=s+p-b;if(w>=0&&w<l&&d[w]!==-1){var T=i-d[w];if(S>=T)return c(e,t,S,C)}}}for(var E=-y+_;E<=y-v;E+=2){for(var w=s+E,T=E===-y||E!==y&&d[w-1]<d[w+1]?d[w+1]:d[w-1]+1,D=T-E;T<i&&D<a&&e.charAt(i-T-1)===t.charAt(a-D-1);)T++,D++;if(d[w]=T,T>i)v+=2;else if(D>a)_+=2;else if(!m){var x=s+p-E;if(x>=0&&x<l&&u[x]!==-1){var S=u[x],C=s+S-x;if(T=i-T,S>=T)return c(e,t,S,C)}}}}return[[n,e],[r,t]]}function c(e,t,n,r){var i=e.substring(0,n),o=t.substring(0,r),s=e.substring(n),c=t.substring(r),l=a(i,o),u=a(s,c);return l.concat(u)}function l(e,t){if(!e||!t||e.charAt(0)!==t.charAt(0))return 0;for(var n=0,r=Math.min(e.length,t.length),i=r,a=0;n<i;)e.substring(a,i)==t.substring(a,i)?(n=i,a=n):r=i,i=Math.floor((r-n)/2+n);return x(e.charCodeAt(i-1))&&i--,i}function u(e,t){var n=e.length,r=t.length;if(n==0||r==0)return 0;n>r?e=e.substring(n-r):n<r&&(t=t.substring(0,n));var i=Math.min(n,r);if(e==t)return i;for(var a=0,o=1;;){var s=e.substring(i-o),c=t.indexOf(s);if(c==-1)return a;o+=c,(c==0||e.substring(i-o)==t.substring(0,o))&&(a=o,o++)}}function d(e,t){if(!e||!t||e.slice(-1)!==t.slice(-1))return 0;for(var n=0,r=Math.min(e.length,t.length),i=r,a=0;n<i;)e.substring(e.length-i,e.length-a)==t.substring(t.length-i,t.length-a)?(n=i,a=n):r=i,i=Math.floor((r-n)/2+n);return S(e.charCodeAt(e.length-i))&&i--,i}function f(e,t){var n=e.length>t.length?e:t,r=e.length>t.length?t:e;if(n.length<4||r.length*2<n.length)return null;function i(e,t,n){for(var r=e.substring(n,n+Math.floor(e.length/4)),i=-1,a=``,o,s,c,u;(i=t.indexOf(r,i+1))!==-1;){var f=l(e.substring(n),t.substring(i)),p=d(e.substring(0,n),t.substring(0,i));a.length<p+f&&(a=t.substring(i-p,i)+t.substring(i,i+f),o=e.substring(0,n-p),s=e.substring(n+f),c=t.substring(0,i-p),u=t.substring(i+f))}return a.length*2>=e.length?[o,s,c,u,a]:null}var a=i(n,r,Math.ceil(n.length/4)),o=i(n,r,Math.ceil(n.length/2)),s;if(!a&&!o)return null;s=o?a&&a[4].length>o[4].length?a:o:a;var c,u,f,p;e.length>t.length?(c=s[0],u=s[1],f=s[2],p=s[3]):(f=s[0],p=s[1],c=s[2],u=s[3]);var m=s[4];return[c,u,f,p,m]}function p(e){for(var t=!1,a=[],o=0,s=null,c=0,l=0,d=0,f=0,p=0;c<e.length;)e[c][0]==i?(a[o++]=c,l=f,d=p,f=0,p=0,s=e[c][1]):(e[c][0]==r?f+=e[c][1].length:p+=e[c][1].length,s&&s.length<=Math.max(l,d)&&s.length<=Math.max(f,p)&&(e.splice(a[o-1],0,[n,s]),e[a[o-1]+1][0]=r,o--,o--,c=o>0?a[o-1]:-1,l=0,d=0,f=0,p=0,s=null,t=!0)),c++;for(t&&b(e),y(e),c=1;c<e.length;){if(e[c-1][0]==n&&e[c][0]==r){var m=e[c-1][1],h=e[c][1],g=u(m,h),_=u(h,m);g>=_?(g>=m.length/2||g>=h.length/2)&&(e.splice(c,0,[i,h.substring(0,g)]),e[c-1][1]=m.substring(0,m.length-g),e[c+1][1]=h.substring(g),c++):(_>=m.length/2||_>=h.length/2)&&(e.splice(c,0,[i,m.substring(0,_)]),e[c-1][0]=r,e[c-1][1]=h.substring(0,h.length-_),e[c+1][0]=n,e[c+1][1]=m.substring(_),c++),c++}c++}}var m=/[^a-zA-Z0-9]/,h=/\s/,g=/[\r\n]/,_=/\n\r?\n$/,v=/^\r?\n\r?\n/;function y(e){function t(e,t){if(!e||!t)return 6;var n=e.charAt(e.length-1),r=t.charAt(0),i=n.match(m),a=r.match(m),o=i&&n.match(h),s=a&&r.match(h),c=o&&n.match(g),l=s&&r.match(g),u=c&&e.match(_),d=l&&t.match(v);return u||d?5:c||l?4:i&&!o&&s?3:o||s?2:i||a?1:0}for(var n=1;n<e.length-1;){if(e[n-1][0]==i&&e[n+1][0]==i){var r=e[n-1][1],a=e[n][1],o=e[n+1][1],s=d(r,a);if(s){var c=a.substring(a.length-s);r=r.substring(0,r.length-s),a=c+a.substring(0,a.length-s),o=c+o}for(var l=r,u=a,f=o,p=t(r,a)+t(a,o);a.charAt(0)===o.charAt(0);){r+=a.charAt(0),a=a.substring(1)+o.charAt(0),o=o.substring(1);var y=t(r,a)+t(a,o);y>=p&&(p=y,l=r,u=a,f=o)}e[n-1][1]!=l&&(l?e[n-1][1]=l:(e.splice(n-1,1),n--),e[n][1]=u,f?e[n+1][1]=f:(e.splice(n+1,1),n--))}n++}}function b(e,t){e.push([i,``]);for(var a=0,o=0,s=0,c=``,u=``,f;a<e.length;)if(a<e.length-1&&!e[a][1])e.splice(a,1);else switch(e[a][0]){case r:s++,u+=e[a][1],a++;break;case n:o++,c+=e[a][1],a++;break;case i:var p=a-s-o-1;if(t){if(p>=0&&w(e[p][1])){var m=e[p][1].slice(-1);if(e[p][1]=e[p][1].slice(0,-1),c=m+c,u=m+u,!e[p][1]){e.splice(p,1),a--;var h=p-1;e[h]&&e[h][0]===r&&(s++,u=e[h][1]+u,h--),e[h]&&e[h][0]===n&&(o++,c=e[h][1]+c,h--),p=h}}if(C(e[a][1])){var m=e[a][1].charAt(0);e[a][1]=e[a][1].slice(1),c+=m,u+=m}}if(a<e.length-1&&!e[a][1]){e.splice(a,1);break}if(c.length>0||u.length>0){c.length>0&&u.length>0&&(f=l(u,c),f!==0&&(p>=0?e[p][1]+=u.substring(0,f):(e.splice(0,0,[i,u.substring(0,f)]),a++),u=u.substring(f),c=c.substring(f)),f=d(u,c),f!==0&&(e[a][1]=u.substring(u.length-f)+e[a][1],u=u.substring(0,u.length-f),c=c.substring(0,c.length-f)));var g=s+o;c.length===0&&u.length===0?(e.splice(a-g,g),a-=g):c.length===0?(e.splice(a-g,g,[r,u]),a=a-g+1):u.length===0?(e.splice(a-g,g,[n,c]),a=a-g+1):(e.splice(a-g,g,[n,c],[r,u]),a=a-g+2)}a!==0&&e[a-1][0]===i?(e[a-1][1]+=e[a][1],e.splice(a,1)):a++,s=0,o=0,c=``,u=``}e[e.length-1][1]===``&&e.pop();var _=!1;for(a=1;a<e.length-1;)e[a-1][0]===i&&e[a+1][0]===i&&(e[a][1].substring(e[a][1].length-e[a-1][1].length)===e[a-1][1]?(e[a][1]=e[a-1][1]+e[a][1].substring(0,e[a][1].length-e[a-1][1].length),e[a+1][1]=e[a-1][1]+e[a+1][1],e.splice(a-1,1),_=!0):e[a][1].substring(0,e[a+1][1].length)==e[a+1][1]&&(e[a-1][1]+=e[a+1][1],e[a][1]=e[a][1].substring(e[a+1][1].length)+e[a+1][1],e.splice(a+1,1),_=!0)),a++;_&&b(e,t)}function x(e){return e>=55296&&e<=56319}function S(e){return e>=56320&&e<=57343}function C(e){return S(e.charCodeAt(0))}function w(e){return x(e.charCodeAt(e.length-1))}function T(e){for(var t=[],n=0;n<e.length;n++)e[n][1].length>0&&t.push(e[n]);return t}function E(e,t,a,o){return w(e)||C(o)?null:T([[i,e],[n,t],[r,a],[i,o]])}function D(e,t,n){var r=typeof n==`number`?{index:n,length:0}:n.oldRange,i=typeof n==`number`?null:n.newRange,a=e.length,o=t.length;if(r.length===0&&(i===null||i.length===0)){var s=r.index,c=e.slice(0,s),l=e.slice(s),u=i?i.index:null;editBefore:{var d=s+o-a;if(u!==null&&u!==d||d<0||d>o)break editBefore;var f=t.slice(0,d),p=t.slice(d);if(p!==l)break editBefore;var m=Math.min(s,d),h=c.slice(0,m),g=f.slice(0,m);if(h!==g)break editBefore;var _=c.slice(m),v=f.slice(m);return E(h,_,v,l)}editAfter:{if(u!==null&&u!==s)break editAfter;var y=s,f=t.slice(0,y),p=t.slice(y);if(f!==c)break editAfter;var b=Math.min(a-y,o-y),x=l.slice(l.length-b),S=p.slice(p.length-b);if(x!==S)break editAfter;var _=l.slice(0,l.length-b),v=p.slice(0,p.length-b);return E(c,_,v,x)}}if(r.length>0&&i&&i.length===0)replaceRange:{var h=e.slice(0,r.index),x=e.slice(r.index+r.length),m=h.length,b=x.length;if(o<m+b)break replaceRange;var g=t.slice(0,m),S=t.slice(o-b);if(h!==g||x!==S)break replaceRange;var _=e.slice(m,a-b),v=t.slice(m,o-b);return E(h,_,v,x)}return null}function O(e,t,n,r){return a(e,t,n,r,!0)}O.INSERT=r,O.DELETE=n,O.EQUAL=i,t.exports=O}))(),1);function fc(e,t){let n=(0,dc.default)(e,t),r=[],i=[];for(let[e,t]of n)e===dc.default.EQUAL?(r.push({text:t,type:`same`}),i.push({text:t,type:`same`})):e===dc.default.DELETE?r.push({text:t,type:`changed`}):e===dc.default.INSERT&&i.push({text:t,type:`changed`});return{oldSegments:r,newSegments:i}}var pc=/[\p{L}\p{N}_]/u;function mc(e){let t=e.map(e=>e.text).join(``);return t.length===0?e:_c(t,gc(t,hc(e,t.length)))}function hc(e,t){let n=new Uint8Array(t),r=0;for(let t of e)t.type===`changed`&&n.fill(1,r,r+t.text.length),r+=t.text.length;return n}function gc(e,t){let n=Uint8Array.from(t);for(let r=0;r<e.length;r++)if(t[r]&&pc.test(e[r])){if(r===0||!t[r-1])for(let t=r-1;t>=0&&pc.test(e[t]);t--)n[t]=1;if(r===e.length-1||!t[r+1])for(let t=r+1;t<e.length&&pc.test(e[t]);t++)n[t]=1}return n}function _c(e,t){let n=[],r=0;for(let i=1;i<=e.length;i++)i<e.length&&t[i]===t[r]||(n.push({text:e.slice(r,i),type:t[r]?`changed`:`same`}),r=i);return n}var vc=/^@@ -(\d+)(?:,(\d+))? \+(\d+)(?:,(\d+))? @@(.*)$/;function yc(e){let t=vc.exec(e);return t?{oldStart:parseInt(t[1],10),oldCount:t[2]===void 0?1:parseInt(t[2],10),newStart:parseInt(t[3],10),newCount:t[4]===void 0?1:parseInt(t[4],10),context:t[5].trim()}:null}function bc(e){return uc(e)}function xc(e){return Math.max(3,String(e).length)}function Sc(e,t){let n=0,r=0,i=0;for(let t of e)r+=t.text.length,t.type===`same`&&(n+=t.text.length);for(let e of t)i+=e.text.length;let a=r+i-n;return a!==0&&n/a>=.5}function Cc(e,t,n){let r=new Map,i=new Map,a=Math.min(e.length,t.length);for(let o=0;o<a;o++){let a=n(e[o]),s=n(t[o]);if(!a||!s||a.length>1e3||s.length>1e3)continue;let{oldSegments:c,newSegments:l}=fc(a,s);Sc(c,l)&&(r.set(o,mc(c)),i.set(o,mc(l)))}return{delSegments:r,addSegments:i}}function wc(e){let t=new Map,n=null;for(let r of e.lines){if(r.type===`header`&&r.content.startsWith(`diff --git`)){let e=bc(r.content);e===null?n=null:(n=t.get(e)??[],t.set(e,n))}n?.push(r)}let r=new Map;for(let[e,n]of t)r.set(e,{lines:n});return r}function Tc(e){return!(e.startsWith(`index `)||e.startsWith(`--- `)||e.startsWith(`+++ `)||e.startsWith(`similarity index`))}function Ec(e){return e.type!==`header`||Tc(e.content)}function Dc(e){return e.type===`addition`||e.type===`deletion`||e.type===`context`&&e.content.startsWith(` `)?e.content.slice(1):e.content}var Oc=/[\u0000-\u0008\u000b-\u001f\u007f]/g;function kc(e){return Dc(e).replace(Oc,``)}function Ac(e){let t=yc(e);if(!t)return{oldRange:``,newRange:``,context:``};let n=(e,t)=>t===1?`${e}`:`${e}-${e+t-1}`;return{oldRange:n(t.oldStart,t.oldCount),newRange:n(t.newStart,t.newCount),context:t.context}}function jc(e){let t=[],n=null,r=null,i=null,a=()=>(r||(r={filePath:null,notes:[],hunks:[]},t.push(r)),r);for(let o of e)if(o.type===`header`){i=null;let e=bc(o.content);e===null?(a().notes.push(o.content),o.content.startsWith(`Binary files`)?n={kind:`binary`,note:`Binary file — no text diff to show.`}:o.content.startsWith(`Large file — diff not shown`)&&(n={kind:`large`,note:o.content})):(r={filePath:e,notes:[],hunks:[]},t.push(r))}else o.type===`hunk`?(i={header:o,lines:[]},a().hunks.push(i)):i&&i.lines.push(o);return{sections:t,notShown:n}}function Mc(e){let t=2166136261;for(let n=0;n<e.length;n++)t^=e.charCodeAt(n),t=Math.imul(t,16777619);return(t>>>0).toString(36)}function Nc(e,t){return`${e?`s`:`u`}:${t??``}`}function Pc(e,t,n){let r=yc(t),i=`${e}#${Mc(`${e} ${r?`${r.context} ${r.oldStart}`:t}`)}`,a=n.get(i)??0;return n.set(i,a+1),a>0&&(i=`${i}~${a}`),i}function Fc(e,t,n){return t.oldLineNum===void 0?t.newLineNum===void 0?`${e}:r${n}`:`${e}:+${t.newLineNum}`:`${e}:${t.oldLineNum}`}function Ic(e,t,n,r,i){let a={kind:t,...e.oldLineNum!==void 0&&t!==`add`&&{oldLineNum:e.oldLineNum},...e.newLineNum!==void 0&&t!==`del`&&{newLineNum:e.newLineNum},content:kc(e),...i&&{segments:i}};return{key:Fc(n,a,r),...a}}function Lc(e,t,n,r){let i=t,a=[];for(;i<e.length&&e[i].type===`deletion`;)a.push(e[i++]);let o=i<e.length&&oc(e[i].content)?e[i++]:null,s=[];for(;i<e.length&&e[i].type===`addition`;)s.push(e[i++]);if(a.length===0&&s.length===0)return i+1;let c=Cc(a,s,kc);return a.forEach((e,t)=>{n.push(Ic(e,`del`,r,n.length,c.delSegments.get(t)))}),o&&n.push(Ic(o,`no-newline`,r,n.length)),s.forEach((e,t)=>{n.push(Ic(e,`add`,r,n.length,c.addSegments.get(t)))}),i}function Rc(e,t){let n=[],r=0;for(;r<e.length;){let i=e[r];oc(i.content)?(n.push(Ic(i,`no-newline`,t,n.length)),r++):i.type===`context`?(n.push(Ic(i,`context`,t,n.length)),r++):r=Lc(e,r,n,t)}return n}function zc(e,t){let n=e.editedAt;for(let e of t)e.editedAt!==void 0&&(n===void 0||e.editedAt>n)&&(n=e.editedAt);return n}function Bc(e){let t=0;for(let n of e)for(let e of n.hunks)for(let n of e.rows)t=Math.max(t,n.oldLineNum??0,n.newLineNum??0);return t}function Vc(e,t,n){let r=Nc(t,e.filePath),i={key:r,filePath:e.filePath,notes:e.notes,hunks:[]},a=new Map;for(let t of e.hunks){let e=Pc(r,t.header.content,a);i.hunks.push({key:e,index:n(),...Ac(t.header.content),raw:t.header.content,editedAt:zc(t.header,t.lines),rows:Rc(t.lines,e)})}return i}var Hc={staged:new WeakMap,unstaged:new WeakMap};function Uc(e,t){let n=t?Hc.staged:Hc.unstaged,r=n.get(e);if(r)return r;let i=Wc(e,t);return n.set(e,i),i}function Wc(e,t=!1){let n={sections:[],lineNumWidth:3,rowCount:0,notShown:null};if(!e)return n;let r=0,i=()=>r++,a=jc(e.lines.filter(Ec));n.notShown=a.notShown,n.sections=a.sections.map(e=>Vc(e,t,i));for(let e of n.sections)for(let t of e.hunks)n.rowCount+=t.rows.length,t.editedAt!==void 0&&(n.latestEditedAt===void 0||t.editedAt>n.latestEditedAt)&&(n.latestEditedAt=t.editedAt);return n.lineNumWidth=xc(Bc(n.sections)),n}var Gc={dark:{name:`dark`,displayName:`Dark`,colors:{addBg:`#022800`,delBg:`#3D0100`,addHighlight:`#044700`,delHighlight:`#5C0200`,text:`white`,addLineNum:`#368F35`,delLineNum:`#A14040`,contextLineNum:`gray`,addSymbol:`greenBright`,delSymbol:`redBright`}},light:{name:`light`,displayName:`Light`,colors:{addBg:`#69db7c`,delBg:`#ffa8b4`,addHighlight:`#2f9d44`,delHighlight:`#d1454b`,text:`black`,addLineNum:`#2f9d44`,delLineNum:`#d1454b`,contextLineNum:`#6c757d`,addSymbol:`green`,delSymbol:`red`}},"dark-colorblind":{name:`dark-colorblind`,displayName:`Dark (colorblind)`,colors:{addBg:`#004466`,delBg:`#660000`,addHighlight:`#0077b3`,delHighlight:`#b30000`,text:`white`,addLineNum:`#0077b3`,delLineNum:`#b30000`,contextLineNum:`gray`,addSymbol:`cyanBright`,delSymbol:`redBright`}},"light-colorblind":{name:`light-colorblind`,displayName:`Light (colorblind)`,colors:{addBg:`#99ccff`,delBg:`#ffcccc`,addHighlight:`#3366cc`,delHighlight:`#993333`,text:`black`,addLineNum:`#3366cc`,delLineNum:`#993333`,contextLineNum:`#6c757d`,addSymbol:`blue`,delSymbol:`red`}},"dark-ansi":{name:`dark-ansi`,displayName:`Dark (ANSI)`,colors:{addBg:`green`,delBg:`red`,addHighlight:`greenBright`,delHighlight:`redBright`,text:`white`,addLineNum:`greenBright`,delLineNum:`redBright`,contextLineNum:`gray`,addSymbol:`greenBright`,delSymbol:`redBright`}},"light-ansi":{name:`light-ansi`,displayName:`Light (ANSI)`,colors:{addBg:`green`,delBg:`red`,addHighlight:`greenBright`,delHighlight:`redBright`,text:`black`,addLineNum:`green`,delLineNum:`red`,contextLineNum:`gray`,addSymbol:`green`,delSymbol:`red`}}},Kc=[`dark`,`light`,`dark-colorblind`,`light-colorblind`,`dark-ansi`,`light-ansi`];function qc(e){return typeof e==`string`&&Kc.includes(e)}var Jc={dark:{...Gc.dark,scheme:`dark`,chrome:{bg:`#0d100f`,surface:`#131716`,surfaceRaised:`#1a1f1d`,border:`#242b28`,text:`#d7ded9`,textDim:`#859089`,accent:`#3fa53d`,selection:`#43b3bc`,add:`#3fa53d`,del:`#c25e5e`,warn:`#d2b23e`,statusModified:`#d2b23e`,statusAdded:`#3fa53d`,statusDeleted:`#c25e5e`,statusUntracked:`#859089`,statusRenamed:`#6f9fdd`,statusCopied:`#43b3bc`,statusConflicted:`#d98c4a`,uncommitted:`#c678dd`,flash:`#e5c94b`},syntax:{keyword:`#c678dd`,string:`#98c379`,comment:`#6e7a72`,number:`#d19a66`,literal:`#56b6c2`,title:`#61afef`,attr:`#e5c07b`,meta:`#859089`}},light:{...Gc.light,scheme:`light`,chrome:{bg:`#f5f6f5`,surface:`#fcfdfc`,surfaceRaised:`#eef1ee`,border:`#d7dcd8`,text:`#1d231f`,textDim:`#5d675f`,accent:`#2f9d44`,selection:`#0c7f8c`,add:`#247a36`,del:`#c03038`,warn:`#7a6300`,statusModified:`#9a7d00`,statusAdded:`#2f9d44`,statusDeleted:`#d1454b`,statusUntracked:`#6c757d`,statusRenamed:`#3b6fd4`,statusCopied:`#0c7f8c`,statusConflicted:`#b5561d`,uncommitted:`#9c36b5`,flash:`#eac54f`},syntax:{keyword:`#a626a4`,string:`#2f7d3b`,comment:`#6a737d`,number:`#b25e09`,literal:`#0184bc`,title:`#4078f2`,attr:`#986801`,meta:`#5d675f`}},"dark-colorblind":{...Gc[`dark-colorblind`],scheme:`dark`,chrome:{bg:`#0d0f11`,surface:`#131619`,surfaceRaised:`#191d21`,border:`#242a30`,text:`#d6dce2`,textDim:`#848f9a`,accent:`#2596d1`,selection:`#45b8c9`,add:`#2596d1`,del:`#d16060`,warn:`#d2b23e`,statusModified:`#d2b23e`,statusAdded:`#2596d1`,statusDeleted:`#d16060`,statusUntracked:`#848f9a`,statusRenamed:`#6f9fdd`,statusCopied:`#45b8c9`,statusConflicted:`#d55e00`,uncommitted:`#c678dd`,flash:`#e5c94b`},syntax:{keyword:`#c678dd`,string:`#56b6c2`,comment:`#7d8894`,number:`#d19a66`,literal:`#2596d1`,title:`#6f9fdd`,attr:`#e5c07b`,meta:`#848f9a`}},"light-colorblind":{...Gc[`light-colorblind`],scheme:`light`,chrome:{bg:`#f4f6f8`,surface:`#fcfdfe`,surfaceRaised:`#edf0f3`,border:`#d5dbe1`,text:`#1d2126`,textDim:`#5c6670`,accent:`#3366cc`,selection:`#0c7f8c`,add:`#3366cc`,del:`#993333`,warn:`#7a6300`,statusModified:`#9a7d00`,statusAdded:`#3366cc`,statusDeleted:`#993333`,statusUntracked:`#6c757d`,statusRenamed:`#3b6fd4`,statusCopied:`#0c7f8c`,statusConflicted:`#a8460b`,uncommitted:`#9c36b5`,flash:`#eac54f`},syntax:{keyword:`#9c36b5`,string:`#0c7f8c`,comment:`#6a737d`,number:`#b25e09`,literal:`#0184bc`,title:`#3b6fd4`,attr:`#986801`,meta:`#5c6670`}},"dark-ansi":{...Gc[`dark-ansi`],scheme:`dark`,chrome:{bg:`#000000`,surface:`#121212`,surfaceRaised:`#1c1c1c`,border:`#3a3a3a`,text:`#e5e5e5`,textDim:`#7f7f7f`,accent:`#00ff00`,selection:`#00cdcd`,add:`#00ff00`,del:`#ff0000`,warn:`#cdcd00`,statusModified:`#cdcd00`,statusAdded:`#00cd00`,statusDeleted:`#cd0000`,statusUntracked:`#7f7f7f`,statusRenamed:`#5c5cff`,statusCopied:`#00cdcd`,statusConflicted:`#ff8700`,uncommitted:`#cd00cd`,flash:`#ffff00`},syntax:{keyword:`#cd00cd`,string:`#00cd00`,comment:`#7f7f7f`,number:`#cdcd00`,literal:`#00cdcd`,title:`#5c5cff`,attr:`#cdcd00`,meta:`#7f7f7f`}},"light-ansi":{...Gc[`light-ansi`],scheme:`light`,chrome:{bg:`#ffffff`,surface:`#f5f5f5`,surfaceRaised:`#ebebeb`,border:`#c0c0c0`,text:`#000000`,textDim:`#7f7f7f`,accent:`#00a000`,selection:`#00a3a3`,add:`#007700`,del:`#cd0000`,warn:`#6e6e00`,statusModified:`#a0a000`,statusAdded:`#00a000`,statusDeleted:`#cd0000`,statusUntracked:`#7f7f7f`,statusRenamed:`#0000ee`,statusCopied:`#00a3a3`,statusConflicted:`#c85000`,uncommitted:`#cd00cd`,flash:`#ffff00`},syntax:{keyword:`#cd00cd`,string:`#00a000`,comment:`#7f7f7f`,number:`#a0a000`,literal:`#00a3a3`,title:`#0000ee`,attr:`#a0a000`,meta:`#7f7f7f`}}},Yc=[`changes`,`journal`,`history`,`compare`,`explorer`];function Xc(e){return typeof e==`string`&&Yc.includes(e)}function Zc(e){try{return decodeURIComponent(e)}catch{return e}}function Qc(e){return encodeURIComponent(e).split(`%2F`).join(`/`).split(`%3A`).join(`:`)}function $c(e){let t=new Map;for(let n of e.replace(/^\?/,``).split(`&`)){if(n===``)continue;let e=n.indexOf(`=`),r=e===-1?n:n.slice(0,e),i=e===-1?``:n.slice(e+1);t.set(Zc(r),Zc(i))}return t}var el={repo:null,view:null,at:null,base:null,head:null,whole:null};function tl(e,t=``){let n=e.split(`/`).filter(Boolean);if(n.length===0||!Xc(n[0]))return el;let r=n[0],i=n.slice(1),a=$c(t),o=a.get(`at`)??null,s=a.get(`base`)??null,c=a.get(`head`)||null,l=a.get(`whole`)||null;if(i.length===0)return{repo:null,view:r,at:o,base:s,head:c,whole:l};let u=i[0]===`~`;return{repo:{homeRelative:u,path:(u?i.slice(1):i).map(Zc).join(`/`)},view:r,at:o,base:s,head:c,whole:l}}function nl(e,t){let n=t!==null&&(e===t||e.startsWith(t+`/`)),r=(n?e.slice(t.length):e).split(`/`).filter(Boolean).map(e=>e===`~`?`%7E`:encodeURIComponent(e));return n?[`~`,...r]:r}function rl(e){if(e.repoPath===null)return`/`;let t=[];e.base!==null&&e.base!==void 0&&t.push(`base=${Qc(e.base)}`),e.head!==null&&e.head!==void 0&&e.head!==``&&t.push(`head=${Qc(e.head)}`),e.whole!==null&&e.whole!==void 0&&e.whole!==``&&t.push(`whole=${Qc(e.whole)}`),e.at!==null&&e.at!==void 0&&t.push(`at=${Qc(e.at)}`);let n=`/`+[e.view,...nl(e.repoPath,e.home??null)].join(`/`);return t.length===0?n:`${n}?${t.join(`&`)}`}var il={staged:!1,unstaged:!1,untracked:!1},al=`diffstalker:prefs`,ol=[`unified`,`split`];function sl(e){return typeof e==`string`&&ol.includes(e)}var cl=[`side-by-side`,`swipe`,`onion`];function ll(e){return typeof e==`string`&&cl.includes(e)}var ul=.15,dl=.65,fl=.1,pl=.6;function ml(){return{theme:null,activeView:`changes`,recentRepos:[],autoMode:!1,diffSyntax:!1,diffMode:`unified`,imageDiffMode:`side-by-side`,wrapEnabled:!1,changesSplit:null,changesTop:null,historyTop:null,compareTop:null,explorerTop:null,compareUncommitted:{...il}}}function hl(e,t,n){return typeof e!=`number`||!Number.isFinite(e)?null:e>=t&&e<=n?e:null}function gl(e){if(typeof e!=`object`||!e)return{...il};let{staged:t,unstaged:n,untracked:r}=e;return typeof t!=`boolean`||typeof n!=`boolean`||typeof r!=`boolean`||n&&!t?{...il}:{staged:t,unstaged:n,untracked:r}}var _l=[`changesTop`,`historyTop`,`compareTop`,`explorerTop`];function vl(e){let t=ml();if(typeof e!=`object`||!e)return t;let n=e;qc(n.theme)&&(t.theme=n.theme),Xc(n.activeView)&&(t.activeView=n.activeView),Array.isArray(n.recentRepos)&&(t.recentRepos=n.recentRepos.filter(e=>typeof e==`string`).slice(0,8)),typeof n.autoMode==`boolean`&&(t.autoMode=n.autoMode),typeof n.diffSyntax==`boolean`&&(t.diffSyntax=n.diffSyntax),sl(n.diffMode)&&(t.diffMode=n.diffMode),ll(n.imageDiffMode)&&(t.imageDiffMode=n.imageDiffMode),typeof n.wrapEnabled==`boolean`&&(t.wrapEnabled=n.wrapEnabled),t.changesSplit=hl(n.changesSplit,ul,dl);for(let e of _l)t[e]=hl(n[e],fl,pl);return t.compareUncommitted=gl(n.compareUncommitted),t}function yl(){let e;try{e=localStorage.getItem(al)}catch{return ml()}if(e===null)return ml();try{return vl(JSON.parse(e))}catch{return ml()}}function bl(e){let t={...yl(),...e};try{localStorage.setItem(al,JSON.stringify(t))}catch{}}var xl=20,Sl=1e3,Cl=6,wl=4,Tl=15;function El(e,t){if(e===t)return!0;if(e.lines.length!==t.lines.length)return!1;for(let n=0;n<e.lines.length;n++)if(e.lines[n].content!==t.lines[n].content||e.lines[n].type!==t.lines[n].type)return!1;return!0}function Dl(e){return`${e.staged?`s`:`u`}:${e.path}`}function Ol(e){return`${e.uncommitted??`c`}:${e.path}`}function kl(e,t){let n=e.layers.findIndex(e=>e.name===t);if(n===-1)return null;let r=e.layers[n];return{layer:r,base:n===0?e.trunk:e.layers[n-1].name,head:r.isHead?void 0:r.name}}var Al=`daemon connection lost — reconnecting…`;function jl(e){return Ls(e)?Al:Rs(e)}function Ml(){return{status:null,hunkCounts:null,stashList:[],operationInProgress:null,mtimes:null,error:null,isLoading:!0}}function Nl(){return{file:null}}function Pl(){return{commits:[],selectedCommit:null,commitFiles:null,isLoading:!1}}function Fl(){return{compareDiff:null,pair:null,baseBranch:null,commitCount:null,loading:!1,error:null,noBaseBranch:!1,selection:{type:null,index:0,diff:null}}}var Il=Ps(`repo`,()=>{let e=new Xs,t=ic(),n=H(null),r=H(null),i=H(Ml()),a=H({byKey:new Map,seq:0}),o=H(new Map),s=H(Nl()),c=H(Pl()),l=H([]),u=H(null),d=H(0),f=H(!1),p=H(!1),m=H(Fl()),h=H(null),g=H(null),_=H(yl().compareUncommitted),v=H(null),y=H(null),b=null,x=H(!1),S=H(null),C=0,w=$(()=>n.value!==null),T=0,E=null,D=null,O=null,k=!1,A=null,j=!1,M=!1,N=!1,P=0,F=null,I=[],L=100,ee=0,R=0,te=!1,ne=!1,re=0,ie=0,ae=new Map,oe=new Set,se=[],ce=0,le=new Map,ue=null,de=null;function fe(){O&&=(clearTimeout(O),null),ue&&=(clearTimeout(ue),null)}function pe(){fe(),k=!1,D=null,j=!1,M=!1,N=!1,P=0,F=null,I=[],L=100,te=!1,de=null,ae.clear(),le.clear(),oe.clear(),se.length=0,i.value=Ml(),a.value={byKey:new Map,seq:0},o.value=new Map,s.value=Nl(),c.value=Pl(),l.value=[],u.value=null,d.value=0,f.value=!1,p.value=!1,m.value=Fl(),h.value=null,g.value=null,v.value=null,y.value=null,x.value=!1,S.value=null,b=null,C++}async function z(a){let o=++T;E??=n.value;try{let t=await e.openRepo(a);return o===T?(E!==null&&me(E),pe(),E=t.id,n.value=t.id,r.value=t.path,he(),t):(me(t.id),null)}catch(e){return o===T?Ls(e)?(pe(),t.detachRepo(),n.value=null,r.value=a,ve(),null):(Zs(`open repo`,e,{path:a}),i.value={...i.value,error:Rs(e),isLoading:!1},null):null}}function me(t){e.closeRepo(t).catch(e=>Qs(`release repo`,e,{id:t}))}function he(){let e=n.value;e!==null&&t.attachRepo(e,{onSnapshot:e=>B(e),onStateChange:e=>B(e),onJournalAppend:e=>at(e),onResume:()=>void dt(),onMissing:({id:e})=>{e===n.value&&ve()},onError:()=>ve()})}async function ge(){let r=++T;t.detachRepo(),fe(),k=!1;let i=n.value??E;if(E=null,i!==null){if(await e.closeRepo(i).catch(e=>{Qs(`release repo`,e,{id:i})}),r!==T)return;n.value=null}}function _e(){let t=E;t!==null&&(E=null,e.releaseRepoOnUnload(t))}function ve(){D=null,i.value.error!==`daemon connection lost — reconnecting…`&&(console.warn(`diffstalker: daemon connection lost; reconnecting`,{path:r.value}),i.value={...i.value,error:Al,isLoading:!1}),be()}function ye(e,t){return t===T?Ls(e)?(ve(),!0):!1:!0}function be(){k||O||(O=setTimeout(()=>{O=null,xe()},Sl))}async function xe(){let i=r.value;if(k||i===null)return;k=!0;let a=T;try{let r=await e.openRepo(i);if(a!==T)return;E??=r.id,n.value=r.id,t.trackActive(r),he();let o=await e.status(r.id);if(a!==T)return;B(o),dt()}catch(e){Se(e,i),k=!1,a===T&&be();return}k=!1,A=null}function Se(e,t){if(Ls(e))return;let n=`${e instanceof Is?e.status:``} ${Rs(e)}`;n!==A&&(A=n,Zs(`recover repo`,e,{path:t}))}function B(e){re+=1;let t=de;de=Pe(e),i.value={status:e.status,hunkCounts:e.hunkCounts,stashList:e.stashList,operationInProgress:e.operationInProgress,mtimes:e.mtimes,error:we(e),isLoading:!1},Ne();let n=Ge(t,de);Qe(n),te?We(n):Re(),c.value.commits.length>0&&tt(),(m.value.compareDiff!==null||m.value.error!==null)&&!m.value.loading?bt():ht()}function Ce(e){i.value={...i.value,error:e}}function we(e){return e.error===null?(D!==null&&Te(D,e)&&(D=null),D?.message??null):(D=null,e.error)}function Te(e,t){let n=t.status?.files;return n?!n.some(t=>t.path===e.path&&t.staged!==e.staged):!1}function Ee(e,t,n){let r=`Could not ${t?`stage`:`unstage`} ${e}: ${n}`;D={message:r,path:e,staged:t},i.value={...i.value,error:r}}function De(){let e=D;D=null,e!==null&&i.value.error===e.message&&(i.value={...i.value,error:null})}async function Oe(t,r){let i=n.value;if(i===null)return;let a=T;De();try{r?await e.stage(i,t):await e.unstage(i,t)}catch(e){if(ye(e,a))return;Zs(r?`stage file`:`unstage file`,e,{path:t}),Ee(t,r,Rs(e))}}function ke(e){return Oe(e,!0)}function Ae(e){return Oe(e,!1)}async function je(e,t){let n=T;try{return await e()}catch(e){if(ye(e,n))return t;throw e}}function Me(e){s.value={file:e}}function Ne(){let e=s.value.file,t=i.value.status;if(!e||!t)return;let n=t.files.find(t=>t.path===e.path&&t.staged===e.staged)??t.files.find(t=>t.path===e.path);s.value=n?{file:n}:Nl()}function Pe(e){return{files:new Map((e.status?.files??[]).map(e=>[Dl(e),e])),mtimes:e.mtimes,hunkCounts:e.hunkCounts}}function Fe(e){let t=a.value,n=new Map(t.byKey);e(n)&&(a.value={byKey:n,seq:t.seq+1})}function Ie(e,t,n){if((ae.get(e)??0)>t||de!==null&&!de.files.has(e))return;ae.set(e,t);let r=a.value.byKey.get(e);r&&El(r.diff,n)||Fe(t=>(t.set(e,{diff:Yt(n),fetchedAt:Date.now()}),!0))}async function Le(t){let r=n.value;if(r===null||t.length===0)return;let i=T,a=[...t],o=!1,s=null,c=async()=>{for(;;){let t=a.shift();if(!t||o||i!==T)return;let n=Dl(t),c=++ie;try{let a=t.status===`untracked`?await e.diff(r,{path:t.path}):await e.diff(r,{path:t.path,staged:t.staged});if(i!==T)return;Ie(n,c,a)}catch(e){if(ye(e,i)){o=!0;return}Zs(`load diff`,e,{path:t.path,staged:t.staged}),s??=Rs(e)}}},l=Array.from({length:Math.min(Cl,a.length)},()=>c());await Promise.all(l),s!==null&&!o&&i===T&&Ce(`Failed to load diffs: ${s}`)}async function Re(){if(ne||n.value===null)return;ne=!0;let e=T,t=de,r=re;try{await ze({quiet:!0})}finally{ne=!1}e===T&&te&&de!==null&&re!==r&&We(Ge(t,de))}async function ze(t={}){let r=n.value;if(r===null)return;let a=T,o=++ie,s,c;try{[s,c]=await Promise.all([e.diff(r,{}),e.diff(r,{staged:!0})])}catch(e){if(ye(e,a))return;Zs(`load diffs`,e),t.quiet||Ce(`Failed to load diffs: ${Rs(e)}`);return}if(a!==T)return;te=!0;let l=i.value.status?.files??[],u=new Set(l.map(Dl));Fe(e=>{let t=Be(e,`u`,wc(s),u,o);t=Be(e,`s`,wc(c),u,o)||t;for(let n of[...e.keys()])u.has(n)||(e.delete(n),ae.delete(n),t=!0);return t}),await Le(l.filter(e=>e.status===`untracked`))}function Be(e,t,n,r,i){let a=!1;for(let[o,s]of n){let n=`${t}:${o}`;if(!r.has(n)||(ae.get(n)??0)>i)continue;ae.set(n,i);let c=e.get(n);c&&El(c.diff,s)||(e.set(n,{diff:Yt(s),fetchedAt:Date.now()}),a=!0)}return a}function Ve(t,n){if(n.view===`history`)return e.commitDiff(t,n.hash,{path:n.path,whole:!0});if(n.view===`compare`){let r=m.value.pair;return r===null?Promise.reject(Error(`No compare is loaded`)):e.compareFileDiff(t,{path:n.path,base:r.base,head:r.head??void 0,uncommitted:n.side,whole:!0})}let r=de?.files.get(n.key);return e.diff(t,{path:r?.path??n.path,staged:r?.staged??!1,whole:!0})}async function He(e){let t=n.value,r=++C;if(b=e,e===null||t===null){y.value=null,x.value=!1,S.value=null;return}let i=e.key;if(e.view===`changes`){let e=de?.files.get(i);if(!e||e.status===`untracked`){y.value=null,x.value=!1,S.value=null;return}}S.value=null,y.value=null,x.value=!0;let a=T;try{let n=await Ve(t,e);if(a!==T||r!==C)return;if(ac(n)){S.value={key:i,reason:`Too large to show whole — the hunks are all of it that fits`};return}y.value={key:i,path:e.path,diff:Yt(n)}}catch(t){if(r!==C||ye(t,a))return;Zs(`load whole file`,t,{path:e.path}),Ce(`Failed to load whole file: ${Rs(t)}`)}finally{a===T&&r===C&&(x.value=!1)}}function Ue(e){let t=b;t!==null&&y.value!==null&&t.view===`changes`&&(de!==null&&!de.files.has(t.key)?He(null):e.some(e=>Dl(e)===t.key)&&He(t))}function We(e){let t=de;if(t===null)return;let n=[...a.value.byKey.keys()].filter(e=>!t.files.has(e));n.length>0&&Fe(e=>{for(let t of n)e.delete(t),ae.delete(t);return!0});for(let e of[...le.keys()])t.files.has(e)||le.delete(e);Ue(e),e.length!==0&&(e.length>Tl?(le.clear(),ze()):qe(e))}function Ge(e,t){let n=[];for(let[r,i]of t.files){let a=e?.files.get(r);if(!a){n.push(i);continue}let o=t.mtimes?.[i.path]!==e?.mtimes?.[i.path],s=Ke(t.hunkCounts,i)!==Ke(e?.hunkCounts??null,i);(o||s||a.status!==i.status)&&n.push(i)}return n}function Ke(e,t){return e?(t.staged?e.staged:e.unstaged)[t.path]??0:0}function qe(e){for(let t of e)le.set(Dl(t),t);ue||=setTimeout(()=>{ue=null;let e=[...le.values()];le.clear(),Le(e)},xl)}function Je(e,t){let r=Dl(e);return n.value===null||oe.has(r)?Promise.resolve():(oe.add(r),new Promise(n=>{se.push({key:r,path:e.path,staged:t,settle:n}),Ye()}))}function Ye(){for(;ce<wl&&se.length>0;)ce+=1,Xe()}async function Xe(){try{for(;;){let e=se.shift();if(e===void 0)return;try{await Ze(e)}finally{e.settle()}}}finally{--ce}}async function Ze(t){let r=n.value;if(r===null)return;let i=T;try{let n=await e.media(r,t.path,t.staged);if(i!==T||!oe.has(t.key))return;let a=new Map(o.value);a.set(t.key,Yt(n)),o.value=a}catch(e){if(i!==T||(oe.delete(t.key),ye(e,i)))return;Zs(`load image metadata`,e,{path:t.path}),Ce(`Failed to load image metadata: ${Rs(e)}`)}}function Qe(e){let t=de;if(t===null)return;let n=[...o.value.keys()].filter(e=>!t.files.has(e));for(let e of n)oe.delete(e);if(n.length>0){let e=new Map(o.value);for(let t of n)e.delete(t);o.value=e}for(let t of e)oe.delete(Dl(t))}function $e(e,t){return Uc(e,t)}async function et(t=100){let r=n.value;if(r===null)return;let i=T;L=t,c.value={...c.value,isLoading:!0};try{let n=await e.history(r,t);if(i!==T)return;let a=c.value.selectedCommit,o=a===null?null:n.find(e=>e.hash===a.hash)??null;c.value={commits:n,selectedCommit:o,commitFiles:o===null?null:c.value.commitFiles,isLoading:!1}}catch(e){if(i!==T||(c.value={...c.value,isLoading:!1},ye(e,i)))return;throw e}}async function tt(){if(!j){j=!0;try{await et(L)}catch(e){Zs(`reload history`,e)}finally{j=!1}}}async function nt(t){let r=n.value;if(r===null)return null;let i=T;try{let n=await e.getCommit(r,t);return i===T?n:null}catch(e){return ye(e,i),null}}async function rt(t){let r=t&&(c.value.commits.find(e=>e.hash===t.hash)??t);c.value={...c.value,selectedCommit:r,commitFiles:null};let i=n.value;if(!r||i===null)return;let a=T,o=await je(()=>e.commitFiles(i,r.hash),null);o!==null&&a===T&&c.value.selectedCommit?.hash===r.hash&&(c.value={...c.value,commitFiles:o})}function it(e,t){let n=new Map(e.map(e=>[e.seq,e])),r=!1;for(let e of t)n.has(e.seq)||(n.set(e.seq,e),r=!0);return r?[...n.values()].sort((e,t)=>e.seq-t.seq):e}function at(e){f.value?e.epoch===u.value?ot(e.entries):(I.push(e),lt()):(F!==null&&F!==e.epoch&&(l.value=[]),F=e.epoch,ot(e.entries))}function ot(e){let t=l.value,n=t.at(-1)?.seq??0,r=e.filter(e=>e.seq>n).sort((e,t)=>e.seq-t.seq);r.length!==0&&(l.value=[...t,...r])}function st(e){l.value=e.entries,u.value=e.epoch,d.value=e.prunedBefore,P=e.entries.at(-1)?.seq??e.prunedBefore,p.value=!0}function ct(){let e=I;I=[];for(let t of e){if(t.epoch!==u.value)continue;let e=it(l.value,t.entries);e!==l.value&&(l.value=e)}}async function lt(){let t=n.value;if(t===null||N)return;N=!0;let r=T;try{let n=await e.journal(t);if(r!==T)return;st(n),ct()}catch(e){ye(e,r)||Zs(`reload journal`,e)}finally{N=!1}}async function ut(){let t=n.value;if(t===null||f.value||M)return;M=!0;let r=T;try{let n=await e.journal(t);if(r!==T)return;F!==null&&F!==n.epoch?l.value=n.entries:l.value=it(l.value,n.entries),F=null,u.value=n.epoch,d.value=n.prunedBefore,P=n.entries.at(-1)?.seq??n.prunedBefore,f.value=!0}catch(e){if(ye(e,r))return;throw e}finally{M=!1}}async function dt(){let t=n.value;if(t===null||N)return;if(!f.value){l.value.length>0&&(l.value=[]),F=null;return}N=!0;let r=T,i=P;try{let n=await e.journal(t,i);if(r!==T)return;if(n.epoch!==u.value||n.prunedBefore>i){let n=await e.journal(t);if(r!==T)return;st(n),ct();return}let a=it(l.value,n.entries);a!==l.value&&(l.value=a),n.prunedBefore!==d.value&&(d.value=n.prunedBefore);let o=n.entries.at(-1)?.seq;o!==void 0&&o>P&&(P=o)}catch(e){ye(e,r)||Zs(`resync journal`,e)}finally{N=!1}ft(r)}function ft(e){e===T&&I.length!==0&&lt()}async function pt(e){_.value={...e},bl({compareUncommitted:_.value}),await bt()}function mt(e,t){let n=e.selection;if(n.type!==`file`)return n;let r=e.compareDiff?.files[n.index]?.path,i=r===void 0?-1:t.files.findIndex(e=>e.path===r);return i===-1?{type:null,index:0,diff:null}:{type:`file`,index:i,diff:t.files[i].diff}}async function ht(){let t=n.value;if(t===null)return;let r=T,i=++R,a=gt();if(a===null)m.value={...m.value,commitCount:null};else try{let{commits:n}=await e.compareCount(t,a);if(r!==T||i!==R)return;m.value={...m.value,commitCount:n}}catch(e){if(r!==T||i!==R)return;if(e instanceof Is&&e.status===422){m.value={...m.value,commitCount:null};return}Qs(`count compare commits`,e)}}function gt(){let e=g.value;if(e===null)return{base:h.value??void 0,head:void 0};let t=v.value;if(t===null)return null;let n=kl(t,e);return n===null?null:{base:n.base,head:n.head}}function _t(e){return e instanceof Is&&e.status===422||Qs(`load compare stack`,e,{base:h.value}),null}async function vt(t,n,r){let[i,a]=await Promise.all([e.compareStack(t,{base:n}).catch(_t),e.compare(t,{base:n,...r})]);return{stack:i,diff:a,head:void 0,uncommitted:r}}async function yt(t,n,r,i,a){let o=await e.compareStack(t,{base:n});if(a())return null;let s=kl(o,r);if(s===null)return xt(r,o),null;let c=s.head===void 0;return{stack:o,diff:await e.compare(t,{base:s.base,head:s.head,...c?i:{}}),head:s.head,uncommitted:c?i:il}}async function bt(){let e=_.value,t=n.value;if(t===null)return;let r=T,i=++ee,a=()=>r!==T||i!==ee;m.value={...m.value,loading:!0,error:null,noBaseBranch:!1};let o=h.value??void 0,s=g.value;try{let n=s===null?await vt(t,o,e):await yt(t,o,s,e,a);if(n===null||a())return;let{stack:r,diff:i}=n;R+=1,v.value=r,m.value={...m.value,compareDiff:i,pair:{base:i.baseBranch,head:n.head??null,uncommitted:n.uncommitted},baseBranch:s===null||r===null?i.baseBranch:r.trunk,commitCount:i.commits.length,loading:!1,noBaseBranch:!1,selection:mt(m.value,i)}}catch(e){if(a())return;St(e)}}function xt(e,t){let n=`${e} is not a layer of this stack`;Zs(`compare`,Error(n),{head:e,layers:t.layers.map(e=>e.name)}),R+=1,v.value=t,m.value={...m.value,compareDiff:null,pair:null,baseBranch:t.trunk,commitCount:null,loading:!1,error:n,noBaseBranch:!1,selection:{type:null,index:0,diff:null}}}function St(e){Ls(e)?(m.value={...m.value,loading:!1},ve()):e instanceof Is&&e.status===422?m.value={...m.value,compareDiff:null,pair:null,baseBranch:null,commitCount:null,loading:!1,error:null,noBaseBranch:!0}:(Zs(`compare`,e,{base:h.value}),m.value={...m.value,loading:!1,error:`Failed to load compare diff: ${Rs(e)}`})}async function Ct(){let t=n.value;return t===null?[]:je(()=>e.baseBranches(t),[])}function wt(e){return Et({base:e,head:null})}function Tt(e){return Et({head:e})}async function Et(e){e.base!==void 0&&(h.value=e.base),g.value=e.head,await bt()}let Dt=$(()=>{let e=g.value,t=v.value;return e===null||t===null?null:kl(t,e)}),Ot=$(()=>Dt.value?.layer??null),kt=$(()=>{let e=m.value.pair;return e===null?{base:m.value.baseBranch,head:null}:{base:e.base,head:e.head}});function At(e){let t=m.value.compareDiff;!t||e<0||e>=t.files.length?m.value={...m.value,selection:{type:null,index:0,diff:null}}:m.value={...m.value,selection:{type:`file`,index:e,diff:t.files[e].diff}}}return{repoId:n,repoPath:r,isRepo:w,shared:i,workingDiffs:a,wholeFile:y,wholeFileLoading:x,wholeFileRefusal:S,mediaMeta:o,selection:s,history:c,journalEntries:l,journalEpoch:u,journalPrunedBefore:d,journalLoaded:f,journalRestarted:p,compare:m,selectedCompareBase:h,selectedStackHead:g,compareUncommitted:_,compareStack:v,pickedLayer:Ot,comparePair:kt,open:z,dispose:ge,releaseOnUnload:_e,stageFile:ke,unstageFile:Ae,selectFile:Me,refreshAllDiffs:ze,setWholeFile:He,diffModelFor:$e,ensureMedia:Je,loadHistory:et,resolveCommit:nt,selectHistoryCommit:rt,loadJournal:ut,refreshCompare:bt,refreshCompareCount:ht,setCompareUncommitted:pt,getCandidateBaseBranches:Ct,setSelectedCompareBase:wt,setSelectedStackHead:Tt,setComparePick:Et,selectCompareFile:At}}),Ll=Ps(`explorer`,()=>{let e=Il(),t=new Xs,n=H(new Map),r=H(new Set),i=H(new Set),a=H(!1),o=H(!1),s=H(null),c=H(!1),l=H(!1),u=H(!1),d=H(null),f=H(null),p=H(null),m=H(!1),h=H(null),g=0,_=0,v=null;function y(){g++,_++,v=null,n.value=new Map,r.value=new Set,i.value=new Set,a.value=!1,o.value=!1,s.value=null,d.value=null,f.value=null,p.value=null,m.value=!1,h.value=null}W(()=>e.repoId,()=>y());function b(e){Qs(`load explorer tree`,e),s.value=jl(e)}function x(n){let r=e.repoId;return r===null?Promise.resolve([]):t.tree(r,{dir:n,hidden:c.value,ignored:l.value})}async function S(e,t){let n=await x(t);e.set(t,n);for(let t of n)t.type===`dir`&&r.value.has(t.path)&&await S(e,t.path)}async function C(){if(e.repoId===null)return!0;_++;let t=_;o.value=!0,s.value=null;try{let e=new Map;return await S(e,``),t===_&&(n.value=e,a.value=!0),!0}catch(e){return t!==_||(b(e),!1)}finally{t===_&&(o.value=!1)}}async function w(){a.value||(v??=C().finally(()=>{v=null}),await v)}async function T(){await C()}async function E(e){let t=_;i.value=new Set([...i.value,e]);try{let r=await x(e);if(t!==_)return!1;let i=new Map(n.value);return i.set(e,r),n.value=i,s.value=null,!0}catch(n){if(t!==_)return!1;let i=new Set(r.value);return i.delete(e),r.value=i,b(n),!1}finally{let t=new Set(i.value);t.delete(e)&&(i.value=t)}}async function D(e){if(r.value.has(e)){let t=new Set(r.value);t.delete(e),r.value=t}else r.value=new Set([...r.value,e]),(n.value.has(e)||await E(e))&&await O(e)}async function O(e){let t=e;for(;;){let e=n.value.get(t);if(e===void 0||e.length!==1||e[0].type!==`dir`)return;let i=e[0].path;if(r.value.has(i)||(r.value=new Set([...r.value,i])),!n.value.has(i)&&!await E(i))return;t=i}}function k(e){if(!r.value.has(e))return;let t=new Set(r.value);t.delete(e),r.value=t}async function A(e){c.value!==e&&(c.value=e,await C()||(c.value=!e))}async function j(e){l.value!==e&&(l.value=e,await C()||(l.value=!e))}function M(e){u.value=e}async function N(n){let r=e.repoId;if(r===null)return;let i=g;d.value=n,h.value=null,m.value=!0;try{let e=await t.file(r,n);if(i!==g||d.value!==n)return;f.value=e,p.value=null}catch(e){if(i!==g||d.value!==n)return;Qs(`load file`,e,{path:n}),f.value=null,p.value=null,h.value=jl(e)}finally{i===g&&d.value===n&&(m.value=!1)}}async function P(){let n=e.repoId,r=d.value;if(n===null||r===null)return;let i=g;try{let e=await t.file(n,r,{symbols:!0});if(i!==g||d.value!==r)return;f.value=e,p.value=e.symbols??null}catch(e){if(i!==g||d.value!==r)return;Qs(`load file outline`,e,{path:r}),h.value=jl(e),p.value={status:`unavailable`,reason:`error`}}}async function F(e,t,r){let i=n.value.get(e)?.find(e=>e.path===t);return i===void 0?l.value||(await j(!0),r!==g||!l.value)?null:n.value.get(e)?.find(e=>e.path===t)??null:i}let I=H(null),L=0;function ee(e){L+=1,I.value={line:e,seq:L}}async function R(t,n={}){if(e.repoId===null)return;let r=g,i=n.line;if(!c.value&&t.split(`/`).some(e=>e.startsWith(`.`))&&(await A(!0),r!==g||!c.value)||(await w(),r!==g||!a.value))return;let o=t.split(`/`),s=``;for(let e=0;e<o.length;e++){let n=s===``?o[e]:`${s}/${o[e]}`,a=await te(s,n,e===o.length-1,r);if(a===`done`&&i!==void 0&&r===g&&d.value===t&&ee(i),a!==`descend`)return;s=n}r===g&&await O(s)}async function te(e,t,i,a){let o=await F(e,t,a);if(o===null||a!==g)return`bail`;if(o.type!==`dir`)return i&&await N(t),`done`;if(r.value.has(t)||(r.value=new Set([...r.value,t])),!n.value.has(t)){let e=await E(t);if(a!==g||!e)return`bail`}return`descend`}function ne(){d.value=null,f.value=null,p.value=null,h.value=null,m.value=!1}function re(e){return u.value?e.type===`dir`?e.hasChanges===!0:e.gitStatus!==void 0:!0}return{rows:$(()=>{let e=[],t=(a,o)=>{for(let s of n.value.get(a)??[]){let a=s,c=s.name;if(s.type===`dir`)for(;;){let e=n.value.get(a.path);if(e===void 0||e.length!==1||e[0].type!==`dir`)break;a=e[0],c=`${c}/${a.name}`}if(!re(a))continue;let l=a.type===`dir`&&r.value.has(a.path);e.push({entry:a,displayName:c,depth:o,isExpanded:l,isLoading:i.value.has(a.path)}),l&&t(a.path,o+1)}};return t(``,0),e}),rootLoaded:a,rootLoading:o,error:s,showHidden:c,showIgnored:l,changedOnly:u,selectedPath:d,file:f,fileLoading:m,fileError:h,fileSymbols:p,lineRequest:I,ensureRoot:w,refresh:T,toggleDir:D,collapseDir:k,setShowHidden:A,setShowIgnored:j,setChangedOnly:M,openFile:N,loadSymbols:P,revealFile:R,requestLine:ee,clearSelection:ne}}),Rl=[{name:`changes`,label:`Changes`},{name:`journal`,label:`Journal`},{name:`history`,label:`History`},{name:`compare`,label:`Compare`},{name:`explorer`,label:`Explorer`}],zl=new Set([`finder`,`search`]);function Bl(){return typeof window<`u`&&typeof window.matchMedia==`function`&&window.matchMedia(`(prefers-color-scheme: light)`).matches?`light`:`dark`}function Vl(e){document.documentElement.dataset.theme=e}var Hl=Ps(`ui`,()=>{let e=yl(),t=H(e.theme??Bl()),n=H(e.activeView),r=H(e.recentRepos),i=H(null),a=H(e.autoMode),o=H(e.diffSyntax),s=H(e.diffMode),c=H(e.imageDiffMode),l=H(e.wrapEnabled),u=H(null),d=null,f=H(null);function p(){Vl(t.value)}function m(e){t.value=e,Vl(e),bl({theme:e})}function h(e){n.value=e,bl({activeView:e})}function g(e){let t=[e,...r.value.filter(t=>t!==e)].slice(0,8);r.value=t,bl({recentRepos:t})}function _(){a.value=!a.value,bl({autoMode:a.value})}function v(){o.value=!o.value,bl({diffSyntax:o.value})}function y(){s.value=s.value===`split`?`unified`:`split`,bl({diffMode:s.value})}function b(e){c.value=e,bl({imageDiffMode:e})}function x(){l.value=!l.value,bl({wrapEnabled:l.value})}function S(e){u.value=e,d&&clearTimeout(d),d=setTimeout(()=>{u.value=null,d=null},900)}function C(e){f.value=e}let w=H(null),T=0;function E(e){T+=1,w.value={key:e,seq:T}}let D=H(0);function O(){D.value+=1}let k=H(0);function A(){k.value+=1}let j=H(``);function M(e){j.value=e}function N(e){(e===null||!zl.has(e))&&(j.value=``),i.value=e}function P(e){N(e)}function F(e){N(i.value===e?null:e)}function I(){N(null)}return{theme:t,activeView:n,recentRepos:r,activeOverlay:i,autoModeEnabled:a,diffSyntaxEnabled:o,diffMode:s,imageDiffMode:c,wrapEnabled:l,flashedFile:u,activeStackKey:f,stackScrollRequest:w,expandGatedRequest:D,outlineRequest:k,overlayQuery:j,setOverlayQuery:M,init:p,setTheme:m,setActiveView:h,addRecentRepo:g,toggleAutoMode:_,toggleDiffSyntax:v,toggleDiffMode:y,setImageDiffMode:b,toggleWrap:x,flashFile:S,setActiveStackKey:C,requestStackScroll:E,requestExpandGated:O,requestOutline:A,openOverlay:P,toggleOverlay:F,closeOverlay:I}});function Ul(){let e=ic(),t=Il(),n=Hl();async function r(r){let i=r.trim();if(!i)return!1;let a=await t.open(i);return a?(e.trackActive(a),n.addRecentRepo(a.path),!0):!1}async function i(r){let i=await t.open(r.path);i&&(e.trackActive(i),n.addRecentRepo(i.path))}return{openByPath:r,activate:i}}function Wl(e){let t=e.split(`/`).filter(Boolean);return t[t.length-1]??e}function Gl(e){let t=e.length;for(;t>1&&e[t-1]===`/`;)t--;return e.slice(0,t)}function Kl(e){let t=Gl(e),n=t.lastIndexOf(`/`);return n<=0?`/`:t.slice(0,n)}function ql(e){return e<1024?`${e} B`:e<1048576?`${(e/1024).toFixed(1)} KB`:`${(e/1048576).toFixed(1)} MB`}function Jl(e){switch(e){case`modified`:return`M`;case`added`:return`A`;case`deleted`:return`D`;case`untracked`:return`?`;case`renamed`:return`R`;case`copied`:return`C`;case`conflicted`:return`U`}}function Yl(e){return String(e).padStart(2,`0`)}function Xl(e,t){let n=new Date(e),r=new Date(t),i=`${Yl(n.getHours())}:${Yl(n.getMinutes())}`,a=n.getFullYear()===r.getFullYear();if(a&&n.getMonth()===r.getMonth()&&n.getDate()===r.getDate())return i;let o=a?{month:`short`,day:`numeric`}:{month:`short`,day:`numeric`,year:`numeric`};return`${n.toLocaleDateString(`en-US`,o)} ${i}`}function Zl(e){let t=e.lastIndexOf(`/`);return t===-1?{head:``,tail:e}:{head:e.slice(0,t),tail:e.slice(t)}}var Ql=3e3,$l=400,eu=1e3,tu=null;function nu(e={}){tu={...e,expires:Date.now()+Ql,used:!1}}function ru(e={}){let t=ic(),n=Ll(),r=Il(),i=Hl(),a=new Xs,o=V(null),s=!1,c=l();async function l(){for(;;)try{let e=await a.health();o.value=e.home??null;return}catch(e){if(!Ls(e)){Zs(`load daemon home`,e);return}if(await $s(eu),s)return}}let u=typeof window>`u`?el:tl(window.location.pathname,window.location.search);typeof window<`u`&&`scrollRestoration`in window.history&&(window.history.scrollRestoration=`manual`);function d(e){return e.homeRelative?o.value===null?`/${e.path}`:`${o.value}/${e.path}`:`/${e.path}`}let f=$(()=>r.repoId===null?null:r.repoPath);function p(e){return f.value!==null&&d(e)===f.value}function m(){switch(i.activeView){case`changes`:return i.activeStackKey;case`history`:return r.history.selectedCommit?.shortHash??null;case`compare`:{let{selection:e,compareDiff:t}=r.compare;return e.type!==`file`||!t?null:t.files[e.index]?.path??null}case`explorer`:return n.selectedPath;default:return null}}function h(e,t){return e===`changes`?t.slice(t.indexOf(`:`)+1):e===`compare`?t:null}function g(e,t,n){return n===null?!1:e===`history`||t!==null&&h(e,t)===n}function _(){let e=f.value,t=i.activeView,n=e===null?null:m(),a=e!==null&&t===`compare`?r.selectedCompareBase:null,s=e!==null&&t===`compare`?r.selectedStackHead:null,c=r.wholeFile?.path??null,l=g(t,n,c)?c:null;return e===null?{url:`/`,repoPath:null,view:t,at:null,base:null,head:null,whole:null}:{url:rl({view:t,repoPath:e,home:o.value,at:n,base:a,head:s,whole:l}),repoPath:e,view:t,at:n,base:a,head:s,whole:l}}function v(e){let t=[];return e.at!==null&&t.push(e.whole===null?e.at:`${e.at} (whole)`),t.push(e.view),e.repoPath!==null&&t.push(Wl(e.repoPath)),t.filter(Boolean).join(` — `)||`diffstalker`}let y=null,b=!1,x=null,S=0,C=null;function w(){return tu===null?null:tu.expires<=Date.now()?(tu=null,null):tu}function T(e,t){return!(e.view!==void 0&&e.view!==t.view||e.repo!==void 0&&e.repo!==t.repoPath)}function E(e){return y!==null&&y.repoPath===e.repoPath&&y.view===e.view&&y.base===e.base&&y.head===e.head&&y.whole===e.whole}function D(e){if(y===null||b)return`replace`;let t=w();return t!==null&&T(t,e)?t.used?`replace`:(t.used=!0,x={repoPath:e.repoPath,view:e.view},`push`):x!==null&&(x.repoPath!==e.repoPath||x.view!==e.view)?(x=null,`push`):E(e)?`defer`:`replace`}function O(){C!==null&&(clearTimeout(C),C=null)}function k(){if(typeof window>`u`||r.repoId!==t.activeRepoId)return;let e=_();if(document.title=v(e),e.url===window.location.pathname+window.location.search){y=e;return}if(e.repoPath===null&&y===null)return;let n=D(e);n===`defer`?C===null&&(C=setTimeout(()=>{C=null,A(_(),`replace`)},$l)):(O(),A(e,n))}function A(e,t){let n=e.url;n!==window.location.pathname+window.location.search&&(t===`push`?(S+=1,window.history.pushState({serial:S,place:e},``,n)):window.history.replaceState({serial:S,place:e},``,n)),y=e}async function j(){await c,k()}j(),W([()=>r.repoId,()=>t.activeRepoId,()=>r.repoPath,()=>i.activeView,()=>i.activeStackKey,()=>r.selectedCompareBase,()=>r.selectedStackHead,()=>r.wholeFile,()=>r.compare.selection,()=>r.history.selectedCommit,()=>n.selectedPath],k,{flush:`post`});let M=0;async function N(t){let n=++M;b=!0,O();try{await e.onRestore?.(t,{isStale:()=>n!==M})}finally{n===M&&(await On(),k(),b=!1)}}function P(){N(tl(window.location.pathname,window.location.search))}return typeof window<`u`&&(window.addEventListener(`popstate`,P),ke(()=>{s=!0,window.removeEventListener(`popstate`,P),O()})),{initial:u,whenHomeReady:c,toAbsolute:d,isActiveRepo:p,restore:N}}var iu=Ps(`filter`,()=>{let e=ic(),t=H(``),n=H(!1),r=H(0);function i(e){t.value=e}function a(){n.value=!0,r.value+=1}function o(){n.value=!1,t.value=``}function s(){n.value=!1,t.value=``}return W(()=>e.activeRepoId,()=>s()),{query:t,open:n,focusRequest:r,setQuery:i,openAndFocus:a,close:o,reset:s}}),au=new Set([`changes`]),ou=Object.fromEntries(Rl.map((e,t)=>[String(t+1),e.name]));function su(e){if(!(e instanceof HTMLElement))return!1;if(e.isContentEditable)return!0;let t=e.tagName;return t===`INPUT`||t===`TEXTAREA`||t===`SELECT`}function cu(){let e=Hl(),t=ic(),n=iu();function r(n){switch(n){case`a`:return e.toggleAutoMode(),!0;case`s`:return e.toggleDiffSyntax(),!0;case`d`:return e.toggleDiffMode(),!0;case`f`:return(t.follow?.targetFile??null)!==null&&t.toggleFollow(),!0;case`e`:return e.requestExpandGated(),!0;default:return!1}}function i(n){if(!(n.ctrlKey||n.metaKey)||n.altKey)return!1;let r=n.key.toLowerCase(),i=!n.shiftKey&&r===`p`?`finder`:null,a=n.shiftKey&&r===`f`?`search`:null,o=i??a;return o!==null&&(e.activeOverlay===o?(n.preventDefault(),e.closeOverlay()):t.activeRepoId!==null&&(n.preventDefault(),e.openOverlay(o)),!0)}function a(r){return r.key===`F`?(t.activeRepoId===null||(r.preventDefault(),e.openOverlay(`search`)),!0):r.key===`o`?(e.activeView!==`explorer`||t.activeRepoId===null||(r.preventDefault(),e.requestOutline()),!0):r.key===`/`&&(au.has(e.activeView)&&(r.preventDefault(),n.openAndFocus()),!0)}function o(t){if(t.defaultPrevented||i(t))return;if(t.key===`Escape`){e.activeOverlay!==null&&(t.preventDefault(),e.closeOverlay());return}if(su(t.target)||t.ctrlKey||t.metaKey||t.altKey)return;if(t.key===`?`){t.preventDefault(),e.toggleOverlay(`help`);return}if(t.key===`,`){t.preventDefault(),e.toggleOverlay(`settings`);return}if(e.activeOverlay!==null||a(t)||r(t.key))return;let n=ou[t.key];n!==void 0&&(nu({view:n}),e.setActiveView(n))}jr(()=>window.addEventListener(`keydown`,o)),Pr(()=>window.removeEventListener(`keydown`,o))}function lu(){let e=ic(),t=Ll(),n=Hl(),{activate:r,openByPath:i}=Ul();async function a(t){return e.repos.find(e=>e.id===t)||(await e.refreshRepos(),e.repos.find(e=>e.id===t))}async function o(o){let s=await a(o.repoId);if(!s&&(!await i(o.path)||(s=e.activeRepo??void 0,!s)))return;e.activeRepoId!==s.id&&(await r({id:s.id,path:s.path}),await On());let c=Gl(s.path),l=Gl(o.path);l!==c&&l.startsWith(c+`/`)&&(n.setActiveView(`explorer`),await t.revealFile(l.slice(c.length+1)))}let s=Promise.resolve(),c=null;function l(t){let n=c!==null;c=t,!n&&(s=s.then(async()=>{let t=c;if(c=null,t!==null&&e.followEnabled&&!e.followNavigationSuspended())try{await o(t)}catch(e){Zs(`follow change`,e,{path:t.path,repoId:t.repoId})}}))}W(()=>e.lastFollowChange,t=>{t!==null&&(e.skipInitialFollow?e.skipInitialFollow=!1:e.followEnabled&&l(t))}),W(()=>e.followEnabled,t=>{let n=e.lastFollowChange;t&&n!==null&&l(n)})}var uu=1500,du=100,fu=null;function pu(e){return fu=e,()=>{fu===e&&(fu=null)}}function mu(){let e=Il(),t=Hl(),n=new Map,r=0,i=!1,a=null,o=null;function s(){a=null,o!==null&&(clearTimeout(o),o=null)}function c(e){o!==null&&clearTimeout(o),o=setTimeout(()=>{o=null,l()},e)}function l(){if(a===null)return;if(!t.autoModeEnabled||t.activeView!==`changes`){s();return}let e=fu;if(e===null){c(du);return}let n=Date.now()-e.lastUserScrollAt();if(n<1500){c(uu-n);return}let r=a;s(),e.jump(r)}W(()=>e.repoId,()=>{n=new Map,r=0,i=!1,s()}),Pr(s);function u(e,t){let r=new Map,i=null;for(let a of e){let e=t[a.path];if(e===void 0||r.has(a.path))continue;r.set(a.path,e);let o=n.get(a.path);(o===void 0||e>o)&&(!i||e>i.mtime)&&(i={path:a.path,mtime:e})}return n=r,i}function d(){let n=e.history.commits[0];n&&e.selectHistoryCommit(n).catch(e=>{Qs(`select newest commit`,e,{hash:n.hash})}),t.setActiveView(`history`)}function f(e,n){return e>0&&n===0?(t.activeView===`changes`&&d(),!0):(e===0&&n>0&&t.activeView===`history`&&t.setActiveView(`changes`),!1)}function p(n,r){if(t.activeView!==`changes`)return;let i=n.find(e=>e.path===r.path);i&&(e.selectFile(i),t.flashFile(r.path),a=r.path,l())}function m(e){let n=e.status;if(n===null||!n.isRepo)return;let a=n.files,o=r;r=a.length;let s=u(a,e.mtimes??{}),c=!i;i=!0,!c&&t.autoModeEnabled&&(f(o,a.length)||s!==null&&p(a,s))}W(()=>e.shared,e=>m(e))}var hu=`(orientation: portrait), (max-aspect-ratio: 1/1), (max-width: 1400px)`;function gu(e){let t=V(!1);if(typeof window>`u`||typeof window.matchMedia!=`function`)return t;let n=window.matchMedia(e);if(t.value=n.matches,typeof n.addEventListener==`function`){let e=e=>{t.value=e.matches};n.addEventListener(`change`,e),Pa()&&Pr(()=>n.removeEventListener(`change`,e))}return t}function _u(){return gu(hu)}function vu(){let e=_u();return typeof document<`u`&&Jn(()=>{document.documentElement.dataset.split=e.value?`stacked`:`split`}),e}function yu(e){return[...e].sort((e,t)=>(t.lastActivity??-1/0)-(e.lastActivity??-1/0))}function bu(e,t){let n=yu(t.filter(e=>!e.isBare)),r=t.find(e=>e.isMain);if(!r)return{root:e,name:Wl(e),worktrees:n};if(!r.isBare)return{root:r.path,name:Wl(r.path),worktrees:n};let i=Wl(r.path);if(i.startsWith(`.`)){let e=Kl(r.path);return{root:e,name:Wl(e),worktrees:n}}return{root:r.path,name:i.replace(/\.git$/,``),worktrees:n}}var xu=Ps(`worktrees`,()=>{let e=new Xs,t=ic(),n=H(new Map),r=new Map,i=0,a=new Map;function o(e,t){let r=new Map(n.value);r.set(e,t),n.value=r}function s(e){return n.value.get(e)}function c(e){let t=n.value.get(e);return t?.status===`ready`?t.project:null}function l(t){let s=r.get(t);if(s)return s;let c=n.value.get(t);(c===void 0||c.status===`failed`)&&o(t,{status:`pending`});let l=e.worktreesForPath(t).then(e=>{o(t,e.length===0?{status:`absent`}:{status:`ready`,project:bu(t,e)})}).catch(e=>{Qs(`list worktrees`,e,{path:t}),o(t,{status:`failed`})}).finally(()=>{a.set(t,i),r.delete(t)});return r.set(t,l),l}function u(e){let t=e.filter(e=>{let t=n.value.get(e);return t===void 0||t.status===`failed`||(a.get(e)??-1)<i});return Promise.all(t.map(l)).then(()=>void 0)}function d(e){return Promise.all(e.map(l)).then(()=>void 0)}function f(){i++}let p=$(()=>t.activeRepoPath);return W(p,e=>{e!==null&&u([e])},{immediate:!0}),W(()=>t.repos.map(e=>e.path).join(`
2
+ `))),e[Ho]=zo(i);let a=r||i.props&&i.props.type===`number`;wo(e,t?`change`:`input`,t=>{t.target.composing||e[Ho](Wo(e.value,n,a))}),(n||a)&&wo(e,`change`,()=>{e.value=Wo(e.value,n,a)}),t||(wo(e,`compositionstart`,Bo),wo(e,`compositionend`,Vo),wo(e,`change`,Vo))},mounted(e,{value:t,modifiers:{trim:n,number:r}}){let i=t??``,a=e[Uo];delete e[Uo],a!==void 0&&(e.type===`text`||e.type===`textarea`)&&e.value!==a?e[Ho](Wo(e.value,n,r)):e.value=i},beforeUpdate(e,{value:t,oldValue:n,modifiers:{lazy:r,trim:i,number:a}},o){if(e[Ho]=zo(o),e.composing)return;let s=(a||e.type===`number`)&&!/^0\d/.test(e.value)?oe(e.value):e.value,c=t??``;if(s===c)return;let l=e.getRootNode();(l instanceof Document||l instanceof ShadowRoot)&&l.activeElement===e&&e.type!==`range`&&(r&&t===n||i&&e.value.trim()===c)||(e.value=c)}},Ko=[`ctrl`,`shift`,`alt`,`meta`],qo={stop:e=>e.stopPropagation(),prevent:e=>e.preventDefault(),self:e=>e.target!==e.currentTarget,ctrl:e=>!e.ctrlKey,shift:e=>!e.shiftKey,alt:e=>!e.altKey,meta:e=>!e.metaKey,left:e=>`button`in e&&e.button!==0,middle:e=>`button`in e&&e.button!==1,right:e=>`button`in e&&e.button!==2,exact:(e,t)=>Ko.some(n=>e[`${n}Key`]&&!t.includes(n))},Jo=(e,t)=>{if(!e)return e;let n=e._withMods||={},r=t.join(`.`);return n[r]||(n[r]=((n,...r)=>{for(let e=0;e<t.length;e++){let r=qo[t[e]];if(r&&r(n,t))return}return e(n,...r)}))},Yo={esc:`escape`,space:` `,up:`arrow-up`,left:`arrow-left`,right:`arrow-right`,down:`arrow-down`,delete:`backspace`},Xo=(e,t)=>{let n=e._withKeys||={},r=t.join(`.`);return n[r]||(n[r]=(n=>{if(!(`key`in n))return;let r=R(n.key);if(t.some(e=>e===r||Yo[e]===r))return e(n)}))},Zo=g({patchProp:Io},io),Qo;function $o(){return Qo||=Yi(Zo)}var es=((...e)=>{let t=$o().createApp(...e),{mount:n}=t;return t.mount=e=>{let r=ns(e);if(!r)return;let i=t._component;!w(i)&&!i.render&&!i.template&&(i.template=r.innerHTML),r.nodeType===1&&(r.textContent=``);let a=n(r,!1,ts(r));return r instanceof Element&&(r.removeAttribute(`v-cloak`),r.setAttribute(`data-v-app`,``)),a},t});function ts(e){if(e instanceof SVGElement)return`svg`;if(typeof MathMLElement==`function`&&e instanceof MathMLElement)return`mathml`}function ns(e){return T(e)?document.querySelector(e):e}var rs=typeof window<`u`,is,as=e=>is=e,os=Symbol();function ss(e){return e&&typeof e==`object`&&Object.prototype.toString.call(e)===`[object Object]`&&typeof e.toJSON!=`function`}var cs=typeof window==`object`&&window.window===window?window:typeof self==`object`&&self.self===self?self:typeof global==`object`&&global.global===global?global:typeof globalThis==`object`?globalThis:{HTMLElement:null};function ls(e,{autoBom:t=!1}={}){return t&&/^\s*(?:text\/\S*|application\/xml|\S*\/\S*\+xml)\s*;.*charset\s*=\s*utf-8/i.test(e.type)?new Blob([``,e],{type:e.type}):e}function us(e,t,n){let r=new XMLHttpRequest;r.open(`GET`,e),r.responseType=`blob`,r.onload=function(){hs(r.response,t,n)},r.onerror=function(){console.error(`could not download file`)},r.send()}function ds(e){let t=new XMLHttpRequest;t.open(`HEAD`,e,!1);try{t.send()}catch{}return t.status>=200&&t.status<=299}function fs(e){try{e.dispatchEvent(new MouseEvent(`click`))}catch{let t=new MouseEvent(`click`,{bubbles:!0,cancelable:!0,view:window,detail:0,screenX:80,screenY:20,clientX:80,clientY:20,ctrlKey:!1,altKey:!1,shiftKey:!1,metaKey:!1,button:0,relatedTarget:null});e.dispatchEvent(t)}}var ps=typeof navigator==`object`?navigator:{userAgent:``},ms=/Macintosh/.test(ps.userAgent)&&/AppleWebKit/.test(ps.userAgent)&&!/Safari/.test(ps.userAgent),hs=rs?typeof HTMLAnchorElement<`u`&&`download`in HTMLAnchorElement.prototype&&!ms?gs:`msSaveOrOpenBlob`in ps?_s:vs:()=>{};function gs(e,t=`download`,n){let r=document.createElement(`a`);r.download=t,r.rel=`noopener`,typeof e==`string`?(r.href=e,r.origin===location.origin?fs(r):ds(r.href)?us(e,t,n):(r.target=`_blank`,fs(r))):(r.href=URL.createObjectURL(e),setTimeout(function(){URL.revokeObjectURL(r.href)},4e4),setTimeout(function(){fs(r)},0))}function _s(e,t=`download`,n){if(typeof e==`string`){if(ds(e))us(e,t,n);else{let t=document.createElement(`a`);t.href=e,t.target=`_blank`,setTimeout(function(){fs(t)})}}else navigator.msSaveOrOpenBlob(ls(e,n),t)}function vs(e,t,n,r){if(r||=open(``,`_blank`),r&&(r.document.title=r.document.body.innerText=`downloading...`),typeof e==`string`)return us(e,t,n);let i=e.type===`application/octet-stream`,a=/constructor/i.test(String(cs.HTMLElement))||`safari`in cs,o=/CriOS\/[\d]+/.test(navigator.userAgent);if((o||i&&a||ms)&&typeof FileReader<`u`){let t=new FileReader;t.onloadend=function(){let e=t.result;if(typeof e!=`string`)throw r=null,Error(`Wrong reader.result type`);e=o?e:e.replace(/^data:[^;]*;/,`data:attachment/file;`),r?r.location.href=e:location.assign(e),r=null},t.readAsDataURL(e)}else{let t=URL.createObjectURL(e);r?r.location.assign(t):location.href=t,r=null,setTimeout(function(){URL.revokeObjectURL(t)},4e4)}}var{assign:ys}=Object;function bs(){let e=De(!0),t=e.run(()=>V({})),n=[],r=[],i=Yt({install(e){as(i),i._a=e,e.provide(os,i),e.config.globalProperties.$pinia=i,r.forEach(e=>n.push(e)),r=[]},use(e){return this._a?n.push(e):r.push(e),this},_p:n,_a:null,_e:e,_s:new Map,state:t});return i}var xs=()=>{};function Ss(e,t,n,r=xs){e.add(t);let i=()=>{e.delete(t)&&r()};return!n&&Oe()&&ke(i),i}function Cs(e,...t){e.forEach(e=>{e(...t)})}var ws=e=>e(),Ts=Symbol(),Es=Symbol();function Ds(e,t){e instanceof Map&&t instanceof Map?t.forEach((t,n)=>e.set(n,t)):e instanceof Set&&t instanceof Set&&t.forEach(e.add,e);for(let n in t){if(!Object.hasOwn(t,n))continue;let r=t[n],i=e[n];e[n]=ss(i)&&ss(r)&&Object.hasOwn(e,n)&&!Qt(r)&&!Wt(r)?Ds(i,r):r}return e}var Os=Symbol();function ks(e){return!e||typeof e!=`object`||!Object.hasOwn(e,Os)}var{assign:As}=Object;function js(e){return!!(Qt(e)&&e.effect)}function Ms(e,t,n,r){let{state:i,actions:a,getters:o}=t,s=n.state.value[e],c;function l(){return s||(n.state.value[e]=i?i():{}),As(rn(n.state.value[e]),a,Object.keys(o||{}).reduce((t,r)=>(t[r]=Yt($(()=>{as(n);let t=n._s.get(e);return o[r].call(t,t)})),t),{}))}return c=Ns(e,l,t,n,r,!0),c}function Ns(e,t,n={},r,i,a){let o,s=As({actions:{}},n),c={deep:!0},l,u,d=new Set,f=new Set,p,m=r.state.value[e];!a&&!m&&(r.state.value[e]={});let h;function g(t){let n;l=u=!1,typeof t==`function`?(t(r.state.value[e]),n={type:`patch function`,storeId:e,events:p}):(Ds(r.state.value[e],t),n={type:`patch object`,payload:t,storeId:e,events:p});let i=h=Symbol();On().then(()=>{h===i&&(l=!0)}),u=!0,Cs(d,n,r.state.value[e])}let _=a?function(){let{state:e}=n,t=e?e():{};this.$patch(e=>{As(e,t)})}:xs;function v(){o.stop(),d.clear(),f.clear(),r._s.delete(e)}let y=(t,n=``)=>{if(Ts in t)return t[Es]=n,t;let i=function(){as(r);let n=Array.from(arguments),a=new Set,o=new Set;function s(e){a.add(e)}function c(e){o.add(e)}Cs(f,{args:n,name:i[Es],store:b,after:s,onError:c});let l;try{l=t.apply(this&&this.$id===e?this:b,n)}catch(e){throw Cs(o,e),e}return l instanceof Promise?l.then(e=>(Cs(a,e),e)).catch(e=>(Cs(o,e),Promise.reject(e))):(Cs(a,l),l)};return i[Ts]=!0,i[Es]=n,i},b=Bt({_p:r,$id:e,$onAction:Ss.bind(null,f),$patch:g,$reset:_,$subscribe(t,n={}){if(d.has(t))return xs;let i=Ss(d,t,n.detached,()=>a()),a=o.run(()=>W(()=>r.state.value[e],r=>{(n.flush===`sync`?u:l)&&t({storeId:e,type:`direct`,events:p},r)},As({},c,n)));return i},$dispose:v});r._s.set(e,b);let x=(r._a&&r._a.runWithContext||ws)(()=>r._e.run(()=>(o=De()).run(()=>t({action:y}))));for(let t in x){let n=x[t];Qt(n)&&!js(n)||Wt(n)?a||(m&&ks(n)&&(Qt(n)?n.value=m[t]:((n instanceof Set||n instanceof Map)&&n.clear(),Ds(n,m[t]))),r.state.value[e][t]=n):typeof n==`function`&&(x[t]=y(n,t),s.actions[t]=n)}return As(b,x),As(Jt(b),x),Object.defineProperty(b,"$state",{get:()=>r.state.value[e],set:e=>{g(t=>{As(t,e)})}}),r._p.forEach(e=>{let t=o.run(()=>e({store:b,app:r._a,pinia:r,options:s}));As(b,t)}),m&&a&&n.hydrate&&n.hydrate(b.$state,m),l=!0,u=!0,b}function Ps(e,t,n){let r,i=typeof t==`function`;r=i?n:t;function a(n,a){let o=Gn();return n||=o?Wn(os,null):null,n&&as(n),n=is,n._s.has(e)||(i?Ns(e,t,r,n):Ms(e,r,n)),n._s.get(e)}return a.$id=e,a}function Fs(e){let t=Jt(e),n={};for(let r in t){let i=t[r];i?.effect?n[r]=$({get:()=>e[r],set(t){e[r]=t}}):(Qt(i)||Wt(i))&&(n[r]=sn(e,r))}return n}var Is=class extends Error{status;constructor(e,t){super(t),this.name=`DaemonError`,this.status=e}};function Ls(e){return!(e instanceof Is)}function Rs(e){return e instanceof Error?e.message:String(e)}function zs(e,t){if(typeof e==`object`&&e){let t=e.error;if(typeof t==`string`&&t.length>0)return t}return`Daemon request failed with HTTP ${t}`}function Bs(e,t){let n=t instanceof Error?t.message:String(t);return Error(`daemon unreachable (${e}): ${n}`)}async function Vs(e,t,n){let r=n===void 0?null:JSON.stringify(n),i;try{i=await fetch(t,{method:e,headers:{accept:`application/json`,...r===null?{}:{"content-type":`application/json`}},...r===null?{}:{body:r}})}catch(e){throw Bs(`request`,e)}let a;try{a=await i.text()}catch(e){throw Bs(`response body`,e)}let o=i.status,s=null;if(a.length>0)try{s=JSON.parse(a)}catch{throw new Is(o,`Daemon sent invalid JSON (HTTP ${o}): ${a.slice(0,200)}`)}if(o>=200&&o<300)return s;throw new Is(o,zs(s,o))}function Hs(e,t,n){let r=new EventSource(e),i=!1;for(let e of t)r.addEventListener(e,t=>{if(i)return;let r=t.data,a=null;if(typeof r==`string`&&r.length>0)try{a=JSON.parse(r)}catch{n.onError?.();return}n.onEvent(e,a)});return r.onopen=()=>{i||n.onOpen?.()},r.onerror=()=>{i||n.onError?.()},{close(){i||(i=!0,r.close())}}}function Us(e,t){let n=`path=${encodeURIComponent(t.path)}&side=${encodeURIComponent(t.side)}`,r=t.version===void 0?``:`&v=${encodeURIComponent(t.version)}`;return`/repos/${encodeURIComponent(e)}/blob?${n}${r}`}function Ws(e,t,n){let r=`path=${encodeURIComponent(t)}&staged=${n?`true`:`false`}`;return`/repos/${encodeURIComponent(e)}/media?${r}`}var Gs=[`snapshot`,`repo-opened`,`repo-closed`,`follow-change`,`settings-change`,`discovery-change`],Ks=[`repo-snapshot`,`state-change`,`journal-append`,`repo-missing`];function qs(e){return Ks.includes(e)}function Js(e){return{...e,date:new Date(e.date)}}function Ys(e){let t=new URLSearchParams;for(let[n,r]of Object.entries(e))r!==void 0&&t.set(n,String(r));let n=t.toString();return n?`?${n}`:``}var Xs=class{health(){return Vs(`GET`,`/health`)}version(){return Vs(`GET`,`/version`)}getFollow(){return Vs(`GET`,`/follow`)}getSettings(){return Vs(`GET`,`/settings`)}setWatchRoots(e){return Vs(`PUT`,`/settings`,{watchRoots:e})}discovered(){return Vs(`GET`,`/discovered`)}rescanDiscovered(){return Vs(`POST`,`/discovered/rescan`)}browse(e){return Vs(`GET`,`/browse${e===void 0?``:`?path=${encodeURIComponent(e)}`}`)}openRepo(e){return Vs(`POST`,`/repos`,{path:e})}listRepos(){return Vs(`GET`,`/repos`)}async closeRepo(e){await Vs(`DELETE`,this.repoPath(e,``))}releaseRepoOnUnload(e){fetch(this.repoPath(e,``),{method:`DELETE`,keepalive:!0}).catch(()=>{})}worktreesForPath(e){return Vs(`GET`,`/worktrees`+Ys({path:e}))}resolvePath(e){return Vs(`GET`,`/resolve`+Ys({path:e}))}status(e){return Vs(`GET`,this.repoPath(e,`/status`))}diff(e,t={}){return Vs(`GET`,this.repoPath(e,`/diff`)+Ys({path:t.path,staged:t.staged,whole:t.whole}))}stage(e,t){return Vs(`POST`,this.repoPath(e,`/stage`),{path:t})}unstage(e,t){return Vs(`POST`,this.repoPath(e,`/unstage`),{path:t})}async history(e,t){return(await Vs(`GET`,this.repoPath(e,`/history`)+Ys({count:t}))).map(Js)}async getCommit(e,t){return Js(await Vs(`GET`,this.repoPath(e,`/commits/${encodeURIComponent(t)}`)))}commitDiff(e,t,n={}){return Vs(`GET`,this.repoPath(e,`/commits/${encodeURIComponent(t)}/diff`)+Ys({path:n.path,whole:n.whole}))}commitFiles(e,t){return Vs(`GET`,this.repoPath(e,`/commits/${encodeURIComponent(t)}/files`))}compareFileDiff(e,t){return Vs(`GET`,this.repoPath(e,`/compare/file`)+Ys({path:t.path,base:t.base,head:t.head,uncommitted:t.uncommitted,whole:t.whole}))}baseBranches(e){return Vs(`GET`,this.repoPath(e,`/base-branches`))}async compare(e,t={}){let n=await Vs(`GET`,this.repoPath(e,`/compare`)+Ys({base:t.base,head:t.head,staged:t.staged,unstaged:t.unstaged,untracked:t.untracked}));return{...n,commits:n.commits.map(Js)}}compareCount(e,t={}){return Vs(`GET`,this.repoPath(e,`/compare/count`)+Ys({base:t.base,head:t.head}))}compareStack(e,t={}){return Vs(`GET`,this.repoPath(e,`/compare/stack`)+Ys({base:t.base}))}journal(e,t){return Vs(`GET`,this.repoPath(e,`/journal`)+Ys({since:t}))}tree(e,t={}){return Vs(`GET`,this.repoPath(e,`/tree`)+Ys({dir:t.dir,hidden:t.hidden,ignored:t.ignored}))}file(e,t,n={}){return Vs(`GET`,this.repoPath(e,`/file`)+Ys({path:t,symbols:n.symbols}))}files(e){return Vs(`GET`,this.repoPath(e,`/files`))}search(e,t){return Vs(`POST`,this.repoPath(e,`/search`),{query:t})}media(e,t,n){return Vs(`GET`,Ws(e,t,n))}subscribeEvents(e,t){return Hs(t?`/events?repo=${encodeURIComponent(t.id)}`:`/events`,t?[...Gs,...Ks]:Gs,{onEvent:(n,r)=>{t&&qs(n)?this.dispatchRepoEvent(n,r,t.handlers):this.dispatchDaemonEvent(n,r,e)},onOpen:e.onOpen,onError:()=>{e.onError?.(),t?.handlers.onError?.()}})}dispatchRepoEvent(e,t,n){switch(e){case`repo-snapshot`:n.onSnapshot(t);break;case`state-change`:n.onStateChange(t);break;case`journal-append`:n.onJournalAppend?.(t);break;case`repo-missing`:n.onMissing(t)}}dispatchDaemonEvent(e,t,n){switch(e){case`snapshot`:n.onSnapshot(t);break;case`repo-opened`:n.onRepoOpened(t);break;case`repo-closed`:n.onRepoClosed(t);break;case`follow-change`:n.onFollowChange(t);break;case`settings-change`:n.onSettingsChange?.(t);break;case`discovery-change`:n.onDiscoveryChange?.(t)}}repoPath(e,t){return`/repos/${encodeURIComponent(e)}${t}`}};function Zs(e,t,n={}){console.error(`diffstalker: ${e} failed`,{status:t instanceof Is?t.status:null,message:Rs(t),...n,error:t})}function Qs(e,t,n={}){Ls(t)||Zs(e,t,n)}function $s(e){return new Promise(t=>setTimeout(t,e))}var ec=Ps(`settings`,()=>{let e=new Xs,t=H([]),n=H(!0),r=H([]),i=H(!1),a=H(null),o=H(!1),s=$(()=>{let e=new Map;for(let t of r.value)for(let n of t.repos)e.has(n.path)||e.set(n.path,n);return[...e.values()].sort((e,t)=>(t.lastActivity??0)-(e.lastActivity??0)||e.name.localeCompare(t.name))});function c(e){t.value=e.watchRoots,n.value=e.persisted}function l(e){r.value=e.roots}async function u(){try{let[t,n]=await Promise.all([e.getSettings(),e.discovered()]);c(t),l(n),o.value=!0}catch(e){Qs(`load settings`,e)}}async function d(t){i.value=!0,a.value=null;try{return c(await e.setWatchRoots(t)),l(await e.discovered()),!0}catch(e){return Zs(`save watch directories`,e,{watchRoots:t}),a.value=Rs(e),!1}finally{i.value=!1}}async function f(e){let n=t.value,r=await d([...n,e]);return r&&t.value.length===n.length?(a.value=`Already watching ${e}`,!1):r}function p(){a.value=null}function m(e){return d(t.value.filter(t=>t!==e))}async function h(){try{l(await e.rescanDiscovered())}catch(e){Qs(`rescan watch directories`,e)}}return{watchRoots:t,persisted:n,roots:r,saving:i,saveError:a,loaded:o,discoveredRepos:s,applySettings:c,applyDiscovery:l,load:u,clearSaveError:p,addWatchRoot:f,removeWatchRoot:m,rescan:h}});function tc(e){return e.followedRepoId===null||e.followedPath===null?null:{repoId:e.followedRepoId,path:e.followedPath,rawContent:e.followedPath}}var nc=36e5,rc=1e4,ic=Ps(`daemon`,()=>{let e=new Xs,t=H(`connecting`),n=H([]),r=H(null),i=H(!0),a=H(null),o=H(!1),s=H(null),c=H(null),l=H(null),u=H(null),d=null,f=null,p=!1,m=!1,h=null,g=!1,_=null,v=!1,y=!1;function b(e){let t=new Map(n.value.map(e=>[e.id,e.branch]));n.value=e.map(e=>({...e,branch:t.get(e.id)??null}))}function x(e,t=null){n.value.find(t=>t.id===e.id)||(n.value=[...n.value,{...e,branch:t}])}let S=!1;function C(){S=!1,F(),te(),ec().load(),I()}let w={onSnapshot:e=>{t.value=`connected`,l.value=null,b(e),f===null?C():S=!0,L()},onRepoOpened:e=>x(e),onRepoClosed:({id:e})=>{n.value=n.value.filter(t=>t.id!==e)},onFollowChange:e=>{if(a.value=e,r.value){let t=n.value.find(t=>t.id===e.repoId)?.path??r.value.followedPath;r.value={...r.value,followedRepoId:e.repoId,followedPath:t}}},onSettingsChange:e=>ec().applySettings(e),onDiscoveryChange:e=>ec().applyDiscovery(e),onError:()=>{t.value!==`disconnected`&&console.warn(`diffstalker: daemon event stream lost; the browser will retry`),t.value=`disconnected`}};function T(){return document.visibilityState===`hidden`}function E(){d?.close(),d=null,k(),O(),T()?p=!0:(p=!1,d=e.subscribeEvents(w,f===null?void 0:D(f)))}function D(e){let{handlers:t}=e;return{id:e.id,handlers:{...t,onSnapshot:e=>{t.onSnapshot(e),S&&C(),m&&(m=!1,t.onResume?.())},onMissing:e=>{t.onMissing(e),S&&C()}}}}function O(){g||(g=!0,document.addEventListener(`visibilitychange`,A))}function k(){h!==null&&(clearTimeout(h),h=null)}function A(){if(T()){if(h!==null||d===null)return;h=setTimeout(()=>{h=null,d?.close(),d=null,p=!0},rc)}else k(),p&&(m=f!==null,E())}function j(){d||p||E()}function M(e,t){f={id:e,handlers:t},m=!1,E()}function N(){f!==null&&(f=null,m=!1,d&&E())}function P(){d?.close(),d=null,p=!1,m=!1,k(),g&&(g=!1,document.removeEventListener(`visibilitychange`,A)),ee()}async function F(){try{n.value=await e.listRepos()}catch(e){Qs(`list repos`,e),t.value=`disconnected`}}async function I(){try{let t=await e.version();c.value=t,u.value===null&&t.current!==null&&(u.value=t.current)}catch(e){Qs(`load version`,e)}}function L(){_===null&&(_=setInterval(()=>void I(),nc))}function ee(){_!==null&&(clearInterval(_),_=null)}function R(e){let t=r.value?.followedRepoId??null;r.value=e;let n=tc(e);y?n!==null&&n.repoId!==t&&(a.value=n):(y=!0,a.value===null&&n!==null&&(a.value=n))}async function te(){if(!v){v=!0;try{for(let n=1;n<=3;n++)try{R(await e.getFollow());return}catch(e){if(n<3){await $s(300);continue}Zs(`load follow state`,e,{attempts:n}),t.value=`disconnected`}}finally{v=!1}}}function ne(e){x(e),s.value=e.id,l.value=null}async function re(t){try{await e.closeRepo(t)}catch(e){Zs(`release repo`,e,{id:t}),l.value=Rs(e);return}n.value=n.value.filter(e=>e.id!==t),s.value===t&&(s.value=null)}let ie=0;function ae(e){ie=Date.now()+e}function oe(){return Date.now()<ie}function se(){return i.value=!i.value,i.value}let ce=$(()=>n.value.find(e=>e.id===s.value)??null);return{connection:t,repos:n,follow:r,followEnabled:i,lastFollowChange:a,skipInitialFollow:o,suspendFollowNavigation:ae,followNavigationSuspended:oe,activeRepoId:s,activeRepo:ce,activeRepoPath:$(()=>ce.value?.path??null),version:c,servedBy:u,daemonUpgraded:$(()=>u.value!==null&&c.value?.current!=null&&c.value.current!==u.value),error:l,connect:j,disconnect:P,attachRepo:M,detachRepo:N,refreshRepos:F,loadFollow:te,loadVersion:I,trackActive:ne,closeRepo:re,toggleFollow:se}});function ac(e){return e.lines.some(e=>e.type===`header`&&e.content.startsWith(`Large file — diff not shown`))}function oc(e){return e.startsWith(`\\ `)}var sc=new Map([[`a`,7],[`b`,8],[`f`,12],[`n`,10],[`r`,13],[`t`,9],[`v`,11],[`\\`,92],[`"`,34]]);new Map([...sc].map(([e,t])=>[t,e]));function cc(e){if(e.length<2||!e.startsWith(`"`)||!e.endsWith(`"`))return e;let t=e.slice(1,-1),n=new TextEncoder,r=[],i=0;for(;i<t.length;){let e=t.indexOf(`\\`,i);if(e===-1){r.push(...n.encode(t.slice(i)));break}r.push(...n.encode(t.slice(i,e)));let a=/^[0-7]{1,3}/.exec(t.slice(e+1,e+4));if(a!==null){r.push(parseInt(a[0],8)),i=e+1+a[0].length;continue}let o=sc.get(t[e+1]??``);o===void 0?(r.push(92),i=e+1):(r.push(o),i=e+2)}return new TextDecoder().decode(Uint8Array.from(r))}function lc(e){for(let t=e.length-2;t>=0;t--){if(e[t]!==`"`)continue;let n=0;for(let r=t-1;r>=0&&e[r]===`\\`;r--)n++;if(n%2==0)return t}return-1}function uc(e){if(!e.startsWith(`diff --git `))return null;let t=e.slice(11);if(t.endsWith(`"`)){let e=lc(t);if(e===-1)return null;let n=cc(t.slice(e));return n.startsWith(`b/`)?n.slice(2):null}let n=t.lastIndexOf(` b/`);return n===-1?null:t.slice(n+3)}var dc=c(o(((e,t)=>{var n=-1,r=1,i=0;function a(e,t,n,r,a){if(e===t)return e?[[i,e]]:[];if(n!=null){var s=D(e,t,n);if(s)return s}var c=l(e,t),u=e.substring(0,c);e=e.substring(c),t=t.substring(c),c=d(e,t);var f=e.substring(e.length-c);e=e.substring(0,e.length-c),t=t.substring(0,t.length-c);var m=o(e,t);return u&&m.unshift([i,u]),f&&m.push([i,f]),b(m,a),r&&p(m),m}function o(e,t){var o;if(!e)return[[r,t]];if(!t)return[[n,e]];var c=e.length>t.length?e:t,l=e.length>t.length?t:e,u=c.indexOf(l);if(u!==-1)return o=[[r,c.substring(0,u)],[i,l],[r,c.substring(u+l.length)]],e.length>t.length&&(o[0][0]=o[2][0]=n),o;if(l.length===1)return[[n,e],[r,t]];var d=f(e,t);if(d){var p=d[0],m=d[1],h=d[2],g=d[3],_=d[4],v=a(p,h),y=a(m,g);return v.concat([[i,_]],y)}return s(e,t)}function s(e,t){for(var i=e.length,a=t.length,o=Math.ceil((i+a)/2),s=o,l=2*o,u=Array(l),d=Array(l),f=0;f<l;f++)u[f]=-1,d[f]=-1;u[s+1]=0,d[s+1]=0;for(var p=i-a,m=p%2!=0,h=0,g=0,_=0,v=0,y=0;y<o;y++){for(var b=-y+h;b<=y-g;b+=2){for(var x=s+b,S=b===-y||b!==y&&u[x-1]<u[x+1]?u[x+1]:u[x-1]+1,C=S-b;S<i&&C<a&&e.charAt(S)===t.charAt(C);)S++,C++;if(u[x]=S,S>i)g+=2;else if(C>a)h+=2;else if(m){var w=s+p-b;if(w>=0&&w<l&&d[w]!==-1){var T=i-d[w];if(S>=T)return c(e,t,S,C)}}}for(var E=-y+_;E<=y-v;E+=2){for(var w=s+E,T=E===-y||E!==y&&d[w-1]<d[w+1]?d[w+1]:d[w-1]+1,D=T-E;T<i&&D<a&&e.charAt(i-T-1)===t.charAt(a-D-1);)T++,D++;if(d[w]=T,T>i)v+=2;else if(D>a)_+=2;else if(!m){var x=s+p-E;if(x>=0&&x<l&&u[x]!==-1){var S=u[x],C=s+S-x;if(T=i-T,S>=T)return c(e,t,S,C)}}}}return[[n,e],[r,t]]}function c(e,t,n,r){var i=e.substring(0,n),o=t.substring(0,r),s=e.substring(n),c=t.substring(r),l=a(i,o),u=a(s,c);return l.concat(u)}function l(e,t){if(!e||!t||e.charAt(0)!==t.charAt(0))return 0;for(var n=0,r=Math.min(e.length,t.length),i=r,a=0;n<i;)e.substring(a,i)==t.substring(a,i)?(n=i,a=n):r=i,i=Math.floor((r-n)/2+n);return x(e.charCodeAt(i-1))&&i--,i}function u(e,t){var n=e.length,r=t.length;if(n==0||r==0)return 0;n>r?e=e.substring(n-r):n<r&&(t=t.substring(0,n));var i=Math.min(n,r);if(e==t)return i;for(var a=0,o=1;;){var s=e.substring(i-o),c=t.indexOf(s);if(c==-1)return a;o+=c,(c==0||e.substring(i-o)==t.substring(0,o))&&(a=o,o++)}}function d(e,t){if(!e||!t||e.slice(-1)!==t.slice(-1))return 0;for(var n=0,r=Math.min(e.length,t.length),i=r,a=0;n<i;)e.substring(e.length-i,e.length-a)==t.substring(t.length-i,t.length-a)?(n=i,a=n):r=i,i=Math.floor((r-n)/2+n);return S(e.charCodeAt(e.length-i))&&i--,i}function f(e,t){var n=e.length>t.length?e:t,r=e.length>t.length?t:e;if(n.length<4||r.length*2<n.length)return null;function i(e,t,n){for(var r=e.substring(n,n+Math.floor(e.length/4)),i=-1,a=``,o,s,c,u;(i=t.indexOf(r,i+1))!==-1;){var f=l(e.substring(n),t.substring(i)),p=d(e.substring(0,n),t.substring(0,i));a.length<p+f&&(a=t.substring(i-p,i)+t.substring(i,i+f),o=e.substring(0,n-p),s=e.substring(n+f),c=t.substring(0,i-p),u=t.substring(i+f))}return a.length*2>=e.length?[o,s,c,u,a]:null}var a=i(n,r,Math.ceil(n.length/4)),o=i(n,r,Math.ceil(n.length/2)),s;if(!a&&!o)return null;s=o?a&&a[4].length>o[4].length?a:o:a;var c,u,f,p;e.length>t.length?(c=s[0],u=s[1],f=s[2],p=s[3]):(f=s[0],p=s[1],c=s[2],u=s[3]);var m=s[4];return[c,u,f,p,m]}function p(e){for(var t=!1,a=[],o=0,s=null,c=0,l=0,d=0,f=0,p=0;c<e.length;)e[c][0]==i?(a[o++]=c,l=f,d=p,f=0,p=0,s=e[c][1]):(e[c][0]==r?f+=e[c][1].length:p+=e[c][1].length,s&&s.length<=Math.max(l,d)&&s.length<=Math.max(f,p)&&(e.splice(a[o-1],0,[n,s]),e[a[o-1]+1][0]=r,o--,o--,c=o>0?a[o-1]:-1,l=0,d=0,f=0,p=0,s=null,t=!0)),c++;for(t&&b(e),y(e),c=1;c<e.length;){if(e[c-1][0]==n&&e[c][0]==r){var m=e[c-1][1],h=e[c][1],g=u(m,h),_=u(h,m);g>=_?(g>=m.length/2||g>=h.length/2)&&(e.splice(c,0,[i,h.substring(0,g)]),e[c-1][1]=m.substring(0,m.length-g),e[c+1][1]=h.substring(g),c++):(_>=m.length/2||_>=h.length/2)&&(e.splice(c,0,[i,m.substring(0,_)]),e[c-1][0]=r,e[c-1][1]=h.substring(0,h.length-_),e[c+1][0]=n,e[c+1][1]=m.substring(_),c++),c++}c++}}var m=/[^a-zA-Z0-9]/,h=/\s/,g=/[\r\n]/,_=/\n\r?\n$/,v=/^\r?\n\r?\n/;function y(e){function t(e,t){if(!e||!t)return 6;var n=e.charAt(e.length-1),r=t.charAt(0),i=n.match(m),a=r.match(m),o=i&&n.match(h),s=a&&r.match(h),c=o&&n.match(g),l=s&&r.match(g),u=c&&e.match(_),d=l&&t.match(v);return u||d?5:c||l?4:i&&!o&&s?3:o||s?2:i||a?1:0}for(var n=1;n<e.length-1;){if(e[n-1][0]==i&&e[n+1][0]==i){var r=e[n-1][1],a=e[n][1],o=e[n+1][1],s=d(r,a);if(s){var c=a.substring(a.length-s);r=r.substring(0,r.length-s),a=c+a.substring(0,a.length-s),o=c+o}for(var l=r,u=a,f=o,p=t(r,a)+t(a,o);a.charAt(0)===o.charAt(0);){r+=a.charAt(0),a=a.substring(1)+o.charAt(0),o=o.substring(1);var y=t(r,a)+t(a,o);y>=p&&(p=y,l=r,u=a,f=o)}e[n-1][1]!=l&&(l?e[n-1][1]=l:(e.splice(n-1,1),n--),e[n][1]=u,f?e[n+1][1]=f:(e.splice(n+1,1),n--))}n++}}function b(e,t){e.push([i,``]);for(var a=0,o=0,s=0,c=``,u=``,f;a<e.length;)if(a<e.length-1&&!e[a][1])e.splice(a,1);else switch(e[a][0]){case r:s++,u+=e[a][1],a++;break;case n:o++,c+=e[a][1],a++;break;case i:var p=a-s-o-1;if(t){if(p>=0&&w(e[p][1])){var m=e[p][1].slice(-1);if(e[p][1]=e[p][1].slice(0,-1),c=m+c,u=m+u,!e[p][1]){e.splice(p,1),a--;var h=p-1;e[h]&&e[h][0]===r&&(s++,u=e[h][1]+u,h--),e[h]&&e[h][0]===n&&(o++,c=e[h][1]+c,h--),p=h}}if(C(e[a][1])){var m=e[a][1].charAt(0);e[a][1]=e[a][1].slice(1),c+=m,u+=m}}if(a<e.length-1&&!e[a][1]){e.splice(a,1);break}if(c.length>0||u.length>0){c.length>0&&u.length>0&&(f=l(u,c),f!==0&&(p>=0?e[p][1]+=u.substring(0,f):(e.splice(0,0,[i,u.substring(0,f)]),a++),u=u.substring(f),c=c.substring(f)),f=d(u,c),f!==0&&(e[a][1]=u.substring(u.length-f)+e[a][1],u=u.substring(0,u.length-f),c=c.substring(0,c.length-f)));var g=s+o;c.length===0&&u.length===0?(e.splice(a-g,g),a-=g):c.length===0?(e.splice(a-g,g,[r,u]),a=a-g+1):u.length===0?(e.splice(a-g,g,[n,c]),a=a-g+1):(e.splice(a-g,g,[n,c],[r,u]),a=a-g+2)}a!==0&&e[a-1][0]===i?(e[a-1][1]+=e[a][1],e.splice(a,1)):a++,s=0,o=0,c=``,u=``}e[e.length-1][1]===``&&e.pop();var _=!1;for(a=1;a<e.length-1;)e[a-1][0]===i&&e[a+1][0]===i&&(e[a][1].substring(e[a][1].length-e[a-1][1].length)===e[a-1][1]?(e[a][1]=e[a-1][1]+e[a][1].substring(0,e[a][1].length-e[a-1][1].length),e[a+1][1]=e[a-1][1]+e[a+1][1],e.splice(a-1,1),_=!0):e[a][1].substring(0,e[a+1][1].length)==e[a+1][1]&&(e[a-1][1]+=e[a+1][1],e[a][1]=e[a][1].substring(e[a+1][1].length)+e[a+1][1],e.splice(a+1,1),_=!0)),a++;_&&b(e,t)}function x(e){return e>=55296&&e<=56319}function S(e){return e>=56320&&e<=57343}function C(e){return S(e.charCodeAt(0))}function w(e){return x(e.charCodeAt(e.length-1))}function T(e){for(var t=[],n=0;n<e.length;n++)e[n][1].length>0&&t.push(e[n]);return t}function E(e,t,a,o){return w(e)||C(o)?null:T([[i,e],[n,t],[r,a],[i,o]])}function D(e,t,n){var r=typeof n==`number`?{index:n,length:0}:n.oldRange,i=typeof n==`number`?null:n.newRange,a=e.length,o=t.length;if(r.length===0&&(i===null||i.length===0)){var s=r.index,c=e.slice(0,s),l=e.slice(s),u=i?i.index:null;editBefore:{var d=s+o-a;if(u!==null&&u!==d||d<0||d>o)break editBefore;var f=t.slice(0,d),p=t.slice(d);if(p!==l)break editBefore;var m=Math.min(s,d),h=c.slice(0,m),g=f.slice(0,m);if(h!==g)break editBefore;var _=c.slice(m),v=f.slice(m);return E(h,_,v,l)}editAfter:{if(u!==null&&u!==s)break editAfter;var y=s,f=t.slice(0,y),p=t.slice(y);if(f!==c)break editAfter;var b=Math.min(a-y,o-y),x=l.slice(l.length-b),S=p.slice(p.length-b);if(x!==S)break editAfter;var _=l.slice(0,l.length-b),v=p.slice(0,p.length-b);return E(c,_,v,x)}}if(r.length>0&&i&&i.length===0)replaceRange:{var h=e.slice(0,r.index),x=e.slice(r.index+r.length),m=h.length,b=x.length;if(o<m+b)break replaceRange;var g=t.slice(0,m),S=t.slice(o-b);if(h!==g||x!==S)break replaceRange;var _=e.slice(m,a-b),v=t.slice(m,o-b);return E(h,_,v,x)}return null}function O(e,t,n,r){return a(e,t,n,r,!0)}O.INSERT=r,O.DELETE=n,O.EQUAL=i,t.exports=O}))(),1);function fc(e,t){let n=(0,dc.default)(e,t),r=[],i=[];for(let[e,t]of n)e===dc.default.EQUAL?(r.push({text:t,type:`same`}),i.push({text:t,type:`same`})):e===dc.default.DELETE?r.push({text:t,type:`changed`}):e===dc.default.INSERT&&i.push({text:t,type:`changed`});return{oldSegments:r,newSegments:i}}var pc=/[\p{L}\p{N}_]/u;function mc(e){let t=e.map(e=>e.text).join(``);return t.length===0?e:_c(t,gc(t,hc(e,t.length)))}function hc(e,t){let n=new Uint8Array(t),r=0;for(let t of e)t.type===`changed`&&n.fill(1,r,r+t.text.length),r+=t.text.length;return n}function gc(e,t){let n=Uint8Array.from(t);for(let r=0;r<e.length;r++)if(t[r]&&pc.test(e[r])){if(r===0||!t[r-1])for(let t=r-1;t>=0&&pc.test(e[t]);t--)n[t]=1;if(r===e.length-1||!t[r+1])for(let t=r+1;t<e.length&&pc.test(e[t]);t++)n[t]=1}return n}function _c(e,t){let n=[],r=0;for(let i=1;i<=e.length;i++)i<e.length&&t[i]===t[r]||(n.push({text:e.slice(r,i),type:t[r]?`changed`:`same`}),r=i);return n}var vc=/^@@ -(\d+)(?:,(\d+))? \+(\d+)(?:,(\d+))? @@(.*)$/;function yc(e){let t=vc.exec(e);return t?{oldStart:parseInt(t[1],10),oldCount:t[2]===void 0?1:parseInt(t[2],10),newStart:parseInt(t[3],10),newCount:t[4]===void 0?1:parseInt(t[4],10),context:t[5].trim()}:null}function bc(e){return uc(e)}function xc(e){return Math.max(3,String(e).length)}function Sc(e,t){let n=0,r=0,i=0;for(let t of e)r+=t.text.length,t.type===`same`&&(n+=t.text.length);for(let e of t)i+=e.text.length;let a=r+i-n;return a!==0&&n/a>=.5}function Cc(e,t,n){let r=new Map,i=new Map,a=Math.min(e.length,t.length);for(let o=0;o<a;o++){let a=n(e[o]),s=n(t[o]);if(!a||!s||a.length>1e3||s.length>1e3)continue;let{oldSegments:c,newSegments:l}=fc(a,s);Sc(c,l)&&(r.set(o,mc(c)),i.set(o,mc(l)))}return{delSegments:r,addSegments:i}}function wc(e){let t=new Map,n=null;for(let r of e.lines){if(r.type===`header`&&r.content.startsWith(`diff --git`)){let e=bc(r.content);e===null?n=null:(n=t.get(e)??[],t.set(e,n))}n?.push(r)}let r=new Map;for(let[e,n]of t)r.set(e,{lines:n});return r}function Tc(e){return!(e.startsWith(`index `)||e.startsWith(`--- `)||e.startsWith(`+++ `)||e.startsWith(`similarity index`))}function Ec(e){return e.type!==`header`||Tc(e.content)}function Dc(e){return e.type===`addition`||e.type===`deletion`||e.type===`context`&&e.content.startsWith(` `)?e.content.slice(1):e.content}var Oc=/[\u0000-\u0008\u000b-\u001f\u007f]/g;function kc(e){return Dc(e).replace(Oc,``)}function Ac(e){let t=yc(e);if(!t)return{oldRange:``,newRange:``,context:``};let n=(e,t)=>t===1?`${e}`:`${e}-${e+t-1}`;return{oldRange:n(t.oldStart,t.oldCount),newRange:n(t.newStart,t.newCount),context:t.context}}function jc(e){let t=[],n=null,r=null,i=null,a=()=>(r||(r={filePath:null,notes:[],hunks:[]},t.push(r)),r);for(let o of e)if(o.type===`header`){i=null;let e=bc(o.content);e===null?(a().notes.push(o.content),o.content.startsWith(`Binary files`)?n={kind:`binary`,note:`Binary file — no text diff to show.`}:o.content.startsWith(`Large file — diff not shown`)&&(n={kind:`large`,note:o.content})):(r={filePath:e,notes:[],hunks:[]},t.push(r))}else o.type===`hunk`?(i={header:o,lines:[]},a().hunks.push(i)):i&&i.lines.push(o);return{sections:t,notShown:n}}function Mc(e){let t=2166136261;for(let n=0;n<e.length;n++)t^=e.charCodeAt(n),t=Math.imul(t,16777619);return(t>>>0).toString(36)}function Nc(e,t){return`${e?`s`:`u`}:${t??``}`}function Pc(e,t,n){let r=yc(t),i=`${e}#${Mc(`${e} ${r?`${r.context} ${r.oldStart}`:t}`)}`,a=n.get(i)??0;return n.set(i,a+1),a>0&&(i=`${i}~${a}`),i}function Fc(e,t,n){return t.oldLineNum===void 0?t.newLineNum===void 0?`${e}:r${n}`:`${e}:+${t.newLineNum}`:`${e}:${t.oldLineNum}`}function Ic(e,t,n,r,i){let a={kind:t,...e.oldLineNum!==void 0&&t!==`add`&&{oldLineNum:e.oldLineNum},...e.newLineNum!==void 0&&t!==`del`&&{newLineNum:e.newLineNum},content:kc(e),...i&&{segments:i}};return{key:Fc(n,a,r),...a}}function Lc(e,t,n,r){let i=t,a=[];for(;i<e.length&&e[i].type===`deletion`;)a.push(e[i++]);let o=i<e.length&&oc(e[i].content)?e[i++]:null,s=[];for(;i<e.length&&e[i].type===`addition`;)s.push(e[i++]);if(a.length===0&&s.length===0)return i+1;let c=Cc(a,s,kc);return a.forEach((e,t)=>{n.push(Ic(e,`del`,r,n.length,c.delSegments.get(t)))}),o&&n.push(Ic(o,`no-newline`,r,n.length)),s.forEach((e,t)=>{n.push(Ic(e,`add`,r,n.length,c.addSegments.get(t)))}),i}function Rc(e,t){let n=[],r=0;for(;r<e.length;){let i=e[r];oc(i.content)?(n.push(Ic(i,`no-newline`,t,n.length)),r++):i.type===`context`?(n.push(Ic(i,`context`,t,n.length)),r++):r=Lc(e,r,n,t)}return n}function zc(e,t){let n=e.editedAt;for(let e of t)e.editedAt!==void 0&&(n===void 0||e.editedAt>n)&&(n=e.editedAt);return n}function Bc(e){let t=0;for(let n of e)for(let e of n.hunks)for(let n of e.rows)t=Math.max(t,n.oldLineNum??0,n.newLineNum??0);return t}function Vc(e,t,n){let r=Nc(t,e.filePath),i={key:r,filePath:e.filePath,notes:e.notes,hunks:[]},a=new Map;for(let t of e.hunks){let e=Pc(r,t.header.content,a);i.hunks.push({key:e,index:n(),...Ac(t.header.content),raw:t.header.content,editedAt:zc(t.header,t.lines),rows:Rc(t.lines,e)})}return i}var Hc={staged:new WeakMap,unstaged:new WeakMap};function Uc(e,t){let n=t?Hc.staged:Hc.unstaged,r=n.get(e);if(r)return r;let i=Wc(e,t);return n.set(e,i),i}function Wc(e,t=!1){let n={sections:[],lineNumWidth:3,rowCount:0,notShown:null};if(!e)return n;let r=0,i=()=>r++,a=jc(e.lines.filter(Ec));n.notShown=a.notShown,n.sections=a.sections.map(e=>Vc(e,t,i));for(let e of n.sections)for(let t of e.hunks)n.rowCount+=t.rows.length,t.editedAt!==void 0&&(n.latestEditedAt===void 0||t.editedAt>n.latestEditedAt)&&(n.latestEditedAt=t.editedAt);return n.lineNumWidth=xc(Bc(n.sections)),n}var Gc={dark:{name:`dark`,displayName:`Dark`,colors:{addBg:`#022800`,delBg:`#3D0100`,addHighlight:`#044700`,delHighlight:`#5C0200`,text:`white`,addLineNum:`#368F35`,delLineNum:`#A14040`,contextLineNum:`gray`,addSymbol:`greenBright`,delSymbol:`redBright`}},light:{name:`light`,displayName:`Light`,colors:{addBg:`#69db7c`,delBg:`#ffa8b4`,addHighlight:`#2f9d44`,delHighlight:`#d1454b`,text:`black`,addLineNum:`#2f9d44`,delLineNum:`#d1454b`,contextLineNum:`#6c757d`,addSymbol:`green`,delSymbol:`red`}},"dark-colorblind":{name:`dark-colorblind`,displayName:`Dark (colorblind)`,colors:{addBg:`#004466`,delBg:`#660000`,addHighlight:`#0077b3`,delHighlight:`#b30000`,text:`white`,addLineNum:`#0077b3`,delLineNum:`#b30000`,contextLineNum:`gray`,addSymbol:`cyanBright`,delSymbol:`redBright`}},"light-colorblind":{name:`light-colorblind`,displayName:`Light (colorblind)`,colors:{addBg:`#99ccff`,delBg:`#ffcccc`,addHighlight:`#3366cc`,delHighlight:`#993333`,text:`black`,addLineNum:`#3366cc`,delLineNum:`#993333`,contextLineNum:`#6c757d`,addSymbol:`blue`,delSymbol:`red`}},"dark-ansi":{name:`dark-ansi`,displayName:`Dark (ANSI)`,colors:{addBg:`green`,delBg:`red`,addHighlight:`greenBright`,delHighlight:`redBright`,text:`white`,addLineNum:`greenBright`,delLineNum:`redBright`,contextLineNum:`gray`,addSymbol:`greenBright`,delSymbol:`redBright`}},"light-ansi":{name:`light-ansi`,displayName:`Light (ANSI)`,colors:{addBg:`green`,delBg:`red`,addHighlight:`greenBright`,delHighlight:`redBright`,text:`black`,addLineNum:`green`,delLineNum:`red`,contextLineNum:`gray`,addSymbol:`green`,delSymbol:`red`}}},Kc=[`dark`,`light`,`dark-colorblind`,`light-colorblind`,`dark-ansi`,`light-ansi`];function qc(e){return typeof e==`string`&&Kc.includes(e)}var Jc={dark:{...Gc.dark,scheme:`dark`,chrome:{bg:`#0d100f`,surface:`#131716`,surfaceRaised:`#1a1f1d`,border:`#242b28`,text:`#d7ded9`,textDim:`#859089`,accent:`#3fa53d`,selection:`#43b3bc`,add:`#3fa53d`,del:`#c25e5e`,warn:`#d2b23e`,statusModified:`#d2b23e`,statusAdded:`#3fa53d`,statusDeleted:`#c25e5e`,statusUntracked:`#859089`,statusRenamed:`#6f9fdd`,statusCopied:`#43b3bc`,statusConflicted:`#d98c4a`,uncommitted:`#c678dd`,flash:`#e5c94b`},syntax:{keyword:`#c678dd`,string:`#98c379`,comment:`#6e7a72`,number:`#d19a66`,literal:`#56b6c2`,title:`#61afef`,attr:`#e5c07b`,meta:`#859089`}},light:{...Gc.light,scheme:`light`,chrome:{bg:`#f5f6f5`,surface:`#fcfdfc`,surfaceRaised:`#eef1ee`,border:`#d7dcd8`,text:`#1d231f`,textDim:`#5d675f`,accent:`#2f9d44`,selection:`#0c7f8c`,add:`#247a36`,del:`#c03038`,warn:`#7a6300`,statusModified:`#9a7d00`,statusAdded:`#2f9d44`,statusDeleted:`#d1454b`,statusUntracked:`#6c757d`,statusRenamed:`#3b6fd4`,statusCopied:`#0c7f8c`,statusConflicted:`#b5561d`,uncommitted:`#9c36b5`,flash:`#eac54f`},syntax:{keyword:`#a626a4`,string:`#2f7d3b`,comment:`#6a737d`,number:`#b25e09`,literal:`#0184bc`,title:`#4078f2`,attr:`#986801`,meta:`#5d675f`}},"dark-colorblind":{...Gc[`dark-colorblind`],scheme:`dark`,chrome:{bg:`#0d0f11`,surface:`#131619`,surfaceRaised:`#191d21`,border:`#242a30`,text:`#d6dce2`,textDim:`#848f9a`,accent:`#2596d1`,selection:`#45b8c9`,add:`#2596d1`,del:`#d16060`,warn:`#d2b23e`,statusModified:`#d2b23e`,statusAdded:`#2596d1`,statusDeleted:`#d16060`,statusUntracked:`#848f9a`,statusRenamed:`#6f9fdd`,statusCopied:`#45b8c9`,statusConflicted:`#d55e00`,uncommitted:`#c678dd`,flash:`#e5c94b`},syntax:{keyword:`#c678dd`,string:`#56b6c2`,comment:`#7d8894`,number:`#d19a66`,literal:`#2596d1`,title:`#6f9fdd`,attr:`#e5c07b`,meta:`#848f9a`}},"light-colorblind":{...Gc[`light-colorblind`],scheme:`light`,chrome:{bg:`#f4f6f8`,surface:`#fcfdfe`,surfaceRaised:`#edf0f3`,border:`#d5dbe1`,text:`#1d2126`,textDim:`#5c6670`,accent:`#3366cc`,selection:`#0c7f8c`,add:`#3366cc`,del:`#993333`,warn:`#7a6300`,statusModified:`#9a7d00`,statusAdded:`#3366cc`,statusDeleted:`#993333`,statusUntracked:`#6c757d`,statusRenamed:`#3b6fd4`,statusCopied:`#0c7f8c`,statusConflicted:`#a8460b`,uncommitted:`#9c36b5`,flash:`#eac54f`},syntax:{keyword:`#9c36b5`,string:`#0c7f8c`,comment:`#6a737d`,number:`#b25e09`,literal:`#0184bc`,title:`#3b6fd4`,attr:`#986801`,meta:`#5c6670`}},"dark-ansi":{...Gc[`dark-ansi`],scheme:`dark`,chrome:{bg:`#000000`,surface:`#121212`,surfaceRaised:`#1c1c1c`,border:`#3a3a3a`,text:`#e5e5e5`,textDim:`#7f7f7f`,accent:`#00ff00`,selection:`#00cdcd`,add:`#00ff00`,del:`#ff0000`,warn:`#cdcd00`,statusModified:`#cdcd00`,statusAdded:`#00cd00`,statusDeleted:`#cd0000`,statusUntracked:`#7f7f7f`,statusRenamed:`#5c5cff`,statusCopied:`#00cdcd`,statusConflicted:`#ff8700`,uncommitted:`#cd00cd`,flash:`#ffff00`},syntax:{keyword:`#cd00cd`,string:`#00cd00`,comment:`#7f7f7f`,number:`#cdcd00`,literal:`#00cdcd`,title:`#5c5cff`,attr:`#cdcd00`,meta:`#7f7f7f`}},"light-ansi":{...Gc[`light-ansi`],scheme:`light`,chrome:{bg:`#ffffff`,surface:`#f5f5f5`,surfaceRaised:`#ebebeb`,border:`#c0c0c0`,text:`#000000`,textDim:`#7f7f7f`,accent:`#00a000`,selection:`#00a3a3`,add:`#007700`,del:`#cd0000`,warn:`#6e6e00`,statusModified:`#a0a000`,statusAdded:`#00a000`,statusDeleted:`#cd0000`,statusUntracked:`#7f7f7f`,statusRenamed:`#0000ee`,statusCopied:`#00a3a3`,statusConflicted:`#c85000`,uncommitted:`#cd00cd`,flash:`#ffff00`},syntax:{keyword:`#cd00cd`,string:`#00a000`,comment:`#7f7f7f`,number:`#a0a000`,literal:`#00a3a3`,title:`#0000ee`,attr:`#a0a000`,meta:`#7f7f7f`}}},Yc=[`changes`,`journal`,`history`,`compare`,`explorer`];function Xc(e){return typeof e==`string`&&Yc.includes(e)}function Zc(e){try{return decodeURIComponent(e)}catch{return e}}function Qc(e){return encodeURIComponent(e).split(`%2F`).join(`/`).split(`%3A`).join(`:`)}function $c(e){let t=new Map;for(let n of e.replace(/^\?/,``).split(`&`)){if(n===``)continue;let e=n.indexOf(`=`),r=e===-1?n:n.slice(0,e),i=e===-1?``:n.slice(e+1);t.set(Zc(r),Zc(i))}return t}var el={repo:null,view:null,at:null,base:null,head:null,whole:null};function tl(e,t=``){let n=e.split(`/`).filter(Boolean);if(n.length===0||!Xc(n[0]))return el;let r=n[0],i=n.slice(1),a=$c(t),o=a.get(`at`)??null,s=a.get(`base`)??null,c=a.get(`head`)||null,l=a.get(`whole`)||null;if(i.length===0)return{repo:null,view:r,at:o,base:s,head:c,whole:l};let u=i[0]===`~`;return{repo:{homeRelative:u,path:(u?i.slice(1):i).map(Zc).join(`/`)},view:r,at:o,base:s,head:c,whole:l}}function nl(e,t){let n=t!==null&&(e===t||e.startsWith(t+`/`)),r=(n?e.slice(t.length):e).split(`/`).filter(Boolean).map(e=>e===`~`?`%7E`:encodeURIComponent(e));return n?[`~`,...r]:r}function rl(e){if(e.repoPath===null)return`/`;let t=[];e.base!==null&&e.base!==void 0&&t.push(`base=${Qc(e.base)}`),e.head!==null&&e.head!==void 0&&e.head!==``&&t.push(`head=${Qc(e.head)}`),e.whole!==null&&e.whole!==void 0&&e.whole!==``&&t.push(`whole=${Qc(e.whole)}`),e.at!==null&&e.at!==void 0&&t.push(`at=${Qc(e.at)}`);let n=`/`+[e.view,...nl(e.repoPath,e.home??null)].join(`/`);return t.length===0?n:`${n}?${t.join(`&`)}`}var il={staged:!1,unstaged:!1,untracked:!1},al=`diffstalker:prefs`,ol=[`unified`,`split`];function sl(e){return typeof e==`string`&&ol.includes(e)}var cl=[`side-by-side`,`swipe`,`onion`];function ll(e){return typeof e==`string`&&cl.includes(e)}var ul=.15,dl=.65,fl=.1,pl=.6;function ml(){return{theme:null,activeView:`changes`,recentRepos:[],autoMode:!1,diffSyntax:!1,diffMode:`unified`,imageDiffMode:`side-by-side`,wrapEnabled:!1,changesSplit:null,changesTop:null,historyTop:null,compareTop:null,explorerTop:null,compareUncommitted:{...il}}}function hl(e,t,n){return typeof e!=`number`||!Number.isFinite(e)?null:e>=t&&e<=n?e:null}function gl(e){if(typeof e!=`object`||!e)return{...il};let{staged:t,unstaged:n,untracked:r}=e;return typeof t!=`boolean`||typeof n!=`boolean`||typeof r!=`boolean`||n&&!t?{...il}:{staged:t,unstaged:n,untracked:r}}var _l=[`changesTop`,`historyTop`,`compareTop`,`explorerTop`];function vl(e){let t=ml();if(typeof e!=`object`||!e)return t;let n=e;qc(n.theme)&&(t.theme=n.theme),Xc(n.activeView)&&(t.activeView=n.activeView),Array.isArray(n.recentRepos)&&(t.recentRepos=n.recentRepos.filter(e=>typeof e==`string`).slice(0,8)),typeof n.autoMode==`boolean`&&(t.autoMode=n.autoMode),typeof n.diffSyntax==`boolean`&&(t.diffSyntax=n.diffSyntax),sl(n.diffMode)&&(t.diffMode=n.diffMode),ll(n.imageDiffMode)&&(t.imageDiffMode=n.imageDiffMode),typeof n.wrapEnabled==`boolean`&&(t.wrapEnabled=n.wrapEnabled),t.changesSplit=hl(n.changesSplit,ul,dl);for(let e of _l)t[e]=hl(n[e],fl,pl);return t.compareUncommitted=gl(n.compareUncommitted),t}function yl(){let e;try{e=localStorage.getItem(al)}catch{return ml()}if(e===null)return ml();try{return vl(JSON.parse(e))}catch{return ml()}}function bl(e){let t={...yl(),...e};try{localStorage.setItem(al,JSON.stringify(t))}catch{}}var xl=20,Sl=1e3,Cl=6,wl=4,Tl=15;function El(e,t){if(e===t)return!0;if(e.lines.length!==t.lines.length)return!1;for(let n=0;n<e.lines.length;n++)if(e.lines[n].content!==t.lines[n].content||e.lines[n].type!==t.lines[n].type)return!1;return!0}function Dl(e){return`${e.staged?`s`:`u`}:${e.path}`}function Ol(e){return`${e.uncommitted??`c`}:${e.path}`}function kl(e,t){let n=e.layers.findIndex(e=>e.name===t);if(n===-1)return null;let r=e.layers[n];return{layer:r,base:n===0?e.trunk:e.layers[n-1].name,head:r.isHead?void 0:r.name}}var Al=`daemon connection lost — reconnecting…`;function jl(e){return Ls(e)?Al:Rs(e)}function Ml(){return{status:null,hunkCounts:null,stashList:[],operationInProgress:null,mtimes:null,error:null,isLoading:!0}}function Nl(){return{file:null}}function Pl(){return{commits:[],selectedCommit:null,commitFiles:null,isLoading:!1}}function Fl(){return{compareDiff:null,pair:null,baseBranch:null,commitCount:null,loading:!1,error:null,noBaseBranch:!1,selection:{type:null,index:0,diff:null}}}var Il=Ps(`repo`,()=>{let e=new Xs,t=ic(),n=H(null),r=H(null),i=H(Ml()),a=H({byKey:new Map,seq:0}),o=H(new Map),s=H(Nl()),c=H(Pl()),l=H([]),u=H(null),d=H(0),f=H(!1),p=H(!1),m=H(Fl()),h=H(null),g=H(null),_=H(yl().compareUncommitted),v=H(null),y=H(null),b=null,x=H(!1),S=H(null),C=0,w=$(()=>n.value!==null),T=0,E=null,D=null,O=null,k=!1,A=null,j=!1,M=!1,N=!1,P=0,F=null,I=[],L=100,ee=0,R=0,te=!1,ne=!1,re=0,ie=0,ae=new Map,oe=new Set,se=[],ce=0,le=new Map,ue=null,de=null;function fe(){O&&=(clearTimeout(O),null),ue&&=(clearTimeout(ue),null)}function pe(){fe(),k=!1,D=null,j=!1,M=!1,N=!1,P=0,F=null,I=[],L=100,te=!1,de=null,ae.clear(),le.clear(),oe.clear(),se.length=0,i.value=Ml(),a.value={byKey:new Map,seq:0},o.value=new Map,s.value=Nl(),c.value=Pl(),l.value=[],u.value=null,d.value=0,f.value=!1,p.value=!1,m.value=Fl(),h.value=null,g.value=null,v.value=null,y.value=null,x.value=!1,S.value=null,b=null,C++}async function z(a){let o=++T;E??=n.value;try{let t=await e.openRepo(a);return o===T?(E!==null&&me(E),pe(),E=t.id,n.value=t.id,r.value=t.path,he(),t):(me(t.id),null)}catch(e){return o===T?Ls(e)?(pe(),t.detachRepo(),n.value=null,r.value=a,ve(),null):(Zs(`open repo`,e,{path:a}),i.value={...i.value,error:Rs(e),isLoading:!1},null):null}}function me(t){e.closeRepo(t).catch(e=>Qs(`release repo`,e,{id:t}))}function he(){let e=n.value;e!==null&&t.attachRepo(e,{onSnapshot:e=>B(e),onStateChange:e=>B(e),onJournalAppend:e=>at(e),onResume:()=>void dt(),onMissing:({id:e})=>{e===n.value&&ve()},onError:()=>ve()})}async function ge(){let r=++T;t.detachRepo(),fe(),k=!1;let i=n.value??E;if(E=null,i!==null){if(await e.closeRepo(i).catch(e=>{Qs(`release repo`,e,{id:i})}),r!==T)return;n.value=null}}function _e(){let t=E;t!==null&&(E=null,e.releaseRepoOnUnload(t))}function ve(){D=null,i.value.error!==`daemon connection lost — reconnecting…`&&(console.warn(`diffstalker: daemon connection lost; reconnecting`,{path:r.value}),i.value={...i.value,error:Al,isLoading:!1}),be()}function ye(e,t){return t===T?Ls(e)?(ve(),!0):!1:!0}function be(){k||O||(O=setTimeout(()=>{O=null,xe()},Sl))}async function xe(){let i=r.value;if(k||i===null)return;k=!0;let a=T;try{let r=await e.openRepo(i);if(a!==T)return;E??=r.id,n.value=r.id,t.trackActive(r),he();let o=await e.status(r.id);if(a!==T)return;B(o),dt()}catch(e){Se(e,i),k=!1,a===T&&be();return}k=!1,A=null}function Se(e,t){if(Ls(e))return;let n=`${e instanceof Is?e.status:``} ${Rs(e)}`;n!==A&&(A=n,Zs(`recover repo`,e,{path:t}))}function B(e){re+=1;let t=de;de=Pe(e),i.value={status:e.status,hunkCounts:e.hunkCounts,stashList:e.stashList,operationInProgress:e.operationInProgress,mtimes:e.mtimes,error:we(e),isLoading:!1},Ne();let n=Ge(t,de);Qe(n),te?We(n):Re(),c.value.commits.length>0&&tt(),(m.value.compareDiff!==null||m.value.error!==null)&&!m.value.loading?bt():ht()}function Ce(e){i.value={...i.value,error:e}}function we(e){return e.error===null?(D!==null&&Te(D,e)&&(D=null),D?.message??null):(D=null,e.error)}function Te(e,t){let n=t.status?.files;return n?!n.some(t=>t.path===e.path&&t.staged!==e.staged):!1}function Ee(e,t,n){let r=`Could not ${t?`stage`:`unstage`} ${e}: ${n}`;D={message:r,path:e,staged:t},i.value={...i.value,error:r}}function De(){let e=D;D=null,e!==null&&i.value.error===e.message&&(i.value={...i.value,error:null})}async function Oe(t,r){let i=n.value;if(i===null)return;let a=T;De();try{r?await e.stage(i,t):await e.unstage(i,t)}catch(e){if(ye(e,a))return;Zs(r?`stage file`:`unstage file`,e,{path:t}),Ee(t,r,Rs(e))}}function ke(e){return Oe(e,!0)}function Ae(e){return Oe(e,!1)}async function je(e,t){let n=T;try{return await e()}catch(e){if(ye(e,n))return t;throw e}}function Me(e){s.value={file:e}}function Ne(){let e=s.value.file,t=i.value.status;if(!e||!t)return;let n=t.files.find(t=>t.path===e.path&&t.staged===e.staged)??t.files.find(t=>t.path===e.path);s.value=n?{file:n}:Nl()}function Pe(e){return{files:new Map((e.status?.files??[]).map(e=>[Dl(e),e])),mtimes:e.mtimes,hunkCounts:e.hunkCounts}}function Fe(e){let t=a.value,n=new Map(t.byKey);e(n)&&(a.value={byKey:n,seq:t.seq+1})}function Ie(e,t,n){if((ae.get(e)??0)>t||de!==null&&!de.files.has(e))return;ae.set(e,t);let r=a.value.byKey.get(e);r&&El(r.diff,n)||Fe(t=>(t.set(e,{diff:Yt(n),fetchedAt:Date.now()}),!0))}async function Le(t){let r=n.value;if(r===null||t.length===0)return;let i=T,a=[...t],o=!1,s=null,c=async()=>{for(;;){let t=a.shift();if(!t||o||i!==T)return;let n=Dl(t),c=++ie;try{let a=t.status===`untracked`?await e.diff(r,{path:t.path}):await e.diff(r,{path:t.path,staged:t.staged});if(i!==T)return;Ie(n,c,a)}catch(e){if(ye(e,i)){o=!0;return}Zs(`load diff`,e,{path:t.path,staged:t.staged}),s??=Rs(e)}}},l=Array.from({length:Math.min(Cl,a.length)},()=>c());await Promise.all(l),s!==null&&!o&&i===T&&Ce(`Failed to load diffs: ${s}`)}async function Re(){if(ne||n.value===null)return;ne=!0;let e=T,t=de,r=re;try{await ze({quiet:!0})}finally{ne=!1}e===T&&te&&de!==null&&re!==r&&We(Ge(t,de))}async function ze(t={}){let r=n.value;if(r===null)return;let a=T,o=++ie,s,c;try{[s,c]=await Promise.all([e.diff(r,{}),e.diff(r,{staged:!0})])}catch(e){if(ye(e,a))return;Zs(`load diffs`,e),t.quiet||Ce(`Failed to load diffs: ${Rs(e)}`);return}if(a!==T)return;te=!0;let l=i.value.status?.files??[],u=new Set(l.map(Dl));Fe(e=>{let t=Be(e,`u`,wc(s),u,o);t=Be(e,`s`,wc(c),u,o)||t;for(let n of[...e.keys()])u.has(n)||(e.delete(n),ae.delete(n),t=!0);return t}),await Le(l.filter(e=>e.status===`untracked`))}function Be(e,t,n,r,i){let a=!1;for(let[o,s]of n){let n=`${t}:${o}`;if(!r.has(n)||(ae.get(n)??0)>i)continue;ae.set(n,i);let c=e.get(n);c&&El(c.diff,s)||(e.set(n,{diff:Yt(s),fetchedAt:Date.now()}),a=!0)}return a}function Ve(t,n){if(n.view===`history`)return e.commitDiff(t,n.hash,{path:n.path,whole:!0});if(n.view===`compare`){let r=m.value.pair;return r===null?Promise.reject(Error(`No compare is loaded`)):e.compareFileDiff(t,{path:n.path,base:r.base,head:r.head??void 0,uncommitted:n.side,whole:!0})}let r=de?.files.get(n.key);return e.diff(t,{path:r?.path??n.path,staged:r?.staged??!1,whole:!0})}async function He(e){let t=n.value,r=++C;if(b=e,e===null||t===null){y.value=null,x.value=!1,S.value=null;return}let i=e.key;if(e.view===`changes`){let e=de?.files.get(i);if(!e||e.status===`untracked`){y.value=null,x.value=!1,S.value=null;return}}S.value=null,y.value=null,x.value=!0;let a=T;try{let n=await Ve(t,e);if(a!==T||r!==C)return;if(ac(n)){S.value={key:i,reason:`Too large to show whole — the hunks are all of it that fits`};return}y.value={key:i,path:e.path,diff:Yt(n)}}catch(t){if(r!==C||ye(t,a))return;Zs(`load whole file`,t,{path:e.path}),Ce(`Failed to load whole file: ${Rs(t)}`)}finally{a===T&&r===C&&(x.value=!1)}}function Ue(e){let t=b;t!==null&&y.value!==null&&t.view===`changes`&&(de!==null&&!de.files.has(t.key)?He(null):e.some(e=>Dl(e)===t.key)&&He(t))}function We(e){let t=de;if(t===null)return;let n=[...a.value.byKey.keys()].filter(e=>!t.files.has(e));n.length>0&&Fe(e=>{for(let t of n)e.delete(t),ae.delete(t);return!0});for(let e of[...le.keys()])t.files.has(e)||le.delete(e);Ue(e),e.length!==0&&(e.length>Tl?(le.clear(),ze()):qe(e))}function Ge(e,t){let n=[];for(let[r,i]of t.files){let a=e?.files.get(r);if(!a){n.push(i);continue}let o=t.mtimes?.[i.path]!==e?.mtimes?.[i.path],s=Ke(t.hunkCounts,i)!==Ke(e?.hunkCounts??null,i);(o||s||a.status!==i.status)&&n.push(i)}return n}function Ke(e,t){return e?(t.staged?e.staged:e.unstaged)[t.path]??0:0}function qe(e){for(let t of e)le.set(Dl(t),t);ue||=setTimeout(()=>{ue=null;let e=[...le.values()];le.clear(),Le(e)},xl)}function Je(e,t){let r=Dl(e);return n.value===null||oe.has(r)?Promise.resolve():(oe.add(r),new Promise(n=>{se.push({key:r,path:e.path,staged:t,settle:n}),Ye()}))}function Ye(){for(;ce<wl&&se.length>0;)ce+=1,Xe()}async function Xe(){try{for(;;){let e=se.shift();if(e===void 0)return;try{await Ze(e)}finally{e.settle()}}}finally{--ce}}async function Ze(t){let r=n.value;if(r===null)return;let i=T;try{let n=await e.media(r,t.path,t.staged);if(i!==T||!oe.has(t.key))return;let a=new Map(o.value);a.set(t.key,Yt(n)),o.value=a}catch(e){if(i!==T||(oe.delete(t.key),ye(e,i)))return;Zs(`load image metadata`,e,{path:t.path}),Ce(`Failed to load image metadata: ${Rs(e)}`)}}function Qe(e){let t=de;if(t===null)return;let n=[...o.value.keys()].filter(e=>!t.files.has(e));for(let e of n)oe.delete(e);if(n.length>0){let e=new Map(o.value);for(let t of n)e.delete(t);o.value=e}for(let t of e)oe.delete(Dl(t))}function $e(e,t){return Uc(e,t)}async function et(t=100){let r=n.value;if(r===null)return;let i=T;L=t,c.value={...c.value,isLoading:!0};try{let n=await e.history(r,t);if(i!==T)return;let a=c.value.selectedCommit,o=a===null?null:n.find(e=>e.hash===a.hash)??null;c.value={commits:n,selectedCommit:o,commitFiles:o===null?null:c.value.commitFiles,isLoading:!1}}catch(e){if(i!==T||(c.value={...c.value,isLoading:!1},ye(e,i)))return;throw e}}async function tt(){if(!j){j=!0;try{await et(L)}catch(e){Zs(`reload history`,e)}finally{j=!1}}}async function nt(t){let r=n.value;if(r===null)return null;let i=T;try{let n=await e.getCommit(r,t);return i===T?n:null}catch(e){return ye(e,i),null}}async function rt(t){let r=t&&(c.value.commits.find(e=>e.hash===t.hash)??t);c.value={...c.value,selectedCommit:r,commitFiles:null};let i=n.value;if(!r||i===null)return;let a=T,o=await je(()=>e.commitFiles(i,r.hash),null);o!==null&&a===T&&c.value.selectedCommit?.hash===r.hash&&(c.value={...c.value,commitFiles:o})}function it(e,t){let n=new Map(e.map(e=>[e.seq,e])),r=!1;for(let e of t)n.has(e.seq)||(n.set(e.seq,e),r=!0);return r?[...n.values()].sort((e,t)=>e.seq-t.seq):e}function at(e){f.value?e.epoch===u.value?ot(e.entries):(I.push(e),lt()):(F!==null&&F!==e.epoch&&(l.value=[]),F=e.epoch,ot(e.entries))}function ot(e){let t=l.value,n=t.at(-1)?.seq??0,r=e.filter(e=>e.seq>n).sort((e,t)=>e.seq-t.seq);r.length!==0&&(l.value=[...t,...r])}function st(e){l.value=e.entries,u.value=e.epoch,d.value=e.prunedBefore,P=e.entries.at(-1)?.seq??e.prunedBefore,p.value=!0}function ct(){let e=I;I=[];for(let t of e){if(t.epoch!==u.value)continue;let e=it(l.value,t.entries);e!==l.value&&(l.value=e)}}async function lt(){let t=n.value;if(t===null||N)return;N=!0;let r=T;try{let n=await e.journal(t);if(r!==T)return;st(n),ct()}catch(e){ye(e,r)||Zs(`reload journal`,e)}finally{N=!1}}async function ut(){let t=n.value;if(t===null||f.value||M)return;M=!0;let r=T;try{let n=await e.journal(t);if(r!==T)return;F!==null&&F!==n.epoch?l.value=n.entries:l.value=it(l.value,n.entries),F=null,u.value=n.epoch,d.value=n.prunedBefore,P=n.entries.at(-1)?.seq??n.prunedBefore,f.value=!0}catch(e){if(ye(e,r))return;throw e}finally{M=!1}}async function dt(){let t=n.value;if(t===null||N)return;if(!f.value){l.value.length>0&&(l.value=[]),F=null;return}N=!0;let r=T,i=P;try{let n=await e.journal(t,i);if(r!==T)return;if(n.epoch!==u.value||n.prunedBefore>i){let n=await e.journal(t);if(r!==T)return;st(n),ct();return}let a=it(l.value,n.entries);a!==l.value&&(l.value=a),n.prunedBefore!==d.value&&(d.value=n.prunedBefore);let o=n.entries.at(-1)?.seq;o!==void 0&&o>P&&(P=o)}catch(e){ye(e,r)||Zs(`resync journal`,e)}finally{N=!1}ft(r)}function ft(e){e===T&&I.length!==0&&lt()}async function pt(e){_.value={...e},bl({compareUncommitted:_.value}),await bt()}function mt(e,t){let n=e.selection;if(n.type!==`file`)return n;let r=e.compareDiff?.files[n.index]?.path,i=r===void 0?-1:t.files.findIndex(e=>e.path===r);return i===-1?{type:null,index:0,diff:null}:{type:`file`,index:i,diff:t.files[i].diff}}async function ht(){let t=n.value;if(t===null)return;let r=T,i=++R,a=gt();if(a===null)m.value={...m.value,commitCount:null};else try{let{commits:n}=await e.compareCount(t,a);if(r!==T||i!==R)return;m.value={...m.value,commitCount:n}}catch(e){if(r!==T||i!==R)return;if(e instanceof Is&&e.status===422){m.value={...m.value,commitCount:null};return}Qs(`count compare commits`,e)}}function gt(){let e=g.value;if(e===null)return{base:h.value??void 0,head:void 0};let t=v.value;if(t===null)return null;let n=kl(t,e);return n===null?null:{base:n.base,head:n.head}}function _t(e){return e instanceof Is&&e.status===422||Qs(`load compare stack`,e,{base:h.value}),null}async function vt(t,n,r){let[i,a]=await Promise.all([e.compareStack(t,{base:n}).catch(_t),e.compare(t,{base:n,...r})]);return{stack:i,diff:a,head:void 0,uncommitted:r}}async function yt(t,n,r,i,a){let o=await e.compareStack(t,{base:n});if(a())return null;let s=kl(o,r);if(s===null)return xt(r,o),null;let c=s.head===void 0;return{stack:o,diff:await e.compare(t,{base:s.base,head:s.head,...c?i:{}}),head:s.head,uncommitted:c?i:il}}async function bt(){let e=_.value,t=n.value;if(t===null)return;let r=T,i=++ee,a=()=>r!==T||i!==ee;m.value={...m.value,loading:!0,error:null,noBaseBranch:!1};let o=h.value??void 0,s=g.value;try{let n=s===null?await vt(t,o,e):await yt(t,o,s,e,a);if(n===null||a())return;let{stack:r,diff:i}=n;R+=1,v.value=r,m.value={...m.value,compareDiff:i,pair:{base:i.baseBranch,head:n.head??null,uncommitted:n.uncommitted},baseBranch:s===null||r===null?i.baseBranch:r.trunk,commitCount:i.commits.length,loading:!1,noBaseBranch:!1,selection:mt(m.value,i)}}catch(e){if(a())return;St(e)}}function xt(e,t){let n=`${e} is not a layer of this stack`;Zs(`compare`,Error(n),{head:e,layers:t.layers.map(e=>e.name)}),R+=1,v.value=t,m.value={...m.value,compareDiff:null,pair:null,baseBranch:t.trunk,commitCount:null,loading:!1,error:n,noBaseBranch:!1,selection:{type:null,index:0,diff:null}}}function St(e){Ls(e)?(m.value={...m.value,loading:!1},ve()):e instanceof Is&&e.status===422?m.value={...m.value,compareDiff:null,pair:null,baseBranch:null,commitCount:null,loading:!1,error:null,noBaseBranch:!0}:(Zs(`compare`,e,{base:h.value}),m.value={...m.value,loading:!1,error:`Failed to load compare diff: ${Rs(e)}`})}async function Ct(){let t=n.value;return t===null?[]:je(()=>e.baseBranches(t),[])}function wt(e){return Et({base:e,head:null})}function Tt(e){return Et({head:e})}async function Et(e){e.base!==void 0&&(h.value=e.base),g.value=e.head,await bt()}let Dt=$(()=>{let e=g.value,t=v.value;return e===null||t===null?null:kl(t,e)}),Ot=$(()=>Dt.value?.layer??null),kt=$(()=>{let e=m.value.pair;return e===null?{base:m.value.baseBranch,head:null}:{base:e.base,head:e.head}});function At(e){let t=m.value.compareDiff;!t||e<0||e>=t.files.length?m.value={...m.value,selection:{type:null,index:0,diff:null}}:m.value={...m.value,selection:{type:`file`,index:e,diff:t.files[e].diff}}}return{repoId:n,repoPath:r,isRepo:w,shared:i,workingDiffs:a,wholeFile:y,wholeFileLoading:x,wholeFileRefusal:S,mediaMeta:o,selection:s,history:c,journalEntries:l,journalEpoch:u,journalPrunedBefore:d,journalLoaded:f,journalRestarted:p,compare:m,selectedCompareBase:h,selectedStackHead:g,compareUncommitted:_,compareStack:v,pickedLayer:Ot,comparePair:kt,open:z,dispose:ge,releaseOnUnload:_e,stageFile:ke,unstageFile:Ae,selectFile:Me,refreshAllDiffs:ze,setWholeFile:He,diffModelFor:$e,ensureMedia:Je,loadHistory:et,resolveCommit:nt,selectHistoryCommit:rt,loadJournal:ut,refreshCompare:bt,refreshCompareCount:ht,setCompareUncommitted:pt,getCandidateBaseBranches:Ct,setSelectedCompareBase:wt,setSelectedStackHead:Tt,setComparePick:Et,selectCompareFile:At}}),Ll=Ps(`explorer`,()=>{let e=Il(),t=new Xs,n=H(new Map),r=H(new Set),i=H(new Set),a=H(!1),o=H(!1),s=H(null),c=H(!1),l=H(!1),u=H(!1),d=H(null),f=H(null),p=H(null),m=H(!1),h=H(null),g=0,_=0,v=null;function y(){g++,_++,v=null,n.value=new Map,r.value=new Set,i.value=new Set,a.value=!1,o.value=!1,s.value=null,d.value=null,f.value=null,p.value=null,m.value=!1,h.value=null}W(()=>e.repoId,()=>y());function b(e){Qs(`load explorer tree`,e),s.value=jl(e)}function x(n){let r=e.repoId;return r===null?Promise.resolve([]):t.tree(r,{dir:n,hidden:c.value,ignored:l.value})}async function S(e,t){let n=await x(t);e.set(t,n);for(let t of n)t.type===`dir`&&r.value.has(t.path)&&await S(e,t.path)}async function C(){if(e.repoId===null)return!0;_++;let t=_;o.value=!0,s.value=null;try{let e=new Map;return await S(e,``),t===_&&(n.value=e,a.value=!0),!0}catch(e){return t!==_||(b(e),!1)}finally{t===_&&(o.value=!1)}}async function w(){a.value||(v??=C().finally(()=>{v=null}),await v)}async function T(){await C()}async function E(e){let t=_;i.value=new Set([...i.value,e]);try{let r=await x(e);if(t!==_)return!1;let i=new Map(n.value);return i.set(e,r),n.value=i,s.value=null,!0}catch(n){if(t!==_)return!1;let i=new Set(r.value);return i.delete(e),r.value=i,b(n),!1}finally{let t=new Set(i.value);t.delete(e)&&(i.value=t)}}async function D(e){if(r.value.has(e)){let t=new Set(r.value);t.delete(e),r.value=t}else r.value=new Set([...r.value,e]),(n.value.has(e)||await E(e))&&await O(e)}async function O(e){let t=e;for(;;){let e=n.value.get(t);if(e===void 0||e.length!==1||e[0].type!==`dir`)return;let i=e[0].path;if(r.value.has(i)||(r.value=new Set([...r.value,i])),!n.value.has(i)&&!await E(i))return;t=i}}function k(e){if(!r.value.has(e))return;let t=new Set(r.value);t.delete(e),r.value=t}async function A(e){c.value!==e&&(c.value=e,await C()||(c.value=!e))}async function j(e){l.value!==e&&(l.value=e,await C()||(l.value=!e))}function M(e){u.value=e}async function N(n){let r=e.repoId;if(r===null)return;let i=g;d.value=n,h.value=null,m.value=!0;try{let e=await t.file(r,n);if(i!==g||d.value!==n)return;f.value=e,p.value=null}catch(e){if(i!==g||d.value!==n)return;Qs(`load file`,e,{path:n}),f.value=null,p.value=null,h.value=jl(e)}finally{i===g&&d.value===n&&(m.value=!1)}}async function P(){let n=e.repoId,r=d.value;if(n===null||r===null)return;let i=g;try{let e=await t.file(n,r,{symbols:!0});if(i!==g||d.value!==r)return;f.value=e,p.value=e.symbols??null}catch(e){if(i!==g||d.value!==r)return;Qs(`load file outline`,e,{path:r}),h.value=jl(e),p.value={status:`unavailable`,reason:`error`}}}async function F(e,t,r){let i=n.value.get(e)?.find(e=>e.path===t);return i===void 0?l.value||(await j(!0),r!==g||!l.value)?null:n.value.get(e)?.find(e=>e.path===t)??null:i}let I=H(null),L=0;function ee(e){L+=1,I.value={line:e,seq:L}}async function R(t,n={}){if(e.repoId===null)return;let r=g,i=n.line;if(!c.value&&t.split(`/`).some(e=>e.startsWith(`.`))&&(await A(!0),r!==g||!c.value)||(await w(),r!==g||!a.value))return;let o=t.split(`/`),s=``;for(let e=0;e<o.length;e++){let n=s===``?o[e]:`${s}/${o[e]}`,a=await te(s,n,e===o.length-1,r);if(a===`done`&&i!==void 0&&r===g&&d.value===t&&ee(i),a!==`descend`)return;s=n}r===g&&await O(s)}async function te(e,t,i,a){let o=await F(e,t,a);if(o===null||a!==g)return`bail`;if(o.type!==`dir`)return i&&await N(t),`done`;if(r.value.has(t)||(r.value=new Set([...r.value,t])),!n.value.has(t)){let e=await E(t);if(a!==g||!e)return`bail`}return`descend`}function ne(){d.value=null,f.value=null,p.value=null,h.value=null,m.value=!1}function re(e){return u.value?e.type===`dir`?e.hasChanges===!0:e.gitStatus!==void 0:!0}return{rows:$(()=>{let e=[],t=(a,o)=>{for(let s of n.value.get(a)??[]){let a=s,c=s.name;if(s.type===`dir`)for(;;){let e=n.value.get(a.path);if(e===void 0||e.length!==1||e[0].type!==`dir`)break;a=e[0],c=`${c}/${a.name}`}if(!re(a))continue;let l=a.type===`dir`&&r.value.has(a.path);e.push({entry:a,displayName:c,depth:o,isExpanded:l,isLoading:i.value.has(a.path)}),l&&t(a.path,o+1)}};return t(``,0),e}),rootLoaded:a,rootLoading:o,error:s,showHidden:c,showIgnored:l,changedOnly:u,selectedPath:d,file:f,fileLoading:m,fileError:h,fileSymbols:p,lineRequest:I,ensureRoot:w,refresh:T,toggleDir:D,collapseDir:k,setShowHidden:A,setShowIgnored:j,setChangedOnly:M,openFile:N,loadSymbols:P,revealFile:R,requestLine:ee,clearSelection:ne}}),Rl=[{name:`changes`,label:`Changes`},{name:`journal`,label:`Journal`},{name:`history`,label:`History`},{name:`compare`,label:`Compare`},{name:`explorer`,label:`Explorer`}],zl=new Set([`finder`,`search`]);function Bl(){return typeof window<`u`&&typeof window.matchMedia==`function`&&window.matchMedia(`(prefers-color-scheme: light)`).matches?`light`:`dark`}function Vl(e){document.documentElement.dataset.theme=e}var Hl=Ps(`ui`,()=>{let e=yl(),t=H(e.theme??Bl()),n=H(e.activeView),r=H(e.recentRepos),i=H(null),a=H(e.autoMode),o=H(e.diffSyntax),s=H(e.diffMode),c=H(e.imageDiffMode),l=H(e.wrapEnabled),u=H(null),d=null,f=H(null);function p(){Vl(t.value)}function m(e){t.value=e,Vl(e),bl({theme:e})}function h(e){n.value=e,bl({activeView:e})}function g(e){let t=[e,...r.value.filter(t=>t!==e)].slice(0,8);r.value=t,bl({recentRepos:t})}function _(){a.value=!a.value,bl({autoMode:a.value})}function v(){o.value=!o.value,bl({diffSyntax:o.value})}function y(){s.value=s.value===`split`?`unified`:`split`,bl({diffMode:s.value})}function b(e){c.value=e,bl({imageDiffMode:e})}function x(){l.value=!l.value,bl({wrapEnabled:l.value})}function S(e){u.value=e,d&&clearTimeout(d),d=setTimeout(()=>{u.value=null,d=null},900)}function C(e){f.value=e}let w=H(null),T=0;function E(e){T+=1,w.value={key:e,seq:T}}let D=H(0);function O(){D.value+=1}let k=H(0);function A(){k.value+=1}let j=H(``);function M(e){j.value=e}function N(e){(e===null||!zl.has(e))&&(j.value=``),i.value=e}function P(e){N(e)}function F(e){N(i.value===e?null:e)}function I(){N(null)}return{theme:t,activeView:n,recentRepos:r,activeOverlay:i,autoModeEnabled:a,diffSyntaxEnabled:o,diffMode:s,imageDiffMode:c,wrapEnabled:l,flashedFile:u,activeStackKey:f,stackScrollRequest:w,expandGatedRequest:D,outlineRequest:k,overlayQuery:j,setOverlayQuery:M,init:p,setTheme:m,setActiveView:h,addRecentRepo:g,toggleAutoMode:_,toggleDiffSyntax:v,toggleDiffMode:y,setImageDiffMode:b,toggleWrap:x,flashFile:S,setActiveStackKey:C,requestStackScroll:E,requestExpandGated:O,requestOutline:A,openOverlay:P,toggleOverlay:F,closeOverlay:I}});function Ul(){let e=ic(),t=Il(),n=Hl();async function r(r){let i=r.trim();if(!i)return!1;let a=await t.open(i);return a?(e.trackActive(a),n.addRecentRepo(a.path),!0):!1}async function i(r){let i=await t.open(r.path);i&&(e.trackActive(i),n.addRecentRepo(i.path))}return{openByPath:r,activate:i}}function Wl(e){let t=e.split(`/`).filter(Boolean);return t[t.length-1]??e}function Gl(e){let t=e.length;for(;t>1&&e[t-1]===`/`;)t--;return e.slice(0,t)}function Kl(e){let t=Gl(e),n=t.lastIndexOf(`/`);return n<=0?`/`:t.slice(0,n)}function ql(e){return e<1024?`${e} B`:e<1048576?`${(e/1024).toFixed(1)} KB`:`${(e/1048576).toFixed(1)} MB`}function Jl(e){switch(e){case`modified`:return`M`;case`added`:return`A`;case`deleted`:return`D`;case`untracked`:return`?`;case`renamed`:return`R`;case`copied`:return`C`;case`conflicted`:return`U`}}function Yl(e){return String(e).padStart(2,`0`)}function Xl(e,t){let n=new Date(e),r=new Date(t),i=`${Yl(n.getHours())}:${Yl(n.getMinutes())}`,a=n.getFullYear()===r.getFullYear();if(a&&n.getMonth()===r.getMonth()&&n.getDate()===r.getDate())return i;let o=a?{month:`short`,day:`numeric`}:{month:`short`,day:`numeric`,year:`numeric`};return`${n.toLocaleDateString(`en-US`,o)} ${i}`}function Zl(e){let t=e.lastIndexOf(`/`);return t===-1?{head:``,tail:e}:{head:e.slice(0,t),tail:e.slice(t)}}var Ql=3e3,$l=400,eu=1e3,tu=null;function nu(e={}){tu={...e,expires:Date.now()+Ql,used:!1}}function ru(e={}){let t=ic(),n=Ll(),r=Il(),i=Hl(),a=new Xs,o=V(null),s=!1,c=l();async function l(){for(;;)try{let e=await a.health();o.value=e.home??null;return}catch(e){if(!Ls(e)){Zs(`load daemon home`,e);return}if(await $s(eu),s)return}}let u=typeof window>`u`?el:tl(window.location.pathname,window.location.search);typeof window<`u`&&`scrollRestoration`in window.history&&(window.history.scrollRestoration=`manual`);function d(e){return e.homeRelative?o.value===null?`/${e.path}`:`${o.value}/${e.path}`:`/${e.path}`}let f=$(()=>r.repoId===null?null:r.repoPath);function p(e){return f.value!==null&&d(e)===f.value}function m(){switch(i.activeView){case`changes`:return i.activeStackKey;case`history`:return r.history.selectedCommit?.shortHash??null;case`compare`:{let{selection:e,compareDiff:t}=r.compare;return e.type!==`file`||!t?null:t.files[e.index]?.path??null}case`explorer`:return n.selectedPath;default:return null}}function h(e,t){return e===`changes`?t.slice(t.indexOf(`:`)+1):e===`compare`?t:null}function g(e,t,n){return n===null?!1:e===`history`||t!==null&&h(e,t)===n}function _(){let e=f.value,t=i.activeView,n=e===null?null:m(),a=e!==null&&t===`compare`?r.selectedCompareBase:null,s=e!==null&&t===`compare`?r.selectedStackHead:null,c=r.wholeFile?.path??null,l=g(t,n,c)?c:null;return e===null?{url:`/`,repoPath:null,view:t,at:null,base:null,head:null,whole:null}:{url:rl({view:t,repoPath:e,home:o.value,at:n,base:a,head:s,whole:l}),repoPath:e,view:t,at:n,base:a,head:s,whole:l}}function v(e){let t=[];return e.at!==null&&t.push(e.whole===null?e.at:`${e.at} (whole)`),t.push(e.view),e.repoPath!==null&&t.push(Wl(e.repoPath)),t.filter(Boolean).join(` — `)||`diffstalker`}let y=null,b=!1,x=null,S=0,C=null;function w(){return tu===null?null:tu.expires<=Date.now()?(tu=null,null):tu}function T(e,t){return!(e.view!==void 0&&e.view!==t.view||e.repo!==void 0&&e.repo!==t.repoPath)}function E(e){return y!==null&&y.repoPath===e.repoPath&&y.view===e.view&&y.base===e.base&&y.head===e.head&&y.whole===e.whole}function D(e){if(y===null||b)return`replace`;let t=w();return t!==null&&T(t,e)?t.used?`replace`:(t.used=!0,x={repoPath:e.repoPath,view:e.view},`push`):x!==null&&(x.repoPath!==e.repoPath||x.view!==e.view)?(x=null,`push`):E(e)?`defer`:`replace`}function O(){C!==null&&(clearTimeout(C),C=null)}function k(){if(typeof window>`u`||r.repoId!==t.activeRepoId)return;let e=_();if(document.title=v(e),e.url===window.location.pathname+window.location.search){y=e;return}if(e.repoPath===null&&y===null)return;let n=D(e);n===`defer`?C===null&&(C=setTimeout(()=>{C=null,A(_(),`replace`)},$l)):(O(),A(e,n))}function A(e,t){let n=e.url;n!==window.location.pathname+window.location.search&&(t===`push`?(S+=1,window.history.pushState({serial:S,place:e},``,n)):window.history.replaceState({serial:S,place:e},``,n)),y=e}async function j(){await c,k()}j(),W([()=>r.repoId,()=>t.activeRepoId,()=>r.repoPath,()=>i.activeView,()=>i.activeStackKey,()=>r.selectedCompareBase,()=>r.selectedStackHead,()=>r.wholeFile,()=>r.compare.selection,()=>r.history.selectedCommit,()=>n.selectedPath],k,{flush:`post`});let M=0;async function N(t){let n=++M;b=!0,O();try{await e.onRestore?.(t,{isStale:()=>n!==M})}finally{n===M&&(await On(),k(),b=!1)}}function P(){N(tl(window.location.pathname,window.location.search))}return typeof window<`u`&&(window.addEventListener(`popstate`,P),ke(()=>{s=!0,window.removeEventListener(`popstate`,P),O()})),{initial:u,whenHomeReady:c,toAbsolute:d,isActiveRepo:p,restore:N}}var iu=Ps(`filter`,()=>{let e=ic(),t=H(``),n=H(!1),r=H(0);function i(e){t.value=e}function a(){n.value=!0,r.value+=1}function o(){n.value=!1,t.value=``}function s(){n.value=!1,t.value=``}return W(()=>e.activeRepoId,()=>s()),{query:t,open:n,focusRequest:r,setQuery:i,openAndFocus:a,close:o,reset:s}}),au=new Set([`changes`]),ou=Object.fromEntries(Rl.map((e,t)=>[String(t+1),e.name]));function su(e){if(!(e instanceof HTMLElement))return!1;if(e.isContentEditable)return!0;let t=e.tagName;return t===`INPUT`||t===`TEXTAREA`||t===`SELECT`}function cu(){let e=Hl(),t=ic(),n=iu();function r(n){switch(n){case`a`:return e.toggleAutoMode(),!0;case`s`:return e.toggleDiffSyntax(),!0;case`d`:return e.toggleDiffMode(),!0;case`f`:return(t.follow?.targetFile??null)!==null&&t.toggleFollow(),!0;case`e`:return e.requestExpandGated(),!0;default:return!1}}function i(n){if(!(n.ctrlKey||n.metaKey)||n.altKey)return!1;let r=n.key.toLowerCase(),i=!n.shiftKey&&r===`p`?`finder`:null,a=n.shiftKey&&r===`f`?`search`:null,o=i??a;return o!==null&&(e.activeOverlay===o?(n.preventDefault(),e.closeOverlay()):t.activeRepoId!==null&&(n.preventDefault(),e.openOverlay(o)),!0)}function a(r){return r.key===`F`?(t.activeRepoId===null||(r.preventDefault(),e.openOverlay(`search`)),!0):r.key===`o`?(e.activeView!==`explorer`||t.activeRepoId===null||(r.preventDefault(),e.requestOutline()),!0):r.key===`/`&&(au.has(e.activeView)&&(r.preventDefault(),n.openAndFocus()),!0)}function o(t){if(t.defaultPrevented||i(t))return;if(t.key===`Escape`){e.activeOverlay!==null&&(t.preventDefault(),e.closeOverlay());return}if(su(t.target)||t.ctrlKey||t.metaKey||t.altKey)return;if(t.key===`?`){t.preventDefault(),e.toggleOverlay(`help`);return}if(t.key===`,`){t.preventDefault(),e.toggleOverlay(`settings`);return}if(e.activeOverlay!==null||a(t)||r(t.key))return;let n=ou[t.key];n!==void 0&&(nu({view:n}),e.setActiveView(n))}jr(()=>window.addEventListener(`keydown`,o)),Pr(()=>window.removeEventListener(`keydown`,o))}function lu(){let e=ic(),t=Ll(),n=Hl(),{activate:r,openByPath:i}=Ul();async function a(t){return e.repos.find(e=>e.id===t)||(await e.refreshRepos(),e.repos.find(e=>e.id===t))}async function o(o){let s=await a(o.repoId);if(!s&&(!await i(o.path)||(s=e.activeRepo??void 0,!s)))return;e.activeRepoId!==s.id&&(await r({id:s.id,path:s.path}),await On());let c=Gl(s.path),l=Gl(o.path);l!==c&&l.startsWith(c+`/`)&&(n.setActiveView(`explorer`),await t.revealFile(l.slice(c.length+1)))}let s=Promise.resolve(),c=null;function l(t){let n=c!==null;c=t,!n&&(s=s.then(async()=>{let t=c;if(c=null,t!==null&&e.followEnabled&&!e.followNavigationSuspended())try{await o(t)}catch(e){Zs(`follow change`,e,{path:t.path,repoId:t.repoId})}}))}W(()=>e.lastFollowChange,t=>{t!==null&&(e.skipInitialFollow?e.skipInitialFollow=!1:e.followEnabled&&l(t))}),W(()=>e.followEnabled,t=>{let n=e.lastFollowChange;t&&n!==null&&l(n)})}var uu=1500,du=100,fu=null;function pu(e){return fu=e,()=>{fu===e&&(fu=null)}}function mu(){let e=Il(),t=Hl(),n=new Map,r=0,i=!1,a=null,o=null;function s(){a=null,o!==null&&(clearTimeout(o),o=null)}function c(e){o!==null&&clearTimeout(o),o=setTimeout(()=>{o=null,l()},e)}function l(){if(a===null)return;if(!t.autoModeEnabled||t.activeView!==`changes`){s();return}let e=fu;if(e===null){c(du);return}let n=Date.now()-e.lastUserScrollAt();if(n<1500){c(uu-n);return}let r=a;s(),e.jump(r)}W(()=>e.repoId,()=>{n=new Map,r=0,i=!1,s()}),Pr(s);function u(e,t){let r=new Map,i=null;for(let a of e){let e=t[a.path];if(e===void 0||r.has(a.path))continue;r.set(a.path,e);let o=n.get(a.path);(o===void 0||e>o)&&(!i||e>i.mtime)&&(i={path:a.path,mtime:e})}return n=r,i}function d(){let n=e.history.commits[0];n&&e.selectHistoryCommit(n).catch(e=>{Qs(`select newest commit`,e,{hash:n.hash})}),t.setActiveView(`history`)}function f(e,n){return e>0&&n===0?(t.activeView===`changes`&&d(),!0):(e===0&&n>0&&t.activeView===`history`&&t.setActiveView(`changes`),!1)}function p(n,r){if(t.activeView!==`changes`)return;let i=n.find(e=>e.path===r.path);i&&(e.selectFile(i),t.flashFile(r.path),a=r.path,l())}function m(e){let n=e.status;if(n===null||!n.isRepo)return;let a=n.files,o=r;r=a.length;let s=u(a,e.mtimes??{}),c=!i;i=!0,!c&&t.autoModeEnabled&&(f(o,a.length)||s!==null&&p(a,s))}W(()=>e.shared,e=>m(e))}var hu=`(orientation: portrait), (max-aspect-ratio: 1/1), (max-width: 1400px)`;function gu(e){let t=V(!1);if(typeof window>`u`||typeof window.matchMedia!=`function`)return t;let n=window.matchMedia(e);if(t.value=n.matches,typeof n.addEventListener==`function`){let e=e=>{t.value=e.matches};n.addEventListener(`change`,e),Pa()&&Pr(()=>n.removeEventListener(`change`,e))}return t}function _u(){return gu(hu)}function vu(){let e=_u();return typeof document<`u`&&Jn(()=>{document.documentElement.dataset.split=e.value?`stacked`:`split`}),e}function yu(e){return[...e].sort((e,t)=>(t.lastActivity??-1/0)-(e.lastActivity??-1/0))}function bu(e,t){let n=yu(t.filter(e=>!e.isBare)),r=t.find(e=>e.isMain);if(!r)return{root:e,name:Wl(e),worktrees:n};if(!r.isBare)return{root:r.path,name:Wl(r.path),worktrees:n};let i=Wl(r.path);if(i.startsWith(`.`)){let e=Kl(r.path);return{root:e,name:Wl(e),worktrees:n}}return{root:r.path,name:i.replace(/\.git$/,``),worktrees:n}}var xu=Ps(`worktrees`,()=>{let e=new Xs,t=ic(),n=H(new Map),r=new Map,i=0,a=new Map;function o(e,t){let r=new Map(n.value);r.set(e,t),n.value=r}function s(e){return n.value.get(e)}function c(e){let t=n.value.get(e);return t?.status===`ready`?t.project:null}function l(t){let s=r.get(t);if(s)return s;let c=n.value.get(t);(c===void 0||c.status===`failed`)&&o(t,{status:`pending`});let l=e.worktreesForPath(t).then(e=>{o(t,e.length===0?{status:`absent`}:{status:`ready`,project:bu(t,e)})}).catch(e=>{Qs(`list worktrees`,e,{path:t}),o(t,{status:`failed`})}).finally(()=>{a.set(t,i),r.delete(t)});return r.set(t,l),l}function u(e){let t=e.filter(e=>{let t=n.value.get(e);return t===void 0||t.status===`failed`||(a.get(e)??-1)<i});return Promise.all(t.map(l)).then(()=>void 0)}function d(e){return Promise.all(e.map(l)).then(()=>void 0)}function f(){i++}let p=$(()=>t.activeRepoPath);return W(p,e=>{e!==null&&u([e])},{immediate:!0}),W(()=>t.repos.map(e=>e.path).join(`
3
3
  `),()=>f()),{entries:n,activePath:p,activeProject:$(()=>p.value===null?null:c(p.value)),entryFor:s,projectFor:c,ensure:u,refresh:d}});function Su(){let e=ic(),t=xu(),n=$(()=>t.activePath),r=$(()=>t.activeProject?.worktrees??[]);return{activePath:n,worktrees:r,hasMultiple:$(()=>r.value.length>1),projectName:$(()=>{let n=t.activeProject;if(n)return n.name;let r=e.activeRepo;return r?Wl(r.path):``})}}var Cu={216:`O`,223:`s`,248:`o`,273:`d`,295:`h`,305:`i`,320:`l`,322:`l`,359:`t`,383:`s`,384:`b`,385:`B`,387:`b`,390:`O`,392:`c`,393:`D`,394:`D`,396:`d`,398:`E`,400:`E`,402:`f`,403:`G`,407:`I`,409:`k`,410:`l`,412:`M`,413:`N`,414:`n`,415:`O`,421:`p`,427:`t`,429:`t`,430:`T`,434:`V`,436:`y`,438:`z`,477:`e`,485:`g`,544:`N`,545:`d`,549:`z`,564:`l`,565:`n`,566:`t`,567:`j`,570:`A`,571:`C`,572:`c`,573:`L`,574:`T`,575:`s`,576:`z`,579:`B`,580:`U`,581:`V`,582:`E`,583:`e`,584:`J`,585:`j`,586:`Q`,587:`q`,588:`R`,589:`r`,590:`Y`,591:`y`,592:`a`,593:`a`,595:`b`,596:`o`,597:`c`,598:`d`,599:`d`,600:`e`,603:`e`,604:`e`,605:`e`,606:`e`,607:`j`,608:`g`,609:`g`,610:`G`,613:`h`,614:`h`,616:`i`,618:`I`,619:`l`,620:`l`,621:`l`,623:`m`,624:`m`,625:`m`,626:`n`,627:`n`,628:`N`,629:`o`,633:`r`,634:`r`,635:`r`,636:`r`,637:`r`,638:`r`,639:`r`,640:`R`,641:`R`,642:`s`,647:`t`,648:`t`,649:`u`,651:`v`,652:`v`,653:`w`,654:`y`,655:`Y`,656:`z`,657:`z`,663:`c`,665:`B`,666:`e`,667:`G`,668:`H`,669:`j`,670:`k`,671:`L`,672:`q`,686:`h`,867:`a`,868:`e`,869:`i`,870:`o`,871:`u`,872:`c`,873:`d`,874:`h`,875:`m`,876:`r`,877:`t`,878:`v`,879:`x`,7424:`A`,7427:`B`,7428:`C`,7429:`D`,7431:`E`,7432:`e`,7433:`i`,7434:`J`,7435:`K`,7436:`L`,7437:`M`,7438:`N`,7439:`O`,7440:`O`,7441:`o`,7442:`o`,7443:`o`,7446:`o`,7447:`o`,7448:`P`,7449:`R`,7450:`R`,7451:`T`,7452:`U`,7453:`u`,7454:`u`,7455:`m`,7456:`V`,7457:`W`,7458:`Z`,7522:`i`,7523:`r`,7524:`u`,7525:`v`,7834:`a`,7835:`s`,8305:`i`,8341:`h`,8342:`k`,8343:`l`,8344:`m`,8345:`n`,8346:`p`,8347:`s`,8348:`t`,8580:`c`};for(let e=`̀`.codePointAt(0);e<=`ͯ`.codePointAt(0);++e){let t=String.fromCodePoint(e);for(let e of`ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz`){let n=(e+t).normalize().codePointAt(0);n>126&&(Cu[n]=e)}}var wu={a:[7844,7863],e:[7870,7879],o:[7888,7907],u:[7912,7921]};for(let e of Object.keys(wu)){let t=e.toUpperCase();for(let n=wu[e][0];n<=wu[e][1];++n)Cu[n]=n%2==0?t:e}function Tu(e){if(e<192||e>8580)return e;let t=Cu[e];return t===void 0?e:t.codePointAt(0)}function Eu(e){return e}function Du(e){return e}function Ou(e,t){return e>t?e:t}var ku=e=>e.split(``).map(e=>e.codePointAt(0)),Au=new Set(` \f
4
4
  \r \v\xA0 \u2028\u2029   `.split(``).map(e=>e.codePointAt(0)));for(let e=` `.codePointAt(0);e<=` `.codePointAt(0);e++)Au.add(e);var ju=``.codePointAt(0),Mu=`A`.codePointAt(0),Nu=`Z`.codePointAt(0),Pu=`a`.codePointAt(0),Fu=`z`.codePointAt(0),Iu=`0`.codePointAt(0),Lu=`9`.codePointAt(0);function Ru(e,t,n){return n?e:t-e-1}var zu=16,Bu=-3,Vu=-1,Hu=zu/2,Uu=zu/2,Wu=7,Gu=4,Ku=2;function qu(e){return e?new Set:null}function Ju(e,t,n){if(t!==null&&t.i16.length>e+n){let r=t.i16.subarray(e,e+n);return[e+n,r]}return[e,new Int16Array(n)]}function Yu(e,t,n){if(t!==null&&t.i32.length>e+n){let r=t.i32.subarray(e,e+n);return[e+n,r]}return[e,new Int32Array(n)]}function Xu(e){return e>=Pu&&e<=Fu?1:e>=Mu&&e<=Nu?2:e>=Iu&&e<=Lu?4:0}function Zu(e){let t=String.fromCodePoint(e);return t===t.toUpperCase()?t===t.toLowerCase()?t.match(/\p{Number}/gu)===null?t.match(/\p{Letter}/gu)===null?0:3:4:2:1}function Qu(e){return e<=ju?Xu(e):Zu(e)}function $u(e,t){return e===0&&t!==0?Hu:e===1&&t===2||e!==4&&t===4?Wu:t===0?Uu:0}function ed(e,t){return t===0?Hu:$u(Qu(e[t-1]),Qu(e[t]))}function td(e,t,n,r){let i=e.slice(r),a=i.indexOf(n);if(a===0)return r;if(!t&&n>=Pu&&n<=Fu){a>0&&(i=i.slice(0,a));let e=i.indexOf(n-32);e>=0&&(a=e)}return a<0?-1:r+a}function nd(e){for(let t of e)if(t>=128)return!1;return!0}function rd(e,t,n){if(!nd(e))return 0;if(!nd(t))return-1;let r=0,i=0;for(let a=0;a<t.length;a++){if(i=td(e,n,t[a],i),i<0)return-1;a===0&&i>0&&(r=i-1),i++}return r}var id=(e,t,n,r,i,a,o)=>{let s=i.length;if(s===0)return[{start:0,end:0,score:0},qu(a)];let c=r.length;if(o!==null&&c*s>o.i16.length)return od(e,t,n,r,i,a);let l=rd(r,i,e);if(l<0)return[{start:-1,end:-1,score:0},null];let u=0,d=0,f=null,p=null,m=null,h=null;[u,f]=Ju(u,o,c),[u,p]=Ju(u,o,c),[u,m]=Ju(u,o,c),[d,h]=Yu(d,o,s);let[,g]=Yu(d,o,c);for(let e=0;e<g.length;e++)g[e]=r[e];let _=Eu(0),v=0,y=0,b=0,x=i[0],S=i[0],C=Eu(0),w=0,T=!1,E=g.subarray(l),D=f.subarray(l).subarray(0,E.length),O=p.subarray(l).subarray(0,E.length),k=m.subarray(l).subarray(0,E.length);for(let[r,a]of E.entries()){let o=null;a<=ju?(o=Xu(a),!e&&o===2&&(a+=32)):(o=Zu(a),!e&&o===2&&(a=String.fromCodePoint(a).toLowerCase().codePointAt(0)),t&&(a=Tu(a))),E[r]=a;let c=$u(w,o);if(k[r]=c,w=o,a===S&&(y<s&&(h[y]=Du(l+r),y++,S=i[Math.min(y,s-1)]),b=l+r),a===x){let e=zu+c*Ku;if(D[r]=e,O[r]=1,s===1&&(n&&e>_||!n&&e>=_)&&(_=e,v=l+r,n&&c===Hu))break;T=!1}else D[r]=Ou(T?C+Vu:C+Bu,0),O[r]=0,T=!0;C=D[r]}if(y!==s)return[{start:-1,end:-1,score:0},null];if(s===1){let e={start:v,end:v+1,score:_};if(!a)return[e,null];let t=new Set;return t.add(v),[e,t]}let A=h[0],j=b-A+1,M=null;[u,M]=Ju(u,o,j*s);{let e=f.subarray(A,b+1);for(let[t,n]of e.entries())M[t]=n}let[,N]=Ju(u,o,j*s);{let e=p.subarray(A,b+1);for(let[t,n]of e.entries())N[t]=n}let P=h.subarray(1),F=i.slice(1).slice(0,P.length);for(let[e,t]of P.entries()){let r=!1,i=F[e],a=e+1,o=a*j,c=g.subarray(t,b+1),l=m.subarray(t).subarray(0,c.length),u=N.subarray(o+t-A).subarray(0,c.length),d=N.subarray(o+t-A-1-j).subarray(0,c.length),f=M.subarray(o+t-A).subarray(0,c.length),p=M.subarray(o+t-A-1-j).subarray(0,c.length),h=M.subarray(o+t-A-1).subarray(0,c.length);h[0]=0;for(let[e,o]of c.entries()){let c=e+t,g=0,y=0,b=0;if(y=r?h[e]+Vu:h[e]+Bu,i===o){g=p[e]+zu;let t=l[e];b=d[e]+1,t===Hu?b=1:b>1&&(t=Ou(t,Ou(Gu,m[c-b+1]))),g+t<y?(g+=l[e],b=0):g+=t}u[e]=b,r=g<y;let x=Ou(Ou(g,y),0);a===s-1&&(n&&x>_||!n&&x>=_)&&(_=x,v=c),f[e]=x}}let I=qu(a),L=A;if(a&&I!==null){let e=s-1;L=v;let t=!0;for(;;){let n=e*j,r=L-A,i=M[n+r],a=0,o=0;if(e>0&&L>=h[e]&&(a=M[n-j+r-1]),L>h[e]&&(o=M[n+r-1]),i>a&&(i>o||i===o&&t)){if(I.add(L),e===0)break;e--}t=N[n+r]>1||n+j+r+1<N.length&&N[n+j+r+1]>0,L--}}return[{start:L,end:v+1,score:_},I]};function ad(e,t,n,r,i,a,o){let s=0,c=0,l=!1,u=0,d=Eu(0),f=qu(o),p=0;i>0&&(p=Qu(n[i-1]));for(let m=i;m<a;m++){let i=n[m],a=Qu(i);if(e||(i>=Mu&&i<=Nu?i+=32:i>ju&&(i=String.fromCodePoint(i).toLowerCase().codePointAt(0))),t&&(i=Tu(i)),i===r[s]){o&&f!==null&&f.add(m),c+=zu;let e=$u(p,a);u===0?d=e:(e===Hu&&(d=e),e=Ou(Ou(e,d),Gu)),c+=s===0?e*Ku:e,l=!1,u++,s++}else c+=l?Vu:Bu,l=!0,u=0,d=0;p=a}return[c,f]}var od=(e,t,n,r,i,a,o)=>{if(i.length===0)return[{start:0,end:0,score:0},null];if(rd(r,i,e)<0)return[{start:-1,end:-1,score:0},null];let s=0,c=-1,l=-1,u=r.length,d=i.length;for(let a=0;a<u;a++){let o=r[Ru(a,u,n)];e||(o>=Mu&&o<=Nu?o+=32:o>ju&&(o=String.fromCodePoint(o).toLowerCase().codePointAt(0))),t&&(o=Tu(o));let f=i[Ru(s,d,n)];if(o===f&&(c<0&&(c=a),s++,s===d)){l=a+1;break}}if(c>=0&&l>=0){s--;for(let t=l-1;t>=c;t--){let a=r[Ru(t,u,n)];e||(a>=Mu&&a<=Nu?a+=32:a>ju&&(a=String.fromCodePoint(a).toLowerCase().codePointAt(0)));let o=i[Ru(s,d,n)];if(a===o&&(s--,s<0)){c=t;break}}if(!n){let e=c;c=u-l,l=u-e}let[o,f]=ad(e,t,r,i,c,l,a);return[{start:c,end:l,score:o},f]}return[{start:-1,end:-1,score:0},null]},sd=(e,t,n,r,i,a,o)=>{if(i.length===0)return[{start:0,end:0,score:0},null];let s=r.length,c=i.length;if(s<c||rd(r,i,e)<0)return[{start:-1,end:-1,score:0},null];let l=0,u=-1,d=Eu(0),f=Eu(-1);for(let a=0;a<s;a++){let o=Ru(a,s,n),p=r[o];e||(p>=Mu&&p<=Nu?p+=32:p>ju&&(p=String.fromCodePoint(p).toLowerCase().codePointAt(0))),t&&(p=Tu(p));let m=Ru(l,c,n);if(i[m]===p){if(m===0&&(d=ed(r,o)),l++,l===c){if(d>f&&(u=a,f=d),d===Hu)break;a-=l-1,l=0,d=0}}else a-=l,l=0,d=0}if(u>=0){let a=0,o=0;n?(a=u-c+1,o=u+1):(a=s-(u+1),o=s-(u-c+1));let[l]=ad(e,t,r,i,a,o,!1);return[{start:a,end:o,score:l},null]}return[{start:-1,end:-1,score:0},null]},cd=102400,ld=2048;function ud(e,t){return{i16:new Int16Array(e),i32:new Int32Array(t)}}var dd=ud(cd,ld),fd=(e,t,n)=>{let r=!1;switch(t){case`smart-case`:e.toLowerCase()!==e&&(r=!0);break;case`case-sensitive`:r=!0;break;case`case-insensitive`:e=e.toLowerCase(),r=!1}let i=ku(e);return n&&(i=i.map(Tu)),{queryRunes:i,caseSensitive:r}};function pd(e,t){let n=Object.keys(e).map(e=>parseInt(e,10)).sort((e,t)=>t-e),r=[];for(let i of n)if(r=r.concat(e[i]),r.length>=t)break;return r}function md(e,t,n){return r=>{let i=this.runesList[r];if(t.length>i.length)return;let[a,o]=this.algoFn(n,this.opts.normalize,this.opts.forward,i,t,!0,dd);if(a.start===-1)return;if(this.opts.fuzzy===!1){o=new Set;for(let e=a.start;e<a.end;++e)o.add(e)}let s=this.opts.sort?a.score:0;e[s]===void 0&&(e[s]=[]),e[s].push({item:this.items[r],...a,positions:o??new Set})}}function hd(e){let{queryRunes:t,caseSensitive:n}=fd(e,this.opts.casing,this.opts.normalize),r={},i=md.bind(this)(r,t,n);for(let e=0,t=this.runesList.length;e<t;++e)i(e);return pd(r,this.opts.limit)}var gd={limit:1/0,selector:e=>e,casing:`smart-case`,normalize:!0,fuzzy:`v2`,tiebreakers:[],sort:!0,forward:!0},_d=class{constructor(e,...t){switch(this.opts={...gd,...t[0]},this.items=e,this.runesList=e.map(e=>ku(this.opts.selector(e).normalize())),this.algoFn=sd,this.opts.fuzzy){case`v2`:this.algoFn=id;break;case`v1`:this.algoFn=od}}},vd={...gd,match:hd},yd=class extends _d{constructor(e,...t){super(e,...t),this.opts={...vd,...t[0]}}find(e){return e.length===0||this.items.length===0?this.items.slice(0,this.opts.limit).map(bd):(e=e.normalize(),xd(this.opts.match.bind(this)(e),this.opts))}};({...gd});var bd=e=>({item:e,start:-1,end:-1,score:0,positions:new Set});function xd(e,t){if(t.sort){let{selector:n}=t;e.sort((e,r)=>{if(e.score===r.score)for(let i of t.tiebreakers){let t=i(e,r,n);if(t!==0)return t}return 0})}return Number.isFinite(t.limit)&&e.splice(t.limit),e}var Sd=class{constructor(e,...t){this.finder=new yd(e,...t),this.find=this.finder.find.bind(this.finder)}},Cd=new Set;function wd(e,t){let n=e,r=new Sd(n,{limit:t,casing:`smart-case`});return{find(e){return e===``?n.slice(0,t).map(e=>({text:e,positions:Cd})):r.find(e).map(e=>({text:e.item,positions:e.positions}))}}}function Td(e,t,n=0){let r=[];for(let i=0;i<e.length;i++){let a=t.has(i+n),o=r[r.length-1];o!==void 0&&o.hit===a?o.text+=e[i]:r.push({text:e[i],hit:a})}return r}function Ed(e,t,n){return n<=0?0:Math.min(n-1,Math.max(0,e+t))}function Dd(e,t,n){return n<=0?0:((e+t)%n+n)%n}function Od(e,t){return`${e} ${t}${e===1?``:`s`} ago`}function kd(e,t=Date.now()){let n=Math.max(0,t-e),r=Math.floor(n/1e3);if(r<10)return`just now`;if(r<60)return Od(r,`second`);let i=Math.floor(n/6e4);if(i<60)return Od(i,`minute`);let a=Math.floor(i/60);if(a<24)return Od(a,`hour`);let o=Math.floor(a/24);return o<7?Od(o,`day`):o<30?Od(Math.floor(o/7),`week`):o<365?Od(Math.floor(o/30),`month`):Od(Math.floor(o/365),`year`)}function Ad(e){return e.toLocaleString(`en-US`,{year:`numeric`,month:`short`,day:`numeric`,hour:`2-digit`,minute:`2-digit`})}function jd(e){return e.kind!==`section`}function Md(e,t){return e===null||t-e>157248e5}function Nd(e){let{openProjects:t,query:n,expanded:r,connected:i,capped:a,now:o}=e,s=new Set(t.map(e=>e.root)),c=e.recentProjects.filter(e=>!s.has(e.root)),l=new Set;for(let e of[...t,...c]){l.add(e.root);for(let t of e.familyPaths)l.add(t)}for(let e of t)for(let t of e.repos)l.add(t.path);let u=e.discovered.filter(e=>!l.has(e.path)),d=[...t.map(e=>e.root),...c.map(e=>e.root),...u.map(e=>e.path)],f=wd(d,d.length),p=new Map(f.find(n).map(e=>[e.text,e.positions])),m=[];function h(e,t){t>0&&m.push({kind:`section`,key:`section:${e}`,label:e})}let g=t.flatMap(t=>{let n=p.get(t.root);return n?[{kind:`open`,key:`open:${t.root}`,name:t.name,path:t.root,positions:n,project:t,active:t.repos.some(t=>t.id===e.activeRepoId)}]:[]});h(`Open`,g.length),m.push(...g);let _=c.flatMap(e=>{let t=p.get(e.root);return t?[{kind:`recent`,key:`recent:${e.root}`,name:e.name,path:e.root,positions:t,project:e}]:[]});h(`Recent`,_.length),m.push(..._);let v=n!==``||r?u.flatMap(e=>{let t=p.get(e.path);return t?[{kind:`discovered`,key:`discovered:${e.path}`,name:e.name,path:e.path,positions:t,branch:e.branch,lastActivity:e.lastActivity,stale:Md(e.lastActivity,o)}]:[]}):[];return h(`Discovered`,v.length),m.push(...v),n===``&&(r||i&&u.length>0)&&m.push({kind:`more`,key:`more`,label:Pd(r,u.length,a)}),m}function Pd(e,t,n){return e?`Hide discovered repos`:`Show ${t}${n?`+ discovered repos (list incomplete)`:` discovered repos`}`}var Fd={class:`repo-picker`,"data-testid":`repo-picker`},Id={class:`input-row`},Ld=[`aria-expanded`,`aria-controls`,`aria-activedescendant`,`value`],Rd=[`title`],zd={key:0,class:`note mono`,"data-testid":`picker-note`},Bd={key:1,class:`note error mono`,"data-testid":`picker-note`},Vd={key:2,class:`note mono`,"data-testid":`picker-note`},Hd={key:3,class:`note mono`,"data-testid":`picker-no-matches`},Ud={key:0,class:`group-label eyebrow`},Wd=[`id`,`aria-selected`,`onMousemove`,`onClick`],Gd=[`title`],Kd={key:0,class:`branch mono`},qd={key:1,class:`branch mono`},Jd={class:`meta mono`},Yd=[`title`],Xd={key:0,class:`hit`},Zd={key:0,class:`age`},Qd={class:`hints mono`,"aria-hidden":`true`},$d=250,ef=gr({__name:`RepoPicker`,emits:[`opened`],setup(e,{emit:t}){let n=t,r=ic(),i=Il(),a=ec(),o=Hl(),s=xu(),{openByPath:c,activate:l}=Ul(),u=new Xs,d=V(``),f=V(!1),p=V(null),m=V(null),h=$(()=>d.value.trim()),g=$(()=>o.recentRepos.filter(e=>!r.repos.some(t=>t.path===e)));W($(()=>[...r.repos.map(e=>e.path),...g.value]),e=>void s.ensure(e),{immediate:!0});let _=$(()=>{let e=new Map;for(let t of r.repos){let n=s.projectFor(t.path),r=n?.root??t.path,i=e.get(r);i||(i={root:r,name:Wl(r),repos:[],worktreeCount:0,familyPaths:[]},e.set(r,i)),i.repos.push(t),i.worktreeCount=Math.max(i.worktreeCount,n?.worktrees.length??0),n&&(i.familyPaths=n.worktrees.map(e=>e.path))}return[...e.values()]}),v=$(()=>{let e=new Map;for(let t of g.value){let n=s.entryFor(t);if(n===void 0||n.status===`pending`||n.status===`absent`)continue;let r=n.status===`ready`?n.project:{root:t,name:Wl(t),worktrees:[]};e.has(r.root)||e.set(r.root,{root:r.root,name:r.name,worktreeCount:r.worktrees.length,familyPaths:r.worktrees.map(e=>e.path),openPath:r.worktrees[0]?.path??r.root})}return[...e.values()]}),y=$(()=>Nd({openProjects:_.value,recentProjects:v.value,discovered:a.discoveredRepos,activeRepoId:r.activeRepoId,query:h.value,expanded:f.value,connected:r.connection!==`disconnected`,capped:a.roots.some(e=>e.capped),now:Date.now()})),b=$(()=>y.value.filter(jd)),x=$(()=>y.value.filter(e=>e.kind!==`more`)),S=$(()=>y.value.find(e=>e.kind===`more`)??null),C=$(()=>x.value.every(e=>e.kind===`section`));jr(()=>{a.rescan(),p.value?.focus()});let w=V(null),T=V(!1),E=$(()=>{let e=b.value.findIndex(e=>e.key===w.value);return e===-1?b.value.length>0?0:-1:e}),D=$(()=>b.value[E.value]??null);function O(){w.value=null,T.value=!1,m.value&&(m.value.scrollTop=0)}function k(e){let t=b.value.length;if(t===0)return;let n=E.value===-1?0:E.value;w.value=b.value[Ed(n,e,t)]?.key??null,T.value=!0,A()}function A(){(m.value?.querySelectorAll(`.picker-row`)[E.value])?.scrollIntoView?.({block:`nearest`})}function j(e){w.value=e.key,T.value=!0}let M=H(null);async function N(e){M.value=null,nu({repo:e}),await c(e)?n(`opened`):M.value=i.shared.error??`Could not open ${e}`}async function P(e){let t=e.repos.find(e=>e.id===r.activeRepoId)??e.repos[0];nu({repo:t.path}),await l(t),n(`opened`)}function F(e){e.kind===`more`?(f.value=!f.value,O()):e.kind===`open`?P(e.project):N(e.kind===`recent`?e.project.openPath:e.path)}let I=H({state:`idle`,answeredFor:``,root:null}),L=$(()=>/^[/~]/.test(h.value)),ee=$(()=>I.value.state===`openable`&&I.value.answeredFor===h.value),R=null,te=0;async function ne(e){let t=++te;I.value={state:`checking`,answeredFor:``,root:null};let n;try{let t=await u.resolvePath(e);n={state:t.openable?`openable`:`not-a-repo`,root:t.root}}catch(e){n={state:re(e)?`unreachable`:`not-a-repo`,root:null}}t===te&&(I.value={...n,answeredFor:e})}function re(e){return!(e instanceof Error&&`status`in e)}W(h,e=>{R!==null&&clearTimeout(R),te++,/^[/~]/.test(e)?(I.value={state:`checking`,answeredFor:``,root:null},R=setTimeout(()=>{R=null,ne(e)},$d)):I.value={state:`idle`,answeredFor:``,root:null}}),Pr(()=>{R!==null&&clearTimeout(R)});function ie(){ee.value&&N(I.value.root??h.value)}function ae(e){d.value=e.target.value,M.value=null,O()}function oe(e){e.key===`ArrowDown`||e.ctrlKey&&e.key===`j`?(e.preventDefault(),k(1)):e.key===`ArrowUp`||e.ctrlKey&&e.key===`k`?(e.preventDefault(),k(-1)):e.key===`Enter`?(e.preventDefault(),se()):e.key===`Escape`&&d.value!==``&&(e.preventDefault(),e.stopPropagation(),d.value=``,M.value=null,O())}function se(){if(!T.value&&L.value){if(ee.value){ie();return}if(I.value.state===`checking`)return}let e=D.value;e&&F(e)}let ce=$(()=>r.connection===`disconnected`),le=$(()=>L.value?I.value.state===`checking`?`checking path…`:I.value.answeredFor===h.value?I.value.state===`not-a-repo`?`not a git repository`:I.value.state===`unreachable`?`could not reach daemon`:null:null:null);function ue(e){return e===null?``:kd(e)}function de(e){return Td(e.path,e.positions)}return(e,t)=>(q(),J(`div`,Fd,[Y(`div`,Id,[Y(`input`,{ref_key:`inputEl`,ref:p,class:`picker-input mono`,"data-testid":`picker-input`,type:`text`,role:`combobox`,"aria-label":`Filter repositories, or type a path to open`,"aria-expanded":b.value.length>0,"aria-controls":b.value.length>0?`repo-picker-options`:void 0,"aria-activedescendant":E.value>=0?`repo-picker-option-${E.value}`:void 0,placeholder:`filter repos, or type a path`,spellcheck:`false`,autocomplete:`off`,value:d.value,onInput:ae,onKeydown:oe},null,40,Ld),ee.value?(q(),J(`button`,{key:0,type:`button`,class:`open-btn chrome-chip`,"data-testid":`picker-open-btn`,title:I.value.root??void 0,onClick:ie},` Open `,8,Rd)):Q(``,!0)]),ce.value?(q(),J(`p`,zd,` daemon connection lost — reconnecting… `)):M.value?(q(),J(`p`,Bd,B(M.value),1)):le.value?(q(),J(`p`,Vd,B(le.value),1)):Q(``,!0),C.value?(q(),J(`p`,Hd,[h.value===``?(q(),J(K,{key:0},[Z(`no repositories yet`)],64)):(q(),J(K,{key:1},[Z(`no repo matches “`+B(h.value)+`”`,1)],64))])):(q(),J(`div`,{key:4,id:`repo-picker-options`,ref_key:`listEl`,ref:m,class:`options`,role:`listbox`,"aria-label":`Repositories`,"data-testid":`picker-options`},[(q(!0),J(K,null,G(x.value,e=>(q(),J(K,{key:e.key},[e.kind===`section`?(q(),J(`p`,Ud,B(e.label),1)):(q(),J(`button`,{key:1,id:`repo-picker-option-${b.value.indexOf(e)}`,class:z([`picker-row`,{selected:e.key===D.value?.key,active:e.kind===`open`&&e.active,stale:e.kind===`discovered`&&e.stale}]),"data-testid":`picker-row`,role:`option`,type:`button`,"aria-selected":e.key===D.value?.key,onMousemove:t=>j(e),onClick:t=>F(e)},[Y(`span`,{class:`name mono`,title:e.name},B(e.name),9,Gd),e.kind!==`discovered`&&e.project.worktreeCount>1?(q(),J(`span`,Kd,B(e.project.worktreeCount)+` worktrees`,1)):e.kind===`discovered`&&e.branch?(q(),J(`span`,qd,B(e.branch),1)):Q(``,!0),Y(`span`,Jd,[Y(`span`,{class:`path`,title:e.path},[(q(!0),J(K,null,G(de(e),(e,t)=>(q(),J(K,{key:t},[e.hit?(q(),J(`span`,Xd,B(e.text),1)):(q(),J(K,{key:1},[Z(B(e.text),1)],64))],64))),128))],8,Yd),e.kind===`discovered`&&e.lastActivity?(q(),J(`span`,Zd,B(ue(e.lastActivity)),1)):Q(``,!0)])],42,Wd))],64))),128))],512)),S.value?(q(),J(`button`,{key:5,type:`button`,class:z([`more-row mono`,{selected:S.value.key===D.value?.key}]),"data-testid":`picker-more`,onMousedown:t[0]||=Jo(()=>{},[`prevent`]),onMousemove:t[1]||=e=>j(S.value),onClick:t[2]||=e=>F(S.value)},B(S.value.label),35)):Q(``,!0),Y(`p`,Qd,[t[3]||=Y(`kbd`,null,`↑↓`,-1),t[4]||=Z(` move · `,-1),t[5]||=Y(`kbd`,null,`enter`,-1),t[6]||=Z(` open · `,-1),t[7]||=Y(`kbd`,null,`esc`,-1),Z(` `+B(h.value?`clear`:`close`),1)])]))}}),tf=(e,t)=>{let n=e.__vccOpts||e;for(let[e,r]of t)n[e]=r;return n},nf=tf(ef,[[`__scopeId`,`data-v-43b4830d`]]);function rf(){let e=V(!1),t=V(null);function n(n){e.value&&t.value&&!t.value.contains(n.target)&&(e.value=!1)}function r(t){t.key===`Escape`&&e.value&&(e.value=!1)}return jr(()=>{document.addEventListener(`mousedown`,n),document.addEventListener(`keydown`,r)}),Pr(()=>{document.removeEventListener(`mousedown`,n),document.removeEventListener(`keydown`,r)}),{open:e,rootEl:t}}var af=[`aria-expanded`,`title`],of={class:`repo-label mono`},sf={key:0,class:`panel popover-panel`},cf=tf(gr({__name:`RepoSwitcher`,setup(e){let t=ic(),{hasMultiple:n,projectName:r}=Su(),{open:i,rootEl:a}=rf(),o=$(()=>t.repos.find(e=>e.id===t.activeRepoId)??null),s=$(()=>o.value?n.value?r.value:Wl(o.value.path):`no repo`);return(e,t)=>(q(),J(`div`,{ref_key:`rootEl`,ref:a,class:`repo-switcher`},[Y(`button`,{class:`switch-btn chrome-chip`,"aria-haspopup":`true`,"aria-expanded":U(i),title:o.value?o.value.path:void 0,onClick:t[0]||=e=>i.value=!U(i)},[Y(`span`,of,B(s.value),1),t[2]||=Y(`span`,{class:`caret popover-caret`,"aria-hidden":`true`},`▾`,-1)],8,af),U(i)?(q(),J(`div`,sf,[X(nf,{onOpened:t[1]||=e=>i.value=!1})])):Q(``,!0)],512))}}),[[`__scopeId`,`data-v-c2637e49`]]),lf=[`aria-expanded`,`title`],uf={class:`wt-name`},df={key:0,class:`panel popover-panel`,"data-testid":`worktree-options`},ff={key:0,class:`group-label eyebrow`},pf=[`title`,`onClick`],mf={class:`name mono`},hf={key:0,class:`branch mono`},gf={key:1,class:`meta mono`},_f={key:0,class:`group-label eyebrow`},vf=[`title`,`onClick`],yf={class:`name mono`},bf={key:0,class:`branch mono`},xf={key:1,class:`meta mono`},Sf=6048e5,Cf=3,wf=tf(gr({__name:`WorktreeSwitcher`,setup(e){let{openByPath:t}=Ul(),{activePath:n,worktrees:r,hasMultiple:i}=Su(),a=xu(),{open:o,rootEl:s}=rf(),c=$(()=>n.value??``);W(o,e=>{e&&n.value!==null&&a.refresh([n.value])});let l=V(!1);W(o,e=>{e||(l.value=!1)});let u=$(()=>r.value),d=$(()=>{let e=Date.now()-Sf;return u.value.filter(t=>t.lastActivity!==null&&t.lastActivity>=e)}),f=$(()=>{let e=Date.now()-Sf;return u.value.filter(t=>t.lastActivity===null||t.lastActivity<e)}),p=$(()=>{if(l.value)return f.value;let e=f.value.slice(0,Cf),t=f.value.find(e=>e.path===c.value);return t&&!e.includes(t)&&e.push(t),e}),m=$(()=>f.value.length-p.value.length),h=$(()=>d.value.length>0&&f.value.length>0);function g(e){return Wl(e.path)}function _(e){return e.branch===null||e.branch===Wl(e.path)?null:e.branch}function v(e){let t=[];return e.branch===null&&t.push(`detached`),e.aheadOfBase!==null&&e.aheadOfBase>0&&t.push(`${e.aheadOfBase} commit${e.aheadOfBase===1?``:`s`} ahead`),e.lastActivity!==null&&t.push(kd(e.lastActivity)),t.join(` · `)}function y(e){e.path!==c.value&&(nu({repo:e.path}),t(e.path)),o.value=!1}return(e,t)=>U(i)?(q(),J(`div`,{key:0,ref_key:`rootEl`,ref:s,class:`wt-switcher`},[Y(`button`,{class:`wt-trigger mono chrome-chip`,"data-testid":`worktree-select`,"aria-haspopup":`true`,"aria-expanded":U(o),title:`Switch worktree (currently ${U(Wl)(c.value)})`,"aria-label":`Switch worktree`,onClick:t[0]||=e=>o.value=!U(o)},[Y(`span`,uf,B(U(Wl)(c.value)),1),t[2]||=Y(`span`,{class:`caret popover-caret`,"aria-hidden":`true`},`▾`,-1)],8,lf),U(o)?(q(),J(`div`,df,[d.value.length?(q(),J(K,{key:0},[h.value?(q(),J(`p`,ff,`Recent`)):Q(``,!0),(q(!0),J(K,null,G(d.value,e=>(q(),J(`button`,{key:e.path,class:z([`wt-row`,{active:e.path===c.value}]),title:e.path,onClick:t=>y(e)},[Y(`span`,mf,B(g(e)),1),_(e)?(q(),J(`span`,hf,B(_(e)),1)):Q(``,!0),v(e)?(q(),J(`span`,gf,B(v(e)),1)):Q(``,!0)],10,pf))),128))],64)):Q(``,!0),f.value.length?(q(),J(K,{key:1},[h.value?(q(),J(`p`,_f,`Stale`)):Q(``,!0),(q(!0),J(K,null,G(p.value,e=>(q(),J(`button`,{key:e.path,class:z([`wt-row`,{active:e.path===c.value}]),title:e.path,onClick:t=>y(e)},[Y(`span`,yf,B(g(e)),1),_(e)?(q(),J(`span`,bf,B(_(e)),1)):Q(``,!0),v(e)?(q(),J(`span`,xf,B(v(e)),1)):Q(``,!0)],10,vf))),128)),m.value>0?(q(),J(`button`,{key:1,class:`more-row mono`,"data-testid":`worktree-more`,onClick:t[1]||=e=>l.value=!0},B(m.value)+` more `,1)):Q(``,!0)],64)):Q(``,!0)])):Q(``,!0)],512)):Q(``,!0)}}),[[`__scopeId`,`data-v-3ed3cbd5`]]),Tf={class:`app-header`},Ef={class:`header-identity`},Df=[`title`],Of={key:0,class:`branch-name`},kf=[`title`],Af={key:2,class:`count-add`},jf={key:3,class:`count-del`},Mf=[`title`],Nf={class:`header-pinned`},Pf=[`disabled`,`title`],Ff=tf(gr({__name:`AppHeader`,setup(e){let t=ic(),n=Il(),r=Hl(),{hasMultiple:i}=Su(),a=$(()=>n.shared.status?.branch??null),o=$(()=>{let e=t.activeRepoPath;return e===null?null:Wl(e)}),s=$(()=>!(i.value&&a.value?.tracking!=null&&a.value.current===o.value)),c=$(()=>{let e=a.value?.current,t=a.value?.tracking;if(!t||!e)return t??``;let n=`/${e}`;return t.endsWith(n)?t.slice(0,-n.length):t}),l=$(()=>t.activeRepoId===null?t.error??n.shared.error:n.shared.error);return(e,n)=>(q(),J(`header`,Tf,[Y(`div`,Ef,[n[3]||=wa(`<div class="brand" aria-hidden="true" data-v-b5038c20><span class="mark" data-v-b5038c20><span class="cell add" data-v-b5038c20></span><span class="cell del" data-v-b5038c20></span></span><span class="brand-name mono" data-v-b5038c20>diffstalker</span></div>`,1),X(cf),X(wf),a.value?(q(),J(`div`,{key:0,class:`branch mono`,"data-testid":`branch-info`,title:a.value.tracking?`${a.value.current} → ${a.value.tracking}`:a.value.current},[s.value?(q(),J(`span`,Of,B(a.value.current),1)):Q(``,!0),a.value.tracking?(q(),J(K,{key:1},[n[2]||=Y(`span`,{class:`arrow`,"aria-hidden":`true`},`→`,-1),Y(`span`,{class:`tracking`,title:a.value.tracking},B(c.value),9,kf)],64)):Q(``,!0),a.value.ahead>0?(q(),J(`span`,Af,`↑`+B(a.value.ahead),1)):Q(``,!0),a.value.behind>0?(q(),J(`span`,jf,`↓`+B(a.value.behind),1)):Q(``,!0)],8,Df)):Q(``,!0),l.value?(q(),J(`p`,{key:1,class:`error-line mono`,"data-testid":`header-error`,title:l.value},B(l.value),9,Mf)):Q(``,!0)]),Y(`div`,Nf,[Y(`button`,{class:`finder-btn`,"data-testid":`finder-open`,disabled:U(t).activeRepoId===null,title:U(t).activeRepoId===null?`Open a repository to search it`:`Search this repository: file names, contents, or the open file’s outline`,onClick:n[0]||=e=>U(r).openOverlay(`finder`)},[...n[4]||=[Z(` Search `,-1),Y(`kbd`,{class:`mono`},`Ctrl P`,-1)]],8,Pf),Y(`button`,{class:`settings-btn`,"data-testid":`settings-open`,title:`Settings (,)`,"aria-label":`Settings`,onClick:n[1]||=e=>U(r).toggleOverlay(`settings`)},[...n[5]||=[Y(`svg`,{viewBox:`0 0 16 16`,width:`15`,height:`15`,"aria-hidden":`true`},[Y(`circle`,{cx:`8`,cy:`8`,r:`2.25`}),Y(`path`,{d:`M8 1.5v1.75M8 12.75v1.75M1.5 8h1.75M12.75 8h1.75M3.4 3.4l1.24 1.24M11.36 11.36l1.24 1.24M12.6 3.4l-1.24 1.24M4.64 11.36 3.4 12.6`})],-1)]])])]))}}),[[`__scopeId`,`data-v-b5038c20`]]),If={class:`header-toggles`},Lf=[`aria-pressed`,`aria-label`,`title`],Rf=[`aria-pressed`,`aria-label`,`title`],zf=[`aria-pressed`,`aria-label`,`title`],Bf=[`disabled`,`aria-pressed`,`aria-label`,`title`],Vf=tf(gr({__name:`HeaderToggles`,setup(e){let t=ic(),n=Hl(),r=$(()=>(t.follow?.targetFile??null)!==null),i=$(()=>{let e=t.follow?.followedRepoId??null;return e===null?null:t.repos.find(t=>t.id===e)??null}),a=$(()=>i.value?.path??t.follow?.followedPath??null),o=$(()=>{if(i.value)return Wl(i.value.path);let e=t.follow?.followedPath??null;return e?Wl(e):null}),s=$(()=>r.value&&t.followEnabled),c=$(()=>r.value?t.followEnabled?o.value?`following ${o.value}`:`on`:`off`:`no target`),l=$(()=>{if(!r.value)return`Follow (f): the daemon is not watching a follow hook file (started with --no-follow)`;let e=a.value===null?``:`Following ${a.value}. `;return t.followEnabled?`Follow (f) is on. ${e}Click to stop switching repos on follow changes`:`Follow (f) is off. Click to switch repos when the follow hook changes`}),u=$(()=>n.autoModeEnabled?`Auto mode (a) is on: the newest change is selected and flashed, and the view follows changes appearing or drying up. Click to turn off`:`Auto mode (a) is off. Click to auto-select the newest-changed file and auto-switch Changes/History`),d=$(()=>n.diffSyntaxEnabled?`Diff syntax highlighting (s) is on for every diff. Click to show plain text`:`Diff syntax highlighting (s) is off. Click to turn it on for every diff`),f=$(()=>n.diffMode===`split`),p=$(()=>f.value?`Diff layout (d): side by side (old | new). Click for the unified view`:`Diff layout (d): unified. Click for side by side (old | new)`);return(e,i)=>(q(),J(`div`,If,[Y(`button`,{class:z([`key-toggle mono`,{on:U(n).autoModeEnabled}]),"data-testid":`auto-toggle`,"aria-pressed":U(n).autoModeEnabled,"aria-label":`Auto mode (a): ${U(n).autoModeEnabled?`on`:`off`}`,title:u.value,onClick:i[0]||=e=>U(n).toggleAutoMode()},[...i[4]||=[Y(`span`,{class:`dot`,"aria-hidden":`true`},null,-1),Y(`span`,{class:`label`},[Y(`span`,{class:`key`},`a`),Z(`uto`)],-1)]],10,Lf),Y(`button`,{class:z([`key-toggle mono`,{on:U(n).diffSyntaxEnabled}]),"data-testid":`syntax-toggle`,"aria-pressed":U(n).diffSyntaxEnabled,"aria-label":`Diff syntax highlighting (s): ${U(n).diffSyntaxEnabled?`on`:`off`}`,title:d.value,onClick:i[1]||=e=>U(n).toggleDiffSyntax()},[...i[5]||=[Y(`span`,{class:`dot`,"aria-hidden":`true`},null,-1),Y(`span`,{class:`label`},[Y(`span`,{class:`key`},`s`),Z(`yntax`)],-1)]],10,Rf),Y(`button`,{class:z([`key-toggle mono`,{on:f.value}]),"data-testid":`split-toggle`,"aria-pressed":f.value,"aria-label":`Diff layout (d): ${f.value?`split`:`unified`}`,title:p.value,onClick:i[2]||=e=>U(n).toggleDiffMode()},[...i[6]||=[Y(`span`,{class:`dot`,"aria-hidden":`true`},null,-1),Y(`span`,{class:`label`},[Y(`span`,{class:`key`},`d`),Z(`iff`)],-1)]],10,zf),U(t).follow?(q(),J(`button`,{key:0,class:z([`key-toggle mono`,{on:s.value}]),"data-testid":`follow-toggle`,disabled:!r.value,"aria-pressed":s.value,"aria-label":`Follow mode (f): ${c.value}`,title:l.value,onClick:i[3]||=e=>U(t).toggleFollow()},[...i[7]||=[Y(`span`,{class:`dot`,"aria-hidden":`true`},null,-1),Y(`span`,{class:`label`},[Y(`span`,{class:`key`},`f`),Z(`ollow`)],-1)]],10,Bf)):Q(``,!0)]))}}),[[`__scopeId`,`data-v-9660d705`]]),Hf={ref:`railEl`,class:`rail`,"aria-label":`Views`},Uf=[`aria-current`,`title`,`aria-label`,`onClick`],Wf={viewBox:`0 0 16 16`,width:`16`,height:`16`,"aria-hidden":`true`},Gf=[`d`],Kf={class:`rail-label`},qf=[`data-testid`],Jf={class:`band-right`},Yf=tf(gr({__name:`ActivityRail`,setup(e){let t=Hl(),n=Il(),r=$(()=>n.shared.status?.files.length??null),i=$(()=>n.compare.commitCount);function a(e){return e===`changes`?r.value:e===`compare`?i.value:null}function o(e,t){let n=a(e);return n===null?t:e===`changes`?`${t} — ${n} changed file${n===1?``:`s`}`:`${t} — ${n} commit${n===1?``:`s`} vs the base branch`}let s={changes:`M8 1.5v5M5.5 4h5M4.5 11.5h7`,journal:`M2.5 3.5h11M2.5 7h5.5M2.5 10.5h4M13.5 11a2.75 2.75 0 1 1-5.5 0 2.75 2.75 0 0 1 5.5 0ZM10.75 9.6V11l1 .75`,history:`M8 4.5V8l2.4 1.5M14 8A6 6 0 1 1 8 2a6 6 0 0 1 6 6Z`,compare:`M5 13V3.5M2.8 5.7 5 3.5l2.2 2.2M11 3v9.5M8.8 10.3 11 12.5l2.2-2.2`,explorer:`M2 4h4l1.5 1.5H14V13H2Z`};function c(e){nu({view:e}),t.setActiveView(e)}return(e,n)=>(q(),J(`nav`,Hf,[(q(!0),J(K,null,G(U(Rl),e=>(q(),J(`button`,{key:e.name,class:z([`rail-item`,{active:U(t).activeView===e.name}]),"aria-current":U(t).activeView===e.name?`page`:void 0,title:o(e.name,e.label),"aria-label":o(e.name,e.label),onClick:t=>c(e.name)},[(q(),J(`svg`,Wf,[Y(`path`,{d:s[e.name],fill:`none`,stroke:`currentColor`,"stroke-width":`1.5`,"stroke-linecap":`round`,"stroke-linejoin":`round`},null,8,Gf)])),Y(`span`,Kf,B(e.label),1),a(e.name)===null?Q(``,!0):(q(),J(`span`,{key:0,class:`rail-count`,"data-testid":`${e.name}-count`},`(`+B(a(e.name))+`)`,9,qf))],10,Uf))),128)),Y(`div`,Jf,[X(Vf)])],512))}}),[[`__scopeId`,`data-v-150012b7`]]),Xf=tf(gr({__name:`ViewToolbarStrip`,setup(e){let t=V(null),n=null;return jr(()=>{let e=t.value;if(!e)return;let r=document.getElementById(`view-toolbar-slot`);r||(r=document.createElement(`div`),r.id=`view-toolbar-slot`),r.classList.add(`toolbar-slot`),e.appendChild(r),n=r}),Pr(()=>{n?.parentElement?.classList.contains(`view-toolbar-strip`)&&document.body.appendChild(n),n=null}),(e,n)=>(q(),J(`div`,{ref_key:`stripEl`,ref:t,class:`view-toolbar-strip`},null,512))}}),[[`__scopeId`,`data-v-7578f3db`]]),Zf={class:`status-bar mono`},Qf=[`data-state`],$f=[`title`],ep={key:1,class:`changes`,"data-testid":`change-count`},tp={key:0,class:`count-add`},np={key:1,class:`count-del`},rp=[`data-state`,`title`,`role`,`tabindex`,`onKeydown`],ip=1400,ap=tf(gr({__name:`StatusBar`,setup(e){let t=ic(),n=Il(),r={connecting:`connecting…`,connected:`daemon connected`,disconnected:Al},i=$(()=>r[t.connection]),a=$(()=>t.follow?.followedPath??null),o=$(()=>n.shared.status?.files??null),s=$(()=>o.value?.reduce((e,t)=>e+(t.insertions??0),0)??0),c=$(()=>o.value?.reduce((e,t)=>e+(t.deletions??0),0)??0),l=$(()=>{let e=t.version;if(!e||e.current===null)return null;if(t.daemonUpgraded)return{status:`stale-bundle`,label:`v${t.servedBy} → v${e.current}`,title:`the daemon restarted on ${e.current}; reload to match it`,command:null};let n=`v${e.current}`,r={current:`up to date with npm (${e.latest})`,outdated:`update available on npm: ${e.latest}`,ahead:`ahead of npm (latest published: ${e.latest})`,unknown:`npm version unknown — could not check`},i=e.install?.command??null,a=e.restart??null,o=i&&a?`${i} && ${a}`:i;return{status:e.status,label:e.status===`outdated`?`${n} → ${e.latest}`:n,title:o?`${r[e.status]}\nclick to copy: ${o}`:r[e.status],command:o}}),u=V(null),d=null;function f(e){u.value=e,d!==null&&clearTimeout(d),d=setTimeout(()=>{u.value=null,d=null},ip)}Pr(()=>{d!==null&&clearTimeout(d)});async function p(){let e=l.value?.command;if(e)try{await navigator.clipboard.writeText(e),f(`copied`)}catch{f(`failed`)}}let m={copied:`copied`,failed:`copy failed`},h=$(()=>u.value?m[u.value]:l.value?.label??``);return(e,n)=>(q(),J(`footer`,Zf,[Y(`span`,{class:`conn`,"data-state":U(t).connection,"data-testid":`connection`},[n[0]||=Y(`span`,{class:`dot`,"aria-hidden":`true`},null,-1),Z(B(i.value),1)],8,Qf),a.value?(q(),J(`span`,{key:0,class:`follow-target`,"data-testid":`follow-target`,title:a.value},` follow: `+B(a.value),9,$f)):Q(``,!0),n[1]||=Y(`span`,{class:`spacer`},null,-1),o.value?(q(),J(`span`,ep,[Z(B(o.value.length)+` changed `,1),s.value>0?(q(),J(`span`,tp,`+`+B(s.value),1)):Q(``,!0),c.value>0?(q(),J(`span`,np,`−`+B(c.value),1)):Q(``,!0)])):Q(``,!0),l.value?(q(),J(`span`,{key:2,class:z([`version`,{copyable:l.value.command!==null}]),"data-state":l.value.status,title:l.value.title,role:l.value.command?`button`:void 0,tabindex:l.value.command?0:void 0,"data-testid":`version`,onClick:p,onKeydown:[Xo(Jo(p,[`prevent`]),[`enter`]),Xo(Jo(p,[`prevent`]),[`space`])]},B(h.value),43,rp)):Q(``,!0)]))}}),[[`__scopeId`,`data-v-b98f6b82`]]),op={class:`empty-state`,"data-testid":`empty-state`},sp={class:`card`},cp=tf(gr({__name:`RepoEmptyState`,setup(e){return(e,t)=>(q(),J(`div`,op,[Y(`div`,sp,[t[0]||=wa(`<span class="mark" aria-hidden="true" data-v-2743da3b><span class="cell add" data-v-2743da3b></span><span class="cell del" data-v-2743da3b></span><span class="cell ctx" data-v-2743da3b></span></span><h1 data-v-2743da3b>Open a repository</h1><p class="copy" data-v-2743da3b> diffstalker follows a repository on the daemon&#39;s machine. Type a name to pick one it already knows, or an absolute path to open a new one. </p>`,3),X(nf)])]))}}),[[`__scopeId`,`data-v-2743da3b`]]),lp=`a[href], button:not([disabled]), input:not([disabled]), textarea:not([disabled]), select:not([disabled]), [tabindex]:not([tabindex="-1"])`;function up(e){return!(e===null||!e.isConnected||`disabled`in e&&e.disabled===!0)}function dp(e,t={}){let n=null;function r(t){if(t.key!==`Tab`||t.defaultPrevented)return;let n=e.value;if(!n)return;let r=[...n.querySelectorAll(lp)];if(r.length===0){t.preventDefault();return}let i=r[0],a=r[r.length-1],o=document.activeElement;!(o instanceof HTMLElement)||!r.includes(o)?(t.preventDefault(),(t.shiftKey?a:i).focus()):t.shiftKey&&o===i?(t.preventDefault(),a.focus()):!t.shiftKey&&o===a&&(t.preventDefault(),i.focus())}jr(()=>{n=document.activeElement instanceof HTMLElement?document.activeElement:null;let t=e.value;t?.addEventListener(`keydown`,r),(t?.querySelector(`[data-autofocus]`)??t)?.focus()}),Pr(()=>{e.value?.removeEventListener(`keydown`,r),up(n)?n.focus():t.fallback?.()?.focus()})}var fp={class:`search-modes mono`,"data-testid":`search-modes`},pp=[`aria-current`],mp=[`aria-current`],hp=tf(gr({__name:`SearchModes`,props:{current:{}},setup(e){let t=e,n=Hl();function r(){t.current!==`files`&&n.openOverlay(`finder`)}function i(){t.current!==`contents`&&n.openOverlay(`search`)}async function a(){n.closeOverlay(),nu({view:`explorer`}),n.setActiveView(`explorer`),await On(),n.requestOutline()}return(t,n)=>(q(),J(`div`,fp,[Y(`button`,{type:`button`,class:z([`mode`,{current:e.current===`files`}]),"data-testid":`mode-files`,"aria-current":e.current===`files`?`true`:void 0,title:`Find a file by name`,onClick:r},[...n[1]||=[Z(` Files `,-1),Y(`kbd`,null,`Ctrl P`,-1)]],10,pp),Y(`button`,{type:`button`,class:z([`mode`,{current:e.current===`contents`}]),"data-testid":`mode-contents`,"aria-current":e.current===`contents`?`true`:void 0,title:`Search the text inside files`,onClick:i},[...n[2]||=[Z(` Contents `,-1),Y(`kbd`,null,`⇧ F`,-1)]],10,mp),Y(`button`,{type:`button`,class:`mode`,"data-testid":`mode-outline`,title:`The symbols in the file open in Explorer`,onClick:n[0]||=e=>void a()},[...n[3]||=[Z(` Outline `,-1),Y(`kbd`,null,`o`,-1)]])]))}}),[[`__scopeId`,`data-v-44f4d414`]]),gp=[`aria-expanded`,`aria-controls`,`aria-activedescendant`,`value`],_p={key:0,class:`finder-note mono`},vp={key:1,class:`finder-note error mono`,"data-testid":`finder-error`},yp={key:2,class:`finder-note mono`,"data-testid":`finder-no-matches`},bp=[`id`,`aria-selected`,`title`,`onMousemove`,`onClick`],xp={key:0,class:`hit`},Sp=50,Cp=tf(gr({__name:`FinderOverlay`,setup(e){let t=ic(),n=Ll(),r=Hl(),i=new Xs,a=V(null),o=V(null);dp(a);let s=H(null),c=H(null),l=V(r.overlayQuery),u=H([]),d=V(0),f=null,p=null,m=``;function h(){u.value=f?.find(m)??[],d.value=0,o.value&&(o.value.scrollTop=0)}let g=jl;jr(async()=>{let e=t.activeRepoId;if(e===null)c.value=`No active repository.`;else try{let t=await i.files(e);s.value=t,f=wd(t,Sp),m=l.value,h()}catch(e){c.value=g(e)}}),W(l,e=>{r.setOverlayQuery(e),p!==null&&clearTimeout(p),p=setTimeout(()=>{p=null,e!==m&&(m=e,h())},15)}),Pr(()=>{p!==null&&clearTimeout(p)}),W(()=>t.activeRepoId,()=>r.closeOverlay());let _=$(()=>s.value===null&&c.value===null);function v(e){return Td(e.text,e.positions)}function y(e){let t=u.value.length;t!==0&&(d.value=Ed(d.value,e,t),x())}function b(e){let t=u.value.length;t!==0&&(d.value=Dd(d.value,e,t),x())}function x(){(o.value?.querySelectorAll(`.finder-option`)[d.value])?.scrollIntoView?.({block:`nearest`})}async function S(e){await n.revealFile(e)}function C(e){r.closeOverlay(),nu({view:`explorer`}),r.setActiveView(`explorer`),S(e)}function w(){let e=u.value[d.value];e!==void 0&&C(e.text)}function T(e){e.key===`ArrowDown`||e.ctrlKey&&e.key===`j`?(e.preventDefault(),y(1)):e.key===`ArrowUp`||e.ctrlKey&&e.key===`k`?(e.preventDefault(),y(-1)):e.key===`Tab`?(e.preventDefault(),b(e.shiftKey?-1:1)):e.key===`Enter`?(e.preventDefault(),w()):e.key===`Escape`&&(e.preventDefault(),r.closeOverlay())}return(e,t)=>(q(),J(`div`,{class:`overlay-scrim`,"data-testid":`finder-overlay`,onClick:t[1]||=Jo(e=>U(r).closeOverlay(),[`self`])},[Y(`div`,{ref_key:`dialogEl`,ref:a,class:`overlay-dialog finder`,role:`dialog`,"aria-modal":`true`,"aria-label":`Find file`,tabindex:`-1`},[X(hp,{current:`files`}),Y(`input`,{class:`finder-input mono`,"data-autofocus":``,"data-testid":`finder-input`,type:`text`,role:`combobox`,"aria-expanded":u.value.length>0,"aria-controls":u.value.length>0?`finder-results`:void 0,"aria-activedescendant":u.value.length>0?`finder-option-${d.value}`:void 0,autocomplete:`off`,spellcheck:`false`,placeholder:`Find a file…`,value:l.value,onInput:t[0]||=e=>l.value=e.target.value,onKeydown:T},null,40,gp),_.value?(q(),J(`p`,_p,`Loading file list…`)):c.value?(q(),J(`p`,vp,B(c.value),1)):u.value.length===0?(q(),J(`p`,yp,[l.value===``?(q(),J(K,{key:0},[Z(`This repository has no files.`)],64)):(q(),J(K,{key:1},[Z(`No files match “`+B(l.value)+`”.`,1)],64))])):(q(),J(`ul`,{key:3,id:`finder-results`,ref_key:`listEl`,ref:o,class:`finder-results mono`,role:`listbox`,"aria-label":`Matching files`,"data-testid":`finder-results`},[(q(!0),J(K,null,G(u.value,(e,t)=>(q(),J(`li`,{id:`finder-option-${t}`,key:e.text,class:z([`finder-option`,{selected:t===d.value}]),role:`option`,"aria-selected":t===d.value,title:e.text,onMousemove:e=>d.value=t,onClick:t=>C(e.text)},[(q(!0),J(K,null,G(v(e),(e,t)=>(q(),J(K,{key:t},[e.hit?(q(),J(`span`,xp,B(e.text),1)):(q(),J(K,{key:1},[Z(B(e.text),1)],64))],64))),128))],42,bp))),128))],512)),t[2]||=Y(`p`,{class:`finder-hints mono`,"aria-hidden":`true`},[Y(`kbd`,null,`↑↓`),Z(` / `),Y(`kbd`,null,`ctrl j·k`),Z(` move · `),Y(`kbd`,null,`enter`),Z(` reveal · `),Y(`kbd`,null,`esc`),Z(` close `)],-1)],512)]))}}),[[`__scopeId`,`data-v-8b8c7b53`]]),wp=[`aria-expanded`,`aria-controls`,`aria-activedescendant`,`value`],Tp={key:0,class:`search-note mono`,"data-testid":`search-too-short`},Ep={key:1,class:`search-note mono`},Dp={key:2,class:`search-note error mono`,"data-testid":`search-error`},Op={key:3,class:`search-note mono`,"data-testid":`search-no-matches`},kp=[`title`],Ap={class:`hit-count`},jp=[`id`,`aria-selected`,`onMousemove`,`onClick`],Mp={class:`hit-line`},Np={class:`hit-text`},Pp={key:5,class:`search-note mono`,"data-testid":`search-capped`},Fp={key:6,class:`search-note mono`,"data-testid":`search-incomplete`},Ip=3,Lp=tf(gr({__name:`SearchOverlay`,setup(e){let t=ic(),n=Ll(),r=Hl(),i=new Xs,a=V(null),o=V(null);dp(a);let s=V(r.overlayQuery),c=H(null),l=H(null),u=V(!1),d=V(0),f=null,p=0,m=$(()=>c.value?.matches??[]),h=$(()=>{let e=new Map;for(let t of m.value){let n=e.get(t.path);n?n.push(t):e.set(t.path,[t])}return[...e.entries()].map(([e,t])=>({path:e,hits:t}))}),g=$(()=>m.value);async function _(e){let n=t.activeRepoId;if(n===null){l.value=`No active repository.`;return}p+=1;let r=p;u.value=!0;try{let t=await i.search(n,e);if(r!==p)return;c.value=t,l.value=null,d.value=0,o.value&&(o.value.scrollTop=0)}catch(e){if(r!==p)return;c.value=null,l.value=jl(e)}finally{r===p&&(u.value=!1)}}W(s,e=>{r.setOverlayQuery(e),f!==null&&clearTimeout(f);let t=e.trim();t.length<Ip?(p+=1,c.value=null,l.value=null,u.value=!1):f=setTimeout(()=>{f=null,_(t)},150)},{immediate:!0}),Pr(()=>{f!==null&&clearTimeout(f),p+=1}),W(()=>t.activeRepoId,()=>r.closeOverlay());function v(e){let t=g.value.length;t!==0&&(d.value=Math.min(t-1,Math.max(0,d.value+e)),(o.value?.querySelectorAll(`.hit-row`)[d.value])?.scrollIntoView?.({block:`nearest`}))}function y(e){return g.value.indexOf(e)}async function b(e,t){await n.revealFile(e,{line:t})}function x(e){r.closeOverlay(),nu({view:`explorer`}),r.setActiveView(`explorer`),b(e.path,e.line)}function S(){let e=g.value[d.value];e!==void 0&&x(e)}function C(e){e.key===`ArrowDown`||e.ctrlKey&&e.key===`j`?(e.preventDefault(),v(1)):e.key===`ArrowUp`||e.ctrlKey&&e.key===`k`?(e.preventDefault(),v(-1)):e.key===`Enter`?(e.preventDefault(),S()):e.key===`Escape`&&(e.preventDefault(),r.closeOverlay())}let w=$(()=>s.value.trim().length>0&&s.value.trim().length<Ip),T=$(()=>!u.value&&c.value!==null&&m.value.length===0);return(e,t)=>(q(),J(`div`,{class:`overlay-scrim`,"data-testid":`search-overlay`,onClick:t[1]||=Jo(e=>U(r).closeOverlay(),[`self`])},[Y(`div`,{ref_key:`dialogEl`,ref:a,class:`overlay-dialog search`,role:`dialog`,"aria-modal":`true`,"aria-label":`Search repository content`,tabindex:`-1`},[X(hp,{current:`contents`}),Y(`input`,{class:`search-input mono`,"data-autofocus":``,"data-testid":`search-input`,type:`text`,role:`combobox`,"aria-expanded":m.value.length>0,"aria-controls":m.value.length>0?`search-results`:void 0,"aria-activedescendant":m.value.length>0?`search-option-${d.value}`:void 0,autocomplete:`off`,spellcheck:`false`,placeholder:`Search file contents…`,value:s.value,onInput:t[0]||=e=>s.value=e.target.value,onKeydown:C},null,40,wp),w.value?(q(),J(`p`,Tp,` Type at least `+B(Ip)+` characters. `)):u.value?(q(),J(`p`,Ep,`Searching…`)):l.value?(q(),J(`p`,Dp,B(l.value),1)):T.value?(q(),J(`p`,Op,` No file contains “`+B(s.value.trim())+`”. `,1)):m.value.length>0?(q(),J(`ul`,{key:4,id:`search-results`,ref_key:`listEl`,ref:o,class:`search-results mono`,role:`listbox`,"aria-label":`Matching lines`,"data-testid":`search-results`},[(q(!0),J(K,null,G(h.value,e=>(q(),J(`li`,{key:e.path,class:`hit-group`},[Y(`p`,{class:`hit-path`,title:e.path},[Z(B(e.path)+` `,1),Y(`span`,Ap,B(e.hits.length),1)],8,kp),(q(!0),J(K,null,G(e.hits,e=>(q(),J(`div`,{id:`search-option-${y(e)}`,key:`${e.path}:${e.line}`,class:z([`hit-row`,{selected:y(e)===d.value}]),role:`option`,"aria-selected":y(e)===d.value,onMousemove:t=>d.value=y(e),onClick:t=>x(e)},[Y(`span`,Mp,B(e.line),1),Y(`span`,Np,[Z(B(e.text),1),e.truncated?(q(),J(K,{key:0},[Z(`…`)],64)):Q(``,!0)])],42,jp))),128))]))),128))],512)):Q(``,!0),c.value?.capped?(q(),J(`p`,Pp,` Showing the first `+B(m.value.length)+` matches — narrow the search to see the rest. `,1)):c.value?.incomplete?(q(),J(`p`,Fp,` Search stopped early on this repository. These results are partial. `)):Q(``,!0),t[2]||=Y(`p`,{class:`search-hints mono`,"aria-hidden":`true`},[Y(`kbd`,null,`↑↓`),Z(` move · `),Y(`kbd`,null,`enter`),Z(` open · `),Y(`kbd`,null,`esc`),Z(` close · literal text, not a pattern `)],-1)],512)]))}}),[[`__scopeId`,`data-v-cecc3ed7`]]),Rp={class:`hotkeys-header`},zp={class:`hotkeys-body`,"data-testid":`hotkeys-body`,tabindex:`0`,role:`region`,"aria-label":`Shortcut list`},Bp={class:`hotkeys-columns`},Vp={class:`group-title eyebrow`},Hp={key:0,class:`group-note`},Up={class:`group-entries`},Wp={class:`entry-keys`},Gp={key:0,class:`key-or`},Kp={class:`mono`},qp=tf(gr({__name:`HotkeysOverlay`,setup(e){let t=Hl(),n=V(null);dp(n);let r=[{title:`Open`,note:`On a Mac, use Command instead of Ctrl.`,entries:[{keys:[`Ctrl P`],description:`Find file by name`},{keys:[`Ctrl ⇧ F`],description:`Search file contents`},{keys:[`⇧ F`],description:`Search, without the chord`},{keys:[`/`],description:`Filter the file list`},{keys:[`o`],description:`Outline, in Explorer`}]},{title:`Switch view`,entries:Rl.map((e,t)=>({keys:[String(t+1)],description:e.label}))},{title:`Change the display`,note:`Wrap long lines is a button. It has no key.`,entries:[{keys:[`a`],description:`Jump to the newest change`},{keys:[`s`],description:`Syntax highlighting`},{keys:[`d`],description:`Split or unified diff`},{keys:[`f`],description:`Follow mode`},{keys:[`e`],description:`Expand every big diff`}]},{title:`Lists (files, commits)`,entries:[{keys:[`↑ ↓`],description:`Move selection`},{keys:[`Enter`],description:`Select, focus the diff`},{keys:[`Space`],description:`Select, stay in the list`},{keys:[`Tab`],description:`Next focus stop`},{keys:[`Enter`,`Space`],description:`Fold a commit, in Journal`}]},{title:`Trees (Explorer, Compare)`,entries:[{keys:[`→`],description:`Expand, or step in`},{keys:[`←`],description:`Collapse, or go up`},{keys:[`Home`,`End`],description:`First or last row`}]},{title:`Find, search, outline`,note:`Find file reveals the result in Explorer.`,entries:[{keys:[`Type`],description:`Narrow the list`},{keys:[`↑ ↓`,`Ctrl j k`],description:`Move selection`},{keys:[`Enter`],description:`Go to the result`},{keys:[`Tab`,`⇧ Tab`],description:`Cycle results, in Find file`},{keys:[`Esc`],description:`Close`}]},{title:`Filter (/)`,entries:[{keys:[`/`],description:`Open, or focus the box`},{keys:[`Esc`],description:`Clear and close`}]},{title:`Panes`,note:`j and k need the stacked layout.`,entries:[{keys:[`j k`],description:`Move, or scroll the diff`},{keys:[`↑ ↓ ← →`],description:`Resize, on the divider`}]},{title:`Help and closing`,entries:[{keys:[`,`],description:`Settings`},{keys:[`?`],description:`This help`},{keys:[`Esc`],description:`Close what is open`}]}];return(e,i)=>(q(),J(`div`,{class:`overlay-scrim`,"data-testid":`hotkeys-overlay`,onClick:i[1]||=Jo(e=>U(t).closeOverlay(),[`self`])},[Y(`div`,{ref_key:`dialogEl`,ref:n,class:`overlay-dialog hotkeys`,role:`dialog`,"aria-modal":`true`,"aria-label":`Keyboard shortcuts`,tabindex:`-1`},[Y(`header`,Rp,[i[2]||=Y(`h2`,{class:`hotkeys-title`},`Keyboard shortcuts`,-1),Y(`button`,{class:`hotkeys-close`,"data-autofocus":``,"data-testid":`hotkeys-close`,"aria-label":`Close`,onClick:i[0]||=e=>U(t).closeOverlay()},` × `)]),Y(`div`,zp,[Y(`div`,Bp,[(q(),J(K,null,G(r,e=>Y(`section`,{key:e.title,class:`hotkeys-group`},[Y(`h3`,Vp,B(e.title),1),e.note?(q(),J(`p`,Hp,B(e.note),1)):Q(``,!0),Y(`dl`,Up,[(q(!0),J(K,null,G(e.entries,e=>(q(),J(K,{key:e.keys.join(` `)},[Y(`dt`,Wp,[(q(!0),J(K,null,G(e.keys,(e,t)=>(q(),J(`span`,{key:e,class:`key-alt`},[t>0?(q(),J(`span`,Gp,`or`)):Q(``,!0),Y(`kbd`,Kp,B(e),1)]))),128))]),Y(`dd`,null,B(e.description),1)],64))),128))])])),64))])])],512)]))}}),[[`__scopeId`,`data-v-6c9060b5`]]);function Jp(e,t){if(e.length<=t)return e;let n=Math.max(t,20);if(e.length<=n)return e;let r=e.split(`/`);if(r.length===1){let t=Math.floor((n-1)/2);return e.slice(0,t)+`…`+e.slice(-(n-t-1))}let i=r[r.length-1],a=r[0];if(a.length+3+i.length>n){let e=n-2;if(i.length>e){let t=Math.floor((e-1)/2);return`…/`+i.slice(0,t)+`…`+i.slice(-(e-t-1))}return`…/`+i}let o=a,s=1;for(;s<r.length-1;){let e=r[s],t=o+`/`+e;if(t.length+3+i.length<=n)o=t,s++;else break}return s===r.length-1?e:o+`/…/`+i}var Yp={class:`picker`,"data-testid":`directory-picker`},Xp={class:`bar`},Zp=[`disabled`],Qp=[`title`],$p=[`disabled`],em={key:0,class:`picker-error mono`},tm={key:1,class:`empty mono`},nm={key:2,class:`entries`},rm=[`onClick`],im={class:`entry-name mono`},am={key:0,class:`repo-tag mono`},om={key:3,class:`empty mono`},sm=tf(gr({__name:`DirectoryPicker`,props:{start:{}},emits:[`pick`,`cancel`],setup(e,{emit:t}){let n=e,r=t,i=new Xs,a=V(``),o=V(null),s=V([]),c=V(null),l=V(!1),u=0;async function d(e){let t=++u;l.value=!0;try{let n=await i.browse(e);if(t!==u)return;a.value=n.path,o.value=n.parent,s.value=n.entries,c.value=null}catch(e){if(t!==u)return;c.value=Rs(e)}finally{t===u&&(l.value=!1)}}let f=$(()=>Jp(a.value,52));return jr(async()=>{let e=n.start??void 0;if(await d(e),e!==void 0&&!a.value){let e=c.value;await d(),e&&(c.value=e)}}),(e,t)=>(q(),J(`div`,Yp,[Y(`div`,Xp,[Y(`button`,{class:`up chrome-chip`,type:`button`,disabled:o.value===null||l.value,"aria-label":`Parent directory`,title:`Parent directory`,onClick:t[0]||=e=>d(o.value??void 0)},` ↑ `,8,Zp),Y(`span`,{class:`current mono`,title:a.value},B(f.value||`…`),9,Qp),Y(`button`,{class:`chrome-chip`,type:`button`,onClick:t[1]||=e=>r(`cancel`)},`Cancel`),Y(`button`,{class:`use chrome-chip`,type:`button`,disabled:!a.value,onClick:t[2]||=e=>r(`pick`,a.value)},` Use this folder `,8,$p)]),c.value?(q(),J(`p`,em,B(c.value),1)):Q(``,!0),l.value?(q(),J(`p`,tm,`Loading…`)):Q(``,!0),s.value.length?(q(),J(`ul`,nm,[(q(!0),J(K,null,G(s.value,e=>(q(),J(`li`,{key:e.path},[Y(`button`,{type:`button`,class:`entry`,onClick:t=>d(e.path)},[Y(`span`,im,B(e.name),1),e.isRepo?(q(),J(`span`,am,`repo`)):Q(``,!0)],8,rm)]))),128))])):!l.value&&!c.value?(q(),J(`p`,om,`no subdirectories`)):Q(``,!0)]))}}),[[`__scopeId`,`data-v-db2256cf`]]),cm={class:`settings-header`},lm={class:`settings-body`},um={class:`settings-section`},dm={class:`field-row`},fm=[`value`],pm=[`value`],mm={class:`settings-section`},hm={class:`section-note`},gm={key:0,class:`warn`},_m={key:0,class:`root-list`,"data-testid":`watch-roots`},vm={class:`root-main`},ym=[`title`],bm={key:0,class:`root-status error mono`},xm={key:1,class:`root-status mono`},Sm={key:2,class:`root-status mono`},Cm={key:0,class:`warn`},wm=[`disabled`,`aria-label`,`onClick`],Tm={key:1,class:`field-help empty`},Em=[`disabled`],Dm=[`disabled`],Om={key:3,class:`form-error mono`,"data-testid":`settings-error`},km=tf(gr({__name:`SettingsOverlay`,setup(e){let t=Hl(),n=ec(),r=V(null);dp(r);let i=V(``),a=V(!1);jr(()=>{n.clearSaveError(),n.rescan()});let o=$(()=>n.watchRoots.map(e=>{let t=n.roots.find(t=>t.path===e);return{path:e,repoCount:t?.repos.length??0,error:t?.error??null,capped:t?.capped??!1,pending:t===void 0}}));function s(e){let n=e.target.value;qc(n)&&t.setTheme(n)}async function c(){let e=i.value.trim();e&&!n.saving&&await n.addWatchRoot(e)&&(i.value=``)}async function l(e){await n.addWatchRoot(e)&&(a.value=!1,i.value=``)}function u(e){a.value&&=(e.preventDefault(),!1)}function d(e){n.removeWatchRoot(e)}return(e,f)=>(q(),J(`div`,{class:`overlay-scrim`,"data-testid":`settings-overlay`,onClick:f[4]||=Jo(e=>U(t).closeOverlay(),[`self`])},[Y(`div`,{ref_key:`dialogEl`,ref:r,class:`overlay-dialog settings`,role:`dialog`,"aria-modal":`true`,"aria-label":`Settings`,tabindex:`-1`,onKeydown:Xo(u,[`esc`])},[Y(`header`,cm,[f[5]||=Y(`h2`,{class:`settings-title`},`Settings`,-1),Y(`button`,{class:`settings-close`,"data-autofocus":``,"data-testid":`settings-close`,"aria-label":`Close`,onClick:f[0]||=e=>U(t).closeOverlay()},` × `)]),Y(`div`,lm,[Y(`section`,um,[f[7]||=Y(`h3`,{class:`section-title eyebrow`},`Appearance`,-1),f[8]||=Y(`p`,{class:`section-note`},`Stored in this browser.`,-1),Y(`div`,dm,[f[6]||=Y(`label`,{for:`settings-theme`},`Theme`,-1),Y(`select`,{id:`settings-theme`,value:U(t).theme,onChange:s},[(q(!0),J(K,null,G(U(Kc),e=>(q(),J(`option`,{key:e,value:e},B(U(Jc)[e].displayName),9,pm))),128))],40,fm)])]),Y(`section`,mm,[f[11]||=Y(`h3`,{class:`section-title eyebrow`},`Repositories`,-1),Y(`p`,hm,[f[9]||=Z(` Stored by the daemon, on its machine — every client sees the same list. `,-1),U(n).persisted?Q(``,!0):(q(),J(`span`,gm,` This daemon is not saving settings to disk; they last until it stops. `))]),f[12]||=Y(`h4`,{class:`field-title`},`Watch directories`,-1),f[13]||=Y(`p`,{class:`field-help`},` A folder you keep projects in. Every git repository directly inside it — or one level further down — shows up in the repo switcher, ready to open. `,-1),o.value.length?(q(),J(`ul`,_m,[(q(!0),J(K,null,G(o.value,e=>(q(),J(`li`,{key:e.path,class:`root-row`},[Y(`div`,vm,[Y(`span`,{class:`root-path mono`,title:e.path},B(e.path),9,ym),e.error?(q(),J(`span`,bm,B(e.error),1)):e.pending?(q(),J(`span`,xm,`scanning…`)):(q(),J(`span`,Sm,[Z(B(e.repoCount)+` `+B(e.repoCount===1?`repo`:`repos`)+` `,1),e.capped?(q(),J(`span`,Cm,`(list capped)`)):Q(``,!0)]))]),Y(`button`,{class:`root-remove chrome-chip`,disabled:U(n).saving,"aria-label":`Stop watching ${e.path}`,onClick:t=>d(e.path)},` Remove `,8,wm)]))),128))])):(q(),J(`p`,Tm,`No watch directories yet.`)),Y(`form`,{class:`add-form`,onSubmit:Jo(c,[`prevent`])},[f[10]||=Y(`label`,{class:`visually-hidden`,for:`settings-new-root`},` Directory to watch, absolute on the daemon's machine `,-1),Vn(Y(`input`,{id:`settings-new-root`,"onUpdate:modelValue":f[1]||=e=>i.value=e,class:`mono`,type:`text`,placeholder:`/home/you/projects`,spellcheck:`false`,autocomplete:`off`},null,512),[[Go,i.value]]),Y(`button`,{type:`button`,class:`browse-btn chrome-chip`,"data-testid":`settings-browse`,disabled:U(n).saving,onClick:f[2]||=e=>a.value=!a.value},` Browse… `,8,Em),Y(`button`,{type:`submit`,class:`add-btn chrome-chip`,disabled:U(n).saving||!i.value.trim()},` Add `,8,Dm)],32),a.value?(q(),ga(sm,{key:2,class:`picker-slot`,start:i.value.trim()||null,onPick:l,onCancel:f[3]||=e=>a.value=!1},null,8,[`start`])):Q(``,!0),U(n).saveError?(q(),J(`p`,Om,B(U(n).saveError),1)):Q(``,!0)])])],544)]))}}),[[`__scopeId`,`data-v-800a1350`]]),Am=5e3;function jm(e,t){let n=iu(),r=$(()=>e.value.length),i=$(()=>{let r=e.value,i=n.query;if(i===``||r.length===0)return r;let a=r.slice(0,Am),o=a.map(t),s=new Set(wd(o,a.length).find(i).map(e=>e.text));return a.filter((e,t)=>s.has(o[t]))}),a=$(()=>n.query!==``);return{filtered:i,total:r,active:a,empty:$(()=>a.value&&r.value>0&&i.value.length===0)}}var Mm={class:`filter-chip mono`,"data-testid":`filter-chip`},Nm=[`aria-label`,`value`],Pm={class:`filter-count`,"data-testid":`filter-count`},Fm=tf(gr({__name:`FilterChip`,props:{shown:{},total:{},corpus:{},singular:{}},setup(e){let t=e,n=$(()=>t.total===1?t.singular:t.corpus),r=iu(),i=V(null);W(()=>r.focusRequest,()=>{On(()=>{i.value?.focus(),i.value?.select()})},{immediate:!0});function a(e){e.key===`Escape`&&(e.preventDefault(),r.close())}return(e,o)=>(q(),J(`div`,Mm,[o[2]||=Y(`span`,{class:`filter-slash`,"aria-hidden":`true`},`/`,-1),Y(`input`,{ref_key:`inputEl`,ref:i,class:`filter-input mono`,"data-testid":`filter-input`,type:`text`,autocomplete:`off`,spellcheck:`false`,placeholder:`filter`,"aria-label":`Filter ${t.corpus}`,value:U(r).query,onInput:o[0]||=e=>U(r).setQuery(e.target.value),onKeydown:a},null,40,Nm),Y(`span`,Pm,[U(r).query===``?(q(),J(K,{key:0},[Z(B(t.total)+` `+B(n.value),1)],64)):(q(),J(K,{key:1},[Z(B(t.shown)+` of `+B(t.total)+` `+B(n.value),1)],64))]),Y(`button`,{class:`filter-clear`,type:`button`,"aria-label":`Clear filter`,"data-testid":`filter-clear`,onClick:o[1]||=e=>U(r).close()},` x `)]))}}),[[`__scopeId`,`data-v-cab1f421`]]);function Im(e){let t=e.filter(e=>!e.staged&&e.status!==`untracked`),n=e.filter(e=>!e.staged&&e.status===`untracked`),r=e.filter(e=>e.staged);return{modified:t,untracked:n,staged:r,ordered:[...t,...n,...r]}}function Lm(e,t,n){return n===0?-1:e===-1?t>0?0:n-1:Math.min(n-1,Math.max(0,e+t))}var Rm=.02;function zm(e,t){return Math.min(e.max,Math.max(e.min,t))}function Bm(e){let{container:t,isRow:n,row:r,column:i}=e,a=yl(),o=V(a[r.pref]??r.defaultRatio),s=V(i?a[i.pref]??i.defaultRatio:0),c=!1;function l(){return n.value?r:i??null}function u(){return n.value?o:s}let d=$(()=>n.value?`horizontal`:`vertical`),f=$(()=>Math.round((n.value?o.value:s.value)*100)),p=$(()=>{let e=n.value?r:i??r;return Math.round(e.min*100)}),m=$(()=>{let e=n.value?r:i??r;return Math.round(e.max*100)});function h(e,t){bl({[e.pref]:t})}function g(e){e.button===0&&l()!==null&&(c=!0,e.target.setPointerCapture(e.pointerId))}function _(e){let r=l();if(!c||!r||!t.value)return;let i=t.value.getBoundingClientRect(),a=n.value?i.height:i.width;if(a<=0)return;let o=n.value?e.clientY-i.top:e.clientX-i.left;u().value=zm(r,o/a)}function v(){if(!c)return;c=!1;let e=l();e&&h(e,u().value)}function y(e){c&&(e.target.releasePointerCapture(e.pointerId),v())}function b(){v()}function x(e){let t=l();if(!t)return;let r;if(n.value){if(e.key===`ArrowUp`)r=-.02;else if(e.key===`ArrowDown`)r=Rm;else return}else if(e.key===`ArrowLeft`)r=-.02;else if(e.key===`ArrowRight`)r=Rm;else return;e.preventDefault();let i=u();i.value=zm(t,i.value+r),h(t,i.value)}return{columnRatio:s,rowRatio:o,ariaOrientation:d,ariaValueNow:f,ariaValueMin:p,ariaValueMax:m,onPointerDown:g,onPointerMove:_,onPointerUp:y,onPointerCancel:b,onKeydown:x}}var Vm=48;function Hm(e,t){return(n,r)=>{e.value&&(n.key===`j`?(n.preventDefault(),t(1,r)):n.key===`k`&&(n.preventDefault(),t(-1,r)))}}function Um(e,t,n){return r=>{if(!e.value||r.key!==`j`&&r.key!==`k`)return;r.preventDefault();let i=t.value;if(!i)return;let a=n?.self?i:i.querySelector(`.diff-scroll, .code-scroll`)??i;a.scrollTop+=r.key===`j`?Vm:-48}}function Wm(e,t,n,r){let i=Um(e,t,r);return $(()=>e.value?{tabindex:0,role:`region`,"aria-label":n,onKeydown:i}:{onKeydown:i})}function Gm(e,t,n){let r=V(!1);function i(){let t=e.value;if(!t)return;let r=n();if(!r)return;let i=t.getBoundingClientRect(),a=r.getBoundingClientRect();a.top<i.top?t.scrollTop+=a.top-i.top:a.bottom>i.bottom&&(t.scrollTop+=a.bottom-i.bottom)}return W(t,()=>{r.value||On(i)}),{onPointerEnter:()=>{r.value=!0},onPointerLeave:()=>{r.value=!1}}}var Km=1;function qm(e,t){let n=0,r=e.length-1,i=-1;for(;n<=r;){let a=n+r>>1;e[a].el.getBoundingClientRect().top<=t+Km?(i=a,n=a+1):r=a-1}return i===-1?0:i}function Jm(e,t,n){let r=e[t];if(n.has(r.key))return r;for(let r=t-1;r>=0;r--){let t=e[r];if(t.kind===`hunk`&&n.has(t.key))return t}let i=e.find(e=>e.kind===`file`&&e.key===r.fileKey);if(i&&n.has(i.key))return i;let a=r.el.offsetTop,o=null,s=1/0;for(let t of e){if(t.kind!==`file`||!n.has(t.key))continue;let e=Math.abs(t.el.offsetTop-a);e<s&&(s=e,o=t)}return o}function Ym(e,t){return e.every(e=>e!==null&&e.getBoundingClientRect().top>=t)}function Xm(e,t){let n=null;function r(r){n=null;let i=e.value;if(!i)return;let a=i.getBoundingClientRect().top,o=a+i.clientHeight;if(Ym(r.changedEls,o))return;let s=t.candidates();if(s.length===0)return;let c=Jm(s,qm(s,a),r.survivingKeys);c&&(n={key:c.key,top:c.el.getBoundingClientRect().top})}function i(){let r=n;if(n=null,!r)return 0;let i=e.value;if(!i)return 0;let a=t.resolve(r.key);if(!a)return 0;let o=a.getBoundingClientRect().top-r.top;return o===0?0:(t.isTweenActive?.()||(i.scrollTop+=o),o)}return{prepare:r,restore:i}}var Zm=200,Qm=450,$m=.6,eh=3,th=1.5,nh=[`wheel`,`touchstart`,`pointerdown`,`keydown`];function rh(e,t){let n=0,r=e.length-1,i=-1;for(;n<=r;){let a=n+r>>1;e[a].top<=t?(i=a,n=a+1):r=a-1}return i===-1?0:i}function ih(e){return 1-(1-e)**3}function ah(e,t){let n=t.stickyOffset??0,r=V(null),i=gu(`(prefers-reduced-motion: reduce)`),a=null,o=null,s=0,c=0,l=null;function u(e){e!==r.value&&(r.value=e,t.onActiveKey?.(e))}function d(){a=null}function f(e){let n=t.sectionHeights?.()??null;if(n===null)return null;let r=[],i=n.start;for(let{key:t}of e){let e=n.heightFor(t);if(e===null)return null;r.push({key:t,top:i}),i+=e+n.gap}return r}function p(){if(a===null){let e=t.sections();a=f(e),a===null&&(a=e.map(({key:e,el:t})=>({key:e,top:t.offsetTop})),a.sort((e,t)=>e.top-t.top))}return a}function m(){let t=e.value;if(!t||o!==null||Date.now()<s)return;let i=p();if(i.length===0)return;let a=t.scrollHeight-t.clientHeight;if(a>8&&t.scrollTop>=a-8){u(i[i.length-1].key);return}let c=t.scrollTop+n+1,l=rh(i,c),d=r.value===null?-1:i.findIndex(e=>e.key===r.value);(d===-1||l!==d&&(l>d?c-i[l].top>=8:i[d].top-c>=8))&&u(i[l].key)}function h(){l===null&&(l=requestAnimationFrame(()=>{l=null,m()}))}function g(){return o!==null}function _(){o!==null&&(cancelAnimationFrame(o.raf),o=null)}function v(t){let n=o,r=e.value;if(n===null)return;if(r===null){o=null;return}n.startTs??=t;let i=Math.min(1,(t-n.startTs)/n.duration),a=n.getTop();a===null?o=null:(r.scrollTop=Math.max(0,n.start+(a-n.start)*ih(i)),i>=1?(o=null,s=Date.now()+150):n.raf=requestAnimationFrame(v))}function y(t,n){let r=e.value;if(!r)return;n?.activeKey!==void 0&&u(n.activeKey);let a=t();if(a===null)return;_();let c=r.scrollTop;if(!((n?.smooth??!0)&&!i.value)||Math.abs(a-c)<1){r.scrollTo({top:Math.max(0,a)}),s=Date.now()+150;return}let l=c,d=r.clientHeight;d>0&&Math.abs(a-c)>eh*d&&(l=a-Math.sign(a-c)*th*d,r.scrollTo({top:Math.max(0,l)}),l=r.scrollTop);let f=Math.min(Qm,Math.max(Zm,Math.abs(a-l)*$m)),p={getTop:t,start:l,startTs:null,duration:f,raf:0};o=p,p.raf=requestAnimationFrame(v)}function b(e,r){y(()=>{let r=t.sections().find(t=>t.key===e);return r?r.el.offsetTop-n:null},{...r,activeKey:e})}function x(){c=Date.now(),s=0,_()}let S=typeof ResizeObserver<`u`?new ResizeObserver(()=>d()):null,C=null;function w(e){C=e,e.addEventListener(`scroll`,h,{passive:!0});for(let t of nh)e.addEventListener(t,x,{passive:!0});S&&e instanceof HTMLElement&&S.observe(e)}function T(){let e=C;if(e){C=null,e.removeEventListener(`scroll`,h);for(let t of nh)e.removeEventListener(t,x);S&&e instanceof HTMLElement&&S.unobserve(e),_(),d()}}return W(e,e=>{T(),e&&w(e)},{immediate:!0}),typeof window<`u`&&window.addEventListener(`resize`,d),Oe()&&ke(()=>{T(),S?.disconnect(),l!==null&&cancelAnimationFrame(l),window.removeEventListener(`resize`,d)}),{activeKey:r,scrollToKey:b,scrollToTarget:y,isTweening:g,invalidateOffsets:d,lastUserScrollAt:()=>c}}var oh=o(((e,t)=>{function n(e){return e instanceof Map?e.clear=e.delete=e.set=function(){throw Error(`map is read-only`)}:e instanceof Set&&(e.add=e.clear=e.delete=function(){throw Error(`set is read-only`)}),Object.freeze(e),Object.getOwnPropertyNames(e).forEach(t=>{let r=e[t],i=typeof r;(i===`object`||i===`function`)&&!Object.isFrozen(r)&&n(r)}),e}var r=class{constructor(e){e.data===void 0&&(e.data={}),this.data=e.data,this.isMatchIgnored=!1}ignoreMatch(){this.isMatchIgnored=!0}};function i(e){return e.replace(/&/g,`&amp;`).replace(/</g,`&lt;`).replace(/>/g,`&gt;`).replace(/"/g,`&quot;`).replace(/'/g,`&#x27;`)}function a(e,...t){let n=Object.create(null);for(let t in e)n[t]=e[t];return t.forEach(function(e){for(let t in e)n[t]=e[t]}),n}var o=`</span>`,s=e=>!!e.scope,c=(e,{prefix:t})=>{if(e.startsWith(`language:`))return e.replace(`language:`,`language-`);if(e.includes(`.`)){let n=e.split(`.`);return[`${t}${n.shift()}`,...n.map((e,t)=>`${e}${`_`.repeat(t+1)}`)].join(` `)}return`${t}${e}`},l=class{constructor(e,t){this.buffer=``,this.classPrefix=t.classPrefix,e.walk(this)}addText(e){this.buffer+=i(e)}openNode(e){if(!s(e))return;let t=c(e.scope,{prefix:this.classPrefix});this.span(t)}closeNode(e){s(e)&&(this.buffer+=o)}value(){return this.buffer}span(e){this.buffer+=`<span class="${e}">`}},u=(e={})=>{let t={children:[]};return Object.assign(t,e),t},d=class e{constructor(){this.rootNode=u(),this.stack=[this.rootNode]}get top(){return this.stack[this.stack.length-1]}get root(){return this.rootNode}add(e){this.top.children.push(e)}openNode(e){let t=u({scope:e});this.add(t),this.stack.push(t)}closeNode(){if(this.stack.length>1)return this.stack.pop()}closeAllNodes(){for(;this.closeNode(););}toJSON(){return JSON.stringify(this.rootNode,null,4)}walk(e){return this.constructor._walk(e,this.rootNode)}static _walk(e,t){return typeof t==`string`?e.addText(t):t.children&&(e.openNode(t),t.children.forEach(t=>this._walk(e,t)),e.closeNode(t)),e}static _collapse(t){typeof t!=`string`&&t.children&&(t.children.every(e=>typeof e==`string`)?t.children=[t.children.join(``)]:t.children.forEach(t=>{e._collapse(t)}))}},f=class extends d{constructor(e){super(),this.options=e}addText(e){e!==``&&this.add(e)}startScope(e){this.openNode(e)}endScope(){this.closeNode()}__addSublanguage(e,t){let n=e.root;t&&(n.scope=`language:${t}`),this.add(n)}toHTML(){return new l(this,this.options).value()}finalize(){return this.closeAllNodes(),!0}};function p(e){return e?typeof e==`string`?e:e.source:null}function m(e){return _(`(?=`,e,`)`)}function h(e){return _(`(?:`,e,`)*`)}function g(e){return _(`(?:`,e,`)?`)}function _(...e){return e.map(e=>p(e)).join(``)}function v(e){let t=e[e.length-1];return typeof t==`object`&&t.constructor===Object?(e.splice(e.length-1,1),t):{}}function y(...e){return`(`+(v(e).capture?``:`?:`)+e.map(e=>p(e)).join(`|`)+`)`}function b(e){return RegExp(e.toString()+`|`).exec(``).length-1}function x(e,t){let n=e&&e.exec(t);return n&&n.index===0}var S=new RegExp(y(/\[(?:[^\\\]]|\\.)*\]/,/\(\?<(?![=!])[^>]+>/,/\(\?'[^']+'/,/\(\??/,/\\([1-9][0-9]*)/,/\\./));function C(e,{joinWith:t}){let n=0;return e.map(e=>{n+=1;let t=n,r=p(e),i=``;for(;r.length>0;){let e=S.exec(r);if(!e){i+=r;break}i+=r.substring(0,e.index),r=r.substring(e.index+e[0].length),e[0][0]===`\\`&&e[1]?i+=`\\`+String(Number(e[1])+t):(i+=e[0],(e[0]===`(`||/^\(\?[<']/.test(e[0]))&&n++)}return i}).map(e=>`(${e})`).join(t)}var w=/\b\B/,T=`[a-zA-Z]\\w*`,E=`[a-zA-Z_]\\w*`,D=`\\b\\d+(\\.\\d+)?`,O=`(-?)(\\b0[xX][a-fA-F0-9]+|(\\b\\d+(\\.\\d*)?|\\.\\d+)([eE][-+]?\\d+)?)`,k=`\\b(0b[01]+)`,A=`!|!=|!==|%|%=|&|&&|&=|\\*|\\*=|\\+|\\+=|,|-|-=|/=|/|:|;|<<|<<=|<=|<|===|==|=|>>>=|>>=|>=|>>>|>>|>|\\?|\\[|\\{|\\(|\\^|\\^=|\\||\\|=|\\|\\||~`,j=(e={})=>{let t=/^#![ ]*\//;return e.binary&&(e.begin=_(t,/.*\b/,e.binary,/\b.*/)),a({scope:`meta`,begin:t,end:/$/,relevance:0,"on:begin":(e,t)=>{e.index!==0&&t.ignoreMatch()}},e)},M={begin:`\\\\[\\s\\S]`,relevance:0},N={scope:`string`,begin:`'`,end:`'`,illegal:`\\n`,contains:[M]},P={scope:`string`,begin:`"`,end:`"`,illegal:`\\n`,contains:[M]},F={begin:/\b(a|an|the|are|I'm|isn't|don't|doesn't|won't|but|just|should|pretty|simply|enough|gonna|going|wtf|so|such|will|you|your|they|like|more)\b/},I=function(e,t,n={}){let r=a({scope:`comment`,begin:e,end:t,contains:[]},n);r.contains.push({scope:`doctag`,begin:`[ ]*(?=(TODO|FIXME|NOTE|BUG|OPTIMIZE|HACK|XXX):)`,end:/(TODO|FIXME|NOTE|BUG|OPTIMIZE|HACK|XXX):/,excludeBegin:!0,relevance:0});let i=y(`I`,`a`,`is`,`so`,`us`,`to`,`at`,`if`,`in`,`it`,`on`,/[A-Za-z]+['](d|ve|re|ll|t|s|n)/,/[A-Za-z]+[-][a-z]+/,/[A-Za-z][a-z]{2,}/);return r.contains.push({begin:_(/[ ]+/,`(`,i,/[.]?[:]?([.][ ]|[ ])/,`){3}`)}),r},L=I(`//`,`$`),ee=I(`/\\*`,`\\*/`),R=I(`#`,`$`),te=Object.freeze({__proto__:null,APOS_STRING_MODE:N,BACKSLASH_ESCAPE:M,BINARY_NUMBER_MODE:{scope:`number`,begin:k,relevance:0},BINARY_NUMBER_RE:k,COMMENT:I,C_BLOCK_COMMENT_MODE:ee,C_LINE_COMMENT_MODE:L,C_NUMBER_MODE:{scope:`number`,begin:O,relevance:0},C_NUMBER_RE:O,END_SAME_AS_BEGIN:function(e){return Object.assign(e,{"on:begin":(e,t)=>{t.data._beginMatch=e[1]},"on:end":(e,t)=>{t.data._beginMatch!==e[1]&&t.ignoreMatch()}})},HASH_COMMENT_MODE:R,IDENT_RE:T,MATCH_NOTHING_RE:w,METHOD_GUARD:{begin:`\\.\\s*[a-zA-Z_]\\w*`,relevance:0},NUMBER_MODE:{scope:`number`,begin:D,relevance:0},NUMBER_RE:D,PHRASAL_WORDS_MODE:F,QUOTE_STRING_MODE:P,REGEXP_MODE:{scope:`regexp`,begin:/\/(?=[^/\n]*\/)/,end:/\/[gimuy]*/,contains:[M,{begin:/\[/,end:/\]/,relevance:0,contains:[M]}]},RE_STARTERS_RE:A,SHEBANG:j,TITLE_MODE:{scope:`title`,begin:T,relevance:0},UNDERSCORE_IDENT_RE:E,UNDERSCORE_TITLE_MODE:{scope:`title`,begin:E,relevance:0}});function ne(e,t){e.input[e.index-1]===`.`&&t.ignoreMatch()}function re(e,t){e.className!==void 0&&(e.scope=e.className,delete e.className)}function ie(e,t){t&&e.beginKeywords&&(e.begin=`\\b(`+e.beginKeywords.split(` `).join(`|`)+`)(?!\\.)(?=\\b|\\s)`,e.__beforeBegin=ne,e.keywords=e.keywords||e.beginKeywords,delete e.beginKeywords,e.relevance===void 0&&(e.relevance=0))}function ae(e,t){Array.isArray(e.illegal)&&(e.illegal=y(...e.illegal))}function oe(e,t){if(e.match){if(e.begin||e.end)throw Error(`begin & end are not supported with match`);e.begin=e.match,delete e.match}}function se(e,t){e.relevance===void 0&&(e.relevance=1)}var ce=(e,t)=>{if(!e.beforeMatch)return;if(e.starts)throw Error(`beforeMatch cannot be used with starts`);let n=Object.assign({},e);Object.keys(e).forEach(t=>{delete e[t]}),e.keywords=n.keywords,e.begin=_(n.beforeMatch,m(n.begin)),e.starts={relevance:0,contains:[Object.assign(n,{endsParent:!0})]},e.relevance=0,delete n.beforeMatch},le=[`of`,`and`,`for`,`in`,`not`,`or`,`if`,`then`,`parent`,`list`,`value`],ue=`keyword`;function de(e,t,n=ue){let r=Object.create(null);return typeof e==`string`?i(n,e.split(` `)):Array.isArray(e)?i(n,e):Object.keys(e).forEach(function(n){Object.assign(r,de(e[n],t,n))}),r;function i(e,n){t&&(n=n.map(e=>e.toLowerCase())),n.forEach(function(t){let n=t.split(`|`);r[n[0]]=[e,fe(n[0],n[1])]})}}function fe(e,t){return t?Number(t):+!pe(e)}function pe(e){return le.includes(e.toLowerCase())}var z={},me=e=>{console.error(e)},he=(e,...t)=>{console.log(`WARN: ${e}`,...t)},ge=(e,t)=>{z[`${e}/${t}`]||(console.log(`Deprecated as of ${e}. ${t}`),z[`${e}/${t}`]=!0)},_e=Error();function ve(e,t,{key:n}){let r=0,i=e[n],a={},o={};for(let e=1;e<=t.length;e++)o[e+r]=i[e],a[e+r]=!0,r+=b(t[e-1]);e[n]=o,e[n]._emit=a,e[n]._multi=!0}function ye(e){if(Array.isArray(e.begin)){if(e.skip||e.excludeBegin||e.returnBegin)throw me(`skip, excludeBegin, returnBegin not compatible with beginScope: {}`),_e;if(typeof e.beginScope!=`object`||e.beginScope===null)throw me(`beginScope must be object`),_e;ve(e,e.begin,{key:`beginScope`}),e.begin=C(e.begin,{joinWith:``})}}function be(e){if(Array.isArray(e.end)){if(e.skip||e.excludeEnd||e.returnEnd)throw me(`skip, excludeEnd, returnEnd not compatible with endScope: {}`),_e;if(typeof e.endScope!=`object`||e.endScope===null)throw me(`endScope must be object`),_e;ve(e,e.end,{key:`endScope`}),e.end=C(e.end,{joinWith:``})}}function xe(e){e.scope&&typeof e.scope==`object`&&e.scope!==null&&(e.beginScope=e.scope,delete e.scope)}function Se(e){xe(e),typeof e.beginScope==`string`&&(e.beginScope={_wrap:e.beginScope}),typeof e.endScope==`string`&&(e.endScope={_wrap:e.endScope}),ye(e),be(e)}function B(e){function t(t,n){return new RegExp(p(t),`m`+(e.case_insensitive?`i`:``)+(e.unicodeRegex?`u`:``)+(n?`g`:``))}class n{constructor(){this.matchIndexes={},this.regexes=[],this.matchAt=1,this.position=0}addRule(e,t){t.position=this.position++,this.matchIndexes[this.matchAt]=t,this.regexes.push([t,e]),this.matchAt+=b(e)+1}compile(){this.regexes.length===0&&(this.exec=()=>null);let e=this.regexes.map(e=>e[1]);this.matcherRe=t(C(e,{joinWith:`|`}),!0),this.lastIndex=0}exec(e){this.matcherRe.lastIndex=this.lastIndex;let t=this.matcherRe.exec(e);if(!t)return null;let n=t.findIndex((e,t)=>t>0&&e!==void 0),r=this.matchIndexes[n];return t.splice(0,n),Object.assign(t,r)}}class r{constructor(){this.rules=[],this.multiRegexes=[],this.count=0,this.lastIndex=0,this.regexIndex=0}getMatcher(e){if(this.multiRegexes[e])return this.multiRegexes[e];let t=new n;return this.rules.slice(e).forEach(([e,n])=>t.addRule(e,n)),t.compile(),this.multiRegexes[e]=t,t}resumingScanAtSamePosition(){return this.regexIndex!==0}considerAll(){this.regexIndex=0}addRule(e,t){this.rules.push([e,t]),t.type===`begin`&&this.count++}exec(e){let t=this.getMatcher(this.regexIndex);t.lastIndex=this.lastIndex;let n=t.exec(e);if(this.resumingScanAtSamePosition()&&!(n&&n.index===this.lastIndex)){let t=this.getMatcher(0);t.lastIndex=this.lastIndex+1,n=t.exec(e)}return n&&(this.regexIndex+=n.position+1,this.regexIndex===this.count&&this.considerAll()),n}}function i(e){let t=new r;return e.contains.forEach(e=>t.addRule(e.begin,{rule:e,type:`begin`})),e.terminatorEnd&&t.addRule(e.terminatorEnd,{type:`end`}),e.illegal&&t.addRule(e.illegal,{type:`illegal`}),t}function o(n,r){let a=n;if(n.isCompiled)return a;[re,oe,Se,ce].forEach(e=>e(n,r)),e.compilerExtensions.forEach(e=>e(n,r)),n.__beforeBegin=null,[ie,ae,se].forEach(e=>e(n,r)),n.isCompiled=!0;let s=null;return typeof n.keywords==`object`&&n.keywords.$pattern&&(n.keywords=Object.assign({},n.keywords),s=n.keywords.$pattern,delete n.keywords.$pattern),s||=/\w+/,n.keywords&&=de(n.keywords,e.case_insensitive),a.keywordPatternRe=t(s,!0),r&&(n.begin||=/\B|\b/,a.beginRe=t(a.begin),!n.end&&!n.endsWithParent&&(n.end=/\B|\b/),n.end&&(a.endRe=t(a.end)),a.terminatorEnd=p(a.end)||``,n.endsWithParent&&r.terminatorEnd&&(a.terminatorEnd+=(n.end?`|`:``)+r.terminatorEnd)),n.illegal&&(a.illegalRe=t(n.illegal)),n.contains||=[],n.contains=[].concat(...n.contains.map(function(e){return we(e===`self`?n:e)})),n.contains.forEach(function(e){o(e,a)}),n.starts&&o(n.starts,r),a.matcher=i(a),a}if(e.compilerExtensions||=[],e.contains&&e.contains.includes(`self`))throw Error("ERR: contains `self` is not supported at the top-level of a language. See documentation.");return e.classNameAliases=a(e.classNameAliases||{}),o(e)}function Ce(e){return e?e.endsWithParent||Ce(e.starts):!1}function we(e){return e.variants&&!e.cachedVariants&&(e.cachedVariants=e.variants.map(function(t){return a(e,{variants:null},t)})),e.cachedVariants?e.cachedVariants:Ce(e)?a(e,{starts:e.starts?a(e.starts):null}):Object.isFrozen(e)?a(e):e}var Te=`11.12.0`,Ee=class extends Error{constructor(e,t){super(e),this.name=`HTMLInjectionError`,this.html=t}},De=i,Oe=a,ke=Symbol(`nomatch`),Ae=7,je=function(e){let t=Object.create(null),i=Object.create(null),a=[],o=!0,s=`Could not find the language '{}', did you forget to load/include a language module?`,c={disableAutodetect:!0,name:`Plain text`,contains:[]},l={ignoreUnescapedHTML:!1,throwUnescapedHTML:!1,noHighlightRe:/^(no-?highlight)$/i,languageDetectRe:/\blang(?:uage)?-([\w-]+)\b/i,classPrefix:`hljs-`,cssSelector:`pre code`,languages:null,__emitter:f};function u(e){return l.noHighlightRe.test(e)}function d(e){let t=e.className+` `;t+=e.parentNode?e.parentNode.className:``;let n=l.languageDetectRe.exec(t);if(n){let t=N(n[1]);return t||(he(s.replace(`{}`,n[1])),he(`Falling back to no-highlight mode for this block.`,e)),t?n[1]:`no-highlight`}return t.split(/\s+/).find(e=>u(e)||N(e))}function p(e,t,n){let r=``,i=``;typeof t==`object`?(r=e,n=t.ignoreIllegals,i=t.language):(ge(`10.7.0`,`highlight(lang, code, ...args) has been deprecated.`),ge(`10.7.0`,`Please use highlight(code, options) instead.
5
5
  https://github.com/highlightjs/highlight.js/issues/2277`),i=e,r=t),n===void 0&&(n=!0);let a={code:r,language:i};R(`before:highlight`,a);let o=a.result?a.result:v(a.language,a.code,n);return o.code=a.code,R(`after:highlight`,o),o}function v(e,n,i,a){let c=Object.create(null);function u(e,t){return e.keywords[t]}function d(){if(!A.keywords){M.addText(P);return}let e=0;A.keywordPatternRe.lastIndex=0;let t=A.keywordPatternRe.exec(P),n=``;for(;t;){n+=P.substring(e,t.index);let r=D.case_insensitive?t[0].toLowerCase():t[0],i=u(A,r);if(i){let[e,a]=i;if(M.addText(n),n=``,c[r]=(c[r]||0)+1,c[r]<=Ae&&(F+=a),e.startsWith(`_`))n+=t[0];else{let n=D.classNameAliases[e]||e;m(t[0],n)}}else n+=t[0];e=A.keywordPatternRe.lastIndex,t=A.keywordPatternRe.exec(P)}n+=P.substring(e),M.addText(n)}function f(){if(P===``)return;let e=null;if(typeof A.subLanguage==`string`){if(!t[A.subLanguage]){M.addText(P);return}e=v(A.subLanguage,P,!0,j[A.subLanguage]),j[A.subLanguage]=e._top}else e=S(P,A.subLanguage.length?A.subLanguage:null);A.relevance>0&&(F+=e.relevance),M.__addSublanguage(e._emitter,e.language)}function p(){A.subLanguage==null?d():f(),P=``}function m(e,t){e!==``&&(M.startScope(t),M.addText(e),M.endScope())}function h(e,t){let n=1,r=t.length-1;for(;n<=r;){if(!e._emit[n]){n++;continue}let r=D.classNameAliases[e[n]]||e[n],i=t[n];r?m(i,r):(P=i,d(),P=``),n++}}function g(e,t){return e.scope&&typeof e.scope==`string`&&M.openNode(D.classNameAliases[e.scope]||e.scope),e.beginScope&&(e.beginScope._wrap?(m(P,D.classNameAliases[e.beginScope._wrap]||e.beginScope._wrap),P=``):e.beginScope._multi&&(h(e.beginScope,t),P=``)),A=Object.create(e,{parent:{value:A}}),A}function _(e,t,n){let i=x(e.endRe,n);if(i){if(e[`on:end`]){let n=new r(e);e[`on:end`](t,n),n.isMatchIgnored&&(i=!1)}if(i){for(;e.endsParent&&e.parent;)e=e.parent;return e}}if(e.endsWithParent)return _(e.parent,t,n)}function y(e){return A.matcher.regexIndex===0?(P+=e[0],1):(ee=!0,0)}function b(e){let t=e[0],n=e.rule,i=new r(n),a=[n.__beforeBegin,n[`on:begin`]];for(let n of a)if(n&&(n(e,i),i.isMatchIgnored))return y(t);return n.skip?P+=t:(n.excludeBegin&&(P+=t),p(),!n.returnBegin&&!n.excludeBegin&&(P=t)),g(n,e),n.returnBegin?0:t.length}function C(e){let t=e[0],r=n.substring(e.index),i=_(A,e,r);if(!i)return ke;let a=A;A.endScope&&A.endScope._wrap?(p(),m(t,A.endScope._wrap)):A.endScope&&A.endScope._multi?(p(),h(A.endScope,e)):a.skip?P+=t:(a.returnEnd||a.excludeEnd||(P+=t),p(),a.excludeEnd&&(P=t));do A.scope&&M.closeNode(),!A.skip&&!A.subLanguage&&(F+=A.relevance),A=A.parent;while(A!==i.parent);return i.starts&&g(i.starts,e),a.returnEnd?0:t.length}function w(){let e=[];for(let t=A;t!==D;t=t.parent)t.scope&&e.unshift(t.scope);e.forEach(e=>M.openNode(e))}let T={};function E(t,r){let a=r&&r[0];if(P+=t,a==null)return p(),0;if(T.type===`begin`&&r.type===`end`&&T.index===r.index&&a===``){if(P+=n.slice(r.index,r.index+1),!o){let t=Error(`0 width match regex (${e})`);throw t.languageName=e,t.badRule=T.rule,t}return 1}if(T=r,r.type===`begin`)return b(r);if(r.type===`illegal`&&!i){let e=Error(`Illegal lexeme "`+a+`" for mode "`+(A.scope||`<unnamed>`)+`"`);throw e.mode=A,e}if(r.type===`end`){let e=C(r);if(e!==ke)return e}if(r.type===`illegal`&&a===``)return r.index===n.length||(P+=`