You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

237 lines
442 KiB

2 years ago
/*
3 years ago
THIS IS A GENERATED/BUNDLED FILE BY ESBUILD
3 years ago
if you want to view the source visit the plugins github repository
*/
/*
License obsidian-tasks:
MIT License
Copyright (c) 2021 Martin Schenck and Clare Macrae
3 years ago
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
*/
/*
License rrule (included library):
rrule.js: Library for working with recurrence rules for calendar dates.
=======================================================================
Copyright 2010, Jakub Roztocil <jakub@roztocil.name> and Lars Schöning
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
3. Neither the name of The author nor the names of its contributors may
be used to endorse or promote products derived from this software
without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE AUTHOR AND CONTRIBUTORS BE LIABLE FOR
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
./rrule.js and ./test/tests.js is based on python-dateutil. LICENCE:
python-dateutil - Extensions to the standard Python datetime module.
====================================================================
Copyright (c) 2003-2011 - Gustavo Niemeyer <gustavo@niemeyer.net>
Copyright (c) 2012 - Tomi Pieviläinen <tomi.pievilainen@iki.fi>
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
* Neither the name of the copyright holder nor the names of its
contributors may be used to endorse or promote products derived from
this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
/*
License chrono-node (included library):
The MIT License
Copyright (c) 2014, Wanasit Tanakitrungruang
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
*/
1 year ago
"use strict";var Ik=Object.create;var Bi=Object.defineProperty,Fk=Object.defineProperties,Lk=Object.getOwnPropertyDescriptor,Yk=Object.getOwnPropertyDescriptors,Uk=Object.getOwnPropertyNames,um=Object.getOwnPropertySymbols,Wk=Object.getPrototypeOf,cm=Object.prototype.hasOwnProperty,qk=Object.prototype.propertyIsEnumerable;var lm=(r,e,t)=>e in r?Bi(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,Pe=(r,e)=>{for(var t in e||(e={}))cm.call(e,t)&&lm(r,t,e[t]);if(um)for(var t of um(e))qk.call(e,t)&&lm(r,t,e[t]);return r},tr=(r,e)=>Fk(r,Yk(e));var O=(r,e)=>()=>(e||r((e={exports:{}}).exports,e),e.exports),jk=(r,e)=>{for(var t in e)Bi(r,t,{get:e[t],enumerable:!0})},dm=(r,e,t,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let s of Uk(e))!cm.call(r,s)&&s!==t&&Bi(r,s,{get:()=>e[s],enumerable:!(n=Lk(e,s))||n.enumerable});return r};var Ln=(r,e,t)=>(t=r!=null?Ik(Wk(r)):{},dm(e||!r||!r.__esModule?Bi(t,"default",{value:r,enumerable:!0}):t,r)),$k=r=>dm(Bi({},"__esModule",{value:!0}),r);var Q=(r,e,t)=>new Promise((n,s)=>{var a=c=>{try{l(t.next(c))}catch(f){s(f)}},o=c=>{try{l(t.throw(c))}catch(f){s(f)}},l=c=>c.done?n(c.value):Promise.resolve(c.value).then(a,o);l((t=t.apply(r,e)).next())});var Fe=O(Yn=>{"use strict";Object.defineProperty(Yn,"__esModule",{value:!0});Yn.matchAnyPattern=Yn.extractTerms=Yn.repeatedTimeunitPattern=void 0;function zk(r,e){let t=e.replace(/\((?!\?)/g,"(?:");return`${r}${t}\\s{0,5}(?:,?\\s{0,5}${t}){0,10}`}Yn.repeatedTimeunitPattern=zk;function fm(r){let e;return r instanceof Array?e=[...r]:r instanceof Map?e=Array.from(r.keys()):e=Object.keys(r),e}Yn.extractTerms=fm;function Vk(r){return`(?:${fm(r).sort((t,n)=>n.length-t.length).join("|").replace(/\./g,"\\.")})`}Yn.matchAnyPattern=Vk});var Re=O((jl,$l)=>{(function(r,e){typeof jl=="object"&&typeof $l!="undefined"?$l.exports=e():typeof define=="function"&&define.amd?define(e):(r=typeof globalThis!="undefined"?globalThis:r||self).dayjs=e()})(jl,function(){"use strict";var r=1e3,e=6e4,t=36e5,n="millisecond",s="second",a="minute",o="hour",l="day",c="week",f="month",p="quarter",g="year",T="date",S="Invalid Date",b=/^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/,x=/\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g,C={name:"en",weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_")},G=function(z,W,A){var ee=String(z);return!ee||ee.length>=W?z:""+Array(W+1-ee.length).join(A)+z},K={s:G,z:function(z){var W=-z.utcOffset(),A=Math.abs(W),ee=Math.floor(A/60),Y=A%60;return(W<=0?"+":"-")+G(ee,2,"0")+":"+G(Y,2,"0")},m:function z(W,A){if(W.date()<A.date())return-z(A,W);var ee=12*(A.year()-W.year())+(A.month()-W.month()),Y=W.clone().add(ee,f),ce=A-Y<0,y=W.clone().add(ee+(ce?-1:1),f);return+(-(ee+(A-Y)/(ce?Y-y:y-Y))||0)},a:function(z){return z<0?Math.ceil(z)||0:Math.floor(z)},p:function(z){return{M:f,y:g,w:c,d:l,D:T,h:o,m:a,s,ms:n,Q:p}[z]||String(z||"").toLowerCase().replace(/s$/,"")},u:function(z){return z===void 0}},B="en",de={};de[B]=C;var le=function(z){return z instanceof Ze},ye=function(z,W,A){var ee;if(!z)return B;if(typeof z=="string")de[z]&&(ee=z),W&&(de[z]=W,ee=z);else{var Y=z.name;de[Y]=z,ee=Y}return!A&&ee&&(B=ee),ee||!A&&B},te=function(z,W){if(le(z))return z.clone();var A=typeof W=="object"?W:{};return A.date=z,A.args=arguments,new Ze(A)},J=K;J.l=ye,J.i=le,J.w=function(z,W){return te(z,{locale:W.$L,utc:W.$u,x:W.$x,$offset:W.$offset})};var Ze=function(){function z(A){this.$L=ye(A.locale,null,!0),this.parse(A)}var W=z.prototype;return W.parse=function(A){this.$d=function(ee){var Y=ee.date,ce=ee.utc;if(Y===null)return new Date(NaN);if(J.u(Y))return new Date;if(Y instanceof Date)return new Date(Y);if(typeof Y=="string"&&!/Z$/i.test(Y)){var y=Y.match(b);if(y){var _=y[2]-1||0,w=(y[7]||"0").substring(0,3);return ce?new Date(Date.UTC(y[1],_,y[3]||1,y[4]||0,y[5]||0,y[6]||0,w)):new Date(y[1],_,y[3]||1,y[4]||0,y[5]||0,y[6]||0,w)}}return new Date(Y)}(A),
[`+v+"] ";for(R in arguments[0])a(arguments[0],R)&&(m+=R+": "+arguments[0][R]+", ");m=m.slice(0,-2)}else m=arguments[v];h.push(m)}te(i+`
Arguments: `+Array.prototype.slice.call(h).join("")+`
1 year ago
`+new Error().stack),d=!1}return u.apply(this,arguments)},u)}var Ze={};function tt(i,u){e.deprecationHandler!=null&&e.deprecationHandler(i,u),Ze[i]||(te(u),Ze[i]=!0)}e.suppressDeprecationWarnings=!1,e.deprecationHandler=null;function z(i){return typeof Function!="undefined"&&i instanceof Function||Object.prototype.toString.call(i)==="[object Function]"}function W(i){var u,d;for(d in i)a(i,d)&&(u=i[d],z(u)?this[d]=u:this["_"+d]=u);this._config=i,this._dayOfMonthOrdinalParseLenient=new RegExp((this._dayOfMonthOrdinalParse.source||this._ordinalParse.source)+"|"+/\d{1,2}/.source)}function A(i,u){var d=g({},i),h;for(h in u)a(u,h)&&(s(i[h])&&s(u[h])?(d[h]={},g(d[h],i[h]),g(d[h],u[h])):u[h]!=null?d[h]=u[h]:delete d[h]);for(h in i)a(i,h)&&!a(u,h)&&s(i[h])&&(d[h]=g({},d[h]));return d}function ee(i){i!=null&&this.set(i)}var Y;Object.keys?Y=Object.keys:Y=function(i){var u,d=[];for(u in i)a(i,u)&&d.push(u);return d};var ce={sameDay:"[Today at] LT",nextDay:"[Tomorrow at] LT",nextWeek:"dddd [at] LT",lastDay:"[Yesterday at] LT",lastWeek:"[Last] dddd [at] LT",sameElse:"L"};function y(i,u,d){var h=this._calendar[i]||this._calendar.sameElse;return z(h)?h.call(u,d):h}function _(i,u,d){var h=""+Math.abs(i),m=u-h.length,v=i>=0;return(v?d?"+":"":"-")+Math.pow(10,Math.max(0,m)).toString().substr(1)+h}var w=/(\[[^\[]*\])|(\\)?([Hh]mm(ss)?|Mo|MM?M?M?|Do|DDDo|DD?D?D?|ddd?d?|do?|w[o|w]?|W[o|W]?|Qo?|N{1,5}|YYYYYY|YYYYY|YYYY|YY|y{2,4}|yo?|gg(ggg?)?|GG(GGG?)?|e|E|a|A|hh?|HH?|kk?|mm?|ss?|S{1,9}|x|X|zz?|ZZ?|.)/g,k=/(\[[^\[]*\])|(\\)?(LTS|LT|LL?L?L?|l{1,4})/g,D={},M={};function E(i,u,d,h){var m=h;typeof h=="string"&&(m=function(){return this[h]()}),i&&(M[i]=m),u&&(M[u[0]]=function(){return _(m.apply(this,arguments),u[1],u[2])}),d&&(M[d]=function(){return this.localeData().ordinal(m.apply(this,arguments),i)})}function I(i){return i.match(/\[[\s\S]/)?i.replace(/^\[|\]$/g,""):i.replace(/\\/g,"")}function P(i){var u=i.match(w),d,h;for(d=0,h=u.length;d<h;d++)M[u[d]]?u[d]=M[u[d]]:u[d]=I(u[d]);return function(m){var v="",R;for(R=0;R<h;R++)v+=z(u[R])?u[R].call(m,i):u[R];return v}}function N(i,u){return i.isValid()?(u=q(u,i.localeData()),D[u]=D[u]||P(u),D[u](i)):i.localeData().invalidDate()}function q(i,u){var d=5;function h(m){return u.longDateFormat(m)||m}for(k.lastIndex=0;d>=0&&k.test(i);)i=i.replace(k,h),k.lastIndex=0,d-=1;return i}var Ee={LTS:"h:mm:ss A",LT:"h:mm A",L:"MM/DD/YYYY",LL:"MMMM D, YYYY",LLL:"MMMM D, YYYY h:mm A",LLLL:"dddd, MMMM D, YYYY h:mm A"};function ge(i){var u=this._longDateFormat[i],d=this._longDateFormat[i.toUpperCase()];return u||!d?u:(this._longDateFormat[i]=d.match(w).map(function(h){return h==="MMMM"||h==="MM"||h==="DD"||h==="dddd"?h.slice(1):h}).join(""),this._longDateFormat[i])}var fe="Invalid date";function Ie(){return this._invalidDate}var V="%d",qe=/\d{1,2}/;function ze(i){return this._ordinal.replace("%d",i)}var pt={future:"in %s",past:"%s ago",s:"a few seconds",ss:"%d seconds",m:"a minute",mm:"%d minutes",h:"an hour",hh:"%d hours",d:"a day",dd:"%d days",w:"a week",ww:"%d weeks",M:"a month",MM:"%d months",y:"a year",yy:"%d years"};function Mr(i,u,d,h){var m=this._relativeTime[d];return z(m)?m(i,u,d,h):m.replace(/%d/i,i)}function st(i,u){var d=this._relativeTime[i>0?"future":"past"];return z(d)?d(u):d.replace(/%s/i,u)}var je={};function mt(i,u){var d=i.toLowerCase();je[d]=je[d+"s"]=je[u]=i}function bt(i){return typeof i=="string"?je[i]||je[i.toLowerCase()]:void 0}function Rn(i){var u={},d,h;for(h in i)a(i,h)&&(d=bt(h),d&&(u[d]=i[h]));return u}var Yi={};function $e(i,u){Yi[i]=u}function Ws(i){var u=[],d;for(d in i)a(i,d)&&u.push({unit:d,priority:Yi[d]});return u.sort(function(h,m){return h.priority-m.priority}),u}function rs(i){return i%4===0&&i%100!==0||i%400===0}function yt(i){return i<0?Math.ceil(i)||0:Math.floor(i)}function he(i){var u=+i,d=0;return u!==0&&isFinite(u)&&(d=yt(u)),d}function Jr(i,u){return function(d){return d!=null?(ns(this,i,d),e.updateOffset(this,u),this):At(this,i)}}function At(i,u){return i.isValid()?i._d["get"+(i._isUTC?"UTC":"")+u]():NaN}function ns(i,u,d){i.isValid()&&!isNaN(d)&&(u==="FullYear"&&rs(i.y
`).map(_I).filter(function(t){return t!==null});return zt(zt({},e[0]),e[1])}function Za(r){var e={},t=/DTSTART(?:;TZID=([^:=]+?))?(?::|=)([^;\s]+)/i.exec(r);if(!t)return e;var n=t[1],s=t[2];return n&&(e.tzid=n),e.dtstart=se.untilStringToDate(s),e}function _I(r){if(r=r.replace(/^\s+|\s+$/,""),!r.length)return null;var e=/^([A-Z]+?)[:;]/.exec(r.toUpperCase());if(!e)return bb(r);var t=e[1];switch(t.toUpperCase()){case"RRULE":case"EXRULE":return bb(r);case"DTSTART":return Za(r);default:throw new Error("Unsupported RFC prop ".concat(t," in ").concat(r))}}function bb(r){var e=r.replace(/^RRULE:/i,""),t=Za(e),n=r.replace(/^(?:RRULE|EXRULE):/i,"").split(";");return n.forEach(function(s){var a=s.split("="),o=a[0],l=a[1];switch(o.toUpperCase()){case"FREQ":t.freq=ve[l.toUpperCase()];break;case"WKST":t.wkst=Dr[l.toUpperCase()];break;case"COUNT":case"INTERVAL":case"BYSETPOS":case"BYMONTH":case"BYMONTHDAY":case"BYYEARDAY":case"BYWEEKNO":case"BYHOUR":case"BYMINUTE":case"BYSECOND":var c=TI(l),f=o.toLowerCase();t[f]=c;break;case"BYWEEKDAY":case"BYDAY":t.byweekday=bI(l);break;case"DTSTART":case"TZID":var p=Za(r);t.tzid=p.tzid,t.dtstart=p.dtstart;break;case"UNTIL":t.until=se.untilStringToDate(l);break;case"BYEASTER":t.byeaster=Number(l);break;default:throw new Error("Unknown RRULE property '"+o+"'")}}),t}function TI(r){if(r.indexOf(",")!==-1){var e=r.split(",");return e.map(vb)}return vb(r)}function vb(r){return/^[+-]?\d+$/.test(r)?Number(r):r}function bI(r){var e=r.split(",");return e.map(function(t){if(t.length===2)return Dr[t];var n=t.match(/^([+-]?\d{1,2})([A-Z]{2})$/);if(!n||n.length<3)throw new SyntaxError("Invalid weekday string: ".concat(t));var s=Number(n[1]),a=n[2],o=Dr[a].weekday;return new ft(o,s)})}var Es=function(){function r(e,t){if(isNaN(e.getTime()))throw new RangeError("Invalid date passed to DateWithZone");this.date=e,this.tzid=t}return Object.defineProperty(r.prototype,"isUTC",{get:function(){return!this.tzid||this.tzid.toUpperCase()==="UTC"},enumerable:!1,configurable:!0}),r.prototype.toString=function(){var e=se.timeToUntilString(this.date.getTime(),this.isUTC);return this.isUTC?":".concat(e):";TZID=".concat(this.tzid,":").concat(e)},r.prototype.getTime=function(){return this.date.getTime()},r.prototype.rezonedDate=function(){var e;if(this.isUTC)return this.date;var t=Intl.DateTimeFormat().resolvedOptions().timeZone,n=new Date(this.date.toLocaleString(void 0,{timeZone:t})),s=new Date(this.date.toLocaleString(void 0,{timeZone:(e=this.tzid)!==null&&e!==void 0?e:"UTC"})),a=s.getTime()-n.getTime();return new Date(this.date.getTime()-a)},r}();function Xa(r){for(var e=[],t="",n=Object.keys(r),s=Object.keys(Ka),a=0;a<n.length;a++)if(n[a]!=="tzid"&&!!De(s,n[a])){var o=n[a].toUpperCase(),l=r[n[a]],c="";if(!(!Ve(l)||Ft(l)&&!l.length)){switch(o){case"FREQ":c=X.FREQUENCIES[r.freq];break;case"WKST":ar(l)?c=new ft(l).toString():c=l.toString();break;case"BYWEEKDAY":o="BYDAY",c=qT(l).map(function(S){return S instanceof ft?S:Ft(S)?new ft(S[0],S[1]):new ft(S)}).toString();break;case"DTSTART":t=vI(l,r.tzid);break;case"UNTIL":c=se.timeToUntilString(l,!r.tzid);break;default:if(Ft(l)){for(var f=[],p=0;p<l.length;p++)f[p]=String(l[p]);c=f.toString()}else c=String(l)}c&&e.push([o,c])}}var g=e.map(function(S){var b=S[0],x=S[1];return"".concat(b,"=").concat(x.toString())}).join(";"),T="";return g!==""&&(T="RRULE:".concat(g)),[t,T].filter(function(S){return!!S}).join(`
`)}function vI(r,e){return r?"DTSTART"+new Es(new Date(r),e).toString():""}function wI(r,e){return Array.isArray(r)?!Array.isArray(e)||r.length!==e.length?!1:r.every(function(t,n){return t.getTime()===e[n].getTime()}):r instanceof Date?e instanceof Date&&r.getTime()===e.getTime():r===e}var wb=function(){function r(){this.all=!1,this.before=[],this.after=[],this.between=[]}return r.prototype._cacheAdd=function(e,t,n){t&&(t=t instanceof Date?se.clone(t):se.cloneDates(t)),e==="all"?this.all=t:(n._value=t,this[e].push(n))},r.prototype._cacheGet=function(e,t){var n=!1,s=t?Object.keys(t):[],a=function(p){for(var g=0;g<s.length;g++){var T=s[g];if(!wI(t[T],p[T]))return!0}return!1},o=this[e];if(e==="all")n=this.all;else if(Ft(o))for(var l=0;l<o.length;l++){var c=o[l];if(!(s.length&&a(c))){n=c._value;break}}if(!n&&this.all){for(var f=new _n(e,t),l=0;l<this.all.length&&f.accept(this.all[l]);l++);n=f.getValue(),this._cacheAdd(e,n,t)}return Ft(n)?se.cloneDates(n):n instanceof Date?se.clone(n):n},r}();var kb=U(U(U(U(U(U(U(U(U(U(U(U(U([],ke(1,31),!0),ke(2,28),!0),ke(3,31),!0),ke(4,30),!0),ke(5,31),!0),ke(6,30),!0),ke(7,31),!0),ke(8,31),!0),ke(9,30),!0),ke(10,31),!0),ke(11,30),!0),ke(12,31),!0),ke(1,7),!0),Eb=U(U(U(U(U(U(U(U(U(U(U(U(U([],ke(1,31),!0),ke(2,29),!0),ke(3,31),!0),ke(4,30),!0),ke(5,31),!0),ke(6,30),!0),ke(7,31),!0),ke(8,31),!0),ke(9,30),!0),ke(10,31),!0),ke(11,30),!0),ke(12,31),!0),ke(1,7),!0),kI=Er(1,29),EI=Er(1,30),Bn=Er(1,31),Ut=Er(1,32),Db=U(U(U(U(U(U(U(U(U(U(U(U(U([],Ut,!0),EI,!0),Ut,!0),Bn,!0),Ut,!0),Bn,!0),Ut,!0),Ut,!0),Bn,!0),Ut,!0),Bn,!0),Ut,!0),Ut.slice(0,7),!0),Sb=U(U(U(U(U(U(U(U(U(U(U(U(U([],Ut,!0),kI,!0),Ut,!0),Bn,!0),Ut,!0),Bn,!0),Ut,!0),Ut,!0),Bn,!0),Ut,!0),Bn,!0),Ut,!0),Ut.slice(0,7),!0),DI=Er(-28,0),SI=Er(-29,0),zn=Er(-30,0),Wt=Er(-31,0),Ob=U(U(U(U(U(U(U(U(U(U(U(U(U([],Wt,!0),SI,!0),Wt,!0),zn,!0),Wt,!0),zn,!0),Wt,!0),Wt,!0),zn,!0),Wt,!0),zn,!0),Wt,!0),Wt.slice(0,7),!0),Mb=U(U(U(U(U(U(U(U(U(U(U(U(U([],Wt,!0),DI,!0),Wt,!0),zn,!0),Wt,!0),zn,!0),Wt,!0),Wt,!0),zn,!0),Wt,!0),zn,!0),Wt,!0),Wt.slice(0,7),!0),Rb=[0,31,60,91,121,152,182,213,244,274,305,335,366],xb=[0,31,59,90,120,151,181,212,243,273,304,334,365],Lh=function(){for(var r=[],e=0;e<55;e++)r=r.concat(Er(7));return r}();function Ab(r,e){var t=new Date(Date.UTC(r,0,1)),n=se.isLeapYear(r)?366:365,s=se.isLeapYear(r+1)?366:365,a=se.toOrdinal(t),o=se.getWeekday(t),l=zt(zt({yearlen:n,nextyearlen:s,yearordinal:a,yearweekday:o},OI(r)),{wnomask:null});if(or(e.byweekno))return l;l.wnomask=ke(0,n+7);var c,f,p=c=Yt(7-o+e.wkst,7);p>=4?(p=0,f=l.yearlen+Yt(o-e.wkst,7)):f=n-p;for(var g=Math.floor(f/7),T=Yt(f,7),S=Math.floor(g+T/4),b=0;b<e.byweekno.length;b++){var x=e.byweekno[b];if(x<0&&(x+=S+1),x>0&&x<=S){var C=void 0;x>1?(C=p+(x-1)*7,p!==c&&(C-=7-c)):C=p;for(var G=0;G<7&&(l.wnomask[C]=1,C++,l.wdaymask[C]!==e.wkst);G++);}}if(De(e.byweekno,1)){var C=p+S*7;if(p!==c&&(C-=7-c),C<n)for(var b=0;b<7&&(l.wnomask[C]=1,C+=1,l.wdaymask[C]!==e.wkst);b++);}if(p){var K=void 0;if(De(e.byweekno,-1))K=-1;else{var B=se.getWeekday(new Date(Date.UTC(r-1,0,1))),de=Yt(7-B.valueOf()+e.wkst,7),le=se.isLeapYear(r-1)?366:365,ye=void 0;de>=4?(de=0,ye=le+Yt(B-e.wkst,7)):ye=n-p,K=Math.floor(52+Yt(ye,7)/4)}if(De(e.byweekno,K))for(var C=0;C<p;C++)l.wnomask[C]=1}return l}function OI(r){var e=se.isLeapYear(r)?366:365,t=new Date(Date.UTC(r,0,1)),n=se.getWeekday(t);return e===365?{mmask:kb,mdaymask:Sb,nmdaymask:Mb,wdaymask:Lh.slice(n),mrange:xb}:{mmask:Eb,mdaymask:Db,nmdaymask:Ob,wdaymask:Lh.slice(n),mrange:Rb}}function Pb(r,e,t,n,s,a){var o={lastyear:r,lastmonth:e,nwdaymask:[]},l=[];if(a.freq===X.YEARLY)if(or(a.bymonth))l=[[0,t]];else for(var c=0;c<a.bymonth.length;c++)e=a.bymonth[c],l.push(n.slice(e-1,e+1));else a.freq===X.MONTHLY&&(l=[n.slice(e-1,e+1)]);if(or(l))return o;o.nwdaymask=ke(0,t);for(var c=0;c<l.length;c++)for(var f=l[c],p=f[0],g=f[1]-1,T=0;T<a.bynweekday.length;T++){var S=void 0,b=a.bynweekday[T],x=b[0],C=b[1];C<0?(S=g+(C+1)*7,S-=Yt(s[S]-x,7)):(S=p+(C-1)*7,S+=Yt(7-s[S]+x,7)),p<=S&&S<=g&&(o.nwdaymask[S]=1)}return o}function Nb(r,e){e===void 0&&(e=0);var t=r%19,n=Math.floor(r/100),s=r%100,a=M
`),n=0;n<t.length;){var s=t[n]=t[n].replace(/\s+$/g,"");s?n>0&&s[0]===" "?(t[n-1]+=s.slice(1),t.splice(n,1)):n+=1:t.splice(n,1)}return t}function YI(r){r.forEach(function(e){if(!/(VALUE=DATE(-TIME)?)|(TZID=)/.test(e))throw new Error("unsupported RDATE/EXDATE parm: "+e)})}function Ub(r,e){return YI(e),r.split(",").map(function(t){return se.untilStringToDate(t)})}function Wb(r){var e=this;return function(t){if(t!==void 0&&(e["_".concat(r)]=t),e["_".concat(r)]!==void 0)return e["_".concat(r)];for(var n=0;n<e._rrule.length;n++){var s=e._rrule[n].origOptions[r];if(s)return s}}}var Uh=function(r){pi(e,r);function e(t){t===void 0&&(t=!1);var n=r.call(this,{},t)||this;return n.dtstart=Wb.apply(n,["dtstart"]),n.tzid=Wb.apply(n,["tzid"]),n._rrule=[],n._rdate=[],n._exrule=[],n._exdate=[],n}return e.prototype._iter=function(t){return Lb(t,this._rrule,this._exrule,this._rdate,this._exdate,this.tzid())},e.prototype.rrule=function(t){qb(t,this._rrule)},e.prototype.exrule=function(t){qb(t,this._exrule)},e.prototype.rdate=function(t){jb(t,this._rdate)},e.prototype.exdate=function(t){jb(t,this._exdate)},e.prototype.rrules=function(){return this._rrule.map(function(t){return Pu(t.toString())})},e.prototype.exrules=function(){return this._exrule.map(function(t){return Pu(t.toString())})},e.prototype.rdates=function(){return this._rdate.map(function(t){return new Date(t.getTime())})},e.prototype.exdates=function(){return this._exdate.map(function(t){return new Date(t.getTime())})},e.prototype.valueOf=function(){var t=[];return!this._rrule.length&&this._dtstart&&(t=t.concat(Xa({dtstart:this._dtstart}))),this._rrule.forEach(function(n){t=t.concat(n.toString().split(`
2 years ago
`))}),this._exrule.forEach(function(n){t=t.concat(n.toString().split(`
1 year ago
`).map(function(s){return s.replace(/^RRULE:/,"EXRULE:")}).filter(function(s){return!/^DTSTART/.test(s)}))}),this._rdate.length&&t.push($b("RDATE",this._rdate,this.tzid())),this._exdate.length&&t.push($b("EXDATE",this._exdate,this.tzid())),t},e.prototype.toString=function(){return this.valueOf().join(`
`)},e.prototype.clone=function(){var t=new e(!!this._cache);return this._rrule.forEach(function(n){return t.rrule(n.clone())}),this._exrule.forEach(function(n){return t.exrule(n.clone())}),this._rdate.forEach(function(n){return t.rdate(new Date(n.getTime()))}),this._exdate.forEach(function(n){return t.exdate(new Date(n.getTime()))}),t},e}(X);function qb(r,e){if(!(r instanceof X))throw new TypeError(String(r)+" is not RRule instance");De(e.map(String),String(r))||e.push(r)}function jb(r,e){if(!(r instanceof Date))throw new TypeError(String(r)+" is not Date instance");De(e.map(Number),Number(r))||(e.push(r),se.sort(e))}function $b(r,e,t){var n=!t||t.toUpperCase()==="UTC",s=n?"".concat(r,":"):"".concat(r,";TZID=").concat(t,":"),a=e.map(function(o){return se.timeToUntilString(o.valueOf(),n)}).join(",");return"".concat(s).concat(a)}function Vr(r,e){return r!==null&&e===null?-1:r===null&&e!==null?1:r!==null&&e!==null?r.isValid()&&!e.isValid()?-1:!r.isValid()&&e.isValid()||r.isAfter(e)?1:r.isBefore(e)?-1:0:0}var Rt=class{constructor({rrule:e,baseOnToday:t,referenceDate:n,startDate:s,scheduledDate:a,dueDate:o}){this.rrule=e,this.baseOnToday=t,this.referenceDate=n,this.startDate=s,this.scheduledDate=a,this.dueDate=o}static fromText({recurrenceRuleText:e,startDate:t,scheduledDate:n,dueDate:s}){try{let a=e.match(/^([a-zA-Z0-9, !]+?)( when done)?$/i);if(a==null)return null;let o=a[1].trim(),l=a[2]!==void 0,c=X.parseText(o);if(c!==null){let f=null;s?f=window.moment(s):n?f=window.moment(n):t&&(f=window.moment(t)),!l&&f!==null?c.dtstart=window.moment(f).startOf("day").utc(!0).toDate():c.dtstart=window.moment().startOf("day").utc(!0).toDate();let p=new X(c);return new Rt({rrule:p,baseOnToday:l,referenceDate:f,startDate:t,scheduledDate:n,dueDate:s})}}catch(a){}return null}toText(){let e=this.rrule.toText();return this.baseOnToday&&(e+=" when done"),e}next(){let e=this.nextReferenceDate();if(e!==null){let t=null,n=null,s=null;if(this.referenceDate){if(this.startDate){let a=window.moment.duration(this.startDate.diff(this.referenceDate));t=window.moment(e),t.add(Math.round(a.asDays()),"days")}if(this.scheduledDate){let a=window.moment.duration(this.scheduledDate.diff(this.referenceDate));n=window.moment(e),n.add(Math.round(a.asDays()),"days")}if(this.dueDate){let a=window.moment.duration(this.dueDate.diff(this.referenceDate));s=window.moment(e),s.add(Math.round(a.asDays()),"days")}}return{startDate:t,scheduledDate:n,dueDate:s}}return null}identicalTo(e){return this.baseOnToday!==e.baseOnToday||Vr(this.startDate,e.startDate)!==0||Vr(this.scheduledDate,e.scheduledDate)!==0||Vr(this.dueDate,e.dueDate)!==0?!1:this.toText()===e.toText()}nextReferenceDate(){if(this.baseOnToday){let e=window.moment();return this.nextReferenceDateFromToday(e).toDate()}else return this.nextReferenceDateFromOriginalReferenceDate().toDate()}nextReferenceDateFromToday(e){let t=new X(tr(Pe({},this.rrule.origOptions),{dtstart:e.startOf("day").utc(!0).toDate()}));return this.nextAfter(e.endOf("day"),t)}nextReferenceDateFromOriginalReferenceDate(){var t;let e=window.moment((t=this.referenceDate)!=null?t:void 0).endOf("day");return this.nextAfter(e,this.rrule)}nextAfter(e,t){e.utc(!0);let n=window.moment(t.after(e.toDate())),s=this.toText(),a=s.match(/every( \d+)? month(s)?(.*)?/);a!==null&&(s.includes(" on ")||(n=Rt.nextAfterMonths(e,n,t,a[1])));let o=s.match(/every( \d+)? year(s)?(.*)?/);return o!==null&&(n=Rt.nextAfterYears(e,n,t,o[1])),Rt.addTimezone(n)}static nextAfterMonths(e,t,n,s){let a=1;for(s!==void 0&&(a=Number.parseInt(s.trim(),10));Rt.isSkippingTooManyMonths(e,t,a);)t=Rt.fromOneDayEarlier(e,n);return t}static isSkippingTooManyMonths(e,t,n){let s=t.month()-e.month();return s+=(t.year()-e.year())*12,s>n}static nextAfterYears(e,t,n,s){let a=1;for(s!==void 0&&(a=Number.parseInt(s.trim(),10));Rt.isSkippingTooManyYears(e,t,a);)t=Rt.fromOneDayEarlier(e,n);return t}static isSkippingTooManyYears(e,t,n){return t.year()-e.year()>n}static fromOneDayEarlier(e,t){e.subtract(1,"days").endOf("day");let n=t.origOptions;return n.dtstart=e.startOf("day").toDate(),t=new X(n),wind
`}),o=o.slice(0,a.autoSuggestMaxItems),o}}function UI(r,e,t,n){let s=c=>Object.values(n.prioritySymbols).some(f=>f.length>0&&c.includes(f)),a=[];if(r.includes(n.dueDateSymbol)||a.push({displayText:`${n.dueDateSymbol} due date`,appendText:`${n.dueDateSymbol} `}),r.includes(n.startDateSymbol)||a.push({displayText:`${n.startDateSymbol} start date`,appendText:`${n.startDateSymbol} `}),r.includes(n.scheduledDateSymbol)||a.push({displayText:`${n.scheduledDateSymbol} scheduled date`,appendText:`${n.scheduledDateSymbol} `}),s(r)||(a.push({displayText:`${n.prioritySymbols.High} high priority`,appendText:`${n.prioritySymbols.High} `}),a.push({displayText:`${n.prioritySymbols.Medium} medium priority`,appendText:`${n.prioritySymbols.Medium} `}),a.push({displayText:`${n.prioritySymbols.Low} low priority`,appendText:`${n.prioritySymbols.Low} `}),a.push({displayText:`${n.prioritySymbols.Highest} highest priority`,appendText:`${n.prioritySymbols.Highest} `}),a.push({displayText:`${n.prioritySymbols.Lowest} lowest priority`,appendText:`${n.prioritySymbols.Lowest} `})),r.includes(n.recurrenceSymbol)||a.push({displayText:`${n.recurrenceSymbol} recurring (repeat)`,appendText:`${n.recurrenceSymbol} `}),!r.includes(n.createdDateSymbol)){let f=ir.parseDate("today",!0).format(ie.dateFormat);a.push({textToMatch:`${n.createdDateSymbol} created`,displayText:`${n.createdDateSymbol} created today (${f})`,appendText:`${n.createdDateSymbol} ${f} `})}let o=jh(r,/([a-zA-Z'_-]*)/g,e),l=[];if(o&&o.length>0){let c=o[0];if(c.length>=Math.max(1,t.autoSuggestMinMatch)){let f=a.filter(p=>(p.textToMatch||p.displayText).toLowerCase().includes(c.toLowerCase()));for(let p of f)l.push({suggestionType:"match",displayText:p.displayText,appendText:p.appendText,insertAt:o.index,insertSkip:c.length})}}return l.length===0&&t.autoSuggestMinMatch===0?a:l}function WI(r,e,t,n,s){let a=["today","tomorrow","Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday","next week","next month","next year"],o=[],l=new RegExp(`(${n})\\s*([0-9a-zA-Z ]*)`,"ug"),c=jh(r,l,e);if(c&&c.length>=2){let f=c[1],p=c[2];if(p.length<t.autoSuggestMinMatch)return[];let g=p&&p.length>1?ir.parseDate(fi(p),!0):null;g&&g.isValid()&&o.push({displayText:`${g.format(ie.dateFormat)}`,appendText:`${f} ${g.format(ie.dateFormat)} `,insertAt:c.index,insertSkip:c[0].length});let T=1,S=a.filter(b=>p&&p.length>=T&&b.toLowerCase().includes(p.toLowerCase())).slice(0,s);S.length===0&&(S=a.slice(0,s));for(let b of S){let C=`${ir.parseDate(b,!0).format(ie.dateFormat)}`;o.push({suggestionType:"match",displayText:`${b} (${C})`,appendText:`${f} ${C} `,insertAt:c.index,insertSkip:c[0].length})}}return o}function qI(r,e,t,n){var c;let s=["every","every day","every week","every month","every month on the","every year","every week on Sunday","every week on Monday","every week on Tuesday","every week on Wednesday","every week on Thursday","every week on Friday","every week on Saturday"],a=[],o=new RegExp(`(${n})\\s*([0-9a-zA-Z ]*)`,"ug"),l=jh(r,o,e);if(l&&l.length>=2){let f=l[1],p=l[2];if(p.length<t.autoSuggestMinMatch)return[];if(p.length>0){let b=(c=Rt.fromText({recurrenceRuleText:p,startDate:null,scheduledDate:null,dueDate:null}))==null?void 0:c.toText();if(b){let x=`${f} ${b} `;if(a.push({suggestionType:"match",displayText:`\u2705 ${b}`,appendText:x,insertAt:l.index,insertSkip:l[0].length}),l[0]==x)return[]}}let g=1,T=t.autoSuggestMaxItems/2,S=s.filter(b=>p&&p.length>=g&&b.toLowerCase().includes(p.toLowerCase())).slice(0,T);S.length===0&&p.trim().length===0&&(S=s.slice(0,T));for(let b of S)a.push({suggestionType:"match",displayText:`${b}`,appendText:`${f} ${b} `,insertAt:l.index,insertSkip:l[0].length})}return a}function jh(r,e,t){let n=r.matchAll(e);for(let s of n)if((s==null?void 0:s.index)&&s.index<=t&&t<=s.index+s[0].length)return s}var Ja=class{constructor(){this.hideTaskCount=!1;this.hideBacklinks=!1;this.hidePriority=!1;this.hideCreatedDate=!1;this.hideStartDate=!1;this.hideScheduledDate=!1;this.hideDoneDate=!1;this.hideDueDate=!1;this.hideRecurrenceRule=!1;this.hideEditButton=!1;this.hideUrgency=!0;thi
2 years ago
The task line not updated is:
${r.originalMarkdown}
In this markdown file:
"${r.taskLocation.path}"
Note: further clicks on this checkbox will usually now be ignored until the file is opened (or certain, specific edits are made - it's complicated).
Recommendations:
1. Close all panes that have the above file open, and then re-open the file.
2. Check for exactly identical copies of the task line, in this file, and see if you can make them different.
1 year ago
`;Lu(f);return}let c=Math.min(Math.pow(10,a),100);no.debug(`timeout = ${c}`),setTimeout(()=>{ev({originalTask:r,newTasks:e,vault:t,metadataCache:n,workspace:s,previousTries:a+1})},c)};try{let[c,f,p]=yield tv(r,t),g=[...p.slice(0,c),...e.map(T=>T.toFileLineString()),...p.slice(c+1)];yield t.modify(f,g.join(`
`))}catch(c){if(c instanceof Zn)return c.message&&Jb(c.message),l();if(c instanceof Yu)return l();c instanceof Error&&Lu(c.message)}});function tv(r,e){return Q(this,null,function*(){if(ro===void 0)throw new Zn;let t=e.getAbstractFileByPath(r.path);if(!(t instanceof so.TFile))throw new Zn(`Tasks: No file found for task ${r.description}. Retrying ...`);if(!HI.includes(t.extension))throw new Error(`Tasks: Does not support files with the ${t.extension} file extension.`);let n=ro.getFileCache(t);if(n==null||n===null)throw new Zn(`Tasks: No file cache found for file ${t.path}. Retrying ...`);let s=n.listItems;if(s===void 0||s.length===0)throw new Zn(`Tasks: No list items found in file cache of ${t.path}. Retrying ...`);let o=(yield e.read(t)).split(`
`),l=zI(r,o,s,BI);if(l===void 0)throw new Yu;return[l,t,o]})}function Zh(r,e){return Q(this,null,function*(){try{let[t,n,s]=yield tv(r,e);return[t,n]}catch(t){t instanceof Zn?t.message&&Jb(t.message):t instanceof Error&&Lu(t.message)}})}function rv(r,e){return r<e.length}function zI(r,e,t,n){let s=VI(r,e);return s!==void 0||(s=KI(r,e),s!==void 0)?s:ZI(r,e,t,n)}function VI(r,e){let t=r.taskLocation.lineNumber;if(rv(t,e)&&e[t]===r.originalMarkdown)return no.debug(`Found original markdown at original line number ${t}`),t}function KI(r,e){let t=[];for(let n=0;n<e.length;n++)e[n]===r.originalMarkdown&&t.push(n);if(t.length===1)return t[0]}function ZI(r,e,t,n){let s,a=0;for(let o of t){let l=o.position.start.line;if(!rv(l,e))return;if(l<r.taskLocation.sectionStart||o.task===void 0)continue;let c=e[l];if(Le.includedIn(c)){if(a===r.taskLocation.sectionIndex){if(c===r.originalMarkdown)s=l;else{n(`Tasks: Unable to find task in file ${r.taskLocation.path}.
2 years ago
Expected task:
${r.originalMarkdown}
Found task:
1 year ago
${c}`);return}break}a++}}return s}var Qn={description:"task-description",priority:"task-priority",dueDate:"task-due",startDate:"task-start",createdDate:"task-created",scheduledDate:"task-scheduled",doneDate:"task-done",recurrenceRule:"task-recurring",blockLink:""},QI=7,XI="far";function JI(r,e,t,n){return Q(this,null,function*(){if(!n)throw new Error("Must call the Obsidian renderer with an Obsidian Component object");yield nv.MarkdownRenderer.renderMarkdown(r,e,t,n)})}function sv(r,e,t=null){return Q(this,null,function*(){var l;t||(t=JI);let n=document.createElement("li");e.parentUlElement.appendChild(n),n.classList.add("task-list-item","plugin-tasks-list-item");let s=document.createElement("span");n.appendChild(s),s.classList.add("tasks-list-text");let a=yield eF(r,e,s,t);for(let c in a)n.dataset[c]=a[c];let o=document.createElement("input");return n.appendChild(o),o.classList.add("task-list-item-checkbox"),o.type="checkbox",r.status.symbol!==" "&&(o.checked=!0,n.classList.add("is-checked")),o.addEventListener("click",c=>{c.preventDefault(),c.stopPropagation(),o.disabled=!0;let f=r.toggleWithRecurrenceInUsersOrder();Uu({originalTask:r,newTasks:f})}),n.prepend(o),n.setAttribute("data-task",r.status.symbol.trim()),n.setAttribute("data-line",e.listIndex.toString()),n.setAttribute("data-task-status-name",r.status.name),n.setAttribute("data-task-status-type",r.status.type),o.setAttribute("data-line",e.listIndex.toString()),(l=e.layoutOptions)!=null&&l.shortMode&&iF({task:r,element:s,isFilenameUnique:e.isFilenameUnique}),n})}function eF(r,e,t,n){return Q(this,null,function*(){let s={},a=new Vn(e.layoutOptions),o=bn.tasksPluginEmoji.taskSerializer;for(let l of a.layoutComponents){let c=o.componentToString(r,a,l);if(c){l==="description"&&(c=Le.removeAsSubstringFromDependingOnSettings(c));let f=document.createElement("span");if(t.appendChild(f),f){let p=document.createElement("span");f.appendChild(p),yield tF(p,c,l,r,n,e.obsidianComponent);let[g,T]=Qh(l,r);rF(l,p),f.classList.add(...g);for(let S in T)f.dataset[S]=T[S];s=Pe(Pe({},s),T)}}}for(let l of a.hiddenComponents){let[c,f]=Qh(l,r);s=Pe(Pe({},s),f)}if(s.taskPriority===void 0){let[l,c]=Qh("priority",r);s=Pe(Pe({},s),c)}return s})}function tF(r,e,t,n,s,a){return Q(this,null,function*(){if(t==="description"){let{debugSettings:o}=ue();o.showTaskHiddenData&&(e+=`<br>\u{1F41B} <b>${n.lineNumber}</b> . ${n.sectionStart} . ${n.sectionIndex} . '<code>${n.originalMarkdown}</code>'<br>'<code>${n.path}</code>' > '<code>${n.precedingHeader}</code>'<br>`),yield s(e,r,n.path,a);let l=r.querySelector("blockquote"),c=l!=null?l:r,f=c.querySelector("p");if(f!==null){for(;f.firstChild;)c.insertBefore(f.firstChild,f);f.remove()}r.querySelectorAll("p").forEach(p=>{p.hasChildNodes()||p.remove()}),r.querySelectorAll(".footnotes").forEach(p=>{p.remove()})}else r.innerHTML=e})}function Qh(r,e){let t=[],n={},s=(a,o)=>{let l=nF(a);l&&(n[o]=l)};switch(r){case"description":t.push(Qn.description);break;case"priority":{let a=null;e.priority==="0"?a="highest":e.priority==="1"?a="high":e.priority==="2"?a="medium":e.priority==="4"?a="low":e.priority==="5"?a="lowest":a="normal",n.taskPriority=a,t.push(Qn.priority);break}case"createdDate":{let a=e.createdDate;a&&(t.push(Qn.createdDate),s(a,"taskCreated"));break}case"dueDate":{let a=e.dueDate;a&&(t.push(Qn.dueDate),s(a,"taskDue"));break}case"startDate":{let a=e.startDate;a&&(t.push(Qn.startDate),s(a,"taskStart"));break}case"scheduledDate":{let a=e.scheduledDate;a&&(t.push(Qn.scheduledDate),s(a,"taskScheduled"));break}case"doneDate":{let a=e.doneDate;a&&(t.push(Qn.doneDate),s(a,"taskDone"));break}case"recurrenceRule":{t.push(Qn.recurrenceRule);break}}return[t,n]}function rF(r,e){if(r==="description"){let t=e.getElementsByClassName("tag");for(let n=0;n<t.length;n++){let s=t[n].textContent;if(s){let a=sF(s),o=t[n];a&&(o.dataset.tagName=a)}}}}function nF(r){let e=window.moment().startOf("day"),t="",n=e.diff(r,"days");return isNaN(n)?null:n===0?"today":(n>0?t+="past-":n<0&&(t+="future-"),Math.abs(n)<=QI?t+=Math.abs(n).toString()+"d":t+=XI,t)}function sF(r){let e=/[
`),l=o.length,c=new ao(()=>Jt.fromPath(s.path)),f=null,p=0;for(let g of t)if(g.task!==void 0){let T=g.position.start.line;if(T>=l)return console.log(`${s.path} Obsidian gave us a line number ${T} past the end of the file. ${l}.`),a;if((f===null||f.position.end.line<T)&&(f=Ms.getSection(T,n.sections),p=0),f===null)continue;let S=o[T];if(S===void 0){console.log(`${s.path}: line ${T} - ignoring 'undefined' line.`);continue}let b;try{b=Ge.fromLine({line:S,taskLocation:new Lt(s.path,T,f.position.start.line,p,Ms.getPrecedingHeader(T,n.headings)),fallbackDate:c.value})}catch(x){this.reportTaskParsingErrorToUser(x,s,g,S);continue}b!==null&&(p++,a.push(b))}return a}reportTaskParsingErrorToUser(e,t,n,s){let a=`There was an error reading one of the tasks in this vault.
The following task has been ignored, to prevent Tasks queries getting stuck with 'Loading Tasks ...'
Error: ${e}
File: ${t.path}
Line number: ${n.position.start.line}
2 years ago
Task line: ${s}
Please create a bug report for this message at
https://github.com/obsidian-tasks-group/obsidian-tasks/issues/new/choose
to help us find and fix the underlying issue.
Include:
- either a screenshot of the error popup, or copy the text from the console, if on a desktop machine.
- the output from running the Obsidian command 'Show debug info'
The error popup will only be shown when Tasks is starting up, but if the error persists,
it will be shown in the console every time this file is edited during the Obsidian
session.
1 year ago
`;console.error(a),e instanceof Error&&console.error(e.stack),this.state==="Initializing"&&new gi.Notice(a,1e4)}static getSection(e,t){if(t===void 0)return null;for(let n of t)if(n.position.start.line<=e&&n.position.end.line>=e)return n;return null}static getPrecedingHeader(e,t){if(t===void 0)return null;let n=null;for(let s of t){if(s.position.start.line>e)return n;n=s.heading}return n}};var up=require("obsidian");var kv=require("obsidian");function wn(){}function ep(r){return r()}function av(){return Object.create(null)}function xs(r){r.forEach(ep)}function Wu(r){return typeof r=="function"}function uv(r,e){return r!=r?e==e:r!==e||r&&typeof r=="object"||typeof r=="function"}function lv(r){return Object.keys(r).length===0}var cv=typeof window!="undefined"?window:typeof globalThis!="undefined"?globalThis:global,uo=class{constructor(e){this.options=e,this._listeners="WeakMap"in cv?new WeakMap:void 0}observe(e,t){return this._listeners.set(e,t),this._getObserver().observe(e,this.options),()=>{this._listeners.delete(e),this._observer.unobserve(e)}}_getObserver(){var e;return(e=this._observer)!==null&&e!==void 0?e:this._observer=new ResizeObserver(t=>{var n;for(let s of t)uo.entries.set(s.target,s),(n=this._listeners.get(s.target))===null||n===void 0||n(s)})}};uo.entries="WeakMap"in cv?new WeakMap:void 0;var dv=!1;function aF(){dv=!0}function oF(){dv=!1}function L(r,e){r.appendChild(e)}function vi(r,e,t){r.insertBefore(e,t||null)}function As(r){r.parentNode&&r.parentNode.removeChild(r)}function tp(r,e){for(let t=0;t<r.length;t+=1)r[t]&&r[t].d(e)}function ae(r){return document.createElement(r)}function uF(r){return document.createElementNS("http://www.w3.org/2000/svg",r)}function qt(r){return document.createTextNode(r)}function Se(){return qt(" ")}function Vt(r,e,t,n){return r.addEventListener(e,t,n),()=>r.removeEventListener(e,t,n)}function fv(r){return function(e){return e.preventDefault(),r.call(this,e)}}function H(r,e,t){t==null?r.removeAttribute(e):r.getAttribute(e)!==t&&r.setAttribute(e,t)}function hv(r){let e;return{p(...t){e=t,e.forEach(n=>r.push(n))},r(){e.forEach(t=>r.splice(r.indexOf(t),1))}}}function lF(r){return Array.from(r.childNodes)}function rp(r,e){e=""+e,r.data!==e&&(r.data=e)}function Yr(r,e){r.value=e==null?"":e}function np(r,e,t){for(let n=0;n<r.options.length;n+=1){let s=r.options[n];if(s.__value===e){s.selected=!0;return}}(!t||e!==void 0)&&(r.selectedIndex=-1)}function pv(r){let e=r.querySelector(":checked");return e&&e.__value}function Ur(r,e,t){r.classList[t?"add":"remove"](e)}var Rs=class{constructor(e=!1){this.is_svg=!1,this.is_svg=e,this.e=this.n=null}c(e){this.h(e)}m(e,t,n=null){this.e||(this.is_svg?this.e=uF(t.nodeName):this.e=ae(t.nodeType===11?"TEMPLATE":t.nodeName),this.t=t.tagName!=="TEMPLATE"?t:t.content,this.c(e)),this.i(n)}h(e){this.e.innerHTML=e,this.n=Array.from(this.e.nodeName==="TEMPLATE"?this.e.content.childNodes:this.e.childNodes)}i(e){for(let t=0;t<this.n.length;t+=1)vi(this.t,this.n[t],e)}p(e){this.d(),this.h(e),this.i(this.a)}d(){this.n.forEach(As)}};var lo;function oo(r){lo=r}function cF(){if(!lo)throw new Error("Function called outside component initialization");return lo}function sp(r){cF().$$.on_mount.push(r)}var Ti=[];var qu=[],bi=[],ov=[],dF=Promise.resolve(),Jh=!1;function fF(){Jh||(Jh=!0,dF.then(mv))}function co(r){bi.push(r)}var Xh=new Set,_i=0;function mv(){if(_i!==0)return;let r=lo;do{try{for(;_i<Ti.length;){let e=Ti[_i];_i++,oo(e),hF(e.$$)}}catch(e){throw Ti.length=0,_i=0,e}for(oo(null),Ti.length=0,_i=0;qu.length;)qu.pop()();for(let e=0;e<bi.length;e+=1){let t=bi[e];Xh.has(t)||(Xh.add(t),t())}bi.length=0}while(Ti.length);for(;ov.length;)ov.pop()();Jh=!1,Xh.clear(),oo(r)}function hF(r){if(r.fragment!==null){r.update(),xs(r.before_update);let e=r.dirty;r.dirty=[-1],r.fragment&&r.fragment.p(r.ctx,e),r.after_update.forEach(co)}}function pF(r){let e=[],t=[];bi.forEach(n=>r.indexOf(n)===-1?e.push(n):t.push(n)),t.forEach(n=>n()),bi=e}var mF=new Set;function yF(r,e){r&&r.i&&(mF.delete(r),r.i(e))}var gF=["allowfullscreen","allowpaymentrequest","async","autofocus","autoplay","
<span class="accesskey-first">future</span> dates:`,Yi=Se(),$e=ae("input"),rs=Se(),yt=ae("div"),he=ae("label"),he.innerHTML='Stat<span class="accesskey">u</span>s',Jr=Se(),At=ae("select");for(let j=0;j<Qe.length;j+=1)Qe[j].c();yo=Se(),qr=ae("div"),xn=ae("div"),vt=ae("label"),vt.textContent="Completed:",Ui=Se(),fr=ae("input"),Ye=Se(),An=ae("div"),qs=ae("span"),qs.textContent="Created on:",ss=Se(),Pn=ae("code"),is=Se(),hr=ae("div"),Nn=ae("span"),Nn.textContent="Done on:",go=Se(),tn=ae("code"),_o=Se(),pr=ae("div"),mr=ae("button"),$=qt("Apply"),To=Se(),gt=ae("button"),gt.textContent="Cancel",H(s,"for","description"),H(o,"id","description"),H(o,"type","text"),H(o,"class","tasks-modal-description"),H(o,"placeholder","Take out the trash"),H(o,"accesskey",l=r[15]("t")),H(n,"class","tasks-modal-section"),H(p,"for",T="priority-"+r[1].priority),H(f,"class","tasks-modal-section tasks-modal-priorities"),H(C,"for","recurrence"),H(C,"class","accesskey-first"),H(K,"id","recurrence"),H(K,"type","text"),H(K,"placeholder","Try 'every 2 weeks on Thursday'."),H(K,"accesskey",B=r[15]("r")),Ur(K,"tasks-modal-error",!r[8]),J.a=null,H(tt,"for","due"),H(tt,"class","accesskey-first"),H(W,"id","due"),H(W,"type","text"),H(W,"placeholder",ip),H(W,"accesskey",A=r[15]("d")),Ur(W,"tasks-modal-error",!r[7]),_.a=null,H(k,"for","scheduled"),H(k,"class","accesskey-first"),H(M,"id","scheduled"),H(M,"type","text"),H(M,"placeholder",ip),H(M,"accesskey",E=r[15]("s")),Ur(M,"tasks-modal-error",!r[5]),Ee.a=null,H(fe,"for","start"),H(V,"id","start"),H(V,"type","text"),H(V,"placeholder",ip),H(V,"accesskey",qe=r[15]("a")),Ur(V,"tasks-modal-error",!r[3]),je.a=null,H(Rn,"for","forwardOnly"),H($e,"id","forwardOnly"),H($e,"type","checkbox"),H($e,"class","task-list-item-checkbox tasks-modal-checkbox"),H($e,"accesskey",Ws=r[15]("f")),H(x,"class","tasks-modal-section tasks-modal-dates"),H(he,"for","status"),H(At,"id","status-type"),H(At,"class","dropdown"),H(At,"accesskey",ns=r[15]("u")),r[1].status===void 0&&co(()=>r[39].call(At)),H(yt,"class","tasks-modal-section"),H(vt,"for","status"),H(fr,"id","status"),H(fr,"type","checkbox"),H(fr,"class","task-list-item-checkbox tasks-modal-checkbox"),fr.checked=en=r[1].status.isCompleted(),fr.disabled=!0,H(qr,"class","tasks-modal-section tasks-modal-status"),mr.disabled=js=!r[14],H(mr,"type","submit"),H(mr,"class","mod-cta"),H(gt,"type","button"),H(pr,"class","tasks-modal-section tasks-modal-buttons"),Ur(t,"with-accesskeys",r[9]),H(e,"class","tasks-modal")},m(j,ne){vi(j,e,ne),L(e,t),L(t,n),L(n,s),L(n,a),L(n,o),Yr(o,r[1].description),r[31](o),L(t,c),L(t,f),L(f,p),L(p,g),L(f,S);for(let oe=0;oe<Pt.length;oe+=1)Pt[oe]&&Pt[oe].m(f,null);L(t,b),L(t,x),L(x,C),L(x,G),L(x,K),Yr(K,r[1].recurrenceRule),L(x,de),L(x,le),L(le,ye),L(le,te),J.m(r[12],le),L(x,Ze),L(x,tt),L(x,z),L(x,W),Yr(W,r[1].dueDate),L(x,ee),L(x,Y),L(Y,ce),L(Y,y),_.m(r[6],Y),L(x,w),L(x,k),L(x,D),L(x,M),Yr(M,r[1].scheduledDate),L(x,I),L(x,P),L(P,N),L(P,q),Ee.m(r[4],P),L(x,ge),L(x,fe),L(x,Ie),L(x,V),Yr(V,r[1].startDate),L(x,ze),L(x,pt),L(pt,Mr),L(pt,st),je.m(r[2],pt),L(x,mt),L(x,bt),L(bt,Rn),L(bt,Yi),L(bt,$e),$e.checked=r[1].forwardOnly,L(t,rs),L(t,yt),L(yt,he),L(yt,Jr),L(yt,At);for(let oe=0;oe<Qe.length;oe+=1)Qe[oe]&&Qe[oe].m(At,null);np(At,r[1].status,!0),L(t,yo),L(t,qr),L(qr,xn),L(xn,vt),L(xn,Ui),L(xn,fr),L(qr,Ye),L(qr,An),L(An,qs),L(An,ss),L(An,Pn),Pn.innerHTML=r[11],L(qr,is),L(qr,hr),L(hr,Nn),L(hr,go),L(hr,tn),tn.innerHTML=r[13],L(t,_o),L(t,pr),L(pr,mr),L(mr,$),L(pr,To),L(pr,gt),as||(Ae=[Vt(o,"input",r[30]),Vt(o,"keydown",r[23]),Vt(o,"paste",r[24]),Vt(o,"drop",r[24]),Vt(f,"keyup",r[21]),Vt(K,"input",r[34]),Vt(W,"input",r[35]),Vt(M,"input",r[36]),Vt(V,"input",r[37]),Vt($e,"change",r[38]),Vt(At,"change",r[39]),Vt(gt,"click",r[22]),Vt(t,"submit",fv(r[25]))],as=!0)},p(j,ne){if(ne[0]&32768&&l!==(l=j[15]("t"))&&H(o,"accesskey",l),ne[0]&3&&Yr(o,j[1].description),ne[0]&3&&T!==(T="priority-"+j[1].priority)&&H(p,"for",T),ne[0]&1081346){yr=j[20];let oe;for(oe=0;oe<yr.length;oe+=1){let $t=Tv(j,yr,oe);Pt[oe]?Pt[oe].p($t,ne):(Pt[oe]=bv($t),Pt[oe].c(),Pt[oe].m(f,null))}fo
`);e.setLine(o,S)};new Xn({app:n,task:c,onSubmit:f}).open()};var lp=require("obsidian");var Dv=(r,e,t)=>{var c;if(r)return t instanceof lp.MarkdownView;if(!(t instanceof lp.MarkdownView))return;let n=(c=t.file)==null?void 0:c.path;if(n===void 0)return;let s=e.getCursor(),a=s.line,o=e.getLine(a),l=EF(o,n);e.setLine(a,l.text),e.setCursor(DF(s,l))},EF=(r,e)=>{let t=Ge.fromLine({line:r,taskLocation:Lt.fromUnknownPosition(e),fallbackDate:null});if(t!==null){let n=t.toggleWithRecurrenceInUsersOrder().map(s=>s.toFileLineString());return{text:n.join(`
`),moveTo:{line:n.length-1}}}else{let n=r.match(ie.taskRegex);if(n!==null){let s=n[3],o=He.getInstance().bySymbol(s).nextStatusSymbol;return{text:r.replace(ie.taskRegex,`$1- [${o}] $4`)}}else if(ie.listItemRegex.test(r)){let s=r.replace(ie.listItemRegex,"$1$2 [ ]");return{text:s,moveTo:{ch:s.length}}}else{let s=r.replace(ie.indentationRegex,"$1- ");return{text:s,moveTo:{ch:s.length}}}}},DF=(r,e)=>{var a;let t={line:0,ch:r.ch},n=Pe(Pe({},t),(a=e.moveTo)!=null?a:{}),s=e.text.split(`
`)[n.line].length;return{line:r.line+n.line,ch:Math.min(n.ch,s)}};var Gu=class{get app(){return this.plugin.app}constructor({plugin:e}){this.plugin=e,e.addCommand({id:"edit-task",name:"Create or edit task",icon:"pencil",editorCheckCallback:(t,n,s)=>Ev(t,n,s,this.app)}),e.addCommand({id:"toggle-done",name:"Toggle task done",icon:"check-in-circle",editorCheckCallback:Dv})}};var Hu=class{constructor({obsidianEvents:e}){this.obsidianEvents=e}onCacheUpdate(e){return this.obsidianEvents.on("obsidian-tasks-plugin:cache-update",e)}triggerCacheUpdate(e){this.obsidianEvents.trigger("obsidian-tasks-plugin:cache-update",e)}onRequestCacheUpdate(e){return this.obsidianEvents.on("obsidian-tasks-plugin:request-cache-update",e)}triggerRequestCacheUpdate(e){this.obsidianEvents.trigger("obsidian-tasks-plugin:request-cache-update",e)}off(e){this.obsidianEvents.offref(e)}};var Sv=require("obsidian");var Bu=class{constructor({plugin:e}){this.markdownPostProcessor=this._markdownPostProcessor.bind(this);e.registerMarkdownPostProcessor(this._markdownPostProcessor.bind(this))}_markdownPostProcessor(e,t){return Q(this,null,function*(){var p;let n=new Sv.MarkdownRenderChild(e);t.addChild(n);let s=e.findAll(".task-list-item").filter(g=>{var b;let T=(b=g.textContent)==null?void 0:b.split(`
`);if(T===void 0)return!1;let S=null;for(let x=0;x<T.length;x=x+1)if(T[x]!==""){S=T[x];break}return S===null?!1:Le.includedIn(S)});if(s.length===0)return;let a=t.sourcePath,o=t.getSectionInfo(e);if(o===null)return;let l=o.text.split(`
`),c=0,f=[];for(let g=o.lineStart;g<=o.lineEnd;g++){let T=l[g];if(T===void 0)continue;let S=null,b=Ge.fromLine({line:T,taskLocation:new Lt(a,g,o.lineStart,c,S),fallbackDate:null});b!==null&&(f.push(b),c++)}for(let g=0;g<s.length;g++){let T=f[g],S=s[g];if(T===void 0||S===void 0)continue;let b=(p=S.getAttr("data-line"))!=null?p:"0",x=Number.parseInt(b,10),C=yield T.toLi({parentUlElement:e,listIndex:x,obsidianComponent:n}),G=S.childNodes;for(let de=0;de<G.length;de=de+1){let le=G[de];le.nodeName.toLowerCase()==="div"?C.prepend(le):le.nodeName.toLowerCase()==="ul"&&C.append(le)}let K=S.querySelectorAll("[data-footnote-id]"),B=C.querySelectorAll("[data-footnote-id]");if(K.length===B.length)for(let de=0;de<K.length;de++)B[de].replaceWith(K[de]);S.replaceWith(C)}})}};var Ov=require("@codemirror/view"),Mv=require("obsidian");var Rv=()=>Ov.ViewPlugin.fromClass(cp),cp=class{constructor(e){this.view=e,this.handleClickEvent=this.handleClickEvent.bind(this),this.view.dom.addEventListener("click",this.handleClickEvent)}destroy(){this.view.dom.removeEventListener("click",this.handleClickEvent)}handleClickEvent(e){let{target:t}=e;if(!t||!(t instanceof HTMLInputElement)||t.type!=="checkbox")return!1;let n=t.closest("ul.plugin-tasks-query-result, div.callout-content");if(n){if(n.matches("div.callout-content")){let T=`obsidian-tasks-plugin warning: Tasks cannot add or remove completion dates or make the next copy of a recurring task for tasks written inside a callout when you click their checkboxes in Live Preview.
If you wanted Tasks to do these things, please undo your change, then either click the line of the task and use the "Toggle Task Done" command, or switch to Reading View to click the checkbox.`;console.warn(T),new Mv.Notice(T,45e3)}return!1}let{state:s}=this.view,a=this.view.posAtDOM(t),o=s.doc.lineAt(a),l=Ge.fromLine({line:o.text,taskLocation:Lt.fromUnknownPosition(""),fallbackDate:null});if(console.debug(`Live Preview Extension: toggle called. Position: ${a} Line: ${o.text}`),l===null)return!1;e.preventDefault();let f=l.toggleWithRecurrenceInUsersOrder().map(T=>T.toFileLineString()).join(s.lineBreak),p=s.update({changes:{from:o.from,to:o.to,insert:f}});this.view.dispatch(p);let g=t.checked;return setTimeout(()=>{t.checked=g},1),!0}};var Fi=require("obsidian");var kn=class{constructor(e,t,n){this.property=e,this.comparator=kn.maybeReverse(n,t)}static maybeReverse(e,t){return e?kn.makeReversedComparator(t):t}static makeReversedComparator(e){return(t,n)=>e(t,n)*-1}};var wi=class{constructor(e,t,n){this.property=e,this.grouper=t,this.reverse=n}};var Je=class{canCreateFilterForLine(e){return Je.lineMatchesFilter(this.filterRegExp(),e)}static lineMatchesFilter(e,t){return e?e.test(t):!1}static getMatch(e,t){return e?t.match(e):null}fieldNameSingular(){return this.fieldName()}fieldNameSingularEscaped(){return Iu(this.fieldNameSingular())}supportsSorting(){return!1}createSorterFromLine(e){if(!this.supportsSorting())return null;let t=Je.getMatch(this.sorterRegExp(),e);if(t===null)return null;let n=!!t[1];return this.createSorter(n)}sorterRegExp(){if(!this.supportsSorting())throw Error(`sorterRegExp() unimplemented for ${this.fieldNameSingular()}`);return new RegExp(`^sort by ${this.fieldNameSingularEscaped()}( reverse)?`)}comparator(){throw Error(`comparator() unimplemented for ${this.fieldNameSingular()}`)}createSorter(e){return new kn(this.fieldNameSingular(),this.comparator(),e)}createNormalSorter(){return this.createSorter(!1)}createReverseSorter(){return this.createSorter(!0)}supportsGrouping(){return!1}createGrouperFromLine(e){if(!this.supportsGrouping())return null;let t=Je.getMatch(this.grouperRegExp(),e);if(t===null)return null;let n=!!t[1];return this.createGrouper(n)}grouperRegExp(){if(!this.supportsGrouping())throw Error(`grouperRegExp() unimplemented for ${this.fieldNameSingular()}`);return new RegExp(`^group by ${this.fieldNameSingularEscaped()}( reverse)?$`)}grouper(){throw Error(`grouper() unimplemented for ${this.fieldNameSingular()}`)}createGrouper(e){return new wi(this.fieldNameSingular(),this.grouper(),e)}createNormalGrouper(){return this.createGrouper(!1)}createReverseGrouper(){return this.createGrouper(!0)}};var et=class{constructor(e,t=[],n=""){this.description=e,this.symbol=n,this.children=t}static booleanAnd(e){return this.combineOrCreateExplanation("All of",e,"AND")}static booleanOr(e){return this.combineOrCreateExplanation("At least one of",e,"OR")}static booleanNot(e){return new et("None of",e,"NOT")}static booleanXor(e){return new et("Exactly one of",e,"XOR")}asString(e=""){if(this.children.length==0)return e+this.description;let t=e;this.symbol===""?t+=this.description:(t+=this.symbol,this.children.length>1&&(t+=` (${this.description})`),t+=":");let n=e+" ";for(let s=0;s<this.children.length;s++)t+=`
${this.children[s].asString(n)}`;return t}static combineOrCreateExplanation(e,t,n){if(t.length===2){let s=t[0],a=t[1];if(s.symbol===n&&a.symbol==="")return s.children.push(a),s}return new et(e,t,n)}};var er=class{constructor(e,t,n){this.instruction=e,this.explanation=n,this.filterFunction=t}explainFilterIndented(e){let t=this.explanation;return t.asString()===this.instruction?`${e}${this.instruction}
2 years ago
`:`${e}${this.instruction} =>
${t.asString(" ")}
1 year ago
`}},Be=class{constructor(e){this.instruction=e}get filter(){return this._filter}set filter(e){this._filter=e}get filterFunction(){if(this._filter)return this._filter.filterFunction}static fromFilter(e){let t=new Be(e.instruction);return t.filter=e,t}static fromError(e,t){let n=new Be(e);return n.error=t,n}};var zu=class{constructor(e,t){this._instruction=e,this._filter=t}canCreateFilterForLine(e){return e==this._instruction}createFilterOrErrorMessage(e){let t=new Be(e);return e===this._instruction?(t.filter=new er(e,this._filter,new et(e)),t):(t.error=`do not understand filter: ${e}`,t)}};var Zr=class{constructor(){this._filters=[]}add(e,t){this._filters.push(new zu(e,t))}canCreateFilterForLine(e){for(let t of this._filters)if(t.canCreateFilterForLine(e))return!0;return!1}createFilterOrErrorMessage(e){for(let n of this._filters){let s=n.createFilterOrErrorMessage(e);if(s.error===void 0)return s}let t=new Be(e);return t.error=`do not understand filter: ${e}`,t}};var Jn=class extends Je{constructor(){super(...arguments);this._filters=new Zr}canCreateFilterForLine(t){return this._filters.canCreateFilterForLine(t)}createFilterOrErrorMessage(t){return this._filters.createFilterOrErrorMessage(t)}filterRegExp(){return null}};var Qr=class extends Jn{constructor(){super(),this._filters.add("done",e=>e.status.type==="DONE"||e.status.type==="CANCELLED"||e.status.type==="NON_TASK"),this._filters.add("not done",e=>e.status.type==="TODO"||e.status.type==="IN_PROGRESS")}fieldName(){return"status"}supportsSorting(){return!0}comparator(){return(e,t)=>{let n=Qr.oldStatusName(e),s=Qr.oldStatusName(t);return n<s?1:n>s?-1:0}}static oldStatusName(e){return e.status.symbol===" "?"Todo":"Done"}supportsGrouping(){return!0}grouper(){return e=>[Qr.oldStatusName(e)]}};var jt=class extends Je{constructor(t=null){super();t!==null?this.filterInstructions=t:(this.filterInstructions=new Zr,this.filterInstructions.add(`has ${this.fieldName()} date`,n=>this.date(n)!==null),this.filterInstructions.add(`no ${this.fieldName()} date`,n=>this.date(n)===null),this.filterInstructions.add(`${this.fieldName()} date is invalid`,n=>{let s=this.date(n);return s!==null&&!s.isValid()}))}canCreateFilterForLine(t){return this.filterInstructions.canCreateFilterForLine(t)?!0:super.canCreateFilterForLine(t)}createFilterOrErrorMessage(t){let n=this.filterInstructions.createFilterOrErrorMessage(t);if(n.filter!==void 0)return n;let s=new Be(t),a=Je.getMatch(this.filterRegExp(),t);if(a!==null){let o=a[1],l=a[2],c=a[3],f=ir.parseDateRange(c);if(!f.isValid()){let p=ir.parseDate(o);p.isValid()&&(f=new Bt(p,p))}if(!f.isValid())s.error="do not understand "+this.fieldName()+" date";else{let p=this.buildFilterFunction(l,f),g=jt.buildExplanation(this.fieldNameForExplanation(),l,this.filterResultIfFieldMissing(),f);s.filter=new er(t,p,g)}}else s.error="do not understand query filter ("+this.fieldName()+" date)";return s}buildFilterFunction(t,n){let s;return t==="before"?s=a=>a?a.isBefore(n.start):this.filterResultIfFieldMissing():t==="after"?s=a=>a?a.isAfter(n.end):this.filterResultIfFieldMissing():s=a=>a?a.isSameOrAfter(n.start)&&a.isSameOrBefore(n.end):this.filterResultIfFieldMissing(),this.getFilter(s)}getFilter(t){return n=>t(this.date(n))}filterRegExp(){return new RegExp(`^${this.fieldNameForFilterInstruction()} ((before|after|on|in)? ?(.*))`)}fieldNameForFilterInstruction(){return this.fieldName()}static buildExplanation(t,n,s,a){let o,l="YYYY-MM-DD (dddd Do MMMM YYYY)",c;switch(n){case"before":o=n,c=a.start.format(l);break;case"after":o=n,c=a.end.format(l);break;default:if(a.start.isSame(a.end))o="on",c=a.start.format(l);else{let p=`${t} date is between:`,g=[new et(`${a.start.format(l)} and`),new et(`${a.end.format(l)} inclusive`)];return s&&g.push(new et(`OR no ${t} date`)),new et(p,g)}break}let f=`${t} date is ${o} ${c}`;return s&&(f+=` OR no ${t} date`),new et(f)}fieldNameForExplanation(){return this.fieldName()}supportsSorting(){return!0}comparator(){return(t,n)=>Vr(this.date(t),this.date(n))}supportsGrouping(){return!0}grouper(){return t=>{let n=this.date(t);return n===null
2 years ago
`;return e}toString(){let e=`
`;e+=`Group names: [${this.groups}]
1 year ago
`;for(let t of this.groupHeadings)e+=`${"#".repeat(4+t.nestingLevel)} [${t.property}] ${t.displayName}
`;return e+=this.tasksAsStringOfLines(),e}};var el=class{constructor(e,t){this._groups=new Array;this._totalTaskCount=0;this._totalTaskCount=t.length,this._groupers=e;let s=new Xu(e,t).generateTaskTreeStorage();this.addTaskGroups(s),this.sortTaskGroups(),this.setGroupsHeadings(s)}get groupers(){return this._groupers}get groups(){return this._groups}totalTasksCount(){return this._totalTaskCount}toString(){let e="";e+=`Groupers (if any):
`;for(let n of this._groupers){let s=n.reverse?" reverse":"";e+=`- ${n.property}${s}
`}for(let n of this.groups)e+=n.toString(),e+=`
2 years ago
---
`;return e+=`
${this.totalTasksCount()} tasks
1 year ago
`,e}addTaskGroups(e){for(let[t,n]of e){let s=new Ju(t,n);this.addTaskGroup(s)}}addTaskGroup(e){this._groups.push(e)}sortTaskGroups(){let e=(t,n)=>{let s=t.groups,a=n.groups;for(let o=0;o<s.length;o++){let l=this._groupers[o],c=s[o].localeCompare(a[o],void 0,{numeric:!0});if(c!==0)return l.reverse?-c:c}return 0};this._groups.sort(e)}setGroupsHeadings(e){let t=new Ku(e,this._groupers);for(let n of this._groups)n.setGroupHeadings(t.getHeadingsForTaskGroup(n.groups))}applyTaskLimit(e){this._groupers.length!==0&&(this._groups.forEach(t=>{t.applyTaskLimit(e)}),this.calculateTotalTaskCount())}calculateTotalTaskCount(){let e=[];this._groups.forEach(n=>{e=[...e,...n.tasks]});let t=[...new Set(e)];this._totalTaskCount=t.length}};var Ns=class extends Ke{fieldName(){return"description"}value(e){return Le.removeAsSubstringFrom(e.description)}supportsSorting(){return!0}comparator(){return(e,t)=>{let n=Ns.cleanDescription(e.description),s=Ns.cleanDescription(t.description);return n.localeCompare(s,void 0,{numeric:!0})}}static cleanDescription(e){e=Le.removeAsSubstringFrom(e);let t=/^\[\[?([^\]]*)]]?/,n=e.match(t);if(n!==null){let s=n[1];e=s.substring(s.indexOf("|")+1)+e.replace(t,"")}return e=this.replaceFormatting(e,/^\*\*([^*]+)\*\*/),e=this.replaceFormatting(e,/^\*([^*]+)\*/),e=this.replaceFormatting(e,/^==([^=]+)==/),e=this.replaceFormatting(e,/^__([^_]+)__/),e=this.replaceFormatting(e,/^_([^_]+)_/),e}static replaceFormatting(e,t){let n=e.match(t);return n!==null&&(e=n[1]+e.replace(t,"")),e}};var tl=class extends jt{fieldName(){return"created"}date(e){return e.createdDate}filterResultIfFieldMissing(){return!1}};var rl=class extends jt{fieldName(){return"done"}date(e){return e.doneDate}filterResultIfFieldMissing(){return!1}};var nl=class extends Jn{constructor(){super(),this._filters.add("exclude sub-items",e=>{if(e.indentation==="")return!0;let t=e.indentation.lastIndexOf(">");return t===-1?!1:/^ ?$/.test(e.indentation.slice(t+1))})}fieldName(){return"exclude"}};var sl=class extends Ke{fieldName(){return"heading"}value(e){return e.precedingHeader?e.precedingHeader:""}supportsSorting(){return!0}supportsGrouping(){return!0}grouper(){return e=>e.precedingHeader===null||e.precedingHeader.length===0?["(No heading)"]:[e.precedingHeader]}};var il=class extends jt{fieldName(){return"scheduled"}date(e){return e.scheduledDate}filterResultIfFieldMissing(){return!1}};var al=class extends jt{fieldName(){return"start"}fieldNameForFilterInstruction(){return"starts"}date(e){return e.startDate}filterResultIfFieldMissing(){return!0}};var xi=class extends jt{constructor(){let e=new Zr;e.add("has happens date",t=>this.dates(t).some(n=>n!==null)),e.add("no happens date",t=>!this.dates(t).some(n=>n!==null)),super(e)}fieldName(){return"happens"}fieldNameForExplanation(){return"due, start or scheduled"}date(e){return this.earliestDate(e)}dates(e){return Array.of(e.startDate,e.scheduledDate,e.dueDate)}earliestDate(e){return new xi().dates(e).sort(Vr)[0]}filterResultIfFieldMissing(){return!1}getFilter(e){return t=>this.dates(t).some(n=>e(n))}};var ol=class extends Jn{constructor(){super(),this._filters.add("is recurring",e=>e.recurrence!==null),this._filters.add("is not recurring",e=>e.recurrence===null)}fieldName(){return"recurring"}supportsSorting(){return!0}comparator(){return(e,t)=>e.recurrence!==null&&t.recurrence===null?-1:e.recurrence===null&&t.recurrence!==null?1:0}supportsGrouping(){return!0}grouper(){return e=>e.recurrence!==null?["Recurring"]:["Not Recurring"]}};var ul=class extends Ke{fieldNamePlural(){return this.fieldNameSingular()+"s"}fieldName(){return`${this.fieldNameSingular()}/${this.fieldNamePlural()}`}fieldPattern(){return`${this.fieldNameSingular()}|${this.fieldNamePlural()}`}filterOperatorPattern(){return`${super.filterOperatorPattern()}|include|do not include`}value(e){return this.values(e).join(", ")}getFilter(e,t){return n=>{let s=e.matchesAnyOf(this.values(n));return t?!s:s}}createGrouper(e){return new wi(this.fieldNamePlural(),this.grouper(),e)}grouperRegExp(){if(!this.supportsGrouping())throw Error(`grouperRegExp() unimplemente
2 years ago
Allowed options: 'is' and 'is not' (without quotes).
Allowed values: ${t}
Note: values are case-insensitive,
so 'in_progress' works too, for example.
1 year ago
Example: ${this.fieldNameSingular()} is not NON_TASK`;return Be.fromError(e,n)}fieldName(){return"status.type"}value(e){return e.status.type}supportsSorting(){return!0}comparator(){return(e,t)=>{let n=ts.groupName(e),s=ts.groupName(t);return n.localeCompare(s,void 0,{numeric:!0})}}supportsGrouping(){return!0}grouper(){return e=>[ts.groupName(e)]}static groupName(e){let t;switch(e.status.type){case"IN_PROGRESS":t="1";break;case"TODO":t="2";break;case"DONE":t="3";break;case"CANCELLED":t="4";break;case"NON_TASK":t="5";break;case"EMPTY":t="6";break}return t+" "+e.status.type}};var yl=class extends Ke{fieldName(){return"recurrence"}value(e){return e.recurrence!==null?e.recurrence.toText():""}supportsGrouping(){return!0}grouper(){return e=>e.recurrence!==null?[e.recurrence.toText()]:["None"]}};var gl=class extends Ke{fieldName(){return"folder"}value(e){let t=e.path,n=e.filename+".md",s=t.substring(0,t.lastIndexOf(n));return s===""?"/":s}supportsGrouping(){return!0}grouper(){return e=>[Ke.escapeMarkdownCharacters(this.value(e))]}};var _l=class extends Ke{fieldName(){return"root"}value(e){let t=e.path.replace(/\\/g,"/");t.charAt(0)==="/"&&(t=t.substring(1));let n=t.indexOf("/");return n==-1?"/":t.substring(0,n+1)}supportsGrouping(){return!0}grouper(){return e=>[Ke.escapeMarkdownCharacters(this.value(e))]}};var Tl=class extends Ke{fieldName(){return"backlink"}value(e){let t=e.getLinkText({isFilenameUnique:!0});return t===null?"Unknown Location":t}createFilterOrErrorMessage(e){return Be.fromError(e,"backlink field does not support filtering")}canCreateFilterForLine(e){return!1}supportsGrouping(){return!0}grouper(){return e=>{let t=e.filename;if(t===null)return["Unknown Location"];let n=Ke.escapeMarkdownCharacters(t);return e.precedingHeader&&e.precedingHeader!==t&&(n+=" > "+e.precedingHeader),[n]}}};var kp=[()=>new ml,()=>new ts,()=>new Qr,()=>new ol,()=>new Ps,()=>new xi,()=>new tl,()=>new al,()=>new il,()=>new ki,()=>new rl,()=>new Oi,()=>new gl,()=>new _l,()=>new Tl,()=>new Ns,()=>new Cs,()=>new sl,()=>new nl,()=>new pl,()=>new Mi,()=>new yl,()=>new fl];function hl(r){for(let e of kp){let t=e();if(t.canCreateFilterForLine(r))return t.createFilterOrErrorMessage(r)}return null}function $v(r){let e=/^sort by /;if(r.match(e)===null)return null;for(let t of kp){let s=t().createSorterFromLine(r);if(s)return s}return null}function Gv(r){let e=/^group by /;if(r.match(e)===null)return null;for(let t of kp){let s=t().createGrouperFromLine(r);if(s)return s}return null}var Mn=class{constructor({source:e}){this._limit=void 0;this._taskGroupLimit=void 0;this._layoutOptions=new Ja;this._filters=[];this._error=void 0;this._sorting=[];this._grouping=[];this.hideOptionsRegexp=/^(hide|show) (task count|backlink|priority|created date|start date|scheduled date|done date|due date|recurrence rule|edit button|urgency)/;this.shortModeRegexp=/^short/;this.explainQueryRegexp=/^explain/;this.limitRegexp=/^limit (groups )?(to )?(\d+)( tasks?)?/;this.commentRegexp=/^#.*/;this.source=e,e.split(`
`).map(t=>t.trim()).forEach(t=>{switch(!0){case t==="":break;case this.shortModeRegexp.test(t):this._layoutOptions.shortMode=!0;break;case this.explainQueryRegexp.test(t):this._layoutOptions.explainQuery=!0;break;case this.limitRegexp.test(t):this.parseLimit({line:t});break;case this.parseSortBy({line:t}):break;case this.parseGroupBy({line:t}):break;case this.hideOptionsRegexp.test(t):this.parseHideOptions({line:t});break;case this.commentRegexp.test(t):break;case this.parseFilter(t):break;default:this._error=`do not understand query: ${t}`}})}append(e){return this.source===""?e:e.source===""?this:new Mn({source:`${this.source}
2 years ago
${e.source}`})}explainQuery(){let e="",t=this.filters.length;if(t===0)e+="No filters supplied. All tasks will match the query.";else for(let s=0;s<t;s++)s>0&&(e+=`
1 year ago
`),e+=this.filters[s].explainFilterIndented("");e+=this.explainQueryLimits();let{debugSettings:n}=ue();return n.ignoreSortInstructions&&(e+=`
2 years ago
1 year ago
NOTE: All sort instructions, including default sort order, are disabled, due to 'ignoreSortInstructions' setting.`),e}explainQueryLimits(){let e="";function t(n){let s=`
2 years ago
1 year ago
At most ${n} task`;return n!==1&&(s+="s"),s}return this._limit!==void 0&&(e+=t(this._limit),e+=`.
`),this._taskGroupLimit!==void 0&&(e+=t(this._taskGroupLimit),e+=` per group (if any "group by" options are supplied).
`),e}get limit(){return this._limit}get layoutOptions(){return this._layoutOptions}get filters(){return this._filters}get sorting(){return this._sorting}get grouping(){return this._grouping}get error(){return this._error}applyQueryToTasks(e){this.filters.forEach(o=>{e=e.filter(o.filterFunction)});let{debugSettings:t}=ue(),s=(t.ignoreSortInstructions?e:Ri.by(this.sorting,e)).slice(0,this.limit),a=new el(this.grouping,s);return this._taskGroupLimit!==void 0&&a.applyTaskLimit(this._taskGroupLimit),a}parseHideOptions({line:e}){let t=e.match(this.hideOptionsRegexp);if(t!==null){let n=t[1]==="hide";switch(t[2]){case"task count":this._layoutOptions.hideTaskCount=n;break;case"backlink":this._layoutOptions.hideBacklinks=n;break;case"priority":this._layoutOptions.hidePriority=n;break;case"created date":this._layoutOptions.hideCreatedDate=n;break;case"start date":this._layoutOptions.hideStartDate=n;break;case"scheduled date":this._layoutOptions.hideScheduledDate=n;break;case"due date":this._layoutOptions.hideDueDate=n;break;case"done date":this._layoutOptions.hideDoneDate=n;break;case"recurrence rule":this._layoutOptions.hideRecurrenceRule=n;break;case"edit button":this._layoutOptions.hideEditButton=n;break;case"urgency":this._layoutOptions.hideUrgency=n;break;default:this._error="do not understand hide/show option"}}}parseFilter(e){let t=hl(e);return t!=null?(t.filter?this._filters.push(t.filter):this._error=t.error,!0):!1}parseLimit({line:e}){let t=e.match(this.limitRegexp);if(t===null){this._error="do not understand query limit";return}let n=Number.parseInt(t[3],10);t[1]!==void 0?this._taskGroupLimit=n:this._limit=n}parseSortBy({line:e}){let t=$v(e);return t?(this._sorting.push(t),!0):!1}parseGroupBy({line:e}){let t=Gv(e);return t?(this._grouping.push(t),!0):!1}};function Hv(r){let e="";Le.isEmpty()||(e+=`Only tasks containing the global filter '${Le.get()}'.
2 years ago
1 year ago
`);let t=new Mn(Hh());return t.source.trim()!==""&&(e+=`Explanation of the global query:
2 years ago
${t.explainQuery()}
`),e+=`Explanation of this Tasks code block query:
2 years ago
1 year ago
${new Mn({source:r}).explainQuery()}`,e}function bl(r){return new Mn(Hh()).append(new Mn({source:r}))}var vl=class{constructor({plugin:e,events:t}){this.addQueryRenderChild=this._addQueryRenderChild.bind(this);this.app=e.app,this.events=t,e.registerMarkdownCodeBlockProcessor("tasks",this._addQueryRenderChild.bind(this))}_addQueryRenderChild(e,t,n){return Q(this,null,function*(){n.addChild(new Ep({app:this.app,events:this.events,container:t,source:e,filePath:n.sourcePath}))})}},Ep=class extends Fi.MarkdownRenderChild{constructor({app:t,events:n,container:s,source:a,filePath:o}){super(s);switch(this.app=t,this.events=n,this.source=a,this.filePath=o,this.containerEl.className){case"block-language-tasks":this.query=bl(this.source),this.queryType="tasks";break;default:this.query=bl(this.source),this.queryType="tasks";break}}onload(){this.events.triggerRequestCacheUpdate(this.render.bind(this)),this.renderEventRef=this.events.onCacheUpdate(this.render.bind(this)),this.reloadQueryAtMidnight()}onunload(){this.renderEventRef!==void 0&&this.events.off(this.renderEventRef),this.queryReloadTimeout!==void 0&&clearTimeout(this.queryReloadTimeout)}reloadQueryAtMidnight(){let t=new Date;t.setHours(24,0,0,0);let n=new Date,s=t.getTime()-n.getTime();this.queryReloadTimeout=setTimeout(()=>{this.query=bl(this.source),this.events.triggerRequestCacheUpdate(this.render.bind(this)),this.reloadQueryAtMidnight()},s+1e3)}render(s){return Q(this,arguments,function*({tasks:t,state:n}){var o;let a=this.containerEl.createEl("div");if(n==="Warm"&&this.query.error===void 0){console.debug(`Render ${this.queryType} called for a block in active file "${this.filePath}", to select from ${t.length} tasks: plugin state: ${n}`),this.query.layoutOptions.explainQuery&&this.createExplanation(a);let l=this.query.applyQueryToTasks(t);for(let f of l.groups){this.addGroupHeadings(a,f.groupHeadings);let{taskList:p}=yield this.createTasksList({tasks:f.tasks,content:a});a.appendChild(p)}let c=l.totalTasksCount();console.debug(`${c} of ${t.length} tasks displayed in a block in "${this.filePath}"`),this.addTaskCount(a,c)}else this.query.error!==void 0?a.createDiv().innerHTML=`<pre>Tasks query: ${this.query.error.replace(/\n/g,"<br>")}</pre>`:a.setText("Loading Tasks ...");(o=this.containerEl.firstChild)==null||o.replaceWith(a)})}createExplanation(t){let n=Hv(this.source),s=t.createEl("pre");s.addClasses(["plugin-tasks-query-explanation"]),s.setText(n),t.appendChild(s)}createTasksList(s){return Q(this,arguments,function*({tasks:t,content:n}){let a=t.length,o=new Vn(this.query.layoutOptions),l=n.createEl("ul");l.addClasses(["contains-task-list","plugin-tasks-query-result"]),l.addClasses(o.specificClasses);let c=this.getGroupingAttribute();c&&c.length>0&&(l.dataset.taskGroupBy=c);for(let f=0;f<a;f++){let p=t[f],g=this.isFilenameUnique({task:p}),T=yield p.toLi({parentUlElement:l,listIndex:f,layoutOptions:this.query.layoutOptions,isFilenameUnique:g,taskLayout:o,obsidianComponent:this});T.querySelectorAll("[data-footnote-id]").forEach(C=>C.remove());let b=this.query.layoutOptions.shortMode,x=T.createSpan("task-extras");this.query.layoutOptions.hideUrgency||this.addUrgency(x,p),this.query.layoutOptions.hideBacklinks||this.addBacklinks(x,p,b,g),this.query.layoutOptions.hideEditButton||this.addEditButton(x,p),l.appendChild(T)}return{taskList:l,tasksCount:a}})}addEditButton(t,n){t.createEl("a",{cls:"tasks-edit"}).onClickEvent(a=>{a.preventDefault();let o=c=>{Uu({originalTask:n,newTasks:Jt.removeInferredStatusIfNeeded(n,c)})};new Xn({app:this.app,task:n,onSubmit:o}).open()})}addUrgency(t,n){let s=new Intl.NumberFormat().format(n.urgency);t.createSpan({text:s,cls:"tasks-urgency"})}addGroupHeadings(t,n){for(let s of n)this.addGroupHeading(t,s)}addGroupHeading(t,n){return Q(this,null,function*(){let s="h6";n.nestingLevel===0?s="h4":n.nestingLevel===1&&(s="h5");let a=t.createEl(s,{cls:"tasks-group-heading"});yield Fi.MarkdownRenderer.renderMarkdown(n.displayName,a,this.filePath,this)})}addBacklinks(t,n,s,a){var p;let o=t.createSpan({cls:"tasks-backlink"});s||o.append(" (");let l=o.creat
`)+`
1 year ago
Fix errors before saving.`;new Wr.Notice(g);return}this.saved=!0,this.close()})),f)),c.addExtraButton(f=>(f.setIcon("cross").setTooltip("Cancel").onClick(()=>{this.saved=!1,this.close()}),f))})}onOpen(){this.display()}static setValidationError(t){t.inputEl.addClass("tasks-settings-is-invalid")}static removeValidationError(t){t.inputEl.removeClass("tasks-settings-is-invalid")}static setValid(t,n){n.length===0?cr.removeValidationError(t):cr.setValidationError(t)}};var dr=class extends Ce.PluginSettingTab{constructor({plugin:t}){super(t.app,t);this.customFunctions={insertTaskCoreStatusSettings:this.insertTaskCoreStatusSettings.bind(this),insertCustomTaskStatusSettings:this.insertCustomTaskStatusSettings.bind(this)};this.plugin=t}saveSettings(t){return Q(this,null,function*(){yield this.plugin.saveSettings(),t&&this.display()})}display(){let{containerEl:t}=this;t.empty(),this.containerEl.addClass("tasks-settings"),t.createEl("h3",{text:"Tasks Settings"}),t.createEl("p",{cls:"tasks-setting-important",text:"Changing any settings requires a restart of obsidian."}),t.createEl("h4",{text:"Task Format Settings"}),new Ce.Setting(t).setName("Task Format").setDesc(dr.createFragmentWithHTML('<p>The format that Tasks uses to read and write tasks.</p><p><b>Important:</b> Tasks currently only supports one format at a time. Selecting Dataview will currently <b>stop Tasks reading its own emoji signifiers</b>.</p><p>See the <a href="https://publish.obsidian.md/tasks/Reference/Task+Formats/About+Task+Formats">documentation</a>.</p>')).addDropdown(s=>{for(let a of Object.keys(bn))s.addOption(a,bn[a].displayName);s.setValue(ue().taskFormat).onChange(a=>Q(this,null,function*(){ht({taskFormat:a}),yield this.plugin.saveSettings()}))}),t.createEl("h4",{text:"Global filter Settings"}),new Ce.Setting(t).setName("Global task filter").setDesc(dr.createFragmentWithHTML('<p><b>Recommended: Leave empty if you want all checklist items in your vault to be tasks managed by this plugin.</b></p><p>Use a global filter if you want Tasks to only act on a subset of your "<code>- [ ]</code>" checklist items, so that a checklist item must include the specified string in its description in order to be considered a task.<p><p>For example, if you set the global filter to <code>#task</code>, the Tasks plugin will only handle checklist items tagged with <code>#task</code>.</br>Other checklist items will remain normal checklist items and not appear in queries or get a done date set.</p><p>See the <a href="https://publish.obsidian.md/tasks/Getting+Started/Global+Filter">documentation</a>.</p>')).addText(s=>{s.setPlaceholder("e.g. #task or TODO").setValue(Le.get()).onChange(a=>Q(this,null,function*(){Le.set(a),yield this.plugin.saveSettings()}))}),new Ce.Setting(t).setName("Remove global filter from description").setDesc("Enabling this removes the string that you set as global filter from the task description when displaying a task.").addToggle(s=>{let a=ue();s.setValue(a.removeGlobalFilter).onChange(o=>Q(this,null,function*(){ht({removeGlobalFilter:o}),yield this.plugin.saveSettings()}))}),t.createEl("h4",{text:"Global Query"}),YF(new Ce.Setting(t).setDesc(dr.createFragmentWithHTML('<p>A query that is automatically included at the start of every Tasks block in the vault. Useful for adding default filters, or layout options.</p><p>See the <a href="https://publish.obsidian.md/tasks/Queries/Global+Query">documentation</a>.</p>')).addTextArea(s=>{let a=ue();s.inputEl.rows=4,s.setPlaceholder(`# For example...
2 years ago
path does not include _templates/
limit 300
1 year ago
show urgency`).setValue(a.globalQuery).onChange(o=>Q(this,null,function*(){ht({globalQuery:o}),yield this.plugin.saveSettings()}))})),t.createEl("h4",{text:"Task Statuses"});let{headingOpened:n}=ue();Jv.forEach(s=>{this.addOneSettingsBlock(t,s,n)}),t.createEl("h4",{text:"Date Settings"}),new Ce.Setting(t).setName("Set created date on every added task").setDesc(dr.createFragmentWithHTML(`Enabling this will add a timestamp \u2795 YYYY-MM-DD before other date values, when a task is created with 'Create or edit task', or by completing a recurring task.</br><p>See the <a href="https://publish.obsidian.md/tasks/Getting+Started/Dates#Created+date">documentation</a>.</p>`)).addToggle(s=>{let a=ue();s.setValue(a.setCreatedDate).onChange(o=>Q(this,null,function*(){ht({setCreatedDate:o}),yield this.plugin.saveSettings()}))}),new Ce.Setting(t).setName("Set done date on every completed task").setDesc(dr.createFragmentWithHTML('Enabling this will add a timestamp \u2705 YYYY-MM-DD at the end when a task is toggled to done.</br><p>See the <a href="https://publish.obsidian.md/tasks/Getting+Started/Dates#Done+date">documentation</a>.</p>')).addToggle(s=>{let a=ue();s.setValue(a.setDoneDate).onChange(o=>Q(this,null,function*(){ht({setDoneDate:o}),yield this.plugin.saveSettings()}))}),new Ce.Setting(t).setName("Use filename as Scheduled date for undated tasks").setDesc(dr.createFragmentWithHTML('Save time entering Scheduled (\u23F3) dates.</br>If this option is enabled, any undated tasks will be given a default Scheduled date extracted from their file name.</br>The date in the file name must be in one of <code>YYYY-MM-DD</code> or <code>YYYYMMDD</code> formats.</br>Undated tasks have none of Due (\u{1F4C5} ), Scheduled (\u23F3) and Start (\u{1F6EB}) dates.</br><p>See the <a href="https://publish.obsidian.md/tasks/Getting+Started/Use+Filename+as+Default+Date">documentation</a>.</p>')).addToggle(s=>{let a=ue();s.setValue(a.useFilenameAsScheduledDate).onChange(o=>Q(this,null,function*(){ht({useFilenameAsScheduledDate:o}),yield this.plugin.saveSettings()}))}),new Ce.Setting(t).setName("Folders with default Scheduled dates").setDesc("Leave empty if you want to use default Scheduled dates everywhere, or enter a comma-separated list of folders.").addText(s=>Q(this,null,function*(){let a=ue();yield this.plugin.saveSettings(),s.setValue(dr.renderFolderArray(a.filenameAsDateFolders)).onChange(o=>Q(this,null,function*(){let l=dr.parseCommaSeparatedFolders(o);ht({filenameAsDateFolders:l}),yield this.plugin.saveSettings()}))})),t.createEl("h4",{text:"Recurring task Settings"}),new Ce.Setting(t).setName("Next recurrence appears on the line below").setDesc(dr.createFragmentWithHTML('Enabling this will make the next recurrence of a task appear on the line below the completed task. Otherwise the next recurrence will appear before the completed one.</br><p>See the <a href="https://publish.obsidian.md/tasks/Getting+Started/Recurring+Tasks">documentation</a>.</p>')).addToggle(s=>{let{recurrenceOnNextLine:a}=ue();s.setValue(a).onChange(o=>Q(this,null,function*(){ht({recurrenceOnNextLine:o}),yield this.plugin.saveSettings()}))}),t.createEl("h4",{text:"Auto-suggest Settings"}),new Ce.Setting(t).setName("Auto-suggest task content").setDesc(dr.createFragmentWithHTML('Enabling this will open an intelligent suggest menu while typing inside a recognized task line.</br><p>See the <a href="https://publish.obsidian.md/tasks/Getting+Started/Auto-Suggest">documentation</a>.</p>')).addToggle(s=>{let a=ue();s.setValue(a.autoSuggestInEditor).onChange(o=>Q(this,null,function*(){ht({autoSuggestInEditor:o}),yield this.plugin.saveSettings()}))}),new Ce.Setting(t).setName("Minimum match length for auto-suggest").setDesc("If higher than 0, auto-suggest will be triggered only when the beginning of any supported keywords is recognized.").addSlider(s=>{let a=ue();s.setLimits(0,3,1).setValue(a.autoSuggestMinMatch).setDynamicTooltip().onChange(o=>Q(this,null,function*(){ht({autoSuggestMinMatch:o}),yield this.plugin.saveSettings()}))}),new Ce.Setting(t).setName("Maximum number of auto-s
`);t(l)}).open(),n};var nw=(r,e)=>{let t=$u({line:"",path:""});return new Xn({app:r,task:t,onSubmit:e})};var sw=r=>({createTaskLineModal:()=>rw(r,nw)});var kl=class extends iw.Plugin{get apiV1(){return sw(app)}onload(){return Q(this,null,function*(){Fu.registerConsoleLogger(),console.log('loading plugin "tasks"'),yield this.loadSettings(),this.addSettingTab(new mo({plugin:this})),Xb({metadataCache:this.app.metadataCache,vault:this.app.vault,workspace:this.app.workspace}),yield this.loadTaskStatuses();let t=new Hu({obsidianEvents:this.app.workspace});this.cache=new Ms({metadataCache:this.app.metadataCache,vault:this.app.vault,events:t}),this.inlineRenderer=new Bu({plugin:this}),this.queryRenderer=new vl({plugin:this,events:t}),this.registerEditorExtension(Rv()),this.registerEditorSuggest(new wl(this.app,ue())),new Gu({plugin:this})})}loadTaskStatuses(){return Q(this,null,function*(){let{statusSettings:t}=ue();Tt.applyToStatusRegistry(t,He.getInstance())})}onunload(){var t;console.log('unloading plugin "tasks"'),(t=this.cache)==null||t.unload()}loadSettings(){return Q(this,null,function*(){let t=yield this.loadData();ht(t),yield this.loadTaskStatuses()})}saveSettings(){return Q(this,null,function*(){yield this.saveData(ue())})}getTasks(){var t;return(t=this.cache)==null?void 0:t.getTasks()}};
2 years ago
/*!
* EventEmitter2
* https://github.com/hij1nx/EventEmitter2
*
* Copyright (c) 2013 hij1nx
* Licensed under the MIT license.
*/
//! authors : Tim Wood, Iskren Chernev, Moment.js contributors
//! license : MIT
//! moment.js
//! momentjs.com
//! version : 2.29.4