@dubusoft/toodo-linux-arm64 1.3.3-dev.16 → 1.3.3-dev.17
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bin/toodo +0 -0
- package/bin/toodo-server +0 -0
- package/package.json +1 -1
- package/web/assets/index-6KPsebod.js +18 -0
- package/web/assets/index-BAWKg-X2.css +2 -0
- package/web/assets/{markdown-2J-VVyGB.js → markdown-BssgDUKq.js} +1 -1
- package/web/assets/{server-access-BteG4fY0.js → server-access-B1JK1Ia2.js} +1 -1
- package/web/assets/task-graph-DijZe0VW.js +8 -0
- package/web/assets/workspace-list-S6px6B3H.js +1 -0
- package/web/index.html +3 -3
- package/web/sw.js +2 -2
- package/web/assets/index-BSAzUcfT.js +0 -18
- package/web/assets/index-D8l9IJkk.css +0 -2
- package/web/assets/task-graph-BpMpbjXq.js +0 -8
- package/web/assets/workspace-list-B9Mk01az.js +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{i as e,n as t,r as n,s as r,t as i}from"./dist-ZmB2kPfR.js";import{t as a}from"./button-Dghi8qWf.js";import{a as o,n as s,o as c,s as l}from"./connection-BFaD-ecb.js";import{i as u,n as d,o as f,r as p,s as m}from"./event-BTxkSTih.js";var h=r(e(),1),g=n(),_=h.createContext(void 0),v=e=>{let t=h.useContext(_);if(e)return e;if(!t)throw Error(`No QueryClient set, use QueryClientProvider to set one`);return t},y=({client:e,children:t})=>(h.useEffect(()=>(e.mount(),()=>{e.unmount()}),[e]),(0,g.jsx)(_.Provider,{value:e,children:t})),b={setTimeout:(e,t)=>setTimeout(e,t),clearTimeout:e=>clearTimeout(e),setInterval:(e,t)=>setInterval(e,t),clearInterval:e=>clearInterval(e)},x=new class{#e=b;setTimeoutProvider(e){this.#e=e}setTimeout(e,t){return this.#e.setTimeout(e,t)}clearTimeout(e){this.#e.clearTimeout(e)}setInterval(e,t){return this.#e.setInterval(e,t)}clearInterval(e){this.#e.clearInterval(e)}};function S(e){setTimeout(e,0)}var C=typeof window>`u`||`Deno`in globalThis;function w(){}function T(e,t){return typeof e==`function`?e(t):e}function E(e){return typeof e==`number`&&e>=0&&e!==1/0}function D(e,t){return Math.max(e+(t||0)-Date.now(),0)}function O(e,t){return typeof e==`function`?e(t):e}function k(e,t){let{type:n=`all`,exact:r,fetchStatus:i,predicate:a,queryKey:o,stale:s}=e;if(o){if(r){if(t.queryHash!==A(o,t.options))return!1}else if(!M(t.queryKey,o))return!1}if(n!==`all`){let e=t.isActive();if(n===`active`&&!e||n===`inactive`&&e)return!1}return!(typeof s==`boolean`&&t.isStale()!==s||i&&i!==t.state.fetchStatus||a&&!a(t))}function ee(e,t){let{exact:n,status:r,predicate:i,mutationKey:a}=e;if(a){if(!t.options.mutationKey)return!1;if(n){if(j(t.options.mutationKey)!==j(a))return!1}else if(!M(t.options.mutationKey,a))return!1}return!(r&&t.state.status!==r||i&&!i(t))}function A(e,t){return(t?.queryKeyHashFn||j)(e)}function j(e){return JSON.stringify(e,(e,t)=>ne(t)?Object.keys(t).sort().reduce((e,n)=>(e[n]=t[n],e),{}):t)}function M(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(e&&t&&typeof e==`object`&&typeof t==`object`){if(Array.isArray(e)&&Array.isArray(t)){if(t.length>e.length)return!1;for(let n=0;n<t.length;n++)if(!M(e[n],t[n]))return!1;return!0}let n=Object.keys(t);for(let r of n)if(!M(e[r],t[r]))return!1;return!0}return!1}var N=Object.prototype.hasOwnProperty;function P(e,t,n=0){if(e===t)return e;if(n>500)return t;let r=te(e)&&te(t);if(!r&&!(ne(e)&&ne(t)))return t;let i=(r?e:Object.keys(e)).length,a=r?t:Object.keys(t),o=a.length,s=r?Array(o):{},c=0;for(let l=0;l<o;l++){let o=r?l:a[l],u=e[o],d=t[o];if(u===d){s[o]=u,(r?l<i:N.call(e,o))&&c++;continue}if(u===null||d===null||typeof u!=`object`||typeof d!=`object`){s[o]=d;continue}let f=P(u,d,n+1);s[o]=f,f===u&&c++}return i===o&&c===i?e:s}function F(e,t){if(!t||Object.keys(e).length!==Object.keys(t).length)return!1;for(let n in e)if(e[n]!==t[n])return!1;return!0}function te(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function ne(e){if(!re(e))return!1;let t=Object.getPrototypeOf(e),n=t?.constructor;if(n===void 0)return!0;if(typeof n!=`function`)return!1;let r=n.prototype;return!(!re(r)||!r.hasOwnProperty(`isPrototypeOf`)||t!==Object.prototype)}function re(e){return Object.prototype.toString.call(e)===`[object Object]`}function I(e){return new Promise(t=>{x.setTimeout(t,e)})}function L(e,t,n){return typeof n.structuralSharing==`function`?n.structuralSharing(e,t):n.structuralSharing===!1?t:P(e,t)}function R(e,t,n=0){let r=[...e,t];return n&&r.length>n?r.slice(1):r}function ie(e,t,n=0){let r=[t,...e];return n&&r.length>n?r.slice(0,-1):r}var ae=Symbol();function oe(e,t){return!e.queryFn&&t?.initialPromise?()=>t.initialPromise:!e.queryFn||e.queryFn===ae?()=>Promise.reject(Error(`Missing queryFn: '${e.queryHash}'`)):e.queryFn}function se(e,t){return typeof e==`function`?e(...t):!!e}function ce(e,t,n){let r=!1,i;return Object.defineProperty(e,"signal",{enumerable:!0,get:()=>(i??=t(),r||(r=!0,i.aborted?n():i.addEventListener(`abort`,n,{once:!0})),i)}),e}var le=()=>C,ue=()=>le(),z=class{constructor(){this.listeners=new Set,this.subscribe=this.subscribe.bind(this)}subscribe(e){return this.listeners.add(e),this.onSubscribe(),()=>{this.listeners.delete(e),this.onUnsubscribe()}}hasListeners(){return this.listeners.size>0}onSubscribe(){}onUnsubscribe(){}},de=new class extends z{#e;#t;#n;constructor(){super(),this.#n=e=>{if(typeof window<`u`&&window.addEventListener){let t=()=>e();return window.addEventListener(`visibilitychange`,t,!1),()=>{window.removeEventListener(`visibilitychange`,t)}}}}onSubscribe(){this.#t||this.setEventListener(this.#n)}onUnsubscribe(){this.hasListeners()||(this.#t?.(),this.#t=void 0)}setEventListener(e){this.#n=e,this.#t?.(),this.#t=e(e=>{typeof e==`boolean`?this.setFocused(e):this.onFocus()})}setFocused(e){this.#e!==e&&(this.#e=e,this.onFocus())}onFocus(){let e=this.isFocused();this.listeners.forEach(t=>{t(e)})}isFocused(){return typeof this.#e==`boolean`?this.#e:globalThis.document?.visibilityState!==`hidden`}},fe=S;function pe(){let e=[],t=0,n=e=>{e()},r=e=>{e()},i=fe,a=r=>{t?e.push(r):i(()=>{n(r)})},o=()=>{let t=e;e=[],t.length&&i(()=>{r(()=>{t.forEach(e=>{n(e)})})})};return{batch:e=>{let n;t++;try{n=e()}finally{t--,t||o()}return n},batchCalls:e=>(...t)=>{a(()=>{e(...t)})},schedule:a,setNotifyFunction:e=>{n=e},setBatchNotifyFunction:e=>{r=e},setScheduler:e=>{i=e}}}var B=pe(),me=new class extends z{#e=!0;#t;#n;constructor(){super(),this.#n=e=>{if(typeof window<`u`&&window.addEventListener){let t=()=>e(!0),n=()=>e(!1);return window.addEventListener(`online`,t,!1),window.addEventListener(`offline`,n,!1),()=>{window.removeEventListener(`online`,t),window.removeEventListener(`offline`,n)}}}}onSubscribe(){this.#t||this.setEventListener(this.#n)}onUnsubscribe(){this.hasListeners()||(this.#t?.(),this.#t=void 0)}setEventListener(e){this.#n=e,this.#t?.(),this.#t=e(this.setOnline.bind(this))}setOnline(e){this.#e!==e&&(this.#e=e,this.listeners.forEach(t=>{t(e)}))}isOnline(){return this.#e}};function he(e){return Math.min(1e3*2**e,3e4)}function ge(e){return(e??`online`)!==`online`||me.isOnline()}var _e=class extends Error{constructor(e){super(`CancelledError`),this.revert=e?.revert,this.silent=e?.silent}};function ve(e){let t=!1,n=0,r,i=`pending`,a,o,s=new Promise((e,t)=>{a=e,o=t});s.catch(w);let c=()=>i!==`pending`,l=t=>{if(!c()){let n=new _e(t);h(n),e.onCancel?.(n)}},u=()=>{t=!0},d=()=>{t=!1},f=()=>de.isFocused()&&(e.networkMode===`always`||me.isOnline())&&e.canRun(),p=()=>ge(e.networkMode)&&e.canRun(),m=e=>{c()||(r?.(),i=`resolved`,a(e))},h=e=>{c()||(r?.(),i=`rejected`,o(e))},g=t=>new Promise(n=>{r=e=>{(c()||t())&&n(e)},e.onPause?.()}).then(()=>{r=void 0,c()||e.onContinue?.()}),_=()=>{if(c())return;let r,i=n===0?e.initialPromise:void 0;try{r=i??e.fn()}catch(e){r=Promise.reject(e)}Promise.resolve(r).then(m).catch(r=>{if(c())return;let i=e.retry??(ue()?0:3),a=e.retryDelay??he,o=typeof a==`function`?a(n,r):a,s=i===!0||typeof i==`number`&&n<i||typeof i==`function`&&i(n,r);t||!s?h(r):(n++,e.onFail?.(n,r),I(o).then(()=>f()?void 0:g(f)).then(()=>{t?h(r):_()}))})};return{promise:s,status:()=>i,cancel:l,continue:()=>(r?.(),s),cancelRetry:u,continueRetry:d,canStart:p,start:()=>(p()?_():g(p).then(_),s)}}var ye=class{#e;destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),E(this.gcTime)&&(this.#e=x.setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(e){this.gcTime=Math.max(this.gcTime||0,e??(ue()?1/0:3e5))}clearGcTimeout(){this.#e!==void 0&&(x.clearTimeout(this.#e),this.#e=void 0)}};function be(e){return{onFetch:(t,n)=>{let r=t.options,i=t.fetchOptions?.meta?.fetchMore?.direction,a=t.state.data?.pages||[],o=t.state.data?.pageParams||[],s={pages:[],pageParams:[]},c=0,l=async()=>{let n=!1,l=e=>{ce(e,()=>t.signal,()=>n=!0)},u=oe(t.options,t.fetchOptions),d=async(e,r,i)=>{if(n)return Promise.reject(t.signal.reason);if(r==null&&e.pages.length)return Promise.resolve(e);let a=(()=>{let e={client:t.client,queryKey:t.queryKey,pageParam:r,direction:i?`backward`:`forward`,meta:t.options.meta};return l(e),e})(),o=await u(a),{maxPages:s}=t.options,c=i?ie:R;return{pages:c(e.pages,o,s),pageParams:c(e.pageParams,r,s)}};if(i&&a.length){let e=i===`backward`,t=e?Se:xe,n={pages:a,pageParams:o};s=await d(n,t(r,n),e)}else{let t=e??a.length;do{let e=c===0?o[0]??r.initialPageParam:xe(r,s);if(c>0&&e==null)break;s=await d(s,e),c++}while(c<t)}return s};t.fetchFn=t.options.persister?()=>t.options.persister?.(l,{client:t.client,queryKey:t.queryKey,meta:t.options.meta,signal:t.signal},n):l}}}function xe(e,{pages:t,pageParams:n}){let r=t.length-1;return t.length>0?e.getNextPageParam(t[r],t,n[r],n):void 0}function Se(e,{pages:t,pageParams:n}){return t.length>0?e.getPreviousPageParam?.(t[0],t,n[0],n):void 0}var Ce=class extends ye{#e;#t;#n;#r;#i;#a;#o;#s;constructor(e){super(),this.#s=!1,this.#o=e.defaultOptions,this.setOptions(e.options),this.observers=[],this.#i=e.client,this.#r=this.#i.getQueryCache(),this.queryKey=e.queryKey,this.queryHash=e.queryHash,this.#t=Ee(this.options),this.state=e.state??this.#t,this.scheduleGc()}get meta(){return this.options.meta}get queryType(){return this.#e}get promise(){return this.#a?.promise}setOptions(e){if(this.options={...this.#o,...e},e?._type&&(this.#e=e._type),this.updateGcTime(this.options.gcTime),this.state&&this.state.data===void 0){let e=Ee(this.options);e.data!==void 0&&(this.setState(Te(e.data,e.dataUpdatedAt)),this.#t=e)}}optionalRemove(){!this.observers.length&&this.state.fetchStatus===`idle`&&this.#r.remove(this)}setData(e,t){let n=L(this.state.data,e,this.options);return this.#c({data:n,type:`success`,dataUpdatedAt:t?.updatedAt,manual:t?.manual}),n}setState(e){this.#c({type:`setState`,state:e})}cancel(e){let t=this.#a?.promise;return this.#a?.cancel(e),t?t.then(w).catch(w):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}get resetState(){return this.#t}reset(){this.destroy(),this.setState(this.resetState)}isActive(){return this.observers.some(e=>O(e.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===ae||!this.isFetched()}isFetched(){return this.state.dataUpdateCount+this.state.errorUpdateCount>0}isStatic(){return this.getObserversCount()>0&&this.observers.some(e=>O(e.options.staleTime,this)===`static`)}isStale(){return this.getObserversCount()>0?this.observers.some(e=>e.getCurrentResult().isStale):this.state.data===void 0||this.state.isInvalidated}isStaleByTime(e=0){return this.state.data===void 0?!0:e===`static`?!1:this.state.isInvalidated?!0:!D(this.state.dataUpdatedAt,e)}onFocus(){this.observers.find(e=>e.shouldFetchOnWindowFocus())?.refetch({cancelRefetch:!1}),this.#a?.continue()}onOnline(){this.observers.find(e=>e.shouldFetchOnReconnect())?.refetch({cancelRefetch:!1}),this.#a?.continue()}addObserver(e){this.observers.includes(e)||(this.observers.push(e),this.clearGcTimeout(),this.#r.notify({type:`observerAdded`,query:this,observer:e}))}removeObserver(e){let t=this.observers.indexOf(e);t!==-1&&(this.observers.splice(t,1),this.observers.length||(this.#a&&(this.#s||this.state.fetchStatus===`paused`&&this.state.status===`pending`?this.#a.cancel({revert:!0}):this.#a.cancelRetry()),this.scheduleGc()),this.#r.notify({type:`observerRemoved`,query:this,observer:e}))}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||this.#c({type:`invalidate`})}async fetch(e,t){if(this.state.fetchStatus!==`idle`&&this.#a?.status()!==`rejected`){if(this.state.data!==void 0&&t?.cancelRefetch)this.cancel({silent:!0});else if(this.#a)return this.#a.continueRetry(),this.#a.promise}if(e&&this.setOptions(e),!this.options.queryFn){let e=this.observers.find(e=>e.options.queryFn);e&&this.setOptions(e.options)}let n=new AbortController,r=e=>{Object.defineProperty(e,"signal",{enumerable:!0,get:()=>(this.#s=!0,n.signal)})},i=()=>{let e=oe(this.options,t),n=(()=>{let e={client:this.#i,queryKey:this.queryKey,meta:this.meta};return r(e),e})();return this.#s=!1,this.options.persister?this.options.persister(e,n,this):e(n)},a=(()=>{let e={fetchOptions:t,options:this.options,queryKey:this.queryKey,client:this.#i,state:this.state,fetchFn:i};return r(e),e})();(this.#e===`infinite`?be(this.options.pages):this.options.behavior)?.onFetch(a,this),this.#n=this.state,(this.state.fetchStatus===`idle`||this.state.fetchMeta!==a.fetchOptions?.meta)&&this.#c({type:`fetch`,meta:a.fetchOptions?.meta});let o=this.#a=ve({initialPromise:t?.initialPromise,fn:a.fetchFn,onCancel:e=>{e instanceof _e&&e.revert&&this.setState({...this.#n,fetchStatus:`idle`}),n.abort()},onFail:(e,t)=>{this.#c({type:`failed`,failureCount:e,error:t})},onPause:()=>{this.#c({type:`pause`})},onContinue:()=>{this.#c({type:`continue`})},retry:a.options.retry,retryDelay:a.options.retryDelay,networkMode:a.options.networkMode,canRun:()=>!0});try{let e=await o.start();if(e===void 0)throw Error(`${this.queryHash} data is undefined`);return this.setData(e),this.#r.config.onSuccess?.(e,this),this.#r.config.onSettled?.(e,this.state.error,this),e}catch(e){if(e instanceof _e){if(e.silent)return this.#a.promise;if(e.revert){if(this.state.data===void 0)throw e;return this.state.data}}throw this.#c({type:`error`,error:e}),this.#r.config.onError?.(e,this),this.#r.config.onSettled?.(this.state.data,e,this),e}finally{this.#a===o&&(this.#a=void 0),this.scheduleGc()}}#c(e){let t=t=>{switch(e.type){case`failed`:return{...t,fetchFailureCount:e.failureCount,fetchFailureReason:e.error};case`pause`:return{...t,fetchStatus:`paused`};case`continue`:return{...t,fetchStatus:`fetching`};case`fetch`:return{...t,...we(t.data,this.options),fetchMeta:e.meta??null};case`success`:let n={...t,...Te(e.data,e.dataUpdatedAt),dataUpdateCount:t.dataUpdateCount+1,...!e.manual&&{fetchStatus:`idle`,fetchFailureCount:0,fetchFailureReason:null}};return this.#n=e.manual?n:void 0,n;case`error`:let r=e.error;return{...t,error:r,errorUpdateCount:t.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:t.fetchFailureCount+1,fetchFailureReason:r,fetchStatus:`idle`,status:`error`,isInvalidated:!0};case`invalidate`:return{...t,isInvalidated:!0};case`setState`:return{...t,...e.state}}};this.state=t(this.state),B.batch(()=>{this.observers.slice().forEach(e=>{e.onQueryUpdate()}),this.#r.notify({query:this,type:`updated`,action:e})})}};function we(e,t){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:ge(t.networkMode)?`fetching`:`paused`,...e===void 0&&{error:null,status:`pending`}}}function Te(e,t){return{data:e,dataUpdatedAt:t??Date.now(),error:null,isInvalidated:!1,status:`success`}}function Ee(e){let t=typeof e.initialData==`function`?e.initialData():e.initialData,n=t!==void 0,r=n?typeof e.initialDataUpdatedAt==`function`?e.initialDataUpdatedAt():e.initialDataUpdatedAt:0;return{data:t,dataUpdateCount:0,dataUpdatedAt:n?r??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:n?`success`:`pending`,fetchStatus:`idle`}}var De=class extends z{#e;#t=void 0;#n=void 0;#r=void 0;#i;#a;#o;#s;#c;#l;#u;#d;#f;#p=new Set;constructor(e,t){super(),this.options=t,this.#e=e,this.#o=null,this.bindMethods(),this.setOptions(t)}bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(this.#t.addObserver(this),ke(this.#t,this.options)?this.#m():this.updateResult(),this.#y())}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return Ae(this.#t,this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return Ae(this.#t,this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,this.#b(),this.#x(),this.#t.removeObserver(this)}setOptions(e){let t=this.options,n=this.#t;if(this.options=this.#e.defaultQueryOptions(e),this.options.enabled!==void 0&&typeof this.options.enabled!=`boolean`&&typeof this.options.enabled!=`function`&&typeof O(this.options.enabled,this.#t)!=`boolean`)throw Error(`Expected enabled to be a boolean or a callback that returns a boolean`);this.#S(),this.#t.setOptions(this.options),t._defaulted&&!F(this.options,t)&&this.#e.getQueryCache().notify({type:`observerOptionsUpdated`,query:this.#t,observer:this});let r=this.hasListeners();r&&je(this.#t,n,this.options,t)&&this.#m(),this.updateResult(),r&&(this.#t!==n||O(this.options.enabled,this.#t)!==O(t.enabled,this.#t)||O(this.options.staleTime,this.#t)!==O(t.staleTime,this.#t))&&this.#g();let i=this.#_();r&&(this.#t!==n||O(this.options.enabled,this.#t)!==O(t.enabled,this.#t)||i!==this.#f)&&this.#v(i)}getOptimisticResult(e){let t=this.#e.getQueryCache().build(this.#e,e),n=this.createResult(t,e);return F(this.getCurrentResult(),n)||(this.#r=n,this.#a=this.options,this.#i=this.#t.state),n}getCurrentResult(){return this.#r}trackResult(e,t){return new Proxy(e,{get:(e,n)=>(this.trackProp(n),t?.(n),Reflect.get(e,n))})}trackProp(e){this.#p.add(e)}getCurrentQuery(){return this.#t}refetch({...e}={}){return this.fetch({...e})}fetchOptimistic(e){let t=this.#e.defaultQueryOptions(e),n=this.#e.getQueryCache().build(this.#e,t),r=()=>{},i,a=new Promise(e=>{i=e,r=this.#e.getQueryCache().subscribe(i=>{i.type===`updated`&&i.query.queryHash===n.queryHash&&n.state.data!==void 0&&(r(),e(this.createResult(n,t)))})});return Promise.race([n.fetch().then(()=>{let e=this.createResult(n,t);return i?.(e),e}).finally(()=>{r()}),a])}fetch(e){return this.#m({...e,cancelRefetch:e.cancelRefetch??!0}).then(()=>(this.updateResult(),this.#r))}#m(e){this.#S();let t=this.#t.fetch(this.options,e);return e?.throwOnError||(t=t.catch(w)),t}#h(e){return!ue()&&O(this.options.enabled,this.#t)!==!1&&E(e)}#g(){this.#b();let e=O(this.options.staleTime,this.#t);if(this.#r.isStale||!this.#h(e))return;let t=D(this.#r.dataUpdatedAt,e)+1;this.#u=x.setTimeout(()=>{this.#r.isStale||this.updateResult()},t)}#_(){return O(this.options.refetchInterval,this.#t)??!1}#v(e){this.#x(),this.#f=e,this.#f!==0&&this.#h(this.#f)&&(this.#d=x.setInterval(()=>{(this.options.refetchIntervalInBackground||de.isFocused())&&this.#m()},this.#f))}#y(){this.#g(),this.#v(this.#_())}#b(){this.#u!==void 0&&(x.clearTimeout(this.#u),this.#u=void 0)}#x(){this.#d!==void 0&&(x.clearInterval(this.#d),this.#d=void 0)}createResult(e,t){let n=this.#t,r=this.options,i=this.#r,a=this.#i,o=this.#a,s=e===n?this.#n:e.state,{state:c}=e,l={...c},u=!1,d;if(t._optimisticResults){let i=this.hasListeners(),a=!i&&ke(e,t),o=i&&je(e,n,t,r);(a||o)&&(l={...l,...we(c.data,e.options)}),t._optimisticResults===`isRestoring`&&(l.fetchStatus=`idle`)}let{error:f,errorUpdatedAt:p,status:m}=l;d=l.data;let h=!1;if(t.placeholderData!==void 0&&d===void 0&&m===`pending`){let e;i?.isPlaceholderData&&t.placeholderData===o?.placeholderData?(e=i.data,h=!0):e=typeof t.placeholderData==`function`?t.placeholderData(this.#l?.state.data,this.#l):t.placeholderData,e!==void 0&&(m=`success`,d=L(i?.data,e,t),u=!0)}if(t.select&&d!==void 0&&!h){if(i&&d===a?.data&&t.select===this.#s)d=this.#c;else try{this.#s=t.select,d=t.select(d),d=L(i?.data,d,t),this.#c=d,this.#o=null}catch(e){this.#o=e}}else d===void 0&&(this.#o=null);this.#o&&(f=this.#o,d=this.#c,p=Date.now(),m=`error`,u=!1);let g=l.fetchStatus===`fetching`,_=m===`pending`,v=m===`error`,y=_&&g,b=d!==void 0;return{status:m,fetchStatus:l.fetchStatus,isPending:_,isSuccess:m===`success`,isError:v,isInitialLoading:y,isLoading:y,data:d,dataUpdatedAt:l.dataUpdatedAt,error:f,errorUpdatedAt:p,failureCount:l.fetchFailureCount,failureReason:l.fetchFailureReason,errorUpdateCount:l.errorUpdateCount,isFetched:e.isFetched(),isFetchedAfterMount:l.dataUpdateCount>s.dataUpdateCount||l.errorUpdateCount>s.errorUpdateCount,isFetching:g,isRefetching:g&&!_,isLoadingError:v&&!b,isPaused:l.fetchStatus===`paused`,isPlaceholderData:u,isRefetchError:v&&b,isStale:Me(e,t),refetch:this.refetch,isEnabled:O(t.enabled,e)!==!1}}updateResult(){let e=this.#r,t=this.createResult(this.#t,this.options);if(this.#i=this.#t.state,this.#a=this.options,this.#i.data!==void 0&&(this.#l=this.#t),F(t,e))return;this.#r=t;let n=(()=>{if(!e)return!0;let{notifyOnChangeProps:t}=this.options,n=typeof t==`function`?t():t;if(n===`all`||!n&&!this.#p.size)return!0;let r=new Set(n??this.#p);return this.options.throwOnError&&r.add(`error`),Object.keys(this.#r).some(t=>{let n=t;return this.#r[n]!==e[n]&&r.has(n)})})();B.batch(()=>{n&&this.listeners.forEach(e=>{e(this.#r)}),this.#e.getQueryCache().notify({query:this.#t,type:`observerResultsUpdated`})})}#S(){let e=this.#e.getQueryCache().build(this.#e,this.options);if(e===this.#t)return;let t=this.#t;this.#t=e,this.#n=e.state,this.hasListeners()&&(t?.removeObserver(this),e.addObserver(this))}onQueryUpdate(){this.updateResult(),this.hasListeners()&&this.#y()}};function Oe(e,t){return O(t.enabled,e)!==!1&&e.state.data===void 0&&(e.state.status!==`error`||O(t.retryOnMount,e)!==!1)}function ke(e,t){return Oe(e,t)||e.state.data!==void 0&&Ae(e,t,t.refetchOnMount)}function Ae(e,t,n){if(O(t.enabled,e)!==!1&&O(t.staleTime,e)!==`static`){let r=O(n,e);return r===`always`||r!==!1&&Me(e,t)}return!1}function je(e,t,n,r){return(e!==t||O(r.enabled,e)===!1)&&(!n.suspense||e.state.status!==`error`)&&Me(e,n)}function Me(e,t){return O(t.enabled,e)!==!1&&e.isStaleByTime(O(t.staleTime,e))}var Ne=class extends ye{#e;#t;#n;#r;constructor(e){super(),this.#e=e.client,this.mutationId=e.mutationId,this.#n=e.mutationCache,this.#t=[],this.state=e.state||Pe(),this.setOptions(e.options),this.scheduleGc()}setOptions(e){this.options=e,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(e){this.#t.includes(e)||(this.#t.push(e),this.clearGcTimeout(),this.#n.notify({type:`observerAdded`,mutation:this,observer:e}))}removeObserver(e){this.#t=this.#t.filter(t=>t!==e),this.scheduleGc(),this.#n.notify({type:`observerRemoved`,mutation:this,observer:e})}optionalRemove(){this.#t.length||(this.state.status===`pending`?this.scheduleGc():this.#n.remove(this))}continue(){return this.#r?.continue()??(this.state.status===`pending`?this.execute(this.state.variables):Promise.resolve())}async execute(e){let t=()=>{this.#i({type:`continue`})},n={client:this.#e,meta:this.options.meta,mutationKey:this.options.mutationKey},r=this.#r=ve({fn:()=>this.options.mutationFn?this.options.mutationFn(e,n):Promise.reject(Error(`No mutationFn found`)),onFail:(e,t)=>{this.#i({type:`failed`,failureCount:e,error:t})},onPause:()=>{this.#i({type:`pause`})},onContinue:t,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>this.#n.canRun(this)}),i=this.state.status===`pending`,a=!r.canStart();try{if(i)t();else{this.#i({type:`pending`,variables:e,isPaused:a}),this.#n.config.onMutate&&await this.#n.config.onMutate(e,this,n);let t=await this.options.onMutate?.(e,n);t!==this.state.context&&this.#i({type:`pending`,context:t,variables:e,isPaused:a})}let o=await r.start();return await this.#n.config.onSuccess?.(o,e,this.state.context,this,n),await this.options.onSuccess?.(o,e,this.state.context,n),await this.#n.config.onSettled?.(o,null,this.state.variables,this.state.context,this,n),await this.options.onSettled?.(o,null,e,this.state.context,n),this.#i({type:`success`,data:o}),o}catch(t){try{await this.#n.config.onError?.(t,e,this.state.context,this,n)}catch(e){Promise.reject(e)}try{await this.options.onError?.(t,e,this.state.context,n)}catch(e){Promise.reject(e)}try{await this.#n.config.onSettled?.(void 0,t,this.state.variables,this.state.context,this,n)}catch(e){Promise.reject(e)}try{await this.options.onSettled?.(void 0,t,e,this.state.context,n)}catch(e){Promise.reject(e)}throw this.#i({type:`error`,error:t}),t}finally{this.#r===r&&(this.#r=void 0),this.#n.runNext(this)}}#i(e){let t=t=>{switch(e.type){case`failed`:return{...t,failureCount:e.failureCount,failureReason:e.error};case`pause`:return{...t,isPaused:!0};case`continue`:return{...t,isPaused:!1};case`pending`:return{...t,context:e.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:e.isPaused,status:`pending`,variables:e.variables,submittedAt:Date.now()};case`success`:return{...t,data:e.data,failureCount:0,failureReason:null,error:null,status:`success`,isPaused:!1};case`error`:return{...t,data:void 0,error:e.error,failureCount:t.failureCount+1,failureReason:e.error,isPaused:!1,status:`error`}}};this.state=t(this.state),B.batch(()=>{this.#t.forEach(t=>{t.onMutationUpdate(e)}),this.#n.notify({mutation:this,type:`updated`,action:e})})}};function Pe(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:`idle`,variables:void 0,submittedAt:0}}var Fe=class extends z{#e;#t=void 0;#n;#r;constructor(e,t){super(),this.#e=e,this.setOptions(t),this.bindMethods(),this.#i()}bindMethods(){this.mutate=this.mutate.bind(this),this.reset=this.reset.bind(this)}setOptions(e){let t=this.options;this.options=this.#e.defaultMutationOptions(e),F(this.options,t)||this.#e.getMutationCache().notify({type:`observerOptionsUpdated`,mutation:this.#n,observer:this}),t?.mutationKey&&this.options.mutationKey&&j(t.mutationKey)!==j(this.options.mutationKey)?this.reset():this.#n?.state.status===`pending`&&this.#n.setOptions(this.options)}onSubscribe(){this.listeners.size===1&&this.#n&&(this.#n.addObserver(this),this.#i())}onUnsubscribe(){this.hasListeners()||this.#n?.removeObserver(this)}onMutationUpdate(e){this.#i(),this.#a(e)}getCurrentResult(){return this.#t}reset(){this.#n?.removeObserver(this),this.#n=void 0,this.#i(),this.#a()}mutate(e,t){return this.#r=t,this.#n?.removeObserver(this),this.#n=this.#e.getMutationCache().build(this.#e,this.options),this.#n.addObserver(this),this.#n.execute(e)}#i(){let e=this.#n?.state??Pe();this.#t={...e,isPending:e.status===`pending`,isSuccess:e.status===`success`,isError:e.status===`error`,isIdle:e.status===`idle`,mutate:this.mutate,reset:this.reset}}#a(e){B.batch(()=>{let t=this.#r;if(t&&this.hasListeners()){let n=this.#t.variables,r=this.#t.context,i={client:this.#e,meta:this.options.meta,mutationKey:this.options.mutationKey};if(e?.type===`success`){try{t.onSuccess?.(e.data,n,r,i)}catch(e){Promise.reject(e)}try{t.onSettled?.(e.data,null,n,r,i)}catch(e){Promise.reject(e)}}else if(e?.type===`error`){try{t.onError?.(e.error,n,r,i)}catch(e){Promise.reject(e)}try{t.onSettled?.(void 0,e.error,n,r,i)}catch(e){Promise.reject(e)}}}this.listeners.forEach(e=>{e(this.#t)})})}},Ie=h.createContext(!1),Le=()=>h.useContext(Ie);Ie.Provider;function Re(){let e=!1;return{clearReset:()=>{e=!1},reset:()=>{e=!0},isReset:()=>e}}var ze=h.createContext(Re()),Be=()=>h.useContext(ze),Ve=(e,t,n)=>{let r=n?.state.error&&typeof e.throwOnError==`function`?se(e.throwOnError,[n.state.error,n]):e.throwOnError;(e.suspense||r)&&(t.isReset()||(e.retryOnMount=!1))},He=e=>{h.useEffect(()=>{e.clearReset()},[e])},Ue=({result:e,errorResetBoundary:t,throwOnError:n,query:r,suspense:i})=>e.isError&&!t.isReset()&&!e.isFetching&&r&&(i&&e.data===void 0||se(n,[e.error,r])),We=e=>{if(e.suspense){let t=1e3,n=e=>e===`static`?e:Math.max(e??t,t),r=e.staleTime;e.staleTime=typeof r==`function`?(...e)=>n(r(...e)):n(r),typeof e.gcTime==`number`&&(e.gcTime=Math.max(e.gcTime,t))}},Ge=(e,t)=>e?.suspense&&t.isPending,Ke=(e,t,n)=>t.fetchOptimistic(e).catch(()=>{n.clearReset()});function qe(e,t,n){let r=Le(),i=Be(),a=v(n),o=a.defaultQueryOptions(e),s=a.getQueryCache().get(o.queryHash),c=e.subscribed!==!1;o._optimisticResults=r?`isRestoring`:c?`optimistic`:void 0,We(o),Ve(o,i,s),He(i);let[l]=h.useState(()=>new t(a,o)),u=l.getOptimisticResult(o),d=!r&&c;if(h.useSyncExternalStore(h.useCallback(e=>{let t=d?l.subscribe(B.batchCalls(e)):w;return l.updateResult(),t},[l,d]),()=>l.getCurrentResult(),()=>l.getCurrentResult()),h.useEffect(()=>{l.setOptions(o)},[o,l]),Ge(o,u))throw Ke(o,l,i);if(Ue({result:u,errorResetBoundary:i,throwOnError:o.throwOnError,query:s,suspense:o.suspense}))throw u.error;return o.notifyOnChangeProps?u:l.trackResult(u)}function V(e,t){return qe(e,De,t)}function H(e,t){let n=v(t),[r]=h.useState(()=>new Fe(n,e));h.useEffect(()=>{r.setOptions(e)},[r,e]);let i=h.useSyncExternalStore(h.useCallback(e=>r.subscribe(B.batchCalls(e)),[r]),()=>r.getCurrentResult(),()=>r.getCurrentResult()),a=h.useCallback((...e)=>{r.mutate(e[0],e[1]).catch(w)},[r]);if(i.error&&se(r.options.throwOnError,[i.error]))throw i.error;return{...i,mutate:a,mutateAsync:i.mutate}}var Je={name:`ban`,size:24,node:[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M4.929 4.929 19.07 19.071`,key:`196cmz`}]]};Je.node;var Ye=t(Je),Xe={name:`chevron-right`,size:24,node:[[`path`,{d:`m9 18 6-6-6-6`,key:`mthhwq`}]]};Xe.node;var Ze=t(Xe),Qe={name:`chevron-left`,size:24,node:[[`path`,{d:`m15 18-6-6 6-6`,key:`1wnfg3`}]]};Qe.node;var $e=t(Qe),et={name:`laptop`,size:24,node:[[`path`,{d:`M18 5a2 2 0 0 1 2 2v8.526a2 2 0 0 0 .212.897l1.068 2.127a1 1 0 0 1-.9 1.45H3.62a1 1 0 0 1-.9-1.45l1.068-2.127A2 2 0 0 0 4 15.526V7a2 2 0 0 1 2-2z`,key:`1pdavp`}],[`path`,{d:`M20.054 15.987H3.946`,key:`14rxg9`}]]};et.node;var tt=t(et),nt={name:`plus`,size:24,node:[[`path`,{d:`M5 12h14`,key:`1ays0h`}],[`path`,{d:`M12 5v14`,key:`s699le`}]]};nt.node;var rt=t(nt),it={name:`server`,size:24,node:[[`rect`,{width:`20`,height:`8`,x:`2`,y:`2`,rx:`2`,ry:`2`,key:`ngkwjq`}],[`rect`,{width:`20`,height:`8`,x:`2`,y:`14`,rx:`2`,ry:`2`,key:`iecqi9`}],[`line`,{x1:`6`,x2:`6.01`,y1:`6`,y2:`6`,key:`16zg32`}],[`line`,{x1:`6`,x2:`6.01`,y1:`18`,y2:`18`,key:`nzw8ys`}]]};it.node;var at=t(it),ot={name:`triangle-alert`,size:24,node:[[`path`,{d:`m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3`,key:`wmoenq`}],[`path`,{d:`M12 9v4`,key:`juzpu7`}],[`path`,{d:`M12 17h.01`,key:`p32p05`}]],aliases:[`alert-triangle`]};ot.node;var st=t(ot),ct={name:`x`,size:24,node:[[`path`,{d:`M18 6 6 18`,key:`1bl5f8`}],[`path`,{d:`m6 6 12 12`,key:`d8bk6v`}]]};ct.node;var lt=t(ct);function ut(e){return typeof e==`object`&&!!e&&typeof e.kind==`string`&&typeof e.message==`string`}async function U(e,t={}){let n=m();if(n===null)throw Error(`No access token for the Toodo server.`);let r=await o(`/api/rpc/${encodeURIComponent(e)}`,{method:`POST`,headers:{...u(n),"Content-Type":`application/json`},body:JSON.stringify(t)});if(r.status===401)throw f(),Error(`The Toodo server did not accept the access token.`);let i=await r.text();if(r.ok)return i?JSON.parse(i):null;let a=null;try{a=JSON.parse(i)}catch{}throw ut(a)?a:Error(i||`${r.status} ${r.statusText}`)}var W={appInfo:()=>U(`app_info`),listWorkspaces:()=>K(U(`list_workspaces`)),getWorkspace:e=>K(U(`get_workspace`,{id:e})),createWorkspace:e=>K(U(`create_workspace`,{workspace:e})),updateWorkspace:e=>K(U(`update_workspace`,{workspace:e})),moveWorkspace:(e,t)=>K(U(`move_workspace`,{id:e,location:t})),listWorkspaceBranches:e=>K(U(`list_workspace_branches`,{id:e})),createWorkspaceBaseBranch:(e,t,n)=>K(U(`create_workspace_base_branch`,{id:e,name:t,from:n})),deleteWorkspace:e=>K(U(`delete_workspace`,{id:e})),getMachineSettings:e=>K(U(`get_machine_settings`,{machine:e})),saveMachineSettings:e=>K(U(`save_machine_settings`,{settings:e})),listHerdrMachines:()=>K(U(`list_herdr_machines`)),listSshHosts:()=>K(U(`list_ssh_hosts`)),addSshHost:e=>K(U(`add_ssh_host`,{host:e})),listRemoteDirectories:(e,t)=>K(U(`list_remote_directories`,{machine:e,path:t})),listDirectories:(e,t)=>K(U(`list_directories`,{machine:e,path:t})),listTasks:()=>K(U(`list_tasks`)),listTaskRelations:()=>K(U(`list_task_relations`)),addTaskRelation:(e,t)=>K(U(`add_task_relation`,{taskId:e,relatedId:t})),removeTaskRelation:(e,t)=>K(U(`remove_task_relation`,{taskId:e,relatedId:t})),getTask:e=>K(U(`get_task`,{id:e})),createTask:e=>K(U(`create_task`,{task:e})),updateTask:e=>K(U(`update_task`,{task:e})),pauseTask:e=>K(U(`pause_task`,{id:e})),setCompletionNote:(e,t)=>K(U(`set_completion_note`,{id:e,note:t})),reopenTask:(e,t)=>K(U(`reopen_task`,{id:e,reason:t})),setTaskOutcome:(e,t,n)=>K(U(`set_task_outcome`,{id:e,resolution:t,note:n})),checkCriterion:(e,t,n,r)=>K(U(`check_criterion`,{taskId:e,criterionId:t,met:n,evidence:r})),deleteTask:(e,t)=>K(U(`delete_task`,{id:e,force:t})),addDependency:(e,t,n)=>K(U(`add_dependency`,{taskId:e,dependsOn:t,confirmPause:n})),removeDependency:(e,t)=>K(U(`remove_dependency`,{taskId:e,dependsOn:t})),listCommitRecords:e=>K(U(`list_commit_records`,{taskId:e})),listTaskActivity:e=>K(U(`list_task_activity`,{taskId:e})),herdrStatus:()=>K(U(`herdr_status`)),startTask:e=>K(U(`start_task`,{id:e})),ensureTaskWorkspace:e=>K(U(`ensure_task_workspace`,{id:e})),openTaskInHerdr:e=>K(U(`open_task_in_herdr`,{id:e})),focusAgentPane:e=>K(U(`focus_agent_pane`,{id:e})),restoreTaskWorktree:e=>K(U(`restore_task_worktree`,{id:e})),closeTaskWorkspace:e=>K(U(`close_task_workspace`,{id:e})),startPlainRun:(e,t,n,r)=>K(U(`start_plain_run`,{taskId:e,adapter:t,prompt:n,mcp:r})),listTaskRuns:e=>K(U(`list_task_runs`,{taskId:e})),getRunLog:(e,t)=>K(U(`get_run_log`,{runId:e,tailBytes:t})),stopRun:e=>K(U(`stop_run`,{runId:e})),runnerHealth:()=>K(U(`runner_health`)),refreshCommitRecords:e=>K(U(`refresh_commit_records`,{taskId:e})),openPullRequest:e=>K(U(`open_pull_request`,{id:e})),completeTask:e=>K(U(`complete_task`,{id:e})),concludeTask:(e,t)=>K(U(`conclude_task`,{id:e,note:t})),completeTaskMergedWith:(e,t,n)=>K(U(`complete_task_merged_with`,{id:e,mergedWithTask:t,pullRequestUrl:n})),branchFreshness:e=>K(U(`branch_freshness`,{id:e})),listPullRequestStatuses:()=>U(`list_pull_request_statuses`),linkIssue:(e,t)=>K(U(`link_issue`,{id:e,number:t})),createIssue:e=>K(U(`create_issue`,{id:e})),listAgentStatuses:()=>U(`list_agent_statuses`),mcpServerInfo:()=>U(`mcp_server_info`),listMcpTunnels:()=>U(`list_mcp_tunnels`),listConnectedApps:()=>K(U(`list_connected_apps`)),revokeConnectedApp:e=>K(U(`revoke_connected_app`,{grantId:e})),reviewPeriod:(e,t)=>K(U(`review_period`,{start:e,end:t})),getBackupSettings:()=>U(`get_backup_settings`),saveBackupSettings:e=>K(U(`save_backup_settings`,{settings:e})),listBackups:()=>K(U(`list_backups`)),restoreBackup:e=>K(U(`restore_backup`,{name:e}))},G={tasksChanged:dt(`tasks-changed`),workspacesChanged:dt(`workspaces-changed`),agentStatusesChanged:dt(`agent-statuses-changed`),pullRequestStatusesChanged:dt(`pull-request-statuses-changed`)};async function K(e){try{return{status:`ok`,data:await e}}catch(e){if(e instanceof Error)throw e;return{status:`error`,error:e}}}function dt(e){return{listen:t=>d(e,t)}}function ft(e,t){return/filename="([^"]+)"/.exec(e.headers.get(`Content-Disposition`)??``)?.[1]??t}function pt(e,t){let n=URL.createObjectURL(t),r=document.createElement(`a`);r.href=n,r.download=e,r.click(),URL.revokeObjectURL(n)}async function mt(){let e=await p(`/api/backups/export`),t=ft(e,`toodo-backup.sqlite3`);return pt(t,await e.blob()),t}async function ht(e){return pt(e,await(await p(`/api/backups/${encodeURIComponent(e)}`)).blob()),e}async function gt(e){return await(await p(`/api/backups/restore`,{method:`POST`,headers:{"Content-Type":`application/octet-stream`},body:e})).json()}var _t=`toodo-install-dismissed`;function vt(){let{userAgent:e,maxTouchPoints:t}=navigator;return/iPhone|iPad|iPod/.test(e)||e.includes(`Macintosh`)&&t>1}function yt(){return matchMedia(`(display-mode: standalone)`).matches||`standalone`in navigator&&navigator.standalone===!0}var q=null,bt=!1,xt=new Set;function St(){xt.forEach(e=>e())}function Ct(e){return xt.add(e),()=>xt.delete(e)}function wt(){return bt||yt()||localStorage.getItem(_t)!==null?`none`:q===null?vt()?`home-screen`:`none`:`prompt`}function Tt(){localStorage.setItem(_t,`1`),St()}async function Et(){let e=q;if(e===null)return;q=null,await e.prompt();let{outcome:t}=await e.userChoice;t===`dismissed`?Tt():St()}function Dt(){addEventListener(`beforeinstallprompt`,e=>{e.preventDefault(),q=e,St()}),addEventListener(`appinstalled`,()=>{q=null,bt=!0,St()})}function Ot(){return`serviceWorker`in navigator&&`PushManager`in window&&`Notification`in window?`supported`:vt()&&!yt()?`needs-install`:`unsupported`}var J=null,kt={agent:[`Agent needs input`,`Agent finished`],pullRequests:[`CI failed`,`CI passed`,`Changes requested`,`Pull request approved`],completion:[`Task awaiting completion`]};function At(e){return J!==null&&Object.keys(kt).some(t=>J?.[t]===!0&&kt[t].includes(e))}function jt(e){let t=e.replaceAll(`-`,`+`).replaceAll(`_`,`/`),n=t.padEnd(Math.ceil(t.length/4)*4,`=`);return Uint8Array.from(atob(n),e=>e.charCodeAt(0))}function Mt(e,t){let n=e.options.applicationServerKey;return n===null||n.byteLength===t.length&&new Uint8Array(n).every((e,n)=>e===t[n])}function Nt(){return navigator.serviceWorker.getRegistration()}async function Pt(e){let t=await(await Nt())?.pushManager.getSubscription()??null;return t===null||Mt(t,e)?t:(await t.unsubscribe(),null)}async function Ft(e){return await(await p(`/api/push/subscription`,{method:`PUT`,headers:{"Content-Type":`application/json`},body:JSON.stringify(e.toJSON())})).json()}async function It(){let e=await(await p(`/api/push`)).json(),t=await Pt(jt(e.publicKey)),n=t===null?null:t.endpoint===e.subscription?.endpoint?e.subscription:await Ft(t);return J=n?.settings??null,{publicKey:e.publicKey,permission:Notification.permission,subscription:n}}async function Lt(e,t){if(await e!==`granted`)throw Error(`Notifications were not allowed.`);if(await Nt()===void 0)throw Error(`Notifications need the service worker, which only the built app installs.`);let{pushManager:n}=await navigator.serviceWorker.ready,r=jt(t),i=await Pt(r)??await n.subscribe({userVisibleOnly:!0,applicationServerKey:r});try{let e=await Ft(i);return J=e.settings,e}catch(e){throw await i.unsubscribe(),e}}async function Rt(){await(await(await Nt())?.pushManager.getSubscription())?.unsubscribe(),J=null,await p(`/api/push/subscription`,{method:`DELETE`})}async function zt(e){let t=await(await p(`/api/push/settings`,{method:`PUT`,headers:{"Content-Type":`application/json`},body:JSON.stringify(e)})).json();return J=t.settings,t}async function Bt(){await p(`/api/push/test`,{method:`POST`})}var Vt=`toodo-open-task`;function Ht(e){let t=new URL(location.href),n=t.searchParams.get(`task`);if(n!==null&&(t.searchParams.delete(`task`),history.replaceState(history.state,``,t),/^\d+$/.test(n)&&e(Number(n))),!(`serviceWorker`in navigator))return()=>{};let r=navigator.serviceWorker,i=({data:t})=>{typeof t==`object`&&t&&`type`in t&&t.type===Vt&&`taskId`in t&&typeof t.taskId==`number`&&e(t.taskId)};return r.addEventListener(`message`,i),()=>r.removeEventListener(`message`,i)}async function Ut(){return`Notification`in window&&Notification.permission===`granted`}async function Wt(){return`Notification`in window?Notification.requestPermission():`denied`}function Gt(e){At(e.title)||new Notification(e.title,{body:e.body})}var Kt={planned:`Planned`,in_progress:`In progress`,in_review:`Awaiting completion`,done:`Done`};function qt(e){return e.status===`done`&&e.resolution===`completed`?`Completed`:e.status===`done`&&e.resolution===`not_adopted`?`Not adopted`:Kt[e.status]}function Jt(e,t){switch(t.status){case`in_progress`:return`Task started`;case`in_review`:return`Task awaiting completion`;case`done`:return t.resolution===`not_adopted`?`Task concluded without merging`:`Task done`;case`planned`:return e===`in_progress`?`Task paused`:`Task status changed`}}function Yt(e,t){let n=new Map(e.map(e=>[e.id,e.status])),r=new Map(t.map(e=>[e.id,e]));return t.flatMap(e=>{let t=n.get(e.id);if(t===void 0||t===e.status)return[];let i=e.dependsOn.some(e=>r.get(e)?.status!==`done`);return t===`in_progress`&&e.status===`planned`&&i&&e.herdrWorkspaceId!==null?[{title:`Task paused by a new prerequisite`,body:`#${e.id} ${e.title}: close its herdr workspace?`}]:[{title:Jt(t,e),body:`#${e.id} ${e.title}: ${Kt[t]} -> ${qt(e)}`}]})}function Xt(e,t,n){let r=new Map(e.map(e=>[e.taskId,e.status]));return t.flatMap(({taskId:e,status:t})=>{let i=r.get(e);if(i===void 0||i===t||t!==`blocked`)return[];let a=n.find(t=>t.id===e);return[{title:`Agent needs input`,body:a?`#${e} ${a.title}`:`#${e}`}]})}function Zt(e,t,n){let r=new Map(e.map(e=>[e.taskId,e]));return t.flatMap(({taskId:e,checks:t,review:i})=>{let a=r.get(e);if(a===void 0)return[];let o=n.find(t=>t.id===e),s=o?`#${e} ${o.title}`:`#${e}`,c=[];return t===`failing`&&a.checks!==`failing`&&c.push({title:`CI failed`,body:s}),i===`changes_requested`&&a.review!==`changes_requested`&&c.push({title:`Changes requested`,body:s}),c})}async function Qt(e){if(e.length!==0&&(await Ut()||await Wt()===`granted`))for(let t of e)Gt(t)}var $t=class extends Error{kind;constructor(e){super(e.message),this.name=`CommandFailure`,this.kind=e.kind}};async function Y(e){let t=await e;if(t.status===`error`)throw new $t(t.error);return t.data}var X={workspaces:[`workspaces`],tasks:[`task-list`],taskRelations:[`tasks`,`relations`],herdrStatus:[`herdr-status`],runnerHealth:[`runner-health`],agentStatuses:[`agent-statuses`],pullRequestStatuses:[`pull-request-statuses`],machineSettings:e=>[`machine-settings`,e],branches:e=>[`branches`,e],commitRecords:e=>[`tasks`,e,`commit-records`],taskActivity:e=>[`tasks`,e,`activity`],branchFreshness:e=>[`tasks`,e,`branch-freshness`],taskRuns:e=>[`tasks`,e,`runs`],runLog:e=>[`run-log`,e],herdrMachines:[`herdr-machines`],backups:[`backups`],backupSettings:[`backup-settings`],mcpServerInfo:[`mcp-server-info`],mcpTunnels:[`mcp-tunnels`],review:(e,t)=>[`review`,e,t],directories:(e,t)=>[`directories`,e,t]};function en(){return V({queryKey:X.mcpServerInfo,queryFn:()=>W.mcpServerInfo(),refetchInterval:5e3})}function tn(){return V({queryKey:X.mcpTunnels,queryFn:()=>W.listMcpTunnels(),refetchInterval:3e3})}function nn(){return V({queryKey:X.backups,queryFn:()=>Y(W.listBackups())})}function rn(){return V({queryKey:X.backupSettings,queryFn:()=>W.getBackupSettings()})}function an(){let e=v();return H({mutationFn:e=>Y(W.saveBackupSettings(e)),onSuccess:t=>(e.setQueryData(X.backupSettings,t),e.invalidateQueries({queryKey:X.backups}))})}function on(){let e=v();return H({mutationFn:e=>Y(W.restoreBackup(e)),onSuccess:()=>e.invalidateQueries()})}function sn(){return H({mutationFn:mt})}function cn(){return H({mutationFn:ht})}function ln(){let e=v();return H({mutationFn:gt,onSuccess:()=>e.invalidateQueries()})}function un(){return V({queryKey:X.herdrMachines,queryFn:()=>Y(W.listHerdrMachines())})}function dn(e,t){return V({queryKey:X.directories(e,t),queryFn:()=>Y(W.listDirectories(e,t)),enabled:t!==null,retry:!1})}function fn(e){return V({queryKey:[`home-directory`,e],queryFn:async()=>(await Y(W.listDirectories(e,null))).path,staleTime:1/0,retry:!1})}function pn(e){return e.kind===`local`?{kind:`local`}:{kind:`ssh`,label:e.machine}}function mn(){return V({queryKey:X.workspaces,queryFn:()=>Y(W.listWorkspaces())})}function hn(){let e=v();return H({mutationFn:e=>Y(W.createWorkspace(e)),onSuccess:()=>e.invalidateQueries({queryKey:X.workspaces})})}function gn(){let e=v();return H({mutationFn:e=>Y(W.updateWorkspace(e)),onSuccess:()=>e.invalidateQueries({queryKey:X.workspaces,exact:!0})})}function _n(){let e=v();return H({mutationFn:({id:e,location:t})=>Y(W.moveWorkspace(e,t)),onSuccess:()=>{e.invalidateQueries()}})}function vn(e,t){return V({queryKey:X.branches(e),queryFn:()=>Y(W.listWorkspaceBranches(e)),enabled:t,staleTime:0})}function yn(e,t){return V({queryKey:X.branchFreshness(e),queryFn:()=>Y(W.branchFreshness(e)),enabled:t,staleTime:6e4,refetchInterval:3e5,retry:!1})}function bn(){let e=v();return H({mutationFn:({workspace:e,name:t,from:n})=>Y(W.createWorkspaceBaseBranch(e,t,n)),onSuccess:t=>Promise.all([e.invalidateQueries({queryKey:X.workspaces,exact:!0}),e.invalidateQueries({queryKey:X.branches(t.id)})])})}function xn(){let e=v();return H({mutationFn:e=>Y(W.deleteWorkspace(e)),onSuccess:()=>Promise.all([e.invalidateQueries({queryKey:X.tasks}),e.invalidateQueries({queryKey:X.workspaces,exact:!0})])})}function Sn(){return V({queryKey:X.tasks,queryFn:()=>Y(W.listTasks())})}function Cn(e,t){return V({queryKey:X.review(e,t),queryFn:()=>Y(W.reviewPeriod(e,t))})}function wn(){return V({queryKey:X.herdrStatus,queryFn:()=>Y(W.herdrStatus())})}function Tn(){return V({queryKey:X.runnerHealth,queryFn:()=>Y(W.runnerHealth()),refetchInterval:6e4})}function En(){return V({queryKey:X.agentStatuses,queryFn:()=>W.listAgentStatuses()})}function Dn(){return V({queryKey:X.pullRequestStatuses,queryFn:()=>W.listPullRequestStatuses()})}function On(){let e=v();(0,h.useEffect)(()=>{function t(t,n,r){let i=e.getQueryData(t);e.setQueryData(t,n),!(i===void 0||document.hasFocus())&&Qt(r(i,n,e.getQueryData(X.tasks)??[])).catch(e=>console.error(`toodo: failed to show notifications`,e))}let n=[G.tasksChanged.listen(async()=>{let t=e.getQueryData(X.tasks);await Promise.all([e.invalidateQueries({queryKey:X.tasks}),e.invalidateQueries({queryKey:[`tasks`]})]),!(t===void 0||document.hasFocus())&&Qt(Yt(t,e.getQueryData(X.tasks)??[])).catch(e=>console.error(`toodo: failed to show status notifications`,e))}),G.workspacesChanged.listen(()=>e.invalidateQueries({queryKey:X.workspaces,exact:!0})),G.agentStatusesChanged.listen(({payload:e})=>t(X.agentStatuses,e.statuses,Xt)),G.pullRequestStatusesChanged.listen(({payload:e})=>t(X.pullRequestStatuses,e.statuses,Zt))];return()=>{for(let e of n)e.then(e=>e())}},[e])}function kn(e){return V({queryKey:X.machineSettings(e),queryFn:()=>Y(W.getMachineSettings(e))})}function An(){let e=v();return H({mutationFn:e=>Y(W.saveMachineSettings(e)),onSuccess:t=>e.setQueryData(X.machineSettings(t.machine),t)})}function jn(){let e=v();return H({mutationFn:e=>Y(W.startTask(e)),onSuccess:()=>e.invalidateQueries({queryKey:X.tasks})})}function Mn(){return H({mutationFn:e=>Y(W.openTaskInHerdr(e))})}function Nn(){return H({mutationFn:e=>Y(W.focusAgentPane(e))})}function Pn(e,t){return V({queryKey:X.commitRecords(e),queryFn:()=>Y(W.listCommitRecords(e)),enabled:t})}function Fn(e,t){return V({queryKey:X.taskActivity(e),queryFn:()=>Y(W.listTaskActivity(e)),enabled:t})}var In=3e3;function Ln(e){return e===`reserved`||e===`running`}function Rn(e){return V({queryKey:X.taskRuns(e),queryFn:()=>Y(W.listTaskRuns(e)),refetchInterval:e=>e.state.data?.some(e=>Ln(e.state))?In:!1})}function zn(e){return V({queryKey:X.runLog(e),queryFn:()=>Y(W.getRunLog(e,null)),enabled:e!==null,refetchInterval:e=>e.state.data&&Ln(e.state.data.run.state)?In:!1})}function Bn(){let e=v();return H({mutationFn:({taskId:e,adapter:t,mcp:n})=>Y(W.startPlainRun(e,t,null,n)),onSettled:(t,n,{taskId:r})=>e.invalidateQueries({queryKey:X.taskRuns(r)})})}function Vn(){let e=v();return H({mutationFn:e=>Y(W.stopRun(e.id)),onSettled:(t,n,r)=>Promise.all([e.invalidateQueries({queryKey:X.taskRuns(r.taskId)}),e.invalidateQueries({queryKey:X.runLog(r.id)})])})}function Hn(){let e=v();return H({mutationFn:e=>Y(W.refreshCommitRecords(e)),onSuccess:(t,n)=>e.setQueryData(X.commitRecords(n),t)})}function Un(){let e=v();return H({mutationFn:e=>Y(W.openPullRequest(e)),onSuccess:t=>Promise.all([e.invalidateQueries({queryKey:X.tasks}),e.invalidateQueries({queryKey:X.commitRecords(t.id)})])})}function Wn(){let e=v();return H({mutationFn:e=>Y(W.completeTask(e)),onSuccess:t=>Promise.all([e.invalidateQueries({queryKey:X.tasks}),e.invalidateQueries({queryKey:X.commitRecords(t.id)}),e.invalidateQueries({queryKey:X.taskActivity(t.id)})])})}function Gn(){let e=v();return H({mutationFn:({id:e,note:t})=>Y(W.concludeTask(e,t)),onSuccess:t=>Promise.all([e.invalidateQueries({queryKey:X.tasks}),e.invalidateQueries({queryKey:X.commitRecords(t.id)}),e.invalidateQueries({queryKey:[`review`]})])})}function Kn(){let e=v();return H({mutationFn:({id:e,note:t})=>Y(W.setCompletionNote(e,t)),onSuccess:()=>Promise.all([e.invalidateQueries({queryKey:X.tasks}),e.invalidateQueries({queryKey:[`review`]})])})}function qn(){let e=v();return H({mutationFn:({id:e,reason:t})=>Y(W.reopenTask(e,t)),onSuccess:()=>Promise.all([e.invalidateQueries({queryKey:X.tasks}),e.invalidateQueries({queryKey:[`review`]})])})}function Jn(){let e=v();return H({mutationFn:({id:e,resolution:t,note:n})=>Y(W.setTaskOutcome(e,t,n)),onSuccess:()=>Promise.all([e.invalidateQueries({queryKey:X.tasks}),e.invalidateQueries({queryKey:[`review`]})])})}function Yn(){let e=v();return H({mutationFn:({id:e,mergedWithTask:t,pullRequestUrl:n})=>Y(W.completeTaskMergedWith(e,t,n)),onSuccess:t=>Promise.all([e.invalidateQueries({queryKey:X.tasks}),e.invalidateQueries({queryKey:X.commitRecords(t.id)}),e.invalidateQueries({queryKey:[`review`]})])})}function Xn(){let e=v();return H({mutationFn:e=>Y(W.restoreTaskWorktree(e)),onSuccess:()=>e.invalidateQueries({queryKey:X.tasks})})}function Zn(){let e=v();return H({mutationFn:e=>Y(W.updateTask(e)),onSuccess:()=>e.invalidateQueries({queryKey:X.tasks})})}function Z(e){let t=v();return H({mutationFn:e,onSuccess:()=>t.invalidateQueries({queryKey:X.tasks})})}function Qn(){return Z(e=>Y(W.pauseTask(e)))}function $n(){return Z(e=>Y(W.closeTaskWorkspace(e)))}function er(){return Z(({taskId:e,criterionId:t,met:n,evidence:r})=>Y(W.checkCriterion(e,t,n,r)))}function tr(){return Z(({id:e,force:t})=>Y(W.deleteTask(e,t)))}function nr(){return Z(({id:e,dependsOn:t,confirmPause:n})=>Y(W.addDependency(e,t,n)))}function rr(){return Z(({id:e,dependsOn:t})=>Y(W.removeDependency(e,t)))}function ir(){return V({queryKey:X.taskRelations,queryFn:()=>Y(W.listTaskRelations())})}function ar(e){let t=v();return H({mutationFn:e,onSuccess:()=>t.invalidateQueries({queryKey:X.taskRelations})})}function or(){return ar(({taskId:e,relatedId:t})=>Y(W.addTaskRelation(e,t)))}function sr(){return ar(({taskId:e,relatedId:t})=>Y(W.removeTaskRelation(e,t)))}function cr(){return Z(({id:e,number:t})=>Y(W.linkIssue(e,t)))}function lr(){return Z(e=>Y(W.createIssue(e)))}var ur=class extends Error{constructor(e,t,n){super(`Task #${e} was added, but issue #${t} could not be linked: ${n}`),this.name=`IssueLinkFailure`}};function dr(){let e=v();return H({mutationFn:async({issue:e,...t})=>{let n=await Y(W.createTask(t));if(e===null)return n;try{return await Y(W.linkIssue(n.id,e))}catch(t){throw new ur(n.id,e,t instanceof Error?t.message:String(t))}},onSettled:()=>e.invalidateQueries({queryKey:X.tasks})})}var fr={planned:`Blocked`,ready:`Ready`,paused:`Paused`,in_progress:`In progress`,in_review:`Awaiting completion`,done:`Done`,not_adopted:`Not adopted`},pr=`Planned on`,mr={neutral:`bg-muted text-foreground/70`,info:`bg-sky-100 text-sky-800 dark:bg-sky-950 dark:text-sky-200`,progress:`bg-blue-100 text-blue-800 dark:bg-blue-950 dark:text-blue-200`,review:`bg-violet-100 text-violet-800 dark:bg-violet-950 dark:text-violet-200`,success:`bg-emerald-100 text-emerald-800 dark:bg-emerald-950 dark:text-emerald-200`,attention:`bg-amber-100 text-amber-900 dark:bg-amber-950 dark:text-amber-200`,danger:`bg-rose-100 text-rose-800 dark:bg-rose-950 dark:text-rose-200`},hr={neutral:`text-muted-foreground`,info:`text-sky-700 dark:text-sky-300`,progress:`text-blue-700 dark:text-blue-300`,review:`text-violet-700 dark:text-violet-300`,success:`text-emerald-700 dark:text-emerald-300`,attention:`text-amber-700 dark:text-amber-300`,danger:`text-rose-700 dark:text-rose-300`},gr={neutral:`border-border text-muted-foreground`,info:`border-sky-300 text-sky-700 dark:border-sky-800 dark:text-sky-300`,progress:`border-blue-300 text-blue-700 dark:border-blue-800 dark:text-blue-300`,review:`border-violet-300 text-violet-700 dark:border-violet-800 dark:text-violet-300`,success:`border-emerald-300 text-emerald-700 dark:border-emerald-800 dark:text-emerald-300`,attention:`border-amber-300 text-amber-700 dark:border-amber-800 dark:text-amber-300`,danger:`border-rose-300 text-rose-700 dark:border-rose-800 dark:text-rose-300`},_r=`border-input text-foreground/70`,vr={info:`border border-sky-300 bg-sky-50 text-sky-900 dark:border-sky-800 dark:bg-sky-950 dark:text-sky-100`,attention:`border border-amber-300 bg-amber-50 text-amber-900 dark:border-amber-800 dark:bg-amber-950 dark:text-amber-100`,danger:`border border-rose-300 bg-rose-50 text-rose-900 dark:border-rose-800 dark:bg-rose-950 dark:text-rose-100`},yr={neutral:`bg-neutral-400`,info:`bg-sky-500`,progress:`bg-blue-500`,review:`bg-violet-500`,success:`bg-emerald-500`,attention:`bg-amber-500`,danger:`bg-rose-500`},br={neutral:`border-muted-foreground`,info:`border-sky-500`,progress:`border-blue-500`,review:`border-violet-500`,success:`border-emerald-500`,attention:`border-amber-500`,danger:`border-rose-500 dark:border-rose-400`},xr={done:`border-emerald-500 bg-emerald-100 dark:bg-emerald-950`,ready:`border-amber-500 shadow-none`,blocked:`border-dashed border-muted-foreground shadow-none`,paused:`border-dashed border-muted-foreground bg-muted shadow-none`,behindDue:`border-2 border-rose-500 dark:border-rose-400`},Sr=`border-foreground/70`,Cr=`text-foreground`,wr=200;function Tr(e){return/^[a-zA-Z]:/.test(e)||e.startsWith(`\\\\`)}function Er(e,t){let n=Tr(e)?`\\`:`/`;return/[\\/]$/.test(e)?`${e}${t}`:`${e}${n}${t}`}function Dr(e){return e.replace(/(?<=[^\\/:])[\\/]+$/,``)}function Or(e,t){let[n,r]=(0,h.useState)(e);return(0,h.useEffect)(()=>{let n=setTimeout(()=>r(e),t);return()=>clearTimeout(n)},[e,t]),n}function kr({id:e,machine:t,value:n,onChange:r,describedBy:a,required:o,autoFocus:s,className:c}){let[l,u]=(0,h.useState)(!1),[d,f]=(0,h.useState)(-1),p=Math.max(n.lastIndexOf(`/`),n.lastIndexOf(`\\`)),m=p<0?null:n.slice(0,p+1),_=n.slice(p+1).toLowerCase(),v=Or(m,wr),y=dn(t,l?v:null),b=l&&m!==null&&v===m,x=b&&y.data?y.data.directories.filter(e=>e.toLowerCase().startsWith(_)):[],S=x.length>0,C=`${e}-folders`,w=t.kind===`local`?`the server`:t.label;function T(e){r(e),f(-1),u(!0)}function E(e){m!==null&&T(`${Er(m,e)}${Tr(m)?`\\`:`/`}`)}function D(e){if(e.key===`ArrowDown`||e.key===`ArrowUp`){if(e.preventDefault(),!S){u(!0);return}let t=x.length,n=e.key===`ArrowDown`;f(e=>e<0?n?0:t-1:(e+(n?1:t-1))%t)}else if(e.key===`Enter`){if(!S||d<0)return;e.preventDefault(),E(x[d])}else if(e.key===`Tab`){if(!S||e.shiftKey||d<0&&_===``)return;e.preventDefault(),e.stopPropagation(),E(x[Math.max(d,0)])}else if(e.key===`Escape`){if(!S)return;e.preventDefault(),e.stopPropagation(),u(!1)}}return(0,g.jsxs)(`div`,{className:`relative min-w-0 flex-1`,children:[(0,g.jsx)(`input`,{id:e,role:`combobox`,"aria-expanded":S,"aria-controls":C,"aria-autocomplete":`list`,"aria-activedescendant":S&&d>=0?`${C}-${d}`:void 0,"aria-describedby":a,autoComplete:`off`,spellCheck:!1,className:c,value:n,onChange:e=>T(e.target.value),onFocus:()=>u(!0),onBlur:()=>u(!1),onKeyDown:D,required:o,autoFocus:s}),S&&(0,g.jsx)(`ul`,{id:C,role:`listbox`,"aria-label":`Folders in ${m}`,className:`absolute top-full right-0 left-0 z-10 mt-1 flex max-h-56 flex-col overflow-y-auto rounded-lg border bg-popover p-1 font-mono text-xs text-popover-foreground shadow-md`,children:x.map((e,t)=>(0,g.jsxs)(`li`,{id:`${C}-${t}`,role:`option`,"aria-selected":t===d,onMouseDown:e=>e.preventDefault(),onClick:()=>E(e),className:i(`cursor-pointer truncate rounded px-1.5 py-1 hover:bg-muted max-md:py-2`,t===d&&`bg-secondary hover:bg-secondary`),children:[e,Tr(m??``)?`\\`:`/`]},e))}),b&&y.isError&&(0,g.jsxs)(`p`,{role:`status`,className:`mt-1 text-xs break-words text-muted-foreground`,children:[`No suggestions: `,y.error.message,`. Type the path of a folder that exists on `,w,`, ending in a separator, to see its subfolders.`]})]})}function Ar(e,t){if(e===null)return;let n=[...e.querySelectorAll(`a[href], button, input, select, textarea, summary, [tabindex]`)].filter(e=>!e.matches(`:disabled, [tabindex='-1']`)&&e.getClientRects().length>0);if(n.length===0)return;let r=n[0],i=n[n.length-1],a=document.activeElement,o=a instanceof Node&&e.contains(a);(t.shiftKey?!o||a===r:!o||a===i)&&(t.preventDefault(),(t.shiftKey?i:r).focus())}function jr(e){let t=/^[a-zA-Z]:/.test(e)||e.startsWith(`\\\\`)||e.includes(`\\`)&&!e.includes(`/`),n=t?`\\`:`/`,r=``,i=e,a=t?/^[\\/]{2}[^\\/]+[\\/]+[^\\/]+/.exec(e):null,o=t?/^[a-zA-Z]:([\\/]?)/.exec(e):null;a?(r=`${a[0].replace(/[\\/]+/g,`\\`).replace(/^\\/,`\\\\`)}\\`,i=e.slice(a[0].length)):o?(r=o[0].slice(0,2)+(o[1]?n:``),i=e.slice(o[0].length)):/^[\\/]/.test(e)&&(r=n,i=e.replace(/^[\\/]+/,``));let s=[];for(let e of i.split(t?/[\\/]+/:/\/+/))e!==``&&e!==`.`&&(e===`..`?s.length>0&&s[s.length-1]!==`..`?s.pop():r===``&&s.push(e):s.push(e));return{root:r,separator:n,segments:s}}function Mr(e){let{root:t,separator:n,segments:r}=jr(e),i=t+r.join(n);return i===``?`.`:i}function Nr(e,t=2){let{separator:n,segments:r}=jr(e);return r.length<=t?Mr(e):`…${n}${r.slice(-t).join(n)}`}var Pr=[`none`,`local_git`,`github`],Fr=[`manual`,`local_merge`,`pr_merge`],Ir=[`herdr`,`plain`,`none`],Lr=[`open`,`init`,`clone`],Rr={none:`Plain folder`,local_git:`Local git`,github:`GitHub`},zr={manual:`Manual`,local_merge:`Local merge`,pr_merge:`PR merge`},Q={none:`No runner`,herdr:`herdr`,plain:`Plain`},Br={open:`Open existing`,init:`New repository`,clone:`Clone URL`};function Vr(e){return e===`none`?`manual`:e===`local_git`?`local_merge`:`pr_merge`}function Hr(e,t=!1){return e===`none`?`none`:t?`plain`:`herdr`}function Ur(e){return e===`none`?null:`open`}function Wr(e,t){switch(t){case`manual`:return null;case`local_merge`:return e===`local_git`?null:e===`none`?`Needs a git repository; choose source Local git`:`GitHub tasks merge through pull requests; choose source Local git`;case`pr_merge`:return e===`github`?null:e===`none`?`Needs a git repository; choose source GitHub`:`Needs a GitHub origin remote; choose source GitHub`}}function Gr(e,t,n){return n!==`none`&&e===`none`?`Needs a git repository for task worktrees; choose source Local git or GitHub`:n===`none`&&t!==`manual`?`${zr[t]} needs the task branch that herdr or ${Q.plain} creates; choose completion Manual`:null}function Kr(e,t){return e===`plain`&&t===`ssh`?`Runs agents on this server only; choose herdr for an SSH machine, or add the workspace on Local`:null}function qr(e,t){return e===`none`?`A plain folder has no repository; choose source Local git or GitHub`:e===`github`&&t===`init`?`A new repository has no GitHub origin; choose source Local git`:null}function Jr(e,t=!1){let{source:n}=e,r=e.repository!==null&&qr(n,e.repository)===null?e.repository:Ur(n),i=e.completion!==null&&Wr(n,e.completion)===null?e.completion:Vr(n);return{source:n,repository:r,completion:i,runner:e.runner!==null&&Gr(n,i,e.runner)===null?e.runner:Hr(n,t)}}function Yr(e,t,n=!1){let r={...e,...t},i=Jr(r,n);return{source:r.source,repository:r.repository===i.repository?r.repository:null,completion:r.completion===i.completion?r.completion:null,runner:r.runner===i.runner?r.runner:null}}var Xr=`h-8 w-full min-w-0 rounded-lg border border-input bg-background px-2.5 text-sm outline-none max-md:h-11 focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50`,Zr=`h-6 rounded-md border border-input bg-background px-1.5 text-xs outline-none max-md:h-11 max-md:px-2.5 max-md:text-sm focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 disabled:opacity-50`;function Qr(e){let t=Mr(e.path);return e.kind===`local`?t:`${e.machine}:${t}`}function $r(e){let t=Nr(e.path);return e.kind===`local`?t:`${e.machine}:${t}`}var ei={foreign:`Windows path, not on this server`,missing:`Folder not found on the server`};function ti({problem:e,className:t}){return(0,g.jsxs)(`span`,{className:i(`flex min-w-0 items-start gap-1 text-xs text-destructive`,t),title:`Toodo cannot run git in this repository until its path is corrected`,children:[(0,g.jsx)(st,{"aria-hidden":`true`,className:`mt-0.5 size-3 shrink-0`}),(0,g.jsx)(`span`,{children:ei[e]})]})}function ni({workspace:e}){let t=Rr[e.source],n=zr[e.completion],r=Q[e.runner];return(0,g.jsxs)(`span`,{className:`text-xs text-muted-foreground`,title:`Source ${t}, completion ${n}, runner ${r}; set when the workspace was added`,children:[(0,g.jsx)(`span`,{className:`whitespace-nowrap`,children:t}),` · `,(0,g.jsx)(`span`,{className:`whitespace-nowrap`,children:n}),` `,`· `,(0,g.jsx)(`span`,{className:`whitespace-nowrap`,children:r})]})}function ri(e){return e.kind===`local`?null:e.machine}function ii(e,t){let n=t.filter(t=>t.target===e);return n.length===0?`Not saved in herdr`:n.some(e=>e.enabled)?null:`Disabled in herdr`}function ai(e){return/[\\/]$/.test(e)?e:Er(e,``)}function $({label:e,help:t,children:n}){let r=(0,h.useId)(),i=`${r}-help`;return(0,g.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,g.jsx)(`label`,{htmlFor:r,className:`text-xs text-muted-foreground`,children:e}),n({id:r,describedBy:t?i:void 0}),t&&(0,g.jsx)(`p`,{id:i,className:`text-xs text-muted-foreground`,children:t})]})}function oi(e){return e.replace(/[\\/]+$/,``).split(/[\\/]/).pop()??``}function si(e){return oi(e.trim().replace(/\.git$/,``)).split(`:`).pop()??``}function ci({selectedId:e,onSelect:t}){let n=mn(),r=(0,h.useSyncExternalStore)(c,s),i=r===`unreachable`||r===`retrying`,o=un(),u=Tn().data?.herdr.installed===!1,[d,f]=(0,h.useState)(null),p=(0,h.useRef)(null),m=()=>{f(null),p.current?.focus()},[_,v]=(0,h.useState)(!1),y=o.data??[],b=[null,...new Set([...y.map(e=>e.target),...(n.data??[]).flatMap(e=>e.location.kind===`ssh`?[e.location.machine]:[])])];return(0,g.jsxs)(`section`,{"aria-labelledby":`workspaces-heading`,className:`flex shrink-0 flex-col gap-2`,children:[(0,g.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,g.jsx)(`h2`,{id:`workspaces-heading`,className:`text-xs font-medium uppercase text-muted-foreground`,children:`Workspaces`}),(0,g.jsxs)(a,{variant:`ghost`,size:`xs`,onClick:()=>v(e=>!e),children:[!_&&(0,g.jsx)(rt,{}),_?`Cancel`:`Add machine`]})]}),_&&(0,g.jsx)(pi,{herdrMissing:u,onClose:()=>v(!1)}),o.isError&&(u?(0,g.jsxs)(`p`,{className:`text-xs text-muted-foreground`,children:[`herdr is not installed on this server, so there are no SSH machines; workspaces on Local can use runner`,` `,Q.plain,`.`]}):(0,g.jsxs)(`p`,{role:`alert`,className:`text-xs text-destructive`,children:[`Failed to list herdr machines: `,o.error.message]})),n.isPending&&!i&&(0,g.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Loading workspaces...`}),(n.isError||n.isPending&&i)&&(0,g.jsxs)(`div`,{role:`alert`,className:`flex flex-col items-start gap-2 text-sm text-destructive`,children:[(0,g.jsxs)(`p`,{children:[`Failed to load workspaces:`,` `,n.error?.message??(l()||`The Toodo server does not answer.`)]}),(0,g.jsx)(a,{size:`xs`,variant:`outline`,onClick:()=>void n.refetch(),children:`Retry now`})]}),n.data?.length===0&&d===null&&(0,g.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`No workspaces yet.`}),(0,g.jsx)(`div`,{className:`flex flex-col gap-3`,children:n.data&&b.map(r=>{let i=r??`Local`,s=n.data.filter(e=>ri(e.location)===r),c=r!==null&&o.isSuccess?ii(r,y):null;return(0,g.jsxs)(`section`,{"aria-label":`Machine ${i}`,className:`flex flex-col gap-1`,children:[(0,g.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,g.jsxs)(`h3`,{className:`flex min-w-0 flex-1 items-center gap-1.5 px-1 text-xs font-semibold`,children:[r===null?(0,g.jsx)(tt,{"aria-hidden":!0,className:`size-3.5 shrink-0 text-muted-foreground`}):(0,g.jsx)(at,{"aria-hidden":!0,className:`size-3.5 shrink-0 text-muted-foreground`}),(0,g.jsx)(`span`,{className:`truncate`,children:i}),c&&(0,g.jsx)(`span`,{className:`ml-1.5 font-normal text-destructive`,children:c})]}),(0,g.jsxs)(a,{size:`xs`,variant:`outline`,"aria-label":`Add workspace on ${i}`,title:`Add a workspace on this machine`,"aria-haspopup":`dialog`,"aria-expanded":d!==null&&d.machine===r,onClick:e=>{p.current=e.currentTarget,f({machine:r})},children:[(0,g.jsx)(rt,{}),`Add`]})]}),s.length>0&&(0,g.jsx)(`ul`,{className:`flex flex-col gap-1`,children:s.map(n=>(0,g.jsx)(li,{workspace:n,selected:n.id===e,onSelect:t},n.id))})]},i)})}),d&&(0,g.jsx)(Si,{machine:d.machine,onCreated:e=>{m(),t(e.id)},onClose:m})]})}function li({workspace:e,selected:t,onSelect:n}){let r=xn(),[o,s]=(0,h.useState)(!1);return(0,g.jsxs)(`li`,{className:`flex flex-col gap-1`,children:[(0,g.jsxs)(`div`,{className:i(`group flex items-center rounded-lg hover:bg-sidebar-accent`,t&&`bg-sidebar-accent`),children:[(0,g.jsxs)(`button`,{type:`button`,"aria-current":t?`true`:void 0,onClick:()=>n(e.id),className:`flex min-w-0 flex-1 flex-col px-2.5 py-1.5 text-left`,children:[(0,g.jsx)(`span`,{className:`truncate text-sm font-medium`,children:e.name}),(0,g.jsx)(`span`,{className:`truncate text-xs text-muted-foreground`,title:Qr(e.location),children:Nr(e.location.path)}),(0,g.jsx)(ni,{workspace:e}),e.pathProblem&&(0,g.jsx)(ti,{problem:e.pathProblem})]}),!o&&(0,g.jsx)(a,{size:`icon-xs`,variant:`ghost`,"aria-label":`Remove ${e.name}`,title:`Remove the workspace and its tasks from Toodo`,className:`mr-1 shrink-0 opacity-0 group-hover:opacity-100 hover:text-destructive focus-visible:opacity-100 [@media(hover:none)]:opacity-100`,onClick:()=>{r.reset(),s(!0)},children:(0,g.jsx)(lt,{})})]}),o&&(0,g.jsxs)(`div`,{role:`group`,"aria-label":`Remove ${e.name}`,className:`flex flex-col gap-1.5 rounded-lg border p-2`,onKeyDown:e=>{e.key===`Escape`&&!r.isPending&&(e.preventDefault(),s(!1))},children:[(0,g.jsxs)(`p`,{className:`text-xs text-muted-foreground`,children:[`Remove `,e.name,` and its tasks from Toodo? The repository, worktrees, and herdr workspaces are kept.`]}),r.isError&&(0,g.jsx)(`p`,{role:`alert`,className:`text-xs text-destructive`,children:r.error.message}),(0,g.jsxs)(`div`,{className:`flex gap-1`,children:[(0,g.jsx)(a,{changesData:!0,size:`xs`,variant:`destructive`,"aria-label":`Confirm remove ${e.name}`,disabled:r.isPending,onClick:()=>r.mutate(e.id),children:r.isPending?`Removing...`:`Remove`}),(0,g.jsx)(a,{size:`xs`,variant:`ghost`,autoFocus:!0,onClick:()=>s(!1),children:`Back`})]})]})]})}function ui(e,t=!1){return n=>{n.key===`Escape`&&!t&&!n.defaultPrevented&&(n.preventDefault(),e())}}function di({workspace:e,onClose:t}){let n=_n(),r=un(),i=mn(),[o,s]=(0,h.useState)(ri(e.location)),[c,l]=(0,h.useState)(e.location.path),u=[...new Set([...(r.data??[]).map(e=>e.target),...(i.data??[]).flatMap(e=>e.location.kind===`ssh`?[e.location.machine]:[])])],d=Dr(c.trim());function f(r){r.preventDefault();let i=o===null?{kind:`local`,path:d}:{kind:`ssh`,machine:o,path:d};n.mutate({id:e.id,location:i},{onSuccess:t})}return(0,g.jsxs)(`form`,{onSubmit:f,"aria-label":`Move ${e.name}`,className:`flex flex-col gap-2 rounded-lg border p-2`,onKeyDown:ui(t,n.isPending),children:[(0,g.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Point the workspace at the same repository on another machine or in another folder. Its tasks stay. A repository on a Windows host takes a Windows path such as D:\\dev\\repo.`}),(0,g.jsx)($,{label:`Machine`,children:({id:e})=>(0,g.jsxs)(`select`,{id:e,className:Xr,value:o??``,onChange:e=>s(e.target.value===``?null:e.target.value),autoFocus:!0,children:[(0,g.jsx)(`option`,{value:``,children:`Local (this server)`}),u.map(e=>(0,g.jsx)(`option`,{value:e,children:e},e))]})}),(0,g.jsx)($,{label:`Folder`,help:`The repository's own folder on that machine.`,children:({id:e,describedBy:t})=>(0,g.jsx)(kr,{id:e,machine:o===null?{kind:`local`}:{kind:`ssh`,label:o},className:Xr,describedBy:t,value:c,onChange:l,required:!0})}),n.isError&&(0,g.jsx)(`p`,{role:`alert`,className:`text-xs break-words text-destructive`,children:n.error.message}),(0,g.jsxs)(`div`,{className:`flex gap-1`,children:[(0,g.jsx)(a,{type:`submit`,size:`sm`,disabled:n.isPending||d===``,children:n.isPending?`Moving...`:`Move workspace`}),(0,g.jsx)(a,{type:`button`,size:`sm`,variant:`ghost`,disabled:n.isPending,onClick:t,children:`Cancel`})]})]})}var fi=`herdr machine add <host>`;function pi({herdrMissing:e,onClose:t}){let[n,r]=(0,h.useState)(null);async function i(){try{await navigator.clipboard.writeText(fi),r(`Copied the command.`)}catch(e){r(`Could not copy: ${String(e)}`)}}return(0,g.jsxs)(`section`,{"aria-label":`Add machine`,className:`flex flex-col gap-2 rounded-lg border p-2`,onKeyDown:ui(t),children:[(0,g.jsxs)(`p`,{className:`text-xs text-muted-foreground`,children:[e&&`Install herdr on the server first; SSH machines need it. `,`herdr asks questions in a terminal, which the Toodo server cannot open. Run this command in a terminal on the server, replacing `,(0,g.jsx)(`code`,{children:`<host>`}),` with an SSH host from its ~/.ssh/config, then reload the machine list here.`]}),(0,g.jsxs)(`div`,{className:`flex flex-col items-start gap-1`,children:[(0,g.jsx)(`code`,{className:`max-w-full rounded bg-muted px-1.5 py-1 text-xs`,"aria-label":`Add machine command`,children:fi}),(0,g.jsx)(a,{type:`button`,size:`sm`,variant:`outline`,onClick:()=>void i(),children:`Copy command`})]}),n&&(0,g.jsx)(`p`,{role:`status`,className:`text-xs text-muted-foreground`,children:n})]})}var mi=[`Source`,`Completion`,`Runner`,`Details`],hi={none:`A folder without git. Tasks get no branch, worktree, or pull request.`,local_git:`A git repository without GitHub. Task branches merge locally.`,github:`A git repository with a GitHub origin. Tasks ship as pull requests.`},gi={open:`The folder already holds the repository.`,init:`Make a folder a new git repository without a remote.`,clone:`Clone a repository URL into a new folder.`},_i={manual:`When its criteria are met; nothing is merged.`,local_merge:`Once its branch is merged into the base branch locally.`,pr_merge:`Once its pull request is merged into the base branch.`},vi={herdr:`Opens agents in herdr on a worktree and branch of the task.`,plain:`Runs Claude or Codex on this server in a worktree and branch of the task, without herdr.`,none:`Only marks the task in progress.`};function yi(e){return e?`herdr is not running on this server; start it there before starting tasks, or choose ${Q.plain}.`:`herdr is not running on this server since it is not installed there; install and start herdr before starting tasks, or choose ${Q.plain}.`}var bi={clone:{submit:`Clone workspace`,pending:`Cloning...`},open:{submit:`Open workspace`,pending:`Opening...`},init:{submit:`Init workspace`,pending:`Initializing...`},none:{submit:`Add workspace`,pending:`Adding...`}};function xi({legend:e,value:t,choices:n,onChange:r,autoFocus:a=!1}){let o=(0,h.useId)();return(0,g.jsxs)(`fieldset`,{className:`flex min-w-0 flex-col gap-1.5`,children:[(0,g.jsx)(`legend`,{className:`mb-1.5 text-sm font-medium`,children:e}),n.map(e=>{let n=e.value===t,s=e.problem!==null,c=s?null:e.note??null,l=`${o}-${e.value}`;return(0,g.jsxs)(`label`,{className:i(`flex items-start gap-2.5 rounded-lg border px-3 py-2 transition-colors has-focus-visible:border-ring has-focus-visible:ring-3 has-focus-visible:ring-ring/50`,s?`cursor-not-allowed border-dashed`:`cursor-pointer hover:bg-muted`,n&&`border-ring bg-secondary hover:bg-secondary`),children:[(0,g.jsx)(`input`,{type:`radio`,name:o,value:e.value,checked:n,disabled:s,autoFocus:a&&n,"aria-labelledby":l,"aria-describedby":c===null?`${l}-about`:`${l}-about ${l}-note`,onChange:()=>!s&&r(e.value),className:`mt-0.5 size-4 shrink-0 accent-primary`}),(0,g.jsxs)(`span`,{className:`flex min-w-0 flex-col gap-0.5`,children:[(0,g.jsx)(`span`,{id:l,className:i(`text-sm font-medium`,s&&`text-muted-foreground`),children:e.label}),(0,g.jsxs)(`span`,{id:`${l}-about`,className:`flex items-start gap-1 text-xs text-muted-foreground`,children:[s&&(0,g.jsx)(Ye,{"aria-hidden":!0,className:`mt-0.5 size-3 shrink-0`}),e.problem??e.description]}),c!==null&&(0,g.jsxs)(`span`,{id:`${l}-note`,className:i(`flex items-start gap-1 text-xs`,hr.attention),children:[(0,g.jsx)(st,{"aria-hidden":!0,className:`mt-0.5 size-3 shrink-0`}),c]})]})]},e.value)})]})}function Si({machine:e,onCreated:t,onClose:n}){let r=hn(),o=(0,h.useRef)(null),s=(0,h.useId)(),[c,l]=(0,h.useState)(0),[u,d]=(0,h.useState)({source:`github`,repository:null,completion:null,runner:null}),[f,p]=(0,h.useState)(``),[m,_]=(0,h.useState)(null),[v,y]=(0,h.useState)(null),[b,x]=(0,h.useState)(``),S=e??`Local`,C=e===null?{kind:`local`}:{kind:`ssh`,label:e},w=Tn().data?.herdr,T=e===null&&w!==void 0&&!w.running?yi(w.installed):null,E=T!==null,D=Jr(u,E),O=D.repository===`clone`,k=fn(C).data,ee=k===void 0?``:O?k:ai(k),A=m??ee,j=!O&&m===null,M=v??(O?si(f):j?``:oi(A)),N=O&&A.trim()&&M.trim()?Er(A.trim(),M.trim()):Dr(A.trim()),P=c===mi.length-1,F=r.isPending,te=bi[D.repository??`none`],ne=[Rr[D.source],zr[D.completion],Q[D.runner],S],re=O?void 0:D.source===`none`?`The folder the tasks are about. Toodo runs no git or herdr there.`:`The repository's own folder.`;function I(e){let t=Yr(u,e,E);Jr(t,E).repository===`clone`!==O&&_(null),d(t)}function L(e){l(e)}function R(){F||n()}function ie(n){if(n.preventDefault(),!P){L(c+1);return}let i={name:M,location:e===null?{kind:`local`,path:N}:{kind:`ssh`,machine:e,path:N},repository:D.repository===null?null:D.repository===`clone`?{kind:`clone`,url:f}:{kind:D.repository},source:D.source,completion:D.completion,runner:D.runner,defaultBaseBranch:D.source===`none`?null:b.trim()||null};r.mutate(i,{onSuccess:t})}return(0,g.jsxs)(`div`,{className:`fixed inset-0 z-50`,children:[(0,g.jsx)(`div`,{"aria-hidden":!0,className:`absolute inset-0 bg-black/40 max-md:hidden`,onClick:R}),(0,g.jsx)(`div`,{ref:o,role:`dialog`,"aria-modal":!0,"aria-labelledby":s,onKeyDown:e=>{e.key===`Tab`?Ar(o.current,e.nativeEvent):ui(n,F)(e)},className:i(`relative flex flex-col overflow-hidden bg-background text-foreground`,`max-md:h-full max-md:pt-[env(safe-area-inset-top)] max-md:pb-[env(safe-area-inset-bottom)]`,`md:absolute md:top-1/2 md:left-1/2 md:h-[min(40rem,calc(100dvh-4rem))] md:w-[min(36rem,calc(100vw-4rem))] md:-translate-x-1/2 md:-translate-y-1/2 md:rounded-2xl md:border md:shadow-xl`),children:(0,g.jsxs)(`form`,{onSubmit:ie,className:`flex min-h-0 flex-1 flex-col`,children:[(0,g.jsxs)(`div`,{className:`flex shrink-0 items-center gap-2 px-4 pt-3 pb-2 md:px-6 md:pt-4`,children:[(0,g.jsxs)(`h2`,{id:s,className:`min-w-0 flex-1 truncate text-base font-semibold`,children:[`New workspace on `,S]}),(0,g.jsx)(a,{type:`button`,variant:`ghost`,size:`icon-sm`,"aria-label":`Close new workspace`,title:`Close (Esc)`,disabled:F,onClick:R,children:(0,g.jsx)(lt,{})})]}),(0,g.jsx)(`ol`,{"aria-label":`Steps`,className:`grid shrink-0 grid-cols-2 gap-1 px-4 pb-3 md:grid-cols-4 md:px-6`,children:mi.map((e,t)=>{let n=t===c;return(0,g.jsx)(`li`,{className:`min-w-0`,children:(0,g.jsxs)(`button`,{type:`button`,"aria-current":n?`step`:void 0,disabled:F,onClick:()=>L(t),className:i(`flex w-full min-w-0 items-center gap-2 rounded-lg px-2 py-1.5 text-left outline-none hover:bg-muted focus-visible:ring-3 focus-visible:ring-ring/50 disabled:pointer-events-none`,n&&`bg-secondary hover:bg-secondary`),children:[(0,g.jsx)(`span`,{"aria-hidden":!0,className:i(`flex size-5 shrink-0 items-center justify-center rounded-full border text-xs font-medium`,n?`border-primary bg-primary text-primary-foreground`:`text-muted-foreground`),children:t+1}),(0,g.jsxs)(`span`,{className:`flex min-w-0 flex-col`,children:[(0,g.jsx)(`span`,{className:`text-xs font-medium`,children:e}),(0,g.jsx)(`span`,{className:`truncate text-xs text-muted-foreground`,children:ne[t]})]})]})},e)})}),(0,g.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col gap-4 overflow-y-auto overscroll-contain border-t px-4 py-4 md:px-6`,children:[c===0&&(0,g.jsxs)(g.Fragment,{children:[(0,g.jsx)(xi,{legend:`What does the workspace folder hold?`,value:D.source,autoFocus:!0,choices:Pr.map(e=>({value:e,label:Rr[e],description:hi[e],problem:null})),onChange:e=>I({source:e})}),D.source!==`none`&&(0,g.jsx)(xi,{legend:`How does the repository get there?`,value:D.repository,choices:Lr.map(e=>({value:e,label:Br[e],description:gi[e],problem:qr(D.source,e)})),onChange:e=>I({repository:e})})]}),c===1&&(0,g.jsx)(xi,{legend:`When is a task done?`,value:D.completion,autoFocus:!0,choices:Fr.map(e=>({value:e,label:zr[e],description:_i[e],problem:Wr(D.source,e)})),onChange:e=>I({completion:e})}),c===2&&(0,g.jsx)(xi,{legend:`What does starting a task do?`,value:D.runner,autoFocus:!0,choices:Ir.map(t=>({value:t,label:Q[t],description:vi[t],note:t===`herdr`?T:null,problem:Kr(t,e===null?`local`:`ssh`)??Gr(D.source,D.completion,t)})),onChange:e=>I({runner:e})}),P&&(0,g.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[O&&(0,g.jsx)($,{label:`Repository URL`,children:({id:e})=>(0,g.jsx)(`input`,{id:e,className:`h-8 w-full min-w-0 rounded-lg border border-input bg-background px-2.5 text-sm outline-none max-md:h-11 focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50`,value:f,onChange:e=>p(e.target.value),required:!0,autoFocus:!0})}),(0,g.jsx)($,{label:O?`Parent folder`:`Folder`,help:re,children:({id:e,describedBy:t})=>(0,g.jsx)(kr,{id:e,machine:C,className:`h-8 w-full min-w-0 rounded-lg border border-input bg-background px-2.5 text-sm outline-none max-md:h-11 focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50`,describedBy:t,value:A,onChange:_,required:!0,autoFocus:!O})}),(0,g.jsx)($,{label:`Name`,children:({id:e})=>(0,g.jsx)(`input`,{id:e,className:`h-8 w-full min-w-0 rounded-lg border border-input bg-background px-2.5 text-sm outline-none max-md:h-11 focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50`,value:M,onChange:e=>y(e.target.value),required:!0})}),O&&A.trim()&&M.trim()&&(0,g.jsxs)(`p`,{className:`truncate text-xs text-muted-foreground`,title:N,children:[`Clones into `,N]}),D.repository===`init`&&(0,g.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`The folder is created if it does not exist and becomes a git repository without a remote.`}),D.source!==`none`&&(0,g.jsx)($,{label:`Base branch`,help:D.repository===`init`?`Uses main if empty.`:`Detected from the repository if empty.`,children:({id:e,describedBy:t})=>(0,g.jsx)(`input`,{id:e,className:`h-8 w-full min-w-0 rounded-lg border border-input bg-background px-2.5 text-sm outline-none max-md:h-11 focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50`,"aria-describedby":t,value:b,onChange:e=>x(e.target.value)})}),r.isError&&(0,g.jsx)(`p`,{role:`alert`,className:`text-xs break-words text-destructive`,children:r.error.message})]})]}),(0,g.jsxs)(`div`,{className:`flex shrink-0 items-center gap-2 border-t px-4 py-3 md:px-6`,children:[c===0?(0,g.jsx)(a,{type:`button`,variant:`ghost`,disabled:F,onClick:R,children:`Cancel`}):(0,g.jsxs)(a,{type:`button`,variant:`ghost`,disabled:F,onClick:()=>L(c-1),children:[(0,g.jsx)($e,{"data-icon":`inline-start`}),`Back`]}),(0,g.jsx)(a,{type:`submit`,className:`ml-auto`,changesData:P,disabled:F||P&&j,children:P?F?te.pending:te.submit:(0,g.jsxs)(g.Fragment,{children:[`Next`,(0,g.jsx)(Ze,{"data-icon":`inline-end`})]})})]})]})})]})}export{Un as $,z as $t,En as A,It as At,bn as B,W as Bt,_r as C,Zn as Ct,Y as D,mn as Dt,pn as E,vn as Et,$n as F,Tt as Ft,sn as G,Ze as Gt,dr as H,st as Ht,Pn as I,Et as It,wn as J,Ne as Jt,Nn as K,H as Kt,Wn as L,wt as Lt,nn as M,Ot as Mt,yn as N,zt as Nt,nr as O,Rt as Ot,er as P,Bt as Pt,tn as Q,de as Qt,Yn as R,Ct as Rt,hr as S,Sn as St,ur as T,ln as Tt,tr as U,rt as Ut,lr as V,lt as Vt,cn as W,$e as Wt,kn as X,me as Xt,cr as Y,Ce as Yt,en as Z,B as Zt,mr as _,jn as _t,Qr as a,w as an,sr as at,gr as b,ir as bt,$r as c,ae as cn,Xn as ct,Ar as d,Tn as dt,T as en,Mn as et,xr as f,an as ft,fr as g,Bn as gt,pr as h,Jn as ht,Zr as i,k as in,rr as it,rn as j,Ht as jt,or as k,Lt as kt,Mr as l,y as ln,Cn as lt,Sr as m,Kn as mt,ti as n,A as nn,Dn as nt,ui as o,M as on,qn as ot,Cr as p,An as pt,On as q,V as qt,ci as r,ee as rn,Hn as rt,Xr as s,O as sn,on as st,di as t,j as tn,Qn as tt,Nr as u,v as un,zn as ut,yr as v,Vn as vt,$t as w,gn as wt,vr as x,Rn as xt,br as y,Fn as yt,Gn as z,Dt as zt};
|
package/web/index.html
CHANGED
|
@@ -5,13 +5,13 @@
|
|
|
5
5
|
<link rel="icon" type="image/svg+xml" href="/favicon.svg" />
|
|
6
6
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
7
7
|
<title>Toodo</title>
|
|
8
|
-
<script type="module" crossorigin src="/assets/index-
|
|
8
|
+
<script type="module" crossorigin src="/assets/index-6KPsebod.js"></script>
|
|
9
9
|
<link rel="modulepreload" crossorigin href="/assets/dist-ZmB2kPfR.js">
|
|
10
10
|
<link rel="modulepreload" crossorigin href="/assets/connection-BFaD-ecb.js">
|
|
11
11
|
<link rel="modulepreload" crossorigin href="/assets/button-Dghi8qWf.js">
|
|
12
12
|
<link rel="modulepreload" crossorigin href="/assets/event-BTxkSTih.js">
|
|
13
|
-
<link rel="modulepreload" crossorigin href="/assets/workspace-list-
|
|
14
|
-
<link rel="stylesheet" crossorigin href="/assets/index-
|
|
13
|
+
<link rel="modulepreload" crossorigin href="/assets/workspace-list-S6px6B3H.js">
|
|
14
|
+
<link rel="stylesheet" crossorigin href="/assets/index-BAWKg-X2.css">
|
|
15
15
|
<link rel="manifest" href="/manifest.webmanifest" crossorigin="use-credentials">
|
|
16
16
|
<link rel="apple-touch-icon" href="/pwa/apple-touch-icon.png">
|
|
17
17
|
<meta name="theme-color" content="#ffffff" media="(prefers-color-scheme: light)">
|
package/web/sw.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// Generated by vite-pwa.ts for this build.
|
|
2
|
-
const CACHE = "toodo-shell-
|
|
3
|
-
const SHELL = ["/","/assets/button-Dghi8qWf.js","/assets/connection-BFaD-ecb.js","/assets/dist-ZmB2kPfR.js","/assets/event-BTxkSTih.js","/assets/geist-cyrillic-ext-wght-normal-DjL33-gN.woff2","/assets/geist-cyrillic-wght-normal-BEAKL7Jp.woff2","/assets/geist-latin-ext-wght-normal-DC-KSUi6.woff2","/assets/geist-latin-wght-normal-BgDaEnEv.woff2","/assets/geist-vietnamese-wght-normal-6IgcOCM7.woff2","/assets/index-
|
|
2
|
+
const CACHE = "toodo-shell-dba77a7122856660";
|
|
3
|
+
const SHELL = ["/","/assets/button-Dghi8qWf.js","/assets/connection-BFaD-ecb.js","/assets/dist-ZmB2kPfR.js","/assets/event-BTxkSTih.js","/assets/geist-cyrillic-ext-wght-normal-DjL33-gN.woff2","/assets/geist-cyrillic-wght-normal-BEAKL7Jp.woff2","/assets/geist-latin-ext-wght-normal-DC-KSUi6.woff2","/assets/geist-latin-wght-normal-BgDaEnEv.woff2","/assets/geist-vietnamese-wght-normal-6IgcOCM7.woff2","/assets/index-6KPsebod.js","/assets/index-BAWKg-X2.css","/assets/markdown-BssgDUKq.js","/assets/offline-screen-CnvrTPjs.js","/assets/server-access-B1JK1Ia2.js","/assets/task-graph-DLioOiRN.css","/assets/task-graph-DijZe0VW.js","/assets/workspace-list-S6px6B3H.js","/favicon.svg","/manifest.webmanifest","/pwa/apple-touch-icon.png","/pwa/icon-192.png","/pwa/icon-512.png","/pwa/icon-maskable-192.png","/pwa/icon-maskable-512.png"];
|
|
4
4
|
const SERVER_PATHS = ["/api","/mcp"];
|
|
5
5
|
const NOTIFICATION_ICON = "/pwa/icon-192.png";
|
|
6
6
|
// The message that asks an open page to show a task; see listenForOpenTask in src/web/push.ts.
|