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.

301 lines
395 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.
*/
"use strict";var N_=Object.create;var Zi=Object.defineProperty,I_=Object.defineProperties,F_=Object.getOwnPropertyDescriptor,L_=Object.getOwnPropertyDescriptors,U_=Object.getOwnPropertyNames,qp=Object.getOwnPropertySymbols,W_=Object.getPrototypeOf,Yp=Object.prototype.hasOwnProperty,q_=Object.prototype.propertyIsEnumerable;var $p=(r,e,t)=>e in r?Zi(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,pe=(r,e)=>{for(var t in e||(e={}))Yp.call(e,t)&&$p(r,t,e[t]);if(qp)for(var t of qp(e))q_.call(e,t)&&$p(r,t,e[t]);return r},Tt=(r,e)=>I_(r,L_(e));var b=(r,e)=>()=>(e||r((e={exports:{}}).exports,e),e.exports),$_=(r,e)=>{for(var t in e)Zi(r,t,{get:e[t],enumerable:!0})},jp=(r,e,t,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of U_(e))!Yp.call(r,i)&&i!==t&&Zi(r,i,{get:()=>e[i],enumerable:!(n=F_(e,i))||n.enumerable});return r};var Ji=(r,e,t)=>(t=r!=null?N_(W_(r)):{},jp(e||!r||!r.__esModule?Zi(t,"default",{value:r,enumerable:!0}):t,r)),Y_=r=>jp(Zi({},"__esModule",{value:!0}),r);var q=(r,e,t)=>new Promise((n,i)=>{var s=u=>{try{o(t.next(u))}catch(l){i(l)}},a=u=>{try{o(t.throw(u))}catch(l){i(l)}},o=u=>u.done?n(u.value):Promise.resolve(u.value).then(s,a);o((t=t.apply(r,e)).next())});var Ee=b(Zr=>{"use strict";Object.defineProperty(Zr,"__esModule",{value:!0});Zr.matchAnyPattern=Zr.extractTerms=Zr.repeatedTimeunitPattern=void 0;function H_(r,e){let t=e.replace(/\((?!\?)/g,"(?:");return`${r}${t}\\s{0,5}(?:,?\\s{0,5}${t}){0,10}`}Zr.repeatedTimeunitPattern=H_;function Gp(r){let e;return r instanceof Array?e=[...r]:r instanceof Map?e=Array.from(r.keys()):e=Object.keys(r),e}Zr.extractTerms=Gp;function z_(r){return`(?:${Gp(r).sort((t,n)=>n.length-t.length).join("|").replace(/\./g,"\\.")})`}Zr.matchAnyPattern=z_});var Te=b((Lu,Uu)=>{(function(r,e){typeof Lu=="object"&&typeof Uu!="undefined"?Uu.exports=e():typeof define=="function"&&define.amd?define(e):(r=typeof globalThis!="undefined"?globalThis:r||self).dayjs=e()})(Lu,function(){"use strict";var r=1e3,e=6e4,t=36e5,n="millisecond",i="second",s="minute",a="hour",o="day",u="week",l="month",c="quarter",p="year",h="date",_="Invalid Date",y=/^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/,E=/\[([^\]]+)]|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,x={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("_")},P=function(B,A,w){var H=String(B);return!H||H.length>=A?B:""+Array(A+1-H.length).join(w)+B},N={s:P,z:function(B){var A=-B.utcOffset(),w=Math.abs(A),H=Math.floor(w/60),C=w%60;return(A<=0?"+":"-")+P(H,2,"0")+":"+P(C,2,"0")},m:function B(A,w){if(A.date()<w.date())return-B(w,A);var H=12*(w.year()-A.year())+(w.month()-A.month()),C=A.clone().add(H,l),Z=w-C<0,d=A.clone().add(H+(Z?-1:1),l);return+(-(H+(w-C)/(Z?C-d:d-C))||0)},a:function(B){return B<0?Math.ceil(B)||0:Math.floor(B)},p:function(B){return{M:l,y:p,w:u,d:o,D:h,h:a,m:s,s:i,ms:n,Q:c}[B]||String(B||"").toLowerCase().replace(/s$/,"")},u:function(B){return B===void 0}},F="en",X={};X[F]=x;var V=function(B){return B instanceof Ce},he=function(B,A,w){var H;if(!B)return F;if(typeof B=="string")X[B]&&(H=B),A&&(X[B]=A,H=B);else{var C=B.name;X[C]=B,H=C}return!w&&H&&(F=H),H||!w&&F},j=function(B,A){if(V(B))return B.clone();var w=typeof A=="object"?A:{};return w.date=B,w.args=arguments,new Ce(w)},G=N;G.l=he,G.i=V,G.w=function(B,A){return j(B,{locale:A.$L,utc:A.$u,x:A.$x,$offset:A.$offset})};var Ce=function(){function B(w){this.$L=he(w.locale,null,!0),this.parse(w)}var A=B.prototype;return A.parse=function(w){this.$d=function(H){var C=H.date,Z=H.utc;if(C===null)return new Date(NaN);if(G.u(C))return new Date;if(C instanceof Date)return new Date(C);if(typeof C=="string"&&!/Z$/i.test(C)){var d=C.match(y);if(d){var f=d[2]-1||0,m=(d[7]||"0").substring(0,3);return Z?new Date(Date.UTC(d[1],f,d[3]||1,d[4]||0,d[5]||0,d[6]||0,m)):new Date(d[1],f,d[3]||1,d[4]||0,d[5]||0,d[6]||0,m)}}return new Date(C)}(w),this.$x=w.x||{},this.init()},A.in
`).map(vM).filter(function(t){return t!==null});return at(at({},e[0]),e[1])}function sa(r){var e={},t=/DTSTART(?:;TZID=([^:=]+?))?(?::|=)([^;\s]+)/i.exec(r);if(!t)return e;var n=t[1],i=t[2];return n&&(e.tzid=n),e.dtstart=ta(i),e}function vM(r){if(r=r.replace(/^\s+|\s+$/,""),!r.length)return null;var e=/^([A-Z]+?)[:;]/.exec(r.toUpperCase());if(!e)return NT(r);var t=e[1];switch(t.toUpperCase()){case"RRULE":case"EXRULE":return NT(r);case"DTSTART":return sa(r);default:throw new Error("Unsupported RFC prop ".concat(t," in ").concat(r))}}function NT(r){var e=r.replace(/^RRULE:/i,""),t=sa(e),n=r.replace(/^(?:RRULE|EXRULE):/i,"").split(";");return n.forEach(function(i){var s=i.split("="),a=s[0],o=s[1];switch(a.toUpperCase()){case"FREQ":t.freq=ae[o.toUpperCase()];break;case"WKST":t.wkst=Vt[o.toUpperCase()];break;case"COUNT":case"INTERVAL":case"BYSETPOS":case"BYMONTH":case"BYMONTHDAY":case"BYYEARDAY":case"BYWEEKNO":case"BYHOUR":case"BYMINUTE":case"BYSECOND":var u=EM(o),l=a.toLowerCase();t[l]=u;break;case"BYWEEKDAY":case"BYDAY":t.byweekday=wM(o);break;case"DTSTART":case"TZID":var c=sa(r);t.tzid=c.tzid,t.dtstart=c.dtstart;break;case"UNTIL":t.until=ta(o);break;case"BYEASTER":t.byeaster=Number(o);break;default:throw new Error("Unknown RRULE property '"+a+"'")}}),t}function EM(r){if(r.indexOf(",")!==-1){var e=r.split(",");return e.map(IT)}return IT(r)}function IT(r){return/^[+-]?\d+$/.test(r)?Number(r):r}function wM(r){var e=r.split(",");return e.map(function(t){if(t.length===2)return Vt[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 i=Number(n[1]),s=n[2],a=Vt[s].weekday;return new Ye(a,i)})}var Pn=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=Ti(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(){return this.isUTC?this.date:OT(this.date,this.tzid)},r}();function oa(r){for(var e=[],t="",n=Object.keys(r),i=Object.keys(ia),s=0;s<n.length;s++)if(n[s]!=="tzid"&&!!ce(i,n[s])){var a=n[s].toUpperCase(),o=r[n[s]],u="";if(!(!Re(o)||st(o)&&!o.length)){switch(a){case"FREQ":u=$.FREQUENCIES[r.freq];break;case"WKST":Pt(o)?u=new Ye(o).toString():u=o.toString();break;case"BYWEEKDAY":a="BYDAY",u=bT(o).map(function(_){return _ instanceof Ye?_:st(_)?new Ye(_[0],_[1]):new Ye(_)}).toString();break;case"DTSTART":t=kM(o,r.tzid);break;case"UNTIL":u=Ti(o,!r.tzid);break;default:if(st(o)){for(var l=[],c=0;c<o.length;c++)l[c]=String(o[c]);u=l.toString()}else u=String(o)}u&&e.push([a,u])}}var p=e.map(function(_){var y=_[0],E=_[1];return"".concat(y,"=").concat(E.toString())}).join(";"),h="";return p!==""&&(h="RRULE:".concat(p)),[t,h].filter(function(_){return!!_}).join(`
`)}function kM(r,e){return r?"DTSTART"+new Pn(new Date(r),e).toString():""}function OM(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 FT=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?No(t):Mf(t)),e==="all"?this.all=t:(n._value=t,this[e].push(n))},r.prototype._cacheGet=function(e,t){var n=!1,i=t?Object.keys(t):[],s=function(c){for(var p=0;p<i.length;p++){var h=i[p];if(!OM(t[h],c[h]))return!0}return!1},a=this[e];if(e==="all")n=this.all;else if(st(a))for(var o=0;o<a.length;o++){var u=a[o];if(!(i.length&&s(u))){n=u._value;break}}if(!n&&this.all){for(var l=new Wr(e,t),o=0;o<this.all.length&&l.accept(this.all[o]);o++);n=l.getValue(),this._cacheAdd(e,n,t)}return st(n)?Mf(n):n instanceof Date?No(n):n},r}();var LT=M(M(M(M(M(M(M(M(M(M(M(M(M([],ue(1,31),!0),ue(2,28),!0),ue(3,31),!0),ue(4,30),!0),ue(5,31),!0),ue(6,30),!0),ue(7,31),!0),ue(8,31),!0),ue(9,30),!0),ue(10,31),!0),ue(11,30),!0),ue(12,31),!0),ue(1,7),!0),UT=M(M(M(M(M(M(M(M(M(M(M(M(M([],ue(1,31),!0),ue(2,29),!0),ue(3,31),!0),ue(4,30),!0),ue(5,31),!0),ue(6,30),!0),ue(7,31),!0),ue(8,31),!0),ue(9,30),!0),ue(10,31),!0),ue(11,30),!0),ue(12,31),!0),ue(1,7),!0),SM=Kt(1,29),DM=Kt(1,30),an=Kt(1,31),lt=Kt(1,32),WT=M(M(M(M(M(M(M(M(M(M(M(M(M([],lt,!0),DM,!0),lt,!0),an,!0),lt,!0),an,!0),lt,!0),lt,!0),an,!0),lt,!0),an,!0),lt,!0),lt.slice(0,7),!0),qT=M(M(M(M(M(M(M(M(M(M(M(M(M([],lt,!0),SM,!0),lt,!0),an,!0),lt,!0),an,!0),lt,!0),lt,!0),an,!0),lt,!0),an,!0),lt,!0),lt.slice(0,7),!0),RM=Kt(-28,0),xM=Kt(-29,0),on=Kt(-30,0),ct=Kt(-31,0),$T=M(M(M(M(M(M(M(M(M(M(M(M(M([],ct,!0),xM,!0),ct,!0),on,!0),ct,!0),on,!0),ct,!0),ct,!0),on,!0),ct,!0),on,!0),ct,!0),ct.slice(0,7),!0),YT=M(M(M(M(M(M(M(M(M(M(M(M(M([],ct,!0),RM,!0),ct,!0),on,!0),ct,!0),on,!0),ct,!0),ct,!0),on,!0),ct,!0),on,!0),ct,!0),ct.slice(0,7),!0),jT=[0,31,60,91,121,152,182,213,244,274,305,335,366],GT=[0,31,59,90,120,151,181,212,243,273,304,334,365],Nf=function(){for(var r=[],e=0;e<55;e++)r=r.concat(Kt(7));return r}();function BT(r,e){var t=Tr(r,1,1),n=yi(r)?366:365,i=yi(r+1)?366:365,s=ea(t),a=Lr(t),o=at(at({yearlen:n,nextyearlen:i,yearordinal:s,yearweekday:a},MM(r)),{wnomask:null});if(Nt(e.byweekno))return o;o.wnomask=ue(0,n+7);var u,l,c=u=ut(7-a+e.wkst,7);c>=4?(c=0,l=o.yearlen+ut(a-e.wkst,7)):l=n-c;for(var p=Math.floor(l/7),h=ut(l,7),_=Math.floor(p+h/4),y=0;y<e.byweekno.length;y++){var E=e.byweekno[y];if(E<0&&(E+=_+1),E>0&&E<=_){var x=void 0;E>1?(x=c+(E-1)*7,c!==u&&(x-=7-u)):x=c;for(var P=0;P<7&&(o.wnomask[x]=1,x++,o.wdaymask[x]!==e.wkst);P++);}}if(ce(e.byweekno,1)){var x=c+_*7;if(c!==u&&(x-=7-u),x<n)for(var y=0;y<7&&(o.wnomask[x]=1,x+=1,o.wdaymask[x]!==e.wkst);y++);}if(c){var N=void 0;if(ce(e.byweekno,-1))N=-1;else{var F=Lr(Tr(r-1,1,1)),X=ut(7-F.valueOf()+e.wkst,7),V=yi(r-1)?366:365,he=void 0;X>=4?(X=0,he=V+ut(F-e.wkst,7)):he=n-c,N=Math.floor(52+ut(he,7)/4)}if(ce(e.byweekno,N))for(var x=0;x<c;x++)o.wnomask[x]=1}return o}function MM(r){var e=yi(r)?366:365,t=Tr(r,1,1),n=Lr(t);return e===365?{mmask:LT,mdaymask:qT,nmdaymask:YT,wdaymask:Nf.slice(n),mrange:GT}:{mmask:UT,mdaymask:WT,nmdaymask:$T,wdaymask:Nf.slice(n),mrange:jT}}function HT(r,e,t,n,i,s){var a={lastyear:r,lastmonth:e,nwdaymask:[]},o=[];if(s.freq===$.YEARLY)if(Nt(s.bymonth))o=[[0,t]];else for(var u=0;u<s.bymonth.length;u++)e=s.bymonth[u],o.push(n.slice(e-1,e+1));else s.freq===$.MONTHLY&&(o=[n.slice(e-1,e+1)]);if(Nt(o))return a;a.nwdaymask=ue(0,t);for(var u=0;u<o.length;u++)for(var l=o[u],c=l[0],p=l[1]-1,h=0;h<s.bynweekday.length;h++){var _=void 0,y=s.bynweekday[h],E=y[0],x=y[1];x<0?(_=p+(x+1)*7,_-=ut(i[_]-E,7)):(_=c+(x-1)*7,_+=ut(7-i[_]+E,7)),c<=_&&_<=p&&(a.nwdaymask[_]=1)}return a}function zT(r,e){e===void 0&&(e=0);var t=r%19,n=Math.floor(r/100),i=r%100,s=Math.floor(n/4),a=n%4,o=Math.floor((n+8)/25),u=Math.floor((n-o+1)/3),l=Math.floor(19*t+n-s-u+15)%30,c=Math.floor(i/4),p=i%4,h=Math.floor(32+2*a+2*c-l-p)%7,_=Math.floor((t+11*l
`),n=0;n<t.length;){var i=t[n]=t[n].replace(/\s+$/g,"");i?n>0&&i[0]===" "?(t[n-1]+=i.slice(1),t.splice(n,1)):n+=1:t.splice(n,1)}return t}function $M(r){r.forEach(function(e){if(!/(VALUE=DATE(-TIME)?)|(TZID=)/.test(e))throw new Error("unsupported RDATE/EXDATE parm: "+e)})}function JT(r,e){return $M(e),r.split(",").map(function(t){return ta(t)})}function eb(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 i=e._rrule[n].origOptions[r];if(i)return i}}}var Ff=function(r){bi(e,r);function e(t){t===void 0&&(t=!1);var n=r.call(this,{},t)||this;return n.dtstart=eb.apply(n,["dtstart"]),n.tzid=eb.apply(n,["tzid"]),n._rrule=[],n._rdate=[],n._exrule=[],n._exdate=[],n}return e.prototype._iter=function(t){return XT(t,this._rrule,this._exrule,this._rdate,this._exdate,this.tzid())},e.prototype.rrule=function(t){tb(t,this._rrule)},e.prototype.exrule=function(t){tb(t,this._exrule)},e.prototype.rdate=function(t){rb(t,this._rdate)},e.prototype.exdate=function(t){rb(t,this._exdate)},e.prototype.rrules=function(){return this._rrule.map(function(t){return Fo(t.toString())})},e.prototype.exrules=function(){return this._exrule.map(function(t){return Fo(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(oa({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(`
`).map(function(i){return i.replace(/^RRULE:/,"EXRULE:")}).filter(function(i){return!/^DTSTART/.test(i)}))}),this._rdate.length&&t.push(nb("RDATE",this._rdate,this.tzid())),this._exdate.length&&t.push(nb("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}($);function tb(r,e){if(!(r instanceof $))throw new TypeError(String(r)+" is not RRule instance");ce(e.map(String),String(r))||e.push(r)}function rb(r,e){if(!(r instanceof Date))throw new TypeError(String(r)+" is not Date instance");ce(e.map(Number),Number(r))||(e.push(r),Ur(e))}function nb(r,e,t){var n=!t||t.toUpperCase()==="UTC",i=n?"".concat(r,":"):"".concat(r,";TZID=").concat(t,":"),s=e.map(function(a){return Ti(a.valueOf(),n)}).join(",");return"".concat(i).concat(s)}function $r(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 Ze=class{constructor({rrule:e,baseOnToday:t,referenceDate:n,startDate:i,scheduledDate:s,dueDate:a}){this.rrule=e,this.baseOnToday=t,this.referenceDate=n,this.startDate=i,this.scheduledDate=s,this.dueDate=a}static fromText({recurrenceRuleText:e,startDate:t,scheduledDate:n,dueDate:i}){try{let s=e.match(/^([a-zA-Z0-9, !]+?)( when done)?$/i);if(s==null)return null;let a=s[1].trim(),o=s[2]!==void 0,u=$.parseText(a);if(u!==null){let l=null;i?l=window.moment(i):n?l=window.moment(n):t&&(l=window.moment(t)),!o&&l!==null?u.dtstart=window.moment(l).startOf("day").utc(!0).toDate():u.dtstart=window.moment().startOf("day").utc(!0).toDate();let c=new $(u);return new Ze({rrule:c,baseOnToday:o,referenceDate:l,startDate:t,scheduledDate:n,dueDate:i})}}catch(s){s instanceof Error&&console.log(s.message)}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,i=null;if(this.referenceDate){if(this.startDate){let s=window.moment.duration(this.startDate.diff(this.referenceDate));t=window.moment(e),t.add(Math.round(s.asDays()),"days")}if(this.scheduledDate){let s=window.moment.duration(this.scheduledDate.diff(this.referenceDate));n=window.moment(e),n.add(Math.round(s.asDays()),"days")}if(this.dueDate){let s=window.moment.duration(this.dueDate.diff(this.referenceDate));i=window.moment(e),i.add(Math.round(s.asDays()),"days")}}return{startDate:t,scheduledDate:n,dueDate:i}}return null}identicalTo(e){return this.baseOnToday!==e.baseOnToday||$r(this.startDate,e.startDate)!==0||$r(this.scheduledDate,e.scheduledDate)!==0||$r(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 $(Tt(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())),i=this.toText(),s=i.match(/every( \d+)? month(s)?(.*)?/);s!==null&&(i.includes(" on ")||(n=Ze.nextAfterMonths(e,n,t,s[1])));let a=i.match(/every( \d+)? year(s)?(.*)?/);return a!==null&&(n=Ze.nextAfterYears(e,n,t,a[1])),Ze.addTimezone(n)}static nextAfterMonths(e,t,n,i){let s=1;for(i!==void 0&&(s=Number.parseInt(i.trim(),10));Ze.isSkippingTooManyMonths(e,t,s);)t=Ze.fromOneDayEarlier(e,n);return t}static isSkippingTooManyMonths(e,t,n){let i=t.month()-e.month();return i+=(t.year()-e.year())*12,i>n}static nextAfterYears(e,t,n,i){let s=1;for(i!==void 0&&(s=Number.parseInt(i.trim(),10));Ze.isSkippingTooManyYears(e,t,s);)t=Ze.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").toDat
`}),a=a.slice(0,s.autoSuggestMaxItems),a}}function YM(r,e,t,n){let i=u=>Object.values(n.prioritySymbols).some(l=>l.length>0&&u.includes(l)),s=[];if(r.includes(n.dueDateSymbol)||s.push({displayText:`${n.dueDateSymbol} due date`,appendText:`${n.dueDateSymbol} `}),r.includes(n.startDateSymbol)||s.push({displayText:`${n.startDateSymbol} start date`,appendText:`${n.startDateSymbol} `}),r.includes(n.scheduledDateSymbol)||s.push({displayText:`${n.scheduledDateSymbol} scheduled date`,appendText:`${n.scheduledDateSymbol} `}),i(r)||(s.push({displayText:`${n.prioritySymbols.High} high priority`,appendText:`${n.prioritySymbols.High} `}),s.push({displayText:`${n.prioritySymbols.Medium} medium priority`,appendText:`${n.prioritySymbols.Medium} `}),s.push({displayText:`${n.prioritySymbols.Low} low priority`,appendText:`${n.prioritySymbols.Low} `}),s.push({displayText:`${n.prioritySymbols.Highest} highest priority`,appendText:`${n.prioritySymbols.Highest} `}),s.push({displayText:`${n.prioritySymbols.Lowest} lowest priority`,appendText:`${n.prioritySymbols.Lowest} `})),r.includes(n.recurrenceSymbol)||s.push({displayText:`${n.recurrenceSymbol} recurring (repeat)`,appendText:`${n.recurrenceSymbol} `}),!r.includes(n.createdDateSymbol)){let l=Ct.parseDate("today",!0).format(z.dateFormat);s.push({textToMatch:`${n.createdDateSymbol} created`,displayText:`${n.createdDateSymbol} created today (${l})`,appendText:`${n.createdDateSymbol} ${l} `})}let a=Wf(r,/([a-zA-Z'_-]*)/g,e),o=[];if(a&&a.length>0){let u=a[0];if(u.length>=Math.max(1,t.autoSuggestMinMatch)){let l=s.filter(c=>(c.textToMatch||c.displayText).toLowerCase().includes(u.toLowerCase()));for(let c of l)o.push({suggestionType:"match",displayText:c.displayText,appendText:c.appendText,insertAt:a.index,insertSkip:u.length})}}return o.length===0&&t.autoSuggestMinMatch===0?s:o}function jM(r,e,t,n,i){let s=["today","tomorrow","Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday","next week","next month","next year"],a=[],o=new RegExp(`(${n})\\s*([0-9a-zA-Z ]*)`,"ug"),u=Wf(r,o,e);if(u&&u.length>=2){let l=u[1],c=u[2];if(c.length<t.autoSuggestMinMatch)return[];let p=c&&c.length>1?Ct.parseDate(gi(c),!0):null;p&&p.isValid()&&a.push({displayText:`${p.format(z.dateFormat)}`,appendText:`${l} ${p.format(z.dateFormat)} `,insertAt:u.index,insertSkip:u[0].length});let h=1,_=s.filter(y=>c&&c.length>=h&&y.toLowerCase().includes(c.toLowerCase())).slice(0,i);_.length===0&&(_=s.slice(0,i));for(let y of _){let x=`${Ct.parseDate(y,!0).format(z.dateFormat)}`;a.push({suggestionType:"match",displayText:`${y} (${x})`,appendText:`${l} ${x} `,insertAt:u.index,insertSkip:u[0].length})}}return a}function GM(r,e,t,n){var u;let i=["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"],s=[],a=new RegExp(`(${n})\\s*([0-9a-zA-Z ]*)`,"ug"),o=Wf(r,a,e);if(o&&o.length>=2){let l=o[1],c=o[2];if(c.length<t.autoSuggestMinMatch)return[];if(c.length>0){let y=(u=Ze.fromText({recurrenceRuleText:c,startDate:null,scheduledDate:null,dueDate:null}))==null?void 0:u.toText();if(y){let E=`${l} ${y} `;if(s.push({suggestionType:"match",displayText:`\u2705 ${y}`,appendText:E,insertAt:o.index,insertSkip:o[0].length}),o[0]==E)return[]}}let p=1,h=t.autoSuggestMaxItems/2,_=i.filter(y=>c&&c.length>=p&&y.toLowerCase().includes(c.toLowerCase())).slice(0,h);_.length===0&&c.trim().length===0&&(_=i.slice(0,h));for(let y of _)s.push({suggestionType:"match",displayText:`${y}`,appendText:`${l} ${y} `,insertAt:o.index,insertSkip:o[0].length})}return s}function Wf(r,e,t){let n=r.matchAll(e);for(let i of n)if((i==null?void 0:i.index)&&i.index<=t&&t<=i.index+i[0].length)return i}function BM(r,e){if(e.length===0)return!1;let t=Object.fromEntries(e.map(([i,s])=>[i,0])),n=Object.fromEntries(e.map(([i,s])=>[s,i]));for(let i of r)i in t?t[i]++:i in n&&(t[n[i]]=Math.max(0,t[n[i]]-1));return Object.values(t).some(i=>i>0)}function sb(r,e){return(t,n,i)=>BM(t.slice
\`\`\`${n}
flowchart LR
${i.join(`
`)}
${s.join(`
`)}
\`\`\`
`}};var or=class{static calculate(e){let t=0;if(e.dueDate!==null){let n=window.moment().startOf("day"),i=Math.round(n.diff(e.dueDate)/or.milliSecondsPerDay),s;i>=7?s=1:i>=-14?s=(i+14)*.8/21+.2:s=.2,t+=s*or.dueCoefficient}switch(e.scheduledDate!==null&&window.moment().isSameOrAfter(e.scheduledDate)&&(t+=1*or.scheduledCoefficient),e.startDate!==null&&window.moment().isBefore(e.startDate)&&(t+=1*or.startedCoefficient),e.priority){case"0":t+=1.5*or.priorityCoefficient;break;case"1":t+=1*or.priorityCoefficient;break;case"2":t+=.65*or.priorityCoefficient;break;case"3":t+=.325*or.priorityCoefficient;break;case"5":t-=.3*or.priorityCoefficient;break}return t}},jr=or;jr.dueCoefficient=12,jr.scheduledCoefficient=5,jr.startedCoefficient=-3,jr.priorityCoefficient=6,jr.milliSecondsPerDay=1e3*60*60*24;var Rt=class{static fromPath(e){let{useFilenameAsScheduledDate:t,filenameAsDateFolders:n}=Q();return!t||!this.matchesAnyFolder(n,e)?null:this.extractDateFromPath(e)}static matchesAnyFolder(e,t){return e.length===0?!0:e.some(n=>t.startsWith(n+"/"))}static extractDateFromPath(e){let t=Math.max(0,e.lastIndexOf("/")+1),n=e.lastIndexOf("."),i=e.substring(t,n),s=/(\d{4})-(\d{2})-(\d{2})/.exec(i);if(s||(s=/(\d{4})(\d{2})(\d{2})/.exec(i)),s){let a=window.moment([parseInt(s[1]),parseInt(s[2])-1,parseInt(s[3])]);if(a.isValid())return a}return null}static canApplyFallback({startDate:e,scheduledDate:t,dueDate:n}){return e===null&&n===null&&t===null}static updateTaskPath(e,t,n){let i=e.scheduledDate,s=e.scheduledDateIsInferred;return n===null?s&&(s=!1,i=null):s?i=n:this.canApplyFallback(e)&&(i=n,s=!0),new ye(Tt(pe({},e),{taskLocation:e.taskLocation.fromRenamedFile(t),scheduledDate:i,scheduledDateIsInferred:s}))}static removeInferredStatusIfNeeded(e,t){let n=e.scheduledDateIsInferred?e.scheduledDate:null;return t.map(i=>(n!==null&&!n.isSame(i.scheduledDate,"day")&&(i=new ye(Tt(pe({},i),{scheduledDateIsInferred:!1}))),i))}};var Gr=class{constructor(e,t){this.name=e,this.sortOrder=t}get groupText(){return this.name!==""?`%%${this.sortOrder}%% ${this.name}`:""}};var vt=class{constructor(e){this._date=null;this._date=e}get moment(){return this._date}formatAsDate(e=""){return this.format(z.dateFormat,e)}formatAsDateAndTime(e=""){return this.format(z.dateTimeFormat,e)}format(e,t=""){return this._date?this._date.format(e):t}toISOString(e){return this._date?this._date.toISOString(e):""}get category(){let e=window.moment(),t=this.moment;return t?t.isBefore(e,"day")?new Gr("Overdue",1):t.isSame(e,"day")?new Gr("Today",2):new Gr("Future",3):new Gr("Undated",4)}get fromNow(){let e=this.moment;if(!e)return new Gr("",0);let t=this.fromNowOrder(e);return new Gr(e.fromNow(),t)}fromNowOrder(e){let t=window.moment(),n=e.isSameOrBefore(t,"day"),i=this.fromNowStartDateOfGroup(e,n,t);return Number((n?1:3)+i.format("YYYYMMDD"))}fromNowStartDateOfGroup(e,t,n){let i=e.fromNow(!0).split(" "),s,a=Number(i[0]);isNaN(a)?s=1:s=a;let o=i[1];return t?n.subtract(s,o):n.add(s,o)}};var Ei=class{constructor(e){this._path=e}get path(){return this._path}get pathWithoutExtension(){return this.withoutExtension(this.path)}withoutExtension(e){return e.replace(/\.md$/,"")}get root(){let e=this.path.replace(/\\/g,"/");e.charAt(0)==="/"&&(e=e.substring(1));let t=e.indexOf("/");return t==-1?"/":e.substring(0,t+1)}get folder(){let e=this.path,t=this.filename,n=e.substring(0,e.lastIndexOf(t));return n===""?"/":n}get filename(){let e=this.path.match(/([^/]+)$/);return e!==null?e[1]:""}get filenameWithoutExtension(){return this.withoutExtension(this.filename)}};var Br=class{static priorityNameUsingNone(e){let t="ERROR";switch(e){case"1":t="High";break;case"0":t="Highest";break;case"2":t="Medium";break;case"3":t="None";break;case"4":t="Low";break;case"5":t="Lowest";break}return t}static priorityNameUsingNormal(e){return Br.priorityNameUsingNone(e).replace("None","Normal")}};var It=class{},z=It;z.dateFormat="YYYY-MM-DD",z.dateTimeFormat="YYYY-MM-DD HH:mm",z.indentationRegex=/^([\s\t>]*)/,z.listMarkerRegex=/([-*+]|[0-9]+\.)/,z.checkboxRegex=/\[(.)\]/u,z.afterCheckboxRegex=/ *(.*)/u,z.taskRegex=new RegE
`),o=a.length,u=new da(()=>Rt.fromPath(i.path)),l=null,c=0;for(let p of t)if(p.task!==void 0){let h=p.position.start.line;if(h>=o)return console.log(`${i.path} Obsidian gave us a line number ${h} past the end of the file. ${o}.`),s;if((l===null||l.position.end.line<h)&&(l=Ln.getSection(h,n.sections),c=0),l===null)continue;let _=a[h];if(_===void 0){console.log(`${i.path}: line ${h} - ignoring 'undefined' line.`);continue}let y;try{y=ye.fromLine({line:_,taskLocation:new ot(i.path,h,l.position.start.line,c,Ln.getPrecedingHeader(h,n.headings)),fallbackDate:u.value})}catch(E){this.reportTaskParsingErrorToUser(E,i,p,_);continue}y!==null&&(c++,s.push(y))}return s}reportTaskParsingErrorToUser(e,t,n,i){let s=`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}
1 year ago
Task line: ${i}
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.
`;console.error(s),e instanceof Error&&console.error(e.stack),this.state==="Initializing"&&new wi.Notice(s,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 i of t){if(i.position.start.line>e)return n;n=i.heading}return n}};var Zf=require("obsidian");var Sb=require("obsidian");function Hr(){}function Gf(r){return r()}function lb(){return Object.create(null)}function Wn(r){r.forEach(Gf)}function qo(r){return typeof r=="function"}function db(r,e){return r!=r?e==e:r!==e||r&&typeof r=="object"||typeof r=="function"}function fb(r){return Object.keys(r).length===0}var pb=typeof window!="undefined"?window:typeof globalThis!="undefined"?globalThis:global,pa=class{constructor(e){this.options=e,this._listeners="WeakMap"in pb?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 i of t)pa.entries.set(i.target,i),(n=this._listeners.get(i.target))===null||n===void 0||n(i)})}};pa.entries="WeakMap"in pb?new WeakMap:void 0;var hb=!1;function QM(){hb=!0}function XM(){hb=!1}function R(r,e){r.appendChild(e)}function Di(r,e,t){r.insertBefore(e,t||null)}function qn(r){r.parentNode&&r.parentNode.removeChild(r)}function Bf(r,e){for(let t=0;t<r.length;t+=1)r[t]&&r[t].d(e)}function K(r){return document.createElement(r)}function ZM(r){return document.createElementNS("http://www.w3.org/2000/svg",r)}function dt(r){return document.createTextNode(r)}function de(){return dt(" ")}function Et(r,e,t,n){return r.addEventListener(e,t,n),()=>r.removeEventListener(e,t,n)}function mb(r){return function(e){return e.preventDefault(),r.call(this,e)}}function L(r,e,t){t==null?r.removeAttribute(e):r.getAttribute(e)!==t&&r.setAttribute(e,t)}function gb(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 JM(r){return Array.from(r.childNodes)}function Hf(r,e){e=""+e,r.data!==e&&(r.data=e)}function ur(r,e){r.value=e==null?"":e}function zf(r,e,t){for(let n=0;n<r.options.length;n+=1){let i=r.options[n];if(i.__value===e){i.selected=!0;return}}(!t||e!==void 0)&&(r.selectedIndex=-1)}function yb(r){let e=r.querySelector(":checked");return e&&e.__value}function lr(r,e,t){r.classList[t?"add":"remove"](e)}var Un=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=ZM(t.nodeName):this.e=K(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)Di(this.t,this.n[t],e)}p(e){this.d(),this.h(e),this.i(this.a)}d(){this.n.forEach(qn)}};var ha;function fa(r){ha=r}function eA(){if(!ha)throw new Error("Function called outside component initialization");return ha}function Kf(r){eA().$$.on_mount.push(r)}var Oi=[];var $o=[],Si=[],cb=[],tA=Promise.resolve(),jf=!1;function rA(){jf||(jf=!0,tA.then(Tb))}function ma(r){Si.push(r)}var Yf=new Set,ki=0;function Tb(){if(ki!==0)return;let r=ha;do{try{for(;ki<Oi.length;){let e=Oi[ki];ki++,fa(e),nA(e.$$)}}catch(e){throw Oi.length=0,ki=0,e}for(fa(null),Oi.length=0,ki=0;$o.length;)$o.pop()();for(let e=0;e<Si.length;e+=1){let t=Si[e];Yf.has(t)||(Yf.add(t),t())}Si.length=0}while(Oi.length);for(;cb.length;)cb.pop()();jf=!1,Yf.clear(),fa(r)}function nA(r){if(r.fragment!==null){r.update(),Wn(r.before_update);let e=r.dirty;r.dirty=[-1],r.fragment&&r.fragment.p(r.ctx,e),r.after_update.forEach(ma)}}function iA(r){let e=[],t=[];Si.forEach(n=>r.indexOf(n)===-1?e.push(n):t.push(n)),t.forEach(n=>n()),Si=e}var sA=new Set;function aA(r,e){r&&r.i&&(sA.delete(r),r.i(e))}var oA=["allowfullscreen","allowpaymentrequest","async","autofocus","autoplay","ch
<span class="accesskey-first">future</span> dates:`,Dp=de(),fr=K("input"),Rp=de(),Qn=K("div"),Ra=K("label"),Ra.innerHTML='Stat<span class="accesskey">u</span>s',xp=de(),qt=K("select");for(let Y=0;Y<yt.length;Y+=1)yt[Y].c();Mp=de(),Qr=K("div"),zi=K("div"),Ma=K("label"),Ma.textContent="Completed:",Ap=de(),Xr=K("input"),Cp=de(),Ki=K("div"),Pu=K("span"),Pu.textContent="Created on:",Pp=de(),Ca=K("code"),Np=de(),Vi=K("div"),Nu=K("span"),Nu.textContent="Done on:",Ip=de(),Pa=K("code"),Fp=de(),Xn=K("div"),Tn=K("button"),Lp=dt("Apply"),Up=de(),Qi=K("button"),Qi.textContent="Cancel",L(i,"for","description"),L(a,"id","description"),L(a,"class","tasks-modal-description"),L(a,"placeholder","Take out the trash"),L(a,"accesskey",o=r[15]("t")),L(n,"class","tasks-modal-section"),L(c,"for",h="priority-"+r[1].priority),L(l,"class","tasks-modal-section tasks-modal-priorities"),L(x,"for","recurrence"),L(x,"class","accesskey-first"),L(N,"id","recurrence"),L(N,"type","text"),L(N,"placeholder","Try 'every 2 weeks on Thursday'."),L(N,"accesskey",F=r[15]("r")),lr(N,"tasks-modal-error",!r[8]),G.a=null,L(Ie,"for","due"),L(Ie,"class","accesskey-first"),L(A,"id","due"),L(A,"type","text"),L(A,"placeholder",Vf),L(A,"accesskey",w=r[15]("d")),lr(A,"tasks-modal-error",!r[7]),f.a=null,L(g,"for","scheduled"),L(g,"class","accesskey-first"),L(v,"id","scheduled"),L(v,"type","text"),L(v,"placeholder",Vf),L(v,"accesskey",k=r[15]("s")),lr(v,"tasks-modal-error",!r[5]),me.a=null,L(re,"for","start"),L(U,"id","start"),L(U,"type","text"),L(U,"placeholder",Vf),L(U,"accesskey",xe=r[15]("a")),lr(U,"tasks-modal-error",!r[3]),Fe.a=null,L(Sa,"for","forwardOnly"),L(fr,"id","forwardOnly"),L(fr,"type","checkbox"),L(fr,"class","task-list-item-checkbox tasks-modal-checkbox"),L(fr,"accesskey",Da=r[15]("f")),L(E,"class","tasks-modal-section tasks-modal-dates"),L(Ra,"for","status"),L(qt,"id","status-type"),L(qt,"class","dropdown"),L(qt,"accesskey",xa=r[15]("u")),r[1].status===void 0&&ma(()=>r[39].call(qt)),L(Qn,"class","tasks-modal-section"),L(Ma,"for","status"),L(Xr,"id","status"),L(Xr,"type","checkbox"),L(Xr,"class","task-list-item-checkbox tasks-modal-checkbox"),Xr.checked=Aa=r[1].status.isCompleted(),Xr.disabled=!0,L(Qr,"class","tasks-modal-section tasks-modal-status"),Tn.disabled=Na=!r[14],L(Tn,"type","submit"),L(Tn,"class","mod-cta"),L(Qi,"type","button"),L(Xn,"class","tasks-modal-section tasks-modal-buttons"),lr(t,"with-accesskeys",r[9]),L(e,"class","tasks-modal")},m(Y,fe){Di(Y,e,fe),R(e,t),R(t,n),R(n,i),R(n,s),R(n,a),ur(a,r[1].description),r[31](a),R(t,u),R(t,l),R(l,c),R(c,p),R(l,_);for(let le=0;le<gt.length;le+=1)gt[le]&&gt[le].m(l,null);R(t,y),R(t,E),R(E,x),R(E,P),R(E,N),ur(N,r[1].recurrenceRule),R(E,X),R(E,V),R(V,he),R(V,j),G.m(r[12],V),R(E,Ce),R(E,Ie),R(E,B),R(E,A),ur(A,r[1].dueDate),R(E,H),R(E,C),R(C,Z),R(C,d),f.m(r[6],C),R(E,m),R(E,g),R(E,T),R(E,v),ur(v,r[1].scheduledDate),R(E,D),R(E,O),R(O,S),R(O,I),me.m(r[4],O),R(E,se),R(E,re),R(E,Se),R(E,U),ur(U,r[1].startDate),R(E,Ae),R(E,tt),R(tt,Dr),R(tt,Ue),Fe.m(r[2],tt),R(E,Sp),R(E,Hi),R(Hi,Sa),R(Hi,Dp),R(Hi,fr),fr.checked=r[1].forwardOnly,R(t,Rp),R(t,Qn),R(Qn,Ra),R(Qn,xp),R(Qn,qt);for(let le=0;le<yt.length;le+=1)yt[le]&&yt[le].m(qt,null);zf(qt,r[1].status,!0),R(t,Mp),R(t,Qr),R(Qr,zi),R(zi,Ma),R(zi,Ap),R(zi,Xr),R(Qr,Cp),R(Qr,Ki),R(Ki,Pu),R(Ki,Pp),R(Ki,Ca),Ca.innerHTML=r[11],R(Qr,Np),R(Qr,Vi),R(Vi,Nu),R(Vi,Ip),R(Vi,Pa),Pa.innerHTML=r[13],R(t,Fp),R(t,Xn),R(Xn,Tn),R(Tn,Lp),R(Xn,Up),R(Xn,Qi),Iu||(Wp=[Et(a,"input",r[30]),Et(a,"keydown",r[23]),Et(a,"paste",r[24]),Et(a,"drop",r[24]),Et(l,"keyup",r[21]),Et(N,"input",r[34]),Et(A,"input",r[35]),Et(v,"input",r[36]),Et(U,"input",r[37]),Et(fr,"change",r[38]),Et(qt,"change",r[39]),Et(Qi,"click",r[22]),Et(t,"submit",mb(r[25]))],Iu=!0)},p(Y,fe){if(fe[0]&32768&&o!==(o=Y[15]("t"))&&L(a,"accesskey",o),fe[0]&3&&ur(a,Y[1].description),fe[0]&3&&h!==(h="priority-"+Y[1].priority)&&L(c,"for",h),fe[0]&1081346){Zn=Y[20];let le;for(le=0;le<Zn.length;le+=1){let Xi=Eb(Y,Zn,le);gt[le]?gt[le].p(Xi,fe):(gt[le]=wb(Xi),gt[le].c(),gt[le].m(l,null))}for(;le<gt.length;le+=1)gt[le].d(1);gt.lengt
`);e.setLine(a,_)};new dn({app:n,task:u,onSubmit:l}).open()};var Jf=require("obsidian");var Rb=(r,e,t)=>{var u;if(r)return t instanceof Jf.MarkdownView;if(!(t instanceof Jf.MarkdownView))return;let n=(u=t.file)==null?void 0:u.path;if(n===void 0)return;let i=e.getCursor(),s=i.line,a=e.getLine(s),o=gA(a,n);e.setLine(s,o.text),e.setCursor(yA(i,o))},gA=(r,e)=>{let t=ye.fromLine({line:r,taskLocation:ot.fromUnknownPosition(e),fallbackDate:null});if(t!==null){let n=t.toggleWithRecurrenceInUsersOrder().map(i=>i.toFileLineString());return{text:n.join(`
`),moveTo:{line:n.length-1}}}else{let n=r.match(z.taskRegex);if(n!==null){let i=n[3],a=De.getInstance().bySymbol(i).nextStatusSymbol;return{text:r.replace(z.taskRegex,`$1- [${a}] $4`)}}else if(z.listItemRegex.test(r)){let i=r.replace(z.listItemRegex,"$1$2 [ ]");return{text:i,moveTo:{ch:i.length}}}else{let i=r.replace(z.indentationRegex,"$1- ");return{text:i,moveTo:{ch:i.length}}}}},yA=(r,e)=>{var s;let t={line:0,ch:r.ch},n=pe(pe({},t),(s=e.moveTo)!=null?s:{}),i=e.text.split(`
`)[n.line].length;return{line:r.line+n.line,ch:Math.min(n.ch,i)}};var Go=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,i)=>Db(t,n,i,this.app)}),e.addCommand({id:"toggle-done",name:"Toggle task done",icon:"check-in-circle",editorCheckCallback:Rb})}};var TA=Object.prototype.toString,xi=Array.isArray||function(e){return TA.call(e)==="[object Array]"};function tp(r){return typeof r=="function"}function bA(r){return xi(r)?"array":typeof r}function ep(r){return r.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g,"\\$&")}function xb(r,e){return r!=null&&typeof r=="object"&&e in r}function _A(r,e){return r!=null&&typeof r!="object"&&r.hasOwnProperty&&r.hasOwnProperty(e)}var vA=RegExp.prototype.test;function EA(r,e){return vA.call(r,e)}var wA=/\S/;function kA(r){return!EA(wA,r)}var OA={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;","/":"&#x2F;","`":"&#x60;","=":"&#x3D;"};function SA(r){return String(r).replace(/[&<>"'`=\/]/g,function(t){return OA[t]})}var DA=/\s*/,RA=/\s+/,Mb=/\s*=/,xA=/\s*\}/,MA=/#|\^|\/|>|\{|&|=|!/;function AA(r,e){if(!r)return[];var t=!1,n=[],i=[],s=[],a=!1,o=!1,u="",l=0;function c(){if(a&&!o)for(;s.length;)delete i[s.pop()];else s=[];a=!1,o=!1}var p,h,_;function y(G){if(typeof G=="string"&&(G=G.split(RA,2)),!xi(G)||G.length!==2)throw new Error("Invalid tags: "+G);p=new RegExp(ep(G[0])+"\\s*"),h=new RegExp("\\s*"+ep(G[1])),_=new RegExp("\\s*"+ep("}"+G[1]))}y(e||Xt.tags);for(var E=new ya(r),x,P,N,F,X,V;!E.eos();){if(x=E.pos,N=E.scanUntil(p),N)for(var he=0,j=N.length;he<j;++he)F=N.charAt(he),kA(F)?(s.push(i.length),u+=F):(o=!0,t=!0,u+=" "),i.push(["text",F,x,x+1]),x+=1,F===`
`&&(c(),u="",l=0,t=!1);if(!E.scan(p))break;if(a=!0,P=E.scan(MA)||"name",E.scan(DA),P==="="?(N=E.scanUntil(Mb),E.scan(Mb),E.scanUntil(h)):P==="{"?(N=E.scanUntil(_),E.scan(xA),E.scanUntil(h),P="&"):N=E.scanUntil(h),!E.scan(h))throw new Error("Unclosed tag at "+E.pos);if(P==">"?X=[P,N,x,E.pos,u,l,t]:X=[P,N,x,E.pos],l++,i.push(X),P==="#"||P==="^")n.push(X);else if(P==="/"){if(V=n.pop(),!V)throw new Error('Unopened section "'+N+'" at '+x);if(V[1]!==N)throw new Error('Unclosed section "'+V[1]+'" at '+x)}else P==="name"||P==="{"||P==="&"?o=!0:P==="="&&y(N)}if(c(),V=n.pop(),V)throw new Error('Unclosed section "'+V[1]+'" at '+E.pos);return PA(CA(i))}function CA(r){for(var e=[],t,n,i=0,s=r.length;i<s;++i)t=r[i],t&&(t[0]==="text"&&n&&n[0]==="text"?(n[1]+=t[1],n[3]=t[3]):(e.push(t),n=t));return e}function PA(r){for(var e=[],t=e,n=[],i,s,a=0,o=r.length;a<o;++a)switch(i=r[a],i[0]){case"#":case"^":t.push(i),n.push(i),t=i[4]=[];break;case"/":s=n.pop(),s[5]=i[2],t=n.length>0?n[n.length-1][4]:e;break;default:t.push(i)}return e}function ya(r){this.string=r,this.tail=r,this.pos=0}ya.prototype.eos=function(){return this.tail===""};ya.prototype.scan=function(e){var t=this.tail.match(e);if(!t||t.index!==0)return"";var n=t[0];return this.tail=this.tail.substring(n.length),this.pos+=n.length,n};ya.prototype.scanUntil=function(e){var t=this.tail.search(e),n;switch(t){case-1:n=this.tail,this.tail="";break;case 0:n="";break;default:n=this.tail.substring(0,t),this.tail=this.tail.substring(t)}return this.pos+=n.length,n};function Ri(r,e){this.view=r,this.cache={".":this.view},this.parent=e}Ri.prototype.push=function(e){return new Ri(e,this)};Ri.prototype.lookup=function(e){var t=this.cache,n;if(t.hasOwnProperty(e))n=t[e];else{for(var i=this,s,a,o,u=!1;i;){if(e.indexOf(".")>0)for(s=i.view,a=e.split("."),o=0;s!=null&&o<a.length;)o===a.length-1&&(u=xb(s,a[o])||_A(s,a[o])),s=s[a[o++]];else s=i.view[e],u=xb(i.view,e);if(u){n=s;break}i=i.parent}t[e]=n}return tp(n)&&(n=n.call(this.view)),n};function wt(){this.templateCache={_cache:{},set:function(e,t){this._cache[e]=t},get:function(e){return this._cache[e]},clear:function(){this._cache={}}}}wt.prototype.clearCache=function(){typeof this.templateCache!="undefined"&&this.templateCache.clear()};wt.prototype.parse=function(e,t){var n=this.templateCache,i=e+":"+(t||Xt.tags).join(":"),s=typeof n!="undefined",a=s?n.get(i):void 0;return a==null&&(a=AA(e,t),s&&n.set(i,a)),a};wt.prototype.render=function(e,t,n,i){var s=this.getConfigTags(i),a=this.parse(e,s),o=t instanceof Ri?t:new Ri(t,void 0);return this.renderTokens(a,o,n,e,i)};wt.prototype.renderTokens=function(e,t,n,i,s){for(var a="",o,u,l,c=0,p=e.length;c<p;++c)l=void 0,o=e[c],u=o[0],u==="#"?l=this.renderSection(o,t,n,i,s):u==="^"?l=this.renderInverted(o,t,n,i,s):u===">"?l=this.renderPartial(o,t,n,s):u==="&"?l=this.unescapedValue(o,t):u==="name"?l=this.escapedValue(o,t,s):u==="text"&&(l=this.rawValue(o)),l!==void 0&&(a+=l);return a};wt.prototype.renderSection=function(e,t,n,i,s){var a=this,o="",u=t.lookup(e[1]);function l(h){return a.render(h,t,n,s)}if(!!u){if(xi(u))for(var c=0,p=u.length;c<p;++c)o+=this.renderTokens(e[4],t.push(u[c]),n,i,s);else if(typeof u=="object"||typeof u=="string"||typeof u=="number")o+=this.renderTokens(e[4],t.push(u),n,i,s);else if(tp(u)){if(typeof i!="string")throw new Error("Cannot use higher-order sections without the original template");u=u.call(t.view,i.slice(e[3],e[5]),l),u!=null&&(o+=u)}else o+=this.renderTokens(e[4],t,n,i,s);return o}};wt.prototype.renderInverted=function(e,t,n,i,s){var a=t.lookup(e[1]);if(!a||xi(a)&&a.length===0)return this.renderTokens(e[4],t,n,i,s)};wt.prototype.indentPartial=function(e,t,n){for(var i=t.replace(/[^ \t]/g,""),s=e.split(`
1 year ago
`),a=0;a<s.length;a++)s[a].length&&(a>0||!n)&&(s[a]=i+s[a]);return s.join(`
`)};wt.prototype.renderPartial=function(e,t,n,i){if(!!n){var s=this.getConfigTags(i),a=tp(n)?n(e[1]):n[e[1]];if(a!=null){var o=e[6],u=e[5],l=e[4],c=a;u==0&&l&&(c=this.indentPartial(a,l,o));var p=this.parse(c,s);return this.renderTokens(p,t,n,c,i)}}};wt.prototype.unescapedValue=function(e,t){var n=t.lookup(e[1]);if(n!=null)return n};wt.prototype.escapedValue=function(e,t,n){var i=this.getConfigEscape(n)||Xt.escape,s=t.lookup(e[1]);if(s!=null)return typeof s=="number"&&i===Xt.escape?String(s):i(s)};wt.prototype.rawValue=function(e){return e[1]};wt.prototype.getConfigTags=function(e){return xi(e)?e:e&&typeof e=="object"?e.tags:void 0};wt.prototype.getConfigEscape=function(e){if(e&&typeof e=="object"&&!xi(e))return e.escape};var Xt={name:"mustache.js",version:"4.2.0",tags:["{{","}}"],clearCache:void 0,escape:void 0,parse:void 0,render:void 0,Scanner:void 0,Context:void 0,Writer:void 0,set templateCache(r){ga.templateCache=r},get templateCache(){return ga.templateCache}},ga=new wt;Xt.clearCache=function(){return ga.clearCache()};Xt.parse=function(e,t){return ga.parse(e,t)};Xt.render=function(e,t,n,i){if(typeof e!="string")throw new TypeError('Invalid template! Template should be a "string" but "'+bA(e)+'" was given as the first argument for mustache#render(template, view, partials)');return ga.render(e,t,n,i)};Xt.escape=SA;Xt.Scanner=ya;Xt.Context=Ri;Xt.Writer=wt;var rp=Xt;var Ib=Ji(Nb());function Fb(r,e){rp.escape=function(t){return t};try{return rp.render(r,(0,Ib.default)(e))}catch(t){let n="";throw t instanceof Error?n=`There was an error expanding one or more placeholders.
1 year ago
The error message was:
${t.message.replace(/ > /g,".").replace("Missing Mustache data property","Unknown property")}`:n="Unknown error expanding placeholders.",n+=`
The problem is in:
${r}`,Error(n)}}function Lb(r){return{query:{file:new Ei(r)}}}function $n(r,e){let t=`Error: ${r}.
1 year ago
The error message was:
`,n="";return e instanceof Error?n+=e:n+="Unknown error",`${t}"${n}"`}var zr=class{constructor(e,t,n){this.property=e,this.comparator=zr.maybeReverse(n,t)}static maybeReverse(e,t){return e?zr.makeReversedComparator(t):t}static makeReversedComparator(e){return(t,n)=>e(t,n)*-1}};var fn=class{constructor(e,t,n){this.property=e,this.grouper=t,this.reverse=n}};var we=class{canCreateFilterForLine(e){return we.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 Lo(this.fieldNameSingular())}supportsSorting(){return!1}createSorterFromLine(e){if(!this.supportsSorting())return null;let t=we.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 zr(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=we.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 fn(this.fieldNameSingular(),this.grouper(),e)}createNormalGrouper(){return this.createGrouper(!1)}createReverseGrouper(){return this.createGrouper(!0)}};var ke=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 ke("None of",e,"NOT")}static booleanXor(e){return new ke("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 i=0;i<this.children.length;i++)t+=`
1 year ago
${this.children[i].asString(n)}`;return t}static combineOrCreateExplanation(e,t,n){if(t.length===2){let i=t[0],s=t[1];if(i.symbol===n&&s.symbol==="")return i.children.push(s),i}return new ke(e,t,n)}};var ft=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(" ")}
`}};var vr=class{constructor(e){this.instruction=e}get queryComponent(){return this._queryComponent}set queryComponent(e){this._queryComponent=e}get error(){return this._error}set error(e){this._error=e}static fromObject(e,t){let n=new vr(e);return n._queryComponent=t,n}static fromError(e,t){let n=new vr(e);return n._error=t,n}};var J=class{constructor(e){this.object=e}get instruction(){return this.object.instruction}get filter(){return this.object.queryComponent}get error(){return this.object.error}get filterFunction(){if(this.filter)return this.filter.filterFunction}static fromFilter(e){return new J(vr.fromObject(e.instruction,e))}static fromError(e,t){return new J(vr.fromError(e,t))}};var Bo=class{constructor(e,t){this._instruction=e,this._filter=t}canCreateFilterForLine(e){return e==this._instruction}createFilterOrErrorMessage(e){return e===this._instruction?J.fromFilter(new ft(e,this._filter,new ke(e))):J.fromError(e,`do not understand filter: ${e}`)}};var Er=class{constructor(){this._filters=[]}add(e,t){this._filters.push(new Bo(e,t))}canCreateFilterForLine(e){for(let t of this._filters)if(t.canCreateFilterForLine(e))return!0;return!1}createFilterOrErrorMessage(e){for(let t of this._filters){let n=t.createFilterOrErrorMessage(e);if(n.error===void 0)return n}return J.fromError(e,`do not understand filter: ${e}`)}};var pn=class extends we{constructor(){super(...arguments);this._filters=new Er}canCreateFilterForLine(t){return this._filters.canCreateFilterForLine(t)}createFilterOrErrorMessage(t){return this._filters.createFilterOrErrorMessage(t)}filterRegExp(){return null}};var wr=class extends pn{constructor(){super(),this._filters.add("done",e=>e.isDone),this._filters.add("not done",e=>!e.isDone)}fieldName(){return"status"}supportsSorting(){return!0}comparator(){return(e,t)=>{let n=wr.oldStatusName(e),i=wr.oldStatusName(t);return n<i?1:n>i?-1:0}}static oldStatusName(e){return e.status.symbol===" "?"Todo":"Done"}supportsGrouping(){return!0}grouper(){return e=>[wr.oldStatusName(e)]}};var Ho=class{findUnexpandedDateText(e){let t=["<%","YYYY-MM-DD"];for(let n of t)if(e.includes(n))return this.unexpandedDateTextMessage(n);return null}unexpandedDateTextMessage(e){return`Instruction contains unexpanded template text: "${e}" - and cannot be interpreted.
Possible causes:
- The query is an a template file, and is not intended to be searched.
- A command such as "Replace templates in the active file" needs to be run.
- The core "Daily notes" plugin is in use, and the template contained
date calculations that it does not support.
- Some sample template text was accidentally pasted in to a tasks query,
instead of in to a template file.
See: https://publish.obsidian.md/tasks/Advanced/Instruction+contains+unexpanded+template+text
`}};var pt=class extends we{constructor(t=null){super();t!==null?this.filterInstructions=t:(this.filterInstructions=new Er,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 i=this.date(n);return i!==null&&!i.isValid()}))}canCreateFilterForLine(t){return this.filterInstructions.canCreateFilterForLine(t)?!0:super.canCreateFilterForLine(t)}createFilterOrErrorMessage(t){let n=this.checkForUnexpandedTemplateText(t);if(n)return J.fromError(t,n);let i=this.filterInstructions.createFilterOrErrorMessage(t);if(i.filter!==void 0)return i;let s=we.getMatch(this.filterRegExp(),t);if(s===null)return J.fromError(t,"do not understand query filter ("+this.fieldName()+" date)");let a=s[1],o=s[2],u=s[3],l=Ct.parseDateRange(u);if(!l.isValid()){let h=Ct.parseDate(a);h.isValid()&&(l=new _t(h,h))}if(!l.isValid())return J.fromError(t,"do not understand "+this.fieldName()+" date");let c=this.buildFilterFunction(o,l),p=pt.buildExplanation(this.fieldNameForExplanation(),o,this.filterResultIfFieldMissing(),l);return J.fromFilter(new ft(t,c,p))}buildFilterFunction(t,n){let i;switch(t){case"before":i=s=>s?s.isBefore(n.start):this.filterResultIfFieldMissing();break;case"after":i=s=>s?s.isAfter(n.end):this.filterResultIfFieldMissing();break;case"on or before":case"in or before":i=s=>s?s.isSameOrBefore(n.end):this.filterResultIfFieldMissing();break;case"on or after":case"in or after":i=s=>s?s.isSameOrAfter(n.start):this.filterResultIfFieldMissing();break;default:i=s=>s?s.isSameOrAfter(n.start)&&s.isSameOrBefore(n.end):this.filterResultIfFieldMissing()}return this.getFilter(i)}getFilter(t){return n=>t(this.date(n))}filterRegExp(){return new RegExp(`^${this.fieldNameForFilterInstruction()} (((?:on|in) or before|before|(?:on|in) or after|after|on|in)? ?(.*))`)}fieldNameForFilterInstruction(){return this.fieldName()}static buildExplanation(t,n,i,s){let a=n,o="YYYY-MM-DD (dddd Do MMMM YYYY)",u;switch(n){case"before":case"on or after":u=s.start.format(o);break;case"after":case"on or before":u=s.end.format(o);break;case"in or before":a="on or before",u=s.end.format(o);break;case"in or after":a="on or after",u=s.start.format(o);break;default:if(!s.start.isSame(s.end)){let c=`${t} date is between:`,p=[new ke(`${s.start.format(o)} and`),new ke(`${s.end.format(o)} inclusive`)];return i&&p.push(new ke(`OR no ${t} date`)),new ke(c,p)}a="on",u=s.start.format(o);break}let l=`${t} date is ${a} ${u}`;return i&&(l+=` OR no ${t} date`),new ke(l)}fieldNameForExplanation(){return this.fieldName()}supportsSorting(){return!0}comparator(){return(t,n)=>$r(this.date(t),this.date(n))}supportsGrouping(){return!0}grouper(){return t=>{let n=this.date(t);return n===null?["No "+this.fieldName()+" date"]:[n.format("YYYY-MM-DD dddd")]}}checkForUnexpandedTemplateText(t){return new Ho().findUnexpandedDateText(t)}};var Mi=class extends pt{fieldName(){return"due"}date(e){return e.dueDate}filterResultIfFieldMissing(){return!1}};var ip=class extends we{createFilterOrErrorMessage(e){let t=we.getMatch(this.filterRegExp(),e);if(t!==null){let n=t[5],i=null;switch(n){case"lowest":i="5";break;case"low":i="4";break;case"none":i="3";break;case"medium":i="2";break;case"high":i="1";break;case"highest":i="0";break}if(i===null)return J.fromError(e,"do not understand priority");let s=e,a;switch(t[3]){case"above":a=o=>o.priority.localeCompare(i)<0;break;case"below":a=o=>o.priority.localeCompare(i)>0;break;case"not":a=o=>o.priority!==i;break;default:a=o=>o.priority===i,s=`${this.fieldName()} is ${n}`}return J.fromFilter(new ft(e,a,new ke(s)))}else return J.fromError(e,"do not understand query filter (priority)")}fieldName(){return"priority"}filterRegExp(){return ip.priorityRegexp}supportsSorting(){return!0}comparator(){return(e,t)=>e.priority.localeCompare(t.priority)}supportsGrouping(){return!0}grouper(){return e=>[e.priorityNameGroupText]}},Yn=ip;Yn.priorityRegexp=/^priority(\s+is)?(\s+(above|below|not))?(\s+(lowest|lo
1 year ago
Regular expressions must look like this:
/pattern/
or this:
/pattern/flags
Where:
- pattern: The 'regular expression' pattern to search for.
- flags: Optional characters that modify the search.
i => make the search case-insensitive
u => add Unicode support
Examples: /^Log/
/^Log/i
/File Name\.md/
/waiting|waits|waited/i
/\d\d:\d\d/
The following characters have special meaning in the pattern:
to find them literally, you must add a \ before them:
[\^$.|?*+()
CAUTION! Regular expression (or 'regex') searching is a powerful
but advanced feature that requires thorough knowledge in order to
use successfully, and not miss intended search results.
`}explanation(t){let i=NA(t,"using regex: ",this.regexAsString());return new ke(i)}regexAsString(){let t=`'${this.regex.source}' with `;switch(this.regex.flags.length){case 0:t+="no flags";break;case 1:t+=`flag '${this.regex.flags}'`;break;default:t+=`flags '${this.regex.flags}'`;break}return t}};function NA(r,e,t){var o;let n=r.match(/\//);if(!n)return"Error explaining instruction. Could not find a slash character";let i=2,s=((o=n.index)!=null?o:i)-i;return`${e.padEnd(s)}${t}`}var Me=class extends we{createFilterOrErrorMessage(e){let t=we.getMatch(this.filterRegExp(),e);if(t===null)return J.fromError(e,`do not understand query filter (${this.fieldName()})`);let[n,i,s]=t,a=null;if(i.includes("include"))a=new Ci(s);else if(i.includes("regex")){try{a=hn.validateAndConstruct(s)}catch(l){let c=$n("Parsing regular expression",l)+`
1 year ago
${hn.helpMessage()}`;return J.fromError(e,c)}if(a===null)return J.fromError(e,`Invalid instruction: '${e}'
1 year ago
${hn.helpMessage()}`)}if(a===null)return J.fromError(e,`do not understand query filter (${this.fieldName()})`);let o=i.match(/not/)!==null,u=new ft(e,this.getFilter(a,o),a.explanation(e));return J.fromFilter(u)}fieldPattern(){return this.fieldNameSingularEscaped()}filterOperatorPattern(){return"includes|does not include|regex matches|regex does not match"}filterRegExp(){return new RegExp(`^(?:${this.fieldPattern()}) (${this.filterOperatorPattern()}) (.*)`)}getFilter(e,t){return n=>{let i=e.matches(this.value(n));return t?!i:i}}comparator(){return(e,t)=>this.value(e).localeCompare(this.value(t),void 0,{numeric:!0})}grouper(){return e=>[this.value(e)]}static escapeMarkdownCharacters(e){return e.replace(/\\/g,"\\\\").replace(/_/g,"\\_")}};var Pi=class extends Me{fieldName(){return"path"}value(e){return e.path}supportsSorting(){return!0}supportsGrouping(){return!0}grouper(){return e=>[Me.escapeMarkdownCharacters(e.path.replace(".md",""))]}};var Ni=class extends we{canCreateFilterForLine(e){return!1}createFilterOrErrorMessage(e){return J.fromError(e,"Filtering by urgency is not yet supported")}fieldName(){return"urgency"}filterRegExp(){throw Error(`filterRegExp() unimplemented for ${this.fieldName()}`)}supportsSorting(){return!0}comparator(){return(e,t)=>t.urgency-e.urgency}supportsGrouping(){return!0}grouper(){return e=>[`${e.urgency.toFixed(2)}`]}createGrouper(e){return super.createGrouper(!e)}};var Ii=class{static by(e,t){let n=[new Ni().comparator(),new wr().comparator(),new Mi().comparator(),new Yn().comparator(),new Pi().comparator()],i=[];for(let s of e)i.push(s.comparator);return t.sort(Ii.makeCompositeComparator([...i,...n]))}static makeCompositeComparator(e){return(t,n)=>{for(let i of e){let s=i(t,n);if(s!==0)return s}return 0}}};var zo=class{constructor(e,t,n){this.nestingLevel=e,this.displayName=t,this.property=n}};var Ko=class{constructor(e,t){this.lastHeadingAtLevel=new Array;this.groupers=t;let i=e.keys().next().value.length;for(let s=0;s<i;s++)this.lastHeadingAtLevel.push("")}getHeadingsForTaskGroup(e){let t=new Array;for(let n=0;n<e.length;n++){let i=e[n];if(i!=this.lastHeadingAtLevel[n]){t.push(new zo(n,i,this.groupers[n].property));for(let s=n;s<e.length;s++)this.lastHeadingAtLevel[s]="";this.lastHeadingAtLevel[n]=i}}return t}};var Vo=class{constructor(e){this.children=new Map;this.values=[];this.values=e}generateAllPaths(e=[]){let t=new Map;if(this.children.size==0)return t.set([...e],this.values),t;for(let[n,i]of this.children)e.push(n),i.generateAllPaths(e).forEach((a,o)=>t.set(o,a)),e.pop();return t}};var Qo=class extends Vo{},Xo=class{constructor(e,t){this.root=new Qo(t),this.buildGroupingTree(e)}buildGroupingTree(e){let t=[this.root];for(let n of e){let i=[];for(let s of t)for(let a of s.values){let o=n.grouper(a);o.length===0&&o.push("");for(let u of o){let l=s.children.get(u);l===void 0&&(l=new Qo([]),s.children.set(u,l),i.push(l)),l.values.push(a)}}t=i}}generateTaskTreeStorage(){return this.root.generateAllPaths()}};var Zo=class{constructor(e,t){this.groups=e,this.groupHeadings=[],this.tasks=t}setGroupHeadings(e){for(let t of e)this.groupHeadings.push(t)}applyTaskLimit(e){this.tasks=this.tasks.slice(0,e)}tasksAsStringOfLines(){let e="";for(let t of this.tasks)e+=t.toFileLineString()+`
3 years ago
`;return e}toString(){let e=`
`;e+=`Group names: [${this.groups}]
2 years ago
`;for(let t of this.groupHeadings)e+=`${"#".repeat(4+t.nestingLevel)} [${t.property}] ${t.displayName}
`;return e+=this.tasksAsStringOfLines(),e}};var Fi=class{constructor(e,t){this._groups=new Array;this._totalTaskCount=0;this._totalTaskCount=t.length,this._groupers=e;let i=new Xo(e,t).generateTaskTreeStorage();this.addTaskGroups(i),this.sortTaskGroups(),this.setGroupsHeadings(i)}get groupers(){return this._groupers}get groups(){return this._groups}totalTasksCount(){return this._totalTaskCount}toString(){let e="";e+=`Groupers (if any):
1 year ago
`;for(let n of this._groupers){let i=n.reverse?" reverse":"";e+=`- ${n.property}${i}
2 years ago
`}for(let n of this.groups)e+=n.toString(),e+=`
3 years ago
---
`;return e+=`
${this.totalTasksCount()} tasks
`,e}addTaskGroups(e){for(let[t,n]of e){let i=new Zo(t,n);this.addTaskGroup(i)}}addTaskGroup(e){this._groups.push(e)}sortTaskGroups(){let e=(t,n)=>{let i=t.groups,s=n.groups;for(let a=0;a<i.length;a++){let o=this._groupers[a],u=i[a].localeCompare(s[a],void 0,{numeric:!0});if(u!==0)return o.reverse?-u:u}return 0};this._groups.sort(e)}setGroupsHeadings(e){let t=new Ko(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.recalculateTotalTaskCount())}recalculateTotalTaskCount(){let e=[];this._groups.forEach(n=>{e=[...e,...n.tasks]});let t=[...new Set(e)];this._totalTaskCount=t.length}};var jn=class extends Me{fieldName(){return"description"}value(e){return ge.getInstance().removeAsSubstringFrom(e.description)}supportsSorting(){return!0}comparator(){return(e,t)=>{let n=jn.cleanDescription(e.description),i=jn.cleanDescription(t.description);return n.localeCompare(i,void 0,{numeric:!0})}}static cleanDescription(e){e=ge.getInstance().removeAsSubstringFrom(e);let t=/^\[\[?([^\]]*)]]?/,n=e.match(t);if(n!==null){let i=n[1];e=i.substring(i.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 Jo=class extends pt{fieldName(){return"created"}date(e){return e.createdDate}filterResultIfFieldMissing(){return!1}};var eu=class extends pt{fieldName(){return"done"}date(e){return e.doneDate}filterResultIfFieldMissing(){return!1}};var tu=class extends pn{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 Ta=class extends vr{};function ba(r){return[["task",r]]}function sp(r,e){let t=r.map(([n])=>n);try{let n=e.includes("return")?e:`return ${e}`,i=e&&new Function(...t,n);return i instanceof Function?Ta.fromObject(e,i):Ta.fromError(e,"Error parsing group function")}catch(n){return Ta.fromError(e,$n(`Failed parsing expression "${e}"`,n))}}function ap(r,e){let t=e.map(([n,i])=>i);return r(...t)}function op(r,e,t){try{return ap(r,e)}catch(n){return $n(`Failed calculating expression "${t}"`,n)}}function Ub(r,e){let t=ba(r),n=sp(t,e);return n.error?n.error:op(n.queryComponent,t,e)}var ru=class{constructor(e){this.line=e,this.functionOrError=sp(ba(null),e)}isValid(){return this.functionOrError.error===void 0}get parseError(){return this.functionOrError.error}evaluate(e){if(!this.isValid())throw Error(`Error: Cannot evaluate an expression which is not valid: "${this.line}" gave error: "${this.parseError}"`);return ap(this.functionOrError.queryComponent,ba(e))}evaluateOrCatch(e){return this.isValid()?op(this.functionOrError.queryComponent,ba(e),this.line):`Error: Cannot evaluate an expression which is not valid: "${this.line}" gave error: "${this.parseError}"`}};var nu=class extends we{createFilterOrErrorMessage(e){let t=we.getMatch(this.filterRegExp(),e);if(t===null)return J.fromError(e,"Unable to parse line");let n=t[1],i=new ru(n);return i.isValid()?J.fromFilter(new ft(e,IA(i),new ke(e))):J.fromError(e,i.parseError)}fieldName(){return"function"}filterRegExp(){return new RegExp(`^filter by ${this.fieldNameSingularEscaped()} (.*)`)}supportsGrouping(){return!0}createGrouperFromLine(e){let t=we.getMatch(this.grouperRegExp(),e);if(t===null)return null;let n=!!t[1],i=t[2];return new fn("function",LA(i),n)}grouperRegExp(){return new RegExp(`^group by ${this.fieldNameSingularEscaped()}( reverse)? (.*)`)}grouper(){throw Error("grouper() function not valid for FunctionField. Use createGrouperFromLine() instead.")}};function IA(r){return e=>FA(r,e)}function FA(r,e){let t=r.evaluate(e);if(typeof t=="boolean")return t;throw Error(`filtering function must ret
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.
Example: ${this.fieldNameSingular()} is not NON_TASK`;return J.fromError(e,n)}fieldName(){return"status.type"}value(e){return e.status.type}supportsSorting(){return!0}comparator(){return(e,t)=>{let n=mn.groupName(e),i=mn.groupName(t);return n.localeCompare(i,void 0,{numeric:!0})}}supportsGrouping(){return!0}grouper(){return e=>[mn.groupName(e)]}static groupName(e){return e.status.typeGroupText}};var Tu=class extends Me{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 bu=class extends Me{fieldName(){return"folder"}value(e){return e.file.folder}supportsGrouping(){return!0}grouper(){return e=>[Me.escapeMarkdownCharacters(this.value(e))]}};var _u=class extends Me{fieldName(){return"root"}value(e){return e.file.root}supportsGrouping(){return!0}grouper(){return e=>[Me.escapeMarkdownCharacters(this.value(e))]}};var vu=class extends Me{fieldName(){return"backlink"}value(e){let t=e.getLinkText({isFilenameUnique:!0});return t===null?"Unknown Location":t}createFilterOrErrorMessage(e){return J.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=e.precedingHeader;return n===null?["[["+t+"]]"]:[`[[${t}#${n}|${t} > ${n}]]`]}}};var yp=[()=>new yu,()=>new mn,()=>new wr,()=>new uu,()=>new Yn,()=>new ou,()=>new Jo,()=>new au,()=>new su,()=>new Mi,()=>new eu,()=>new Pi,()=>new bu,()=>new _u,()=>new vu,()=>new jn,()=>new Gn,()=>new iu,()=>new tu,()=>new gu,()=>new Ni,()=>new Tu,()=>new nu,()=>new hu];function mu(r){for(let e of yp){let t=e();if(t.canCreateFilterForLine(r))return t.createFilterOrErrorMessage(r)}return null}function Jb(r){let e=/^sort by /;if(r.match(e)===null)return null;for(let t of yp){let i=t().createSorterFromLine(r);if(i)return i}return null}function e_(r){let e=/^group by /;if(r.match(e)===null)return null;for(let t of yp){let i=t().createGrouperFromLine(r);if(i)return i}return null}function t_(r){return`task${r!==1?"s":""}`}var zn=class{constructor(e,t){this.totalTasksCountBeforeLimit=0;this._searchErrorMessage=void 0;this.taskGroups=e,this.totalTasksCountBeforeLimit=t}get searchErrorMessage(){return this._searchErrorMessage}set searchErrorMessage(e){this._searchErrorMessage=e}get totalTasksCount(){return this.taskGroups.totalTasksCount()}totalTasksCountDisplayText(){let e=this.totalTasksCount,t=this.totalTasksCountBeforeLimit;return e===t?`${e} ${t_(e)}`:`${e} of ${t} ${t_(t)}`}get groups(){return this.taskGroups.groups}static fromError(e){let t=new zn(new Fi([],[]),0);return t._searchErrorMessage=e,t}};function r_(r){return r.endsWith("\\")}function n_(r){return r.endsWith("\\\\")}function dC(r){return r.replace(/^[ \t]*/,"")}function fC(r){return r.replace(/[ \t]*\\$/,"")}function pC(r,e){let t=r;return e&&(t=dC(r)),n_(t)?t=t.slice(0,-1):r_(r)&&(t=fC(t)),t}function hC(r,e,t){e?r[r.length-1]+=" "+t:r.push(t)}function mC(r){let e=[],t=!1;for(let n of r.split(`
`)){let i=pC(n,t);hC(e,t,i),n_(n)?t=!1:t=r_(n)}return e.join(`
`)}function i_(r){return mC(r).split(`
`).map(e=>e.trim()).filter(e=>e!=="")}var Vr=class{constructor(e,t=void 0){this._limit=void 0;this._taskGroupLimit=void 0;this._layoutOptions=new ua;this._filters=[];this._error=void 0;this._sorting=[];this._grouping=[];this._ignoreGlobalQuery=!1;this.hideOptionsRegexp=/^(hide|show) (task count|backlink|priority|created date|start date|scheduled date|done date|due date|recurrence rule|edit button|urgency|tags)/;this.shortModeRegexp=/^short/;this.explainQueryRegexp=/^explain/;this.ignoreGlobalQueryRegexp=/^ignore global query/;this.limitRegexp=/^limit (groups )?(to )?(\d+)( tasks?)?/;this.commentRegexp=/^#.*/;this.source=e,this.filePath=t,i_(e).forEach(n=>{let i=this.expandPlaceholders(n,t);if(this.error===void 0)switch(!0){case this.shortModeRegexp.test(i):this._layoutOptions.shortMode=!0;break;case this.explainQueryRegexp.test(i):this._layoutOptions.explainQuery=!0;break;case this.ignoreGlobalQueryRegexp.test(i):this._ignoreGlobalQuery=!0;break;case this.limitRegexp.test(i):this.parseLimit(i);break;case this.parseSortBy(i):break;case this.parseGroupBy(i):break;case this.hideOptionsRegexp.test(i):this.parseHideOptions(i);break;case this.commentRegexp.test(i):break;case this.parseFilter(i):break;default:this.setError("do not understand query",i)}})}expandPlaceholders(e,t){if(e.includes("{{")&&e.includes("}}")&&this.filePath===void 0)return this._error=`The query looks like it contains a placeholder, with "{{" and "}}"
1 year ago
but no file path has been supplied, so cannot expand placeholder values.
The query is:
${e}`,e;let n=e;if(t){let i=Lb(t);try{n=Fb(e,i)}catch(s){return s instanceof Error?this._error=s.message:this._error="Internal error. expandPlaceholders() threw something other than Error.",e}}return n}append(e){return this.source===""?e:e.source===""?this:new Vr(`${this.source}
1 year ago
${e.source}`,this.filePath)}explainQuery(){let e="";if(this.error!==void 0)return e+=`Query has an error:
1 year ago
`,e+=this.error+`
`,e;let t=this.filters.length;if(t===0)e+="No filters supplied. All tasks will match the query.";else for(let i=0;i<t;i++)i>0&&(e+=`
1 year ago
`),e+=this.filters[i].explainFilterIndented("");e+=this.explainQueryLimits();let{debugSettings:n}=Q();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 i=`
2 years ago
1 year ago
At most ${n} task`;return n!==1&&(i+="s"),i}return this._limit!==void 0&&(e+=t(this._limit),e+=`.
2 years ago
`),this._taskGroupLimit!==void 0&&(e+=t(this._taskGroupLimit),e+=` per group (if any "group by" options are supplied).
1 year ago
`),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}setError(e,t){this._error=`${e}
Problem line: "${t}"`}get ignoreGlobalQuery(){return this._ignoreGlobalQuery}applyQueryToTasks(e){try{this.filters.forEach(a=>{e=e.filter(a.filterFunction)});let{debugSettings:t}=Q(),n=t.ignoreSortInstructions?e:Ii.by(this.sorting,e),i=n.slice(0,this.limit),s=new Fi(this.grouping,i);return this._taskGroupLimit!==void 0&&s.applyTaskLimit(this._taskGroupLimit),new zn(s,n.length)}catch(t){let n="Search failed";return zn.fromError($n(n,t))}}parseHideOptions(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;case"tags":this._layoutOptions.hideTags=n;break;default:this.setError("do not understand hide/show option",e)}}}parseFilter(e){var n;let t=mu(e);return t!=null?(t.filter?this._filters.push(t.filter):this.setError((n=t.error)!=null?n:"Unknown error",e),!0):!1}parseLimit(e){let t=e.match(this.limitRegexp);if(t===null){this.setError("do not understand query limit",e);return}let n=Number.parseInt(t[3],10);t[1]!==void 0?this._taskGroupLimit=n:this._limit=n}parseSortBy(e){let t=Jb(e);return t?(this._sorting.push(t),!0):!1}parseGroupBy(e){let t=e_(e);return t?(this._grouping.push(t),!0):!1}};var gn=class{constructor(e=gn.empty){this._source=e}static getInstance(){return gn.instance||(gn.instance=new gn),gn.instance}set(e){this._source=e}query(e=void 0){return new Vr(this._source,e)}hasInstructions(){return this._source.trim()!==gn.empty}},Jt=gn;Jt.empty="";var Eu=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 wa=require("obsidian");var gC=require("obsidian"),u_=Ji(o_());var Tp=class extends u_.EventEmitter2{constructor(){super(...arguments);this.options={minLevels:{"":"info",tasks:"info"}};this.consoleLoggerRegistered=!1;this.arrAvg=t=>t.reduce((n,i)=>n+i,0)/t.length}configure(t){return this.options=Object.assign({},this.options,t),this}getLogger(t){let n="none",i="";for(let s in this.options.minLevels)t.startsWith(s)&&s.length>=i.length&&(n=this.options.minLevels[s],i=s);return new bp(this,t,n)}onLogEntry(t){return this.on("log",t),this}registerConsoleLogger(){return this.consoleLoggerRegistered?this:(this.onLogEntry(t=>{let n=`[${window.moment().format("YYYY-MM-DD-HH:mm:ss.SSS")}][${t.level}][${t.module}]`;switch(t.traceId&&(n+=`[${t.traceId}]`),n+=` ${t.message}`,t.objects===void 0&&(t.objects=""),t.level){case"trace":console.trace(n,t.objects);break;case"debug":console.debug(n,t.objects);break;case"info":console.info(n,t.objects);break;case"warn":console.warn(n,t.objects);break;case"error":console.error(n,t.objects);break;default:console.log(`{${t.level}} ${n}`,t.objects)}}),this.consoleLoggerRegistered=!0,this)}},wu=new Tp,bp=class{constructor(e,t,n){this.levels={trace:1,debug:2,info:3,warn:4,error:5};this.logManager=e,this.module=t,this.minLevel=this.levelToInt(n)}levelToInt(e){return e.toLowerCase()in this.levels?this.levels[e.toLowerCase()]:99}log(e,t,n){if(this.levelToInt(e)<this.minLevel)return;let s={level:e,module:this.module,message:t,objects:n,traceId:void 0};this.logManager.emit("log",s)}trace(e,t){thi
1 year 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.
`;ku(l);return}let u=Math.min(Math.pow(10,s),100);Ea.debug(`timeout = ${u}`),setTimeout(()=>{d_({originalTask:r,newTasks:e,vault:t,metadataCache:n,workspace:i,previousTries:s+1})},u)};try{let[u,l,c]=yield f_(r,t),p=[...c.slice(0,u),...e.map(h=>h.toFileLineString()),...c.slice(u+1)];yield t.modify(l,p.join(`
`))}catch(u){if(u instanceof yn)return u.message&&c_(u.message),o();if(u instanceof Ou)return o();u instanceof Error&&ku(u.message)}});function f_(r,e){return q(this,null,function*(){if(va===void 0)throw new yn;let t=e.getAbstractFileByPath(r.path);if(!(t instanceof wa.TFile))throw new yn(`Tasks: No file found for task ${r.description}. Retrying ...`);if(!yC.includes(t.extension))throw new Error(`Tasks: Does not support files with the ${t.extension} file extension.`);let n=va.getFileCache(t);if(n==null||n===null)throw new yn(`Tasks: No file cache found for file ${t.path}. Retrying ...`);let i=n.listItems;if(i===void 0||i.length===0)throw new yn(`Tasks: No list items found in file cache of ${t.path}. Retrying ...`);let a=(yield e.read(t)).split(`
`),o=bC(r,a,i,TC);if(o===void 0)throw new Ou;return[o,t,a]})}function Ep(r,e){return q(this,null,function*(){try{let[t,n,i]=yield f_(r,e);return[t,n]}catch(t){t instanceof yn?t.message&&c_(t.message):t instanceof Error&&ku(t.message)}})}function p_(r,e){return r<e.length}function bC(r,e,t,n){let i=_C(r,e);return i!==void 0||(i=vC(r,e),i!==void 0)?i:EC(r,e,t,n)}function _C(r,e){let t=r.taskLocation.lineNumber;if(p_(t,e)&&e[t]===r.originalMarkdown)return Ea.debug(`Found original markdown at original line number ${t}`),t}function vC(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 EC(r,e,t,n){let i,s=0;for(let a of t){let o=a.position.start.line;if(!p_(o,e))return;if(o<r.taskLocation.sectionStart||a.task===void 0)continue;let u=e[o];if(ge.getInstance().includedIn(u)){if(s===r.taskLocation.sectionIndex){if(u===r.originalMarkdown)i=o;else{n(`Tasks: Unable to find task in file ${r.taskLocation.path}.
1 year ago
Expected task:
${r.originalMarkdown}
Found task:
${u}`);return}break}s++}}return i}var m_=require("obsidian");var h_=require("obsidian");var wC={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:""},kC=7,OC="far";function SC(r,e,t){return q(this,null,function*(){var o;let n=document.createElement("li");e.parentUlElement.appendChild(n),n.classList.add("task-list-item","plugin-tasks-list-item");let i=document.createElement("span");n.appendChild(i),i.classList.add("tasks-list-text");let s=yield DC(r,e,i,t);for(let u in s)n.dataset[u]=s[u];let a=document.createElement("input");return n.appendChild(a),a.classList.add("task-list-item-checkbox"),a.type="checkbox",r.status.symbol!==" "&&(a.checked=!0,n.classList.add("is-checked")),a.addEventListener("click",u=>{u.preventDefault(),u.stopPropagation(),a.disabled=!0;let l=r.toggleWithRecurrenceInUsersOrder();Su({originalTask:r,newTasks:l})}),n.prepend(a),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),a.setAttribute("data-line",e.listIndex.toString()),(o=e.layoutOptions)!=null&&o.shortMode&&PC({task:r,element:i,isFilenameUnique:e.isFilenameUnique}),n})}function DC(r,e,t,n){return q(this,null,function*(){let i={},s=new ln(e.layoutOptions),a=Yr.tasksPluginEmoji.taskSerializer;for(let o of s.shownTaskLayoutComponents){let u=a.componentToString(r,s,o);if(u){o==="description"&&(u=ge.getInstance().removeAsWordFromDependingOnSettings(u));let l=document.createElement("span");if(t.appendChild(l),l){let c=document.createElement("span");l.appendChild(c),yield RC(c,u,o,r,n,e.obsidianComponent),MC(o,c);let p=xC(o,r);l.classList.add(...p);let h=wp(o,r);for(let _ in h)l.dataset[_]=h[_];i=pe(pe({},i),h)}}}for(let o of s.hiddenTaskLayoutComponents){let u=wp(o,r);i=pe(pe({},i),u)}if(i.taskPriority===void 0){let o=wp("priority",r);i=pe(pe({},i),o)}return i})}function RC(r,e,t,n,i,s){return q(this,null,function*(){if(t==="description"){let{debugSettings:a}=Q();a.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 i(e,r,n.path,s);let o=r.querySelector("blockquote"),u=o!=null?o:r,l=u.querySelector("p");if(l!==null){for(;l.firstChild;)u.insertBefore(l.firstChild,l);l.remove()}r.querySelectorAll("p").forEach(c=>{c.hasChildNodes()||c.remove()}),r.querySelectorAll(".footnotes").forEach(c=>{c.remove()})}else r.innerHTML=e})}function xC(r,e){let t=[],n=wC[r];switch(r){case"blockLink":break;case"description":case"priority":case"recurrenceRule":t.push(n);break;case"createdDate":case"dueDate":case"startDate":case"scheduledDate":case"doneDate":{e[r]&&t.push(n);break}}return t}function wp(r,e){let t={},n={createdDate:"taskCreated",dueDate:"taskDue",startDate:"taskStart",scheduledDate:"taskScheduled",doneDate:"taskDone",priority:"taskPriority",description:"",recurrenceRule:"",blockLink:""};switch(r){case"description":case"recurrenceRule":case"blockLink":break;case"priority":{let i=n[r];t[i]=Br.priorityNameUsingNormal(e.priority).toLocaleLowerCase();break}case"createdDate":case"dueDate":case"startDate":case"scheduledDate":case"doneDate":{let i=e[r];if(i){let s=AC(i);if(s){let a=n[r];t[a]=s}}break}}return t}function MC(r,e){if(r==="description"){let t=e.getElementsByClassName("tag");for(let n=0;n<t.length;n++){let i=t[n].textContent;if(i){let s=CC(i),a=t[n];s&&(a.dataset.tagName=s)}}}}function AC(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)<=kC?t+=Math.abs(n).toString()+"d":t+=OC,t)}function CC(r){let e=/["&\x00\r\n]/g,t=r.replace(e,"-");return t=t.replace(/^[-_]+/,""),t.length>0?t:null}function PC({task:r,element:e,isFilenameUnique:t}){let{recurrenceSymbol:n,startDateSymbol:
`);if(h===void 0)return!1;let _=null;for(let E=0;E<h.length;E=E+1)if(h[E]!==""){_=h[E];break}return _===null?!1:ge.getInstance().includedIn(_)});if(i.length===0)return;let s=t.sourcePath,a=t.getSectionInfo(e);if(a===null)return;let o=a.text.split(`
`),u=0,l=[];for(let p=a.lineStart;p<=a.lineEnd;p++){let h=o[p];if(h===void 0)continue;let _=null,y=ye.fromLine({line:h,taskLocation:new ot(s,p,a.lineStart,u,_),fallbackDate:null});y!==null&&(l.push(y),u++)}for(let p=0;p<i.length;p++){let h=l[p],_=i[p];if(h===void 0||_===void 0)continue;let y=(c=_.getAttr("data-line"))!=null?c:"0",E=Number.parseInt(y,10),x=yield Du(h,{parentUlElement:e,listIndex:E,obsidianComponent:n}),P=_.childNodes;for(let X=0;X<P.length;X=X+1){let V=P[X];V.nodeName.toLowerCase()==="div"?x.prepend(V):V.nodeName.toLowerCase()==="ul"&&x.append(V)}let N=_.querySelectorAll("[data-footnote-id]"),F=x.querySelectorAll("[data-footnote-id]");if(N.length===F.length)for(let X=0;X<N.length;X++)F[X].replaceWith(N[X]);_.replaceWith(x)}})}};var g_=require("@codemirror/view"),y_=require("obsidian");var T_=()=>g_.ViewPlugin.fromClass(kp),kp=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 h=`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(h),new y_.Notice(h,45e3)}return!1}let{state:i}=this.view,s=this.view.posAtDOM(t),a=i.doc.lineAt(s),o=ye.fromLine({line:a.text,taskLocation:ot.fromUnknownPosition(""),fallbackDate:null});if(o===null)return!1;e.preventDefault();let l=o.toggleWithRecurrenceInUsersOrder().map(h=>h.toFileLineString()).join(i.lineBreak),c=i.update({changes:{from:a.from,to:a.to,insert:l}});this.view.dispatch(c);let p=t.checked;return setTimeout(()=>{t.checked=p},1),!0}};var Gi=require("obsidian");function b_(r,e,t,n=void 0){let i="";e.isEmpty()||(i+=`Only tasks containing the global filter '${e.get()}'.
2 years ago
`);let s=new Vr(r,n);return s.ignoreGlobalQuery||t.hasInstructions()&&(i+=`Explanation of the global query:
2 years ago
1 year ago
${t.query(n).explainQuery()}
`),i+=`Explanation of this Tasks code block query:
2 years ago
${s.explainQuery()}`,i}function xu(r,e,t){let n=new Vr(r,t);return n.ignoreGlobalQuery?n:e.query(t).append(n)}var Mu=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 Op({app:this.app,events:this.events,container:t,source:e,filePath:n.sourcePath}))})}},Op=class extends Gi.MarkdownRenderChild{constructor({app:t,events:n,container:i,source:s,filePath:a}){super(i);switch(this.app=t,this.events=n,this.source=s,this.filePath=a,this.containerEl.className){case"block-language-tasks":this.query=xu(this.source,Jt.getInstance(),this.filePath),this.queryType="tasks";break;default:this.query=xu(this.source,Jt.getInstance(),this.filePath),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,i=t.getTime()-n.getTime();this.queryReloadTimeout=setTimeout(()=>{this.query=xu(this.source,Jt.getInstance(),this.filePath),this.events.triggerRequestCacheUpdate(this.render.bind(this)),this.reloadQueryAtMidnight()},i+1e3)}render(i){return q(this,arguments,function*({tasks:t,state:n}){var a;let s=this.containerEl.createEl("div");n==="Warm"&&this.query.error===void 0?yield this.renderQuerySearchResults(t,n,s):this.query.error!==void 0?this.renderErrorMessage(s,this.query.error):this.renderLoadingMessage(s),(a=this.containerEl.firstChild)==null||a.replaceWith(s)})}renderQuerySearchResults(t,n,i){return q(this,null,function*(){this.query.layoutOptions.explainQuery&&this.createExplanation(i);let a=this.query.applyQueryToTasks(t);if(a.searchErrorMessage!==void 0){this.renderErrorMessage(i,a.searchErrorMessage);return}yield this.addAllTaskGroups(a.taskGroups,i);let o=a.totalTasksCount;this.addTaskCount(i,a)})}renderErrorMessage(t,n){t.createDiv().innerHTML=`<pre>Tasks query: ${n.replace(/\n/g,"<br>")}</pre>`}renderLoadingMessage(t){t.setText("Loading Tasks ...")}createExplanation(t){let n=b_(this.source,ge.getInstance(),Jt.getInstance(),this.filePath),i=t.createEl("pre");i.addClasses(["plugin-tasks-query-explanation"]),i.setText(n),t.appendChild(i)}createTaskList(t,n){return q(this,null,function*(){let i=new ln(this.query.layoutOptions),s=n.createEl("ul");s.addClasses(["contains-task-list","plugin-tasks-query-result"]),s.addClasses(i.taskListHiddenClasses);let a=this.getGroupingAttribute();a&&a.length>0&&(s.dataset.taskGroupBy=a);for(let[o,u]of t.entries()){let l=this.isFilenameUnique({task:u}),c=yield Du(u,{parentUlElement:s,listIndex:o,layoutOptions:this.query.layoutOptions,isFilenameUnique:l,taskLayout:i,obsidianComponent:this});c.querySelectorAll("[data-footnote-id]").forEach(_=>_.remove());let h=c.createSpan("task-extras");if(this.query.layoutOptions.hideUrgency||this.addUrgency(h,u),!this.query.layoutOptions.hideBacklinks){let _=this.query.layoutOptions.shortMode;this.addBacklinks(h,u,_,l)}this.query.layoutOptions.hideEditButton||this.addEditButton(h,u),s.appendChild(c)}n.appendChild(s)})}addEditButton(t,n){t.createEl("a",{cls:"tasks-edit"}).onClickEvent(s=>{s.preventDefault();let a=u=>{Su({originalTask:n,newTasks:Rt.removeInferredStatusIfNeeded(n,u)})};new dn({app:this.app,task:n,onSubmit:a}).open()})}addUrgency(t,n){let i=new Intl.NumberFormat().format(n.urgency);t.createSpan({text:i,cls:"tasks-urgency"})}addAllTaskGroups(t,n){return q(this,null,function*(){for(let i of t.groups)this.addGroupHeadings(n,i.groupHeadings),yield this.createTaskList(i.tasks,n)})}addGroupHeadings(t,n){for(let i of n)this.addGroupHeading(t,i)}addGroupHeading(t,n){return q(this,null,function*(){let i="h6";n.nestingLevel===0?i="h4":n.nestingLevel===1&&(i="h5");let s=t.crea
`)+`
Fix errors before saving.`;new dr.Notice(p);return}this.saved=!0,this.close()})),l)),u.addExtraButton(l=>(l.setIcon("cross").setTooltip("Cancel").onClick(()=>{this.saved=!1,this.close()}),l))})}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?Ut.removeValidationError(t):Ut.setValidationError(t)}};var Wt=class extends ve.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 ve.Setting(t).setName("Task Format").setDesc(Wt.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(i=>{for(let s of Object.keys(Yr))i.addOption(s,Yr[s].displayName);i.setValue(Q().taskFormat).onChange(s=>q(this,null,function*(){et({taskFormat:s}),yield this.plugin.saveSettings()}))}),t.createEl("h4",{text:"Global filter Settings"}),new ve.Setting(t).setName("Global task filter").setDesc(Wt.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(i=>{i.setPlaceholder("e.g. #task or TODO").setValue(ge.getInstance().get()).onChange(s=>q(this,null,function*(){et({globalFilter:s}),ge.getInstance().set(s),yield this.plugin.saveSettings()}))}),new ve.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(i=>{let s=Q();i.setValue(s.removeGlobalFilter).onChange(a=>q(this,null,function*(){et({removeGlobalFilter:a}),ge.getInstance().setRemoveGlobalFilter(a),yield this.plugin.saveSettings()}))}),t.createEl("h4",{text:"Global Query"}),UC(new ve.Setting(t).setDesc(Wt.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(i=>{let s=Q();i.inputEl.rows=4,i.setPlaceholder(`# For example...
2 years ago
path does not include _templates/
limit 300
show urgency`).setValue(s.globalQuery).onChange(a=>q(this,null,function*(){et({globalQuery:a}),Jt.getInstance().set(a),yield this.plugin.saveSettings()}))})),t.createEl("h4",{text:"Task Statuses"});let{headingOpened:n}=Q();D_.forEach(i=>{this.addOneSettingsBlock(t,i,n)}),t.createEl("h4",{text:"Date Settings"}),new ve.Setting(t).setName("Set created date on every added task").setDesc(Wt.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(i=>{let s=Q();i.setValue(s.setCreatedDate).onChange(a=>q(this,null,function*(){et({setCreatedDate:a}),yield this.plugin.saveSettings()}))}),new ve.Setting(t).setName("Set done date on every completed task").setDesc(Wt.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(i=>{let s=Q();i.setValue(s.setDoneDate).onChange(a=>q(this,null,function*(){et({setDoneDate:a}),yield this.plugin.saveSettings()}))}),new ve.Setting(t).setName("Use filename as Scheduled date for undated tasks").setDesc(Wt.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(i=>{let s=Q();i.setValue(s.useFilenameAsScheduledDate).onChange(a=>q(this,null,function*(){et({useFilenameAsScheduledDate:a}),yield this.plugin.saveSettings()}))}),new ve.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(i=>q(this,null,function*(){let s=Q();yield this.plugin.saveSettings(),i.setValue(Wt.renderFolderArray(s.filenameAsDateFolders)).onChange(a=>q(this,null,function*(){let o=Wt.parseCommaSeparatedFolders(a);et({filenameAsDateFolders:o}),yield this.plugin.saveSettings()}))})),t.createEl("h4",{text:"Recurring task Settings"}),new ve.Setting(t).setName("Next recurrence appears on the line below").setDesc(Wt.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(i=>{let{recurrenceOnNextLine:s}=Q();i.setValue(s).onChange(a=>q(this,null,function*(){et({recurrenceOnNextLine:a}),yield this.plugin.saveSettings()}))}),t.createEl("h4",{text:"Auto-suggest Settings"}),new ve.Setting(t).setName("Auto-suggest task content").setDesc(Wt.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(i=>{let s=Q();i.setValue(s.autoSuggestInEditor).onChange(a=>q(this,null,function*(){et({autoSuggestInEditor:a}),yield this.plugin.saveSettings()}))}),new ve.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(i=>{let s=Q();i.setLimits(0,3,1).setValue(s.autoSuggestMinMatch).setDynamicTooltip().onChange(a=>q(this,null,function*(){et({autoSuggestMinMatch:a}),yield this.plugin.saveSettings()}))}),new ve.Setting(t).setName("Maximum
`);t(o)}).open(),n};var A_=(r,e)=>{let t=jo({line:"",path:""});return new dn({app:r,task:t,onSubmit:e})};var C_=r=>({createTaskLineModal:()=>M_(r,A_)});var Cu=class extends P_.Plugin{get apiV1(){return C_(app)}onload(){return q(this,null,function*(){wu.registerConsoleLogger(),console.log('loading plugin "tasks"'),yield this.loadSettings(),this.addSettingTab(new Oa({plugin:this})),l_({metadataCache:this.app.metadataCache,vault:this.app.vault,workspace:this.app.workspace}),yield this.loadTaskStatuses();let t=new Eu({obsidianEvents:this.app.workspace});this.cache=new Ln({metadataCache:this.app.metadataCache,vault:this.app.vault,events:t}),this.inlineRenderer=new Ru({plugin:this}),this.queryRenderer=new Mu({plugin:this,events:t}),this.registerEditorExtension(T_()),this.registerEditorSuggest(new Au(this.app,Q())),new Go({plugin:this})})}loadTaskStatuses(){return q(this,null,function*(){let{statusSettings:t}=Q();Ge.applyToStatusRegistry(t,De.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();et(t),t=Q(),ge.getInstance().set(t.globalFilter),ge.getInstance().setRemoveGlobalFilter(t.removeGlobalFilter),Jt.getInstance().set(t.globalQuery),yield this.loadTaskStatuses()})}saveSettings(){return q(this,null,function*(){yield this.saveData(Q())})}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.
*/
1 year ago
/*!
* mustache.js - Logic-less {{mustache}} templates with JavaScript
* http://github.com/janl/mustache.js
*/