@dubusoft/toodo-linux-arm64 1.11.1-dev.148 → 1.11.1-dev.171
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/{Item-DfC-q_yT.js → Item-izP5iM04.js} +2 -2
- package/web/assets/{ItemSwipeLayer-WriZ2CU4.js → ItemSwipeLayer-Cx3xSy-7.js} +1 -1
- package/web/assets/{MenuBottomSheet-DmVNhQxY.js → MenuBottomSheet-D_F_gf37.js} +1 -1
- package/web/assets/{MenuBottomSheetActionList-DImfpegT.js → MenuBottomSheetActionList-BkRVHUVr.js} +1 -1
- package/web/assets/{Selector-DTDPVjfP.js → Selector-T7AfpHA_.js} +2 -2
- package/web/assets/{details-sheet-DnIAeRgq.js → details-sheet-CXWwTcD1.js} +1 -1
- package/web/assets/event-CB2iK3mK.js +7 -0
- package/web/assets/{index-BMxRmcAM.js → index-BL3A2wYQ.js} +6 -6
- package/web/assets/{markdown-_yZA92rI.js → markdown-DTgqfERC.js} +1 -1
- package/web/assets/{offline-screen-B6xGhyLC.js → offline-screen-B0dlPP7R.js} +1 -1
- package/web/assets/queries-xlRD-NfR.js +1 -0
- package/web/assets/review-WzGExUGK.js +1 -0
- package/web/assets/{server-access-C8jXFU-5.js → server-access-BDe42KSD.js} +1 -1
- package/web/assets/{task-details-C_UlkLMU.js → task-details-Beyi9AGA.js} +2 -2
- package/web/assets/task-graph-BBDMJweU.js +8 -0
- package/web/index.html +6 -6
- package/web/sw.js +2 -2
- package/web/version.json +1 -1
- package/web/assets/event-AVe5c5qy.js +0 -7
- package/web/assets/queries-DRMbWdSl.js +0 -1
- package/web/assets/review-CwgNdF7A.js +0 -1
- package/web/assets/task-graph-Bst1HGUQ.js +0 -8
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a as e,n as t,t as n}from"./jsx-runtime-D3jfb0Ew.js";import{c as r,g as i,i as a,l as o,o as s,t as c}from"./session-sBDFnC3r.js";import{n as l}from"./event-AVe5c5qy.js";var u=e(t(),1),d=n(),f=u.createContext(void 0),p=e=>{let t=u.useContext(f);if(e)return e;if(!t)throw Error(`No QueryClient set, use QueryClientProvider to set one`);return t},m=({client:e,children:t})=>(u.useEffect(()=>(e.mount(),()=>{e.unmount()}),[e]),(0,d.jsx)(f.Provider,{value:e,children:t})),h={setTimeout:(e,t)=>setTimeout(e,t),clearTimeout:e=>clearTimeout(e),setInterval:(e,t)=>setInterval(e,t),clearInterval:e=>clearInterval(e)},g=new class{#e=h;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 _(e){setTimeout(e,0)}var v=typeof window>`u`||`Deno`in globalThis;function y(){}function b(e,t){return typeof e==`function`?e(t):e}function ee(e){return typeof e==`number`&&e>=0&&e!==1/0}function te(e,t){return Math.max(e+(t||0)-Date.now(),0)}function x(e,t){return typeof e==`function`?e(t):e}function ne(e,t){let{type:n=`all`,exact:r,fetchStatus:i,predicate:a,queryKey:o,stale:s}=e;if(o){if(r){if(t.queryHash!==ie(o,t.options))return!1}else if(!C(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 re(e,t){let{exact:n,status:r,predicate:i,mutationKey:a}=e;if(a){if(!t.options.mutationKey)return!1;if(n){if(S(t.options.mutationKey)!==S(a))return!1}else if(!C(t.options.mutationKey,a))return!1}return!(r&&t.state.status!==r||i&&!i(t))}function ie(e,t){return(t?.queryKeyHashFn||S)(e)}function S(e){return JSON.stringify(e,(e,t)=>T(t)?Object.keys(t).sort().reduce((e,n)=>(e[n]=t[n],e),{}):t)}function C(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(!C(e[n],t[n]))return!1;return!0}let n=Object.keys(t);for(let r of n)if(!C(e[r],t[r]))return!1;return!0}return!1}var ae=Object.prototype.hasOwnProperty;function oe(e,t,n=0){if(e===t)return e;if(n>500)return t;let r=se(e)&&se(t);if(!r&&!(T(e)&&T(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:ae.call(e,o))&&c++;continue}if(u===null||d===null||typeof u!=`object`||typeof d!=`object`){s[o]=d;continue}let f=oe(u,d,n+1);s[o]=f,f===u&&c++}return i===o&&c===i?e:s}function w(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 se(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function T(e){if(!ce(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!(!ce(r)||!r.hasOwnProperty(`isPrototypeOf`)||t!==Object.prototype)}function ce(e){return Object.prototype.toString.call(e)===`[object Object]`}function le(e){return new Promise(t=>{g.setTimeout(t,e)})}function ue(e,t,n){return typeof n.structuralSharing==`function`?n.structuralSharing(e,t):n.structuralSharing===!1?t:oe(e,t)}function de(e,t,n=0){let r=[...e,t];return n&&r.length>n?r.slice(1):r}function fe(e,t,n=0){let r=[t,...e];return n&&r.length>n?r.slice(0,-1):r}var pe=Symbol();function me(e,t){return!e.queryFn&&t?.initialPromise?()=>t.initialPromise:!e.queryFn||e.queryFn===pe?()=>Promise.reject(Error(`Missing queryFn: '${e.queryHash}'`)):e.queryFn}function E(e,t){return typeof e==`function`?e(...t):!!e}function he(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 ge=()=>v,D=()=>ge(),O=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(){}},k=new class extends O{#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`}},_e=_;function ve(){let e=[],t=0,n=e=>{e()},r=e=>{e()},i=_e,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 A=ve(),j=new class extends O{#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 ye(e){return Math.min(1e3*2**e,3e4)}function be(e){return(e??`online`)!==`online`||j.isOnline()}var M=class extends Error{constructor(e){super(`CancelledError`),this.revert=e?.revert,this.silent=e?.silent}};function xe(e){let t=!1,n=0,r,i=`pending`,a,o,s=new Promise((e,t)=>{a=e,o=t});s.catch(y);let c=()=>i!==`pending`,l=t=>{if(!c()){let n=new M(t);h(n),e.onCancel?.(n)}},u=()=>{t=!0},d=()=>{t=!1},f=()=>k.isFocused()&&(e.networkMode===`always`||j.isOnline())&&e.canRun(),p=()=>be(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??(D()?0:3),a=e.retryDelay??ye,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),le(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 Se=class{#e;destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),ee(this.gcTime)&&(this.#e=g.setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(e){this.gcTime=Math.max(this.gcTime||0,e??(D()?1/0:3e5))}clearGcTimeout(){this.#e!==void 0&&(g.clearTimeout(this.#e),this.#e=void 0)}};function Ce(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=>{he(e,()=>t.signal,()=>n=!0)},u=me(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?fe:de;return{pages:c(e.pages,o,s),pageParams:c(e.pageParams,r,s)}};if(i&&a.length){let e=i===`backward`,t=e?we:N,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:N(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 N(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 we(e,{pages:t,pageParams:n}){return t.length>0?e.getPreviousPageParam?.(t[0],t,n[0],n):void 0}function Te(e,t){return t?N(e,t)!=null:!1}function Ee(e,t){return!t||!e.getPreviousPageParam?!1:we(e,t)!=null}var De=class extends Se{#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=Ae(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=Ae(this.options);e.data!==void 0&&(this.setState(ke(e.data,e.dataUpdatedAt)),this.#t=e)}}optionalRemove(){!this.observers.length&&this.state.fetchStatus===`idle`&&this.#r.remove(this)}setData(e,t){let n=ue(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(y).catch(y):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=>x(e.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===pe||!this.isFetched()}isFetched(){return this.state.dataUpdateCount+this.state.errorUpdateCount>0}isStatic(){return this.getObserversCount()>0&&this.observers.some(e=>x(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:!te(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=me(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`?Ce(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=xe({initialPromise:t?.initialPromise,fn:a.fetchFn,onCancel:e=>{e instanceof M&&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 M){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,...Oe(t.data,this.options),fetchMeta:e.meta??null};case`success`:let n={...t,...ke(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),A.batch(()=>{this.observers.slice().forEach(e=>{e.onQueryUpdate()}),this.#r.notify({query:this,type:`updated`,action:e})})}};function Oe(e,t){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:be(t.networkMode)?`fetching`:`paused`,...e===void 0&&{error:null,status:`pending`}}}function ke(e,t){return{data:e,dataUpdatedAt:t??Date.now(),error:null,isInvalidated:!1,status:`success`}}function Ae(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 je=class extends O{#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),Ne(this.#t,this.options)?this.#m():this.updateResult(),this.#y())}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return P(this.#t,this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return P(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 x(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&&!w(this.options,t)&&this.#e.getQueryCache().notify({type:`observerOptionsUpdated`,query:this.#t,observer:this});let r=this.hasListeners();r&&Pe(this.#t,n,this.options,t)&&this.#m(),this.updateResult(),r&&(this.#t!==n||x(this.options.enabled,this.#t)!==x(t.enabled,this.#t)||x(this.options.staleTime,this.#t)!==x(t.staleTime,this.#t))&&this.#g();let i=this.#_();r&&(this.#t!==n||x(this.options.enabled,this.#t)!==x(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 w(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(y)),t}#h(e){return!D()&&x(this.options.enabled,this.#t)!==!1&&ee(e)}#g(){this.#b();let e=x(this.options.staleTime,this.#t);if(this.#r.isStale||!this.#h(e))return;let t=te(this.#r.dataUpdatedAt,e)+1;this.#u=g.setTimeout(()=>{this.#r.isStale||this.updateResult()},t)}#_(){return x(this.options.refetchInterval,this.#t)??!1}#v(e){this.#x(),this.#f=e,this.#f!==0&&this.#h(this.#f)&&(this.#d=g.setInterval(()=>{(this.options.refetchIntervalInBackground||k.isFocused())&&this.#m()},this.#f))}#y(){this.#g(),this.#v(this.#_())}#b(){this.#u!==void 0&&(g.clearTimeout(this.#u),this.#u=void 0)}#x(){this.#d!==void 0&&(g.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&&Ne(e,t),o=i&&Pe(e,n,t,r);(a||o)&&(l={...l,...Oe(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=ue(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=ue(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:F(e,t),refetch:this.refetch,isEnabled:x(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),w(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)})})();A.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 Me(e,t){return x(t.enabled,e)!==!1&&e.state.data===void 0&&(e.state.status!==`error`||x(t.retryOnMount,e)!==!1)}function Ne(e,t){return Me(e,t)||e.state.data!==void 0&&P(e,t,t.refetchOnMount)}function P(e,t,n){if(x(t.enabled,e)!==!1&&x(t.staleTime,e)!==`static`){let r=x(n,e);return r===`always`||r!==!1&&F(e,t)}return!1}function Pe(e,t,n,r){return(e!==t||x(r.enabled,e)===!1)&&(!n.suspense||e.state.status!==`error`)&&F(e,n)}function F(e,t){return x(t.enabled,e)!==!1&&e.isStaleByTime(x(t.staleTime,e))}var Fe=class extends je{constructor(e,t){super(e,t)}bindMethods(){super.bindMethods(),this.fetchNextPage=this.fetchNextPage.bind(this),this.fetchPreviousPage=this.fetchPreviousPage.bind(this)}setOptions(e){e._type=`infinite`,super.setOptions(e)}getOptimisticResult(e){return e._type=`infinite`,super.getOptimisticResult(e)}fetchNextPage(e){return this.fetch({...e,meta:{fetchMore:{direction:`forward`}}})}fetchPreviousPage(e){return this.fetch({...e,meta:{fetchMore:{direction:`backward`}}})}createResult(e,t){let{state:n}=e,r=super.createResult(e,t),{isFetching:i,isRefetching:a,isError:o,isRefetchError:s}=r,c=n.fetchMeta?.fetchMore?.direction,l=o&&c===`forward`,u=i&&c===`forward`,d=o&&c===`backward`,f=i&&c===`backward`;return{...r,fetchNextPage:this.fetchNextPage,fetchPreviousPage:this.fetchPreviousPage,hasNextPage:Te(t,n.data),hasPreviousPage:Ee(t,n.data),isFetchNextPageError:l,isFetchingNextPage:u,isFetchPreviousPageError:d,isFetchingPreviousPage:f,isRefetchError:s&&!l&&!d,isRefetching:a&&!u&&!f}}},Ie=class extends Se{#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||Le(),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=xe({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),A.batch(()=>{this.#t.forEach(t=>{t.onMutationUpdate(e)}),this.#n.notify({mutation:this,type:`updated`,action:e})})}};function Le(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:`idle`,variables:void 0,submittedAt:0}}var Re=class extends O{#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),w(this.options,t)||this.#e.getMutationCache().notify({type:`observerOptionsUpdated`,mutation:this.#n,observer:this}),t?.mutationKey&&this.options.mutationKey&&S(t.mutationKey)!==S(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??Le();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){A.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)})})}},ze=u.createContext(!1),Be=()=>u.useContext(ze);ze.Provider;function Ve(){let e=!1;return{clearReset:()=>{e=!1},reset:()=>{e=!0},isReset:()=>e}}var He=u.createContext(Ve()),Ue=()=>u.useContext(He),We=(e,t,n)=>{let r=n?.state.error&&typeof e.throwOnError==`function`?E(e.throwOnError,[n.state.error,n]):e.throwOnError;(e.suspense||r)&&(t.isReset()||(e.retryOnMount=!1))},Ge=e=>{u.useEffect(()=>{e.clearReset()},[e])},Ke=({result:e,errorResetBoundary:t,throwOnError:n,query:r,suspense:i})=>e.isError&&!t.isReset()&&!e.isFetching&&r&&(i&&e.data===void 0||E(n,[e.error,r])),qe=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))}},Je=(e,t)=>e?.suspense&&t.isPending,Ye=(e,t,n)=>t.fetchOptimistic(e).catch(()=>{n.clearReset()});function Xe(e,t,n){let r=Be(),i=Ue(),a=p(n),o=a.defaultQueryOptions(e),s=a.getQueryCache().get(o.queryHash),c=e.subscribed!==!1;o._optimisticResults=r?`isRestoring`:c?`optimistic`:void 0,qe(o),We(o,i,s),Ge(i);let[l]=u.useState(()=>new t(a,o)),d=l.getOptimisticResult(o),f=!r&&c;if(u.useSyncExternalStore(u.useCallback(e=>{let t=f?l.subscribe(A.batchCalls(e)):y;return l.updateResult(),t},[l,f]),()=>l.getCurrentResult(),()=>l.getCurrentResult()),u.useEffect(()=>{l.setOptions(o)},[o,l]),Je(o,d))throw Ye(o,l,i);if(Ke({result:d,errorResetBoundary:i,throwOnError:o.throwOnError,query:s,suspense:o.suspense}))throw d.error;return o.notifyOnChangeProps?d:l.trackResult(d)}function I(e,t){return Xe(e,je,t)}function L(e,t){let n=p(t),[r]=u.useState(()=>new Re(n,e));u.useEffect(()=>{r.setOptions(e)},[r,e]);let i=u.useSyncExternalStore(u.useCallback(e=>r.subscribe(A.batchCalls(e)),[r]),()=>r.getCurrentResult(),()=>r.getCurrentResult()),a=u.useCallback((...e)=>{r.mutate(e[0],e[1]).catch(y)},[r]);if(i.error&&E(r.options.throwOnError,[i.error]))throw i.error;return{...i,mutate:a,mutateAsync:i.mutate}}function Ze(e,t){return Xe(e,Fe,t)}var R={planned:`Blocked`,ready:`Ready`,waiting:`Planned`,paused:`Paused`,in_progress:`In progress`,in_review:`Awaiting completion`,done:`Done`,not_adopted:`Not adopted`},Qe=`Planned on`,$e={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`},et={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`},tt={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`},nt={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`},rt={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`},it={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`},at={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`},ot=`border-foreground/70`,st=`text-foreground`,ct=[[`plannedAt`,`Planned`],[`startedAt`,`Started`],[`reviewAt`,R.in_review],[`completedAt`,`Completed`],[`reopenedAt`,`Reopened`],[`pausedAt`,R.paused]];function lt(e){let t=new Date(e*1e3),n=e=>String(e).padStart(2,`0`);return`${t.getFullYear()}-${n(t.getMonth()+1)}-${n(t.getDate())}`}var ut=new Intl.RelativeTimeFormat(`en`,{numeric:`auto`,style:`short`}),dt=604800;function ft(e,t=Date.now()/1e3){let n=e-t,r=Math.abs(n);if(r<60)return`just now`;if(r<dt){let[e,t]=r<3600?[Math.trunc(n/60),`minute`]:r<86400?[Math.trunc(n/3600),`hour`]:[Math.trunc(n/86400),`day`];return ut.format(e,t)}let i=new Date(e*1e3),a=i.getFullYear()===new Date(t*1e3).getFullYear();return i.toLocaleDateString(`en`,{month:`short`,day:`numeric`,...a?{}:{year:`numeric`}})}function pt(e,t=Date.now()/1e3){let n=Math.max(0,Math.floor((e-t)/60));if(n<60)return`${n}m`;if(n<1440)return`${Math.floor(n/30)/2}h`;let r=Math.floor(n/1440);return r<14?`${r}d`:r<60?`${Math.floor(r/7)}w`:r<365?`${Math.floor(r/30)}mo`:`${Math.floor(r/365)}y`}function mt(e){return new Date(e*1e3).toLocaleString(`en`,{dateStyle:`medium`,timeStyle:`short`})}function ht(e){let t=[];for(let n of e){let e=t.at(-1);e!==void 0&&e.end===null&&(e.end=n.at),n.status!==`done`&&(n.status===`planned`?t.length>0&&t.push({state:`paused`,start:n.at,end:null,reason:n.reason}):t.push({state:n.status,start:n.at,end:null,reason:null}))}return t}function gt(e,t){return vt(e,t,e=>e!==`paused`)}function _t(e,t){return vt(e,t,e=>e===`paused`)}function vt(e,t,n){let r=ht(e);return r.length===0?null:r.filter(e=>n(e.state)).reduce((e,n)=>e+Math.max((n.end??t)-n.start,0),0)}function yt(e){return ct.flatMap(([t,n])=>{let r=e[t];return r===null?[]:[{label:n,at:r}]}).sort((e,t)=>e.at-t.at)}function bt({at:e,prefix:t=``,className:n}){return(0,d.jsx)(`time`,{className:n,dateTime:new Date(e*1e3).toISOString(),title:mt(e),children:`${t}${ft(e)}`})}function xt(e){return typeof e==`object`&&!!e&&typeof e.kind==`string`&&typeof e.code==`string`&&typeof e.message==`string`}async function z(e,t={}){let n=a();if(n===null)throw Error(`No access token for the Toodo server.`);let c=await i(`/api/rpc/${encodeURIComponent(e)}`,{method:`POST`,headers:{...n,"Content-Type":`application/json`},body:JSON.stringify(t)});if(c.status===401)throw await o(c)?(s(),Error(`The Toodo server did not accept the access token.`)):r();let l=await c.text();if(c.ok)return l?JSON.parse(l):null;let u=null;try{u=JSON.parse(l)}catch{}throw xt(u)?u:Error(l||`${c.status} ${c.statusText}`)}var B={appInfo:()=>z(`app_info`),checkUpdate:()=>z(`check_update`),listWorkspaces:()=>H(z(`list_workspaces`)),getWorkspace:e=>H(z(`get_workspace`,{id:e})),createWorkspace:e=>H(z(`create_workspace`,{workspace:e})),updateWorkspace:e=>H(z(`update_workspace`,{workspace:e})),deleteWorkspace:e=>H(z(`delete_workspace`,{id:e})),restoreWorkspace:e=>H(z(`restore_workspace`,{id:e})),purgeWorkspace:e=>H(z(`purge_workspace`,{id:e})),listArchive:()=>H(z(`list_archive`)),listGuidelines:e=>H(z(`list_guidelines`,{workspaceId:e})),addGuideline:e=>H(z(`add_guideline`,{guideline:e})),updateGuideline:e=>H(z(`update_guideline`,{guideline:e})),deleteGuideline:e=>H(z(`delete_guideline`,{id:e})),listTasks:e=>H(z(`list_tasks`,{filter:e})),listTaskRelations:()=>H(z(`list_task_relations`)),addTaskRelation:(e,t)=>H(z(`add_task_relation`,{taskId:e,relatedId:t})),removeTaskRelation:(e,t)=>H(z(`remove_task_relation`,{taskId:e,relatedId:t})),getTask:e=>H(z(`get_task`,{id:e})),createTask:e=>H(z(`create_task`,{task:e})),updateTask:e=>H(z(`update_task`,{task:e})),moveTask:(e,t)=>H(z(`move_task`,{id:e,workspaceId:t})),pauseTask:e=>H(z(`pause_task`,{id:e})),waitTask:(e,t,n)=>H(z(`wait_task`,{id:e,until:t,reason:n})),endWait:e=>H(z(`end_wait`,{id:e})),setCompletionNote:(e,t)=>H(z(`set_completion_note`,{id:e,note:t})),reopenTask:(e,t)=>H(z(`reopen_task`,{id:e,reason:t})),setTaskOutcome:(e,t,n)=>H(z(`set_task_outcome`,{id:e,resolution:t,note:n})),checkCriterion:(e,t,n,r)=>H(z(`check_criterion`,{taskId:e,criterionId:t,met:n,evidence:r})),deleteTask:e=>H(z(`delete_task`,{id:e})),deleteDoneTasks:e=>H(z(`delete_done_tasks`,{workspaceId:e})),restoreTask:e=>H(z(`restore_task`,{id:e})),purgeTask:e=>H(z(`purge_task`,{id:e})),addDependency:(e,t,n)=>H(z(`add_dependency`,{taskId:e,dependsOn:t,confirmPause:n})),removeDependency:(e,t)=>H(z(`remove_dependency`,{taskId:e,dependsOn:t})),startTask:(e,t,n)=>H(z(`start_task`,{id:e,reason:t,refs:n})),completeTask:(e,t,n)=>H(z(`complete_task`,{id:e,note:t,refs:n})),concludeTask:(e,t,n,r)=>H(z(`conclude_task`,{id:e,note:t,outcome:n,shippedWith:r})),linkIssue:(e,t)=>H(z(`link_issue`,{id:e,reference:t})),mcpServerInfo:()=>z(`mcp_server_info`),listConnectedApps:()=>H(z(`list_connected_apps`)),revokeConnectedApp:e=>H(z(`revoke_connected_app`,{grantId:e})),reviewPeriod:(e,t)=>H(z(`review_period`,{from:e,to:t})),reviewReport:e=>H(z(`review_report`,{request:e})),getReviewTimeZone:()=>H(z(`get_review_time_zone`)),setReviewTimeZone:e=>H(z(`set_review_time_zone`,{timeZone:e})),saveReviewSnapshot:e=>H(z(`save_review_snapshot`,{request:e})),listReviewSnapshots:()=>H(z(`list_review_snapshots`)),getReviewSnapshot:e=>H(z(`get_review_snapshot`,{id:e})),deleteReviewSnapshot:e=>H(z(`delete_review_snapshot`,{id:e})),getBackupSettings:()=>z(`get_backup_settings`),getBackupStatus:()=>z(`get_backup_status`),saveBackupSettings:e=>H(z(`save_backup_settings`,{settings:e})),listBackups:()=>H(z(`list_backups`)),restoreBackup:e=>H(z(`restore_backup`,{name:e}))},V={tasksChanged:U(`tasks-changed`),workspacesChanged:U(`workspaces-changed`),guidelinesChanged:U(`guidelines-changed`),taskStatusChanged:U(`task-status-changed`),taskReady:U(`task-ready`)};async function H(e){try{return{status:`ok`,data:await e}}catch(e){if(e instanceof Error)throw e;return{status:`error`,error:e}}}function U(e){return{listen:t=>l(e,t)}}function St(e){switch(e.code){case`unknownCommand`:case`invalidArguments`:return`This page is out of date with the Toodo server. Reload the page, then try again.`;case`commandPanicked`:return`Something went wrong on the Toodo server. Try again; if it keeps failing, look for "a command panicked" in the toodo-server log.`;case`guidelineNotFound`:return`This guideline no longer exists; it was deleted elsewhere. Reload the page to see the current guidelines, and add your text as a new guideline if it is still needed.`;case`storageFailed`:return`The Toodo server could not use its database (${e.message}). Try again; if it keeps failing, check the toodo-server log.`;default:return e.message}}function Ct(e,t){return/filename="([^"]+)"/.exec(e.headers.get(`Content-Disposition`)??``)?.[1]??t}function wt(e,t){let n=URL.createObjectURL(t),r=document.createElement(`a`);r.href=n,r.download=e,r.click(),URL.revokeObjectURL(n)}async function Tt(){let e=await c(`/api/backups/export`),t=Ct(e,`toodo-backup.sqlite3`);return wt(t,await e.blob()),t}async function Et(e){return wt(e,await(await c(`/api/backups/${encodeURIComponent(e)}`)).blob()),e}async function Dt(e){return await(await c(`/api/backups/restore`,{method:`POST`,headers:{"Content-Type":`application/octet-stream`},body:e})).json()}var Ot=`toodo-install-dismissed`;function kt(){let{userAgent:e,maxTouchPoints:t}=navigator;return/iPhone|iPad|iPod/.test(e)||e.includes(`Macintosh`)&&t>1}function At(){return matchMedia(`(display-mode: standalone)`).matches||`standalone`in navigator&&navigator.standalone===!0}var W=null,jt=!1,G=new Set;function K(){G.forEach(e=>e())}function Mt(e){return G.add(e),()=>G.delete(e)}function Nt(){return jt||At()||localStorage.getItem(Ot)!==null?`none`:W===null?kt()?`home-screen`:`none`:`prompt`}function Pt(){localStorage.setItem(Ot,`1`),K()}async function Ft(){let e=W;if(e===null)return;W=null,await e.prompt();let{outcome:t}=await e.userChoice;t===`dismissed`?Pt():K()}function It(){addEventListener(`beforeinstallprompt`,e=>{e.preventDefault(),W=e,K()}),addEventListener(`appinstalled`,()=>{W=null,jt=!0,K()})}function Lt(){return`serviceWorker`in navigator&&`PushManager`in window&&`Notification`in window?`supported`:kt()&&!At()?`needs-install`:`unsupported`}var q=null,Rt={agent:[],pullRequests:[],completion:[`Task awaiting completion`]};function zt(e){return q!==null&&Object.keys(Rt).some(t=>q?.[t]===!0&&Rt[t].includes(e))}function Bt(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 Vt(e,t){let n=e.options.applicationServerKey;return n===null||n.byteLength===t.length&&new Uint8Array(n).every((e,n)=>e===t[n])}function J(){return navigator.serviceWorker.getRegistration()}async function Ht(e){let t=await(await J())?.pushManager.getSubscription()??null;return t===null||Vt(t,e)?t:(await t.unsubscribe(),null)}async function Ut(e){return await(await c(`/api/push/subscription`,{method:`PUT`,headers:{"Content-Type":`application/json`},body:JSON.stringify(e.toJSON())})).json()}async function Wt(){let e=await(await c(`/api/push`)).json(),t=await Ht(Bt(e.publicKey)),n=t===null?null:t.endpoint===e.subscription?.endpoint?e.subscription:await Ut(t);return q=n?.settings??null,{publicKey:e.publicKey,permission:Notification.permission,subscription:n}}async function Gt(e,t){if(await e!==`granted`)throw Error(`Notifications were not allowed.`);if(await J()===void 0)throw Error(`Notifications need the service worker, which only the built app installs.`);let{pushManager:n}=await navigator.serviceWorker.ready,r=Bt(t),i=await Ht(r)??await n.subscribe({userVisibleOnly:!0,applicationServerKey:r});try{let e=await Ut(i);return q=e.settings,e}catch(e){throw await i.unsubscribe(),e}}async function Kt(){await(await(await J())?.pushManager.getSubscription())?.unsubscribe(),q=null,await c(`/api/push/subscription`,{method:`DELETE`})}async function qt(e){let t=await(await c(`/api/push/settings`,{method:`PUT`,headers:{"Content-Type":`application/json`},body:JSON.stringify(e)})).json();return q=t.settings,t}async function Jt(){await c(`/api/push/test`,{method:`POST`})}var Yt=`toodo-open-task`;function Xt(e){if(!(`serviceWorker`in navigator))return()=>{};let t=navigator.serviceWorker,n=({data:t})=>{typeof t==`object`&&t&&`type`in t&&t.type===Yt&&`taskId`in t&&typeof t.taskId==`number`&&e(t.taskId)};return t.addEventListener(`message`,n),()=>t.removeEventListener(`message`,n)}async function Zt(){return`Notification`in window&&Notification.permission===`granted`}async function Qt(){return`Notification`in window?Notification.requestPermission():`denied`}function $t(e){zt(e.title)||new Notification(e.title,{body:e.body})}var en={planned:`Planned`,in_progress:`In progress`,in_review:`Awaiting completion`,done:`Done`};function tn(e){return e.status===`done`&&e.resolution===`completed`?`Completed`:e.status===`done`&&e.resolution===`not_adopted`?`Not adopted`:en[e.status]}function nn(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 rn(e,t){let n=new Map(e.map(e=>[e.id,e.status]));return t.flatMap(e=>{let t=n.get(e.id);return t===void 0||t===e.status?[]:[{title:nn(t,e),body:`#${e.id} ${e.title}: ${en[t]} -> ${tn(e)}`}]})}async function an(e){if(e.length!==0&&(await Zt()||await Qt()===`granted`))for(let t of e)$t(t)}var on=class extends Error{kind;code;constructor(e){super(St(e)),this.name=`CommandFailure`,this.kind=e.kind,this.code=e.code}};async function Y(e){let t=await e;if(t.status===`error`)throw new on(t.error);return t.data}var X={workspaces:[`workspaces`],guidelines:e=>[`guidelines`,e],tasks:[`task-list`,`pages`],taskRelations:[`tasks`,`relations`],archive:[`tasks`,`archive`],backups:[`backups`],backupSettings:[`backup-settings`],backupStatus:[`backup-status`],mcpServerInfo:[`mcp-server-info`],review:(e,t)=>[`review`,e,t],reviewTimeZone:[`review`,`time-zone`],reviewSnapshots:[`review-snapshots`],reviewSnapshot:e=>[`review-snapshots`,e]};function sn(){return I({queryKey:X.mcpServerInfo,queryFn:()=>B.mcpServerInfo(),refetchInterval:5e3})}function cn(){return I({queryKey:X.backups,queryFn:()=>Y(B.listBackups())})}function ln(){return I({queryKey:X.backupSettings,queryFn:()=>B.getBackupSettings()})}function un(){return I({queryKey:X.backupStatus,queryFn:()=>B.getBackupStatus(),refetchInterval:6e4})}function dn(){let e=p();return L({mutationFn:e=>Y(B.saveBackupSettings(e)),onSuccess:t=>(e.setQueryData(X.backupSettings,t),Promise.all([e.invalidateQueries({queryKey:X.backups}),e.invalidateQueries({queryKey:X.backupStatus})]))})}function fn(){let e=p();return L({mutationFn:e=>Y(B.restoreBackup(e)),onSuccess:()=>e.invalidateQueries()})}function pn(){return L({mutationFn:Tt})}function mn(){return L({mutationFn:Et})}function hn(){let e=p();return L({mutationFn:Dt,onSuccess:()=>e.invalidateQueries()})}function gn(){return I({queryKey:X.workspaces,queryFn:()=>Y(B.listWorkspaces())})}function _n(){let e=p();return L({mutationFn:e=>Y(B.createWorkspace(e)),onSuccess:()=>e.invalidateQueries({queryKey:X.workspaces})})}function vn(){let e=p();return L({mutationFn:e=>Y(B.updateWorkspace(e)),onSuccess:()=>e.invalidateQueries({queryKey:X.workspaces,exact:!0})})}function yn(){return Z(e=>Y(B.deleteWorkspace(e)))}function bn(){return I({queryKey:X.archive,queryFn:()=>Y(B.listArchive())})}function Z(e){let t=p();return L({mutationFn:e,onSuccess:()=>Promise.all([t.invalidateQueries({queryKey:X.tasks}),t.invalidateQueries({queryKey:X.workspaces,exact:!0}),t.invalidateQueries({queryKey:X.archive}),t.invalidateQueries({queryKey:[`review`]})])})}function xn(){return Z(e=>Y(B.restoreWorkspace(e)))}function Sn(){return Z(e=>Y(B.purgeWorkspace(e)))}function Cn(){return Z(e=>Y(B.restoreTask(e)))}function wn(){return Z(e=>Y(B.purgeTask(e)))}function Tn(e){return I({queryKey:X.guidelines(e),queryFn:()=>Y(B.listGuidelines(e))})}function En(e){let t=p();return L({mutationFn:e,onSuccess:e=>t.invalidateQueries({queryKey:X.guidelines(e.workspaceId)})})}function Dn(){return En(e=>Y(B.addGuideline(e)))}function On(){return En(e=>Y(B.updateGuideline(e)))}function kn(){return En(e=>Y(B.deleteGuideline(e)))}var An=[`planned`,`in_progress`,`in_review`];function Q(e){return Y(B.listTasks(e))}async function jn(e){let t=Q({statuses:[`done`],before:e,limit:100}),n=e=>e.length<100?null:Math.min(...e.map(e=>e.id));if(e!==null){let e=await t;return{tasks:e,olderBefore:n(e)}}let[r,i]=await Promise.all([Q({statuses:An}),t]),a=new Set([...r,...i].map(e=>e.id)),o=[...new Set(r.flatMap(e=>e.dependsOn))].filter(e=>!a.has(e)),s=[];for(let e=0;e<o.length;e+=100)s.push(o.slice(e,e+100));let c=await Promise.all(s.map(e=>Q({ids:e})));return{tasks:[...r,...i,...c.flat()],olderBefore:n(i)}}function Mn(e){let t=new Map;for(let n of e.pages)for(let e of n.tasks)t.set(e.id,e);return[...t.values()].sort((e,t)=>e.id-t.id)}function Nn(e){let t=e.getQueryData(X.tasks);return t===void 0?void 0:Mn(t)}async function Pn(e){let t=e.getQueryData(X.tasks);t===void 0||t.pages.length<=1||(await e.cancelQueries({queryKey:X.tasks,exact:!0}),e.setQueryData(X.tasks,e=>e===void 0?e:{pages:e.pages.slice(0,1),pageParams:e.pageParams.slice(0,1)}))}function Fn(e){let t=p();(0,u.useEffect)(()=>{if(!e)Pn(t);else return()=>void Pn(t)},[e,t])}function In(e=[]){let t=Ze({queryKey:X.tasks,queryFn:({pageParam:e})=>jn(e),initialPageParam:null,getNextPageParam:e=>e.olderBefore,select:Mn}),n=t.data,r=new Set(n?.map(e=>e.id)),i=[...new Set(e.filter(e=>e!=null&&!r.has(e)))].sort((e,t)=>e-t),a=I({queryKey:[...X.tasks,`by-id`,i],queryFn:()=>Q({ids:i}),enabled:n!==void 0&&i.length>0}),o=i.length===0?[]:a.data??[];return n===void 0||o.length===0?t:{...t,data:[...n,...o].sort((e,t)=>e.id-t.id)}}function Ln(e,t){return I({queryKey:X.review(e,t),queryFn:()=>Y(B.reviewPeriod(e,t))})}function Rn(){return I({queryKey:X.reviewTimeZone,queryFn:()=>Y(B.getReviewTimeZone())})}function zn(){let e=p();return L({mutationFn:e=>Y(B.setReviewTimeZone(e)),onSuccess:()=>e.invalidateQueries({queryKey:[`review`]})})}function Bn(){return I({queryKey:X.reviewSnapshots,queryFn:()=>Y(B.listReviewSnapshots())})}function Vn(e){return I({queryKey:X.reviewSnapshot(e??0),queryFn:()=>Y(B.getReviewSnapshot(e??0)),enabled:e!==null,staleTime:1/0})}function Hn(){let e=p();return L({mutationFn:e=>Y(B.saveReviewSnapshot(e)),onSuccess:()=>e.invalidateQueries({queryKey:X.reviewSnapshots})})}function Un(){let e=p();return L({mutationFn:e=>Y(B.deleteReviewSnapshot(e)),onSuccess:()=>e.invalidateQueries({queryKey:X.reviewSnapshots})})}function Wn(){let e=p();(0,u.useEffect)(()=>{let t=[V.tasksChanged.listen(async()=>{let t=Nn(e);await e.invalidateQueries({queryKey:X.tasks}),!(t===void 0||document.hasFocus())&&an(rn(t,Nn(e)??[])).catch(e=>console.error(`toodo: failed to show status notifications`,e))}),V.workspacesChanged.listen(()=>e.invalidateQueries({queryKey:X.workspaces,exact:!0})),V.guidelinesChanged.listen(t=>e.invalidateQueries({queryKey:X.guidelines(t.payload.workspaceId)}))];return()=>{for(let e of t)e.then(e=>e())}},[e])}function Gn(){let e=p();return L({mutationFn:e=>Y(B.startTask(e,null,null)),onSuccess:()=>e.invalidateQueries({queryKey:X.tasks})})}function Kn(){let e=p();return L({mutationFn:e=>Y(B.completeTask(e,null,null)),onSuccess:()=>Promise.all([e.invalidateQueries({queryKey:X.tasks}),e.invalidateQueries({queryKey:[`review`]})])})}function qn(){let e=p();return L({mutationFn:({id:e,note:t,shippedWith:n=null})=>Y(B.concludeTask(e,t,n===null?`not_adopted`:`shipped_with`,n)),onSuccess:()=>Promise.all([e.invalidateQueries({queryKey:X.tasks}),e.invalidateQueries({queryKey:[`review`]})])})}function Jn(){let e=p();return L({mutationFn:({id:e,note:t})=>Y(B.setCompletionNote(e,t)),onSuccess:()=>Promise.all([e.invalidateQueries({queryKey:X.tasks}),e.invalidateQueries({queryKey:[`review`]})])})}function Yn(){let e=p();return L({mutationFn:({id:e,reason:t})=>Y(B.reopenTask(e,t)),onSuccess:()=>Promise.all([e.invalidateQueries({queryKey:X.tasks}),e.invalidateQueries({queryKey:[`review`]})])})}function Xn(){let e=p();return L({mutationFn:({id:e,resolution:t,note:n})=>Y(B.setTaskOutcome(e,t,n)),onSuccess:()=>Promise.all([e.invalidateQueries({queryKey:X.tasks}),e.invalidateQueries({queryKey:[`review`]})])})}function Zn(){let e=p();return L({mutationFn:e=>Y(B.updateTask(e)),onSuccess:()=>Promise.all([e.invalidateQueries({queryKey:X.tasks}),e.invalidateQueries({queryKey:[`review`]})])})}function Qn(){let e=p();return L({mutationFn:({id:e,workspaceId:t})=>Y(B.moveTask(e,t)),onSuccess:()=>Promise.all([e.invalidateQueries({queryKey:X.tasks}),e.invalidateQueries({queryKey:[`review`]})])})}function $(e){let t=p();return L({mutationFn:e,onSuccess:()=>t.invalidateQueries({queryKey:X.tasks})})}function $n(){return $(e=>Y(B.pauseTask(e)))}function er(){return $(({id:e,until:t,reason:n})=>Y(B.waitTask(e,t,n)))}function tr(){return $(e=>Y(B.endWait(e)))}function nr(){return $(({taskId:e,criterionId:t,met:n,evidence:r})=>Y(B.checkCriterion(e,t,n,r)))}function rr(){return Z(e=>Y(B.deleteTask(e)))}function ir(){return Z(e=>Y(B.deleteDoneTasks(e)))}function ar(e,t){return I({queryKey:[...X.tasks,`done-count`,e],queryFn:async()=>(await Q({workspaceId:e,statuses:[`done`]})).length,enabled:t})}function or(){return $(({id:e,dependsOn:t,confirmPause:n})=>Y(B.addDependency(e,t,n)))}function sr(){return $(({id:e,dependsOn:t})=>Y(B.removeDependency(e,t)))}function cr(){return I({queryKey:X.taskRelations,queryFn:()=>Y(B.listTaskRelations())})}function lr(e){let t=p();return L({mutationFn:e,onSuccess:()=>t.invalidateQueries({queryKey:X.taskRelations})})}function ur(){return lr(({taskId:e,relatedId:t})=>Y(B.addTaskRelation(e,t)))}function dr(){return lr(({taskId:e,relatedId:t})=>Y(B.removeTaskRelation(e,t)))}function fr(){let e=p();return L({mutationFn:e=>Y(B.createTask(e)),onSuccess:()=>e.invalidateQueries({queryKey:X.tasks})})}export{hn as $,p as $t,Sn as A,rt as At,Rn as B,A as Bt,tr as C,ht as Ct,Fn as D,Qe as Dt,Qn as E,ot as Et,Cn as F,L as Ft,zn as G,ie as Gt,Hn as H,O as Ht,xn as I,I as It,cr as J,y as Jt,Xn as K,re as Kt,Ln as L,Ie as Lt,dr as M,tt as Mt,Yn as N,nt as Nt,$n as O,R as Ot,fn as P,et as Pt,vn as Q,m as Qt,Vn as R,De as Rt,pn as S,_t as St,sn as T,st as Tt,Wn as U,b as Ut,dn as V,k as Vt,Jn as W,S as Wt,On as X,x as Xt,In as Y,C as Yt,Zn as Z,pe as Zt,Un as _,lt as _t,ur as a,Xt as at,ar as b,ft as bt,un as c,Jt as ct,Kn as d,Nt as dt,er as et,qn as f,Mt as ft,kn as g,gt,ir as h,bt as ht,Dn as i,Wt as it,sr as j,it as jt,wn as k,$e as kt,cn as l,Pt as lt,_n as m,B as mt,Y as n,Kt as nt,bn as o,Lt as ot,fr as p,It as pt,Gn as q,ne as qt,or as r,Gt as rt,ln as s,qt as st,X as t,gn as tt,nr as u,Ft as ut,rr as v,mt as vt,Tn as w,at as wt,mn as x,yt as xt,yn as y,pt as yt,Bn as z,j as zt};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a as e,n as t,t as n}from"./jsx-runtime-D3jfb0Ew.js";import{t as r}from"./Selector-DTDPVjfP.js";import{At as i,B as a,Ct as o,G as s,H as c,L as l,Pt as u,R as d,St as f,_ as p,_t as m,gt as h,ht as g,mt as ee,n as te,o as ne,tt as re,vt as ie,z as ae}from"./queries-DRMbWdSl.js";import{n as _,t as v}from"./button-BpXTpERz.js";import{A as y,C as oe,Ct as b,D as x,E as S,Et as C,Ft as se,G as w,L as T,M as ce,N as E,Nt as D,O,P as le,Pt as ue,S as de,T as k,U as A,X as fe,Z as pe,_ as me,b as j,c as he,d as ge,et as M,f as N,g as P,h as F,j as I,k as _e,l as L,m as R,nt as ve,p as z,s as ye,tt as be,u as B,v as V,w as xe,wt as H,x as U,y as W}from"./index-BMxRmcAM.js";import{t as G}from"./opener-DWhHPoCL.js";var K=e(t(),1),q=n(),Se={completed:u.success,opened_for_review:u.review,started:u.progress,worked_on:u.progress,planned:u.neutral},J=`live`,Y=`all`,X=`any`,Ce=[{kind:`week`,label:`Week`},{kind:`month`,label:`Month`},{kind:`quarter`,label:`Quarter`},{kind:`year`,label:`Year`},{kind:`custom`,label:`Custom`}];function we(e,t,n){let r=URL.createObjectURL(new Blob([t],{type:`${n};charset=utf-8`})),i=document.createElement(`a`);i.href=r,i.download=e,i.click(),URL.revokeObjectURL(r)}function Te({disabled:e,items:t}){return(0,q.jsx)(A,{items:t,alignment:`end`,menuWidth:192,renderTrigger:t=>(0,q.jsx)(v,{...t,size:`sm`,variant:`primary`,icon:(0,q.jsx)(D,{}),label:`Export`,isDisabled:e})})}function Z(e,t){return`${e} ${t}${e===1?``:`s`}`}function Ee(){let e=a(),t=s(),[n,r]=(0,K.useState)(!1),[i,o]=(0,K.useState)(``),[c,l]=(0,K.useState)(null),u=typeof Intl.supportedValuesOf==`function`?Intl.supportedValuesOf(`timeZone`):[];async function d(e){l(null);try{await t.mutateAsync(e),r(!1)}catch(e){l(e instanceof Error?e.message:String(e))}}if(!e.data)return null;let{timeZone:f,configured:p}=e.data;return n?(0,q.jsxs)(`form`,{"aria-label":`Review time zone`,className:`flex flex-wrap items-center gap-2 print:hidden`,onSubmit:e=>{e.preventDefault(),d(i)},children:[(0,q.jsx)(`label`,{htmlFor:`review-time-zone`,className:`text-xs`,children:`Time zone for every device`}),(0,q.jsx)(`input`,{id:`review-time-zone`,list:`review-time-zones`,required:!0,className:C(M,`w-56`),value:i,onChange:e=>o(e.target.value)}),(0,q.jsx)(`datalist`,{id:`review-time-zones`,children:u.map(e=>(0,q.jsx)(`option`,{value:e},e))}),(0,q.jsx)(v,{size:`sm`,variant:`primary`,type:`submit`,label:`Save`,isDisabled:t.isPending}),p!==null&&(0,q.jsx)(v,{size:`sm`,variant:`secondary`,label:`Use the server's`,onClick:()=>void d(null)}),(0,q.jsx)(v,{size:`sm`,variant:`ghost`,label:`Cancel`,onClick:()=>r(!1)}),c&&(0,q.jsx)(`span`,{role:`alert`,className:`w-full text-xs text-destructive`,children:c})]}):(0,q.jsxs)(`span`,{children:[`Days are in `,f,p===null&&` (the server's time zone)`,`.`,` `,(0,q.jsx)(v,{size:`sm`,variant:`ghost`,label:`Change time zone`,className:`print:hidden`,onClick:()=>{o(p??f),r(!0)}})]})}function Q({onShowTask:e}){let[t,n]=(0,K.useState)(()=>U(`week`,m(Date.now()/1e3))),[i,a]=(0,K.useState)(null),[o,s]=(0,K.useState)(W),[u,f]=(0,K.useState)(null),[h,b]=(0,K.useState)(null),S=l(t.from,t.to),E=ae(),D=d(h),O=c(),k=p(),A=h!==null,M=A?D:S,N=re(),P=ne(),F=A?D.data?.workspaces??[]:[...N.data??[],...P.data?.workspaces??[]],I=new Map(F.map(e=>[e.id,e.name])),L=A?D.data&&{period:{kind:D.data.summary.period,from:D.data.summary.from,to:D.data.summary.to},entries:D.data.entries,start:D.data.summary.start,end:D.data.summary.end,timeZone:D.data.summary.timeZone,now:D.data.summary.savedAt}:S.data&&{period:t,entries:S.data.entries,start:S.data.start,end:S.data.end,timeZone:S.data.timeZone,now:Date.now()/1e3},R=L?.period??t,z=L&&ge(L.entries,o),B=_e(L?.entries??[]);o.label!==null&&!B.includes(o.label)&&B.push(o.label);let V=[o.workspaceId===null?`across all workspaces`:`in ${I.get(o.workspaceId)??`workspace ${o.workspaceId}`}`,o.label!==null&&`labelled ${o.label}`].filter(Boolean).join(`, `),G=oe[R.kind];function Q(e){a(null),n(e)}function $(e){a(null),f(null),b(e)}async function Me(){try{let e=await O.mutateAsync({period:t.kind,from:t.from,to:t.kind===`custom`?t.to:null,workspaceId:o.workspaceId,label:o.label,title:null});a(`Saved "${e.title}" with ${Z(e.entryCount,`task`)}; reopen it from Saved reviews.`)}catch(e){a(`Could not save the review: ${e instanceof Error?e.message:String(e)}`)}}async function Ne(e){try{await k.mutateAsync(e),$(null),a(`Deleted the saved review.`)}catch(e){a(`Could not delete the saved review: ${e instanceof Error?e.message:String(e)}`)}}function Pe(e){e!==t.kind&&Q(e===`custom`?{...t,kind:e}:U(e,t.from))}function Fe(e){return A?D.data?Promise.resolve(e===`csv`?D.data.csv:D.data.markdown):Promise.reject(Error(`the saved review is still loading`)):te(ee.reviewReport({period:t.kind,date:null,from:t.from,to:t.kind===`custom`?t.to:null,format:e,timeZone:null,workspaceId:o.workspaceId,label:o.label}))}async function Ie(){try{let e=Fe(`markdown`);if(typeof ClipboardItem>`u`)await navigator.clipboard.writeText((await e).contents);else{let t=e.then(({contents:e})=>new Blob([e],{type:`text/plain`}));await navigator.clipboard.write([new ClipboardItem({"text/plain":t})])}a(`Copied as Markdown.`)}catch(e){a(`Could not copy: ${String(e)}`)}}async function Le(e){try{let t=await Fe(e);we(t.fileName,t.contents,t.mediaType),a(`Downloaded ${t.fileName}`)}catch(e){a(`Could not export: ${String(e)}`)}}return(0,q.jsxs)(`section`,{"aria-labelledby":`review-heading`,className:`flex flex-col gap-4`,children:[(0,q.jsxs)(`header`,{className:`flex flex-col gap-1`,children:[(0,q.jsx)(`h2`,{id:`review-heading`,className:`text-xl font-semibold tracking-tight`,children:A&&D.data?D.data.summary.title:xe[R.kind]}),(0,q.jsxs)(`p`,{className:`text-sm text-muted-foreground`,children:[`Work recorded from `,R.from,` to `,R.to,` `,V,`.`,` `,A?D.data&&(0,q.jsxs)(`span`,{children:[`Saved `,ie(D.data.summary.savedAt),`, with days in `,D.data.summary.timeZone,`; it stays as it was when saved.`]}):(0,q.jsx)(Ee,{})]})]}),(A||(E.data?.length??0)>0)&&(0,q.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 print:hidden`,children:[(0,q.jsx)(r,{label:`Saved reviews`,isLabelHidden:!0,size:`sm`,options:[{value:J,label:`Live review`},...(E.data??[]).map(e=>({value:String(e.id),label:`${e.title} (saved ${m(e.savedAt)})`}))],value:h===null?J:String(h),onChange:e=>$(e===J?null:Number(e))}),h!==null&&(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(v,{size:`sm`,variant:`secondary`,label:`Back to the live review`,onClick:()=>$(null)}),(0,q.jsx)(v,{size:`sm`,variant:`ghost`,label:`Delete saved review`,isDisabled:k.isPending,onClick:()=>void Ne(h)})]})]}),(0,q.jsxs)(`div`,{className:`flex flex-wrap items-end gap-2 print:hidden`,children:[!A&&(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(ve,{label:`Review period`,size:`sm`,value:t.kind,onChange:e=>typeof e==`string`&&Pe(e),children:Ce.map(({kind:e,label:t})=>(0,q.jsx)(be,{value:e,label:t},e))}),t.kind===`week`&&(0,q.jsx)(T,{label:`Week starting`,size:`sm`,format:`system_date`,value:t.from,onChange:e=>e&&Q(ce(e))}),t.kind===`custom`&&(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(T,{label:`From`,size:`sm`,format:`system_date`,max:t.to,value:t.from,onChange:e=>e&&e<=t.to&&Q({...t,from:e})}),(0,q.jsx)(T,{label:`To`,size:`sm`,format:`system_date`,min:t.from,value:t.to,onChange:e=>e&&e>=t.from&&Q({...t,to:e})})]}),t.kind!==`week`&&t.kind!==`custom`&&(0,q.jsx)(`span`,{className:`px-1 text-sm font-medium`,children:de(t)}),(0,q.jsx)(_,{size:`sm`,variant:`secondary`,icon:(0,q.jsx)(ue,{}),label:`Previous ${G}`,tooltip:`Previous ${G}`,onClick:()=>Q(y(t,-1))}),(0,q.jsx)(_,{size:`sm`,variant:`secondary`,icon:(0,q.jsx)(se,{}),label:`Next ${G}`,tooltip:`Next ${G}`,onClick:()=>Q(y(t,1))}),t.kind!==`custom`&&(0,q.jsx)(v,{size:`sm`,variant:`ghost`,label:`This ${G}`,onClick:()=>Q(U(t.kind,m(Date.now()/1e3)))})]}),(0,q.jsx)(`div`,{className:`ml-auto`,children:(0,q.jsx)(Te,{disabled:!z,items:[...A?[]:[{label:`Save as snapshot`,onClick:()=>void Me()}],{label:`Copy as Markdown`,onClick:()=>void Ie()},{label:`Save as Markdown`,onClick:()=>void Le(`markdown`)},{label:`Save as CSV`,onClick:()=>void Le(`csv`)},{label:`Print or save as PDF`,onClick:()=>window.print()}]})})]}),(0,q.jsxs)(`div`,{role:`group`,"aria-label":`Review filters`,className:`flex flex-wrap items-center gap-2 print:hidden`,children:[(0,q.jsx)(r,{label:`Workspace`,isLabelHidden:!0,size:`sm`,options:[{value:Y,label:`All workspaces`},...F.map(e=>({value:String(e.id),label:e.name}))],value:o.workspaceId===null?Y:String(o.workspaceId),onChange:e=>s({...o,workspaceId:e===Y?null:Number(e)})}),(0,q.jsx)(r,{label:`Label`,isLabelHidden:!0,size:`sm`,options:[{value:X,label:B.length===0?`No labels in this period`:`Any label`},...B.map(e=>({value:`label:${e}`,label:e}))],value:o.label===null?X:`label:${o.label}`,onChange:e=>s({...o,label:e===X?null:e.slice(6)})}),(o.workspaceId!==null||o.label!==null)&&(0,q.jsx)(v,{size:`sm`,variant:`ghost`,label:`Clear filters`,onClick:()=>s(W)})]}),i&&(0,q.jsx)(`p`,{role:`status`,className:`text-xs text-muted-foreground print:hidden`,children:i}),(0,q.jsx)(`p`,{role:`status`,className:C(`text-sm text-muted-foreground`,!M.isPending&&`sr-only`),children:M.isPending?`Loading the review...`:z?`Showing ${z.length} ${z.length===1?`task`:`tasks`} with activity in this ${G}.`:``}),M.isError&&(0,q.jsxs)(`p`,{role:`alert`,className:`text-sm text-destructive`,children:[`Failed to load the review: `,M.error.message]}),z?.length===0&&(0,q.jsx)(ye,{title:L?.entries.length===0?`No recorded activity in this ${G}.`:`No recorded activity in this ${G} matches the filters.`,hint:A?`This saved review keeps the tasks it had when it was saved.`:L?.entries.length===0?`Toodo records each task as it is planned, started, moved to review, and completed, so reviews fill up as you work.`:`Pick another period or change the filters to look at other work.`,action:A?void 0:(0,q.jsx)(`div`,{className:`flex flex-wrap justify-center gap-2 print:hidden`,children:(0,q.jsx)(v,{size:`sm`,variant:`secondary`,label:`Show the ${G} before`,onClick:()=>Q(y(t,-1))})})}),L&&z&&z.length>0&&(0,q.jsx)(je,{shown:L,entries:z,workspaces:F}),L&&z&&(0,q.jsx)(Ae,{shown:L,entries:z,editable:!A}),R.kind===`year`&&z&&(0,q.jsx)(ke,{entries:z}),z&&me(z).map(t=>(0,q.jsxs)(`section`,{"aria-label":j[t.outcome],className:`flex flex-col gap-2`,children:[(0,q.jsxs)(`h3`,{className:C(`text-sm font-semibold`,Se[t.outcome]),children:[j[t.outcome],` `,(0,q.jsxs)(`span`,{className:`font-normal text-muted-foreground`,children:[`(`,t.entries.length,`)`]})]}),(0,q.jsx)(`ul`,{className:`flex flex-col divide-y rounded-lg border`,children:t.entries.map(({task:t,at:n,commits:r,archived:i,pullRequest:a})=>(0,q.jsxs)(`li`,{className:`flex flex-col gap-1 px-3 py-2`,children:[(0,q.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,q.jsx)(w,{type:t.taskType}),(0,q.jsxs)(`span`,{className:`shrink-0 text-xs text-muted-foreground`,children:[`#`,t.id]}),(0,q.jsx)(`button`,{type:`button`,"aria-label":`Open #${t.id} ${t.title}`,title:t.title,onClick:()=>e?.(t.id),className:`min-w-0 flex-1 truncate text-left text-sm font-medium hover:underline max-md:min-h-11`,children:t.title}),t.resolution===`not_adopted`&&(0,q.jsx)(H,{className:`shrink-0`,label:`Not adopted`}),i&&(0,q.jsx)(H,{className:`shrink-0`,label:`Archived`}),t.resolution===`completed`&&(0,q.jsx)(H,{className:`shrink-0`,variant:`green`,label:`Completed`}),x(t)&&(0,q.jsx)(Oe,{url:x(t),stats:a}),(0,q.jsxs)(`span`,{className:`shrink-0 text-xs text-muted-foreground max-md:hidden print:inline`,children:[I.get(t.workspaceId)??`Workspace ${t.workspaceId}`,` · `,(0,q.jsx)(g,{at:n})]})]}),(0,q.jsx)(pe,{task:t}),i||A?null:u?.id===t.id?(0,q.jsx)(le,{task:t,focusPlan:u.field,onDone:()=>f(null)}):(0,q.jsx)(`p`,{className:`text-xs text-muted-foreground empty:hidden print:hidden`,children:(0,q.jsx)(fe,{task:t,onEdit:e=>f({id:t.id,field:e})})}),t.completionNote&&(0,q.jsx)(`p`,{"aria-label":`Completion note of #${t.id}`,className:`whitespace-pre-line break-words-keep text-xs`,children:t.completionNote}),L&&(0,q.jsx)(De,{task:t,shown:L}),r.length>0&&(0,q.jsx)(`ul`,{"aria-label":`Commits of #${t.id} this ${G}`,className:`flex flex-col gap-0.5`,children:r.map(e=>(0,q.jsxs)(`li`,{className:`flex gap-2 text-xs`,title:e.author,children:[(0,q.jsx)(`code`,{className:`shrink-0 text-muted-foreground`,children:e.sha.slice(0,7)}),(0,q.jsx)(`span`,{className:`truncate`,children:he(e.message)})]},e.sha))})]},t.id))})]},t.outcome))]})}function $(e){return e===0?`0h`:R(e)}function De({task:e,shown:t}){let{start:n,end:r,now:i}=t,a=h(e.timeline,i),s=f(e.timeline,i);if(a===null||s===null)return null;let c=o(e.timeline).filter(e=>e.state===`paused`&&e.start<r&&(e.end??i)>n);return(0,q.jsxs)(`div`,{"aria-label":`Time of #${e.id}`,className:`flex flex-col gap-0.5 text-xs text-muted-foreground`,children:[(0,q.jsxs)(`p`,{children:[$(a),` active, `,$(s),` waiting`]}),c.length>0&&(0,q.jsx)(`ul`,{"aria-label":`Waits of #${e.id}`,className:`flex flex-col gap-0.5`,children:c.map(e=>(0,q.jsxs)(`li`,{className:`break-words-keep`,children:[`Waiting `,$(Math.max((e.end??i)-e.start,0)),` from `,m(e.start),e.end===null&&`, still waiting`,`: `,e.reason??`no reason recorded`]},e.start))})]})}function Oe({url:e,stats:t}){let n=S(e),r=t=>{t.preventDefault(),G(e).catch(t=>console.error(`Failed to open ${e}`,t))};return(0,q.jsx)(`a`,{href:e,title:t?`${e} \u00b7 ${O(t)}`:e,"aria-label":n?`Pull request #${n}`:`Pull request`,onClick:r,onAuxClick:r,className:`shrink-0 text-xs text-primary underline underline-offset-2 hover:no-underline max-md:inline-flex max-md:min-h-11 max-md:items-center`,children:n?`#${n}`:`PR`})}function ke({entries:e}){let t=E(e);return t===null?null:(0,q.jsxs)(`section`,{"aria-labelledby":`year-in-review-heading`,className:`flex flex-col gap-3 rounded-lg border p-3`,children:[(0,q.jsx)(`h3`,{id:`year-in-review-heading`,className:`text-sm font-semibold`,children:`Year in review`}),t.pullRequests&&(0,q.jsxs)(`dl`,{className:`flex flex-wrap gap-x-6 gap-y-2`,children:[(0,q.jsxs)(`div`,{className:`flex flex-col`,children:[(0,q.jsx)(`dt`,{className:`text-xs text-muted-foreground`,children:`Merged pull requests`}),(0,q.jsx)(`dd`,{className:`text-lg font-semibold`,children:t.pullRequests.pullRequests})]}),(0,q.jsxs)(`div`,{className:`flex flex-col`,children:[(0,q.jsx)(`dt`,{className:`text-xs text-muted-foreground`,children:`Lines changed`}),(0,q.jsxs)(`dd`,{className:`text-lg font-semibold`,children:[(0,q.jsxs)(`span`,{children:[`+`,t.pullRequests.additions]}),(0,q.jsx)(`span`,{className:`text-muted-foreground`,children:` / `}),(0,q.jsxs)(`span`,{children:[`-`,t.pullRequests.deletions]})]})]}),(0,q.jsxs)(`div`,{className:`flex flex-col`,children:[(0,q.jsx)(`dt`,{className:`text-xs text-muted-foreground`,children:`Files changed`}),(0,q.jsx)(`dd`,{className:`text-lg font-semibold`,children:t.pullRequests.changedFiles})]}),(0,q.jsxs)(`div`,{className:`flex flex-col`,children:[(0,q.jsx)(`dt`,{className:`text-xs text-muted-foreground`,children:`Reviews`}),(0,q.jsxs)(`dd`,{className:`text-lg font-semibold`,title:P(t.pullRequests),children:[t.pullRequests.reviews,(0,q.jsxs)(`span`,{className:`ml-1 text-xs font-normal text-muted-foreground`,children:[`on `,t.pullRequests.reviewed,` of `,t.pullRequests.pullRequests]})]})]})]}),t.largest.length>0&&(0,q.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,q.jsx)(`h4`,{className:`text-xs text-muted-foreground`,children:`Largest pull requests`}),(0,q.jsx)(`ol`,{"aria-label":`Largest pull requests`,className:`flex flex-col gap-1`,children:t.largest.map(({task:e,pullRequest:t})=>(0,q.jsxs)(`li`,{className:`flex min-w-0 flex-wrap items-center gap-x-2 gap-y-0.5 text-sm`,children:[(0,q.jsx)(w,{type:e.taskType}),(0,q.jsx)(`span`,{className:`truncate font-medium`,children:e.title}),(0,q.jsx)(`span`,{className:`ml-auto shrink-0 text-xs text-muted-foreground`,children:O(t)})]},e.id))})]}),t.research.length>0&&(0,q.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,q.jsx)(`h4`,{className:`text-xs text-muted-foreground`,children:`Research conclusions`}),(0,q.jsx)(`ul`,{"aria-label":`Research conclusions`,className:`flex flex-col divide-y rounded-md border`,children:t.research.map(({task:e,at:t,adopted:n})=>(0,q.jsxs)(`li`,{className:`flex flex-col gap-1 px-2 py-1.5`,children:[(0,q.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-center gap-x-2 gap-y-0.5 text-sm`,children:[(0,q.jsx)(`span`,{className:`truncate font-medium`,children:e.title}),(0,q.jsx)(H,{className:`shrink-0`,variant:n?`green`:`neutral`,label:n?`Adopted`:`Not adopted`}),(0,q.jsx)(g,{className:`ml-auto shrink-0 text-xs text-muted-foreground`,at:t})]}),(0,q.jsx)(`p`,{"aria-label":`Research conclusion of #${e.id}`,className:`whitespace-pre-line break-words-keep text-xs`,children:e.completionNote??(0,q.jsx)(`span`,{className:`text-muted-foreground`,children:`No conclusion written.`})})]},e.id))})]}),t.overruns.length>0&&(0,q.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,q.jsx)(`h4`,{className:`text-xs text-muted-foreground`,children:`Largest estimate overruns`}),(0,q.jsx)(`ol`,{"aria-label":`Largest estimate overruns`,className:`flex flex-col gap-1`,children:t.overruns.map(({task:e,estimated:t,actual:n})=>(0,q.jsxs)(`li`,{className:`flex min-w-0 flex-wrap items-center gap-x-2 gap-y-0.5 text-sm`,children:[(0,q.jsx)(w,{type:e.taskType}),(0,q.jsx)(`span`,{className:`truncate font-medium`,children:e.title}),(0,q.jsxs)(`span`,{className:`ml-auto shrink-0 text-xs text-muted-foreground`,children:[`estimated `,R(t),`, `,R(n),` active`]})]},e.id))})]})]})}function Ae({shown:e,entries:t,editable:n}){let r=k(e.end,t,e.now),i=n?t.filter(({archived:e})=>!e).map(({task:e})=>b(e)):[],a=i.filter(e=>e.includes(`estimate`)).length,o=i.filter(e=>e.includes(`dueDate`)).length;if(r===null&&a+o===0)return null;let s=(0,q.jsxs)(`div`,{className:`contents`,children:[(0,q.jsx)(`dt`,{className:`text-muted-foreground`,children:`Missing plan`}),(0,q.jsxs)(`dd`,{children:[[a>0&&`${Z(a,`task`)} without an estimate`,o>0&&`${Z(o,`task`)} without a due date`].filter(Boolean).join(`, `),`; add them from the marks on the tasks below`]})]});return(0,q.jsxs)(`section`,{"aria-labelledby":`plan-heading`,className:`flex flex-col gap-3 rounded-lg border p-3`,children:[(0,q.jsx)(`h3`,{id:`plan-heading`,className:`text-sm font-semibold`,children:`Plan vs actual`}),r===null?(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(`p`,{className:`text-sm`,children:`No reviewed task has an estimate or a due date, so there is nothing to compare yet.`}),(0,q.jsx)(`dl`,{className:`grid gap-x-4 gap-y-1 text-sm sm:grid-cols-[auto_1fr]`,children:s})]}):(0,q.jsxs)(`dl`,{className:`grid gap-x-4 gap-y-1 text-sm sm:grid-cols-[auto_1fr]`,children:[(0,q.jsxs)(`div`,{className:`contents`,children:[(0,q.jsx)(`dt`,{className:`text-muted-foreground`,children:`Estimate vs active time`}),(0,q.jsx)(`dd`,{children:r.time?F(r.time):`No completed task had an estimate`})]}),(0,q.jsxs)(`div`,{className:`contents`,children:[(0,q.jsx)(`dt`,{className:`text-muted-foreground`,children:`Due dates met`}),(0,q.jsx)(`dd`,{children:r.dueDates?z(r.dueDates):`No completed task had a due date`})]}),a+o>0&&s]}),r!==null&&r.late.length>0&&(0,q.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,q.jsx)(`h4`,{className:`text-xs text-muted-foreground`,children:`Late tasks`}),(0,q.jsx)(`ul`,{"aria-label":`Late tasks`,className:`flex flex-col gap-1`,children:r.late.map(e=>(0,q.jsxs)(`li`,{className:`flex min-w-0 flex-wrap items-center gap-x-2 gap-y-0.5 text-sm`,children:[(0,q.jsxs)(`span`,{className:`flex min-w-0 max-w-full items-center gap-2`,children:[(0,q.jsx)(w,{type:e.task.taskType}),(0,q.jsx)(`span`,{className:`truncate font-medium`,children:e.task.title})]}),(0,q.jsx)(`span`,{className:C(`ml-auto shrink-0 text-xs`,u.danger),children:V(e)})]},e.task.id))})]})]})}function je({shown:e,entries:t,workspaces:n}){let r=I(e.period,t,n,e.timeZone),a=Math.max(1,...(r.completedPerMonth??[]).map(({count:e})=>e));return(0,q.jsxs)(`section`,{"aria-label":`Summary`,className:`flex flex-col gap-3 rounded-lg border p-3`,children:[(0,q.jsxs)(`dl`,{className:`flex flex-wrap gap-x-6 gap-y-2`,children:[r.outcomes.map(({outcome:e,count:t})=>(0,q.jsxs)(`div`,{className:`flex flex-col`,children:[(0,q.jsx)(`dt`,{className:`text-xs text-muted-foreground`,children:j[e]}),(0,q.jsx)(`dd`,{className:`text-lg font-semibold`,children:t})]},e)),r.notAdopted>0&&(0,q.jsxs)(`div`,{className:`flex flex-col`,children:[(0,q.jsx)(`dt`,{className:`text-xs text-muted-foreground`,children:`Not adopted`}),(0,q.jsx)(`dd`,{className:`text-lg font-semibold`,children:r.notAdopted})]}),(0,q.jsxs)(`div`,{className:`flex flex-col`,children:[(0,q.jsx)(`dt`,{className:`text-xs text-muted-foreground`,children:`Commits`}),(0,q.jsx)(`dd`,{className:`text-lg font-semibold`,children:r.commits})]})]}),(0,q.jsxs)(`dl`,{className:`grid gap-x-4 gap-y-1 text-sm sm:grid-cols-[auto_1fr]`,children:[L.map(e=>{let t=r[e];return(0,q.jsxs)(`div`,{className:`contents`,children:[(0,q.jsx)(`dt`,{className:`text-muted-foreground`,children:B[e]}),(0,q.jsx)(`dd`,{children:t===null?`No data`:`${R(t.median)} (${t.tasks} ${t.tasks===1?`task`:`tasks`})`})]},e)}),r.changes&&(0,q.jsxs)(`div`,{className:`contents`,children:[(0,q.jsx)(`dt`,{className:`text-muted-foreground`,children:`Changes in completed pull requests`}),(0,q.jsx)(`dd`,{children:N(r.changes)})]}),r.completedByType.length>0&&(0,q.jsxs)(`div`,{className:`contents`,children:[(0,q.jsx)(`dt`,{className:`text-muted-foreground`,children:`Completed by type`}),(0,q.jsx)(`dd`,{children:r.completedByType.map(({taskType:e,count:t})=>`${e} ${t}`).join(`, `)})]}),r.completedByWorkspace.length>0&&(0,q.jsxs)(`div`,{className:`contents`,children:[(0,q.jsx)(`dt`,{className:`text-muted-foreground`,children:`Completed by workspace`}),(0,q.jsx)(`dd`,{children:r.completedByWorkspace.map(({workspace:e,count:t})=>`${e} ${t}`).join(`, `)})]})]}),r.completedPerMonth&&(0,q.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,q.jsx)(`h3`,{className:`text-xs text-muted-foreground`,children:`Completed per month`}),(0,q.jsx)(`ul`,{"aria-label":`Completed per month`,className:`flex flex-col gap-0.5`,children:r.completedPerMonth.map(({month:e,count:t})=>(0,q.jsxs)(`li`,{className:`flex items-center gap-2 text-xs`,children:[(0,q.jsx)(`span`,{className:`w-16 shrink-0 font-mono text-muted-foreground`,children:e}),(0,q.jsx)(`span`,{"aria-hidden":!0,className:C(`h-2 rounded-sm`,i.success),style:{width:`${t/a*60}%`,minWidth:t>0?4:0}}),(0,q.jsx)(`span`,{children:t})]},e))})]})]})}export{Q as Review};
|