diff --git a/.gitignore b/.gitignore index 0645c87ca9..a1b708c3b0 100644 --- a/.gitignore +++ b/.gitignore @@ -39,3 +39,6 @@ yarn-error.log # Backup files. *.bak + +# Yarn +.yarn diff --git a/.yarnrc.yml b/.yarnrc.yml new file mode 100644 index 0000000000..3186f3f079 --- /dev/null +++ b/.yarnrc.yml @@ -0,0 +1 @@ +nodeLinker: node-modules diff --git a/resources/sample_vaults/Tasks-Demo/.obsidian/plugins/obsidian-tasks-plugin/main.js b/resources/sample_vaults/Tasks-Demo/.obsidian/plugins/obsidian-tasks-plugin/main.js index f628b5cb09..8bb49a4a99 100644 --- a/resources/sample_vaults/Tasks-Demo/.obsidian/plugins/obsidian-tasks-plugin/main.js +++ b/resources/sample_vaults/Tasks-Demo/.obsidian/plugins/obsidian-tasks-plugin/main.js @@ -122,15 +122,15828 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ -"use strict";var Gk=Object.create;var fa=Object.defineProperty,Yk=Object.defineProperties,Bk=Object.getOwnPropertyDescriptor,Hk=Object.getOwnPropertyDescriptors,Vk=Object.getOwnPropertyNames,eu=Object.getOwnPropertySymbols,zk=Object.getPrototypeOf,xc=Object.prototype.hasOwnProperty,Vh=Object.prototype.propertyIsEnumerable;var Hh=(r,e,t)=>e in r?fa(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,X=(r,e)=>{for(var t in e||(e={}))xc.call(e,t)&&Hh(r,t,e[t]);if(eu)for(var t of eu(e))Vh.call(e,t)&&Hh(r,t,e[t]);return r},be=(r,e)=>Yk(r,Hk(e));var tu=(r,e)=>{var t={};for(var n in r)xc.call(r,n)&&e.indexOf(n)<0&&(t[n]=r[n]);if(r!=null&&eu)for(var n of eu(r))e.indexOf(n)<0&&Vh.call(r,n)&&(t[n]=r[n]);return t};var k=(r,e)=>()=>(e||r((e={exports:{}}).exports,e),e.exports),Kk=(r,e)=>{for(var t in e)fa(r,t,{get:e[t],enumerable:!0})},zh=(r,e,t,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of Vk(e))!xc.call(r,i)&&i!==t&&fa(r,i,{get:()=>e[i],enumerable:!(n=Bk(e,i))||n.enumerable});return r};var pa=(r,e,t)=>(t=r!=null?Gk(zk(r)):{},zh(e||!r||!r.__esModule?fa(t,"default",{value:r,enumerable:!0}):t,r)),Qk=r=>zh(fa({},"__esModule",{value:!0}),r);var L=(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 De=k($n=>{"use strict";Object.defineProperty($n,"__esModule",{value:!0});$n.matchAnyPattern=$n.extractTerms=$n.repeatedTimeunitPattern=void 0;function eE(r,e){let t=e.replace(/\((?!\?)/g,"(?:");return`${r}${t}\\s{0,5}(?:,?\\s{0,5}${t}){0,10}`}$n.repeatedTimeunitPattern=eE;function Kh(r){let e;return r instanceof Array?e=[...r]:r instanceof Map?e=Array.from(r.keys()):e=Object.keys(r),e}$n.extractTerms=Kh;function tE(r){return`(?:${Kh(r).sort((t,n)=>n.length-t.length).join("|").replace(/\./g,"\\.")})`}$n.matchAnyPattern=tE});var _e=k((Mc,Cc)=>{(function(r,e){typeof Mc=="object"&&typeof Cc!="undefined"?Cc.exports=e():typeof define=="function"&&define.amd?define(e):(r=typeof globalThis!="undefined"?globalThis:r||self).dayjs=e()})(Mc,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",d="year",p="date",m="Invalid Date",b=/^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/,g=/\[([^\]]+)]|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,E={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("_")},R=function(G,N,O){var B=String(G);return!B||B.length>=N?G:""+Array(N+1-B.length).join(O)+G},x={s:R,z:function(G){var N=-G.utcOffset(),O=Math.abs(N),B=Math.floor(O/60),U=O%60;return(N<=0?"+":"-")+R(B,2,"0")+":"+R(U,2,"0")},m:function G(N,O){if(N.date(){"use strict";var rE=Gn&&Gn.__importDefault||function(r){return r&&r.__esModule?r:{default:r}};Object.defineProperty(Gn,"__esModule",{value:!0});Gn.findYearClosestToRef=Gn.findMostLikelyADYear=void 0;var nE=rE(_e());function iE(r){return r<100&&(r>50?r=r+1900:r=r+2e3),r}Gn.findMostLikelyADYear=iE;function sE(r,e,t){let n=nE.default(r),i=n;i=i.month(t-1),i=i.date(e),i=i.year(n.year());let s=i.add(1,"y"),a=i.add(-1,"y");return Math.abs(s.diff(n)){"use strict";Object.defineProperty(ue,"__esModule",{value:!0});ue.parseTimeUnits=ue.TIME_UNITS_PATTERN=ue.parseYear=ue.YEAR_PATTERN=ue.parseOrdinalNumberPattern=ue.ORDINAL_NUMBER_PATTERN=ue.parseNumberPattern=ue.NUMBER_PATTERN=ue.TIME_UNIT_DICTIONARY=ue.ORDINAL_WORD_DICTIONARY=ue.INTEGER_WORD_DICTIONARY=ue.MONTH_DICTIONARY=ue.FULL_MONTH_NAME_DICTIONARY=ue.WEEKDAY_DICTIONARY=void 0;var nu=De(),aE=ft();ue.WEEKDAY_DICTIONARY={sunday:0,sun:0,"sun.":0,monday:1,mon:1,"mon.":1,tuesday:2,tue:2,"tue.":2,wednesday:3,wed:3,"wed.":3,thursday:4,thurs:4,"thurs.":4,thur:4,"thur.":4,thu:4,"thu.":4,friday:5,fri:5,"fri.":5,saturday:6,sat:6,"sat.":6};ue.FULL_MONTH_NAME_DICTIONARY={january:1,february:2,march:3,april:4,may:5,june:6,july:7,august:8,september:9,october:10,november:11,december:12};ue.MONTH_DICTIONARY=Object.assign(Object.assign({},ue.FULL_MONTH_NAME_DICTIONARY),{jan:1,"jan.":1,feb:2,"feb.":2,mar:3,"mar.":3,apr:4,"apr.":4,jun:6,"jun.":6,jul:7,"jul.":7,aug:8,"aug.":8,sep:9,"sep.":9,sept:9,"sept.":9,oct:10,"oct.":10,nov:11,"nov.":11,dec:12,"dec.":12});ue.INTEGER_WORD_DICTIONARY={one:1,two:2,three:3,four:4,five:5,six:6,seven:7,eight:8,nine:9,ten:10,eleven:11,twelve:12};ue.ORDINAL_WORD_DICTIONARY={first:1,second:2,third:3,fourth:4,fifth:5,sixth:6,seventh:7,eighth:8,ninth:9,tenth:10,eleventh:11,twelfth:12,thirteenth:13,fourteenth:14,fifteenth:15,sixteenth:16,seventeenth:17,eighteenth:18,nineteenth:19,twentieth:20,"twenty first":21,"twenty-first":21,"twenty second":22,"twenty-second":22,"twenty third":23,"twenty-third":23,"twenty fourth":24,"twenty-fourth":24,"twenty fifth":25,"twenty-fifth":25,"twenty sixth":26,"twenty-sixth":26,"twenty seventh":27,"twenty-seventh":27,"twenty eighth":28,"twenty-eighth":28,"twenty ninth":29,"twenty-ninth":29,thirtieth:30,"thirty first":31,"thirty-first":31};ue.TIME_UNIT_DICTIONARY={sec:"second",second:"second",seconds:"second",min:"minute",mins:"minute",minute:"minute",minutes:"minute",h:"hour",hr:"hour",hrs:"hour",hour:"hour",hours:"hour",day:"d",days:"d",week:"week",weeks:"week",month:"month",months:"month",qtr:"quarter",quarter:"quarter",quarters:"quarter",y:"year",yr:"year",year:"year",years:"year"};ue.NUMBER_PATTERN=`(?:${nu.matchAnyPattern(ue.INTEGER_WORD_DICTIONARY)}|[0-9]+|[0-9]+\\.[0-9]+|half(?:\\s{0,2}an?)?|an?\\b(?:\\s{0,2}few)?|few|several|a?\\s{0,2}couple\\s{0,2}(?:of)?)`;function Xh(r){let e=r.toLowerCase();return ue.INTEGER_WORD_DICTIONARY[e]!==void 0?ue.INTEGER_WORD_DICTIONARY[e]:e==="a"||e==="an"?1:e.match(/few/)?3:e.match(/half/)?.5:e.match(/couple/)?2:e.match(/several/)?7:parseFloat(e)}ue.parseNumberPattern=Xh;ue.ORDINAL_NUMBER_PATTERN=`(?:${nu.matchAnyPattern(ue.ORDINAL_WORD_DICTIONARY)}|[0-9]{1,2}(?:st|nd|rd|th)?)`;function oE(r){let e=r.toLowerCase();return ue.ORDINAL_WORD_DICTIONARY[e]!==void 0?ue.ORDINAL_WORD_DICTIONARY[e]:(e=e.replace(/(?:st|nd|rd|th)$/i,""),parseInt(e))}ue.parseOrdinalNumberPattern=oE;ue.YEAR_PATTERN="(?:[1-9][0-9]{0,3}\\s{0,2}(?:BE|AD|BC|BCE|CE)|[1-2][0-9]{3}|[5-9][0-9])";function uE(r){if(/BE/i.test(r))return r=r.replace(/BE/i,""),parseInt(r)-543;if(/BCE?/i.test(r))return r=r.replace(/BCE?/i,""),-parseInt(r);if(/(AD|CE)/i.test(r))return r=r.replace(/(AD|CE)/i,""),parseInt(r);let e=parseInt(r);return aE.findMostLikelyADYear(e)}ue.parseYear=uE;var Zh=`(${ue.NUMBER_PATTERN})\\s{0,3}(${nu.matchAnyPattern(ue.TIME_UNIT_DICTIONARY)})`,Qh=new RegExp(Zh,"i");ue.TIME_UNITS_PATTERN=nu.repeatedTimeunitPattern("(?:(?:about|around)\\s{0,3})?",Zh);function lE(r){let e={},t=r,n=Qh.exec(t);for(;n;)cE(e,n),t=t.substring(n[0].length).trim(),n=Qh.exec(t);return e}ue.parseTimeUnits=lE;function cE(r,e){let t=Xh(e[1]),n=ue.TIME_UNIT_DICTIONARY[e[2].toLowerCase()];r[n]=t}});var Jh=k((Ac,Pc)=>{(function(r,e){typeof Ac=="object"&&typeof Pc!="undefined"?Pc.exports=e():typeof define=="function"&&define.amd?define(e):(r=typeof globalThis!="undefined"?globalThis:r||self).dayjs_plugin_quarterOfYear=e()})(Ac,function(){"use strict";var r="month",e="quarter";return function(t,n){var i=n.prototype;i.quarter=function(o){return this.$utils().u(o)?Math.ceil((this.month()+1)/3):this.month(this.month()%3+3*(o-1))};var s=i.add;i.add=function(o,u){return o=Number(o),this.$utils().p(u)===e?this.add(3*o,r):s.bind(this)(o,u)};var a=i.startOf;i.startOf=function(o,u){var l=this.$utils(),c=!!l.u(u)||u;if(l.p(o)===e){var d=this.quarter()-1;return c?this.month(3*d).startOf(r).startOf("day"):this.month(3*d+2).endOf(r).endOf("day")}return a.bind(this)(o,u)}}})});var lr=k(Br=>{"use strict";Object.defineProperty(Br,"__esModule",{value:!0});Br.implySimilarTime=Br.assignSimilarTime=Br.assignSimilarDate=Br.assignTheNextDay=void 0;var eg=Je();function dE(r,e){e=e.add(1,"day"),tg(r,e),rg(r,e)}Br.assignTheNextDay=dE;function tg(r,e){r.assign("day",e.date()),r.assign("month",e.month()+1),r.assign("year",e.year())}Br.assignSimilarDate=tg;function fE(r,e){r.assign("hour",e.hour()),r.assign("minute",e.minute()),r.assign("second",e.second()),r.assign("millisecond",e.millisecond()),r.get("hour")<12?r.assign("meridiem",eg.Meridiem.AM):r.assign("meridiem",eg.Meridiem.PM)}Br.assignSimilarTime=fE;function rg(r,e){r.imply("hour",e.hour()),r.imply("minute",e.minute()),r.imply("second",e.second()),r.imply("millisecond",e.millisecond())}Br.implySimilarTime=rg});var ng=k(mi=>{"use strict";Object.defineProperty(mi,"__esModule",{value:!0});mi.toTimezoneOffset=mi.TIMEZONE_ABBR_MAP=void 0;mi.TIMEZONE_ABBR_MAP={ACDT:630,ACST:570,ADT:-180,AEDT:660,AEST:600,AFT:270,AKDT:-480,AKST:-540,ALMT:360,AMST:-180,AMT:-240,ANAST:720,ANAT:720,AQTT:300,ART:-180,AST:-240,AWDT:540,AWST:480,AZOST:0,AZOT:-60,AZST:300,AZT:240,BNT:480,BOT:-240,BRST:-120,BRT:-180,BST:60,BTT:360,CAST:480,CAT:120,CCT:390,CDT:-300,CEST:120,CET:60,CHADT:825,CHAST:765,CKT:-600,CLST:-180,CLT:-240,COT:-300,CST:-360,CVT:-60,CXT:420,ChST:600,DAVT:420,EASST:-300,EAST:-360,EAT:180,ECT:-300,EDT:-240,EEST:180,EET:120,EGST:0,EGT:-60,EST:-300,ET:-300,FJST:780,FJT:720,FKST:-180,FKT:-240,FNT:-120,GALT:-360,GAMT:-540,GET:240,GFT:-180,GILT:720,GMT:0,GST:240,GYT:-240,HAA:-180,HAC:-300,HADT:-540,HAE:-240,HAP:-420,HAR:-360,HAST:-600,HAT:-90,HAY:-480,HKT:480,HLV:-210,HNA:-240,HNC:-360,HNE:-300,HNP:-480,HNR:-420,HNT:-150,HNY:-540,HOVT:420,ICT:420,IDT:180,IOT:360,IRDT:270,IRKST:540,IRKT:540,IRST:210,IST:330,JST:540,KGT:360,KRAST:480,KRAT:480,KST:540,KUYT:240,LHDT:660,LHST:630,LINT:840,MAGST:720,MAGT:720,MART:-510,MAWT:300,MDT:-360,MESZ:120,MEZ:60,MHT:720,MMT:390,MSD:240,MSK:180,MST:-420,MUT:240,MVT:300,MYT:480,NCT:660,NDT:-90,NFT:690,NOVST:420,NOVT:360,NPT:345,NST:-150,NUT:-660,NZDT:780,NZST:720,OMSST:420,OMST:420,PDT:-420,PET:-300,PETST:720,PETT:720,PGT:600,PHOT:780,PHT:480,PKT:300,PMDT:-120,PMST:-180,PONT:660,PST:-480,PT:-480,PWT:540,PYST:-180,PYT:-240,RET:240,SAMT:240,SAST:120,SBT:660,SCT:240,SGT:480,SRT:-180,SST:-660,TAHT:-600,TFT:300,TJT:300,TKT:780,TLT:540,TMT:300,TVT:720,ULAT:480,UTC:0,UYST:-120,UYT:-180,UZT:300,VET:-210,VLAST:660,VLAT:660,VUT:660,WAST:120,WAT:60,WEST:60,WESZ:60,WET:0,WEZ:0,WFT:720,WGST:-120,WGT:-180,WIB:420,WIT:540,WITA:480,WST:780,WT:0,YAKST:600,YAKT:600,YAPT:600,YEKST:360,YEKT:360};function pE(r){var e;return r==null?null:typeof r=="number"?r:(e=mi.TIMEZONE_ABBR_MAP[r])!==null&&e!==void 0?e:null}mi.toTimezoneOffset=pE});var qe=k(Hr=>{"use strict";var ig=Hr&&Hr.__importDefault||function(r){return r&&r.__esModule?r:{default:r}};Object.defineProperty(Hr,"__esModule",{value:!0});Hr.ParsingResult=Hr.ParsingComponents=Hr.ReferenceWithTimezone=void 0;var mE=ig(Jh()),iu=ig(_e()),Nc=lr(),hE=ng();iu.default.extend(mE.default);var Ic=class{constructor(e){var t;e=e!=null?e:new Date,e instanceof Date?this.instant=e:(this.instant=(t=e.instant)!==null&&t!==void 0?t:new Date,this.timezoneOffset=hE.toTimezoneOffset(e.timezone))}};Hr.ReferenceWithTimezone=Ic;var hi=class{constructor(e,t){if(this.reference=e,this.knownValues={},this.impliedValues={},t)for(let i in t)this.knownValues[i]=t[i];let n=iu.default(e.instant);this.imply("day",n.date()),this.imply("month",n.month()+1),this.imply("year",n.year()),this.imply("hour",12),this.imply("minute",0),this.imply("second",0),this.imply("millisecond",0)}get(e){return e in this.knownValues?this.knownValues[e]:e in this.impliedValues?this.impliedValues[e]:null}isCertain(e){return e in this.knownValues}getCertainComponents(){return Object.keys(this.knownValues)}imply(e,t){return e in this.knownValues?this:(this.impliedValues[e]=t,this)}assign(e,t){return this.knownValues[e]=t,delete this.impliedValues[e],this}delete(e){delete this.knownValues[e],delete this.impliedValues[e]}clone(){let e=new hi(this.reference);e.knownValues={},e.impliedValues={};for(let t in this.knownValues)e.knownValues[t]=this.knownValues[t];for(let t in this.impliedValues)e.impliedValues[t]=this.impliedValues[t];return e}isOnlyDate(){return!this.isCertain("hour")&&!this.isCertain("minute")&&!this.isCertain("second")}isOnlyTime(){return!this.isCertain("weekday")&&!this.isCertain("day")&&!this.isCertain("month")}isOnlyWeekdayComponent(){return this.isCertain("weekday")&&!this.isCertain("day")&&!this.isCertain("month")}isOnlyDayMonthComponent(){return this.isCertain("day")&&this.isCertain("month")&&!this.isCertain("year")}isValidDate(){let e=this.dateWithoutTimezoneAdjustment();return!(e.getFullYear()!==this.get("year")||e.getMonth()!==this.get("month")-1||e.getDate()!==this.get("day")||this.get("hour")!=null&&e.getHours()!=this.get("hour")||this.get("minute")!=null&&e.getMinutes()!=this.get("minute"))}toString(){return`[ParsingComponents {knownValues: ${JSON.stringify(this.knownValues)}, impliedValues: ${JSON.stringify(this.impliedValues)}}, reference: ${JSON.stringify(this.reference)}]`}dayjs(){return iu.default(this.date())}date(){let e=this.dateWithoutTimezoneAdjustment();return new Date(e.getTime()+this.getSystemTimezoneAdjustmentMinute(e)*6e4)}dateWithoutTimezoneAdjustment(){let e=new Date(this.get("year"),this.get("month")-1,this.get("day"),this.get("hour"),this.get("minute"),this.get("second"),this.get("millisecond"));return e.setFullYear(this.get("year")),e}getSystemTimezoneAdjustmentMinute(e){var t,n;(!e||e.getTime()<0)&&(e=new Date);let i=-e.getTimezoneOffset(),s=(n=(t=this.get("timezoneOffset"))!==null&&t!==void 0?t:this.reference.timezoneOffset)!==null&&n!==void 0?n:i;return i-s}static createRelativeFromReference(e,t){let n=iu.default(e.instant);for(let s in t)n=n.add(t[s],s);let i=new hi(e);return t.hour||t.minute||t.second?(Nc.assignSimilarTime(i,n),Nc.assignSimilarDate(i,n),e.timezoneOffset!==null&&i.assign("timezoneOffset",-e.instant.getTimezoneOffset())):(Nc.implySimilarTime(i,n),e.timezoneOffset!==null&&i.imply("timezoneOffset",-e.instant.getTimezoneOffset()),t.d?(i.assign("day",n.date()),i.assign("month",n.month()+1),i.assign("year",n.year())):(t.week&&i.imply("weekday",n.day()),i.imply("day",n.date()),t.month?(i.assign("month",n.month()+1),i.assign("year",n.year())):(i.imply("month",n.month()+1),t.year?i.assign("year",n.year()):i.imply("year",n.year())))),i}};Hr.ParsingComponents=hi;var ma=class{constructor(e,t,n,i,s){this.reference=e,this.refDate=e.instant,this.index=t,this.text=n,this.start=i||new hi(e),this.end=s}clone(){let e=new ma(this.reference,this.index,this.text);return e.start=this.start?this.start.clone():null,e.end=this.end?this.end.clone():null,e}date(){return this.start.date()}toString(){return`[ParsingResult {index: ${this.index}, text: '${this.text}', ...}]`}};Hr.ParsingResult=ma});var H=k(su=>{"use strict";Object.defineProperty(su,"__esModule",{value:!0});su.AbstractParserWithWordBoundaryChecking=void 0;var Fc=class{constructor(){this.cachedInnerPattern=null,this.cachedPattern=null}patternLeftBoundary(){return"(\\W|^)"}pattern(e){let t=this.innerPattern(e);return t==this.cachedInnerPattern?this.cachedPattern:(this.cachedPattern=new RegExp(`${this.patternLeftBoundary()}${t.source}`,t.flags),this.cachedInnerPattern=t,this.cachedPattern)}extract(e,t){var n;let i=(n=t[1])!==null&&n!==void 0?n:"";t.index=t.index+i.length,t[0]=t[0].substring(i.length);for(let s=2;s{"use strict";Object.defineProperty(Wc,"__esModule",{value:!0});var Uc=pt(),gE=qe(),yE=H(),bE=new RegExp(`(?:within|in|for)\\s*(?:(?:about|around|roughly|approximately|just)\\s*(?:~\\s*)?)?(${Uc.TIME_UNITS_PATTERN})(?=\\W|$)`,"i"),TE=new RegExp(`(?:(?:about|around|roughly|approximately|just)\\s*(?:~\\s*)?)?(${Uc.TIME_UNITS_PATTERN})(?=\\W|$)`,"i"),Lc=class extends yE.AbstractParserWithWordBoundaryChecking{innerPattern(e){return e.option.forwardDate?TE:bE}innerExtract(e,t){let n=Uc.parseTimeUnits(t[1]);return gE.ParsingComponents.createRelativeFromReference(e.reference,n)}};Wc.default=Lc});var dg=k(jc=>{"use strict";Object.defineProperty(jc,"__esModule",{value:!0});var _E=ft(),lg=pt(),cg=pt(),au=pt(),vE=De(),wE=H(),kE=new RegExp(`(?:on\\s{0,3})?(${au.ORDINAL_NUMBER_PATTERN})(?:\\s{0,3}(?:to|\\-|\\\u2013|until|through|till)?\\s{0,3}(${au.ORDINAL_NUMBER_PATTERN}))?(?:-|/|\\s{0,3}(?:of)?\\s{0,3})(${vE.matchAnyPattern(lg.MONTH_DICTIONARY)})(?:(?:-|/|,?\\s{0,3})(${cg.YEAR_PATTERN}(?![^\\s]\\d)))?(?=\\W|$)`,"i"),ag=1,og=2,EE=3,ug=4,qc=class extends wE.AbstractParserWithWordBoundaryChecking{innerPattern(){return kE}innerExtract(e,t){let n=e.createParsingResult(t.index,t[0]),i=lg.MONTH_DICTIONARY[t[EE].toLowerCase()],s=au.parseOrdinalNumberPattern(t[ag]);if(s>31)return t.index=t.index+t[ag].length,null;if(n.start.assign("month",i),n.start.assign("day",s),t[ug]){let a=cg.parseYear(t[ug]);n.start.assign("year",a)}else{let a=_E.findYearClosestToRef(e.refDate,s,i);n.start.imply("year",a)}if(t[og]){let a=au.parseOrdinalNumberPattern(t[og]);n.end=n.start.clone(),n.end.assign("day",a)}return n}};jc.default=qc});var gg=k(Gc=>{"use strict";Object.defineProperty(Gc,"__esModule",{value:!0});var SE=ft(),mg=pt(),ou=pt(),hg=pt(),OE=De(),DE=H(),xE=new RegExp(`(${OE.matchAnyPattern(mg.MONTH_DICTIONARY)})(?:-|/|\\s*,?\\s*)(${ou.ORDINAL_NUMBER_PATTERN})(?!\\s*(?:am|pm))\\s*(?:(?:to|\\-)\\s*(${ou.ORDINAL_NUMBER_PATTERN})\\s*)?(?:(?:-|/|\\s*,?\\s*)(${hg.YEAR_PATTERN}))?(?=\\W|$)(?!\\:\\d)`,"i"),RE=1,ME=2,fg=3,pg=4,$c=class extends DE.AbstractParserWithWordBoundaryChecking{innerPattern(){return xE}innerExtract(e,t){let n=mg.MONTH_DICTIONARY[t[RE].toLowerCase()],i=ou.parseOrdinalNumberPattern(t[ME]);if(i>31)return null;let s=e.createParsingComponents({day:i,month:n});if(t[pg]){let u=hg.parseYear(t[pg]);s.assign("year",u)}else{let u=SE.findYearClosestToRef(e.refDate,i,n);s.imply("year",u)}if(!t[fg])return s;let a=ou.parseOrdinalNumberPattern(t[fg]),o=e.createParsingResult(t.index,t[0]);return o.start=s,o.end=s.clone(),o.end.assign("day",a),o}};Gc.default=$c});var Tg=k(Hc=>{"use strict";Object.defineProperty(Hc,"__esModule",{value:!0});var Yc=pt(),CE=ft(),AE=De(),bg=pt(),PE=H(),NE=new RegExp(`((?:in)\\s*)?(${AE.matchAnyPattern(Yc.MONTH_DICTIONARY)})\\s*(?:[,-]?\\s*(${bg.YEAR_PATTERN})?)?(?=[^\\s\\w]|\\s+[^0-9]|\\s+$|$)`,"i"),IE=1,FE=2,yg=3,Bc=class extends PE.AbstractParserWithWordBoundaryChecking{innerPattern(){return NE}innerExtract(e,t){let n=t[FE].toLowerCase();if(t[0].length<=3&&!Yc.FULL_MONTH_NAME_DICTIONARY[n])return null;let i=e.createParsingResult(t.index+(t[IE]||"").length,t.index+t[0].length);i.start.imply("day",1);let s=Yc.MONTH_DICTIONARY[n];if(i.start.assign("month",s),t[yg]){let a=bg.parseYear(t[yg]);i.start.assign("year",a)}else{let a=CE.findYearClosestToRef(e.refDate,1,s);i.start.imply("year",a)}return i}};Hc.default=Bc});var wg=k(zc=>{"use strict";Object.defineProperty(zc,"__esModule",{value:!0});var vg=pt(),LE=De(),UE=H(),WE=new RegExp(`([0-9]{4})[\\.\\/\\s](?:(${LE.matchAnyPattern(vg.MONTH_DICTIONARY)})|([0-9]{1,2}))[\\.\\/\\s]([0-9]{1,2})(?=\\W|$)`,"i"),qE=1,jE=2,_g=3,$E=4,Vc=class extends UE.AbstractParserWithWordBoundaryChecking{innerPattern(){return WE}innerExtract(e,t){let n=t[_g]?parseInt(t[_g]):vg.MONTH_DICTIONARY[t[jE].toLowerCase()];if(n<1||n>12)return null;let i=parseInt(t[qE]);return{day:parseInt(t[$E]),month:n,year:i}}};zc.default=Vc});var kg=k(Qc=>{"use strict";Object.defineProperty(Qc,"__esModule",{value:!0});var GE=H(),YE=new RegExp("([0-9]|0[1-9]|1[012])/([0-9]{4})","i"),BE=1,HE=2,Kc=class extends GE.AbstractParserWithWordBoundaryChecking{innerPattern(){return YE}innerExtract(e,t){let n=parseInt(t[HE]),i=parseInt(t[BE]);return e.createParsingComponents().imply("day",1).assign("month",i).assign("year",n)}};Qc.default=Kc});var gi=k(cu=>{"use strict";Object.defineProperty(cu,"__esModule",{value:!0});cu.AbstractTimeExpressionParser=void 0;var Mt=Je();function VE(r,e,t,n){return new RegExp(`${r}${e}(\\d{1,4})(?:(?:\\.|:|\uFF1A)(\\d{1,2})(?:(?::|\uFF1A)(\\d{2})(?:\\.(\\d{1,6}))?)?)?(?:\\s*(a\\.m\\.|p\\.m\\.|am?|pm?))?${t}`,n)}function zE(r,e){return new RegExp(`^(${r})(\\d{1,4})(?:(?:\\.|\\:|\\\uFF1A)(\\d{1,2})(?:(?:\\.|\\:|\\\uFF1A)(\\d{1,2})(?:\\.(\\d{1,6}))?)?)?(?:\\s*(a\\.m\\.|p\\.m\\.|am?|pm?))?${e}`,"i")}var Eg=2,ts=3,uu=4,lu=5,ha=6,Xc=class{constructor(e=!1){this.cachedPrimaryPrefix=null,this.cachedPrimarySuffix=null,this.cachedPrimaryTimePattern=null,this.cachedFollowingPhase=null,this.cachedFollowingSuffix=null,this.cachedFollowingTimePatten=null,this.strictMode=e}patternFlags(){return"i"}primaryPatternLeftBoundary(){return"(^|\\s|T|\\b)"}primarySuffix(){return"(?=\\W|$)"}followingSuffix(){return"(?=\\W|$)"}pattern(e){return this.getPrimaryTimePatternThroughCache()}extract(e,t){let n=this.extractPrimaryTimeComponents(e,t);if(!n)return t.index+=t[0].length,null;let i=t.index+t[1].length,s=t[0].substring(t[1].length),a=e.createParsingResult(i,s,n);t.index+=t[0].length;let o=e.text.substring(t.index),l=this.getFollowingTimePatternThroughCache().exec(o);return s.match(/^\d{3,4}/)&&l&&l[0].match(/^\s*([+-])\s*\d{2,4}$/)?null:!l||l[0].match(/^\s*([+-])\s*\d{3,4}$/)?this.checkAndReturnWithoutFollowingPattern(a):(a.end=this.extractFollowingTimeComponents(e,l,a),a.end&&(a.text+=l[0]),this.checkAndReturnWithFollowingPattern(a))}extractPrimaryTimeComponents(e,t,n=!1){let i=e.createParsingComponents(),s=0,a=null,o=parseInt(t[Eg]);if(o>100){if(this.strictMode||t[ts]!=null)return null;s=o%100,o=Math.floor(o/100)}if(o>24)return null;if(t[ts]!=null){if(t[ts].length==1&&!t[ha])return null;s=parseInt(t[ts])}if(s>=60)return null;if(o>12&&(a=Mt.Meridiem.PM),t[ha]!=null){if(o>12)return null;let u=t[ha][0].toLowerCase();u=="a"&&(a=Mt.Meridiem.AM,o==12&&(o=0)),u=="p"&&(a=Mt.Meridiem.PM,o!=12&&(o+=12))}if(i.assign("hour",o),i.assign("minute",s),a!==null?i.assign("meridiem",a):o<12?i.imply("meridiem",Mt.Meridiem.AM):i.imply("meridiem",Mt.Meridiem.PM),t[lu]!=null){let u=parseInt(t[lu].substring(0,3));if(u>=1e3)return null;i.assign("millisecond",u)}if(t[uu]!=null){let u=parseInt(t[uu]);if(u>=60)return null;i.assign("second",u)}return i}extractFollowingTimeComponents(e,t,n){let i=e.createParsingComponents();if(t[lu]!=null){let u=parseInt(t[lu].substring(0,3));if(u>=1e3)return null;i.assign("millisecond",u)}if(t[uu]!=null){let u=parseInt(t[uu]);if(u>=60)return null;i.assign("second",u)}let s=parseInt(t[Eg]),a=0,o=-1;if(t[ts]!=null?a=parseInt(t[ts]):s>100&&(a=s%100,s=Math.floor(s/100)),a>=60||s>24)return null;if(s>=12&&(o=Mt.Meridiem.PM),t[ha]!=null){if(s>12)return null;let u=t[ha][0].toLowerCase();u=="a"&&(o=Mt.Meridiem.AM,s==12&&(s=0,i.isCertain("day")||i.imply("day",i.get("day")+1))),u=="p"&&(o=Mt.Meridiem.PM,s!=12&&(s+=12)),n.start.isCertain("meridiem")||(o==Mt.Meridiem.AM?(n.start.imply("meridiem",Mt.Meridiem.AM),n.start.get("hour")==12&&n.start.assign("hour",0)):(n.start.imply("meridiem",Mt.Meridiem.PM),n.start.get("hour")!=12&&n.start.assign("hour",n.start.get("hour")+12)))}return i.assign("hour",s),i.assign("minute",a),o>=0?i.assign("meridiem",o):n.start.isCertain("meridiem")&&n.start.get("hour")>12?n.start.get("hour")-12>s?i.imply("meridiem",Mt.Meridiem.AM):s<=12&&(i.assign("hour",s+12),i.assign("meridiem",Mt.Meridiem.PM)):s>12?i.imply("meridiem",Mt.Meridiem.PM):s<=12&&i.imply("meridiem",Mt.Meridiem.AM),i.date().getTime()24)return null}return e}checkAndReturnWithFollowingPattern(e){if(e.text.match(/^\d+-\d+$/))return null;let t=e.text.match(/[^\d:.](\d[\d.]+)\s*-\s*(\d[\d.]+)$/);if(t){if(this.strictMode)return null;let n=t[1],i=t[2];if(i.includes(".")&&!i.match(/\d(\.\d{2})+$/))return null;let s=parseInt(i),a=parseInt(n);if(s>24||a>24)return null}return e}getPrimaryTimePatternThroughCache(){let e=this.primaryPrefix(),t=this.primarySuffix();return this.cachedPrimaryPrefix===e&&this.cachedPrimarySuffix===t?this.cachedPrimaryTimePattern:(this.cachedPrimaryTimePattern=VE(this.primaryPatternLeftBoundary(),e,t,this.patternFlags()),this.cachedPrimaryPrefix=e,this.cachedPrimarySuffix=t,this.cachedPrimaryTimePattern)}getFollowingTimePatternThroughCache(){let e=this.followingPhase(),t=this.followingSuffix();return this.cachedFollowingPhase===e&&this.cachedFollowingSuffix===t?this.cachedFollowingTimePatten:(this.cachedFollowingTimePatten=zE(e,t),this.cachedFollowingPhase=e,this.cachedFollowingSuffix=t,this.cachedFollowingTimePatten)}};cu.AbstractTimeExpressionParser=Xc});var Sg=k(Jc=>{"use strict";Object.defineProperty(Jc,"__esModule",{value:!0});var du=Je(),KE=gi(),Zc=class extends KE.AbstractTimeExpressionParser{constructor(e){super(e)}followingPhase(){return"\\s*(?:\\-|\\\u2013|\\~|\\\u301C|to|\\?)\\s*"}primaryPrefix(){return"(?:(?:at|from)\\s*)??"}primarySuffix(){return"(?:\\s*(?:o\\W*clock|at\\s*night|in\\s*the\\s*(?:morning|afternoon)))?(?!/)(?=\\W|$)"}extractPrimaryTimeComponents(e,t){let n=super.extractPrimaryTimeComponents(e,t);if(n){if(t[0].endsWith("night")){let i=n.get("hour");i>=6&&i<12?(n.assign("hour",n.get("hour")+12),n.assign("meridiem",du.Meridiem.PM)):i<6&&n.assign("meridiem",du.Meridiem.AM)}if(t[0].endsWith("afternoon")){n.assign("meridiem",du.Meridiem.PM);let i=n.get("hour");i>=0&&i<=6&&n.assign("hour",n.get("hour")+12)}t[0].endsWith("morning")&&(n.assign("meridiem",du.Meridiem.AM),n.get("hour")<12&&n.assign("hour",n.get("hour")))}return n}};Jc.default=Zc});var cr=k(rs=>{"use strict";Object.defineProperty(rs,"__esModule",{value:!0});rs.addImpliedTimeUnits=rs.reverseTimeUnits=void 0;function QE(r){let e={};for(let t in r)e[t]=-r[t];return e}rs.reverseTimeUnits=QE;function XE(r,e){let t=r.clone(),n=r.dayjs();for(let i in e)n=n.add(e[i],i);return("day"in e||"d"in e||"week"in e||"month"in e||"year"in e)&&(t.imply("day",n.date()),t.imply("month",n.month()+1),t.imply("year",n.year())),("second"in e||"minute"in e||"hour"in e)&&(t.imply("second",n.second()),t.imply("minute",n.minute()),t.imply("hour",n.hour())),t}rs.addImpliedTimeUnits=XE});var Og=k(rd=>{"use strict";Object.defineProperty(rd,"__esModule",{value:!0});var td=pt(),ZE=qe(),JE=H(),eS=cr(),tS=new RegExp(`(${td.TIME_UNITS_PATTERN})\\s{0,5}(?:ago|before|earlier)(?=(?:\\W|$))`,"i"),rS=new RegExp(`(${td.TIME_UNITS_PATTERN})\\s{0,5}ago(?=(?:\\W|$))`,"i"),ed=class extends JE.AbstractParserWithWordBoundaryChecking{constructor(e){super(),this.strictMode=e}innerPattern(){return this.strictMode?rS:tS}innerExtract(e,t){let n=td.parseTimeUnits(t[1]),i=eS.reverseTimeUnits(n);return ZE.ParsingComponents.createRelativeFromReference(e.reference,i)}};rd.default=ed});var Dg=k(sd=>{"use strict";Object.defineProperty(sd,"__esModule",{value:!0});var id=pt(),nS=qe(),iS=H(),sS=new RegExp(`(${id.TIME_UNITS_PATTERN})\\s{0,5}(?:later|after|from now|henceforth|forward|out)(?=(?:\\W|$))`,"i"),aS=new RegExp("("+id.TIME_UNITS_PATTERN+")(later|from now)(?=(?:\\W|$))","i"),oS=1,nd=class extends iS.AbstractParserWithWordBoundaryChecking{constructor(e){super(),this.strictMode=e}innerPattern(){return this.strictMode?aS:sS}innerExtract(e,t){let n=id.parseTimeUnits(t[oS]);return nS.ParsingComponents.createRelativeFromReference(e.reference,n)}};sd.default=nd});var is=k(ns=>{"use strict";Object.defineProperty(ns,"__esModule",{value:!0});ns.MergingRefiner=ns.Filter=void 0;var ad=class{refine(e,t){return t.filter(n=>this.isValid(e,n))}};ns.Filter=ad;var od=class{refine(e,t){if(t.length<2)return t;let n=[],i=t[0],s=null;for(let a=1;a{console.log(`${this.constructor.name} merged ${u} and ${l} into ${c}`)}),i=c}}return i!=null&&n.push(i),n}};ns.MergingRefiner=od});var Vr=k(ld=>{"use strict";Object.defineProperty(ld,"__esModule",{value:!0});var uS=is(),ud=class extends uS.MergingRefiner{shouldMergeResults(e,t,n){return!t.end&&!n.end&&e.match(this.patternBetween())!=null}mergeResults(e,t,n){if(!t.start.isOnlyWeekdayComponent()&&!n.start.isOnlyWeekdayComponent()&&(n.start.getCertainComponents().forEach(s=>{t.start.isCertain(s)||t.start.assign(s,n.start.get(s))}),t.start.getCertainComponents().forEach(s=>{n.start.isCertain(s)||n.start.assign(s,t.start.get(s))})),t.start.date().getTime()>n.start.date().getTime()){let s=t.start.dayjs(),a=n.start.dayjs();t.start.isOnlyWeekdayComponent()&&s.add(-7,"days").isBefore(a)?(s=s.add(-7,"days"),t.start.imply("day",s.date()),t.start.imply("month",s.month()+1),t.start.imply("year",s.year())):n.start.isOnlyWeekdayComponent()&&a.add(7,"days").isAfter(s)?(a=a.add(7,"days"),n.start.imply("day",a.date()),n.start.imply("month",a.month()+1),n.start.imply("year",a.year())):[n,t]=[t,n]}let i=t.clone();return i.start=t.start,i.end=n.start,i.index=Math.min(t.index,n.index),t.index{"use strict";var lS=ga&&ga.__importDefault||function(r){return r&&r.__esModule?r:{default:r}};Object.defineProperty(ga,"__esModule",{value:!0});var cS=lS(Vr()),cd=class extends cS.default{patternBetween(){return/^\s*(to|-)\s*$/i}};ga.default=cd});var Rg=k(ss=>{"use strict";Object.defineProperty(ss,"__esModule",{value:!0});ss.mergeDateTimeComponent=ss.mergeDateTimeResult=void 0;var dS=Je();function fS(r,e){let t=r.clone(),n=r.start,i=e.start;if(t.start=dd(n,i),r.end!=null||e.end!=null){let s=r.end==null?r.start:r.end,a=e.end==null?e.start:e.end,o=dd(s,a);r.end==null&&o.date().getTime(){"use strict";Object.defineProperty(pd,"__esModule",{value:!0});var pS=is(),Mg=Rg(),fd=class extends pS.MergingRefiner{shouldMergeResults(e,t,n){return(t.start.isOnlyDate()&&n.start.isOnlyTime()||n.start.isOnlyDate()&&t.start.isOnlyTime())&&e.match(this.patternBetween())!=null}mergeResults(e,t,n){let i=t.start.isOnlyDate()?Mg.mergeDateTimeResult(t,n):Mg.mergeDateTimeResult(n,t);return i.index=t.index,i.text=t.text+e+n.text,i}};pd.default=fd});var Cg=k(ya=>{"use strict";var mS=ya&&ya.__importDefault||function(r){return r&&r.__esModule?r:{default:r}};Object.defineProperty(ya,"__esModule",{value:!0});var hS=mS(pn()),md=class extends hS.default{patternBetween(){return new RegExp("^\\s*(T|at|after|before|on|of|,|-)?\\s*$")}};ya.default=md});var Ag=k(gd=>{"use strict";Object.defineProperty(gd,"__esModule",{value:!0});var gS=new RegExp("^\\s*,?\\s*\\(?([A-Z]{2,4})\\)?(?=\\W|$)","i"),yS={ACDT:630,ACST:570,ADT:-180,AEDT:660,AEST:600,AFT:270,AKDT:-480,AKST:-540,ALMT:360,AMST:-180,AMT:-240,ANAST:720,ANAT:720,AQTT:300,ART:-180,AST:-240,AWDT:540,AWST:480,AZOST:0,AZOT:-60,AZST:300,AZT:240,BNT:480,BOT:-240,BRST:-120,BRT:-180,BST:60,BTT:360,CAST:480,CAT:120,CCT:390,CDT:-300,CEST:120,CET:60,CHADT:825,CHAST:765,CKT:-600,CLST:-180,CLT:-240,COT:-300,CST:-360,CVT:-60,CXT:420,ChST:600,DAVT:420,EASST:-300,EAST:-360,EAT:180,ECT:-300,EDT:-240,EEST:180,EET:120,EGST:0,EGT:-60,EST:-300,ET:-300,FJST:780,FJT:720,FKST:-180,FKT:-240,FNT:-120,GALT:-360,GAMT:-540,GET:240,GFT:-180,GILT:720,GMT:0,GST:240,GYT:-240,HAA:-180,HAC:-300,HADT:-540,HAE:-240,HAP:-420,HAR:-360,HAST:-600,HAT:-90,HAY:-480,HKT:480,HLV:-210,HNA:-240,HNC:-360,HNE:-300,HNP:-480,HNR:-420,HNT:-150,HNY:-540,HOVT:420,ICT:420,IDT:180,IOT:360,IRDT:270,IRKST:540,IRKT:540,IRST:210,IST:330,JST:540,KGT:360,KRAST:480,KRAT:480,KST:540,KUYT:240,LHDT:660,LHST:630,LINT:840,MAGST:720,MAGT:720,MART:-510,MAWT:300,MDT:-360,MESZ:120,MEZ:60,MHT:720,MMT:390,MSD:240,MSK:240,MST:-420,MUT:240,MVT:300,MYT:480,NCT:660,NDT:-90,NFT:690,NOVST:420,NOVT:360,NPT:345,NST:-150,NUT:-660,NZDT:780,NZST:720,OMSST:420,OMST:420,PDT:-420,PET:-300,PETST:720,PETT:720,PGT:600,PHOT:780,PHT:480,PKT:300,PMDT:-120,PMST:-180,PONT:660,PST:-480,PT:-480,PWT:540,PYST:-180,PYT:-240,RET:240,SAMT:240,SAST:120,SBT:660,SCT:240,SGT:480,SRT:-180,SST:-660,TAHT:-600,TFT:300,TJT:300,TKT:780,TLT:540,TMT:300,TVT:720,ULAT:480,UTC:0,UYST:-120,UYT:-180,UZT:300,VET:-210,VLAST:660,VLAT:660,VUT:660,WAST:120,WAT:60,WEST:60,WESZ:60,WET:0,WEZ:0,WFT:720,WGST:-120,WGT:-180,WIB:420,WIT:540,WITA:480,WST:780,WT:0,YAKST:600,YAKT:600,YAPT:600,YEKST:360,YEKT:360},hd=class{constructor(e){this.timezone=Object.assign(Object.assign({},yS),e)}refine(e,t){var n;let i=(n=e.option.timezones)!==null&&n!==void 0?n:{};return t.forEach(s=>{var a,o;let u=e.text.substring(s.index+s.text.length),l=gS.exec(u);if(!l)return;let c=l[1].toUpperCase(),d=(o=(a=i[c])!==null&&a!==void 0?a:this.timezone[c])!==null&&o!==void 0?o:null;if(d===null)return;e.debug(()=>{console.log(`Extracting timezone: '${c}' into: ${d} for: ${s.start}`)});let p=s.start.get("timezoneOffset");p!==null&&d!=p&&(s.start.isCertain("timezoneOffset")||c!=l[1])||s.start.isOnlyDate()&&c!=l[1]||(s.text+=l[0],s.start.isCertain("timezoneOffset")||s.start.assign("timezoneOffset",d),s.end!=null&&!s.end.isCertain("timezoneOffset")&&s.end.assign("timezoneOffset",d))}),t}};gd.default=hd});var fu=k(bd=>{"use strict";Object.defineProperty(bd,"__esModule",{value:!0});var bS=new RegExp("^\\s*(?:\\(?(?:GMT|UTC)\\s?)?([+-])(\\d{1,2})(?::?(\\d{2}))?\\)?","i"),TS=1,_S=2,vS=3,yd=class{refine(e,t){return t.forEach(function(n){if(n.start.isCertain("timezoneOffset"))return;let i=e.text.substring(n.index+n.text.length),s=bS.exec(i);if(!s)return;e.debug(()=>{console.log(`Extracting timezone: '${s[0]}' into : ${n}`)});let a=parseInt(s[_S]),o=parseInt(s[vS]||"0"),u=a*60+o;u>14*60||(s[TS]==="-"&&(u=-u),n.end!=null&&n.end.assign("timezoneOffset",u),n.start.assign("timezoneOffset",u),n.text+=s[0])}),t}};bd.default=yd});var Pg=k(_d=>{"use strict";Object.defineProperty(_d,"__esModule",{value:!0});var Td=class{refine(e,t){if(t.length<2)return t;let n=[],i=t[0];for(let s=1;si.text.length&&(i=a):(n.push(i),i=a)}return i!=null&&n.push(i),n}};_d.default=Td});var Ng=k(ba=>{"use strict";var wS=ba&&ba.__importDefault||function(r){return r&&r.__esModule?r:{default:r}};Object.defineProperty(ba,"__esModule",{value:!0});var kS=wS(_e()),vd=class{refine(e,t){return e.option.forwardDate&&t.forEach(function(n){let i=kS.default(e.refDate);if(n.start.isOnlyDayMonthComponent()&&i.isAfter(n.start.dayjs()))for(let s=0;s<3&&i.isAfter(n.start.dayjs());s++)n.start.imply("year",n.start.get("year")+1),e.debug(()=>{console.log(`Forward yearly adjusted for ${n} (${n.start})`)}),n.end&&!n.end.isCertain("year")&&(n.end.imply("year",n.end.get("year")+1),e.debug(()=>{console.log(`Forward yearly adjusted for ${n} (${n.end})`)}));n.start.isOnlyWeekdayComponent()&&i.isAfter(n.start.dayjs())&&(i.day()>=n.start.get("weekday")?i=i.day(n.start.get("weekday")+7):i=i.day(n.start.get("weekday")),n.start.imply("day",i.date()),n.start.imply("month",i.month()+1),n.start.imply("year",i.year()),e.debug(()=>{console.log(`Forward weekly adjusted for ${n} (${n.start})`)}),n.end&&n.end.isOnlyWeekdayComponent()&&(i.day()>n.end.get("weekday")?i=i.day(n.end.get("weekday")+7):i=i.day(n.end.get("weekday")),n.end.imply("day",i.date()),n.end.imply("month",i.month()+1),n.end.imply("year",i.year()),e.debug(()=>{console.log(`Forward weekly adjusted for ${n} (${n.end})`)})))}),t}};ba.default=vd});var Ig=k(kd=>{"use strict";Object.defineProperty(kd,"__esModule",{value:!0});var ES=is(),wd=class extends ES.Filter{constructor(e){super(),this.strictMode=e}isValid(e,t){return t.text.replace(" ","").match(/^\d*(\.\d*)?$/)?(e.debug(()=>{console.log(`Removing unlikely result '${t.text}'`)}),!1):t.start.isValidDate()?t.end&&!t.end.isValidDate()?(e.debug(()=>{console.log(`Removing invalid result: ${t} (${t.end})`)}),!1):this.strictMode?this.isStrictModeValid(e,t):!0:(e.debug(()=>{console.log(`Removing invalid result: ${t} (${t.start})`)}),!1)}isStrictModeValid(e,t){return t.start.isOnlyWeekdayComponent()?(e.debug(()=>{console.log(`(Strict) Removing weekday only component: ${t} (${t.end})`)}),!1):t.start.isOnlyTime()&&(!t.start.isCertain("hour")||!t.start.isCertain("minute"))?(e.debug(()=>{console.log(`(Strict) Removing uncertain time component: ${t} (${t.end})`)}),!1):!0}};kd.default=wd});var Od=k(Sd=>{"use strict";Object.defineProperty(Sd,"__esModule",{value:!0});var SS=H(),OS=new RegExp("([0-9]{4})\\-([0-9]{1,2})\\-([0-9]{1,2})(?:T([0-9]{1,2}):([0-9]{1,2})(?::([0-9]{1,2})(?:\\.(\\d{1,4}))?)?(?:Z|([+-]\\d{2}):?(\\d{2})?)?)?(?=\\W|$)","i"),DS=1,xS=2,RS=3,Fg=4,MS=5,Lg=6,Ug=7,Wg=8,qg=9,Ed=class extends SS.AbstractParserWithWordBoundaryChecking{innerPattern(){return OS}innerExtract(e,t){let n={};if(n.year=parseInt(t[DS]),n.month=parseInt(t[xS]),n.day=parseInt(t[RS]),t[Fg]!=null)if(n.hour=parseInt(t[Fg]),n.minute=parseInt(t[MS]),t[Lg]!=null&&(n.second=parseInt(t[Lg])),t[Ug]!=null&&(n.millisecond=parseInt(t[Ug])),t[Wg]==null)n.timezoneOffset=0;else{let i=parseInt(t[Wg]),s=0;t[qg]!=null&&(s=parseInt(t[qg]));let a=i*60;a<0?a-=s:a+=s,n.timezoneOffset=a}return n}};Sd.default=Ed});var jg=k(xd=>{"use strict";Object.defineProperty(xd,"__esModule",{value:!0});var CS=is(),Dd=class extends CS.MergingRefiner{mergeResults(e,t,n){let i=n.clone();return i.index=t.index,i.text=t.text+e+i.text,i.start.assign("weekday",t.start.get("weekday")),i.end&&i.end.assign("weekday",t.start.get("weekday")),i}shouldMergeResults(e,t,n){return t.start.isOnlyWeekdayComponent()&&!t.start.isCertain("hour")&&n.start.isCertain("day")&&e.match(/^,?\s*$/)!=null}};xd.default=Dd});var mn=k(as=>{"use strict";var yi=as&&as.__importDefault||function(r){return r&&r.__esModule?r:{default:r}};Object.defineProperty(as,"__esModule",{value:!0});as.includeCommonConfiguration=void 0;var AS=yi(Ag()),PS=yi(fu()),$g=yi(Pg()),NS=yi(Ng()),IS=yi(Ig()),FS=yi(Od()),LS=yi(jg());function US(r,e=!1){return r.parsers.unshift(new FS.default),r.refiners.unshift(new LS.default),r.refiners.unshift(new AS.default),r.refiners.unshift(new PS.default),r.refiners.unshift(new $g.default),r.refiners.push(new $g.default),r.refiners.push(new NS.default),r.refiners.push(new IS.default(e)),r}as.includeCommonConfiguration=US});var gn=k(Se=>{"use strict";var WS=Se&&Se.__importDefault||function(r){return r&&r.__esModule?r:{default:r}};Object.defineProperty(Se,"__esModule",{value:!0});Se.noon=Se.morning=Se.midnight=Se.yesterdayEvening=Se.evening=Se.lastNight=Se.tonight=Se.theDayAfter=Se.tomorrow=Se.theDayBefore=Se.yesterday=Se.today=Se.now=void 0;var zr=qe(),os=WS(_e()),hn=lr(),Ta=Je();function qS(r){let e=os.default(r.instant),t=new zr.ParsingComponents(r,{});return hn.assignSimilarDate(t,e),hn.assignSimilarTime(t,e),r.timezoneOffset!==null&&t.assign("timezoneOffset",e.utcOffset()),t}Se.now=qS;function jS(r){let e=os.default(r.instant),t=new zr.ParsingComponents(r,{});return hn.assignSimilarDate(t,e),hn.implySimilarTime(t,e),t}Se.today=jS;function $S(r){return Gg(r,1)}Se.yesterday=$S;function Gg(r,e){return Rd(r,-e)}Se.theDayBefore=Gg;function GS(r){return Rd(r,1)}Se.tomorrow=GS;function Rd(r,e){let t=os.default(r.instant),n=new zr.ParsingComponents(r,{});return t=t.add(e,"day"),hn.assignSimilarDate(n,t),hn.implySimilarTime(n,t),n}Se.theDayAfter=Rd;function YS(r,e=22){let t=os.default(r.instant),n=new zr.ParsingComponents(r,{});return n.imply("hour",e),n.imply("meridiem",Ta.Meridiem.PM),hn.assignSimilarDate(n,t),n}Se.tonight=YS;function BS(r,e=0){let t=os.default(r.instant),n=new zr.ParsingComponents(r,{});return t.hour()<6&&(t=t.add(-1,"day")),hn.assignSimilarDate(n,t),n.imply("hour",e),n}Se.lastNight=BS;function HS(r,e=20){let t=new zr.ParsingComponents(r,{});return t.imply("meridiem",Ta.Meridiem.PM),t.imply("hour",e),t}Se.evening=HS;function VS(r,e=20){let t=os.default(r.instant),n=new zr.ParsingComponents(r,{});return t=t.add(-1,"day"),hn.assignSimilarDate(n,t),n.imply("hour",e),n.imply("meridiem",Ta.Meridiem.PM),n}Se.yesterdayEvening=VS;function zS(r){let e=new zr.ParsingComponents(r,{});return e.imply("hour",0),e.imply("minute",0),e.imply("second",0),e}Se.midnight=zS;function KS(r,e=6){let t=new zr.ParsingComponents(r,{});return t.imply("meridiem",Ta.Meridiem.AM),t.imply("hour",e),t}Se.morning=KS;function QS(r){let e=new zr.ParsingComponents(r,{});return e.imply("meridiem",Ta.Meridiem.AM),e.imply("hour",12),e}Se.noon=QS});var Yg=k(Sr=>{"use strict";var XS=Sr&&Sr.__createBinding||(Object.create?function(r,e,t,n){n===void 0&&(n=t),Object.defineProperty(r,n,{enumerable:!0,get:function(){return e[t]}})}:function(r,e,t,n){n===void 0&&(n=t),r[n]=e[t]}),ZS=Sr&&Sr.__setModuleDefault||(Object.create?function(r,e){Object.defineProperty(r,"default",{enumerable:!0,value:e})}:function(r,e){r.default=e}),JS=Sr&&Sr.__importStar||function(r){if(r&&r.__esModule)return r;var e={};if(r!=null)for(var t in r)t!=="default"&&Object.prototype.hasOwnProperty.call(r,t)&&XS(e,r,t);return ZS(e,r),e},eO=Sr&&Sr.__importDefault||function(r){return r&&r.__esModule?r:{default:r}};Object.defineProperty(Sr,"__esModule",{value:!0});var tO=eO(_e()),rO=H(),nO=lr(),_a=JS(gn()),iO=/(now|today|tonight|tomorrow|tmr|tmrw|yesterday|last\s*night)(?=\W|$)/i,Md=class extends rO.AbstractParserWithWordBoundaryChecking{innerPattern(e){return iO}innerExtract(e,t){let n=tO.default(e.refDate),i=t[0].toLowerCase(),s=e.createParsingComponents();switch(i){case"now":return _a.now(e.reference);case"today":return _a.today(e.reference);case"yesterday":return _a.yesterday(e.reference);case"tomorrow":case"tmr":case"tmrw":return _a.tomorrow(e.reference);case"tonight":return _a.tonight(e.reference);default:i.match(/last\s*night/)&&(n.hour()>6&&(n=n.add(-1,"day")),nO.assignSimilarDate(s,n),s.imply("hour",0));break}return s}};Sr.default=Md});var Bg=k(va=>{"use strict";var sO=va&&va.__importDefault||function(r){return r&&r.__esModule?r:{default:r}};Object.defineProperty(va,"__esModule",{value:!0});var pu=Je(),aO=H(),oO=sO(_e()),uO=lr(),lO=/(?:this)?\s{0,3}(morning|afternoon|evening|night|midnight|noon)(?=\W|$)/i,Cd=class extends aO.AbstractParserWithWordBoundaryChecking{innerPattern(){return lO}innerExtract(e,t){let n=oO.default(e.refDate),i=e.createParsingComponents();switch(t[1].toLowerCase()){case"afternoon":i.imply("meridiem",pu.Meridiem.PM),i.imply("hour",15);break;case"evening":case"night":i.imply("meridiem",pu.Meridiem.PM),i.imply("hour",20);break;case"midnight":uO.assignTheNextDay(i,n),i.imply("hour",0),i.imply("minute",0),i.imply("second",0);break;case"morning":i.imply("meridiem",pu.Meridiem.AM),i.imply("hour",6);break;case"noon":i.imply("meridiem",pu.Meridiem.AM),i.imply("hour",12);break}return i}};va.default=Cd});var bi=k(Yn=>{"use strict";var cO=Yn&&Yn.__importDefault||function(r){return r&&r.__esModule?r:{default:r}};Object.defineProperty(Yn,"__esModule",{value:!0});Yn.toDayJSClosestWeekday=Yn.toDayJSWeekday=void 0;var Hg=cO(_e());function dO(r,e,t){if(!t)return Vg(r,e);let n=Hg.default(r);switch(t){case"this":n=n.day(e);break;case"next":n=n.day(e+7);break;case"last":n=n.day(e-7);break}return n}Yn.toDayJSWeekday=dO;function Vg(r,e){let t=Hg.default(r),n=t.day();return Math.abs(e-7-n){"use strict";Object.defineProperty(Pd,"__esModule",{value:!0});var zg=pt(),fO=De(),pO=H(),mO=bi(),hO=new RegExp(`(?:(?:\\,|\\(|\\\uFF08)\\s*)?(?:on\\s*?)?(?:(this|last|past|next)\\s*)?(${fO.matchAnyPattern(zg.WEEKDAY_DICTIONARY)})(?:\\s*(?:\\,|\\)|\\\uFF09))?(?:\\s*(this|last|past|next)\\s*week)?(?=\\W|$)`,"i"),gO=1,yO=2,bO=3,Ad=class extends pO.AbstractParserWithWordBoundaryChecking{innerPattern(){return hO}innerExtract(e,t){let n=t[yO].toLowerCase(),i=zg.WEEKDAY_DICTIONARY[n],s=t[gO],a=t[bO],o=s||a;o=o||"",o=o.toLowerCase();let u=null;o=="last"||o=="past"?u="last":o=="next"?u="next":o=="this"&&(u="this");let l=mO.toDayJSWeekday(e.refDate,i,u);return e.createParsingComponents().assign("weekday",i).imply("day",l.date()).imply("month",l.month()+1).imply("year",l.year())}};Pd.default=Ad});var Zg=k(wa=>{"use strict";var TO=wa&&wa.__importDefault||function(r){return r&&r.__esModule?r:{default:r}};Object.defineProperty(wa,"__esModule",{value:!0});var Xg=pt(),Qg=qe(),_O=TO(_e()),vO=H(),wO=De(),kO=new RegExp(`(this|last|past|next|after\\s*this)\\s*(${wO.matchAnyPattern(Xg.TIME_UNIT_DICTIONARY)})(?=\\s*)(?=\\W|$)`,"i"),EO=1,SO=2,Nd=class extends vO.AbstractParserWithWordBoundaryChecking{innerPattern(){return kO}innerExtract(e,t){let n=t[EO].toLowerCase(),i=t[SO].toLowerCase(),s=Xg.TIME_UNIT_DICTIONARY[i];if(n=="next"||n.startsWith("after")){let u={};return u[s]=1,Qg.ParsingComponents.createRelativeFromReference(e.reference,u)}if(n=="last"||n=="past"){let u={};return u[s]=-1,Qg.ParsingComponents.createRelativeFromReference(e.reference,u)}let a=e.createParsingComponents(),o=_O.default(e.reference.instant);return i.match(/week/i)?(o=o.add(-o.get("d"),"d"),a.imply("day",o.date()),a.imply("month",o.month()+1),a.imply("year",o.year())):i.match(/month/i)?(o=o.add(-o.date()+1,"d"),a.imply("day",o.date()),a.assign("year",o.year()),a.assign("month",o.month()+1)):i.match(/year/i)&&(o=o.add(-o.date()+1,"d"),o=o.add(-o.month(),"month"),a.imply("day",o.date()),a.imply("month",o.month()+1),a.assign("year",o.year())),a}};wa.default=Nd});var Or=k(cs=>{"use strict";Object.defineProperty(cs,"__esModule",{value:!0});cs.ParsingContext=cs.Chrono=void 0;var us=qe(),OO=Id(),ls=class{constructor(e){e=e||OO.createCasualConfiguration(),this.parsers=[...e.parsers],this.refiners=[...e.refiners]}clone(){return new ls({parsers:[...this.parsers],refiners:[...this.refiners]})}parseDate(e,t,n){let i=this.parse(e,t,n);return i.length>0?i[0].start.date():null}parse(e,t,n){let i=new mu(e,t,n),s=[];return this.parsers.forEach(a=>{let o=ls.executeParser(i,a);s=s.concat(o)}),s.sort((a,o)=>a.index-o.index),this.refiners.forEach(function(a){s=a.refine(i,s)}),s}static executeParser(e,t){let n=[],i=t.pattern(e),s=e.text,a=e.text,o=i.exec(a);for(;o;){let u=o.index+s.length-a.length;o.index=u;let l=t.extract(e,o);if(!l){a=s.substring(o.index+1),o=i.exec(a);continue}let c=null;l instanceof us.ParsingResult?c=l:l instanceof us.ParsingComponents?(c=e.createParsingResult(o.index,o[0]),c.start=l):c=e.createParsingResult(o.index,o[0],l),e.debug(()=>console.log(`${t.constructor.name} extracted result ${c}`)),n.push(c),a=s.substring(u+c.text.length),o=i.exec(a)}return n}};cs.Chrono=ls;var mu=class{constructor(e,t,n){this.text=e,this.reference=new us.ReferenceWithTimezone(t),this.option=n!=null?n:{},this.refDate=this.reference.instant}createParsingComponents(e){return e instanceof us.ParsingComponents?e:new us.ParsingComponents(this.reference,e)}createParsingResult(e,t,n,i){let s=typeof t=="string"?t:this.text.substring(e,t),a=n?this.createParsingComponents(n):null,o=i?this.createParsingComponents(i):null;return new us.ParsingResult(this.reference,e,s,a,o)}debug(e){this.option.debug&&(this.option.debug instanceof Function?this.option.debug(e):this.option.debug.debug(e))}};cs.ParsingContext=mu});var Ti=k(Ud=>{"use strict";Object.defineProperty(Ud,"__esModule",{value:!0});var Jg=ft(),DO=new RegExp("([^\\d]|^)([0-3]{0,1}[0-9]{1})[\\/\\.\\-]([0-3]{0,1}[0-9]{1})(?:[\\/\\.\\-]([0-9]{4}|[0-9]{2}))?(\\W|$)","i"),hu=1,ey=5,ty=2,ry=3,Fd=4,Ld=class{constructor(e){this.groupNumberMonth=e?ry:ty,this.groupNumberDay=e?ty:ry}pattern(){return DO}extract(e,t){if(t[hu]=="/"||t[ey]=="/"){t.index+=t[0].length;return}let n=t.index+t[hu].length,i=t[0].substr(t[hu].length,t[0].length-t[hu].length-t[ey].length);if(i.match(/^\d\.\d$/)||i.match(/^\d\.\d{1,2}\.\d{1,2}\s*$/)||!t[Fd]&&t[0].indexOf("/")<0)return;let s=e.createParsingResult(n,i),a=parseInt(t[this.groupNumberMonth]),o=parseInt(t[this.groupNumberDay]);if((a<1||a>12)&&a>12)if(o>=1&&o<=12&&a<=31)[o,a]=[a,o];else return null;if(o<1||o>31)return null;if(s.start.assign("day",o),s.start.assign("month",a),t[Fd]){let u=parseInt(t[Fd]),l=Jg.findMostLikelyADYear(u);s.start.assign("year",l)}else{let u=Jg.findYearClosestToRef(e.refDate,o,a);s.start.imply("year",u)}return s}};Ud.default=Ld});var iy=k(qd=>{"use strict";Object.defineProperty(qd,"__esModule",{value:!0});var ny=pt(),xO=qe(),RO=H(),MO=cr(),CO=new RegExp(`(this|last|past|next|after|\\+|-)\\s*(${ny.TIME_UNITS_PATTERN})(?=\\W|$)`,"i"),Wd=class extends RO.AbstractParserWithWordBoundaryChecking{innerPattern(){return CO}innerExtract(e,t){let n=t[1].toLowerCase(),i=ny.parseTimeUnits(t[2]);switch(n){case"last":case"past":case"-":i=MO.reverseTimeUnits(i);break}return xO.ParsingComponents.createRelativeFromReference(e.reference,i)}};qd.default=Wd});var ay=k(Gd=>{"use strict";Object.defineProperty(Gd,"__esModule",{value:!0});var AO=is(),jd=qe(),PO=pt(),NO=cr();function sy(r){return r.text.match(/\s+(before|from)$/i)!=null}function IO(r){return r.text.match(/\s+(after|since)$/i)!=null}var $d=class extends AO.MergingRefiner{patternBetween(){return/^\s*$/i}shouldMergeResults(e,t,n){return!e.match(this.patternBetween())||!sy(t)&&!IO(t)?!1:!!n.start.get("day")&&!!n.start.get("month")&&!!n.start.get("year")}mergeResults(e,t,n){let i=PO.parseTimeUnits(t.text);sy(t)&&(i=NO.reverseTimeUnits(i));let s=jd.ParsingComponents.createRelativeFromReference(new jd.ReferenceWithTimezone(n.start.date()),i);return new jd.ParsingResult(n.reference,t.index,`${t.text}${e}${n.text}`,s)}};Gd.default=$d});var Id=k(He=>{"use strict";var nt=He&&He.__importDefault||function(r){return r&&r.__esModule?r:{default:r}};Object.defineProperty(He,"__esModule",{value:!0});He.createConfiguration=He.createCasualConfiguration=He.parseDate=He.parse=He.GB=He.strict=He.casual=void 0;var FO=nt(sg()),LO=nt(dg()),UO=nt(gg()),WO=nt(Tg()),qO=nt(wg()),jO=nt(kg()),$O=nt(Sg()),GO=nt(Og()),YO=nt(Dg()),BO=nt(xg()),HO=nt(Cg()),VO=mn(),zO=nt(Yg()),KO=nt(Bg()),QO=nt(Kg()),XO=nt(Zg()),Yd=Or(),ZO=nt(Ti()),JO=nt(iy()),e1=nt(ay());He.casual=new Yd.Chrono(oy(!1));He.strict=new Yd.Chrono(gu(!0,!1));He.GB=new Yd.Chrono(gu(!1,!0));function t1(r,e,t){return He.casual.parse(r,e,t)}He.parse=t1;function r1(r,e,t){return He.casual.parseDate(r,e,t)}He.parseDate=r1;function oy(r=!1){let e=gu(!1,r);return e.parsers.unshift(new zO.default),e.parsers.unshift(new KO.default),e.parsers.unshift(new WO.default),e.parsers.unshift(new XO.default),e.parsers.unshift(new JO.default),e}He.createCasualConfiguration=oy;function gu(r=!0,e=!1){return VO.includeCommonConfiguration({parsers:[new ZO.default(e),new FO.default,new LO.default,new UO.default,new QO.default,new qO.default,new jO.default,new $O.default(r),new GO.default(r),new YO.default(r)],refiners:[new e1.default,new HO.default,new BO.default]},r)}He.createConfiguration=gu});var uy=k(Hd=>{"use strict";Object.defineProperty(Hd,"__esModule",{value:!0});var n1=gi(),Bd=class extends n1.AbstractTimeExpressionParser{primaryPrefix(){return"(?:(?:um|von)\\s*)?"}followingPhase(){return"\\s*(?:\\-|\\\u2013|\\~|\\\u301C|bis)\\s*"}extractPrimaryTimeComponents(e,t){return t[0].match(/^\s*\d{4}\s*$/)?null:super.extractPrimaryTimeComponents(e,t)}};Hd.default=Bd});var ka=k(Me=>{"use strict";Object.defineProperty(Me,"__esModule",{value:!0});Me.parseTimeUnits=Me.TIME_UNITS_PATTERN=Me.parseYear=Me.YEAR_PATTERN=Me.parseNumberPattern=Me.NUMBER_PATTERN=Me.TIME_UNIT_DICTIONARY=Me.INTEGER_WORD_DICTIONARY=Me.MONTH_DICTIONARY=Me.WEEKDAY_DICTIONARY=void 0;var Vd=De(),i1=ft();Me.WEEKDAY_DICTIONARY={sonntag:0,so:0,montag:1,mo:1,dienstag:2,di:2,mittwoch:3,mi:3,donnerstag:4,do:4,freitag:5,fr:5,samstag:6,sa:6};Me.MONTH_DICTIONARY={januar:1,j\u00E4nner:1,janner:1,jan:1,"jan.":1,februar:2,feber:2,feb:2,"feb.":2,m\u00E4rz:3,maerz:3,m\u00E4r:3,"m\xE4r.":3,mrz:3,"mrz.":3,april:4,apr:4,"apr.":4,mai:5,juni:6,jun:6,"jun.":6,juli:7,jul:7,"jul.":7,august:8,aug:8,"aug.":8,september:9,sep:9,"sep.":9,sept:9,"sept.":9,oktober:10,okt:10,"okt.":10,november:11,nov:11,"nov.":11,dezember:12,dez:12,"dez.":12};Me.INTEGER_WORD_DICTIONARY={eins:1,eine:1,einem:1,einen:1,einer:1,zwei:2,drei:3,vier:4,f\u00FCnf:5,fuenf:5,sechs:6,sieben:7,acht:8,neun:9,zehn:10,elf:11,zw\u00F6lf:12,zwoelf:12};Me.TIME_UNIT_DICTIONARY={sek:"second",sekunde:"second",sekunden:"second",min:"minute",minute:"minute",minuten:"minute",h:"hour",std:"hour",stunde:"hour",stunden:"hour",tag:"d",tage:"d",tagen:"d",woche:"week",wochen:"week",monat:"month",monate:"month",monaten:"month",monats:"month",quartal:"quarter",quartals:"quarter",quartale:"quarter",quartalen:"quarter",a:"year",j:"year",jr:"year",jahr:"year",jahre:"year",jahren:"year",jahres:"year"};Me.NUMBER_PATTERN=`(?:${Vd.matchAnyPattern(Me.INTEGER_WORD_DICTIONARY)}|[0-9]+|[0-9]+\\.[0-9]+|half(?:\\s*an?)?|an?\\b(?:\\s*few)?|few|several|a?\\s*couple\\s*(?:of)?)`;function cy(r){let e=r.toLowerCase();return Me.INTEGER_WORD_DICTIONARY[e]!==void 0?Me.INTEGER_WORD_DICTIONARY[e]:e==="a"||e==="an"?1:e.match(/few/)?3:e.match(/half/)?.5:e.match(/couple/)?2:e.match(/several/)?7:parseFloat(e)}Me.parseNumberPattern=cy;Me.YEAR_PATTERN="(?:[0-9]{1,4}(?:\\s*[vn]\\.?\\s*(?:C(?:hr)?|(?:u\\.?|d\\.?(?:\\s*g\\.?)?)?\\s*Z)\\.?|\\s*(?:u\\.?|d\\.?(?:\\s*g\\.)?)\\s*Z\\.?)?)";function s1(r){if(/v/i.test(r))return-parseInt(r.replace(/[^0-9]+/gi,""));if(/n/i.test(r))return parseInt(r.replace(/[^0-9]+/gi,""));if(/z/i.test(r))return parseInt(r.replace(/[^0-9]+/gi,""));let e=parseInt(r);return i1.findMostLikelyADYear(e)}Me.parseYear=s1;var dy=`(${Me.NUMBER_PATTERN})\\s{0,5}(${Vd.matchAnyPattern(Me.TIME_UNIT_DICTIONARY)})\\s{0,5}`,ly=new RegExp(dy,"i");Me.TIME_UNITS_PATTERN=Vd.repeatedTimeunitPattern("",dy);function a1(r){let e={},t=r,n=ly.exec(t);for(;n;)o1(e,n),t=t.substring(n[0].length),n=ly.exec(t);return e}Me.parseTimeUnits=a1;function o1(r,e){let t=cy(e[1]),n=Me.TIME_UNIT_DICTIONARY[e[2].toLowerCase()];r[n]=t}});var py=k(Kd=>{"use strict";Object.defineProperty(Kd,"__esModule",{value:!0});var fy=ka(),u1=De(),l1=H(),c1=bi(),d1=new RegExp(`(?:(?:\\,|\\(|\\\uFF08)\\s*)?(?:a[mn]\\s*?)?(?:(diese[mn]|letzte[mn]|n(?:\xE4|ae)chste[mn])\\s*)?(${u1.matchAnyPattern(fy.WEEKDAY_DICTIONARY)})(?:\\s*(?:\\,|\\)|\\\uFF09))?(?:\\s*(diese|letzte|n(?:\xE4|ae)chste)\\s*woche)?(?=\\W|$)`,"i"),f1=1,p1=3,m1=2,zd=class extends l1.AbstractParserWithWordBoundaryChecking{innerPattern(){return d1}innerExtract(e,t){let n=t[m1].toLowerCase(),i=fy.WEEKDAY_DICTIONARY[n],s=t[f1],a=t[p1],o=s||a;o=o||"",o=o.toLowerCase();let u=null;o.match(/letzte/)?u="last":o.match(/chste/)?u="next":o.match(/diese/)&&(u="this");let l=c1.toDayJSWeekday(e.refDate,i,u);return e.createParsingComponents().assign("weekday",i).imply("day",l.date()).imply("month",l.month()+1).imply("year",l.year())}};Kd.default=zd});var yy=k(Qd=>{"use strict";Object.defineProperty(Qd,"__esModule",{value:!0});var Bn=Je(),h1=new RegExp("(^|\\s|T)(?:(?:um|von)\\s*)?(\\d{1,2})(?:h|:)?(?:(\\d{1,2})(?:m|:)?)?(?:(\\d{1,2})(?:s)?)?(?:\\s*Uhr)?(?:\\s*(morgens|vormittags|nachmittags|abends|nachts|am\\s+(?:Morgen|Vormittag|Nachmittag|Abend)|in\\s+der\\s+Nacht))?(?=\\W|$)","i"),g1=new RegExp("^\\s*(\\-|\\\u2013|\\~|\\\u301C|bis(?:\\s+um)?|\\?)\\s*(\\d{1,2})(?:h|:)?(?:(\\d{1,2})(?:m|:)?)?(?:(\\d{1,2})(?:s)?)?(?:\\s*Uhr)?(?:\\s*(morgens|vormittags|nachmittags|abends|nachts|am\\s+(?:Morgen|Vormittag|Nachmittag|Abend)|in\\s+der\\s+Nacht))?(?=\\W|$)","i"),y1=2,my=3,hy=4,gy=5,ds=class{pattern(e){return h1}extract(e,t){let n=e.createParsingResult(t.index+t[1].length,t[0].substring(t[1].length));if(n.text.match(/^\d{4}$/)||(n.start=ds.extractTimeComponent(n.start.clone(),t),!n.start))return t.index+=t[0].length,null;let i=e.text.substring(t.index+t[0].length),s=g1.exec(i);return s&&(n.end=ds.extractTimeComponent(n.start.clone(),s),n.end&&(n.text+=s[0])),n}static extractTimeComponent(e,t){let n=0,i=0,s=null;if(n=parseInt(t[y1]),t[my]!=null&&(i=parseInt(t[my])),i>=60||n>24)return null;if(n>=12&&(s=Bn.Meridiem.PM),t[gy]!=null){if(n>12)return null;let a=t[gy].toLowerCase();a.match(/morgen|vormittag/)&&(s=Bn.Meridiem.AM,n==12&&(n=0)),a.match(/nachmittag|abend/)&&(s=Bn.Meridiem.PM,n!=12&&(n+=12)),a.match(/nacht/)&&(n==12?(s=Bn.Meridiem.AM,n=0):n<6?s=Bn.Meridiem.AM:(s=Bn.Meridiem.PM,n+=12))}if(e.assign("hour",n),e.assign("minute",i),s!==null?e.assign("meridiem",s):n<12?e.imply("meridiem",Bn.Meridiem.AM):e.imply("meridiem",Bn.Meridiem.PM),t[hy]!=null){let a=parseInt(t[hy]);if(a>=60)return null;e.assign("second",a)}return e}};Qd.default=ds});var by=k(Ea=>{"use strict";var b1=Ea&&Ea.__importDefault||function(r){return r&&r.__esModule?r:{default:r}};Object.defineProperty(Ea,"__esModule",{value:!0});var T1=b1(Vr()),Xd=class extends T1.default{patternBetween(){return/^\s*(bis(?:\s*(?:am|zum))?|-)\s*$/i}};Ea.default=Xd});var Ty=k(Sa=>{"use strict";var _1=Sa&&Sa.__importDefault||function(r){return r&&r.__esModule?r:{default:r}};Object.defineProperty(Sa,"__esModule",{value:!0});var v1=_1(pn()),Zd=class extends v1.default{patternBetween(){return new RegExp("^\\s*(T|um|am|,|-)?\\s*$")}};Sa.default=Zd});var Jd=k(Da=>{"use strict";var w1=Da&&Da.__importDefault||function(r){return r&&r.__esModule?r:{default:r}};Object.defineProperty(Da,"__esModule",{value:!0});var k1=w1(_e()),_i=Je(),E1=H(),S1=lr(),O1=cr(),Oa=class extends E1.AbstractParserWithWordBoundaryChecking{innerPattern(e){return/(diesen)?\s*(morgen|vormittag|mittags?|nachmittag|abend|nacht|mitternacht)(?=\W|$)/i}innerExtract(e,t){let n=k1.default(e.refDate),i=t[2].toLowerCase(),s=e.createParsingComponents();return S1.implySimilarTime(s,n),Oa.extractTimeComponents(s,i)}static extractTimeComponents(e,t){switch(t){case"morgen":e.imply("hour",6),e.imply("minute",0),e.imply("second",0),e.imply("meridiem",_i.Meridiem.AM);break;case"vormittag":e.imply("hour",9),e.imply("minute",0),e.imply("second",0),e.imply("meridiem",_i.Meridiem.AM);break;case"mittag":case"mittags":e.imply("hour",12),e.imply("minute",0),e.imply("second",0),e.imply("meridiem",_i.Meridiem.AM);break;case"nachmittag":e.imply("hour",15),e.imply("minute",0),e.imply("second",0),e.imply("meridiem",_i.Meridiem.PM);break;case"abend":e.imply("hour",18),e.imply("minute",0),e.imply("second",0),e.imply("meridiem",_i.Meridiem.PM);break;case"nacht":e.imply("hour",22),e.imply("minute",0),e.imply("second",0),e.imply("meridiem",_i.Meridiem.PM);break;case"mitternacht":e.get("hour")>1&&(e=O1.addImpliedTimeUnits(e,{day:1})),e.imply("hour",0),e.imply("minute",0),e.imply("second",0),e.imply("meridiem",_i.Meridiem.AM);break}return e}};Da.default=Oa});var wy=k(Dr=>{"use strict";var D1=Dr&&Dr.__createBinding||(Object.create?function(r,e,t,n){n===void 0&&(n=t),Object.defineProperty(r,n,{enumerable:!0,get:function(){return e[t]}})}:function(r,e,t,n){n===void 0&&(n=t),r[n]=e[t]}),x1=Dr&&Dr.__setModuleDefault||(Object.create?function(r,e){Object.defineProperty(r,"default",{enumerable:!0,value:e})}:function(r,e){r.default=e}),R1=Dr&&Dr.__importStar||function(r){if(r&&r.__esModule)return r;var e={};if(r!=null)for(var t in r)t!=="default"&&Object.prototype.hasOwnProperty.call(r,t)&&D1(e,r,t);return x1(e,r),e},vy=Dr&&Dr.__importDefault||function(r){return r&&r.__esModule?r:{default:r}};Object.defineProperty(Dr,"__esModule",{value:!0});var M1=vy(_e()),C1=H(),vi=lr(),A1=vy(Jd()),_y=R1(gn()),P1=new RegExp("(jetzt|heute|morgen|\xFCbermorgen|uebermorgen|gestern|vorgestern|letzte\\s*nacht)(?:\\s*(morgen|vormittag|mittags?|nachmittag|abend|nacht|mitternacht))?(?=\\W|$)","i"),N1=1,I1=2,ef=class extends C1.AbstractParserWithWordBoundaryChecking{innerPattern(e){return P1}innerExtract(e,t){let n=M1.default(e.refDate),i=(t[N1]||"").toLowerCase(),s=(t[I1]||"").toLowerCase(),a=e.createParsingComponents();switch(i){case"jetzt":a=_y.now(e.reference);break;case"heute":a=_y.today(e.reference);break;case"morgen":vi.assignTheNextDay(a,n);break;case"\xFCbermorgen":case"uebermorgen":n=n.add(1,"day"),vi.assignTheNextDay(a,n);break;case"gestern":n=n.add(-1,"day"),vi.assignSimilarDate(a,n),vi.implySimilarTime(a,n);break;case"vorgestern":n=n.add(-2,"day"),vi.assignSimilarDate(a,n),vi.implySimilarTime(a,n);break;default:i.match(/letzte\s*nacht/)&&(n.hour()>6&&(n=n.add(-1,"day")),vi.assignSimilarDate(a,n),a.imply("hour",0));break}return s&&(a=A1.default.extractTimeComponents(a,s)),a}};Dr.default=ef});var xy=k(rf=>{"use strict";Object.defineProperty(rf,"__esModule",{value:!0});var F1=ft(),Oy=ka(),Dy=ka(),L1=De(),U1=H(),W1=new RegExp(`(?:am\\s*?)?(?:den\\s*?)?([0-9]{1,2})\\.(?:\\s*(?:bis(?:\\s*(?:am|zum))?|\\-|\\\u2013|\\s)\\s*([0-9]{1,2})\\.?)?\\s*(${L1.matchAnyPattern(Oy.MONTH_DICTIONARY)})(?:(?:-|/|,?\\s*)(${Dy.YEAR_PATTERN}(?![^\\s]\\d)))?(?=\\W|$)`,"i"),ky=1,Ey=2,q1=3,Sy=4,tf=class extends U1.AbstractParserWithWordBoundaryChecking{innerPattern(){return W1}innerExtract(e,t){let n=e.createParsingResult(t.index,t[0]),i=Oy.MONTH_DICTIONARY[t[q1].toLowerCase()],s=parseInt(t[ky]);if(s>31)return t.index=t.index+t[ky].length,null;if(n.start.assign("month",i),n.start.assign("day",s),t[Sy]){let a=Dy.parseYear(t[Sy]);n.start.assign("year",a)}else{let a=F1.findYearClosestToRef(e.refDate,s,i);n.start.imply("year",a)}if(t[Ey]){let a=parseInt(t[Ey]);n.end=n.start.clone(),n.end.assign("day",a)}return n}};rf.default=tf});var Ry=k(sf=>{"use strict";Object.defineProperty(sf,"__esModule",{value:!0});var yu=ka(),j1=qe(),$1=H(),G1=cr(),Y1=De(),nf=class extends $1.AbstractParserWithWordBoundaryChecking{constructor(){super()}innerPattern(){return new RegExp(`(?:\\s*((?:n\xE4chste|kommende|folgende|letzte|vergangene|vorige|vor(?:her|an)gegangene)(?:s|n|m|r)?|vor|in)\\s*)?(${yu.NUMBER_PATTERN})?(?:\\s*(n\xE4chste|kommende|folgende|letzte|vergangene|vorige|vor(?:her|an)gegangene)(?:s|n|m|r)?)?\\s*(${Y1.matchAnyPattern(yu.TIME_UNIT_DICTIONARY)})`,"i")}innerExtract(e,t){let n=t[2]?yu.parseNumberPattern(t[2]):1,i=yu.TIME_UNIT_DICTIONARY[t[4].toLowerCase()],s={};s[i]=n;let a=t[1]||t[3]||"";if(a=a.toLowerCase(),!!a)return(/vor/.test(a)||/letzte/.test(a)||/vergangen/.test(a))&&(s=G1.reverseTimeUnits(s)),j1.ParsingComponents.createRelativeFromReference(e.reference,s)}};sf.default=nf});var Ay=k(it=>{"use strict";var xr=it&&it.__importDefault||function(r){return r&&r.__esModule?r:{default:r}};Object.defineProperty(it,"__esModule",{value:!0});it.createConfiguration=it.createCasualConfiguration=it.parseDate=it.parse=it.strict=it.casual=void 0;var B1=mn(),My=Or(),H1=xr(Ti()),V1=xr(Od()),z1=xr(uy()),K1=xr(py()),Q1=xr(yy()),X1=xr(by()),Z1=xr(Ty()),J1=xr(wy()),e0=xr(Jd()),t0=xr(xy()),r0=xr(Ry());it.casual=new My.Chrono(Cy());it.strict=new My.Chrono(af(!0));function n0(r,e,t){return it.casual.parse(r,e,t)}it.parse=n0;function i0(r,e,t){return it.casual.parseDate(r,e,t)}it.parseDate=i0;function Cy(r=!0){let e=af(!1,r);return e.parsers.unshift(new e0.default),e.parsers.unshift(new J1.default),e.parsers.unshift(new r0.default),e}it.createCasualConfiguration=Cy;function af(r=!0,e=!0){return B1.includeCommonConfiguration({parsers:[new V1.default,new H1.default(e),new z1.default,new Q1.default,new t0.default,new K1.default],refiners:[new X1.default,new Z1.default]},r)}it.createConfiguration=af});var Ny=k(Rr=>{"use strict";var s0=Rr&&Rr.__createBinding||(Object.create?function(r,e,t,n){n===void 0&&(n=t),Object.defineProperty(r,n,{enumerable:!0,get:function(){return e[t]}})}:function(r,e,t,n){n===void 0&&(n=t),r[n]=e[t]}),a0=Rr&&Rr.__setModuleDefault||(Object.create?function(r,e){Object.defineProperty(r,"default",{enumerable:!0,value:e})}:function(r,e){r.default=e}),o0=Rr&&Rr.__importStar||function(r){if(r&&r.__esModule)return r;var e={};if(r!=null)for(var t in r)t!=="default"&&Object.prototype.hasOwnProperty.call(r,t)&&s0(e,r,t);return a0(e,r),e},u0=Rr&&Rr.__importDefault||function(r){return r&&r.__esModule?r:{default:r}};Object.defineProperty(Rr,"__esModule",{value:!0});var l0=u0(_e()),c0=Je(),d0=H(),Py=lr(),bu=o0(gn()),of=class extends d0.AbstractParserWithWordBoundaryChecking{innerPattern(e){return/(maintenant|aujourd'hui|demain|hier|cette\s*nuit|la\s*veille)(?=\W|$)/i}innerExtract(e,t){let n=l0.default(e.refDate),i=t[0].toLowerCase(),s=e.createParsingComponents();switch(i){case"maintenant":return bu.now(e.reference);case"aujourd'hui":return bu.today(e.reference);case"hier":return bu.yesterday(e.reference);case"demain":return bu.tomorrow(e.reference);default:i.match(/cette\s*nuit/)?(Py.assignSimilarDate(s,n),s.imply("hour",22),s.imply("meridiem",c0.Meridiem.PM)):i.match(/la\s*veille/)&&(n=n.add(-1,"day"),Py.assignSimilarDate(s,n),s.imply("hour",0))}return s}};Rr.default=of});var Iy=k(lf=>{"use strict";Object.defineProperty(lf,"__esModule",{value:!0});var xa=Je(),f0=H(),uf=class extends f0.AbstractParserWithWordBoundaryChecking{innerPattern(e){return/(cet?)?\s*(matin|soir|après-midi|aprem|a midi|à minuit)(?=\W|$)/i}innerExtract(e,t){let n=t[2].toLowerCase(),i=e.createParsingComponents();switch(n){case"apr\xE8s-midi":case"aprem":i.imply("hour",14),i.imply("minute",0),i.imply("meridiem",xa.Meridiem.PM);break;case"soir":i.imply("hour",18),i.imply("minute",0),i.imply("meridiem",xa.Meridiem.PM);break;case"matin":i.imply("hour",8),i.imply("minute",0),i.imply("meridiem",xa.Meridiem.AM);break;case"a midi":i.imply("hour",12),i.imply("minute",0),i.imply("meridiem",xa.Meridiem.AM);break;case"\xE0 minuit":i.imply("hour",0),i.imply("meridiem",xa.Meridiem.AM);break}return i}};lf.default=uf});var Fy=k(df=>{"use strict";Object.defineProperty(df,"__esModule",{value:!0});var p0=gi(),cf=class extends p0.AbstractTimeExpressionParser{primaryPrefix(){return"(?:(?:[\xE0a])\\s*)?"}followingPhase(){return"\\s*(?:\\-|\\\u2013|\\~|\\\u301C|[\xE0a]|\\?)\\s*"}extractPrimaryTimeComponents(e,t){return t[0].match(/^\s*\d{4}\s*$/)?null:super.extractPrimaryTimeComponents(e,t)}};df.default=cf});var Ly=k(Ra=>{"use strict";var m0=Ra&&Ra.__importDefault||function(r){return r&&r.__esModule?r:{default:r}};Object.defineProperty(Ra,"__esModule",{value:!0});var h0=m0(pn()),ff=class extends h0.default{patternBetween(){return new RegExp("^\\s*(T|\xE0|a|vers|de|,|-)?\\s*$")}};Ra.default=ff});var Uy=k(Ma=>{"use strict";var g0=Ma&&Ma.__importDefault||function(r){return r&&r.__esModule?r:{default:r}};Object.defineProperty(Ma,"__esModule",{value:!0});var y0=g0(Vr()),pf=class extends y0.default{patternBetween(){return/^\s*(à|a|-)\s*$/i}};Ma.default=pf});var Hn=k(ve=>{"use strict";Object.defineProperty(ve,"__esModule",{value:!0});ve.parseTimeUnits=ve.TIME_UNITS_PATTERN=ve.parseYear=ve.YEAR_PATTERN=ve.parseOrdinalNumberPattern=ve.ORDINAL_NUMBER_PATTERN=ve.parseNumberPattern=ve.NUMBER_PATTERN=ve.TIME_UNIT_DICTIONARY=ve.INTEGER_WORD_DICTIONARY=ve.MONTH_DICTIONARY=ve.WEEKDAY_DICTIONARY=void 0;var mf=De();ve.WEEKDAY_DICTIONARY={dimanche:0,dim:0,lundi:1,lun:1,mardi:2,mar:2,mercredi:3,mer:3,jeudi:4,jeu:4,vendredi:5,ven:5,samedi:6,sam:6};ve.MONTH_DICTIONARY={janvier:1,jan:1,"jan.":1,f\u00E9vrier:2,f\u00E9v:2,"f\xE9v.":2,fevrier:2,fev:2,"fev.":2,mars:3,mar:3,"mar.":3,avril:4,avr:4,"avr.":4,mai:5,juin:6,jun:6,juillet:7,juil:7,jul:7,"jul.":7,ao\u00FBt:8,aout:8,septembre:9,sep:9,"sep.":9,sept:9,"sept.":9,octobre:10,oct:10,"oct.":10,novembre:11,nov:11,"nov.":11,d\u00E9cembre:12,decembre:12,dec:12,"dec.":12};ve.INTEGER_WORD_DICTIONARY={un:1,deux:2,trois:3,quatre:4,cinq:5,six:6,sept:7,huit:8,neuf:9,dix:10,onze:11,douze:12,treize:13};ve.TIME_UNIT_DICTIONARY={sec:"second",seconde:"second",secondes:"second",min:"minute",mins:"minute",minute:"minute",minutes:"minute",h:"hour",hr:"hour",hrs:"hour",heure:"hour",heures:"hour",jour:"d",jours:"d",semaine:"week",semaines:"week",mois:"month",trimestre:"quarter",trimestres:"quarter",ans:"year",ann\u00E9e:"year",ann\u00E9es:"year"};ve.NUMBER_PATTERN=`(?:${mf.matchAnyPattern(ve.INTEGER_WORD_DICTIONARY)}|[0-9]+|[0-9]+\\.[0-9]+|une?\\b|quelques?|demi-?)`;function qy(r){let e=r.toLowerCase();return ve.INTEGER_WORD_DICTIONARY[e]!==void 0?ve.INTEGER_WORD_DICTIONARY[e]:e==="une"||e==="un"?1:e.match(/quelques?/)?3:e.match(/demi-?/)?.5:parseFloat(e)}ve.parseNumberPattern=qy;ve.ORDINAL_NUMBER_PATTERN="(?:[0-9]{1,2}(?:er)?)";function b0(r){let e=r.toLowerCase();return e=e.replace(/(?:er)$/i,""),parseInt(e)}ve.parseOrdinalNumberPattern=b0;ve.YEAR_PATTERN="(?:[1-9][0-9]{0,3}\\s*(?:AC|AD|p\\.\\s*C(?:hr?)?\\.\\s*n\\.)|[1-2][0-9]{3}|[5-9][0-9])";function T0(r){if(/AC/i.test(r))return r=r.replace(/BC/i,""),-parseInt(r);if(/AD/i.test(r)||/C/i.test(r))return r=r.replace(/[^\d]+/i,""),parseInt(r);let e=parseInt(r);return e<100&&(e>50?e=e+1900:e=e+2e3),e}ve.parseYear=T0;var jy=`(${ve.NUMBER_PATTERN})\\s{0,5}(${mf.matchAnyPattern(ve.TIME_UNIT_DICTIONARY)})\\s{0,5}`,Wy=new RegExp(jy,"i");ve.TIME_UNITS_PATTERN=mf.repeatedTimeunitPattern("",jy);function _0(r){let e={},t=r,n=Wy.exec(t);for(;n;)v0(e,n),t=t.substring(n[0].length),n=Wy.exec(t);return e}ve.parseTimeUnits=_0;function v0(r,e){let t=qy(e[1]),n=ve.TIME_UNIT_DICTIONARY[e[2].toLowerCase()];r[n]=t}});var Gy=k(gf=>{"use strict";Object.defineProperty(gf,"__esModule",{value:!0});var $y=Hn(),w0=De(),k0=H(),E0=bi(),S0=new RegExp(`(?:(?:\\,|\\(|\\\uFF08)\\s*)?(?:(?:ce)\\s*)?(${w0.matchAnyPattern($y.WEEKDAY_DICTIONARY)})(?:\\s*(?:\\,|\\)|\\\uFF09))?(?:\\s*(dernier|prochain)\\s*)?(?=\\W|\\d|$)`,"i"),O0=1,D0=2,hf=class extends k0.AbstractParserWithWordBoundaryChecking{innerPattern(){return S0}innerExtract(e,t){let n=t[O0].toLowerCase(),i=$y.WEEKDAY_DICTIONARY[n];if(i===void 0)return null;let s=t[D0];s=s||"",s=s.toLowerCase();let a=null;s=="dernier"?a="last":s=="prochain"&&(a="next");let o=E0.toDayJSWeekday(e.refDate,i,a);return e.createParsingComponents().assign("weekday",i).imply("day",o.date()).imply("month",o.month()+1).imply("year",o.year())}};gf.default=hf});var Vy=k(yf=>{"use strict";Object.defineProperty(yf,"__esModule",{value:!0});var Ca=Je(),x0=new RegExp("(^|\\s|T)(?:(?:[\xE0a])\\s*)?(\\d{1,2})(?:h|:)?(?:(\\d{1,2})(?:m|:)?)?(?:(\\d{1,2})(?:s|:)?)?(?:\\s*(A\\.M\\.|P\\.M\\.|AM?|PM?))?(?=\\W|$)","i"),R0=new RegExp("^\\s*(\\-|\\\u2013|\\~|\\\u301C|[\xE0a]|\\?)\\s*(\\d{1,2})(?:h|:)?(?:(\\d{1,2})(?:m|:)?)?(?:(\\d{1,2})(?:s|:)?)?(?:\\s*(A\\.M\\.|P\\.M\\.|AM?|PM?))?(?=\\W|$)","i"),M0=2,Yy=3,By=4,Hy=5,fs=class{pattern(e){return x0}extract(e,t){let n=e.createParsingResult(t.index+t[1].length,t[0].substring(t[1].length));if(n.text.match(/^\d{4}$/)||(n.start=fs.extractTimeComponent(n.start.clone(),t),!n.start))return t.index+=t[0].length,null;let i=e.text.substring(t.index+t[0].length),s=R0.exec(i);return s&&(n.end=fs.extractTimeComponent(n.start.clone(),s),n.end&&(n.text+=s[0])),n}static extractTimeComponent(e,t){let n=0,i=0,s=null;if(n=parseInt(t[M0]),t[Yy]!=null&&(i=parseInt(t[Yy])),i>=60||n>24)return null;if(n>=12&&(s=Ca.Meridiem.PM),t[Hy]!=null){if(n>12)return null;let a=t[Hy][0].toLowerCase();a=="a"&&(s=Ca.Meridiem.AM,n==12&&(n=0)),a=="p"&&(s=Ca.Meridiem.PM,n!=12&&(n+=12))}if(e.assign("hour",n),e.assign("minute",i),s!==null?e.assign("meridiem",s):n<12?e.imply("meridiem",Ca.Meridiem.AM):e.imply("meridiem",Ca.Meridiem.PM),t[By]!=null){let a=parseInt(t[By]);if(a>=60)return null;e.assign("second",a)}return e}};yf.default=fs});var Jy=k(Tf=>{"use strict";Object.defineProperty(Tf,"__esModule",{value:!0});var C0=ft(),Xy=Hn(),Zy=Hn(),Tu=Hn(),A0=De(),P0=H(),N0=new RegExp(`(?:on\\s*?)?(${Tu.ORDINAL_NUMBER_PATTERN})(?:\\s*(?:au|\\-|\\\u2013|jusqu'au?|\\s)\\s*(${Tu.ORDINAL_NUMBER_PATTERN}))?(?:-|/|\\s*(?:de)?\\s*)(${A0.matchAnyPattern(Xy.MONTH_DICTIONARY)})(?:(?:-|/|,?\\s*)(${Zy.YEAR_PATTERN}(?![^\\s]\\d)))?(?=\\W|$)`,"i"),zy=1,Ky=2,I0=3,Qy=4,bf=class extends P0.AbstractParserWithWordBoundaryChecking{innerPattern(){return N0}innerExtract(e,t){let n=e.createParsingResult(t.index,t[0]),i=Xy.MONTH_DICTIONARY[t[I0].toLowerCase()],s=Tu.parseOrdinalNumberPattern(t[zy]);if(s>31)return t.index=t.index+t[zy].length,null;if(n.start.assign("month",i),n.start.assign("day",s),t[Qy]){let a=Zy.parseYear(t[Qy]);n.start.assign("year",a)}else{let a=C0.findYearClosestToRef(e.refDate,s,i);n.start.imply("year",a)}if(t[Ky]){let a=Tu.parseOrdinalNumberPattern(t[Ky]);n.end=n.start.clone(),n.end.assign("day",a)}return n}};Tf.default=bf});var tb=k(vf=>{"use strict";Object.defineProperty(vf,"__esModule",{value:!0});var eb=Hn(),F0=qe(),L0=H(),U0=cr(),_f=class extends L0.AbstractParserWithWordBoundaryChecking{constructor(){super()}innerPattern(){return new RegExp(`il y a\\s*(${eb.TIME_UNITS_PATTERN})(?=(?:\\W|$))`,"i")}innerExtract(e,t){let n=eb.parseTimeUnits(t[1]),i=U0.reverseTimeUnits(n);return F0.ParsingComponents.createRelativeFromReference(e.reference,i)}};vf.default=_f});var nb=k(kf=>{"use strict";Object.defineProperty(kf,"__esModule",{value:!0});var rb=Hn(),W0=qe(),q0=H(),wf=class extends q0.AbstractParserWithWordBoundaryChecking{innerPattern(){return new RegExp(`(?:dans|en|pour|pendant|de)\\s*(${rb.TIME_UNITS_PATTERN})(?=\\W|$)`,"i")}innerExtract(e,t){let n=rb.parseTimeUnits(t[1]);return W0.ParsingComponents.createRelativeFromReference(e.reference,n)}};kf.default=wf});var ib=k(Sf=>{"use strict";Object.defineProperty(Sf,"__esModule",{value:!0});var _u=Hn(),j0=qe(),$0=H(),G0=cr(),Y0=De(),Ef=class extends $0.AbstractParserWithWordBoundaryChecking{constructor(){super()}innerPattern(){return new RegExp(`(?:les?|la|l'|du|des?)\\s*(${_u.NUMBER_PATTERN})?(?:\\s*(prochaine?s?|derni[e\xE8]re?s?|pass[\xE9e]e?s?|pr[\xE9e]c[\xE9e]dents?|suivante?s?))?\\s*(${Y0.matchAnyPattern(_u.TIME_UNIT_DICTIONARY)})(?:\\s*(prochaine?s?|derni[e\xE8]re?s?|pass[\xE9e]e?s?|pr[\xE9e]c[\xE9e]dents?|suivante?s?))?`,"i")}innerExtract(e,t){let n=t[1]?_u.parseNumberPattern(t[1]):1,i=_u.TIME_UNIT_DICTIONARY[t[3].toLowerCase()],s={};s[i]=n;let a=t[2]||t[4]||"";if(a=a.toLowerCase(),!!a)return(/derni[eè]re?s?/.test(a)||/pass[ée]e?s?/.test(a)||/pr[ée]c[ée]dents?/.test(a))&&(s=G0.reverseTimeUnits(s)),j0.ParsingComponents.createRelativeFromReference(e.reference,s)}};Sf.default=Ef});var ob=k(st=>{"use strict";var dr=st&&st.__importDefault||function(r){return r&&r.__esModule?r:{default:r}};Object.defineProperty(st,"__esModule",{value:!0});st.createConfiguration=st.createCasualConfiguration=st.parseDate=st.parse=st.strict=st.casual=void 0;var B0=mn(),sb=Or(),H0=dr(Ny()),V0=dr(Iy()),z0=dr(Ti()),K0=dr(Fy()),Q0=dr(Ly()),X0=dr(Uy()),Z0=dr(Gy()),J0=dr(Vy()),eD=dr(Jy()),tD=dr(tb()),rD=dr(nb()),nD=dr(ib());st.casual=new sb.Chrono(ab());st.strict=new sb.Chrono(Of(!0));function iD(r,e,t){return st.casual.parse(r,e,t)}st.parse=iD;function sD(r,e,t){return st.casual.parseDate(r,e,t)}st.parseDate=sD;function ab(r=!0){let e=Of(!1,r);return e.parsers.unshift(new H0.default),e.parsers.unshift(new V0.default),e.parsers.unshift(new nD.default),e}st.createCasualConfiguration=ab;function Of(r=!0,e=!0){return B0.includeCommonConfiguration({parsers:[new z0.default(e),new eD.default,new K0.default,new J0.default,new tD.default,new rD.default,new Z0.default],refiners:[new Q0.default,new X0.default]},r)}st.createConfiguration=Of});var ub=k(vu=>{"use strict";Object.defineProperty(vu,"__esModule",{value:!0});vu.toHankaku=void 0;function aD(r){return String(r).replace(/\u2019/g,"'").replace(/\u201D/g,'"').replace(/\u3000/g," ").replace(/\uFFE5/g,"\xA5").replace(/[\uFF01\uFF03-\uFF06\uFF08\uFF09\uFF0C-\uFF19\uFF1C-\uFF1F\uFF21-\uFF3B\uFF3D\uFF3F\uFF41-\uFF5B\uFF5D\uFF5E]/g,oD)}vu.toHankaku=aD;function oD(r){return String.fromCharCode(r.charCodeAt(0)-65248)}});var cb=k(Aa=>{"use strict";var uD=Aa&&Aa.__importDefault||function(r){return r&&r.__esModule?r:{default:r}};Object.defineProperty(Aa,"__esModule",{value:!0});var Df=ub(),lD=ft(),cD=uD(_e()),dD=/(?:(?:([同今本])|((昭和|平成|令和)?([0-90-9]{1,4}|元)))年\s*)?([0-90-9]{1,2})月\s*([0-90-9]{1,2})日/i,lb=1,fD=2,xf=3,pD=4,mD=5,hD=6,Rf=class{pattern(){return dD}extract(e,t){let n=parseInt(Df.toHankaku(t[mD])),i=parseInt(Df.toHankaku(t[hD])),s=e.createParsingComponents({day:i,month:n});if(t[lb]&&t[lb].match("\u540C|\u4ECA|\u672C")){let a=cD.default(e.refDate);s.assign("year",a.year())}if(t[fD]){let a=t[pD],o=a=="\u5143"?1:parseInt(Df.toHankaku(a));t[xf]=="\u4EE4\u548C"?o+=2018:t[xf]=="\u5E73\u6210"?o+=1988:t[xf]=="\u662D\u548C"&&(o+=1925),s.assign("year",o)}else{let a=lD.findYearClosestToRef(e.refDate,i,n);s.imply("year",a)}return s}};Aa.default=Rf});var db=k(Pa=>{"use strict";var gD=Pa&&Pa.__importDefault||function(r){return r&&r.__esModule?r:{default:r}};Object.defineProperty(Pa,"__esModule",{value:!0});var yD=gD(Vr()),Mf=class extends yD.default{patternBetween(){return/^\s*(から|ー|-)\s*$/i}};Pa.default=Mf});var pb=k(Mr=>{"use strict";var bD=Mr&&Mr.__createBinding||(Object.create?function(r,e,t,n){n===void 0&&(n=t),Object.defineProperty(r,n,{enumerable:!0,get:function(){return e[t]}})}:function(r,e,t,n){n===void 0&&(n=t),r[n]=e[t]}),TD=Mr&&Mr.__setModuleDefault||(Object.create?function(r,e){Object.defineProperty(r,"default",{enumerable:!0,value:e})}:function(r,e){r.default=e}),_D=Mr&&Mr.__importStar||function(r){if(r&&r.__esModule)return r;var e={};if(r!=null)for(var t in r)t!=="default"&&Object.prototype.hasOwnProperty.call(r,t)&&bD(e,r,t);return TD(e,r),e},vD=Mr&&Mr.__importDefault||function(r){return r&&r.__esModule?r:{default:r}};Object.defineProperty(Mr,"__esModule",{value:!0});var wD=vD(_e()),fb=Je(),Cf=_D(gn()),kD=/今日|当日|昨日|明日|今夜|今夕|今晩|今朝/i,Af=class{pattern(){return kD}extract(e,t){let n=t[0],i=wD.default(e.refDate),s=e.createParsingComponents();switch(n){case"\u6628\u65E5":return Cf.yesterday(e.reference);case"\u660E\u65E5":return Cf.tomorrow(e.reference);case"\u4ECA\u65E5":case"\u5F53\u65E5":return Cf.today(e.reference)}return n=="\u4ECA\u591C"||n=="\u4ECA\u5915"||n=="\u4ECA\u6669"?(s.imply("hour",22),s.assign("meridiem",fb.Meridiem.PM)):n.match("\u4ECA\u671D")&&(s.imply("hour",6),s.assign("meridiem",fb.Meridiem.AM)),s.assign("day",i.date()),s.assign("month",i.month()+1),s.assign("year",i.year()),s}};Mr.default=Af});var gb=k(at=>{"use strict";var Pf=at&&at.__importDefault||function(r){return r&&r.__esModule?r:{default:r}};Object.defineProperty(at,"__esModule",{value:!0});at.createConfiguration=at.createCasualConfiguration=at.parseDate=at.parse=at.strict=at.casual=void 0;var ED=Pf(cb()),SD=Pf(db()),OD=Pf(pb()),mb=Or();at.casual=new mb.Chrono(hb());at.strict=new mb.Chrono(Nf());function DD(r,e,t){return at.casual.parse(r,e,t)}at.parse=DD;function xD(r,e,t){return at.casual.parseDate(r,e,t)}at.parseDate=xD;function hb(){let r=Nf();return r.parsers.unshift(new OD.default),r}at.createCasualConfiguration=hb;function Nf(){return{parsers:[new ED.default],refiners:[new SD.default]}}at.createConfiguration=Nf});var wu=k(Kr=>{"use strict";Object.defineProperty(Kr,"__esModule",{value:!0});Kr.parseYear=Kr.YEAR_PATTERN=Kr.MONTH_DICTIONARY=Kr.WEEKDAY_DICTIONARY=void 0;Kr.WEEKDAY_DICTIONARY={domingo:0,dom:0,segunda:1,"segunda-feira":1,seg:1,ter\u00E7a:2,"ter\xE7a-feira":2,ter:2,quarta:3,"quarta-feira":3,qua:3,quinta:4,"quinta-feira":4,qui:4,sexta:5,"sexta-feira":5,sex:5,s\u00E1bado:6,sabado:6,sab:6};Kr.MONTH_DICTIONARY={janeiro:1,jan:1,"jan.":1,fevereiro:2,fev:2,"fev.":2,mar\u00E7o:3,mar:3,"mar.":3,abril:4,abr:4,"abr.":4,maio:5,mai:5,"mai.":5,junho:6,jun:6,"jun.":6,julho:7,jul:7,"jul.":7,agosto:8,ago:8,"ago.":8,setembro:9,set:9,"set.":9,outubro:10,out:10,"out.":10,novembro:11,nov:11,"nov.":11,dezembro:12,dez:12,"dez.":12};Kr.YEAR_PATTERN="[0-9]{1,4}(?![^\\s]\\d)(?:\\s*[a|d]\\.?\\s*c\\.?|\\s*a\\.?\\s*d\\.?)?";function RD(r){if(r.match(/^[0-9]{1,4}$/)){let e=parseInt(r);return e<100&&(e>50?e=e+1900:e=e+2e3),e}return r.match(/a\.?\s*c\.?/i)?(r=r.replace(/a\.?\s*c\.?/i,""),-parseInt(r)):parseInt(r)}Kr.parseYear=RD});var bb=k(Ff=>{"use strict";Object.defineProperty(Ff,"__esModule",{value:!0});var yb=wu(),MD=De(),CD=H(),AD=bi(),PD=new RegExp(`(?:(?:\\,|\\(|\\\uFF08)\\s*)?(?:(este|esta|passado|pr[o\xF3]ximo)\\s*)?(${MD.matchAnyPattern(yb.WEEKDAY_DICTIONARY)})(?:\\s*(?:\\,|\\)|\\\uFF09))?(?:\\s*(este|esta|passado|pr[\xF3o]ximo)\\s*semana)?(?=\\W|\\d|$)`,"i"),ND=1,ID=2,FD=3,If=class extends CD.AbstractParserWithWordBoundaryChecking{innerPattern(){return PD}innerExtract(e,t){let n=t[ID].toLowerCase(),i=yb.WEEKDAY_DICTIONARY[n];if(i===void 0)return null;let s=t[ND],a=t[FD],o=s||a||"";o=o.toLowerCase();let u=null;o=="passado"?u="this":o=="pr\xF3ximo"||o=="proximo"?u="next":o=="este"&&(u="this");let l=AD.toDayJSWeekday(e.refDate,i,u);return e.createParsingComponents().assign("weekday",i).imply("day",l.date()).imply("month",l.month()+1).imply("year",l.year())}};Ff.default=If});var Tb=k(Uf=>{"use strict";Object.defineProperty(Uf,"__esModule",{value:!0});var LD=gi(),Lf=class extends LD.AbstractTimeExpressionParser{primaryPrefix(){return"(?:(?:ao?|\xE0s?|das|da|de|do)\\s*)?"}followingPhase(){return"\\s*(?:\\-|\\\u2013|\\~|\\\u301C|a(?:o)?|\\?)\\s*"}};Uf.default=Lf});var _b=k(Na=>{"use strict";var UD=Na&&Na.__importDefault||function(r){return r&&r.__esModule?r:{default:r}};Object.defineProperty(Na,"__esModule",{value:!0});var WD=UD(pn()),Wf=class extends WD.default{patternBetween(){return new RegExp("^\\s*(?:,|\xE0)?\\s*$")}};Na.default=Wf});var vb=k(Ia=>{"use strict";var qD=Ia&&Ia.__importDefault||function(r){return r&&r.__esModule?r:{default:r}};Object.defineProperty(Ia,"__esModule",{value:!0});var jD=qD(Vr()),qf=class extends jD.default{patternBetween(){return/^\s*(?:-)\s*$/i}};Ia.default=qf});var Db=k($f=>{"use strict";Object.defineProperty($f,"__esModule",{value:!0});var $D=ft(),Sb=wu(),Ob=wu(),GD=De(),YD=H(),BD=new RegExp(`([0-9]{1,2})(?:\xBA|\xAA|\xB0)?(?:\\s*(?:desde|de|\\-|\\\u2013|ao?|\\s)\\s*([0-9]{1,2})(?:\xBA|\xAA|\xB0)?)?\\s*(?:de)?\\s*(?:-|/|\\s*(?:de|,)?\\s*)(${GD.matchAnyPattern(Sb.MONTH_DICTIONARY)})(?:\\s*(?:de|,)?\\s*(${Ob.YEAR_PATTERN}))?(?=\\W|$)`,"i"),wb=1,kb=2,HD=3,Eb=4,jf=class extends YD.AbstractParserWithWordBoundaryChecking{innerPattern(){return BD}innerExtract(e,t){let n=e.createParsingResult(t.index,t[0]),i=Sb.MONTH_DICTIONARY[t[HD].toLowerCase()],s=parseInt(t[wb]);if(s>31)return t.index=t.index+t[wb].length,null;if(n.start.assign("month",i),n.start.assign("day",s),t[Eb]){let a=Ob.parseYear(t[Eb]);n.start.assign("year",a)}else{let a=$D.findYearClosestToRef(e.refDate,s,i);n.start.imply("year",a)}if(t[kb]){let a=parseInt(t[kb]);n.end=n.start.clone(),n.end.assign("day",a)}return n}};$f.default=jf});var xb=k(yn=>{"use strict";var VD=yn&&yn.__createBinding||(Object.create?function(r,e,t,n){n===void 0&&(n=t),Object.defineProperty(r,n,{enumerable:!0,get:function(){return e[t]}})}:function(r,e,t,n){n===void 0&&(n=t),r[n]=e[t]}),zD=yn&&yn.__setModuleDefault||(Object.create?function(r,e){Object.defineProperty(r,"default",{enumerable:!0,value:e})}:function(r,e){r.default=e}),KD=yn&&yn.__importStar||function(r){if(r&&r.__esModule)return r;var e={};if(r!=null)for(var t in r)t!=="default"&&Object.prototype.hasOwnProperty.call(r,t)&&VD(e,r,t);return zD(e,r),e};Object.defineProperty(yn,"__esModule",{value:!0});var QD=H(),ku=KD(gn()),Gf=class extends QD.AbstractParserWithWordBoundaryChecking{innerPattern(e){return/(agora|hoje|amanha|amanhã|ontem)(?=\W|$)/i}innerExtract(e,t){let n=t[0].toLowerCase(),i=e.createParsingComponents();switch(n){case"agora":return ku.now(e.reference);case"hoje":return ku.today(e.reference);case"amanha":case"amanh\xE3":return ku.tomorrow(e.reference);case"ontem":return ku.yesterday(e.reference)}return i}};yn.default=Gf});var Rb=k(Fa=>{"use strict";var XD=Fa&&Fa.__importDefault||function(r){return r&&r.__esModule?r:{default:r}};Object.defineProperty(Fa,"__esModule",{value:!0});var Eu=Je(),ZD=H(),JD=lr(),ex=XD(_e()),Yf=class extends ZD.AbstractParserWithWordBoundaryChecking{innerPattern(){return/(?:esta\s*)?(manha|manhã|tarde|meia-noite|meio-dia|noite)(?=\W|$)/i}innerExtract(e,t){let n=ex.default(e.refDate),i=e.createParsingComponents();switch(t[1].toLowerCase()){case"tarde":i.imply("meridiem",Eu.Meridiem.PM),i.imply("hour",15);break;case"noite":i.imply("meridiem",Eu.Meridiem.PM),i.imply("hour",22);break;case"manha":case"manh\xE3":i.imply("meridiem",Eu.Meridiem.AM),i.imply("hour",6);break;case"meia-noite":JD.assignTheNextDay(i,n),i.imply("hour",0),i.imply("minute",0),i.imply("second",0);break;case"meio-dia":i.imply("meridiem",Eu.Meridiem.AM),i.imply("hour",12);break}return i}};Fa.default=Yf});var Ab=k(ot=>{"use strict";var Vn=ot&&ot.__importDefault||function(r){return r&&r.__esModule?r:{default:r}};Object.defineProperty(ot,"__esModule",{value:!0});ot.createConfiguration=ot.createCasualConfiguration=ot.parseDate=ot.parse=ot.strict=ot.casual=void 0;var tx=mn(),Mb=Or(),rx=Vn(Ti()),nx=Vn(bb()),ix=Vn(Tb()),sx=Vn(_b()),ax=Vn(vb()),ox=Vn(Db()),ux=Vn(xb()),lx=Vn(Rb());ot.casual=new Mb.Chrono(Cb());ot.strict=new Mb.Chrono(Bf(!0));function cx(r,e,t){return ot.casual.parse(r,e,t)}ot.parse=cx;function dx(r,e,t){return ot.casual.parseDate(r,e,t)}ot.parseDate=dx;function Cb(r=!0){let e=Bf(!1,r);return e.parsers.push(new ux.default),e.parsers.push(new lx.default),e}ot.createCasualConfiguration=Cb;function Bf(r=!0,e=!0){return tx.includeCommonConfiguration({parsers:[new rx.default(e),new nx.default,new ix.default,new ox.default],refiners:[new sx.default,new ax.default]},r)}ot.createConfiguration=Bf});var Pb=k(La=>{"use strict";var fx=La&&La.__importDefault||function(r){return r&&r.__esModule?r:{default:r}};Object.defineProperty(La,"__esModule",{value:!0});var px=fx(Vr()),Hf=class extends px.default{patternBetween(){return/^\s*(tot|-)\s*$/i}};La.default=Hf});var Nb=k(Ua=>{"use strict";var mx=Ua&&Ua.__importDefault||function(r){return r&&r.__esModule?r:{default:r}};Object.defineProperty(Ua,"__esModule",{value:!0});var hx=mx(pn()),Vf=class extends hx.default{patternBetween(){return new RegExp("^\\s*(om|na|voor|in de|,|-)?\\s*$")}};Ua.default=Vf});var Ib=k(bn=>{"use strict";var gx=bn&&bn.__createBinding||(Object.create?function(r,e,t,n){n===void 0&&(n=t),Object.defineProperty(r,n,{enumerable:!0,get:function(){return e[t]}})}:function(r,e,t,n){n===void 0&&(n=t),r[n]=e[t]}),yx=bn&&bn.__setModuleDefault||(Object.create?function(r,e){Object.defineProperty(r,"default",{enumerable:!0,value:e})}:function(r,e){r.default=e}),bx=bn&&bn.__importStar||function(r){if(r&&r.__esModule)return r;var e={};if(r!=null)for(var t in r)t!=="default"&&Object.prototype.hasOwnProperty.call(r,t)&&gx(e,r,t);return yx(e,r),e};Object.defineProperty(bn,"__esModule",{value:!0});var Tx=H(),Su=bx(gn()),zf=class extends Tx.AbstractParserWithWordBoundaryChecking{innerPattern(e){return/(nu|vandaag|morgen|morgend|gisteren)(?=\W|$)/i}innerExtract(e,t){let n=t[0].toLowerCase(),i=e.createParsingComponents();switch(n){case"nu":return Su.now(e.reference);case"vandaag":return Su.today(e.reference);case"morgen":case"morgend":return Su.tomorrow(e.reference);case"gisteren":return Su.yesterday(e.reference)}return i}};bn.default=zf});var Fb=k(Wa=>{"use strict";var _x=Wa&&Wa.__importDefault||function(r){return r&&r.__esModule?r:{default:r}};Object.defineProperty(Wa,"__esModule",{value:!0});var Ou=Je(),vx=H(),wx=_x(_e()),kx=lr(),Ex=1,Sx=2,Kf=class extends vx.AbstractParserWithWordBoundaryChecking{innerPattern(){return/(deze)?\s*(namiddag|avond|middernacht|ochtend|middag|'s middags|'s avonds|'s ochtends)(?=\W|$)/i}innerExtract(e,t){let n=wx.default(e.refDate),i=e.createParsingComponents();switch(t[Ex]==="deze"&&(i.assign("day",e.refDate.getDate()),i.assign("month",e.refDate.getMonth()+1),i.assign("year",e.refDate.getFullYear())),t[Sx].toLowerCase()){case"namiddag":case"'s namiddags":i.imply("meridiem",Ou.Meridiem.PM),i.imply("hour",15);break;case"avond":case"'s avonds'":i.imply("meridiem",Ou.Meridiem.PM),i.imply("hour",20);break;case"middernacht":kx.assignTheNextDay(i,n),i.imply("hour",0),i.imply("minute",0),i.imply("second",0);break;case"ochtend":case"'s ochtends":i.imply("meridiem",Ou.Meridiem.AM),i.imply("hour",6);break;case"middag":case"'s middags":i.imply("meridiem",Ou.Meridiem.AM),i.imply("hour",12);break}return i}};Wa.default=Kf});var Ht=k(pe=>{"use strict";Object.defineProperty(pe,"__esModule",{value:!0});pe.parseTimeUnits=pe.TIME_UNITS_PATTERN=pe.parseYear=pe.YEAR_PATTERN=pe.parseOrdinalNumberPattern=pe.ORDINAL_NUMBER_PATTERN=pe.parseNumberPattern=pe.NUMBER_PATTERN=pe.TIME_UNIT_DICTIONARY=pe.ORDINAL_WORD_DICTIONARY=pe.INTEGER_WORD_DICTIONARY=pe.MONTH_DICTIONARY=pe.WEEKDAY_DICTIONARY=void 0;var Du=De(),Ox=ft();pe.WEEKDAY_DICTIONARY={zondag:0,zon:0,"zon.":0,zo:0,"zo.":0,maandag:1,ma:1,"ma.":1,dinsdag:2,din:2,"din.":2,di:2,"di.":2,woensdag:3,woe:3,"woe.":3,wo:3,"wo.":3,donderdag:4,dond:4,"dond.":4,do:4,"do.":4,vrijdag:5,vrij:5,"vrij.":5,vr:5,"vr.":5,zaterdag:6,zat:6,"zat.":6,za:6,"za.":6};pe.MONTH_DICTIONARY={januari:1,jan:1,"jan.":1,februari:2,feb:2,"feb.":2,maart:3,mar:3,"mar.":3,april:4,apr:4,"apr.":4,mei:5,juni:6,jun:6,"jun.":6,juli:7,jul:7,"jul.":7,augustus:8,aug:8,"aug.":8,september:9,sep:9,"sep.":9,sept:9,"sept.":9,oktober:10,okt:10,"okt.":10,november:11,nov:11,"nov.":11,december:12,dec:12,"dec.":12};pe.INTEGER_WORD_DICTIONARY={een:1,twee:2,drie:3,vier:4,vijf:5,zes:6,zeven:7,acht:8,negen:9,tien:10,elf:11,twaalf:12};pe.ORDINAL_WORD_DICTIONARY={eerste:1,tweede:2,derde:3,vierde:4,vijfde:5,zesde:6,zevende:7,achtste:8,negende:9,tiende:10,elfde:11,twaalfde:12,dertiende:13,veertiende:14,vijftiende:15,zestiende:16,zeventiende:17,achttiende:18,negentiende:19,twintigste:20,eenentwintigste:21,twee\u00EBntwintigste:22,drieentwintigste:23,vierentwintigste:24,vijfentwintigste:25,zesentwintigste:26,zevenentwintigste:27,achtentwintig:28,negenentwintig:29,dertigste:30,eenendertigste:31};pe.TIME_UNIT_DICTIONARY={sec:"second",second:"second",seconden:"second",min:"minute",mins:"minute",minute:"minute",minuut:"minute",minuten:"minute",minuutje:"minute",h:"hour",hr:"hour",hrs:"hour",uur:"hour",u:"hour",uren:"hour",dag:"d",dagen:"d",week:"week",weken:"week",maand:"month",maanden:"month",jaar:"year",jr:"year",jaren:"year"};pe.NUMBER_PATTERN=`(?:${Du.matchAnyPattern(pe.INTEGER_WORD_DICTIONARY)}|[0-9]+|[0-9]+[\\.,][0-9]+|halve?|half|paar)`;function Ub(r){let e=r.toLowerCase();return pe.INTEGER_WORD_DICTIONARY[e]!==void 0?pe.INTEGER_WORD_DICTIONARY[e]:e==="paar"?2:e==="half"||e.match(/halve?/)?.5:parseFloat(e.replace(",","."))}pe.parseNumberPattern=Ub;pe.ORDINAL_NUMBER_PATTERN=`(?:${Du.matchAnyPattern(pe.ORDINAL_WORD_DICTIONARY)}|[0-9]{1,2}(?:ste|de)?)`;function Dx(r){let e=r.toLowerCase();return pe.ORDINAL_WORD_DICTIONARY[e]!==void 0?pe.ORDINAL_WORD_DICTIONARY[e]:(e=e.replace(/(?:ste|de)$/i,""),parseInt(e))}pe.parseOrdinalNumberPattern=Dx;pe.YEAR_PATTERN="(?:[1-9][0-9]{0,3}\\s*(?:voor Christus|na Christus)|[1-2][0-9]{3}|[5-9][0-9])";function xx(r){if(/voor Christus/i.test(r))return r=r.replace(/voor Christus/i,""),-parseInt(r);if(/na Christus/i.test(r))return r=r.replace(/na Christus/i,""),parseInt(r);let e=parseInt(r);return Ox.findMostLikelyADYear(e)}pe.parseYear=xx;var Wb=`(${pe.NUMBER_PATTERN})\\s{0,5}(${Du.matchAnyPattern(pe.TIME_UNIT_DICTIONARY)})\\s{0,5}`,Lb=new RegExp(Wb,"i");pe.TIME_UNITS_PATTERN=Du.repeatedTimeunitPattern("(?:(?:binnen|in)\\s*)?",Wb);function Rx(r){let e={},t=r,n=Lb.exec(t);for(;n;)Mx(e,n),t=t.substring(n[0].length),n=Lb.exec(t);return e}pe.parseTimeUnits=Rx;function Mx(r,e){let t=Ub(e[1]),n=pe.TIME_UNIT_DICTIONARY[e[2].toLowerCase()];r[n]=t}});var jb=k(Xf=>{"use strict";Object.defineProperty(Xf,"__esModule",{value:!0});var qb=Ht(),Cx=qe(),Ax=H(),Qf=class extends Ax.AbstractParserWithWordBoundaryChecking{innerPattern(){return new RegExp("(?:binnen|in|binnen de|voor)\\s*("+qb.TIME_UNITS_PATTERN+")(?=\\W|$)","i")}innerExtract(e,t){let n=qb.parseTimeUnits(t[1]);return Cx.ParsingComponents.createRelativeFromReference(e.reference,n)}};Xf.default=Qf});var Gb=k(Jf=>{"use strict";Object.defineProperty(Jf,"__esModule",{value:!0});var $b=Ht(),Px=De(),Nx=H(),Ix=bi(),Fx=new RegExp(`(?:(?:\\,|\\(|\\\uFF08)\\s*)?(?:op\\s*?)?(?:(deze|vorige|volgende)\\s*(?:week\\s*)?)?(${Px.matchAnyPattern($b.WEEKDAY_DICTIONARY)})(?=\\W|$)`,"i"),Lx=1,Ux=2,Wx=3,Zf=class extends Nx.AbstractParserWithWordBoundaryChecking{innerPattern(){return Fx}innerExtract(e,t){let n=t[Ux].toLowerCase(),i=$b.WEEKDAY_DICTIONARY[n],s=t[Lx],a=t[Wx],o=s||a;o=o||"",o=o.toLowerCase();let u=null;o=="vorige"?u="last":o=="volgende"?u="next":o=="deze"&&(u="this");let l=Ix.toDayJSWeekday(e.refDate,i,u);return e.createParsingComponents().assign("weekday",i).imply("day",l.date()).imply("month",l.month()+1).imply("year",l.year())}};Jf.default=Zf});var Kb=k(tp=>{"use strict";Object.defineProperty(tp,"__esModule",{value:!0});var qx=ft(),Vb=Ht(),xu=Ht(),zb=Ht(),jx=De(),$x=H(),Gx=new RegExp(`(?:on\\s*?)?(${xu.ORDINAL_NUMBER_PATTERN})(?:\\s*(?:tot|\\-|\\\u2013|until|through|till|\\s)\\s*(${xu.ORDINAL_NUMBER_PATTERN}))?(?:-|/|\\s*(?:of)?\\s*)(`+jx.matchAnyPattern(Vb.MONTH_DICTIONARY)+`)(?:(?:-|/|,?\\s*)(${zb.YEAR_PATTERN}(?![^\\s]\\d)))?(?=\\W|$)`,"i"),Yx=3,Yb=1,Bb=2,Hb=4,ep=class extends $x.AbstractParserWithWordBoundaryChecking{innerPattern(){return Gx}innerExtract(e,t){let n=Vb.MONTH_DICTIONARY[t[Yx].toLowerCase()],i=xu.parseOrdinalNumberPattern(t[Yb]);if(i>31)return t.index=t.index+t[Yb].length,null;let s=e.createParsingComponents({day:i,month:n});if(t[Hb]){let u=zb.parseYear(t[Hb]);s.assign("year",u)}else{let u=qx.findYearClosestToRef(e.refDate,i,n);s.imply("year",u)}if(!t[Bb])return s;let a=xu.parseOrdinalNumberPattern(t[Bb]),o=e.createParsingResult(t.index,t[0]);return o.start=s,o.end=s.clone(),o.end.assign("day",a),o}};tp.default=ep});var Jb=k(np=>{"use strict";Object.defineProperty(np,"__esModule",{value:!0});var Xb=Ht(),Bx=ft(),Hx=De(),Zb=Ht(),Vx=H(),zx=new RegExp(`(${Hx.matchAnyPattern(Xb.MONTH_DICTIONARY)})\\s*(?:[,-]?\\s*(${Zb.YEAR_PATTERN})?)?(?=[^\\s\\w]|\\s+[^0-9]|\\s+$|$)`,"i"),Kx=1,Qb=2,rp=class extends Vx.AbstractParserWithWordBoundaryChecking{innerPattern(){return zx}innerExtract(e,t){let n=e.createParsingComponents();n.imply("day",1);let i=t[Kx],s=Xb.MONTH_DICTIONARY[i.toLowerCase()];if(n.assign("month",s),t[Qb]){let a=Zb.parseYear(t[Qb]);n.assign("year",a)}else{let a=Bx.findYearClosestToRef(e.refDate,1,s);n.imply("year",a)}return n}};np.default=rp});var eT=k(sp=>{"use strict";Object.defineProperty(sp,"__esModule",{value:!0});var Qx=H(),Xx=new RegExp("([0-9]|0[1-9]|1[012])/([0-9]{4})","i"),Zx=1,Jx=2,ip=class extends Qx.AbstractParserWithWordBoundaryChecking{innerPattern(){return Xx}innerExtract(e,t){let n=parseInt(t[Jx]),i=parseInt(t[Zx]);return e.createParsingComponents().imply("day",1).assign("month",i).assign("year",n)}};sp.default=ip});var tT=k(op=>{"use strict";Object.defineProperty(op,"__esModule",{value:!0});var eR=gi(),ap=class extends eR.AbstractTimeExpressionParser{primaryPrefix(){return"(?:(?:om)\\s*)?"}followingPhase(){return"\\s*(?:\\-|\\\u2013|\\~|\\\u301C|om|\\?)\\s*"}primarySuffix(){return"(?:\\s*(?:uur))?(?!/)(?=\\W|$)"}extractPrimaryTimeComponents(e,t){return t[0].match(/^\s*\d{4}\s*$/)?null:super.extractPrimaryTimeComponents(e,t)}};op.default=ap});var iT=k(lp=>{"use strict";Object.defineProperty(lp,"__esModule",{value:!0});var nT=Ht(),tR=De(),rR=H(),nR=new RegExp(`([0-9]{4})[\\.\\/\\s](?:(${tR.matchAnyPattern(nT.MONTH_DICTIONARY)})|([0-9]{1,2}))[\\.\\/\\s]([0-9]{1,2})(?=\\W|$)`,"i"),iR=1,sR=2,rT=3,aR=4,up=class extends rR.AbstractParserWithWordBoundaryChecking{innerPattern(){return nR}innerExtract(e,t){let n=t[rT]?parseInt(t[rT]):nT.MONTH_DICTIONARY[t[sR].toLowerCase()];if(n<1||n>12)return null;let i=parseInt(t[iR]);return{day:parseInt(t[aR]),month:n,year:i}}};lp.default=up});var sT=k(qa=>{"use strict";var oR=qa&&qa.__importDefault||function(r){return r&&r.__esModule?r:{default:r}};Object.defineProperty(qa,"__esModule",{value:!0});var uR=H(),Ru=Je(),cp=lr(),lR=oR(_e()),cR=1,dR=2,dp=class extends uR.AbstractParserWithWordBoundaryChecking{innerPattern(e){return/(gisteren|morgen|van)(ochtend|middag|namiddag|avond|nacht)(?=\W|$)/i}innerExtract(e,t){let n=t[cR].toLowerCase(),i=t[dR].toLowerCase(),s=e.createParsingComponents(),a=lR.default(e.refDate);switch(n){case"gisteren":cp.assignSimilarDate(s,a.add(-1,"day"));break;case"van":cp.assignSimilarDate(s,a);break;case"morgen":cp.assignTheNextDay(s,a);break}switch(i){case"ochtend":s.imply("meridiem",Ru.Meridiem.AM),s.imply("hour",6);break;case"middag":s.imply("meridiem",Ru.Meridiem.AM),s.imply("hour",12);break;case"namiddag":s.imply("meridiem",Ru.Meridiem.PM),s.imply("hour",15);break;case"avond":s.imply("meridiem",Ru.Meridiem.PM),s.imply("hour",20);break}return s}};qa.default=dp});var oT=k(pp=>{"use strict";Object.defineProperty(pp,"__esModule",{value:!0});var aT=Ht(),fR=qe(),pR=H(),mR=cr(),hR=new RegExp(`(deze|vorige|afgelopen|komende|over|\\+|-)\\s*(${aT.TIME_UNITS_PATTERN})(?=\\W|$)`,"i"),fp=class extends pR.AbstractParserWithWordBoundaryChecking{innerPattern(){return hR}innerExtract(e,t){let n=t[1].toLowerCase(),i=aT.parseTimeUnits(t[2]);switch(n){case"vorige":case"afgelopen":case"-":i=mR.reverseTimeUnits(i);break}return fR.ParsingComponents.createRelativeFromReference(e.reference,i)}};pp.default=fp});var cT=k(ja=>{"use strict";var gR=ja&&ja.__importDefault||function(r){return r&&r.__esModule?r:{default:r}};Object.defineProperty(ja,"__esModule",{value:!0});var lT=Ht(),uT=qe(),yR=gR(_e()),bR=H(),TR=De(),_R=new RegExp(`(dit|deze|komende|volgend|volgende|afgelopen|vorige)\\s*(${TR.matchAnyPattern(lT.TIME_UNIT_DICTIONARY)})(?=\\s*)(?=\\W|$)`,"i"),vR=1,wR=2,mp=class extends bR.AbstractParserWithWordBoundaryChecking{innerPattern(){return _R}innerExtract(e,t){let n=t[vR].toLowerCase(),i=t[wR].toLowerCase(),s=lT.TIME_UNIT_DICTIONARY[i];if(n=="volgend"||n=="volgende"||n=="komende"){let u={};return u[s]=1,uT.ParsingComponents.createRelativeFromReference(e.reference,u)}if(n=="afgelopen"||n=="vorige"){let u={};return u[s]=-1,uT.ParsingComponents.createRelativeFromReference(e.reference,u)}let a=e.createParsingComponents(),o=yR.default(e.reference.instant);return i.match(/week/i)?(o=o.add(-o.get("d"),"d"),a.imply("day",o.date()),a.imply("month",o.month()+1),a.imply("year",o.year())):i.match(/maand/i)?(o=o.add(-o.date()+1,"d"),a.imply("day",o.date()),a.assign("year",o.year()),a.assign("month",o.month()+1)):i.match(/jaar/i)&&(o=o.add(-o.date()+1,"d"),o=o.add(-o.month(),"month"),a.imply("day",o.date()),a.imply("month",o.month()+1),a.assign("year",o.year())),a}};ja.default=mp});var dT=k(yp=>{"use strict";Object.defineProperty(yp,"__esModule",{value:!0});var gp=Ht(),kR=qe(),ER=H(),SR=cr(),OR=new RegExp("("+gp.TIME_UNITS_PATTERN+")(?:geleden|voor|eerder)(?=(?:\\W|$))","i"),DR=new RegExp("("+gp.TIME_UNITS_PATTERN+")geleden(?=(?:\\W|$))","i"),hp=class extends ER.AbstractParserWithWordBoundaryChecking{constructor(e){super(),this.strictMode=e}innerPattern(){return this.strictMode?DR:OR}innerExtract(e,t){let n=gp.parseTimeUnits(t[1]),i=SR.reverseTimeUnits(n);return kR.ParsingComponents.createRelativeFromReference(e.reference,i)}};yp.default=hp});var fT=k(_p=>{"use strict";Object.defineProperty(_p,"__esModule",{value:!0});var Tp=Ht(),xR=qe(),RR=H(),MR=new RegExp("("+Tp.TIME_UNITS_PATTERN+")(later|na|vanaf nu|voortaan|vooruit|uit)(?=(?:\\W|$))","i"),CR=new RegExp("("+Tp.TIME_UNITS_PATTERN+")(later|vanaf nu)(?=(?:\\W|$))","i"),AR=1,bp=class extends RR.AbstractParserWithWordBoundaryChecking{constructor(e){super(),this.strictMode=e}innerPattern(){return this.strictMode?CR:MR}innerExtract(e,t){let n=Tp.parseTimeUnits(t[AR]);return xR.ParsingComponents.createRelativeFromReference(e.reference,n)}};_p.default=bp});var gT=k(ut=>{"use strict";var mt=ut&&ut.__importDefault||function(r){return r&&r.__esModule?r:{default:r}};Object.defineProperty(ut,"__esModule",{value:!0});ut.createConfiguration=ut.createCasualConfiguration=ut.parseDate=ut.parse=ut.strict=ut.casual=void 0;var PR=mn(),pT=Or(),NR=mt(Pb()),IR=mt(Nb()),FR=mt(Ib()),LR=mt(Fb()),UR=mt(Ti()),WR=mt(jb()),qR=mt(Gb()),jR=mt(Kb()),mT=mt(Jb()),$R=mt(eT()),GR=mt(tT()),YR=mt(iT()),BR=mt(sT()),HR=mt(oT()),VR=mt(cT()),zR=mt(dT()),KR=mt(fT());ut.casual=new pT.Chrono(hT());ut.strict=new pT.Chrono(vp(!0));function QR(r,e,t){return ut.casual.parse(r,e,t)}ut.parse=QR;function XR(r,e,t){return ut.casual.parseDate(r,e,t)}ut.parseDate=XR;function hT(r=!0){let e=vp(!1,r);return e.parsers.unshift(new FR.default),e.parsers.unshift(new LR.default),e.parsers.unshift(new BR.default),e.parsers.unshift(new mT.default),e.parsers.unshift(new VR.default),e.parsers.unshift(new HR.default),e}ut.createCasualConfiguration=hT;function vp(r=!0,e=!0){return PR.includeCommonConfiguration({parsers:[new UR.default(e),new WR.default,new jR.default,new mT.default,new qR.default,new YR.default,new $R.default,new GR.default(r),new zR.default(r),new KR.default(r)],refiners:[new IR.default,new NR.default]},r)}ut.createConfiguration=vp});var _T=k($a=>{"use strict";var ZR=$a&&$a.__importDefault||function(r){return r&&r.__esModule?r:{default:r}};Object.defineProperty($a,"__esModule",{value:!0});var JR=ZR(_e()),eM=H(),tM=1,yT=2,rM=3,bT=4,TT=5,nM=6,wp=class extends eM.AbstractParserWithWordBoundaryChecking{innerPattern(e){return new RegExp("(\u800C\u5BB6|\u7ACB(?:\u523B|\u5373)|\u5373\u523B)|(\u4ECA|\u660E|\u524D|\u5927\u524D|\u5F8C|\u5927\u5F8C|\u807D|\u6628|\u5C0B|\u7434)(\u65E9|\u671D|\u665A)|(\u4E0A(?:\u5348|\u665D)|\u671D(?:\u65E9)|\u65E9(?:\u4E0A)|\u4E0B(?:\u5348|\u665D)|\u664F(?:\u665D)|\u665A(?:\u4E0A)|\u591C(?:\u665A)?|\u4E2D(?:\u5348)|\u51CC(?:\u6668))|(\u4ECA|\u660E|\u524D|\u5927\u524D|\u5F8C|\u5927\u5F8C|\u807D|\u6628|\u5C0B|\u7434)(?:\u65E5|\u5929)(?:[\\s|,|\uFF0C]*)(?:(\u4E0A(?:\u5348|\u665D)|\u671D(?:\u65E9)|\u65E9(?:\u4E0A)|\u4E0B(?:\u5348|\u665D)|\u664F(?:\u665D)|\u665A(?:\u4E0A)|\u591C(?:\u665A)?|\u4E2D(?:\u5348)|\u51CC(?:\u6668)))?","i")}innerExtract(e,t){let n=t.index,i=e.createParsingResult(n,t[0]),s=JR.default(e.refDate),a=s;if(t[tM])i.start.imply("hour",s.hour()),i.start.imply("minute",s.minute()),i.start.imply("second",s.second()),i.start.imply("millisecond",s.millisecond());else if(t[yT]){let o=t[yT],u=t[rM];o=="\u660E"||o=="\u807D"?s.hour()>1&&(a=a.add(1,"day")):o=="\u6628"||o=="\u5C0B"||o=="\u7434"?a=a.add(-1,"day"):o=="\u524D"?a=a.add(-2,"day"):o=="\u5927\u524D"?a=a.add(-3,"day"):o=="\u5F8C"?a=a.add(2,"day"):o=="\u5927\u5F8C"&&(a=a.add(3,"day")),u=="\u65E9"||u=="\u671D"?i.start.imply("hour",6):u=="\u665A"&&(i.start.imply("hour",22),i.start.imply("meridiem",1))}else if(t[bT]){let u=t[bT][0];u=="\u65E9"||u=="\u671D"||u=="\u4E0A"?i.start.imply("hour",6):u=="\u4E0B"||u=="\u664F"?(i.start.imply("hour",15),i.start.imply("meridiem",1)):u=="\u4E2D"?(i.start.imply("hour",12),i.start.imply("meridiem",1)):u=="\u591C"||u=="\u665A"?(i.start.imply("hour",22),i.start.imply("meridiem",1)):u=="\u51CC"&&i.start.imply("hour",0)}else if(t[TT]){let o=t[TT];o=="\u660E"||o=="\u807D"?s.hour()>1&&(a=a.add(1,"day")):o=="\u6628"||o=="\u5C0B"||o=="\u7434"?a=a.add(-1,"day"):o=="\u524D"?a=a.add(-2,"day"):o=="\u5927\u524D"?a=a.add(-3,"day"):o=="\u5F8C"?a=a.add(2,"day"):o=="\u5927\u5F8C"&&(a=a.add(3,"day"));let u=t[nM];if(u){let l=u[0];l=="\u65E9"||l=="\u671D"||l=="\u4E0A"?i.start.imply("hour",6):l=="\u4E0B"||l=="\u664F"?(i.start.imply("hour",15),i.start.imply("meridiem",1)):l=="\u4E2D"?(i.start.imply("hour",12),i.start.imply("meridiem",1)):l=="\u591C"||l=="\u665A"?(i.start.imply("hour",22),i.start.imply("meridiem",1)):l=="\u51CC"&&i.start.imply("hour",0)}}return i.start.assign("day",a.date()),i.start.assign("month",a.month()+1),i.start.assign("year",a.year()),i}};$a.default=wp});var ps=k(Lt=>{"use strict";Object.defineProperty(Lt,"__esModule",{value:!0});Lt.zhStringToYear=Lt.zhStringToNumber=Lt.WEEKDAY_OFFSET=Lt.NUMBER=void 0;Lt.NUMBER={\u96F6:0,\u4E00:1,\u4E8C:2,\u5169:2,\u4E09:3,\u56DB:4,\u4E94:5,\u516D:6,\u4E03:7,\u516B:8,\u4E5D:9,\u5341:10,\u5EFF:20,\u5345:30};Lt.WEEKDAY_OFFSET={\u5929:0,\u65E5:0,\u4E00:1,\u4E8C:2,\u4E09:3,\u56DB:4,\u4E94:5,\u516D:6};function iM(r){let e=0;for(let t=0;t{"use strict";var aM=Ga&&Ga.__importDefault||function(r){return r&&r.__esModule?r:{default:r}};Object.defineProperty(Ga,"__esModule",{value:!0});var oM=aM(_e()),uM=H(),wi=ps(),kp=1,vT=2,Ep=3,Sp=class extends uM.AbstractParserWithWordBoundaryChecking{innerPattern(){return new RegExp("(\\d{2,4}|["+Object.keys(wi.NUMBER).join("")+"]{4}|["+Object.keys(wi.NUMBER).join("")+"]{2})?(?:\\s*)(?:\u5E74)?(?:[\\s|,|\uFF0C]*)(\\d{1,2}|["+Object.keys(wi.NUMBER).join("")+"]{1,2})(?:\\s*)(?:\u6708)(?:\\s*)(\\d{1,2}|["+Object.keys(wi.NUMBER).join("")+"]{1,2})?(?:\\s*)(?:\u65E5|\u865F)?")}innerExtract(e,t){let n=oM.default(e.refDate),i=e.createParsingResult(t.index,t[0]),s=parseInt(t[vT]);if(isNaN(s)&&(s=wi.zhStringToNumber(t[vT])),i.start.assign("month",s),t[Ep]){let a=parseInt(t[Ep]);isNaN(a)&&(a=wi.zhStringToNumber(t[Ep])),i.start.assign("day",a)}else i.start.imply("day",n.date());if(t[kp]){let a=parseInt(t[kp]);isNaN(a)&&(a=wi.zhStringToYear(t[kp])),i.start.assign("year",a)}else i.start.imply("year",n.year());return i}};Ga.default=Sp});var ET=k(Ya=>{"use strict";var lM=Ya&&Ya.__importDefault||function(r){return r&&r.__esModule?r:{default:r}};Object.defineProperty(Ya,"__esModule",{value:!0});var cM=lM(_e()),dM=H(),kT=ps(),fM=new RegExp("(\\d+|["+Object.keys(kT.NUMBER).join("")+"]+|\u534A|\u5E7E)(?:\\s*)(?:\u500B)?(\u79D2(?:\u9418)?|\u5206\u9418|\u5C0F\u6642|\u9418|\u65E5|\u5929|\u661F\u671F|\u79AE\u62DC|\u6708|\u5E74)(?:(?:\u4E4B|\u904E)?\u5F8C|(?:\u4E4B)?\u5167)","i"),Op=1,pM=2,Dp=class extends dM.AbstractParserWithWordBoundaryChecking{innerPattern(){return fM}innerExtract(e,t){let n=e.createParsingResult(t.index,t[0]),i=parseInt(t[Op]);if(isNaN(i)&&(i=kT.zhStringToNumber(t[Op])),isNaN(i)){let u=t[Op];if(u==="\u5E7E")i=3;else if(u==="\u534A")i=.5;else return null}let s=cM.default(e.refDate),o=t[pM][0];return o.match(/[日天星禮月年]/)?(o=="\u65E5"||o=="\u5929"?s=s.add(i,"d"):o=="\u661F"||o=="\u79AE"?s=s.add(i*7,"d"):o=="\u6708"?s=s.add(i,"month"):o=="\u5E74"&&(s=s.add(i,"year")),n.start.assign("year",s.year()),n.start.assign("month",s.month()+1),n.start.assign("day",s.date()),n):(o=="\u79D2"?s=s.add(i,"second"):o=="\u5206"?s=s.add(i,"minute"):(o=="\u5C0F"||o=="\u9418")&&(s=s.add(i,"hour")),n.start.imply("year",s.year()),n.start.imply("month",s.month()+1),n.start.imply("day",s.date()),n.start.assign("hour",s.hour()),n.start.assign("minute",s.minute()),n.start.assign("second",s.second()),n)}};Ya.default=Dp});var OT=k(Ba=>{"use strict";var mM=Ba&&Ba.__importDefault||function(r){return r&&r.__esModule?r:{default:r}};Object.defineProperty(Ba,"__esModule",{value:!0});var hM=mM(_e()),gM=H(),ST=ps(),yM=new RegExp("(?\u4E0A|\u4ECA|\u4E0B|\u9019|\u5462)(?:\u500B)?(?:\u661F\u671F|\u79AE\u62DC|\u9031)(?"+Object.keys(ST.WEEKDAY_OFFSET).join("|")+")"),xp=class extends gM.AbstractParserWithWordBoundaryChecking{innerPattern(){return yM}innerExtract(e,t){let n=e.createParsingResult(t.index,t[0]),i=t.groups.weekday,s=ST.WEEKDAY_OFFSET[i];if(s===void 0)return null;let a=null,o=t.groups.prefix;o=="\u4E0A"?a="last":o=="\u4E0B"?a="next":(o=="\u4ECA"||o=="\u9019"||o=="\u5462")&&(a="this");let u=hM.default(e.refDate),l=!1,c=u.day();return a=="last"||a=="past"?(u=u.day(s-7),l=!0):a=="next"?(u=u.day(s+7),l=!0):a=="this"?u=u.day(s):Math.abs(s-7-c){"use strict";var bM=Ha&&Ha.__importDefault||function(r){return r&&r.__esModule?r:{default:r}};Object.defineProperty(Ha,"__esModule",{value:!0});var TM=bM(_e()),_M=H(),pr=ps(),vM=new RegExp("(?:\u7531|\u5F9E|\u81EA)?(?:(\u4ECA|\u660E|\u524D|\u5927\u524D|\u5F8C|\u5927\u5F8C|\u807D|\u6628|\u5C0B|\u7434)(\u65E9|\u671D|\u665A)|(\u4E0A(?:\u5348|\u665D)|\u671D(?:\u65E9)|\u65E9(?:\u4E0A)|\u4E0B(?:\u5348|\u665D)|\u664F(?:\u665D)|\u665A(?:\u4E0A)|\u591C(?:\u665A)?|\u4E2D(?:\u5348)|\u51CC(?:\u6668))|(\u4ECA|\u660E|\u524D|\u5927\u524D|\u5F8C|\u5927\u5F8C|\u807D|\u6628|\u5C0B|\u7434)(?:\u65E5|\u5929)(?:[\\s,\uFF0C]*)(?:(\u4E0A(?:\u5348|\u665D)|\u671D(?:\u65E9)|\u65E9(?:\u4E0A)|\u4E0B(?:\u5348|\u665D)|\u664F(?:\u665D)|\u665A(?:\u4E0A)|\u591C(?:\u665A)?|\u4E2D(?:\u5348)|\u51CC(?:\u6668)))?)?(?:[\\s,\uFF0C]*)(?:(\\d+|["+Object.keys(pr.NUMBER).join("")+"]+)(?:\\s*)(?:\u9EDE|\u6642|:|\uFF1A)(?:\\s*)(\\d+|\u534A|\u6B63|\u6574|["+Object.keys(pr.NUMBER).join("")+"]+)?(?:\\s*)(?:\u5206|:|\uFF1A)?(?:\\s*)(\\d+|["+Object.keys(pr.NUMBER).join("")+"]+)?(?:\\s*)(?:\u79D2)?)(?:\\s*(A.M.|P.M.|AM?|PM?))?","i"),wM=new RegExp("(?:^\\s*(?:\u5230|\u81F3|\\-|\\\u2013|\\~|\\\u301C)\\s*)(?:(\u4ECA|\u660E|\u524D|\u5927\u524D|\u5F8C|\u5927\u5F8C|\u807D|\u6628|\u5C0B|\u7434)(\u65E9|\u671D|\u665A)|(\u4E0A(?:\u5348|\u665D)|\u671D(?:\u65E9)|\u65E9(?:\u4E0A)|\u4E0B(?:\u5348|\u665D)|\u664F(?:\u665D)|\u665A(?:\u4E0A)|\u591C(?:\u665A)?|\u4E2D(?:\u5348)|\u51CC(?:\u6668))|(\u4ECA|\u660E|\u524D|\u5927\u524D|\u5F8C|\u5927\u5F8C|\u807D|\u6628|\u5C0B|\u7434)(?:\u65E5|\u5929)(?:[\\s,\uFF0C]*)(?:(\u4E0A(?:\u5348|\u665D)|\u671D(?:\u65E9)|\u65E9(?:\u4E0A)|\u4E0B(?:\u5348|\u665D)|\u664F(?:\u665D)|\u665A(?:\u4E0A)|\u591C(?:\u665A)?|\u4E2D(?:\u5348)|\u51CC(?:\u6668)))?)?(?:[\\s,\uFF0C]*)(?:(\\d+|["+Object.keys(pr.NUMBER).join("")+"]+)(?:\\s*)(?:\u9EDE|\u6642|:|\uFF1A)(?:\\s*)(\\d+|\u534A|\u6B63|\u6574|["+Object.keys(pr.NUMBER).join("")+"]+)?(?:\\s*)(?:\u5206|:|\uFF1A)?(?:\\s*)(\\d+|["+Object.keys(pr.NUMBER).join("")+"]+)?(?:\\s*)(?:\u79D2)?)(?:\\s*(A.M.|P.M.|AM?|PM?))?","i"),Mu=1,Cu=2,Au=3,Pu=4,Nu=5,Iu=6,fr=7,ms=8,Fu=9,Rp=class extends _M.AbstractParserWithWordBoundaryChecking{innerPattern(){return vM}innerExtract(e,t){if(t.index>0&&e.text[t.index-1].match(/\w/))return null;let n=TM.default(e.refDate),i=e.createParsingResult(t.index,t[0]),s=n.clone();if(t[Mu]){var a=t[Mu];a=="\u660E"||a=="\u807D"?n.hour()>1&&s.add(1,"day"):a=="\u6628"||a=="\u5C0B"||a=="\u7434"?s.add(-1,"day"):a=="\u524D"?s.add(-2,"day"):a=="\u5927\u524D"?s.add(-3,"day"):a=="\u5F8C"?s.add(2,"day"):a=="\u5927\u5F8C"&&s.add(3,"day"),i.start.assign("day",s.date()),i.start.assign("month",s.month()+1),i.start.assign("year",s.year())}else if(t[Pu]){var o=t[Pu];o=="\u660E"||o=="\u807D"?s.add(1,"day"):o=="\u6628"||o=="\u5C0B"||o=="\u7434"?s.add(-1,"day"):o=="\u524D"?s.add(-2,"day"):o=="\u5927\u524D"?s.add(-3,"day"):o=="\u5F8C"?s.add(2,"day"):o=="\u5927\u5F8C"&&s.add(3,"day"),i.start.assign("day",s.date()),i.start.assign("month",s.month()+1),i.start.assign("year",s.year())}else i.start.imply("day",s.date()),i.start.imply("month",s.month()+1),i.start.imply("year",s.year());let u=0,l=0,c=-1;if(t[ms]){var d=parseInt(t[ms]);if(isNaN(d)&&(d=pr.zhStringToNumber(t[ms])),d>=60)return null;i.start.assign("second",d)}if(u=parseInt(t[Iu]),isNaN(u)&&(u=pr.zhStringToNumber(t[Iu])),t[fr]?t[fr]=="\u534A"?l=30:t[fr]=="\u6B63"||t[fr]=="\u6574"?l=0:(l=parseInt(t[fr]),isNaN(l)&&(l=pr.zhStringToNumber(t[fr]))):u>100&&(l=u%100,u=Math.floor(u/100)),l>=60||u>24)return null;if(u>=12&&(c=1),t[Fu]){if(u>12)return null;var p=t[Fu][0].toLowerCase();p=="a"&&(c=0,u==12&&(u=0)),p=="p"&&(c=1,u!=12&&(u+=12))}else if(t[Cu]){var m=t[Cu],b=m[0];b=="\u671D"||b=="\u65E9"?(c=0,u==12&&(u=0)):b=="\u665A"&&(c=1,u!=12&&(u+=12))}else if(t[Au]){var g=t[Au],E=g[0];E=="\u4E0A"||E=="\u671D"||E=="\u65E9"||E=="\u51CC"?(c=0,u==12&&(u=0)):(E=="\u4E0B"||E=="\u664F"||E=="\u665A")&&(c=1,u!=12&&(u+=12))}else if(t[Nu]){var R=t[Nu],x=R[0];x=="\u4E0A"||x=="\u671D"||x=="\u65E9"||x=="\u51CC"?(c=0,u==12&&(u=0)):(x=="\u4E0B"||x=="\u664F"||x=="\u665A")&&(c=1,u!=12&&(u+=12))}if(i.start.assign("hour",u),i.start.assign("minute",l),c>=0?i.start.assign("meridiem",c):u<12?i.start.imply("meridiem",0):i.start.imply("meridiem",1),t=wM.exec(e.text.substring(i.index+i.text.length)),!t)return i.text.match(/^\d+$/)?null:i;let v=s.clone();if(i.end=e.createParsingComponents(),t[Mu]){var a=t[Mu];a=="\u660E"||a=="\u807D"?n.hour()>1&&v.add(1,"day"):a=="\u6628"||a=="\u5C0B"||a=="\u7434"?v.add(-1,"day"):a=="\u524D"?v.add(-2,"day"):a=="\u5927\u524D"?v.add(-3,"day"):a=="\u5F8C"?v.add(2,"day"):a=="\u5927\u5F8C"&&v.add(3,"day"),i.end.assign("day",v.date()),i.end.assign("month",v.month()+1),i.end.assign("year",v.year())}else if(t[Pu]){var o=t[Pu];o=="\u660E"||o=="\u807D"?v.add(1,"day"):o=="\u6628"||o=="\u5C0B"||o=="\u7434"?v.add(-1,"day"):o=="\u524D"?v.add(-2,"day"):o=="\u5927\u524D"?v.add(-3,"day"):o=="\u5F8C"?v.add(2,"day"):o=="\u5927\u5F8C"&&v.add(3,"day"),i.end.assign("day",v.date()),i.end.assign("month",v.month()+1),i.end.assign("year",v.year())}else i.end.imply("day",v.date()),i.end.imply("month",v.month()+1),i.end.imply("year",v.year());if(u=0,l=0,c=-1,t[ms]){var d=parseInt(t[ms]);if(isNaN(d)&&(d=pr.zhStringToNumber(t[ms])),d>=60)return null;i.end.assign("second",d)}if(u=parseInt(t[Iu]),isNaN(u)&&(u=pr.zhStringToNumber(t[Iu])),t[fr]?t[fr]=="\u534A"?l=30:t[fr]=="\u6B63"||t[fr]=="\u6574"?l=0:(l=parseInt(t[fr]),isNaN(l)&&(l=pr.zhStringToNumber(t[fr]))):u>100&&(l=u%100,u=Math.floor(u/100)),l>=60||u>24)return null;if(u>=12&&(c=1),t[Fu]){if(u>12)return null;var p=t[Fu][0].toLowerCase();p=="a"&&(c=0,u==12&&(u=0)),p=="p"&&(c=1,u!=12&&(u+=12)),i.start.isCertain("meridiem")||(c==0?(i.start.imply("meridiem",0),i.start.get("hour")==12&&i.start.assign("hour",0)):(i.start.imply("meridiem",1),i.start.get("hour")!=12&&i.start.assign("hour",i.start.get("hour")+12)))}else if(t[Cu]){var m=t[Cu],b=m[0];b=="\u671D"||b=="\u65E9"?(c=0,u==12&&(u=0)):b=="\u665A"&&(c=1,u!=12&&(u+=12))}else if(t[Au]){var g=t[Au],E=g[0];E=="\u4E0A"||E=="\u671D"||E=="\u65E9"||E=="\u51CC"?(c=0,u==12&&(u=0)):(E=="\u4E0B"||E=="\u664F"||E=="\u665A")&&(c=1,u!=12&&(u+=12))}else if(t[Nu]){var R=t[Nu],x=R[0];x=="\u4E0A"||x=="\u671D"||x=="\u65E9"||x=="\u51CC"?(c=0,u==12&&(u=0)):(x=="\u4E0B"||x=="\u664F"||x=="\u665A")&&(c=1,u!=12&&(u+=12))}return i.text=i.text+t[0],i.end.assign("hour",u),i.end.assign("minute",l),c>=0?i.end.assign("meridiem",c):i.start.isCertain("meridiem")&&i.start.get("meridiem")==1&&i.start.get("hour")>u?i.end.imply("meridiem",0):u>12&&i.end.imply("meridiem",1),i.end.date().getTime(){"use strict";var kM=Va&&Va.__importDefault||function(r){return r&&r.__esModule?r:{default:r}};Object.defineProperty(Va,"__esModule",{value:!0});var EM=kM(_e()),SM=H(),xT=ps(),OM=new RegExp("(?:\u661F\u671F|\u79AE\u62DC|\u9031)(?"+Object.keys(xT.WEEKDAY_OFFSET).join("|")+")"),Mp=class extends SM.AbstractParserWithWordBoundaryChecking{innerPattern(){return OM}innerExtract(e,t){let n=e.createParsingResult(t.index,t[0]),i=t.groups.weekday,s=xT.WEEKDAY_OFFSET[i];if(s===void 0)return null;let a=EM.default(e.refDate),o=!1,u=a.day();return Math.abs(s-7-u){"use strict";var DM=za&&za.__importDefault||function(r){return r&&r.__esModule?r:{default:r}};Object.defineProperty(za,"__esModule",{value:!0});var xM=DM(Vr()),Cp=class extends xM.default{patternBetween(){return/^\s*(至|到|\-|\~|~|-|ー)\s*$/i}};za.default=Cp});var CT=k(Ka=>{"use strict";var RM=Ka&&Ka.__importDefault||function(r){return r&&r.__esModule?r:{default:r}};Object.defineProperty(Ka,"__esModule",{value:!0});var MM=RM(pn()),Ap=class extends MM.default{patternBetween(){return/^\s*$/i}};Ka.default=Ap});var AT=k(Ve=>{"use strict";var Tn=Ve&&Ve.__importDefault||function(r){return r&&r.__esModule?r:{default:r}};Object.defineProperty(Ve,"__esModule",{value:!0});Ve.createConfiguration=Ve.createCasualConfiguration=Ve.parseDate=Ve.parse=Ve.strict=Ve.casual=Ve.hant=void 0;var Pp=Or(),CM=Tn(fu()),AM=mn(),PM=Tn(_T()),NM=Tn(wT()),IM=Tn(ET()),FM=Tn(OT()),LM=Tn(DT()),UM=Tn(RT()),WM=Tn(MT()),qM=Tn(CT());Ve.hant=new Pp.Chrono(Np());Ve.casual=new Pp.Chrono(Np());Ve.strict=new Pp.Chrono(Ip());function jM(r,e,t){return Ve.casual.parse(r,e,t)}Ve.parse=jM;function $M(r,e,t){return Ve.casual.parseDate(r,e,t)}Ve.parseDate=$M;function Np(){let r=Ip();return r.parsers.unshift(new PM.default),r}Ve.createCasualConfiguration=Np;function Ip(){let r=AM.includeCommonConfiguration({parsers:[new NM.default,new FM.default,new UM.default,new LM.default,new IM.default],refiners:[new WM.default,new qM.default]});return r.refiners=r.refiners.filter(e=>!(e instanceof CM.default)),r}Ve.createConfiguration=Ip});var FT=k(Qa=>{"use strict";var GM=Qa&&Qa.__importDefault||function(r){return r&&r.__esModule?r:{default:r}};Object.defineProperty(Qa,"__esModule",{value:!0});var YM=GM(_e()),BM=H(),HM=1,PT=2,VM=3,NT=4,IT=5,zM=6,Fp=class extends BM.AbstractParserWithWordBoundaryChecking{innerPattern(e){return new RegExp("(\u73B0\u5728|\u7ACB(?:\u523B|\u5373)|\u5373\u523B)|(\u4ECA|\u660E|\u524D|\u5927\u524D|\u540E|\u5927\u540E|\u6628)(\u65E9|\u665A)|(\u4E0A(?:\u5348)|\u65E9(?:\u4E0A)|\u4E0B(?:\u5348)|\u665A(?:\u4E0A)|\u591C(?:\u665A)?|\u4E2D(?:\u5348)|\u51CC(?:\u6668))|(\u4ECA|\u660E|\u524D|\u5927\u524D|\u540E|\u5927\u540E|\u6628)(?:\u65E5|\u5929)(?:[\\s|,|\uFF0C]*)(?:(\u4E0A(?:\u5348)|\u65E9(?:\u4E0A)|\u4E0B(?:\u5348)|\u665A(?:\u4E0A)|\u591C(?:\u665A)?|\u4E2D(?:\u5348)|\u51CC(?:\u6668)))?","i")}innerExtract(e,t){let n=t.index,i=e.createParsingResult(n,t[0]),s=YM.default(e.refDate),a=s;if(t[HM])i.start.imply("hour",s.hour()),i.start.imply("minute",s.minute()),i.start.imply("second",s.second()),i.start.imply("millisecond",s.millisecond());else if(t[PT]){let o=t[PT],u=t[VM];o=="\u660E"?s.hour()>1&&(a=a.add(1,"day")):o=="\u6628"?a=a.add(-1,"day"):o=="\u524D"?a=a.add(-2,"day"):o=="\u5927\u524D"?a=a.add(-3,"day"):o=="\u540E"?a=a.add(2,"day"):o=="\u5927\u540E"&&(a=a.add(3,"day")),u=="\u65E9"?i.start.imply("hour",6):u=="\u665A"&&(i.start.imply("hour",22),i.start.imply("meridiem",1))}else if(t[NT]){let u=t[NT][0];u=="\u65E9"||u=="\u4E0A"?i.start.imply("hour",6):u=="\u4E0B"?(i.start.imply("hour",15),i.start.imply("meridiem",1)):u=="\u4E2D"?(i.start.imply("hour",12),i.start.imply("meridiem",1)):u=="\u591C"||u=="\u665A"?(i.start.imply("hour",22),i.start.imply("meridiem",1)):u=="\u51CC"&&i.start.imply("hour",0)}else if(t[IT]){let o=t[IT];o=="\u660E"?s.hour()>1&&(a=a.add(1,"day")):o=="\u6628"?a=a.add(-1,"day"):o=="\u524D"?a=a.add(-2,"day"):o=="\u5927\u524D"?a=a.add(-3,"day"):o=="\u540E"?a=a.add(2,"day"):o=="\u5927\u540E"&&(a=a.add(3,"day"));let u=t[zM];if(u){let l=u[0];l=="\u65E9"||l=="\u4E0A"?i.start.imply("hour",6):l=="\u4E0B"?(i.start.imply("hour",15),i.start.imply("meridiem",1)):l=="\u4E2D"?(i.start.imply("hour",12),i.start.imply("meridiem",1)):l=="\u591C"||l=="\u665A"?(i.start.imply("hour",22),i.start.imply("meridiem",1)):l=="\u51CC"&&i.start.imply("hour",0)}}return i.start.assign("day",a.date()),i.start.assign("month",a.month()+1),i.start.assign("year",a.year()),i}};Qa.default=Fp});var hs=k(Ut=>{"use strict";Object.defineProperty(Ut,"__esModule",{value:!0});Ut.zhStringToYear=Ut.zhStringToNumber=Ut.WEEKDAY_OFFSET=Ut.NUMBER=void 0;Ut.NUMBER={\u96F6:0,"\u3007":0,\u4E00:1,\u4E8C:2,\u4E24:2,\u4E09:3,\u56DB:4,\u4E94:5,\u516D:6,\u4E03:7,\u516B:8,\u4E5D:9,\u5341:10};Ut.WEEKDAY_OFFSET={\u5929:0,\u65E5:0,\u4E00:1,\u4E8C:2,\u4E09:3,\u56DB:4,\u4E94:5,\u516D:6};function KM(r){let e=0;for(let t=0;t{"use strict";var XM=Xa&&Xa.__importDefault||function(r){return r&&r.__esModule?r:{default:r}};Object.defineProperty(Xa,"__esModule",{value:!0});var ZM=XM(_e()),JM=H(),ki=hs(),Lp=1,LT=2,Up=3,Wp=class extends JM.AbstractParserWithWordBoundaryChecking{innerPattern(){return new RegExp("(\\d{2,4}|["+Object.keys(ki.NUMBER).join("")+"]{4}|["+Object.keys(ki.NUMBER).join("")+"]{2})?(?:\\s*)(?:\u5E74)?(?:[\\s|,|\uFF0C]*)(\\d{1,2}|["+Object.keys(ki.NUMBER).join("")+"]{1,3})(?:\\s*)(?:\u6708)(?:\\s*)(\\d{1,2}|["+Object.keys(ki.NUMBER).join("")+"]{1,3})?(?:\\s*)(?:\u65E5|\u53F7)?")}innerExtract(e,t){let n=ZM.default(e.refDate),i=e.createParsingResult(t.index,t[0]),s=parseInt(t[LT]);if(isNaN(s)&&(s=ki.zhStringToNumber(t[LT])),i.start.assign("month",s),t[Up]){let a=parseInt(t[Up]);isNaN(a)&&(a=ki.zhStringToNumber(t[Up])),i.start.assign("day",a)}else i.start.imply("day",n.date());if(t[Lp]){let a=parseInt(t[Lp]);isNaN(a)&&(a=ki.zhStringToYear(t[Lp])),i.start.assign("year",a)}else i.start.imply("year",n.year());return i}};Xa.default=Wp});var qT=k(Za=>{"use strict";var eC=Za&&Za.__importDefault||function(r){return r&&r.__esModule?r:{default:r}};Object.defineProperty(Za,"__esModule",{value:!0});var tC=eC(_e()),rC=H(),WT=hs(),nC=new RegExp("(\\d+|["+Object.keys(WT.NUMBER).join("")+"]+|\u534A|\u51E0)(?:\\s*)(?:\u4E2A)?(\u79D2(?:\u949F)?|\u5206\u949F|\u5C0F\u65F6|\u949F|\u65E5|\u5929|\u661F\u671F|\u793C\u62DC|\u6708|\u5E74)(?:(?:\u4E4B|\u8FC7)?\u540E|(?:\u4E4B)?\u5185)","i"),qp=1,iC=2,jp=class extends rC.AbstractParserWithWordBoundaryChecking{innerPattern(){return nC}innerExtract(e,t){let n=e.createParsingResult(t.index,t[0]),i=parseInt(t[qp]);if(isNaN(i)&&(i=WT.zhStringToNumber(t[qp])),isNaN(i)){let u=t[qp];if(u==="\u51E0")i=3;else if(u==="\u534A")i=.5;else return null}let s=tC.default(e.refDate),o=t[iC][0];return o.match(/[日天星礼月年]/)?(o=="\u65E5"||o=="\u5929"?s=s.add(i,"d"):o=="\u661F"||o=="\u793C"?s=s.add(i*7,"d"):o=="\u6708"?s=s.add(i,"month"):o=="\u5E74"&&(s=s.add(i,"year")),n.start.assign("year",s.year()),n.start.assign("month",s.month()+1),n.start.assign("day",s.date()),n):(o=="\u79D2"?s=s.add(i,"second"):o=="\u5206"?s=s.add(i,"minute"):(o=="\u5C0F"||o=="\u949F")&&(s=s.add(i,"hour")),n.start.imply("year",s.year()),n.start.imply("month",s.month()+1),n.start.imply("day",s.date()),n.start.assign("hour",s.hour()),n.start.assign("minute",s.minute()),n.start.assign("second",s.second()),n)}};Za.default=jp});var $T=k(Ja=>{"use strict";var sC=Ja&&Ja.__importDefault||function(r){return r&&r.__esModule?r:{default:r}};Object.defineProperty(Ja,"__esModule",{value:!0});var aC=sC(_e()),oC=H(),jT=hs(),uC=new RegExp("(?\u4E0A|\u4E0B|\u8FD9)(?:\u4E2A)?(?:\u661F\u671F|\u793C\u62DC|\u5468)(?"+Object.keys(jT.WEEKDAY_OFFSET).join("|")+")"),$p=class extends oC.AbstractParserWithWordBoundaryChecking{innerPattern(){return uC}innerExtract(e,t){let n=e.createParsingResult(t.index,t[0]),i=t.groups.weekday,s=jT.WEEKDAY_OFFSET[i];if(s===void 0)return null;let a=null,o=t.groups.prefix;o=="\u4E0A"?a="last":o=="\u4E0B"?a="next":o=="\u8FD9"&&(a="this");let u=aC.default(e.refDate),l=!1,c=u.day();return a=="last"||a=="past"?(u=u.day(s-7),l=!0):a=="next"?(u=u.day(s+7),l=!0):a=="this"?u=u.day(s):Math.abs(s-7-c){"use strict";var lC=eo&&eo.__importDefault||function(r){return r&&r.__esModule?r:{default:r}};Object.defineProperty(eo,"__esModule",{value:!0});var cC=lC(_e()),dC=H(),hr=hs(),fC=new RegExp("(?:\u4ECE|\u81EA)?(?:(\u4ECA|\u660E|\u524D|\u5927\u524D|\u540E|\u5927\u540E|\u6628)(\u65E9|\u671D|\u665A)|(\u4E0A(?:\u5348)|\u65E9(?:\u4E0A)|\u4E0B(?:\u5348)|\u665A(?:\u4E0A)|\u591C(?:\u665A)?|\u4E2D(?:\u5348)|\u51CC(?:\u6668))|(\u4ECA|\u660E|\u524D|\u5927\u524D|\u540E|\u5927\u540E|\u6628)(?:\u65E5|\u5929)(?:[\\s,\uFF0C]*)(?:(\u4E0A(?:\u5348)|\u65E9(?:\u4E0A)|\u4E0B(?:\u5348)|\u665A(?:\u4E0A)|\u591C(?:\u665A)?|\u4E2D(?:\u5348)|\u51CC(?:\u6668)))?)?(?:[\\s,\uFF0C]*)(?:(\\d+|["+Object.keys(hr.NUMBER).join("")+"]+)(?:\\s*)(?:\u70B9|\u65F6|:|\uFF1A)(?:\\s*)(\\d+|\u534A|\u6B63|\u6574|["+Object.keys(hr.NUMBER).join("")+"]+)?(?:\\s*)(?:\u5206|:|\uFF1A)?(?:\\s*)(\\d+|["+Object.keys(hr.NUMBER).join("")+"]+)?(?:\\s*)(?:\u79D2)?)(?:\\s*(A.M.|P.M.|AM?|PM?))?","i"),pC=new RegExp("(?:^\\s*(?:\u5230|\u81F3|\\-|\\\u2013|\\~|\\\u301C)\\s*)(?:(\u4ECA|\u660E|\u524D|\u5927\u524D|\u540E|\u5927\u540E|\u6628)(\u65E9|\u671D|\u665A)|(\u4E0A(?:\u5348)|\u65E9(?:\u4E0A)|\u4E0B(?:\u5348)|\u665A(?:\u4E0A)|\u591C(?:\u665A)?|\u4E2D(?:\u5348)|\u51CC(?:\u6668))|(\u4ECA|\u660E|\u524D|\u5927\u524D|\u540E|\u5927\u540E|\u6628)(?:\u65E5|\u5929)(?:[\\s,\uFF0C]*)(?:(\u4E0A(?:\u5348)|\u65E9(?:\u4E0A)|\u4E0B(?:\u5348)|\u665A(?:\u4E0A)|\u591C(?:\u665A)?|\u4E2D(?:\u5348)|\u51CC(?:\u6668)))?)?(?:[\\s,\uFF0C]*)(?:(\\d+|["+Object.keys(hr.NUMBER).join("")+"]+)(?:\\s*)(?:\u70B9|\u65F6|:|\uFF1A)(?:\\s*)(\\d+|\u534A|\u6B63|\u6574|["+Object.keys(hr.NUMBER).join("")+"]+)?(?:\\s*)(?:\u5206|:|\uFF1A)?(?:\\s*)(\\d+|["+Object.keys(hr.NUMBER).join("")+"]+)?(?:\\s*)(?:\u79D2)?)(?:\\s*(A.M.|P.M.|AM?|PM?))?","i"),Lu=1,Uu=2,Wu=3,qu=4,ju=5,$u=6,mr=7,gs=8,Gu=9,Gp=class extends dC.AbstractParserWithWordBoundaryChecking{innerPattern(){return fC}innerExtract(e,t){if(t.index>0&&e.text[t.index-1].match(/\w/))return null;let n=cC.default(e.refDate),i=e.createParsingResult(t.index,t[0]),s=n.clone();if(t[Lu]){let c=t[Lu];c=="\u660E"?n.hour()>1&&s.add(1,"day"):c=="\u6628"?s.add(-1,"day"):c=="\u524D"?s.add(-2,"day"):c=="\u5927\u524D"?s.add(-3,"day"):c=="\u540E"?s.add(2,"day"):c=="\u5927\u540E"&&s.add(3,"day"),i.start.assign("day",s.date()),i.start.assign("month",s.month()+1),i.start.assign("year",s.year())}else if(t[qu]){let c=t[qu];c=="\u660E"?s.add(1,"day"):c=="\u6628"?s.add(-1,"day"):c=="\u524D"?s.add(-2,"day"):c=="\u5927\u524D"?s.add(-3,"day"):c=="\u540E"?s.add(2,"day"):c=="\u5927\u540E"&&s.add(3,"day"),i.start.assign("day",s.date()),i.start.assign("month",s.month()+1),i.start.assign("year",s.year())}else i.start.imply("day",s.date()),i.start.imply("month",s.month()+1),i.start.imply("year",s.year());let a=0,o=0,u=-1;if(t[gs]){let c=parseInt(t[gs]);if(isNaN(c)&&(c=hr.zhStringToNumber(t[gs])),c>=60)return null;i.start.assign("second",c)}if(a=parseInt(t[$u]),isNaN(a)&&(a=hr.zhStringToNumber(t[$u])),t[mr]?t[mr]=="\u534A"?o=30:t[mr]=="\u6B63"||t[mr]=="\u6574"?o=0:(o=parseInt(t[mr]),isNaN(o)&&(o=hr.zhStringToNumber(t[mr]))):a>100&&(o=a%100,a=Math.floor(a/100)),o>=60||a>24)return null;if(a>=12&&(u=1),t[Gu]){if(a>12)return null;let c=t[Gu][0].toLowerCase();c=="a"&&(u=0,a==12&&(a=0)),c=="p"&&(u=1,a!=12&&(a+=12))}else if(t[Uu]){let d=t[Uu][0];d=="\u65E9"?(u=0,a==12&&(a=0)):d=="\u665A"&&(u=1,a!=12&&(a+=12))}else if(t[Wu]){let d=t[Wu][0];d=="\u4E0A"||d=="\u65E9"||d=="\u51CC"?(u=0,a==12&&(a=0)):(d=="\u4E0B"||d=="\u665A")&&(u=1,a!=12&&(a+=12))}else if(t[ju]){let d=t[ju][0];d=="\u4E0A"||d=="\u65E9"||d=="\u51CC"?(u=0,a==12&&(a=0)):(d=="\u4E0B"||d=="\u665A")&&(u=1,a!=12&&(a+=12))}if(i.start.assign("hour",a),i.start.assign("minute",o),u>=0?i.start.assign("meridiem",u):a<12?i.start.imply("meridiem",0):i.start.imply("meridiem",1),t=pC.exec(e.text.substring(i.index+i.text.length)),!t)return i.text.match(/^\d+$/)?null:i;let l=s.clone();if(i.end=e.createParsingComponents(),t[Lu]){let c=t[Lu];c=="\u660E"?n.hour()>1&&l.add(1,"day"):c=="\u6628"?l.add(-1,"day"):c=="\u524D"?l.add(-2,"day"):c=="\u5927\u524D"?l.add(-3,"day"):c=="\u540E"?l.add(2,"day"):c=="\u5927\u540E"&&l.add(3,"day"),i.end.assign("day",l.date()),i.end.assign("month",l.month()+1),i.end.assign("year",l.year())}else if(t[qu]){let c=t[qu];c=="\u660E"?l.add(1,"day"):c=="\u6628"?l.add(-1,"day"):c=="\u524D"?l.add(-2,"day"):c=="\u5927\u524D"?l.add(-3,"day"):c=="\u540E"?l.add(2,"day"):c=="\u5927\u540E"&&l.add(3,"day"),i.end.assign("day",l.date()),i.end.assign("month",l.month()+1),i.end.assign("year",l.year())}else i.end.imply("day",l.date()),i.end.imply("month",l.month()+1),i.end.imply("year",l.year());if(a=0,o=0,u=-1,t[gs]){let c=parseInt(t[gs]);if(isNaN(c)&&(c=hr.zhStringToNumber(t[gs])),c>=60)return null;i.end.assign("second",c)}if(a=parseInt(t[$u]),isNaN(a)&&(a=hr.zhStringToNumber(t[$u])),t[mr]?t[mr]=="\u534A"?o=30:t[mr]=="\u6B63"||t[mr]=="\u6574"?o=0:(o=parseInt(t[mr]),isNaN(o)&&(o=hr.zhStringToNumber(t[mr]))):a>100&&(o=a%100,a=Math.floor(a/100)),o>=60||a>24)return null;if(a>=12&&(u=1),t[Gu]){if(a>12)return null;let c=t[Gu][0].toLowerCase();c=="a"&&(u=0,a==12&&(a=0)),c=="p"&&(u=1,a!=12&&(a+=12)),i.start.isCertain("meridiem")||(u==0?(i.start.imply("meridiem",0),i.start.get("hour")==12&&i.start.assign("hour",0)):(i.start.imply("meridiem",1),i.start.get("hour")!=12&&i.start.assign("hour",i.start.get("hour")+12)))}else if(t[Uu]){let d=t[Uu][0];d=="\u65E9"?(u=0,a==12&&(a=0)):d=="\u665A"&&(u=1,a!=12&&(a+=12))}else if(t[Wu]){let d=t[Wu][0];d=="\u4E0A"||d=="\u65E9"||d=="\u51CC"?(u=0,a==12&&(a=0)):(d=="\u4E0B"||d=="\u665A")&&(u=1,a!=12&&(a+=12))}else if(t[ju]){let d=t[ju][0];d=="\u4E0A"||d=="\u65E9"||d=="\u51CC"?(u=0,a==12&&(a=0)):(d=="\u4E0B"||d=="\u665A")&&(u=1,a!=12&&(a+=12))}return i.text=i.text+t[0],i.end.assign("hour",a),i.end.assign("minute",o),u>=0?i.end.assign("meridiem",u):i.start.isCertain("meridiem")&&i.start.get("meridiem")==1&&i.start.get("hour")>a?i.end.imply("meridiem",0):a>12&&i.end.imply("meridiem",1),i.end.date().getTime(){"use strict";var mC=to&&to.__importDefault||function(r){return r&&r.__esModule?r:{default:r}};Object.defineProperty(to,"__esModule",{value:!0});var hC=mC(_e()),gC=H(),YT=hs(),yC=new RegExp("(?:\u661F\u671F|\u793C\u62DC|\u5468)(?"+Object.keys(YT.WEEKDAY_OFFSET).join("|")+")"),Yp=class extends gC.AbstractParserWithWordBoundaryChecking{innerPattern(){return yC}innerExtract(e,t){let n=e.createParsingResult(t.index,t[0]),i=t.groups.weekday,s=YT.WEEKDAY_OFFSET[i];if(s===void 0)return null;let a=hC.default(e.refDate),o=!1,u=a.day();return Math.abs(s-7-u){"use strict";var bC=ro&&ro.__importDefault||function(r){return r&&r.__esModule?r:{default:r}};Object.defineProperty(ro,"__esModule",{value:!0});var TC=bC(Vr()),Bp=class extends TC.default{patternBetween(){return/^\s*(至|到|-|~|~|-|ー)\s*$/i}};ro.default=Bp});var VT=k(no=>{"use strict";var _C=no&&no.__importDefault||function(r){return r&&r.__esModule?r:{default:r}};Object.defineProperty(no,"__esModule",{value:!0});var vC=_C(pn()),Hp=class extends vC.default{patternBetween(){return/^\s*$/i}};no.default=Hp});var zT=k(ze=>{"use strict";var _n=ze&&ze.__importDefault||function(r){return r&&r.__esModule?r:{default:r}};Object.defineProperty(ze,"__esModule",{value:!0});ze.createConfiguration=ze.createCasualConfiguration=ze.parseDate=ze.parse=ze.strict=ze.casual=ze.hans=void 0;var Vp=Or(),wC=_n(fu()),kC=mn(),EC=_n(FT()),SC=_n(UT()),OC=_n(qT()),DC=_n($T()),xC=_n(GT()),RC=_n(BT()),MC=_n(HT()),CC=_n(VT());ze.hans=new Vp.Chrono(zp());ze.casual=new Vp.Chrono(zp());ze.strict=new Vp.Chrono(Kp());function AC(r,e,t){return ze.casual.parse(r,e,t)}ze.parse=AC;function PC(r,e,t){return ze.casual.parseDate(r,e,t)}ze.parseDate=PC;function zp(){let r=Kp();return r.parsers.unshift(new EC.default),r}ze.createCasualConfiguration=zp;function Kp(){let r=kC.includeCommonConfiguration({parsers:[new SC.default,new DC.default,new RC.default,new xC.default,new OC.default],refiners:[new MC.default,new CC.default]});return r.refiners=r.refiners.filter(e=>!(e instanceof wC.default)),r}ze.createConfiguration=Kp});var QT=k(Vt=>{"use strict";var KT=Vt&&Vt.__createBinding||(Object.create?function(r,e,t,n){n===void 0&&(n=t),Object.defineProperty(r,n,{enumerable:!0,get:function(){return e[t]}})}:function(r,e,t,n){n===void 0&&(n=t),r[n]=e[t]}),NC=Vt&&Vt.__setModuleDefault||(Object.create?function(r,e){Object.defineProperty(r,"default",{enumerable:!0,value:e})}:function(r,e){r.default=e}),IC=Vt&&Vt.__exportStar||function(r,e){for(var t in r)t!=="default"&&!Object.prototype.hasOwnProperty.call(e,t)&&KT(e,r,t)},FC=Vt&&Vt.__importStar||function(r){if(r&&r.__esModule)return r;var e={};if(r!=null)for(var t in r)t!=="default"&&Object.prototype.hasOwnProperty.call(r,t)&&KT(e,r,t);return NC(e,r),e};Object.defineProperty(Vt,"__esModule",{value:!0});Vt.hans=void 0;IC(AT(),Vt);Vt.hans=FC(zT())});var Wt=k(se=>{"use strict";Object.defineProperty(se,"__esModule",{value:!0});se.parseTimeUnits=se.TIME_UNITS_PATTERN=se.parseYear=se.YEAR_PATTERN=se.parseOrdinalNumberPattern=se.ORDINAL_NUMBER_PATTERN=se.parseNumberPattern=se.NUMBER_PATTERN=se.TIME_UNIT_DICTIONARY=se.ORDINAL_WORD_DICTIONARY=se.INTEGER_WORD_DICTIONARY=se.MONTH_DICTIONARY=se.FULL_MONTH_NAME_DICTIONARY=se.WEEKDAY_DICTIONARY=se.REGEX_PARTS=void 0;var Yu=De(),LC=ft();se.REGEX_PARTS={leftBoundary:"([^\\p{L}\\p{N}_]|^)",rightBoundary:"(?=[^\\p{L}\\p{N}_]|$)",flags:"iu"};se.WEEKDAY_DICTIONARY={\u0432\u043E\u0441\u043A\u0440\u0435\u0441\u0435\u043D\u044C\u0435:0,\u0432\u043E\u0441\u043A\u0440\u0435\u0441\u0435\u043D\u044C\u044F:0,\u0432\u0441\u043A:0,"\u0432\u0441\u043A.":0,\u043F\u043E\u043D\u0435\u0434\u0435\u043B\u044C\u043D\u0438\u043A:1,\u043F\u043E\u043D\u0435\u0434\u0435\u043B\u044C\u043D\u0438\u043A\u0430:1,\u043F\u043D:1,"\u043F\u043D.":1,\u0432\u0442\u043E\u0440\u043D\u0438\u043A:2,\u0432\u0442\u043E\u0440\u043D\u0438\u043A\u0430:2,\u0432\u0442:2,"\u0432\u0442.":2,\u0441\u0440\u0435\u0434\u0430:3,\u0441\u0440\u0435\u0434\u044B:3,\u0441\u0440\u0435\u0434\u0443:3,\u0441\u0440:3,"\u0441\u0440.":3,\u0447\u0435\u0442\u0432\u0435\u0440\u0433:4,\u0447\u0435\u0442\u0432\u0435\u0440\u0433\u0430:4,\u0447\u0442:4,"\u0447\u0442.":4,\u043F\u044F\u0442\u043D\u0438\u0446\u0430:5,\u043F\u044F\u0442\u043D\u0438\u0446\u0443:5,\u043F\u044F\u0442\u043D\u0438\u0446\u044B:5,\u043F\u0442:5,"\u043F\u0442.":5,\u0441\u0443\u0431\u0431\u043E\u0442\u0430:6,\u0441\u0443\u0431\u0431\u043E\u0442\u0443:6,\u0441\u0443\u0431\u0431\u043E\u0442\u044B:6,\u0441\u0431:6,"\u0441\u0431.":6};se.FULL_MONTH_NAME_DICTIONARY={\u044F\u043D\u0432\u0430\u0440\u044C:1,\u044F\u043D\u0432\u0430\u0440\u044F:1,\u044F\u043D\u0432\u0430\u0440\u0435:1,\u0444\u0435\u0432\u0440\u044F\u043B\u044C:2,\u0444\u0435\u0432\u0440\u044F\u043B\u044F:2,\u0444\u0435\u0432\u0440\u044F\u043B\u0435:2,\u043C\u0430\u0440\u0442:3,\u043C\u0430\u0440\u0442\u0430:3,\u043C\u0430\u0440\u0442\u0435:3,\u0430\u043F\u0440\u0435\u043B\u044C:4,\u0430\u043F\u0440\u0435\u043B\u044F:4,\u0430\u043F\u0440\u0435\u043B\u0435:4,\u043C\u0430\u0439:5,\u043C\u0430\u044F:5,\u043C\u0430\u0435:5,\u0438\u044E\u043D\u044C:6,\u0438\u044E\u043D\u044F:6,\u0438\u044E\u043D\u0435:6,\u0438\u044E\u043B\u044C:7,\u0438\u044E\u043B\u044F:7,\u0438\u044E\u043B\u0435:7,\u0430\u0432\u0433\u0443\u0441\u0442:8,\u0430\u0432\u0433\u0443\u0441\u0442\u0430:8,\u0430\u0432\u0433\u0443\u0441\u0442\u0435:8,\u0441\u0435\u043D\u0442\u044F\u0431\u0440\u044C:9,\u0441\u0435\u043D\u0442\u044F\u0431\u0440\u044F:9,\u0441\u0435\u043D\u0442\u044F\u0431\u0440\u0435:9,\u043E\u043A\u0442\u044F\u0431\u0440\u044C:10,\u043E\u043A\u0442\u044F\u0431\u0440\u044F:10,\u043E\u043A\u0442\u044F\u0431\u0440\u0435:10,\u043D\u043E\u044F\u0431\u0440\u044C:11,\u043D\u043E\u044F\u0431\u0440\u044F:11,\u043D\u043E\u044F\u0431\u0440\u0435:11,\u0434\u0435\u043A\u0430\u0431\u0440\u044C:12,\u0434\u0435\u043A\u0430\u0431\u0440\u044F:12,\u0434\u0435\u043A\u0430\u0431\u0440\u0435:12};se.MONTH_DICTIONARY=Object.assign(Object.assign({},se.FULL_MONTH_NAME_DICTIONARY),{\u044F\u043D\u0432:1,"\u044F\u043D\u0432.":1,\u0444\u0435\u0432:2,"\u0444\u0435\u0432.":2,\u043C\u0430\u0440:3,"\u043C\u0430\u0440.":3,\u0430\u043F\u0440:4,"\u0430\u043F\u0440.":4,\u0430\u0432\u0433:8,"\u0430\u0432\u0433.":8,\u0441\u0435\u043D:9,"\u0441\u0435\u043D.":9,\u043E\u043A\u0442:10,"\u043E\u043A\u0442.":10,\u043D\u043E\u044F:11,"\u043D\u043E\u044F.":11,\u0434\u0435\u043A:12,"\u0434\u0435\u043A.":12});se.INTEGER_WORD_DICTIONARY={\u043E\u0434\u0438\u043D:1,\u043E\u0434\u043D\u0430:1,\u043E\u0434\u043D\u043E\u0439:1,\u043E\u0434\u043D\u0443:1,\u0434\u0432\u0435:2,\u0434\u0432\u0430:2,\u0434\u0432\u0443\u0445:2,\u0442\u0440\u0438:3,\u0442\u0440\u0435\u0445:3,\u0442\u0440\u0451\u0445:3,\u0447\u0435\u0442\u044B\u0440\u0435:4,\u0447\u0435\u0442\u044B\u0440\u0435\u0445:4,\u0447\u0435\u0442\u044B\u0440\u0451\u0445:4,\u043F\u044F\u0442\u044C:5,\u043F\u044F\u0442\u0438:5,\u0448\u0435\u0441\u0442\u044C:6,\u0448\u0435\u0441\u0442\u0438:6,\u0441\u0435\u043C\u044C:7,\u0441\u0435\u043C\u0438:7,\u0432\u043E\u0441\u0435\u043C\u044C:8,\u0432\u043E\u0441\u0435\u043C\u044C\u043C\u0438:8,\u0434\u0435\u0432\u044F\u0442\u044C:9,\u0434\u0435\u0432\u044F\u0442\u0438:9,\u0434\u0435\u0441\u044F\u0442\u044C:10,\u0434\u0435\u0441\u044F\u0442\u0438:10,\u043E\u0434\u0438\u043D\u043D\u0430\u0434\u0446\u0430\u0442\u044C:11,\u043E\u0434\u0438\u043D\u043D\u0430\u0434\u0446\u0430\u0442\u0438:11,\u0434\u0432\u0435\u043D\u0430\u0434\u0446\u0430\u0442\u044C:12,\u0434\u0432\u0435\u043D\u0430\u0434\u0446\u0430\u0442\u0438:12};se.ORDINAL_WORD_DICTIONARY={\u043F\u0435\u0440\u0432\u043E\u0435:1,\u043F\u0435\u0440\u0432\u043E\u0433\u043E:1,\u0432\u0442\u043E\u0440\u043E\u0435:2,\u0432\u0442\u043E\u0440\u043E\u0433\u043E:2,\u0442\u0440\u0435\u0442\u044C\u0435:3,\u0442\u0440\u0435\u0442\u044C\u0435\u0433\u043E:3,\u0447\u0435\u0442\u0432\u0435\u0440\u0442\u043E\u0435:4,\u0447\u0435\u0442\u0432\u0435\u0440\u0442\u043E\u0433\u043E:4,\u043F\u044F\u0442\u043E\u0435:5,\u043F\u044F\u0442\u043E\u0433\u043E:5,\u0448\u0435\u0441\u0442\u043E\u0435:6,\u0448\u0435\u0441\u0442\u043E\u0433\u043E:6,\u0441\u0435\u0434\u044C\u043C\u043E\u0435:7,\u0441\u0435\u0434\u044C\u043C\u043E\u0433\u043E:7,\u0432\u043E\u0441\u044C\u043C\u043E\u0435:8,\u0432\u043E\u0441\u044C\u043C\u043E\u0433\u043E:8,\u0434\u0435\u0432\u044F\u0442\u043E\u0435:9,\u0434\u0435\u0432\u044F\u0442\u043E\u0433\u043E:9,\u0434\u0435\u0441\u044F\u0442\u043E\u0435:10,\u0434\u0435\u0441\u044F\u0442\u043E\u0433\u043E:10,\u043E\u0434\u0438\u043D\u043D\u0430\u0434\u0446\u0430\u0442\u043E\u0435:11,\u043E\u0434\u0438\u043D\u043D\u0430\u0434\u0446\u0430\u0442\u043E\u0433\u043E:11,\u0434\u0432\u0435\u043D\u0430\u0434\u0446\u0430\u0442\u043E\u0435:12,\u0434\u0432\u0435\u043D\u0430\u0434\u0446\u0430\u0442\u043E\u0433\u043E:12,\u0442\u0440\u0438\u043D\u0430\u0434\u0446\u0430\u0442\u043E\u0435:13,\u0442\u0440\u0438\u043D\u0430\u0434\u0446\u0430\u0442\u043E\u0433\u043E:13,\u0447\u0435\u0442\u044B\u0440\u043D\u0430\u0434\u0446\u0430\u0442\u043E\u0435:14,\u0447\u0435\u0442\u044B\u0440\u043D\u0430\u0434\u0446\u0430\u0442\u043E\u0433\u043E:14,\u043F\u044F\u0442\u043D\u0430\u0434\u0446\u0430\u0442\u043E\u0435:15,\u043F\u044F\u0442\u043D\u0430\u0434\u0446\u0430\u0442\u043E\u0433\u043E:15,\u0448\u0435\u0441\u0442\u043D\u0430\u0434\u0446\u0430\u0442\u043E\u0435:16,\u0448\u0435\u0441\u0442\u043D\u0430\u0434\u0446\u0430\u0442\u043E\u0433\u043E:16,\u0441\u0435\u043C\u043D\u0430\u0434\u0446\u0430\u0442\u043E\u0435:17,\u0441\u0435\u043C\u043D\u0430\u0434\u0446\u0430\u0442\u043E\u0433\u043E:17,\u0432\u043E\u0441\u0435\u043C\u043D\u0430\u0434\u0446\u0430\u0442\u043E\u0435:18,\u0432\u043E\u0441\u0435\u043C\u043D\u0430\u0434\u0446\u0430\u0442\u043E\u0433\u043E:18,\u0434\u0435\u0432\u044F\u0442\u043D\u0430\u0434\u0446\u0430\u0442\u043E\u0435:19,\u0434\u0435\u0432\u044F\u0442\u043D\u0430\u0434\u0446\u0430\u0442\u043E\u0433\u043E:19,\u0434\u0432\u0430\u0434\u0446\u0430\u0442\u043E\u0435:20,\u0434\u0432\u0430\u0434\u0446\u0430\u0442\u043E\u0433\u043E:20,"\u0434\u0432\u0430\u0434\u0446\u0430\u0442\u044C \u043F\u0435\u0440\u0432\u043E\u0435":21,"\u0434\u0432\u0430\u0434\u0446\u0430\u0442\u044C \u043F\u0435\u0440\u0432\u043E\u0433\u043E":21,"\u0434\u0432\u0430\u0434\u0446\u0430\u0442\u044C \u0432\u0442\u043E\u0440\u043E\u0435":22,"\u0434\u0432\u0430\u0434\u0446\u0430\u0442\u044C \u0432\u0442\u043E\u0440\u043E\u0433\u043E":22,"\u0434\u0432\u0430\u0434\u0446\u0430\u0442\u044C \u0442\u0440\u0435\u0442\u044C\u0435":23,"\u0434\u0432\u0430\u0434\u0446\u0430\u0442\u044C \u0442\u0440\u0435\u0442\u044C\u0435\u0433\u043E":23,"\u0434\u0432\u0430\u0434\u0446\u0430\u0442\u044C \u0447\u0435\u0442\u0432\u0435\u0440\u0442\u043E\u0435":24,"\u0434\u0432\u0430\u0434\u0446\u0430\u0442\u044C \u0447\u0435\u0442\u0432\u0435\u0440\u0442\u043E\u0433\u043E":24,"\u0434\u0432\u0430\u0434\u0446\u0430\u0442\u044C \u043F\u044F\u0442\u043E\u0435":25,"\u0434\u0432\u0430\u0434\u0446\u0430\u0442\u044C \u043F\u044F\u0442\u043E\u0433\u043E":25,"\u0434\u0432\u0430\u0434\u0446\u0430\u0442\u044C \u0448\u0435\u0441\u0442\u043E\u0435":26,"\u0434\u0432\u0430\u0434\u0446\u0430\u0442\u044C \u0448\u0435\u0441\u0442\u043E\u0433\u043E":26,"\u0434\u0432\u0430\u0434\u0446\u0430\u0442\u044C \u0441\u0435\u0434\u044C\u043C\u043E\u0435":27,"\u0434\u0432\u0430\u0434\u0446\u0430\u0442\u044C \u0441\u0435\u0434\u044C\u043C\u043E\u0433\u043E":27,"\u0434\u0432\u0430\u0434\u0446\u0430\u0442\u044C \u0432\u043E\u0441\u044C\u043C\u043E\u0435":28,"\u0434\u0432\u0430\u0434\u0446\u0430\u0442\u044C \u0432\u043E\u0441\u044C\u043C\u043E\u0433\u043E":28,"\u0434\u0432\u0430\u0434\u0446\u0430\u0442\u044C \u0434\u0435\u0432\u044F\u0442\u043E\u0435":29,"\u0434\u0432\u0430\u0434\u0446\u0430\u0442\u044C \u0434\u0435\u0432\u044F\u0442\u043E\u0433\u043E":29,\u0442\u0440\u0438\u0434\u0446\u0430\u0442\u043E\u0435:30,\u0442\u0440\u0438\u0434\u0446\u0430\u0442\u043E\u0433\u043E:30,"\u0442\u0440\u0438\u0434\u0446\u0430\u0442\u044C \u043F\u0435\u0440\u0432\u043E\u0435":31,"\u0442\u0440\u0438\u0434\u0446\u0430\u0442\u044C \u043F\u0435\u0440\u0432\u043E\u0433\u043E":31};se.TIME_UNIT_DICTIONARY={\u0441\u0435\u043A:"second",\u0441\u0435\u043A\u0443\u043D\u0434\u0430:"second",\u0441\u0435\u043A\u0443\u043D\u0434:"second",\u0441\u0435\u043A\u0443\u043D\u0434\u044B:"second",\u0441\u0435\u043A\u0443\u043D\u0434\u0443:"second",\u0441\u0435\u043A\u0443\u043D\u0434\u043E\u0447\u043A\u0430:"second",\u0441\u0435\u043A\u0443\u043D\u0434\u043E\u0447\u043A\u0438:"second",\u0441\u0435\u043A\u0443\u043D\u0434\u043E\u0447\u0435\u043A:"second",\u0441\u0435\u043A\u0443\u043D\u0434\u043E\u0447\u043A\u0443:"second",\u043C\u0438\u043D:"minute",\u043C\u0438\u043D\u0443\u0442\u0430:"minute",\u043C\u0438\u043D\u0443\u0442:"minute",\u043C\u0438\u043D\u0443\u0442\u044B:"minute",\u043C\u0438\u043D\u0443\u0442\u0443:"minute",\u043C\u0438\u043D\u0443\u0442\u043E\u043A:"minute",\u043C\u0438\u043D\u0443\u0442\u043A\u0438:"minute",\u043C\u0438\u043D\u0443\u0442\u043A\u0443:"minute",\u0447\u0430\u0441:"hour",\u0447\u0430\u0441\u043E\u0432:"hour",\u0447\u0430\u0441\u0430:"hour",\u0447\u0430\u0441\u0443:"hour",\u0447\u0430\u0441\u0438\u043A\u043E\u0432:"hour",\u0447\u0430\u0441\u0438\u043A\u0430:"hour",\u0447\u0430\u0441\u0438\u043A\u0435:"hour",\u0447\u0430\u0441\u0438\u043A:"hour",\u0434\u0435\u043D\u044C:"d",\u0434\u043D\u044F:"d",\u0434\u043D\u0435\u0439:"d",\u0441\u0443\u0442\u043E\u043A:"d",\u0441\u0443\u0442\u043A\u0438:"d",\u043D\u0435\u0434\u0435\u043B\u044F:"week",\u043D\u0435\u0434\u0435\u043B\u0435:"week",\u043D\u0435\u0434\u0435\u043B\u0438:"week",\u043D\u0435\u0434\u0435\u043B\u044E:"week",\u043D\u0435\u0434\u0435\u043B\u044C:"week",\u043D\u0435\u0434\u0435\u043B\u044C\u043A\u0435:"week",\u043D\u0435\u0434\u0435\u043B\u044C\u043A\u0438:"week",\u043D\u0435\u0434\u0435\u043B\u0435\u043A:"week",\u043C\u0435\u0441\u044F\u0446:"month",\u043C\u0435\u0441\u044F\u0446\u0435:"month",\u043C\u0435\u0441\u044F\u0446\u0435\u0432:"month",\u043C\u0435\u0441\u044F\u0446\u0430:"month",\u043A\u0432\u0430\u0440\u0442\u0430\u043B:"quarter",\u043A\u0432\u0430\u0440\u0442\u0430\u043B\u0435:"quarter",\u043A\u0432\u0430\u0440\u0442\u0430\u043B\u043E\u0432:"quarter",\u0433\u043E\u0434:"year",\u0433\u043E\u0434\u0430:"year",\u0433\u043E\u0434\u0443:"year",\u0433\u043E\u0434\u043E\u0432:"year",\u043B\u0435\u0442:"year",\u0433\u043E\u0434\u0438\u043A:"year",\u0433\u043E\u0434\u0438\u043A\u0430:"year",\u0433\u043E\u0434\u0438\u043A\u043E\u0432:"year"};se.NUMBER_PATTERN=`(?:${Yu.matchAnyPattern(se.INTEGER_WORD_DICTIONARY)}|[0-9]+|[0-9]+\\.[0-9]+|\u043F\u043E\u043B|\u043D\u0435\u0441\u043A\u043E\u043B\u044C\u043A\u043E|\u043F\u0430\u0440(?:\u044B|\u0443)|\\s{0,3})`;function ZT(r){let e=r.toLowerCase();return se.INTEGER_WORD_DICTIONARY[e]!==void 0?se.INTEGER_WORD_DICTIONARY[e]:e.match(/несколько/)?3:e.match(/пол/)?.5:e.match(/пар/)?2:e===""?1:parseFloat(e)}se.parseNumberPattern=ZT;se.ORDINAL_NUMBER_PATTERN=`(?:${Yu.matchAnyPattern(se.ORDINAL_WORD_DICTIONARY)}|[0-9]{1,2}(?:\u0433\u043E|\u043E\u0433\u043E|\u0435|\u043E\u0435)?)`;function UC(r){let e=r.toLowerCase();return se.ORDINAL_WORD_DICTIONARY[e]!==void 0?se.ORDINAL_WORD_DICTIONARY[e]:(e=e.replace(/(?:st|nd|rd|th)$/i,""),parseInt(e))}se.parseOrdinalNumberPattern=UC;var Qp="(?:\\s+(?:\u0433\u043E\u0434\u0443|\u0433\u043E\u0434\u0430|\u0433\u043E\u0434|\u0433|\u0433.))?";se.YEAR_PATTERN=`(?:[1-9][0-9]{0,3}${Qp}\\s*(?:\u043D.\u044D.|\u0434\u043E \u043D.\u044D.|\u043D. \u044D.|\u0434\u043E \u043D. \u044D.)|[1-2][0-9]{3}${Qp}|[5-9][0-9]${Qp})`;function WC(r){if(/(год|года|г|г.)/i.test(r)&&(r=r.replace(/(год|года|г|г.)/i,"")),/(до н.э.|до н. э.)/i.test(r))return r=r.replace(/(до н.э.|до н. э.)/i,""),-parseInt(r);if(/(н. э.|н.э.)/i.test(r))return r=r.replace(/(н. э.|н.э.)/i,""),parseInt(r);let e=parseInt(r);return LC.findMostLikelyADYear(e)}se.parseYear=WC;var JT=`(${se.NUMBER_PATTERN})\\s{0,3}(${Yu.matchAnyPattern(se.TIME_UNIT_DICTIONARY)})`,XT=new RegExp(JT,"i");se.TIME_UNITS_PATTERN=Yu.repeatedTimeunitPattern("(?:(?:\u043E\u043A\u043E\u043B\u043E|\u043F\u0440\u0438\u043C\u0435\u0440\u043D\u043E)\\s{0,3})?",JT);function qC(r){let e={},t=r,n=XT.exec(t);for(;n;)jC(e,n),t=t.substring(n[0].length).trim(),n=XT.exec(t);return e}se.parseTimeUnits=qC;function jC(r,e){let t=ZT(e[1]),n=se.TIME_UNIT_DICTIONARY[e[2].toLowerCase()];r[n]=t}});var t_=k(Zp=>{"use strict";Object.defineProperty(Zp,"__esModule",{value:!0});var io=Wt(),$C=qe(),GC=H(),e_=`(?:(?:\u043E\u043A\u043E\u043B\u043E|\u043F\u0440\u0438\u043C\u0435\u0440\u043D\u043E)\\s*(?:~\\s*)?)?(${io.TIME_UNITS_PATTERN})${io.REGEX_PARTS.rightBoundary}`,YC=new RegExp(`(?:\u0432 \u0442\u0435\u0447\u0435\u043D\u0438\u0435|\u0432 \u0442\u0435\u0447\u0435\u043D\u0438\u0438)\\s*${e_}`,io.REGEX_PARTS.flags),BC=new RegExp(e_,"i"),Xp=class extends GC.AbstractParserWithWordBoundaryChecking{patternLeftBoundary(){return io.REGEX_PARTS.leftBoundary}innerPattern(e){return e.option.forwardDate?BC:YC}innerExtract(e,t){let n=io.parseTimeUnits(t[1]);return $C.ParsingComponents.createRelativeFromReference(e.reference,n)}};Zp.default=Xp});var a_=k(em=>{"use strict";Object.defineProperty(em,"__esModule",{value:!0});var HC=ft(),so=Wt(),s_=Wt(),Bu=Wt(),VC=De(),zC=H(),KC=new RegExp(`(?:\u0441)?\\s*(${Bu.ORDINAL_NUMBER_PATTERN})(?:\\s{0,3}(?:\u043F\u043E|-|\u2013|\u0434\u043E)?\\s{0,3}(${Bu.ORDINAL_NUMBER_PATTERN}))?(?:-|\\/|\\s{0,3}(?:of)?\\s{0,3})(${VC.matchAnyPattern(so.MONTH_DICTIONARY)})(?:(?:-|\\/|,?\\s{0,3})(${s_.YEAR_PATTERN}(?![^\\s]\\d)))?${so.REGEX_PARTS.rightBoundary}`,so.REGEX_PARTS.flags),r_=1,n_=2,QC=3,i_=4,Jp=class extends zC.AbstractParserWithWordBoundaryChecking{patternLeftBoundary(){return so.REGEX_PARTS.leftBoundary}innerPattern(){return KC}innerExtract(e,t){let n=e.createParsingResult(t.index,t[0]),i=so.MONTH_DICTIONARY[t[QC].toLowerCase()],s=Bu.parseOrdinalNumberPattern(t[r_]);if(s>31)return t.index=t.index+t[r_].length,null;if(n.start.assign("month",i),n.start.assign("day",s),t[i_]){let a=s_.parseYear(t[i_]);n.start.assign("year",a)}else{let a=HC.findYearClosestToRef(e.refDate,s,i);n.start.imply("year",a)}if(t[n_]){let a=Bu.parseOrdinalNumberPattern(t[n_]);n.end=n.start.clone(),n.end.assign("day",a)}return n}};em.default=Jp});var l_=k(rm=>{"use strict";Object.defineProperty(rm,"__esModule",{value:!0});var ao=Wt(),XC=ft(),ZC=De(),u_=Wt(),JC=H(),eA=new RegExp(`((?:\u0432)\\s*)?(${ZC.matchAnyPattern(ao.MONTH_DICTIONARY)})\\s*(?:[,-]?\\s*(${u_.YEAR_PATTERN})?)?(?=[^\\s\\w]|\\s+[^0-9]|\\s+$|$)`,ao.REGEX_PARTS.flags),tA=2,o_=3,tm=class extends JC.AbstractParserWithWordBoundaryChecking{patternLeftBoundary(){return ao.REGEX_PARTS.leftBoundary}innerPattern(){return eA}innerExtract(e,t){let n=t[tA].toLowerCase();if(t[0].length<=3&&!ao.FULL_MONTH_NAME_DICTIONARY[n])return null;let i=e.createParsingResult(t.index,t.index+t[0].length);i.start.imply("day",1);let s=ao.MONTH_DICTIONARY[n];if(i.start.assign("month",s),t[o_]){let a=u_.parseYear(t[o_]);i.start.assign("year",a)}else{let a=XC.findYearClosestToRef(e.refDate,1,s);i.start.imply("year",a)}return i}};rm.default=tm});var d_=k(im=>{"use strict";Object.defineProperty(im,"__esModule",{value:!0});var Hu=Je(),rA=gi(),c_=Wt(),nm=class extends rA.AbstractTimeExpressionParser{constructor(e){super(e)}patternFlags(){return c_.REGEX_PARTS.flags}primaryPatternLeftBoundary(){return"(^|\\s|T|(?:[^\\p{L}\\p{N}_]))"}followingPhase(){return"\\s*(?:\\-|\\\u2013|\\~|\\\u301C|\u0434\u043E|\u0438|\u043F\u043E|\\?)\\s*"}primaryPrefix(){return"(?:(?:\u0432|\u0441)\\s*)??"}primarySuffix(){return`(?:\\s*(?:\u0443\u0442\u0440\u0430|\u0432\u0435\u0447\u0435\u0440\u0430|\u043F\u043E\u0441\u043B\u0435 \u043F\u043E\u043B\u0443\u0434\u043D\u044F))?(?!\\/)${c_.REGEX_PARTS.rightBoundary}`}extractPrimaryTimeComponents(e,t){let n=super.extractPrimaryTimeComponents(e,t);if(n){if(t[0].endsWith("\u0432\u0435\u0447\u0435\u0440\u0430")){let i=n.get("hour");i>=6&&i<12?(n.assign("hour",n.get("hour")+12),n.assign("meridiem",Hu.Meridiem.PM)):i<6&&n.assign("meridiem",Hu.Meridiem.AM)}if(t[0].endsWith("\u043F\u043E\u0441\u043B\u0435 \u043F\u043E\u043B\u0443\u0434\u043D\u044F")){n.assign("meridiem",Hu.Meridiem.PM);let i=n.get("hour");i>=0&&i<=6&&n.assign("hour",n.get("hour")+12)}t[0].endsWith("\u0443\u0442\u0440\u0430")&&(n.assign("meridiem",Hu.Meridiem.AM),n.get("hour")<12&&n.assign("hour",n.get("hour")))}return n}};im.default=nm});var f_=k(am=>{"use strict";Object.defineProperty(am,"__esModule",{value:!0});var Vu=Wt(),nA=qe(),iA=H(),sA=cr(),aA=new RegExp(`(${Vu.TIME_UNITS_PATTERN})\\s{0,5}\u043D\u0430\u0437\u0430\u0434(?=(?:\\W|$))`,Vu.REGEX_PARTS.flags),sm=class extends iA.AbstractParserWithWordBoundaryChecking{patternLeftBoundary(){return Vu.REGEX_PARTS.leftBoundary}innerPattern(){return aA}innerExtract(e,t){let n=Vu.parseTimeUnits(t[1]),i=sA.reverseTimeUnits(n);return nA.ParsingComponents.createRelativeFromReference(e.reference,i)}};am.default=sm});var p_=k(oo=>{"use strict";var oA=oo&&oo.__importDefault||function(r){return r&&r.__esModule?r:{default:r}};Object.defineProperty(oo,"__esModule",{value:!0});var uA=oA(Vr()),om=class extends uA.default{patternBetween(){return/^\s*(и до|и по|до|по|-)\s*$/i}};oo.default=om});var m_=k(uo=>{"use strict";var lA=uo&&uo.__importDefault||function(r){return r&&r.__esModule?r:{default:r}};Object.defineProperty(uo,"__esModule",{value:!0});var cA=lA(pn()),um=class extends cA.default{patternBetween(){return new RegExp("^\\s*(T|\u0432|,|-)?\\s*$")}};uo.default=um});var h_=k(vn=>{"use strict";var dA=vn&&vn.__createBinding||(Object.create?function(r,e,t,n){n===void 0&&(n=t),Object.defineProperty(r,n,{enumerable:!0,get:function(){return e[t]}})}:function(r,e,t,n){n===void 0&&(n=t),r[n]=e[t]}),fA=vn&&vn.__setModuleDefault||(Object.create?function(r,e){Object.defineProperty(r,"default",{enumerable:!0,value:e})}:function(r,e){r.default=e}),pA=vn&&vn.__importStar||function(r){if(r&&r.__esModule)return r;var e={};if(r!=null)for(var t in r)t!=="default"&&Object.prototype.hasOwnProperty.call(r,t)&&dA(e,r,t);return fA(e,r),e};Object.defineProperty(vn,"__esModule",{value:!0});var mA=H(),lo=pA(gn()),lm=Wt(),hA=new RegExp(`(?:\u0441|\u0441\u043E)?\\s*(\u0441\u0435\u0433\u043E\u0434\u043D\u044F|\u0432\u0447\u0435\u0440\u0430|\u0437\u0430\u0432\u0442\u0440\u0430|\u043F\u043E\u0441\u043B\u0435\u0437\u0430\u0432\u0442\u0440\u0430|\u043F\u043E\u0437\u0430\u0432\u0447\u0435\u0440\u0430)${lm.REGEX_PARTS.rightBoundary}`,lm.REGEX_PARTS.flags),cm=class extends mA.AbstractParserWithWordBoundaryChecking{patternLeftBoundary(){return lm.REGEX_PARTS.leftBoundary}innerPattern(e){return hA}innerExtract(e,t){let n=t[1].toLowerCase(),i=e.createParsingComponents();switch(n){case"\u0441\u0435\u0433\u043E\u0434\u043D\u044F":return lo.today(e.reference);case"\u0432\u0447\u0435\u0440\u0430":return lo.yesterday(e.reference);case"\u0437\u0430\u0432\u0442\u0440\u0430":return lo.tomorrow(e.reference);case"\u043F\u043E\u0441\u043B\u0435\u0437\u0430\u0432\u0442\u0440\u0430":return lo.theDayAfter(e.reference,2);case"\u043F\u043E\u0437\u0430\u0432\u0447\u0435\u0440\u0430":return lo.theDayBefore(e.reference,2)}return i}};vn.default=cm});var g_=k(Cr=>{"use strict";var gA=Cr&&Cr.__createBinding||(Object.create?function(r,e,t,n){n===void 0&&(n=t),Object.defineProperty(r,n,{enumerable:!0,get:function(){return e[t]}})}:function(r,e,t,n){n===void 0&&(n=t),r[n]=e[t]}),yA=Cr&&Cr.__setModuleDefault||(Object.create?function(r,e){Object.defineProperty(r,"default",{enumerable:!0,value:e})}:function(r,e){r.default=e}),bA=Cr&&Cr.__importStar||function(r){if(r&&r.__esModule)return r;var e={};if(r!=null)for(var t in r)t!=="default"&&Object.prototype.hasOwnProperty.call(r,t)&&gA(e,r,t);return yA(e,r),e},TA=Cr&&Cr.__importDefault||function(r){return r&&r.__esModule?r:{default:r}};Object.defineProperty(Cr,"__esModule",{value:!0});var _A=H(),Ei=bA(gn()),vA=lr(),wA=TA(_e()),dm=Wt(),kA=new RegExp(`(\u0441\u0435\u0439\u0447\u0430\u0441|\u043F\u0440\u043E\u0448\u043B\u044B\u043C\\s*\u0432\u0435\u0447\u0435\u0440\u043E\u043C|\u043F\u0440\u043E\u0448\u043B\u043E\u0439\\s*\u043D\u043E\u0447\u044C\u044E|\u0441\u043B\u0435\u0434\u0443\u044E\u0449\u0435\u0439\\s*\u043D\u043E\u0447\u044C\u044E|\u0441\u0435\u0433\u043E\u0434\u043D\u044F\\s*\u043D\u043E\u0447\u044C\u044E|\u044D\u0442\u043E\u0439\\s*\u043D\u043E\u0447\u044C\u044E|\u043D\u043E\u0447\u044C\u044E|\u044D\u0442\u0438\u043C \u0443\u0442\u0440\u043E\u043C|\u0443\u0442\u0440\u043E\u043C|\u0443\u0442\u0440\u0430|\u0432\\s*\u043F\u043E\u043B\u0434\u0435\u043D\u044C|\u0432\u0435\u0447\u0435\u0440\u043E\u043C|\u0432\u0435\u0447\u0435\u0440\u0430|\u0432\\s*\u043F\u043E\u043B\u043D\u043E\u0447\u044C)${dm.REGEX_PARTS.rightBoundary}`,dm.REGEX_PARTS.flags),fm=class extends _A.AbstractParserWithWordBoundaryChecking{patternLeftBoundary(){return dm.REGEX_PARTS.leftBoundary}innerPattern(){return kA}innerExtract(e,t){let n=wA.default(e.refDate),i=t[0].toLowerCase(),s=e.createParsingComponents();if(i==="\u0441\u0435\u0439\u0447\u0430\u0441")return Ei.now(e.reference);if(i==="\u0432\u0435\u0447\u0435\u0440\u043E\u043C"||i==="\u0432\u0435\u0447\u0435\u0440\u0430")return Ei.evening(e.reference);if(i.endsWith("\u0443\u0442\u0440\u043E\u043C")||i.endsWith("\u0443\u0442\u0440\u0430"))return Ei.morning(e.reference);if(i.match(/в\s*полдень/))return Ei.noon(e.reference);if(i.match(/прошлой\s*ночью/))return Ei.lastNight(e.reference);if(i.match(/прошлым\s*вечером/))return Ei.yesterdayEvening(e.reference);if(i.match(/следующей\s*ночью/)){let a=n.hour()<22?1:2;n=n.add(a,"day"),vA.assignSimilarDate(s,n),s.imply("hour",0)}return i.match(/в\s*полночь/)||i.endsWith("\u043D\u043E\u0447\u044C\u044E")?Ei.midnight(e.reference):s}};Cr.default=fm});var y_=k(mm=>{"use strict";Object.defineProperty(mm,"__esModule",{value:!0});var co=Wt(),EA=De(),SA=H(),OA=bi(),DA=new RegExp(`(?:(?:,|\\(|\uFF08)\\s*)?(?:\u0432\\s*?)?(?:(\u044D\u0442\u0443|\u044D\u0442\u043E\u0442|\u043F\u0440\u043E\u0448\u043B\u044B\u0439|\u043F\u0440\u043E\u0448\u043B\u0443\u044E|\u0441\u043B\u0435\u0434\u0443\u044E\u0449\u0438\u0439|\u0441\u043B\u0435\u0434\u0443\u044E\u0449\u0443\u044E|\u0441\u043B\u0435\u0434\u0443\u044E\u0449\u0435\u0433\u043E)\\s*)?(${EA.matchAnyPattern(co.WEEKDAY_DICTIONARY)})(?:\\s*(?:,|\\)|\uFF09))?(?:\\s*\u043D\u0430\\s*(\u044D\u0442\u043E\u0439|\u043F\u0440\u043E\u0448\u043B\u043E\u0439|\u0441\u043B\u0435\u0434\u0443\u044E\u0449\u0435\u0439)\\s*\u043D\u0435\u0434\u0435\u043B\u0435)?${co.REGEX_PARTS.rightBoundary}`,co.REGEX_PARTS.flags),xA=1,RA=2,MA=3,pm=class extends SA.AbstractParserWithWordBoundaryChecking{innerPattern(){return DA}patternLeftBoundary(){return co.REGEX_PARTS.leftBoundary}innerExtract(e,t){let n=t[RA].toLowerCase(),i=co.WEEKDAY_DICTIONARY[n],s=t[xA],a=t[MA],o=s||a;o=o||"",o=o.toLowerCase();let u=null;o=="\u043F\u0440\u043E\u0448\u043B\u044B\u0439"||o=="\u043F\u0440\u043E\u0448\u043B\u0443\u044E"||o=="\u043F\u0440\u043E\u0448\u043B\u043E\u0439"?u="last":o=="\u0441\u043B\u0435\u0434\u0443\u044E\u0449\u0438\u0439"||o=="\u0441\u043B\u0435\u0434\u0443\u044E\u0449\u0443\u044E"||o=="\u0441\u043B\u0435\u0434\u0443\u044E\u0449\u0435\u0439"||o=="\u0441\u043B\u0435\u0434\u0443\u044E\u0449\u0435\u0433\u043E"?u="next":(o=="\u044D\u0442\u043E\u0442"||o=="\u044D\u0442\u0443"||o=="\u044D\u0442\u043E\u0439")&&(u="this");let l=OA.toDayJSWeekday(e.refDate,i,u);return e.createParsingComponents().assign("weekday",i).imply("day",l.date()).imply("month",l.month()+1).imply("year",l.year())}};mm.default=pm});var T_=k(po=>{"use strict";var CA=po&&po.__importDefault||function(r){return r&&r.__esModule?r:{default:r}};Object.defineProperty(po,"__esModule",{value:!0});var fo=Wt(),b_=qe(),AA=CA(_e()),PA=H(),NA=De(),IA=new RegExp(`(\u0432 \u043F\u0440\u043E\u0448\u043B\u043E\u043C|\u043D\u0430 \u043F\u0440\u043E\u0448\u043B\u043E\u0439|\u043D\u0430 \u0441\u043B\u0435\u0434\u0443\u044E\u0449\u0435\u0439|\u0432 \u0441\u043B\u0435\u0434\u0443\u044E\u0449\u0435\u043C|\u043D\u0430 \u044D\u0442\u043E\u0439|\u0432 \u044D\u0442\u043E\u043C)\\s*(${NA.matchAnyPattern(fo.TIME_UNIT_DICTIONARY)})(?=\\s*)${fo.REGEX_PARTS.rightBoundary}`,fo.REGEX_PARTS.flags),FA=1,LA=2,hm=class extends PA.AbstractParserWithWordBoundaryChecking{patternLeftBoundary(){return fo.REGEX_PARTS.leftBoundary}innerPattern(){return IA}innerExtract(e,t){let n=t[FA].toLowerCase(),i=t[LA].toLowerCase(),s=fo.TIME_UNIT_DICTIONARY[i];if(n=="\u043D\u0430 \u0441\u043B\u0435\u0434\u0443\u044E\u0449\u0435\u0439"||n=="\u0432 \u0441\u043B\u0435\u0434\u0443\u044E\u0449\u0435\u043C"){let u={};return u[s]=1,b_.ParsingComponents.createRelativeFromReference(e.reference,u)}if(n=="\u0432 \u043F\u0440\u043E\u0448\u043B\u043E\u043C"||n=="\u043D\u0430 \u043F\u0440\u043E\u0448\u043B\u043E\u0439"){let u={};return u[s]=-1,b_.ParsingComponents.createRelativeFromReference(e.reference,u)}let a=e.createParsingComponents(),o=AA.default(e.reference.instant);return s.match(/week/i)?(o=o.add(-o.get("d"),"d"),a.imply("day",o.date()),a.imply("month",o.month()+1),a.imply("year",o.year())):s.match(/month/i)?(o=o.add(-o.date()+1,"d"),a.imply("day",o.date()),a.assign("year",o.year()),a.assign("month",o.month()+1)):s.match(/year/i)&&(o=o.add(-o.date()+1,"d"),o=o.add(-o.month(),"month"),a.imply("day",o.date()),a.imply("month",o.month()+1),a.assign("year",o.year())),a}};po.default=hm});var __=k(ym=>{"use strict";Object.defineProperty(ym,"__esModule",{value:!0});var mo=Wt(),UA=qe(),WA=H(),qA=cr(),jA=new RegExp(`(\u044D\u0442\u0438|\u043F\u043E\u0441\u043B\u0435\u0434\u043D\u0438\u0435|\u043F\u0440\u043E\u0448\u043B\u044B\u0435|\u0441\u043B\u0435\u0434\u0443\u044E\u0449\u0438\u0435|\u043F\u043E\u0441\u043B\u0435|\u0447\u0435\u0440\u0435\u0437|\\+|-)\\s*(${mo.TIME_UNITS_PATTERN})${mo.REGEX_PARTS.rightBoundary}`,mo.REGEX_PARTS.flags),gm=class extends WA.AbstractParserWithWordBoundaryChecking{patternLeftBoundary(){return mo.REGEX_PARTS.leftBoundary}innerPattern(){return jA}innerExtract(e,t){let n=t[1].toLowerCase(),i=mo.parseTimeUnits(t[2]);switch(n){case"\u043F\u043E\u0441\u043B\u0435\u0434\u043D\u0438\u0435":case"\u043F\u0440\u043E\u0448\u043B\u044B\u0435":case"-":i=qA.reverseTimeUnits(i);break}return UA.ParsingComponents.createRelativeFromReference(e.reference,i)}};ym.default=gm});var k_=k(lt=>{"use strict";var zt=lt&<.__importDefault||function(r){return r&&r.__esModule?r:{default:r}};Object.defineProperty(lt,"__esModule",{value:!0});lt.createConfiguration=lt.createCasualConfiguration=lt.parseDate=lt.parse=lt.strict=lt.casual=void 0;var $A=zt(t_()),GA=zt(a_()),YA=zt(l_()),BA=zt(d_()),HA=zt(f_()),VA=zt(p_()),zA=zt(m_()),KA=mn(),QA=zt(h_()),XA=zt(g_()),ZA=zt(y_()),JA=zt(T_()),v_=Or(),eP=zt(Ti()),tP=zt(__());lt.casual=new v_.Chrono(w_());lt.strict=new v_.Chrono(bm(!0));function rP(r,e,t){return lt.casual.parse(r,e,t)}lt.parse=rP;function nP(r,e,t){return lt.casual.parseDate(r,e,t)}lt.parseDate=nP;function w_(){let r=bm(!1);return r.parsers.unshift(new QA.default),r.parsers.unshift(new XA.default),r.parsers.unshift(new YA.default),r.parsers.unshift(new JA.default),r.parsers.unshift(new tP.default),r}lt.createCasualConfiguration=w_;function bm(r=!0){return KA.includeCommonConfiguration({parsers:[new eP.default(!0),new $A.default,new GA.default,new ZA.default,new BA.default(r),new HA.default],refiners:[new zA.default,new VA.default]},r)}lt.createConfiguration=bm});var Je=k(ce=>{"use strict";var iP=ce&&ce.__createBinding||(Object.create?function(r,e,t,n){n===void 0&&(n=t),Object.defineProperty(r,n,{enumerable:!0,get:function(){return e[t]}})}:function(r,e,t,n){n===void 0&&(n=t),r[n]=e[t]}),sP=ce&&ce.__setModuleDefault||(Object.create?function(r,e){Object.defineProperty(r,"default",{enumerable:!0,value:e})}:function(r,e){r.default=e}),zn=ce&&ce.__importStar||function(r){if(r&&r.__esModule)return r;var e={};if(r!=null)for(var t in r)t!=="default"&&Object.prototype.hasOwnProperty.call(r,t)&&iP(e,r,t);return sP(e,r),e};Object.defineProperty(ce,"__esModule",{value:!0});ce.parseDate=ce.parse=ce.casual=ce.strict=ce.ru=ce.zh=ce.nl=ce.pt=ce.ja=ce.fr=ce.de=ce.Meridiem=ce.Chrono=ce.en=void 0;var Tm=zn(Id());ce.en=Tm;var aP=Or();Object.defineProperty(ce,"Chrono",{enumerable:!0,get:function(){return aP.Chrono}});var oP;(function(r){r[r.AM=0]="AM",r[r.PM=1]="PM"})(oP=ce.Meridiem||(ce.Meridiem={}));var uP=zn(Ay());ce.de=uP;var lP=zn(ob());ce.fr=lP;var cP=zn(gb());ce.ja=cP;var dP=zn(Ab());ce.pt=dP;var fP=zn(gT());ce.nl=fP;var pP=zn(QT());ce.zh=pP;var mP=zn(k_());ce.ru=mP;ce.strict=Tm.strict;ce.casual=Tm.casual;function hP(r,e,t){return ce.casual.parse(r,e,t)}ce.parse=hP;function gP(r,e,t){return ce.casual.parseDate(r,e,t)}ce.parseDate=gP});var vv=k((Tv,_v)=>{(function(r){var e=Object.hasOwnProperty,t=Array.isArray?Array.isArray:function(h){return Object.prototype.toString.call(h)==="[object Array]"},n=10,i=typeof process=="object"&&typeof process.nextTick=="function",s=typeof Symbol=="function",a=typeof Reflect=="object",o=typeof setImmediate=="function",u=o?setImmediate:setTimeout,l=s?a&&typeof Reflect.ownKeys=="function"?Reflect.ownKeys:function(f){var h=Object.getOwnPropertyNames(f);return h.push.apply(h,Object.getOwnPropertySymbols(f)),h}:Object.keys;function c(){this._events={},this._conf&&d.call(this,this._conf)}function d(f){f&&(this._conf=f,f.delimiter&&(this.delimiter=f.delimiter),f.maxListeners!==r&&(this._maxListeners=f.maxListeners),f.wildcard&&(this.wildcard=f.wildcard),f.newListener&&(this._newListener=f.newListener),f.removeListener&&(this._removeListener=f.removeListener),f.verboseMemoryLeak&&(this.verboseMemoryLeak=f.verboseMemoryLeak),f.ignoreErrors&&(this.ignoreErrors=f.ignoreErrors),this.wildcard&&(this.listenerTree={}))}function p(f,h){var y="(node) warning: possible EventEmitter memory leak detected. "+f+" listeners added. Use emitter.setMaxListeners() to increase limit.";if(this.verboseMemoryLeak&&(y+=" Event name: "+h+"."),typeof process!="undefined"&&process.emitWarning){var T=new Error(y);T.name="MaxListenersExceededWarning",T.emitter=this,T.count=f,process.emitWarning(T)}else console.error(y),console.trace&&console.trace()}var m=function(f,h,y){var T=arguments.length;switch(T){case 0:return[];case 1:return[f];case 2:return[f,h];case 3:return[f,h,y];default:for(var w=new Array(T);T--;)w[T]=arguments[T];return w}};function b(f,h){for(var y={},T,w=f.length,S=h?h.length:0,M=0;M0;)f=S[_],M.call(P,f,y[f]);this._listeners={},this._listenersCount=0,D()}}});function E(f,h,y,T){var w=Object.assign({},h);if(!f)return w;if(typeof f!="object")throw TypeError("options must be an object");var S=Object.keys(f),M=S.length,P,_,D;function I(ae){throw Error('Invalid "'+P+'" option value'+(ae?". Reason: "+ae:""))}for(var me=0;me0;)if(P===f[_])return S;M(h)}}var v=x(["function"]),V=x(["object","function"]);function $(f,h,y){var T,w,S=0,M,P=new f(function(_,D,I){y=E(y,{timeout:0,overload:!1},{timeout:function(Ee,We){return Ee*=1,(typeof Ee!="number"||Ee<0||!Number.isFinite(Ee))&&We("timeout must be a positive number"),Ee}}),T=!y.overload&&typeof f.prototype.cancel=="function"&&typeof I=="function";function me(){w&&(w=null),S&&(clearTimeout(S),S=0)}var ae=function(Ee){me(),_(Ee)},le=function(Ee){me(),D(Ee)};T?h(ae,le,I):(w=[function(Ee){le(Ee||Error("canceled"))}],h(ae,le,function(Ee){if(M)throw Error("Unable to subscribe on cancel event asynchronously");if(typeof Ee!="function")throw TypeError("onCancel callback must be a function");w.push(Ee)}),M=!0),y.timeout>0&&(S=setTimeout(function(){var Ee=Error("timeout");Ee.code="ETIMEDOUT",S=0,P.cancel(Ee),D(Ee)},y.timeout))});return T||(P.cancel=function(_){if(!!w){for(var D=w.length,I=1;I0;)le=It[P],le!=="_listeners"&&(Qe=Y(f,h,y[le],T+1,w),Qe&&(ae?ae.push.apply(ae,Qe):ae=Qe));return ae}else if(or==="**"){for(bt=T+1===w||T+2===w&&Wn==="*",bt&&y._listeners&&(ae=Y(f,h,y,w,w)),It=l(y),P=It.length;P-- >0;)le=It[P],le!=="_listeners"&&(le==="*"||le==="**"?(y[le]._listeners&&!bt&&(Qe=Y(f,h,y[le],w,w),Qe&&(ae?ae.push.apply(ae,Qe):ae=Qe)),Qe=Y(f,h,y[le],T,w)):le===Wn?Qe=Y(f,h,y[le],T+2,w):Qe=Y(f,h,y[le],T,w),Qe&&(ae?ae.push.apply(ae,Qe):ae=Qe));return ae}else y[or]&&(ae=Y(f,h,y[or],T+1,w));if(Ee=y["*"],Ee&&Y(f,h,Ee,T+1,w),We=y["**"],We)if(T0;)le=It[P],le!=="_listeners"&&(le===Wn?Y(f,h,We[le],T+2,w):le===or?Y(f,h,We[le],T+1,w):(Un={},Un[le]=We[le],Y(f,h,{"**":Un},T+1,w)));else We._listeners?Y(f,h,We,w,w):We["*"]&&We["*"]._listeners&&Y(f,h,We["*"],w,w);return ae}function q(f,h,y){var T=0,w=0,S,M=this.delimiter,P=M.length,_;if(typeof f=="string")if((S=f.indexOf(M))!==-1){_=new Array(5);do _[T++]=f.slice(w,S),w=S+P;while((S=f.indexOf(M,w))!==-1);_[T++]=f.slice(w)}else _=[f],T=1;else _=f,T=f.length;if(T>1){for(S=0;S+10&&D._listeners.length>this._maxListeners&&(D._listeners.warned=!0,p.call(this,D._listeners.length,I))):D._listeners=h,!0;return!0}function de(f,h,y,T){for(var w=l(f),S=w.length,M,P,_,D=f._listeners,I;S-- >0;)P=w[S],M=f[P],P==="_listeners"?_=y:_=y?y.concat(P):[P],I=T||typeof P=="symbol",D&&h.push(I?_:_.join(this.delimiter)),typeof M=="object"&&de.call(this,M,h,_,I);return h}function Te(f){for(var h=l(f),y=h.length,T,w,S;y-- >0;)w=h[y],T=f[w],T&&(S=!0,w!=="_listeners"&&!Te(T)&&delete f[w]);return S}function G(f,h,y){this.emitter=f,this.event=h,this.listener=y}G.prototype.off=function(){return this.emitter.off(this.event,this.listener),this};function N(f,h,y){if(y===!0)w=!0;else if(y===!1)T=!0;else{if(!y||typeof y!="object")throw TypeError("options should be an object or true");var T=y.async,w=y.promisify,S=y.nextTick,M=y.objectify}if(T||S||w){var P=h,_=h._origin||h;if(S&&!i)throw Error("process.nextTick is not supported");w===r&&(w=h.constructor.name==="AsyncFunction"),h=function(){var D=arguments,I=this,me=this.event;return w?S?Promise.resolve():new Promise(function(ae){u(ae)}).then(function(){return I.event=me,P.apply(I,D)}):(S?process.nextTick:u)(function(){I.event=me,P.apply(I,D)})},h._async=!0,h._origin=_}return[h,M?new G(this,f,h):this]}function O(f){this._events={},this._newListener=!1,this._removeListener=!1,this.verboseMemoryLeak=!1,d.call(this,f)}O.EventEmitter2=O,O.prototype.listenTo=function(f,h,y){if(typeof f!="object")throw TypeError("target musts be an object");var T=this;y=E(y,{on:r,off:r,reducers:r},{on:v,off:v,reducers:V});function w(S){if(typeof S!="object")throw TypeError("events must be an object");var M=y.reducers,P=ee.call(T,f),_;P===-1?_=new g(T,f,y):_=T._observers[P];for(var D=l(S),I=D.length,me,ae=typeof M=="function",le=0;le0;)w=y[T],(!f||w._target===f)&&(w.unsubscribe(h),S=!0);return S},O.prototype.delimiter=".",O.prototype.setMaxListeners=function(f){f!==r&&(this._maxListeners=f,this._conf||(this._conf={}),this._conf.maxListeners=f)},O.prototype.getMaxListeners=function(){return this._maxListeners},O.prototype.event="",O.prototype.once=function(f,h,y){return this._once(f,h,!1,y)},O.prototype.prependOnceListener=function(f,h,y){return this._once(f,h,!0,y)},O.prototype._once=function(f,h,y,T){return this._many(f,1,h,y,T)},O.prototype.many=function(f,h,y,T){return this._many(f,h,y,!1,T)},O.prototype.prependMany=function(f,h,y,T){return this._many(f,h,y,!0,T)},O.prototype._many=function(f,h,y,T,w){var S=this;if(typeof y!="function")throw new Error("many only accepts instances of Function");function M(){return--h===0&&S.off(f,M),y.apply(this,arguments)}return M._origin=y,this._on(f,M,T,w)},O.prototype.emit=function(){if(!this._events&&!this._all)return!1;this._events||c.call(this);var f=arguments[0],h,y=this.wildcard,T,w,S,M,P;if(f==="newListener"&&!this._newListener&&!this._events.newListener)return!1;if(y&&(h=f,f!=="newListener"&&f!=="removeListener"&&typeof f=="object")){if(w=f.length,s){for(S=0;S3)for(T=new Array(_-1),M=1;M<_;M++)T[M-1]=arguments[M];for(S=0,w=D.length;S3)for(w=new Array(D-1),P=1;P0&&this._events[f].length>this._maxListeners&&(this._events[f].warned=!0,p.call(this,this._events[f].length,f))):this._events[f]=h,w)},O.prototype.off=function(f,h){if(typeof h!="function")throw new Error("removeListener only takes instances of Function");var y,T=[];if(this.wildcard){var w=typeof f=="string"?f.split(this.delimiter):f.slice();if(T=Y.call(this,null,w,this.listenerTree,0),!T)return this}else{if(!this._events[f])return this;y=this._events[f],T.push({_listeners:y})}for(var S=0;S0){for(T=this._all,h=0,y=T.length;h0;)T=h[y[S]],typeof T=="function"?w.push(T):w.push.apply(w,T);return w}else{if(this.wildcard){if(M=this.listenerTree,!M)return[];var P=[],_=typeof f=="string"?f.split(this.delimiter):f.slice();return Y.call(this,P,_,M,0),P}return h?(T=h[f],T?typeof T=="function"?[T]:T:[]):[]}},O.prototype.eventNames=function(f){var h=this._events;return this.wildcard?de.call(this,this.listenerTree,[],null,f):h?l(h):[]},O.prototype.listenerCount=function(f){return this.listeners(f).length},O.prototype.hasListeners=function(f){if(this.wildcard){var h=[],y=typeof f=="string"?f.split(this.delimiter):f.slice();return Y.call(this,h,y,this.listenerTree,0),h.length>0}var T=this._events,w=this._all;return!!(w&&w.length||T&&(f===r?l(T).length:T[f]))},O.prototype.listenersAny=function(){return this._all?this._all:[]},O.prototype.waitFor=function(f,h){var y=this,T=typeof h;return T==="number"?h={timeout:h}:T==="function"&&(h={filter:h}),h=E(h,{timeout:0,filter:r,handleError:!1,Promise,overload:!1},{filter:v,Promise:R}),$(h.Promise,function(w,S,M){function P(){var _=h.filter;if(!(_&&!_.apply(y,arguments)))if(y.off(f,P),h.handleError){var D=arguments[0];D?S(D):w(m.apply(null,arguments).slice(1))}else w(m.apply(null,arguments))}M(function(){y.off(f,P)}),y._on(f,P,!1)},{timeout:h.timeout,overload:h.overload})};function B(f,h,y){y=E(y,{Promise,timeout:0,overload:!1},{Promise:R});var T=y.Promise;return $(T,function(w,S,M){var P;if(typeof f.addEventListener=="function"){P=function(){w(m.apply(null,arguments))},M(function(){f.removeEventListener(h,P)}),f.addEventListener(h,P,{once:!0});return}var _=function(){D&&f.removeListener("error",D),w(m.apply(null,arguments))},D;h!=="error"&&(D=function(I){f.removeListener(h,_),S(I)},f.once("error",D)),M(function(){D&&f.removeListener("error",D),f.removeListener(h,_)}),f.once(h,_)},{timeout:y.timeout,overload:y.overload})}var U=O.prototype;if(Object.defineProperties(O,{defaultMaxListeners:{get:function(){return U._maxListeners},set:function(f){if(typeof f!="number"||f<0||Number.isNaN(f))throw TypeError("n must be a non-negative number");U._maxListeners=f},enumerable:!0},once:{value:B,writable:!0,configurable:!0}}),Object.defineProperties(U,{_maxListeners:{value:n,writable:!0,configurable:!0},_observers:{value:null,writable:!0,configurable:!0}}),typeof define=="function"&&define.amd)define(function(){return O});else if(typeof Tv=="object")_v.exports=O;else{var Q=new Function("","return this")();Q.EventEmitter2=O}})()});var xw=k(mh=>{"use strict";Object.defineProperty(mh,"__esModule",{value:!0});var Ow=Symbol("MustacheDataPath");function Sw({target:r,propertyName:e}){return[...r[Ow]||[],e]}function Dw(r,e){return typeof r!="object"?r:new Proxy(r,{get(t,n){let i=t[n];if(i===void 0&&!(n in t)){let s=Sw({target:t,propertyName:n});if(e!=null&&e.handleError)return e.handleError(s),i;throw Error(`Missing Mustache data property: ${s.join(" > ")}`)}return i&&typeof i=="object"?(i[Ow]=Sw({target:t,propertyName:n}),Dw(i,e)):i}})}mh.default=Dw});var on=k(qr=>{"use strict";qr.__esModule=!0;qr.Tokens=qr.StructuralCharacters=qr.Operators=void 0;var OI;(function(r){r.AND="AND",r.OR="OR",r.XOR="XOR",r.NOT="NOT"})(OI=qr.Operators||(qr.Operators={}));var DI;(function(r){r.OPEN_PARENTHESIS="(",r.CLOSE_PARENTHESIS=")"})(DI=qr.StructuralCharacters||(qr.StructuralCharacters={}));var xI;(function(r){r.IDENTIFIER="IDENTIFIER",r.OPERATOR="OPERATOR",r.STRUCTURAL_CHARACTER="STRUCTURAL_CHARACTER",r.EOF="EOF",r.COMMENT="COMMENT"})(xI=qr.Tokens||(qr.Tokens={}))});var vh=k(Hs=>{"use strict";Hs.__esModule=!0;Hs.VALID_TOKENS=Hs.OPERATOR_PRECEDENCE=void 0;var je=on();Hs.OPERATOR_PRECEDENCE={NOT:0,XOR:1,AND:2,OR:3};Hs.VALID_TOKENS={identifierOnly:[{name:je.Tokens.IDENTIFIER},{name:je.Tokens.STRUCTURAL_CHARACTER,value:je.StructuralCharacters.OPEN_PARENTHESIS}],identifierOrNot:[{name:je.Tokens.IDENTIFIER},{name:je.Tokens.STRUCTURAL_CHARACTER,value:je.StructuralCharacters.OPEN_PARENTHESIS},{name:je.Tokens.OPERATOR,value:je.Operators.NOT}],binaryOperator:[{name:je.Tokens.OPERATOR,value:je.Operators.AND},{name:je.Tokens.OPERATOR,value:je.Operators.OR},{name:je.Tokens.OPERATOR,value:je.Operators.XOR}],binaryOperatorOrClose:[{name:je.Tokens.OPERATOR,value:je.Operators.AND},{name:je.Tokens.OPERATOR,value:je.Operators.OR},{name:je.Tokens.OPERATOR,value:je.Operators.XOR},{name:je.Tokens.STRUCTURAL_CHARACTER,value:je.StructuralCharacters.CLOSE_PARENTHESIS}]}});var wh=k(St=>{"use strict";St.__esModule=!0;St.ESCAPE_CHARACTER=St.EOL=St.COMMENT_DELIMITER=St.QUOTED_IDENTIFIER_DELIMITER=St.SEPARATORS=St.OPERATORS=St.STRUCTURAL_CHARACTERS=void 0;var Vs=on();St.STRUCTURAL_CHARACTERS={"(":Vs.StructuralCharacters.OPEN_PARENTHESIS,")":Vs.StructuralCharacters.CLOSE_PARENTHESIS};St.OPERATORS={AND:Vs.Operators.AND,OR:Vs.Operators.OR,XOR:Vs.Operators.XOR,NOT:Vs.Operators.NOT};St.SEPARATORS=new Set([32,9,10,13].map(function(r){return String.fromCodePoint(r)}));St.QUOTED_IDENTIFIER_DELIMITER=String.fromCodePoint(34);St.COMMENT_DELIMITER=String.fromCodePoint(35);St.EOL=String.fromCodePoint(10);St.ESCAPE_CHARACTER=String.fromCodePoint(92)});var Nw=k(wr=>{"use strict";var kh=wr&&wr.__assign||function(){return kh=Object.assign||function(r){for(var e,t=1,n=arguments.length;t{"use strict";Wl.__esModule=!0;Wl.lex=void 0;var zs=on(),nr=wh(),Ks=Nw(),AI=function(r){for(var e=null,t=null,n=null,i=0;i{"use strict";var Fw=ir&&ir.__spreadArray||function(r,e,t){if(t||arguments.length===2)for(var n=0,i=e.length,s;n{"use strict";var un=Xs&&Xs.__spreadArray||function(r,e,t){if(t||arguments.length===2)for(var n=0,i=e.length,s;n{"use strict";Ot.__esModule=!0;Ot.throwInvalidExpression=Ot.isOperator=Ot.isIdentifier=Ot.notUtil=Ot.xorUtil=Ot.orUtil=Ot.andUtil=void 0;var qw=on(),WI=function(r,e){return r&&e};Ot.andUtil=WI;var qI=function(r,e){return r||e};Ot.orUtil=qI;var jI=function(r,e){return r!==e};Ot.xorUtil=jI;var $I=function(r){return!r};Ot.notUtil=$I;var GI=function(r){var e=r.name,t=r.value;return e===qw.Tokens.IDENTIFIER&&typeof t=="string"};Ot.isIdentifier=GI;var YI=function(r){var e=r.name,t=r.value;return e===qw.Tokens.OPERATOR&&typeof t=="string"};Ot.isOperator=YI;var BI=function(r){throw new TypeError("Invalid postfix expression: ".concat(r))};Ot.throwInvalidExpression=BI});var jw=k($l=>{"use strict";var qo;$l.__esModule=!0;$l.OPERATOR_MAP=void 0;var Dh=on(),xh=Oh();$l.OPERATOR_MAP=(qo={},qo[Dh.Operators.AND]=xh.andUtil,qo[Dh.Operators.OR]=xh.orUtil,qo[Dh.Operators.XOR]=xh.xorUtil,qo)});var Gw=k(In=>{"use strict";var Zs=In&&In.__spreadArray||function(r,e,t){if(t||arguments.length===2)for(var n=0,i=e.length,s;n{"use strict";var Rh=ln&&ln.__createBinding||(Object.create?function(r,e,t,n){n===void 0&&(n=t);var i=Object.getOwnPropertyDescriptor(e,t);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return e[t]}}),Object.defineProperty(r,n,i)}:function(r,e,t,n){n===void 0&&(n=t),r[n]=e[t]});ln.__esModule=!0;ln.parse=ln.evaluate=ln.getEvaluator=void 0;var Yw=Gw();Rh(ln,Yw,"getEvaluator");Rh(ln,Yw,"evaluate");var QI=Sh();Rh(ln,QI,"parse")});var dF={};Kk(dF,{default:()=>yc});module.exports=Qk(dF);var Mk=require("obsidian");var Ss=require("obsidian");var pF=new Error("timeout while waiting for mutex to become available"),mF=new Error("mutex already locked"),Xk=new Error("request for lock canceled"),Zk=function(r,e,t,n){function i(s){return s instanceof t?s:new t(function(a){a(s)})}return new(t||(t=Promise))(function(s,a){function o(c){try{l(n.next(c))}catch(d){a(d)}}function u(c){try{l(n.throw(c))}catch(d){a(d)}}function l(c){c.done?s(c.value):i(c.value).then(o,u)}l((n=n.apply(r,e||[])).next())})},Rc=class{constructor(e,t=Xk){this._value=e,this._cancelError=t,this._weightedQueues=[],this._weightedWaiters=[]}acquire(e=1){if(e<=0)throw new Error(`invalid weight ${e}: must be positive`);return new Promise((t,n)=>{this._weightedQueues[e-1]||(this._weightedQueues[e-1]=[]),this._weightedQueues[e-1].push({resolve:t,reject:n}),this._dispatch()})}runExclusive(e,t=1){return Zk(this,void 0,void 0,function*(){let[n,i]=yield this.acquire(t);try{return yield e(n)}finally{i()}})}waitForUnlock(e=1){if(e<=0)throw new Error(`invalid weight ${e}: must be positive`);return new Promise(t=>{this._weightedWaiters[e-1]||(this._weightedWaiters[e-1]=[]),this._weightedWaiters[e-1].push(t),this._dispatch()})}isLocked(){return this._value<=0}getValue(){return this._value}setValue(e){this._value=e,this._dispatch()}release(e=1){if(e<=0)throw new Error(`invalid weight ${e}: must be positive`);this._value+=e,this._dispatch()}cancel(){this._weightedQueues.forEach(e=>e.forEach(t=>t.reject(this._cancelError))),this._weightedQueues=[]}_dispatch(){var e;for(let t=this._value;t>0;t--){let n=(e=this._weightedQueues[t-1])===null||e===void 0?void 0:e.shift();if(!n)continue;let i=this._value,s=t;this._value-=t,t=this._value+1,n.resolve([i,this._newReleaser(s)])}this._drainUnlockWaiters()}_newReleaser(e){let t=!1;return()=>{t||(t=!0,this.release(e))}}_drainUnlockWaiters(){for(let e=this._value;e>0;e--)!this._weightedWaiters[e-1]||(this._weightedWaiters[e-1].forEach(t=>t()),this._weightedWaiters[e-1]=[])}},Jk=function(r,e,t,n){function i(s){return s instanceof t?s:new t(function(a){a(s)})}return new(t||(t=Promise))(function(s,a){function o(c){try{l(n.next(c))}catch(d){a(d)}}function u(c){try{l(n.throw(c))}catch(d){a(d)}}function l(c){c.done?s(c.value):i(c.value).then(o,u)}l((n=n.apply(r,e||[])).next())})},ru=class{constructor(e){this._semaphore=new Rc(1,e)}acquire(){return Jk(this,void 0,void 0,function*(){let[,e]=yield this._semaphore.acquire();return e})}runExclusive(e){return this._semaphore.runExclusive(()=>e())}isLocked(){return this._semaphore.isLocked()}waitForUnlock(){return this._semaphore.waitForUnlock()}release(){this._semaphore.isLocked()&&this._semaphore.release()}cancel(){return this._semaphore.cancel()}};var zu=pa(Je());var Ct=class{constructor(e,t){this.start=e,this.end=t,t.isBefore(e)&&(this.start=t,this.end=e),this.start=this.start.startOf("day"),this.end=this.end.startOf("day")}static buildRelative(e){let t=e==="week"?"isoWeek":e;return new Ct(window.moment().startOf(t).startOf("day"),window.moment().endOf(t).startOf("day"))}static buildInvalid(){return new Ct(window.moment.invalid(),window.moment.invalid())}isValid(){return this.start.isValid()&&this.end.isValid()}moveToPrevious(e){let t=window.moment.duration(1,e);this.start.subtract(t),this.end.subtract(t),(e==="month"||e==="quarter")&&(this.end=this.end.endOf(e).startOf("day"))}moveToNext(e){let t=window.moment.duration(1,e);this.start.add(t),this.end.add(t),(e==="month"||e==="quarter")&&(this.end=this.end.endOf(e).startOf("day"))}};var Kt=class{static parseDate(e,t=!1){return window.moment(zu.parseDate(e,void 0,{forwardDate:t})).startOf("day")}static parseDateRange(e,t=!1){let n=[Kt.parseRelativeDateRange,Kt.parseNumberedDateRange,Kt.parseAbsoluteDateRange];for(let i of n){let s=i(e,t);if(s.isValid())return s}return Ct.buildInvalid()}static parseAbsoluteDateRange(e,t){let n=zu.parse(e,void 0,{forwardDate:t});if(n.length===0)return Ct.buildInvalid();let i=n[0].start,s=n[1]&&n[1].start?n[1].start:i,a=window.moment(i.date()),o=window.moment(s.date());return new Ct(a,o)}static parseRelativeDateRange(e,t){let n=/(last|this|next) (week|month|quarter|year)/,i=e.match(n);if(i&&i.length===3){let s=i[1],a=i[2],o=Ct.buildRelative(a);switch(s){case"last":o.moveToPrevious(a);break;case"next":o.moveToNext(a);break}return o}return Ct.buildInvalid()}static parseNumberedDateRange(e,t){let n=[[/^\s*[0-9]{4}\s*$/,"YYYY","year"],[/^\s*[0-9]{4}-Q[1-4]\s*$/,"YYYY-Q","quarter"],[/^\s*[0-9]{4}-[0-9]{2}\s*$/,"YYYY-MM","month"],[/^\s*[0-9]{4}-W[0-9]{2}\s*$/,"YYYY-WW","isoWeek"]];for(let[i,s,a]of n){let o=e.match(i);if(o){let u=o[0].trim();return new Ct(window.moment(u,s).startOf(a),window.moment(u,s).endOf(a))}}return Ct.buildInvalid()}};var yP={td:"today",tm:"tomorrow",yd:"yesterday",tw:"this week",nw:"next week",weekend:"sat",we:"sat"};function Ku(r){for(let[e,t]of Object.entries(yP))r=r.replace(RegExp(`\\b${e}\\s`,"i"),t);return r}var Qu=["MO","TU","WE","TH","FR","SA","SU"],Ke=function(){function r(e,t){if(t===0)throw new Error("Can't create weekday with n == 0");this.weekday=e,this.n=t}return r.fromStr=function(e){return new r(Qu.indexOf(e))},r.prototype.nth=function(e){return this.n===e?this:new r(this.weekday,e)},r.prototype.equals=function(e){return this.weekday===e.weekday&&this.n===e.n},r.prototype.toString=function(){var e=Qu[this.weekday];return this.n&&(e=(this.n>0?"+":"")+String(this.n)+e),e},r.prototype.getJsWeekday=function(){return this.weekday===6?0:this.weekday+1},r}();var Pe=function(r){return r!=null},Qt=function(r){return typeof r=="number"},_m=function(r){return typeof r=="string"&&Qu.includes(r)},ht=Array.isArray,gr=function(r,e){e===void 0&&(e=r),arguments.length===1&&(e=r,r=0);for(var t=[],n=r;n>0,n.length>e?String(n):(e=e-n.length,e>t.length&&(t+=he(t,e/t.length)),t.slice(0,e)+String(n))}var S_=function(r,e,t){var n=r.split(e);return t?n.slice(0,t).concat([n.slice(t).join(e)]):n},Tt=function(r,e){var t=r%e;return t*e<0?t+e:t},Xu=function(r,e){return{div:Math.floor(r/e),mod:Tt(r,e)}},Xt=function(r){return!Pe(r)||r.length===0},Ge=function(r){return!Xt(r)},ge=function(r,e){return Ge(r)&&r.indexOf(e)!==-1};var Qr=function(r,e,t,n,i,s){return n===void 0&&(n=0),i===void 0&&(i=0),s===void 0&&(s=0),new Date(Date.UTC(r,e-1,t,n,i,s))},bP=[31,28,31,30,31,30,31,31,30,31,30,31],x_=1e3*60*60*24,Zu=9999,R_=Qr(1970,1,1),TP=[6,0,1,2,3,4,5];var ys=function(r){return r%4===0&&r%100!==0||r%400===0},vm=function(r){return r instanceof Date},Oi=function(r){return vm(r)&&!isNaN(r.getTime())},O_=function(r){return r.getTimezoneOffset()*60*1e3},_P=function(r,e){var t=r.getTime()-O_(r),n=e.getTime()-O_(e),i=t-n;return Math.round(i/x_)},ho=function(r){return _P(r,R_)},Ju=function(r){return new Date(R_.getTime()+r*x_)},vP=function(r){var e=r.getUTCMonth();return e===1&&ys(r.getUTCFullYear())?29:bP[e]},wn=function(r){return TP[r.getUTCDay()]},wm=function(r,e){var t=Qr(r,e+1,1);return[wn(t),vP(t)]},el=function(r,e){return e=e||r,new Date(Date.UTC(r.getUTCFullYear(),r.getUTCMonth(),r.getUTCDate(),e.getHours(),e.getMinutes(),e.getSeconds(),e.getMilliseconds()))},tl=function(r){var e=new Date(r.getTime());return e},km=function(r){for(var e=[],t=0;tthis.maxDate;if(this.method==="between"){if(t)return!0;if(n)return!1}else if(this.method==="before"){if(n)return!1}else if(this.method==="after")return t?!0:(this.add(e),!1);return this.add(e)},r.prototype.add=function(e){return this._result.push(e),!0},r.prototype.getValue=function(){var e=this._result;switch(this.method){case"all":case"between":return e;case"before":case"after":default:return e.length?e[e.length-1]:null}},r.prototype.clone=function(){return new r(this.method,this.args)},r}(),En=wP;var Em=function(r,e){return Em=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,n){t.__proto__=n}||function(t,n){for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(t[i]=n[i])},Em(r,e)};function Ts(r,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");Em(r,e);function t(){this.constructor=r}r.prototype=e===null?Object.create(e):(t.prototype=e.prototype,new t)}var gt=function(){return gt=Object.assign||function(e){for(var t,n=1,i=arguments.length;ne[0].length)&&(e=s,t=i)}if(e!=null&&(this.text=this.text.substr(e[0].length),this.text===""&&(this.done=!0)),e==null){this.done=!0,this.symbol=null,this.value=null;return}}while(t==="SKIP");return this.symbol=t,this.value=e,!0},r.prototype.accept=function(e){if(this.symbol===e){if(this.value){var t=this.value;return this.nextSymbol(),t}return this.nextSymbol(),!0}return!1},r.prototype.acceptNumber=function(){return this.accept("number")},r.prototype.expect=function(e){if(this.accept(e))return!0;throw new Error("expected "+e+" but found "+this.symbol)},r}();function yo(r,e){e===void 0&&(e=Di);var t={},n=new xP(e.tokens);if(!n.start(r))return null;return i(),t;function i(){n.expect("every");var p=n.acceptNumber();if(p&&(t.interval=parseInt(p[0],10)),n.isDone())throw new Error("Unexpected end");switch(n.symbol){case"day(s)":t.freq=z.DAILY,n.nextSymbol()&&(a(),d());break;case"weekday(s)":t.freq=z.WEEKLY,t.byweekday=[z.MO,z.TU,z.WE,z.TH,z.FR],n.nextSymbol(),d();break;case"week(s)":t.freq=z.WEEKLY,n.nextSymbol()&&(s(),d());break;case"hour(s)":t.freq=z.HOURLY,n.nextSymbol()&&(s(),d());break;case"minute(s)":t.freq=z.MINUTELY,n.nextSymbol()&&(s(),d());break;case"month(s)":t.freq=z.MONTHLY,n.nextSymbol()&&(s(),d());break;case"year(s)":t.freq=z.YEARLY,n.nextSymbol()&&(s(),d());break;case"monday":case"tuesday":case"wednesday":case"thursday":case"friday":case"saturday":case"sunday":t.freq=z.WEEKLY;var m=n.symbol.substr(0,2).toUpperCase();if(t.byweekday=[z[m]],!n.nextSymbol())return;for(;n.accept("comma");){if(n.isDone())throw new Error("Unexpected end");var b=u();if(!b)throw new Error("Unexpected symbol "+n.symbol+", expected weekday");t.byweekday.push(z[b]),n.nextSymbol()}c(),d();break;case"january":case"february":case"march":case"april":case"may":case"june":case"july":case"august":case"september":case"october":case"november":case"december":if(t.freq=z.YEARLY,t.bymonth=[o()],!n.nextSymbol())return;for(;n.accept("comma");){if(n.isDone())throw new Error("Unexpected end");var g=o();if(!g)throw new Error("Unexpected symbol "+n.symbol+", expected month");t.bymonth.push(g),n.nextSymbol()}s(),d();break;default:throw new Error("Unknown symbol")}}function s(){var p=n.accept("on"),m=n.accept("the");if(!!(p||m))do{var b=l(),g=u(),E=o();if(b)g?(n.nextSymbol(),t.byweekday||(t.byweekday=[]),t.byweekday.push(z[g].nth(b))):(t.bymonthday||(t.bymonthday=[]),t.bymonthday.push(b),n.accept("day(s)"));else if(g)n.nextSymbol(),t.byweekday||(t.byweekday=[]),t.byweekday.push(z[g]);else if(n.symbol==="weekday(s)")n.nextSymbol(),t.byweekday||(t.byweekday=[z.MO,z.TU,z.WE,z.TH,z.FR]);else if(n.symbol==="week(s)"){n.nextSymbol();var R=n.acceptNumber();if(!R)throw new Error("Unexpected symbol "+n.symbol+", expected week number");for(t.byweekno=[parseInt(R[0],10)];n.accept("comma");){if(R=n.acceptNumber(),!R)throw new Error("Unexpected symbol "+n.symbol+"; expected monthday");t.byweekno.push(parseInt(R[0],10))}}else if(E)n.nextSymbol(),t.bymonth||(t.bymonth=[]),t.bymonth.push(E);else return}while(n.accept("comma")||n.accept("the")||n.accept("on"))}function a(){var p=n.accept("at");if(!!p)do{var m=n.acceptNumber();if(!m)throw new Error("Unexpected symbol "+n.symbol+", expected hour");for(t.byhour=[parseInt(m[0],10)];n.accept("comma");){if(m=n.acceptNumber(),!m)throw new Error("Unexpected symbol "+n.symbol+"; expected hour");t.byhour.push(parseInt(m[0],10))}}while(n.accept("comma")||n.accept("at"))}function o(){switch(n.symbol){case"january":return 1;case"february":return 2;case"march":return 3;case"april":return 4;case"may":return 5;case"june":return 6;case"july":return 7;case"august":return 8;case"september":return 9;case"october":return 10;case"november":return 11;case"december":return 12;default:return!1}}function u(){switch(n.symbol){case"monday":case"tuesday":case"wednesday":case"thursday":case"friday":case"saturday":case"sunday":return n.symbol.substr(0,2).toUpperCase();default:return!1}}function l(){switch(n.symbol){case"last":return n.nextSymbol(),-1;case"first":return n.nextSymbol(),1;case"second":return n.nextSymbol(),n.accept("last")?-2:2;case"third":return n.nextSymbol(),n.accept("last")?-3:3;case"nth":var p=parseInt(n.value[1],10);if(p<-366||p>366)throw new Error("Nth out of range: "+p);return n.nextSymbol(),n.accept("last")?-p:p;default:return!1}}function c(){n.accept("on"),n.accept("the");var p=l();if(!!p)for(t.bymonthday=[p],n.nextSymbol();n.accept("comma");){if(p=l(),!p)throw new Error("Unexpected symbol "+n.symbol+"; expected monthday");t.bymonthday.push(p),n.nextSymbol()}}function d(){if(n.symbol==="until"){var p=Date.parse(n.text);if(!p)throw new Error("Cannot parse until date:"+n.text);t.until=new Date(p)}else n.accept("for")&&(t.count=parseInt(n.value[0],10),n.expect("number"))}}var fe;(function(r){r[r.YEARLY=0]="YEARLY",r[r.MONTHLY=1]="MONTHLY",r[r.WEEKLY=2]="WEEKLY",r[r.DAILY=3]="DAILY",r[r.HOURLY=4]="HOURLY",r[r.MINUTELY=5]="MINUTELY",r[r.SECONDLY=6]="SECONDLY"})(fe||(fe={}));function bo(r){return r12){var n=Math.floor(this.month/12),i=Tt(this.month,12);this.month=i,this.year+=n,this.month===0&&(this.month=12,--this.year)}},e.prototype.addWeekly=function(t,n){n>this.getWeekday()?this.day+=-(this.getWeekday()+1+(6-n))+t*7:this.day+=-(this.getWeekday()-n)+t*7,this.fixDay()},e.prototype.addDaily=function(t){this.day+=t,this.fixDay()},e.prototype.addHours=function(t,n,i){for(n&&(this.hour+=Math.floor((23-this.hour)/t)*t);;){this.hour+=t;var s=Xu(this.hour,24),a=s.div,o=s.mod;if(a&&(this.hour=o,this.addDaily(a)),Xt(i)||ge(i,this.hour))break}},e.prototype.addMinutes=function(t,n,i,s){for(n&&(this.minute+=Math.floor((1439-(this.hour*60+this.minute))/t)*t);;){this.minute+=t;var a=Xu(this.minute,60),o=a.div,u=a.mod;if(o&&(this.minute=u,this.addHours(o,!1,i)),(Xt(i)||ge(i,this.hour))&&(Xt(s)||ge(s,this.minute)))break}},e.prototype.addSeconds=function(t,n,i,s,a){for(n&&(this.second+=Math.floor((86399-(this.hour*3600+this.minute*60+this.second))/t)*t);;){this.second+=t;var o=Xu(this.second,60),u=o.div,l=o.mod;if(u&&(this.second=l,this.addMinutes(u,!1,i,s)),(Xt(i)||ge(i,this.hour))&&(Xt(s)||ge(s,this.minute))&&(Xt(a)||ge(a,this.second)))break}},e.prototype.fixDay=function(){if(!(this.day<=28)){var t=wm(this.year,this.month-1)[1];if(!(this.day<=t))for(;this.day>t;){if(this.day-=t,++this.month,this.month===13&&(this.month=1,++this.year,this.year>Zu))return;t=wm(this.year,this.month-1)[1]}}},e.prototype.add=function(t,n){var i=t.freq,s=t.interval,a=t.wkst,o=t.byhour,u=t.byminute,l=t.bysecond;switch(i){case fe.YEARLY:return this.addYears(s);case fe.MONTHLY:return this.addMonths(s);case fe.WEEKLY:return this.addWeekly(s,a);case fe.DAILY:return this.addDaily(s);case fe.HOURLY:return this.addHours(s,n,o);case fe.MINUTELY:return this.addMinutes(s,n,o,u);case fe.SECONDLY:return this.addSeconds(s,n,o,u,l)}},e}(vs);function Om(r){for(var e=[],t=Object.keys(r),n=0,i=t;n=-366&&n<=366))throw new Error("bysetpos must be between 1 and 366, or between -366 and -1")}}if(!(Boolean(e.byweekno)||Ge(e.byweekno)||Ge(e.byyearday)||Boolean(e.bymonthday)||Ge(e.bymonthday)||Pe(e.byweekday)||Pe(e.byeaster)))switch(e.freq){case z.YEARLY:e.bymonth||(e.bymonth=e.dtstart.getUTCMonth()+1),e.bymonthday=e.dtstart.getUTCDate();break;case z.MONTHLY:e.bymonthday=e.dtstart.getUTCDate();break;case z.WEEKLY:e.byweekday=[wn(e.dtstart)];break}if(Pe(e.bymonth)&&!ht(e.bymonth)&&(e.bymonth=[e.bymonth]),Pe(e.byyearday)&&!ht(e.byyearday)&&Qt(e.byyearday)&&(e.byyearday=[e.byyearday]),!Pe(e.bymonthday))e.bymonthday=[],e.bynmonthday=[];else if(ht(e.bymonthday)){for(var i=[],s=[],t=0;t0?i.push(n):n<0&&s.push(n)}e.bymonthday=i,e.bynmonthday=s}else e.bymonthday<0?(e.bynmonthday=[e.bymonthday],e.bymonthday=[]):(e.bynmonthday=[],e.bymonthday=[e.bymonthday]);if(Pe(e.byweekno)&&!ht(e.byweekno)&&(e.byweekno=[e.byweekno]),!Pe(e.byweekday))e.bynweekday=null;else if(Qt(e.byweekday))e.byweekday=[e.byweekday],e.bynweekday=null;else if(_m(e.byweekday))e.byweekday=[Ke.fromStr(e.byweekday).weekday],e.bynweekday=null;else if(e.byweekday instanceof Ke)!e.byweekday.n||e.freq>z.MONTHLY?(e.byweekday=[e.byweekday.weekday],e.bynweekday=null):(e.bynweekday=[[e.byweekday.weekday,e.byweekday.n]],e.byweekday=null);else{for(var a=[],o=[],t=0;tz.MONTHLY?a.push(u.weekday):o.push([u.weekday,u.n])}e.byweekday=Ge(a)?a:null,e.bynweekday=Ge(o)?o:null}return Pe(e.byhour)?Qt(e.byhour)&&(e.byhour=[e.byhour]):e.byhour=e.freq=4?(c=0,l=o.yearlen+Tt(a-e.wkst,7)):l=n-c;for(var d=Math.floor(l/7),p=Tt(l,7),m=Math.floor(d+p/4),b=0;b0&&g<=m){var E=void 0;g>1?(E=c+(g-1)*7,c!==u&&(E-=7-u)):E=c;for(var R=0;R<7&&(o.wnomask[E]=1,E++,o.wdaymask[E]!==e.wkst);R++);}}if(ge(e.byweekno,1)){var E=c+m*7;if(c!==u&&(E-=7-u),E=4?(V=0,ee=$+Tt(v-e.wkst,7)):ee=n-c,x=Math.floor(52+Tt(ee,7)/4)}if(ge(e.byweekno,x))for(var E=0;Es)return Sn(r);if(x>=t){var v=tv(x,e);if(!r.accept(v)||o&&(--o,!o))return Sn(r)}}else for(var R=m;Rs)return Sn(r);if(x>=t){var v=tv(x,e);if(!r.accept(v)||o&&(--o,!o))return Sn(r)}}}if(e.interval===0||(u.add(e,g),u.year>Zu))return Sn(r);bo(n)||(c=l.gettimeset(n)(u.hour,u.minute,u.second,0)),l.rebuild(u.year,u.month)}}function qP(r,e,t){var n=t.bymonth,i=t.byweekno,s=t.byweekday,a=t.byeaster,o=t.bymonthday,u=t.bynmonthday,l=t.byyearday;return Ge(n)&&!ge(n,r.mmask[e])||Ge(i)&&!r.wnomask[e]||Ge(s)&&!ge(s,r.wdaymask[e])||Ge(r.nwdaymask)&&!r.nwdaymask[e]||a!==null&&!ge(r.eastermask,e)||(Ge(o)||Ge(u))&&!ge(o,r.mdaymask[e])&&!ge(u,r.nmdaymask[e])||Ge(l)&&(e=r.yearlen&&!ge(l,e+1-r.yearlen)&&!ge(l,-r.nextyearlen+e-r.yearlen))}function tv(r,e){return new xi(r,e.tzid).rezonedDate()}function Sn(r){return r.getValue()}function jP(r,e,t,n,i){for(var s=!1,a=e;a=z.HOURLY&&Ge(i)&&!ge(i,e.hour)||n>=z.MINUTELY&&Ge(s)&&!ge(s,e.minute)||n>=z.SECONDLY&&Ge(a)&&!ge(a,e.second)?[]:r.gettimeset(n)(e.hour,e.minute,e.second,e.millisecond)}var yr={MO:new Ke(0),TU:new Ke(1),WE:new Ke(2),TH:new Ke(3),FR:new Ke(4),SA:new Ke(5),SU:new Ke(6)},To={freq:fe.YEARLY,dtstart:null,interval:1,wkst:yr.MO,count:null,until:null,tzid:null,bysetpos:null,bymonth:null,bymonthday:null,bynmonthday:null,byyearday:null,byweekno:null,byweekday:null,bynweekday:null,byhour:null,byminute:null,bysecond:null,byeaster:null},U_=Object.keys(To),z=function(){function r(e,t){e===void 0&&(e={}),t===void 0&&(t=!1),this._cache=t?null:new j_,this.origOptions=Om(e);var n=F_(e).parsedOptions;this.options=n}return r.parseText=function(e,t){return yo(e,t)},r.fromText=function(e,t){return A_(e,t)},r.fromString=function(e){return new r(r.parseString(e)||void 0)},r.prototype._iter=function(e){return rl(e,this.options)},r.prototype._cacheGet=function(e,t){return this._cache?this._cache._cacheGet(e,t):!1},r.prototype._cacheAdd=function(e,t,n){if(!!this._cache)return this._cache._cacheAdd(e,t,n)},r.prototype.all=function(e){if(e)return this._iter(new Sm("all",{},e));var t=this._cacheGet("all");return t===!1&&(t=this._iter(new En("all",{})),this._cacheAdd("all",t)),t},r.prototype.between=function(e,t,n,i){if(n===void 0&&(n=!1),!Oi(e)||!Oi(t))throw new Error("Invalid date passed in to RRule.between");var s={before:t,after:e,inc:n};if(i)return this._iter(new Sm("between",s,i));var a=this._cacheGet("between",s);return a===!1&&(a=this._iter(new En("between",s)),this._cacheAdd("between",a,s)),a},r.prototype.before=function(e,t){if(t===void 0&&(t=!1),!Oi(e))throw new Error("Invalid date passed in to RRule.before");var n={dt:e,inc:t},i=this._cacheGet("before",n);return i===!1&&(i=this._iter(new En("before",n)),this._cacheAdd("before",i,n)),i},r.prototype.after=function(e,t){if(t===void 0&&(t=!1),!Oi(e))throw new Error("Invalid date passed in to RRule.after");var n={dt:e,inc:t},i=this._cacheGet("after",n);return i===!1&&(i=this._iter(new En("after",n)),this._cacheAdd("after",i,n)),i},r.prototype.count=function(){return this.all().length},r.prototype.toString=function(){return wo(this.origOptions)},r.prototype.toText=function(e,t,n){return P_(this,e,t,n)},r.prototype.isFullyConvertibleToText=function(){return N_(this)},r.prototype.clone=function(){return new r(this.origOptions)},r.FREQUENCIES=["YEARLY","MONTHLY","WEEKLY","DAILY","HOURLY","MINUTELY","SECONDLY"],r.YEARLY=fe.YEARLY,r.MONTHLY=fe.MONTHLY,r.WEEKLY=fe.WEEKLY,r.DAILY=fe.DAILY,r.HOURLY=fe.HOURLY,r.MINUTELY=fe.MINUTELY,r.SECONDLY=fe.SECONDLY,r.MO=yr.MO,r.TU=yr.TU,r.WE=yr.WE,r.TH=yr.TH,r.FR=yr.FR,r.SA=yr.SA,r.SU=yr.SU,r.parseString=vo,r.optionsToString=wo,r}();function rv(r,e,t,n,i,s){var a={},o=r.accept;function u(p,m){t.forEach(function(b){b.between(p,m,!0).forEach(function(g){a[Number(g)]=!0})})}i.forEach(function(p){var m=new xi(p,s).rezonedDate();a[Number(m)]=!0}),r.accept=function(p){var m=Number(p);return isNaN(m)?o.call(this,p):!a[m]&&(u(new Date(m-1),new Date(m+1)),!a[m])?(a[m]=!0,o.call(this,p)):!0},r.method==="between"&&(u(r.args.after,r.args.before),r.accept=function(p){var m=Number(p);return a[m]?!0:(a[m]=!0,o.call(this,p))});for(var l=0;l1||i.length||s.length||a.length){var c=new Rm(l);return c.dtstart(o),c.tzid(u||void 0),n.forEach(function(p){c.rrule(new z(xm(p,o,u),l))}),i.forEach(function(p){c.rdate(p)}),s.forEach(function(p){c.exrule(new z(xm(p,o,u),l))}),a.forEach(function(p){c.exdate(p)}),e.compatible&&e.dtstart&&c.rdate(o),c}var d=n[0]||{};return new z(xm(d,d.dtstart||e.dtstart||o,d.tzid||e.tzid||u),l)}function nl(r,e){return e===void 0&&(e={}),YP(r,BP(e))}function xm(r,e,t){return gt(gt({},r),{dtstart:e,tzid:t})}function BP(r){var e=[],t=Object.keys(r),n=Object.keys(nv);if(t.forEach(function(i){ge(n,i)||e.push(i)}),e.length)throw new Error("Invalid options: "+e.join(", "));return gt(gt({},nv),r)}function HP(r){if(r.indexOf(":")===-1)return{name:"RRULE",value:r};var e=S_(r,":",1),t=e[0],n=e[1];return{name:t,value:n}}function VP(r){var e=HP(r),t=e.name,n=e.value,i=t.split(";");if(!i)throw new Error("empty property name");return{name:i[0].toUpperCase(),parms:i.slice(1),value:n}}function zP(r,e){if(e===void 0&&(e=!1),r=r&&r.trim(),!r)throw new Error("Invalid empty string");if(!e)return r.split(/\s/);for(var t=r.split(` -`),n=0;n0&&i[0]===" "?(t[n-1]+=i.slice(1),t.splice(n,1)):n+=1:t.splice(n,1)}return t}function KP(r){r.forEach(function(e){if(!/(VALUE=DATE(-TIME)?)|(TZID=)/.test(e))throw new Error("unsupported RDATE/EXDATE parm: "+e)})}function iv(r,e){return KP(e),r.split(",").map(function(t){return go(t)})}function sv(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;nno ${r} date`;let n=Mm.parseDate(e,t,{forwardDate:t!=null});return n!==null?window.moment(n).format("YYYY-MM-DD"):`invalid ${r} date`}function lv(r,e,t){return QP(r,e,t?new Date:void 0)}function Ri(r,e){let t=null,n=Mm.parseDate(r,new Date,{forwardDate:e});return n!==null&&(t=window.moment(n)),t}var ct=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=z.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 z(u);return new ct({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(e=window.moment()){let t=this.nextReferenceDate(e);if(t!==null){let n=null,i=null,s=null;if(this.referenceDate){if(this.startDate){let a=window.moment.duration(this.startDate.diff(this.referenceDate));n=window.moment(t),n.add(Math.round(a.asDays()),"days")}if(this.scheduledDate){let a=window.moment.duration(this.scheduledDate.diff(this.referenceDate));i=window.moment(t),i.add(Math.round(a.asDays()),"days")}if(this.dueDate){let a=window.moment.duration(this.dueDate.diff(this.referenceDate));s=window.moment(t),s.add(Math.round(a.asDays()),"days")}}return{startDate:n,scheduledDate:i,dueDate:s}}return null}identicalTo(e){return this.baseOnToday!==e.baseOnToday||br(this.startDate,e.startDate)!==0||br(this.scheduledDate,e.scheduledDate)!==0||br(this.dueDate,e.dueDate)!==0?!1:this.toText()===e.toText()}nextReferenceDate(e){return this.baseOnToday?this.nextReferenceDateFromToday(e).toDate():this.nextReferenceDateFromOriginalReferenceDate().toDate()}nextReferenceDateFromToday(e){let t=new z(be(X({},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=ct.nextAfterMonths(e,n,t,s[1])));let a=i.match(/every( \d+)? year(s)?(.*)?/);return a!==null&&(n=ct.nextAfterYears(e,n,t,a[1])),ct.addTimezone(n)}static nextAfterMonths(e,t,n,i){let s=1;for(i!==void 0&&(s=Number.parseInt(i.trim(),10));ct.isSkippingTooManyMonths(e,t,s);)t=ct.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));ct.isSkippingTooManyYears(e,t,s);)t=ct.fromOneDayEarlier(e,n);return t}static isSkippingTooManyYears(e,t,n){return t.year()-e.year()>n}static fromOneDayEarlier(e,t){e.subtract(1,"days").endOf("day");let n=t.origOptions;return n.dtstart=e.startOf("day").toDate(),t=new z(n),window.moment(t.after(e.toDate()))}static addTimezone(e){return window.moment.utc(e).local(!0).startOf("day")}};function il(r){return r.replace(/([.*+?^${}()|[\]/\\])/g,"\\$1")}var Xn=class{constructor(){this._globalFilter="";this._removeGlobalFilter=!1}static getInstance(){return Xn.instance||(Xn.instance=new Xn),Xn.instance}get(){return this._globalFilter}set(e){this._globalFilter=e}reset(){this.set(Xn.empty)}isEmpty(){return this.get()===Xn.empty}equals(e){return this.get()===e}includedIn(e){let t=this.get();return e.includes(t)}prependTo(e){return this.get()+" "+e}removeAsWordFromDependingOnSettings(e){return this.getRemoveGlobalFilter()?this.removeAsWordFrom(e):e}getRemoveGlobalFilter(){return this._removeGlobalFilter}setRemoveGlobalFilter(e){this._removeGlobalFilter=e}removeAsWordFrom(e){if(this.isEmpty())return e;let t=RegExp("(^|\\s)"+il(this.get())+"($|\\s)","ug");return e.search(t)>-1&&(e=e.replace(t,"$1$2").replace(" "," ").trim()),e}removeAsSubstringFrom(e){let t=this.get();return e.replace(t,"").trim()}},ye=Xn;ye.empty="";var Zt=class{},Z=Zt;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 RegExp(Zt.indentationRegex.source+Zt.listMarkerRegex.source+" +"+Zt.checkboxRegex.source+Zt.afterCheckboxRegex.source,"u"),Z.nonTaskRegex=new RegExp(Zt.indentationRegex.source+Zt.listMarkerRegex.source+"? *("+Zt.checkboxRegex.source+")?"+Zt.afterCheckboxRegex.source,"u"),Z.listItemRegex=new RegExp(Zt.indentationRegex.source+Zt.listMarkerRegex.source),Z.blockLinkRegex=/ \^[a-zA-Z0-9-]+$/u,Z.hashTags=/(^|\s)#[^ !@#$%^&*(),.?":{}|<>]+/g,Z.hashTagsFromEnd=new RegExp(Zt.hashTags.source+"$");var Cm=5;function Am(r,e,t){let n=[r.startDateSymbol,r.scheduledDateSymbol,r.dueDateSymbol].join("|");return(i,s,a)=>{let o=[];return o=o.concat(ZP(i,s,a,n,e,t)),o=o.concat(JP(i,s,a,r.recurrenceSymbol,t)),o=o.concat(XP(i,s,a,r,t)),o.length>0&&!o.some(u=>u.suggestionType==="match")&&(t||o.unshift({suggestionType:"empty",displayText:"\u23CE",appendText:` -`})),o=o.slice(0,a.autoSuggestMaxItems),o}}function Pm(r,e,t){let n=tN(e.substring(0,t),[["(",")"],["[","]"]])=="("?")":"]",i=r?n+" ":" ",s=r&&e.length>t&&e.charAt(t)===n?1:0;return{postfix:i,insertSkip:s}}function XP(r,e,t,n,i){let s=d=>Object.values(n.prioritySymbols).some(p=>p.length>0&&d.includes(p)),a=[],{postfix:o,insertSkip:u}=Pm(i,r,e);if(r.includes(n.dueDateSymbol)||a.push({displayText:`${n.dueDateSymbol} due date`,appendText:`${n.dueDateSymbol} `}),r.includes(n.startDateSymbol)||a.push({displayText:`${n.startDateSymbol} start date`,appendText:`${n.startDateSymbol} `}),r.includes(n.scheduledDateSymbol)||a.push({displayText:`${n.scheduledDateSymbol} scheduled date`,appendText:`${n.scheduledDateSymbol} `}),!s(r)){let d=n.prioritySymbols,p=["High","Medium","Low","Highest","Lowest"];for(let m=0;m0){let d=l[0];if(d.length>=Math.max(1,t.autoSuggestMinMatch)){let p=a.filter(m=>(m.textToMatch||m.displayText).toLowerCase().includes(d.toLowerCase()));for(let m of p){let b=i&&(m.displayText.includes("priority")||m.displayText.includes("created"))?d.length+u:d.length;c.push({suggestionType:"match",displayText:m.displayText,appendText:m.appendText,insertAt:l.index,insertSkip:b})}}}return c.length===0&&t.autoSuggestMinMatch===0?a:c}function ZP(r,e,t,n,i,s){let a=["today","tomorrow","Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday","next week","next month","next year"],{postfix:o,insertSkip:u}=Pm(s,r,e),l=[],c=new RegExp(`(${n})\\s*([0-9a-zA-Z ]*)`,"ug"),d=Nm(r,c,e);if(d&&d.length>=2){let p=d[1],m=d[2];if(m.length1?Kt.parseDate(Ku(m),!0):null;b&&b.isValid()&&l.push({displayText:`${b.format(Z.dateFormat)}`,appendText:`${p} ${b.format(Z.dateFormat)} `,insertAt:d.index,insertSkip:d[0].length});let g=1,E=a.filter(R=>m&&m.length>=g&&R.toLowerCase().includes(m.toLowerCase())).slice(0,i);E.length===0&&(E=a.slice(0,i));for(let R of E){let v=`${Kt.parseDate(R,!0).format(Z.dateFormat)}`,V=s?d[0].length+u:d[0].length;l.push({suggestionType:"match",displayText:`${R} (${v})`,appendText:`${p} ${v}`+o,insertAt:d.index,insertSkip:V})}}return l}function JP(r,e,t,n,i){var d;let s=["every","every day","every week","every month","every month on the","every year","every week on Sunday","every week on Monday","every week on Tuesday","every week on Wednesday","every week on Thursday","every week on Friday","every week on Saturday"],{postfix:a,insertSkip:o}=Pm(i,r,e),u=[],l=new RegExp(`(${n})\\s*([0-9a-zA-Z ]*)`,"ug"),c=Nm(r,l,e);if(c&&c.length>=2){let p=c[1],m=c[2];if(m.length0){let R=(d=ct.fromText({recurrenceRuleText:m,startDate:null,scheduledDate:null,dueDate:null}))==null?void 0:d.toText();if(R){let x=`${p} ${R}`+a,v=i?c[0].length+o:c[0].length;if(u.push({suggestionType:"match",displayText:`\u2705 ${R}`,appendText:x,insertAt:c.index,insertSkip:v}),c[0]==x)return[]}}let b=1,g=t.autoSuggestMaxItems/2,E=s.filter(R=>m&&m.length>=b&&R.toLowerCase().includes(m.toLowerCase())).slice(0,g);E.length===0&&m.trim().length===0&&(E=s.slice(0,g));for(let R of E)u.push({suggestionType:"match",displayText:`${R}`,appendText:`${p} ${R} `,insertAt:c.index,insertSkip:c[0].length})}return u}function Nm(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 eN(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 tN(r,e){if(e.length===0)return null;let t=Object.fromEntries(e.map(([s,a])=>[s,0])),n=Object.fromEntries(e.map(([s,a])=>[a,s])),i=[];for(let s=0;s=1){for(let o=i.length-1;o>=0;o--)if(i[o].bracket==n[a]){i.splice(o,1);break}}t[n[a]]=Math.max(0,t[n[a]]-1)}}return i.length>0?i[i.length-1].bracket:null}function dv(r,e){return(t,n,i)=>eN(t.slice(0,n),e)?r(t,n,i):[]}function fv(r,e){return ye.getInstance().includedIn(r)&&rN(r,e)}function rN(r,e){if(r.length===0)return!1;let t=oe.extractTaskComponents(r);if(!t)return!1;let n=t.indentation+t.listMarker+" ["+t.status.symbol+"] ";return e>=n.length}var ws=(p=>(p.Description="description",p.Id="id",p.DependsOn="dependsOn",p.Priority="priority",p.RecurrenceRule="recurrenceRule",p.CreatedDate="createdDate",p.StartDate="startDate",p.ScheduledDate="scheduledDate",p.DueDate="dueDate",p.CancelledDate="cancelledDate",p.DoneDate="doneDate",p.BlockLink="blockLink",p))(ws||{}),sl=Object.values(ws),Zr=class{constructor(){this.visible={};this.tagsVisible=!0;sl.forEach(e=>{this.visible[e]=!0})}isShown(e){return this.visible[e]}areTagsShown(){return this.tagsVisible}hide(e){this.visible[e]=!1}setVisibility(e,t){this.visible[e]=t}setTagsVisibility(e){this.tagsVisible=e}get shownComponents(){return sl.filter(e=>this.visible[e])}get hiddenComponents(){return sl.filter(e=>!this.visible[e])}get toggleableComponents(){return sl.filter(e=>e!=="description"&&e!=="blockLink")}toggleVisibilityExceptDescriptionAndBlockLink(){this.toggleableComponents.forEach(e=>{this.visible[e]=!this.visible[e]}),this.setTagsVisibility(!this.areTagsShown())}};var Mi=/[a-zA-Z0-9-_]+/,Fm={prioritySymbols:{Highest:"\u{1F53A}",High:"\u23EB",Medium:"\u{1F53C}",Low:"\u{1F53D}",Lowest:"\u23EC",None:""},startDateSymbol:"\u{1F6EB}",createdDateSymbol:"\u2795",scheduledDateSymbol:"\u23F3",dueDateSymbol:"\u{1F4C5}",doneDateSymbol:"\u2705",cancelledDateSymbol:"\u274C",recurrenceSymbol:"\u{1F501}",dependsOnSymbol:"\u26D4",idSymbol:"\u{1F194}",TaskFormatRegularExpressions:{priorityRegex:/([🔺⏫🔼🔽⏬])\uFE0F?$/u,startDateRegex:/🛫 *(\d{4}-\d{2}-\d{2})$/u,createdDateRegex:/➕ *(\d{4}-\d{2}-\d{2})$/u,scheduledDateRegex:/[⏳⌛] *(\d{4}-\d{2}-\d{2})$/u,dueDateRegex:/[📅📆🗓] *(\d{4}-\d{2}-\d{2})$/u,doneDateRegex:/✅ *(\d{4}-\d{2}-\d{2})$/u,cancelledDateRegex:/❌ *(\d{4}-\d{2}-\d{2})$/u,recurrenceRegex:/🔁 ?([a-zA-Z0-9, !]+)$/iu,dependsOnRegex:new RegExp("\u26D4\uFE0F? *("+Mi.source+"( *, *"+Mi.source+" *)*)$","iu"),idRegex:new RegExp("\u{1F194} *("+Mi.source+")$","iu")}};function Im(r,e,t){return t?r?" "+e:` ${e} ${t}`:""}function ks(r,e,t){return t?r?" "+e:` ${e} ${t.format(Z.dateFormat)}`:""}var Ci=class{constructor(e){this.symbols=e}serialize(e){let t=new Zr,n="",i=!1;for(let s of t.shownComponents)n+=this.componentToString(e,i,s);return n}componentToString(e,t,n){var b;let{prioritySymbols:i,startDateSymbol:s,createdDateSymbol:a,scheduledDateSymbol:o,doneDateSymbol:u,cancelledDateSymbol:l,recurrenceSymbol:c,dueDateSymbol:d,dependsOnSymbol:p,idSymbol:m}=this.symbols;switch(n){case"description":return e.description;case"priority":{let g="";return e.priority==="0"?g=" "+i.Highest:e.priority==="1"?g=" "+i.High:e.priority==="2"?g=" "+i.Medium:e.priority==="4"?g=" "+i.Low:e.priority==="5"&&(g=" "+i.Lowest),g}case"startDate":return ks(t,s,e.startDate);case"createdDate":return ks(t,a,e.createdDate);case"scheduledDate":return e.scheduledDateIsInferred?"":ks(t,o,e.scheduledDate);case"doneDate":return ks(t,u,e.doneDate);case"cancelledDate":return ks(t,l,e.cancelledDate);case"dueDate":return ks(t,d,e.dueDate);case"recurrenceRule":return e.recurrence?Im(t,c,e.recurrence.toText()):"";case"dependsOn":return e.dependsOn.length===0?"":Im(t,p,e.dependsOn.join(","));case"id":return Im(t,m,e.id);case"blockLink":return(b=e.blockLink)!=null?b:"";default:throw new Error(`Don't know how to render task component of type '${n}'`)}}parsePriority(e){let{prioritySymbols:t}=this.symbols;switch(e){case t.Lowest:return"5";case t.Low:return"4";case t.Medium:return"2";case t.High:return"1";case t.Highest:return"0";default:return"3"}}deserialize(e){let{TaskFormatRegularExpressions:t}=this.symbols,n,i="3",s=null,a=null,o=null,u=null,l=null,c=null,d="",p=null,m="",b=[],g="",E=20,R=0;do{n=!1;let x=e.match(t.priorityRegex);x!==null&&(i=this.parsePriority(x[1]),e=e.replace(t.priorityRegex,"").trim(),n=!0);let v=e.match(t.doneDateRegex);v!==null&&(u=window.moment(v[1],Z.dateFormat),e=e.replace(t.doneDateRegex,"").trim(),n=!0);let V=e.match(t.cancelledDateRegex);V!==null&&(l=window.moment(V[1],Z.dateFormat),e=e.replace(t.cancelledDateRegex,"").trim(),n=!0);let $=e.match(t.dueDateRegex);$!==null&&(o=window.moment($[1],Z.dateFormat),e=e.replace(t.dueDateRegex,"").trim(),n=!0);let ee=e.match(t.scheduledDateRegex);ee!==null&&(a=window.moment(ee[1],Z.dateFormat),e=e.replace(t.scheduledDateRegex,"").trim(),n=!0);let Y=e.match(t.startDateRegex);Y!==null&&(s=window.moment(Y[1],Z.dateFormat),e=e.replace(t.startDateRegex,"").trim(),n=!0);let q=e.match(t.createdDateRegex);q!==null&&(c=window.moment(q[1],Z.dateFormat),e=e.replace(t.createdDateRegex,"").trim(),n=!0);let de=e.match(t.recurrenceRegex);de!==null&&(d=de[1].trim(),e=e.replace(t.recurrenceRegex,"").trim(),n=!0);let Te=e.match(Z.hashTagsFromEnd);if(Te!=null){e=e.replace(Z.hashTagsFromEnd,"").trim(),n=!0;let O=Te[0].trim();g=g.length>0?[O,g].join(" "):O}let G=e.match(t.idRegex);G!=null&&(e=e.replace(t.idRegex,"").trim(),m=G[1].trim(),n=!0);let N=e.match(t.dependsOnRegex);N!=null&&(e=e.replace(t.dependsOnRegex,"").trim(),b=N[1].replace(/ /g,"").split(",").filter(O=>O!==""),n=!0),R++}while(n&&R<=E);return d.length>0&&(p=ct.fromText({recurrenceRuleText:d,startDate:s,scheduledDate:a,dueDate:o})),g.length>0&&(e+=" "+g),{description:e,priority:i,startDate:s,createdDate:c,scheduledDate:a,dueDate:o,doneDate:u,cancelledDate:l,recurrence:p,id:m,dependsOn:b,tags:oe.extractHashtags(e)}}};function Jr(r){let e=["(?:",/(?=[^\]]+\])\[/,"|",/(?=[^)]+\))\(/,")",/ */,r,/ */,/[)\]]/,/(?: *,)?/,/$/].map(t=>t instanceof RegExp?t.source:t).join("");return new RegExp(e,r.flags)}var Lm={prioritySymbols:{Highest:"priority:: highest",High:"priority:: high",Medium:"priority:: medium",Low:"priority:: low",Lowest:"priority:: lowest",None:""},startDateSymbol:"start::",createdDateSymbol:"created::",scheduledDateSymbol:"scheduled::",dueDateSymbol:"due::",doneDateSymbol:"completion::",cancelledDateSymbol:"cancelled::",recurrenceSymbol:"repeat::",idSymbol:"id::",dependsOnSymbol:"dependsOn::",TaskFormatRegularExpressions:{priorityRegex:Jr(/priority:: *(highest|high|medium|low|lowest)/),startDateRegex:Jr(/start:: *(\d{4}-\d{2}-\d{2})/),createdDateRegex:Jr(/created:: *(\d{4}-\d{2}-\d{2})/),scheduledDateRegex:Jr(/scheduled:: *(\d{4}-\d{2}-\d{2})/),dueDateRegex:Jr(/due:: *(\d{4}-\d{2}-\d{2})/),doneDateRegex:Jr(/completion:: *(\d{4}-\d{2}-\d{2})/),cancelledDateRegex:Jr(/cancelled:: *(\d{4}-\d{2}-\d{2})/),recurrenceRegex:Jr(/repeat:: *([a-zA-Z0-9, !]+)/),dependsOnRegex:Jr(new RegExp("dependsOn:: *("+Mi.source+"( *, *"+Mi.source+" *)*)")),idRegex:Jr(new RegExp("id:: *("+Mi.source+")"))}},al=class extends Ci{constructor(){super(Lm)}parsePriority(e){switch(e){case"highest":return"0";case"high":return"1";case"medium":return"2";case"low":return"4";case"lowest":return"5";default:return"3"}}componentToString(e,t,n){let i=super.componentToString(e,t,n),s=["blockLink","description"];return i!==""&&!s.includes(n)?` [${i.trim()}]`:i}};var Jt=(a=>(a.TODO="TODO",a.DONE="DONE",a.IN_PROGRESS="IN_PROGRESS",a.CANCELLED="CANCELLED",a.NON_TASK="NON_TASK",a.EMPTY="EMPTY",a))(Jt||{}),et=class{constructor(e,t,n,i,s="TODO"){this.symbol=e,this.name=t,this.nextStatusSymbol=n,this.availableAsCommand=i,this.type=s}};var At=class{get symbol(){return this.configuration.symbol}get name(){return this.configuration.name}get nextStatusSymbol(){return this.configuration.nextStatusSymbol}get nextSymbol(){return this.configuration.nextStatusSymbol}get availableAsCommand(){return this.configuration.availableAsCommand}get type(){return this.configuration.type}get typeGroupText(){let e=this.type,t;switch(e){case"IN_PROGRESS":t="1";break;case"TODO":t="2";break;case"DONE":t="3";break;case"CANCELLED":t="4";break;case"NON_TASK":t="5";break;case"EMPTY":t="6";break}return`%%${t}%%${e}`}constructor(e){this.configuration=e}static makeDone(){return new At(new et("x","Done"," ",!0,"DONE"))}static makeEmpty(){return new At(new et("","EMPTY","",!0,"EMPTY"))}static makeTodo(){return new At(new et(" ","Todo","x",!0,"TODO"))}static makeCancelled(){return new At(new et("-","Cancelled"," ",!0,"CANCELLED"))}static makeInProgress(){return new At(new et("/","In Progress","x",!0,"IN_PROGRESS"))}static makeNonTask(){return new At(new et("Q","Non-Task","A",!0,"NON_TASK"))}static getTypeForUnknownSymbol(e){switch(e){case"x":case"X":return"DONE";case"/":return"IN_PROGRESS";case"-":return"CANCELLED";case"":return"EMPTY";case" ":default:return"TODO"}}static getTypeFromStatusTypeString(e){return Jt[e]||"TODO"}static createUnknownStatus(e){return new At(new et(e,"Unknown","x",!1,"TODO"))}static createFromImportedValue(e){let t=e[0],n=At.getTypeFromStatusTypeString(e[3]);return new At(new et(t,e[1],e[2],!1,n))}isCompleted(){return this.type==="DONE"}isCancelled(){return this.type==="CANCELLED"}identicalTo(e){let t=["symbol","name","nextStatusSymbol","availableAsCommand","type"];for(let n of t)if(this[n]!==e[n])return!1;return!0}previewText(){let e="";return At.tasksPluginCanCreateCommandsForStatuses()&&this.availableAsCommand&&(e=" Available as a command."),`- [${this.symbol}] => [${this.nextStatusSymbol}], name: '${this.name}', type: '${this.configuration.type}'.${e}`}static tasksPluginCanCreateCommandsForStatuses(){return!1}},ne=At;ne.DONE=At.makeDone(),ne.EMPTY=At.makeEmpty(),ne.TODO=At.makeTodo();var ol=class{constructor(e=!1,t=!1){this.ignoreSortInstructions=e,this.showTaskHiddenData=t}};var Le=class{constructor(){this.coreStatuses=[ne.makeTodo().configuration,ne.makeDone().configuration],this.customStatuses=[ne.makeInProgress().configuration,ne.makeCancelled().configuration]}static addStatus(e,t){e.push(t)}static replaceStatus(e,t,n){let i=this.findStatusIndex(t,e);return i<=-1?!1:(e.splice(i,1,n),!0)}static findStatusIndex(e,t){let n=new ne(e);return t.findIndex(i=>new ne(i).previewText()==n.previewText())}static deleteStatus(e,t){let n=this.findStatusIndex(t,e);return n<=-1?!1:(e.splice(n,1),!0)}static deleteAllCustomStatuses(e){e.customStatuses.splice(0)}static resetAllCustomStatuses(e){Le.deleteAllCustomStatuses(e),new Le().customStatuses.forEach(n=>{Le.addStatus(e.customStatuses,n)})}static bulkAddStatusCollection(e,t){let n=[];return t.forEach(i=>{e.customStatuses.find(a=>a.symbol==i[0]&&a.name==i[1]&&a.nextStatusSymbol==i[2])?n.push(`The status ${i[1]} (${i[0]}) is already added.`):Le.addStatus(e.customStatuses,ne.createFromImportedValue(i))}),n}static allStatuses(e){return e.coreStatuses.concat(e.customStatuses)}static applyToStatusRegistry(e,t){t.clearStatuses(),Le.allStatuses(e).forEach(n=>{t.add(n)})}};var pv=[{index:9999,internalName:"INTERNAL_TESTING_ENABLED_BY_DEFAULT",displayName:"Test Item. Used to validate the Feature Framework.",description:"Description",enabledByDefault:!0,stable:!1}];var On=class{constructor(e,t,n,i,s,a){this.internalName=e;this.index=t;this.description=n;this.displayName=i;this.enabledByDefault=s;this.stable=a}static get values(){let e=[];return pv.forEach(t=>{e=[...e,new On(t.internalName,t.index,t.description,t.displayName,t.enabledByDefault,t.stable)]}),e}static get settingsFlags(){let e={};return On.values.forEach(t=>{e[t.internalName]=t.enabledByDefault}),e}static fromString(e){for(let t of On.values)if(e===t.internalName)return t;throw new RangeError(`Illegal argument passed to fromString(): ${e} does not correspond to any available Feature ${this.prototype.constructor.name}`)}};var Dn={tasksPluginEmoji:{displayName:"Tasks Emoji Format",taskSerializer:new Ci(Fm),buildSuggestions:Am(Fm,Cm,!1)},dataview:{displayName:"Dataview",taskSerializer:new al,buildSuggestions:dv(Am(Lm,Cm,!0),[["(",")"],["[","]"]])}},hv={globalQuery:"",globalFilter:"",removeGlobalFilter:!1,taskFormat:"tasksPluginEmoji",setCreatedDate:!1,setDoneDate:!0,setCancelledDate:!0,autoSuggestInEditor:!0,autoSuggestMinMatch:0,autoSuggestMaxItems:6,provideAccessKeys:!0,useFilenameAsScheduledDate:!1,filenameAsDateFolders:[],recurrenceOnNextLine:!1,statusSettings:new Le,features:On.settingsFlags,generalSettings:{},headingOpened:{},debugSettings:new ol,loggingOptions:{minLevels:{"":"info",tasks:"info","tasks.Cache":"info","tasks.Events":"info","tasks.File":"info","tasks.Query":"info","tasks.Task":"info"}}},Zn=X({},hv);function mv(r,e){for(let t in r)e[t]===void 0&&(e[t]=r[t])}var J=()=>(mv(On.settingsFlags,Zn.features),mv(hv.loggingOptions.minLevels,Zn.loggingOptions.minLevels),Zn.statusSettings.customStatuses.forEach((r,e,t)=>{var i,s;let n=ne.getTypeFromStatusTypeString(r.type);t[e]=new et((i=r.symbol)!=null?i:" ",r.name,(s=r.nextStatusSymbol)!=null?s:"x",r.availableAsCommand,n)}),X({},Zn)),tt=r=>(Zn=X(X({},Zn),r),J());var Ai=(r,e)=>(Zn.generalSettings[r]=e,J()),gv=r=>{var e;return(e=Zn.features[r])!=null?e:!1};function Eo(){return Dn[J().taskFormat]}function ul(r){let t={"<":"<",">":">","&":"&",'"':"""}[r];return t!==void 0?t:r}function yv(r){let e=[...r],t="";return e.forEach(n=>{t+=ul(n)}),t}var Oe=class{constructor(){this._registeredStatuses=[];this.addDefaultStatusTypes()}set(e){this.clearStatuses(),e.forEach(t=>{this.add(t)})}get registeredStatuses(){return this._registeredStatuses.filter(({symbol:e})=>e!==ne.EMPTY.symbol)}static getInstance(){return Oe.instance||(Oe.instance=new Oe),Oe.instance}add(e){this.hasSymbol(e.symbol)||(e instanceof ne?this._registeredStatuses.push(e):this._registeredStatuses.push(new ne(e)))}bySymbol(e){return this.hasSymbol(e)?this.getSymbol(e):ne.EMPTY}bySymbolOrCreate(e){return this.hasSymbol(e)?this.getSymbol(e):ne.createUnknownStatus(e)}byName(e){return this._registeredStatuses.filter(({name:t})=>t===e).length>0?this._registeredStatuses.filter(({name:t})=>t===e)[0]:ne.EMPTY}resetToDefaultStatuses(){this.clearStatuses(),this.addDefaultStatusTypes()}clearStatuses(){this._registeredStatuses=[]}getNextStatus(e){if(e.nextStatusSymbol!==""){let t=this.bySymbol(e.nextStatusSymbol);if(t!==null)return t}return ne.EMPTY}getNextStatusOrCreate(e){let t=this.getNextStatus(e);return t.type!=="EMPTY"?t:ne.createUnknownStatus(e.nextStatusSymbol)}getNextRecurrenceStatusOrCreate(e){let t=this.getNextStatusOrCreate(e),n=this.getNextRecurrenceStatusOfType(t,"TODO");if(n)return n;let i=this.getNextRecurrenceStatusOfType(t,"IN_PROGRESS");return i||this.bySymbolOrCreate(" ")}getNextRecurrenceStatusOfType(e,t){if(e.type===t)return e;let n=e;for(let i=0;i!this.hasSymbol(s.symbol)),n=new Oe,i=[];return t.forEach(s=>{if(n.hasSymbol(s.symbol))return;let a=Oe.copyStatusWithNewName(s,`Unknown (${s.symbol})`);i.push(a),n.add(a)}),i.sort((s,a)=>s.symbol.localeCompare(a.symbol,void 0,{numeric:!0}))}static copyStatusWithNewName(e,t){let n=new et(e.symbol,t,e.nextStatusSymbol,e.availableAsCommand,e.type);return new ne(n)}getSymbol(e){return this._registeredStatuses.filter(({symbol:t})=>t===e)[0]}hasSymbol(e){return this._registeredStatuses.find(t=>t.symbol===e)!==void 0}addDefaultStatusTypes(){[ne.makeTodo(),ne.makeInProgress(),ne.makeDone(),ne.makeCancelled()].forEach(t=>{this.add(t)})}mermaidDiagram(e=!1){let t=this.registeredStatuses,n="mermaid",i=[],s=[];return t.forEach((a,o)=>{let u=this.getMermaidNodeLabel(a,e);i.push(`${o+1}${u}`);let l=this.getNextStatus(a);if(this.addEdgeIfNotToInternal(t,l,s,o,!1),a.type==="DONE"){let c=this.getNextRecurrenceStatusOrCreate(a);c.symbol!==l.symbol&&this.addEdgeIfNotToInternal(t,c,s,o,!0)}}),` -\`\`\`${n} +"use strict"; +var __create = Object.create; +var __defProp = Object.defineProperty; +var __defProps = Object.defineProperties; +var __getOwnPropDesc = Object.getOwnPropertyDescriptor; +var __getOwnPropDescs = Object.getOwnPropertyDescriptors; +var __getOwnPropNames = Object.getOwnPropertyNames; +var __getOwnPropSymbols = Object.getOwnPropertySymbols; +var __getProtoOf = Object.getPrototypeOf; +var __hasOwnProp = Object.prototype.hasOwnProperty; +var __propIsEnum = Object.prototype.propertyIsEnumerable; +var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value; +var __spreadValues = (a, b) => { + for (var prop in b || (b = {})) + if (__hasOwnProp.call(b, prop)) + __defNormalProp(a, prop, b[prop]); + if (__getOwnPropSymbols) + for (var prop of __getOwnPropSymbols(b)) { + if (__propIsEnum.call(b, prop)) + __defNormalProp(a, prop, b[prop]); + } + return a; +}; +var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b)); +var __objRest = (source, exclude) => { + var target = {}; + for (var prop in source) + if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0) + target[prop] = source[prop]; + if (source != null && __getOwnPropSymbols) + for (var prop of __getOwnPropSymbols(source)) { + if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop)) + target[prop] = source[prop]; + } + return target; +}; +var __commonJS = (cb, mod) => function __require() { + return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports; +}; +var __export = (target, all) => { + for (var name in all) + __defProp(target, name, { get: all[name], enumerable: true }); +}; +var __copyProps = (to, from, except, desc) => { + if (from && typeof from === "object" || typeof from === "function") { + for (let key of __getOwnPropNames(from)) + if (!__hasOwnProp.call(to, key) && key !== except) + __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable }); + } + return to; +}; +var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps( + isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target, + mod +)); +var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod); +var __async = (__this, __arguments, generator) => { + return new Promise((resolve, reject) => { + var fulfilled = (value) => { + try { + step(generator.next(value)); + } catch (e) { + reject(e); + } + }; + var rejected = (value) => { + try { + step(generator.throw(value)); + } catch (e) { + reject(e); + } + }; + var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected); + step((generator = generator.apply(__this, __arguments)).next()); + }); +}; + +// node_modules/chrono-node/dist/utils/pattern.js +var require_pattern = __commonJS({ + "node_modules/chrono-node/dist/utils/pattern.js"(exports) { + "use strict"; + Object.defineProperty(exports, "__esModule", { value: true }); + exports.matchAnyPattern = exports.extractTerms = exports.repeatedTimeunitPattern = void 0; + function repeatedTimeunitPattern(prefix, singleTimeunitPattern) { + const singleTimeunitPatternNoCapture = singleTimeunitPattern.replace(/\((?!\?)/g, "(?:"); + return `${prefix}${singleTimeunitPatternNoCapture}\\s{0,5}(?:,?\\s{0,5}${singleTimeunitPatternNoCapture}){0,10}`; + } + exports.repeatedTimeunitPattern = repeatedTimeunitPattern; + function extractTerms(dictionary) { + let keys; + if (dictionary instanceof Array) { + keys = [...dictionary]; + } else if (dictionary instanceof Map) { + keys = Array.from(dictionary.keys()); + } else { + keys = Object.keys(dictionary); + } + return keys; + } + exports.extractTerms = extractTerms; + function matchAnyPattern(dictionary) { + const joinedTerms = extractTerms(dictionary).sort((a, b) => b.length - a.length).join("|").replace(/\./g, "\\."); + return `(?:${joinedTerms})`; + } + exports.matchAnyPattern = matchAnyPattern; + } +}); + +// node_modules/dayjs/dayjs.min.js +var require_dayjs_min = __commonJS({ + "node_modules/dayjs/dayjs.min.js"(exports, module2) { + !function(t, e) { + "object" == typeof exports && "undefined" != typeof module2 ? module2.exports = e() : "function" == typeof define && define.amd ? define(e) : (t = "undefined" != typeof globalThis ? globalThis : t || self).dayjs = e(); + }(exports, function() { + "use strict"; + var t = 1e3, e = 6e4, n = 36e5, r = "millisecond", i = "second", s = "minute", u = "hour", a = "day", o = "week", f = "month", h = "quarter", c = "year", d = "date", $ = "Invalid Date", l = /^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/, y = /\[([^\]]+)]|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, M = { 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("_") }, m = function(t2, e2, n2) { + var r2 = String(t2); + return !r2 || r2.length >= e2 ? t2 : "" + Array(e2 + 1 - r2.length).join(n2) + t2; + }, g = { s: m, z: function(t2) { + var e2 = -t2.utcOffset(), n2 = Math.abs(e2), r2 = Math.floor(n2 / 60), i2 = n2 % 60; + return (e2 <= 0 ? "+" : "-") + m(r2, 2, "0") + ":" + m(i2, 2, "0"); + }, m: function t2(e2, n2) { + if (e2.date() < n2.date()) + return -t2(n2, e2); + var r2 = 12 * (n2.year() - e2.year()) + (n2.month() - e2.month()), i2 = e2.clone().add(r2, f), s2 = n2 - i2 < 0, u2 = e2.clone().add(r2 + (s2 ? -1 : 1), f); + return +(-(r2 + (n2 - i2) / (s2 ? i2 - u2 : u2 - i2)) || 0); + }, a: function(t2) { + return t2 < 0 ? Math.ceil(t2) || 0 : Math.floor(t2); + }, p: function(t2) { + return { M: f, y: c, w: o, d: a, D: d, h: u, m: s, s: i, ms: r, Q: h }[t2] || String(t2 || "").toLowerCase().replace(/s$/, ""); + }, u: function(t2) { + return void 0 === t2; + } }, D = "en", v = {}; + v[D] = M; + var p = function(t2) { + return t2 instanceof _; + }, S = function(t2, e2, n2) { + var r2; + if (!t2) + return D; + if ("string" == typeof t2) + v[t2] && (r2 = t2), e2 && (v[t2] = e2, r2 = t2); + else { + var i2 = t2.name; + v[i2] = t2, r2 = i2; + } + return !n2 && r2 && (D = r2), r2 || !n2 && D; + }, w = function(t2, e2) { + if (p(t2)) + return t2.clone(); + var n2 = "object" == typeof e2 ? e2 : {}; + return n2.date = t2, n2.args = arguments, new _(n2); + }, O = g; + O.l = S, O.i = p, O.w = function(t2, e2) { + return w(t2, { locale: e2.$L, utc: e2.$u, x: e2.$x, $offset: e2.$offset }); + }; + var _ = function() { + function M2(t2) { + this.$L = S(t2.locale, null, true), this.parse(t2); + } + var m2 = M2.prototype; + return m2.parse = function(t2) { + this.$d = function(t3) { + var e2 = t3.date, n2 = t3.utc; + if (null === e2) + return new Date(NaN); + if (O.u(e2)) + return new Date(); + if (e2 instanceof Date) + return new Date(e2); + if ("string" == typeof e2 && !/Z$/i.test(e2)) { + var r2 = e2.match(l); + if (r2) { + var i2 = r2[2] - 1 || 0, s2 = (r2[7] || "0").substring(0, 3); + return n2 ? new Date(Date.UTC(r2[1], i2, r2[3] || 1, r2[4] || 0, r2[5] || 0, r2[6] || 0, s2)) : new Date(r2[1], i2, r2[3] || 1, r2[4] || 0, r2[5] || 0, r2[6] || 0, s2); + } + } + return new Date(e2); + }(t2), this.$x = t2.x || {}, this.init(); + }, m2.init = function() { + var t2 = this.$d; + this.$y = t2.getFullYear(), this.$M = t2.getMonth(), this.$D = t2.getDate(), this.$W = t2.getDay(), this.$H = t2.getHours(), this.$m = t2.getMinutes(), this.$s = t2.getSeconds(), this.$ms = t2.getMilliseconds(); + }, m2.$utils = function() { + return O; + }, m2.isValid = function() { + return !(this.$d.toString() === $); + }, m2.isSame = function(t2, e2) { + var n2 = w(t2); + return this.startOf(e2) <= n2 && n2 <= this.endOf(e2); + }, m2.isAfter = function(t2, e2) { + return w(t2) < this.startOf(e2); + }, m2.isBefore = function(t2, e2) { + return this.endOf(e2) < w(t2); + }, m2.$g = function(t2, e2, n2) { + return O.u(t2) ? this[e2] : this.set(n2, t2); + }, m2.unix = function() { + return Math.floor(this.valueOf() / 1e3); + }, m2.valueOf = function() { + return this.$d.getTime(); + }, m2.startOf = function(t2, e2) { + var n2 = this, r2 = !!O.u(e2) || e2, h2 = O.p(t2), $2 = function(t3, e3) { + var i2 = O.w(n2.$u ? Date.UTC(n2.$y, e3, t3) : new Date(n2.$y, e3, t3), n2); + return r2 ? i2 : i2.endOf(a); + }, l2 = function(t3, e3) { + return O.w(n2.toDate()[t3].apply(n2.toDate("s"), (r2 ? [0, 0, 0, 0] : [23, 59, 59, 999]).slice(e3)), n2); + }, y2 = this.$W, M3 = this.$M, m3 = this.$D, g2 = "set" + (this.$u ? "UTC" : ""); + switch (h2) { + case c: + return r2 ? $2(1, 0) : $2(31, 11); + case f: + return r2 ? $2(1, M3) : $2(0, M3 + 1); + case o: + var D2 = this.$locale().weekStart || 0, v2 = (y2 < D2 ? y2 + 7 : y2) - D2; + return $2(r2 ? m3 - v2 : m3 + (6 - v2), M3); + case a: + case d: + return l2(g2 + "Hours", 0); + case u: + return l2(g2 + "Minutes", 1); + case s: + return l2(g2 + "Seconds", 2); + case i: + return l2(g2 + "Milliseconds", 3); + default: + return this.clone(); + } + }, m2.endOf = function(t2) { + return this.startOf(t2, false); + }, m2.$set = function(t2, e2) { + var n2, o2 = O.p(t2), h2 = "set" + (this.$u ? "UTC" : ""), $2 = (n2 = {}, n2[a] = h2 + "Date", n2[d] = h2 + "Date", n2[f] = h2 + "Month", n2[c] = h2 + "FullYear", n2[u] = h2 + "Hours", n2[s] = h2 + "Minutes", n2[i] = h2 + "Seconds", n2[r] = h2 + "Milliseconds", n2)[o2], l2 = o2 === a ? this.$D + (e2 - this.$W) : e2; + if (o2 === f || o2 === c) { + var y2 = this.clone().set(d, 1); + y2.$d[$2](l2), y2.init(), this.$d = y2.set(d, Math.min(this.$D, y2.daysInMonth())).$d; + } else + $2 && this.$d[$2](l2); + return this.init(), this; + }, m2.set = function(t2, e2) { + return this.clone().$set(t2, e2); + }, m2.get = function(t2) { + return this[O.p(t2)](); + }, m2.add = function(r2, h2) { + var d2, $2 = this; + r2 = Number(r2); + var l2 = O.p(h2), y2 = function(t2) { + var e2 = w($2); + return O.w(e2.date(e2.date() + Math.round(t2 * r2)), $2); + }; + if (l2 === f) + return this.set(f, this.$M + r2); + if (l2 === c) + return this.set(c, this.$y + r2); + if (l2 === a) + return y2(1); + if (l2 === o) + return y2(7); + var M3 = (d2 = {}, d2[s] = e, d2[u] = n, d2[i] = t, d2)[l2] || 1, m3 = this.$d.getTime() + r2 * M3; + return O.w(m3, this); + }, m2.subtract = function(t2, e2) { + return this.add(-1 * t2, e2); + }, m2.format = function(t2) { + var e2 = this, n2 = this.$locale(); + if (!this.isValid()) + return n2.invalidDate || $; + var r2 = t2 || "YYYY-MM-DDTHH:mm:ssZ", i2 = O.z(this), s2 = this.$H, u2 = this.$m, a2 = this.$M, o2 = n2.weekdays, f2 = n2.months, h2 = function(t3, n3, i3, s3) { + return t3 && (t3[n3] || t3(e2, r2)) || i3[n3].substr(0, s3); + }, c2 = function(t3) { + return O.s(s2 % 12 || 12, t3, "0"); + }, d2 = n2.meridiem || function(t3, e3, n3) { + var r3 = t3 < 12 ? "AM" : "PM"; + return n3 ? r3.toLowerCase() : r3; + }, l2 = { YY: String(this.$y).slice(-2), YYYY: this.$y, M: a2 + 1, MM: O.s(a2 + 1, 2, "0"), MMM: h2(n2.monthsShort, a2, f2, 3), MMMM: h2(f2, a2), D: this.$D, DD: O.s(this.$D, 2, "0"), d: String(this.$W), dd: h2(n2.weekdaysMin, this.$W, o2, 2), ddd: h2(n2.weekdaysShort, this.$W, o2, 3), dddd: o2[this.$W], H: String(s2), HH: O.s(s2, 2, "0"), h: c2(1), hh: c2(2), a: d2(s2, u2, true), A: d2(s2, u2, false), m: String(u2), mm: O.s(u2, 2, "0"), s: String(this.$s), ss: O.s(this.$s, 2, "0"), SSS: O.s(this.$ms, 3, "0"), Z: i2 }; + return r2.replace(y, function(t3, e3) { + return e3 || l2[t3] || i2.replace(":", ""); + }); + }, m2.utcOffset = function() { + return 15 * -Math.round(this.$d.getTimezoneOffset() / 15); + }, m2.diff = function(r2, d2, $2) { + var l2, y2 = O.p(d2), M3 = w(r2), m3 = (M3.utcOffset() - this.utcOffset()) * e, g2 = this - M3, D2 = O.m(this, M3); + return D2 = (l2 = {}, l2[c] = D2 / 12, l2[f] = D2, l2[h] = D2 / 3, l2[o] = (g2 - m3) / 6048e5, l2[a] = (g2 - m3) / 864e5, l2[u] = g2 / n, l2[s] = g2 / e, l2[i] = g2 / t, l2)[y2] || g2, $2 ? D2 : O.a(D2); + }, m2.daysInMonth = function() { + return this.endOf(f).$D; + }, m2.$locale = function() { + return v[this.$L]; + }, m2.locale = function(t2, e2) { + if (!t2) + return this.$L; + var n2 = this.clone(), r2 = S(t2, e2, true); + return r2 && (n2.$L = r2), n2; + }, m2.clone = function() { + return O.w(this.$d, this); + }, m2.toDate = function() { + return new Date(this.valueOf()); + }, m2.toJSON = function() { + return this.isValid() ? this.toISOString() : null; + }, m2.toISOString = function() { + return this.$d.toISOString(); + }, m2.toString = function() { + return this.$d.toUTCString(); + }, M2; + }(), b = _.prototype; + return w.prototype = b, [["$ms", r], ["$s", i], ["$m", s], ["$H", u], ["$W", a], ["$M", f], ["$y", c], ["$D", d]].forEach(function(t2) { + b[t2[1]] = function(e2) { + return this.$g(e2, t2[0], t2[1]); + }; + }), w.extend = function(t2, e2) { + return t2.$i || (t2(e2, _, w), t2.$i = true), w; + }, w.locale = S, w.isDayjs = p, w.unix = function(t2) { + return w(1e3 * t2); + }, w.en = v[D], w.Ls = v, w.p = {}, w; + }); + } +}); + +// node_modules/chrono-node/dist/calculation/years.js +var require_years = __commonJS({ + "node_modules/chrono-node/dist/calculation/years.js"(exports) { + "use strict"; + var __importDefault = exports && exports.__importDefault || function(mod) { + return mod && mod.__esModule ? mod : { "default": mod }; + }; + Object.defineProperty(exports, "__esModule", { value: true }); + exports.findYearClosestToRef = exports.findMostLikelyADYear = void 0; + var dayjs_1 = __importDefault(require_dayjs_min()); + function findMostLikelyADYear(yearNumber) { + if (yearNumber < 100) { + if (yearNumber > 50) { + yearNumber = yearNumber + 1900; + } else { + yearNumber = yearNumber + 2e3; + } + } + return yearNumber; + } + exports.findMostLikelyADYear = findMostLikelyADYear; + function findYearClosestToRef(refDate, day, month) { + const refMoment = dayjs_1.default(refDate); + let dateMoment = refMoment; + dateMoment = dateMoment.month(month - 1); + dateMoment = dateMoment.date(day); + dateMoment = dateMoment.year(refMoment.year()); + const nextYear = dateMoment.add(1, "y"); + const lastYear = dateMoment.add(-1, "y"); + if (Math.abs(nextYear.diff(refMoment)) < Math.abs(dateMoment.diff(refMoment))) { + dateMoment = nextYear; + } else if (Math.abs(lastYear.diff(refMoment)) < Math.abs(dateMoment.diff(refMoment))) { + dateMoment = lastYear; + } + return dateMoment.year(); + } + exports.findYearClosestToRef = findYearClosestToRef; + } +}); + +// node_modules/chrono-node/dist/locales/en/constants.js +var require_constants = __commonJS({ + "node_modules/chrono-node/dist/locales/en/constants.js"(exports) { + "use strict"; + Object.defineProperty(exports, "__esModule", { value: true }); + exports.parseTimeUnits = exports.TIME_UNITS_PATTERN = exports.parseYear = exports.YEAR_PATTERN = exports.parseOrdinalNumberPattern = exports.ORDINAL_NUMBER_PATTERN = exports.parseNumberPattern = exports.NUMBER_PATTERN = exports.TIME_UNIT_DICTIONARY = exports.ORDINAL_WORD_DICTIONARY = exports.INTEGER_WORD_DICTIONARY = exports.MONTH_DICTIONARY = exports.FULL_MONTH_NAME_DICTIONARY = exports.WEEKDAY_DICTIONARY = void 0; + var pattern_1 = require_pattern(); + var years_1 = require_years(); + exports.WEEKDAY_DICTIONARY = { + sunday: 0, + sun: 0, + "sun.": 0, + monday: 1, + mon: 1, + "mon.": 1, + tuesday: 2, + tue: 2, + "tue.": 2, + wednesday: 3, + wed: 3, + "wed.": 3, + thursday: 4, + thurs: 4, + "thurs.": 4, + thur: 4, + "thur.": 4, + thu: 4, + "thu.": 4, + friday: 5, + fri: 5, + "fri.": 5, + saturday: 6, + sat: 6, + "sat.": 6 + }; + exports.FULL_MONTH_NAME_DICTIONARY = { + january: 1, + february: 2, + march: 3, + april: 4, + may: 5, + june: 6, + july: 7, + august: 8, + september: 9, + october: 10, + november: 11, + december: 12 + }; + exports.MONTH_DICTIONARY = Object.assign(Object.assign({}, exports.FULL_MONTH_NAME_DICTIONARY), { jan: 1, "jan.": 1, feb: 2, "feb.": 2, mar: 3, "mar.": 3, apr: 4, "apr.": 4, jun: 6, "jun.": 6, jul: 7, "jul.": 7, aug: 8, "aug.": 8, sep: 9, "sep.": 9, sept: 9, "sept.": 9, oct: 10, "oct.": 10, nov: 11, "nov.": 11, dec: 12, "dec.": 12 }); + exports.INTEGER_WORD_DICTIONARY = { + one: 1, + two: 2, + three: 3, + four: 4, + five: 5, + six: 6, + seven: 7, + eight: 8, + nine: 9, + ten: 10, + eleven: 11, + twelve: 12 + }; + exports.ORDINAL_WORD_DICTIONARY = { + first: 1, + second: 2, + third: 3, + fourth: 4, + fifth: 5, + sixth: 6, + seventh: 7, + eighth: 8, + ninth: 9, + tenth: 10, + eleventh: 11, + twelfth: 12, + thirteenth: 13, + fourteenth: 14, + fifteenth: 15, + sixteenth: 16, + seventeenth: 17, + eighteenth: 18, + nineteenth: 19, + twentieth: 20, + "twenty first": 21, + "twenty-first": 21, + "twenty second": 22, + "twenty-second": 22, + "twenty third": 23, + "twenty-third": 23, + "twenty fourth": 24, + "twenty-fourth": 24, + "twenty fifth": 25, + "twenty-fifth": 25, + "twenty sixth": 26, + "twenty-sixth": 26, + "twenty seventh": 27, + "twenty-seventh": 27, + "twenty eighth": 28, + "twenty-eighth": 28, + "twenty ninth": 29, + "twenty-ninth": 29, + "thirtieth": 30, + "thirty first": 31, + "thirty-first": 31 + }; + exports.TIME_UNIT_DICTIONARY = { + sec: "second", + second: "second", + seconds: "second", + min: "minute", + mins: "minute", + minute: "minute", + minutes: "minute", + h: "hour", + hr: "hour", + hrs: "hour", + hour: "hour", + hours: "hour", + day: "d", + days: "d", + week: "week", + weeks: "week", + month: "month", + months: "month", + qtr: "quarter", + quarter: "quarter", + quarters: "quarter", + y: "year", + yr: "year", + year: "year", + years: "year" + }; + exports.NUMBER_PATTERN = `(?:${pattern_1.matchAnyPattern(exports.INTEGER_WORD_DICTIONARY)}|[0-9]+|[0-9]+\\.[0-9]+|half(?:\\s{0,2}an?)?|an?\\b(?:\\s{0,2}few)?|few|several|a?\\s{0,2}couple\\s{0,2}(?:of)?)`; + function parseNumberPattern(match) { + const num = match.toLowerCase(); + if (exports.INTEGER_WORD_DICTIONARY[num] !== void 0) { + return exports.INTEGER_WORD_DICTIONARY[num]; + } else if (num === "a" || num === "an") { + return 1; + } else if (num.match(/few/)) { + return 3; + } else if (num.match(/half/)) { + return 0.5; + } else if (num.match(/couple/)) { + return 2; + } else if (num.match(/several/)) { + return 7; + } + return parseFloat(num); + } + exports.parseNumberPattern = parseNumberPattern; + exports.ORDINAL_NUMBER_PATTERN = `(?:${pattern_1.matchAnyPattern(exports.ORDINAL_WORD_DICTIONARY)}|[0-9]{1,2}(?:st|nd|rd|th)?)`; + function parseOrdinalNumberPattern(match) { + let num = match.toLowerCase(); + if (exports.ORDINAL_WORD_DICTIONARY[num] !== void 0) { + return exports.ORDINAL_WORD_DICTIONARY[num]; + } + num = num.replace(/(?:st|nd|rd|th)$/i, ""); + return parseInt(num); + } + exports.parseOrdinalNumberPattern = parseOrdinalNumberPattern; + exports.YEAR_PATTERN = `(?:[1-9][0-9]{0,3}\\s{0,2}(?:BE|AD|BC|BCE|CE)|[1-2][0-9]{3}|[5-9][0-9])`; + function parseYear(match) { + if (/BE/i.test(match)) { + match = match.replace(/BE/i, ""); + return parseInt(match) - 543; + } + if (/BCE?/i.test(match)) { + match = match.replace(/BCE?/i, ""); + return -parseInt(match); + } + if (/(AD|CE)/i.test(match)) { + match = match.replace(/(AD|CE)/i, ""); + return parseInt(match); + } + const rawYearNumber = parseInt(match); + return years_1.findMostLikelyADYear(rawYearNumber); + } + exports.parseYear = parseYear; + var SINGLE_TIME_UNIT_PATTERN = `(${exports.NUMBER_PATTERN})\\s{0,3}(${pattern_1.matchAnyPattern(exports.TIME_UNIT_DICTIONARY)})`; + var SINGLE_TIME_UNIT_REGEX = new RegExp(SINGLE_TIME_UNIT_PATTERN, "i"); + exports.TIME_UNITS_PATTERN = pattern_1.repeatedTimeunitPattern(`(?:(?:about|around)\\s{0,3})?`, SINGLE_TIME_UNIT_PATTERN); + function parseTimeUnits(timeunitText) { + const fragments = {}; + let remainingText = timeunitText; + let match = SINGLE_TIME_UNIT_REGEX.exec(remainingText); + while (match) { + collectDateTimeFragment(fragments, match); + remainingText = remainingText.substring(match[0].length).trim(); + match = SINGLE_TIME_UNIT_REGEX.exec(remainingText); + } + return fragments; + } + exports.parseTimeUnits = parseTimeUnits; + function collectDateTimeFragment(fragments, match) { + const num = parseNumberPattern(match[1]); + const unit = exports.TIME_UNIT_DICTIONARY[match[2].toLowerCase()]; + fragments[unit] = num; + } + } +}); + +// node_modules/dayjs/plugin/quarterOfYear.js +var require_quarterOfYear = __commonJS({ + "node_modules/dayjs/plugin/quarterOfYear.js"(exports, module2) { + !function(t, n) { + "object" == typeof exports && "undefined" != typeof module2 ? module2.exports = n() : "function" == typeof define && define.amd ? define(n) : (t = "undefined" != typeof globalThis ? globalThis : t || self).dayjs_plugin_quarterOfYear = n(); + }(exports, function() { + "use strict"; + var t = "month", n = "quarter"; + return function(e, i) { + var r = i.prototype; + r.quarter = function(t2) { + return this.$utils().u(t2) ? Math.ceil((this.month() + 1) / 3) : this.month(this.month() % 3 + 3 * (t2 - 1)); + }; + var s = r.add; + r.add = function(e2, i2) { + return e2 = Number(e2), this.$utils().p(i2) === n ? this.add(3 * e2, t) : s.bind(this)(e2, i2); + }; + var u = r.startOf; + r.startOf = function(e2, i2) { + var r2 = this.$utils(), s2 = !!r2.u(i2) || i2; + if (r2.p(e2) === n) { + var o = this.quarter() - 1; + return s2 ? this.month(3 * o).startOf(t).startOf("day") : this.month(3 * o + 2).endOf(t).endOf("day"); + } + return u.bind(this)(e2, i2); + }; + }; + }); + } +}); + +// node_modules/chrono-node/dist/utils/dayjs.js +var require_dayjs = __commonJS({ + "node_modules/chrono-node/dist/utils/dayjs.js"(exports) { + "use strict"; + Object.defineProperty(exports, "__esModule", { value: true }); + exports.implySimilarTime = exports.assignSimilarTime = exports.assignSimilarDate = exports.assignTheNextDay = void 0; + var index_1 = require_dist(); + function assignTheNextDay(component, targetDayJs) { + targetDayJs = targetDayJs.add(1, "day"); + assignSimilarDate(component, targetDayJs); + implySimilarTime(component, targetDayJs); + } + exports.assignTheNextDay = assignTheNextDay; + function assignSimilarDate(component, targetDayJs) { + component.assign("day", targetDayJs.date()); + component.assign("month", targetDayJs.month() + 1); + component.assign("year", targetDayJs.year()); + } + exports.assignSimilarDate = assignSimilarDate; + function assignSimilarTime(component, targetDayJs) { + component.assign("hour", targetDayJs.hour()); + component.assign("minute", targetDayJs.minute()); + component.assign("second", targetDayJs.second()); + component.assign("millisecond", targetDayJs.millisecond()); + if (component.get("hour") < 12) { + component.assign("meridiem", index_1.Meridiem.AM); + } else { + component.assign("meridiem", index_1.Meridiem.PM); + } + } + exports.assignSimilarTime = assignSimilarTime; + function implySimilarTime(component, targetDayJs) { + component.imply("hour", targetDayJs.hour()); + component.imply("minute", targetDayJs.minute()); + component.imply("second", targetDayJs.second()); + component.imply("millisecond", targetDayJs.millisecond()); + } + exports.implySimilarTime = implySimilarTime; + } +}); + +// node_modules/chrono-node/dist/timezone.js +var require_timezone = __commonJS({ + "node_modules/chrono-node/dist/timezone.js"(exports) { + "use strict"; + Object.defineProperty(exports, "__esModule", { value: true }); + exports.toTimezoneOffset = exports.TIMEZONE_ABBR_MAP = void 0; + exports.TIMEZONE_ABBR_MAP = { + ACDT: 630, + ACST: 570, + ADT: -180, + AEDT: 660, + AEST: 600, + AFT: 270, + AKDT: -480, + AKST: -540, + ALMT: 360, + AMST: -180, + AMT: -240, + ANAST: 720, + ANAT: 720, + AQTT: 300, + ART: -180, + AST: -240, + AWDT: 540, + AWST: 480, + AZOST: 0, + AZOT: -60, + AZST: 300, + AZT: 240, + BNT: 480, + BOT: -240, + BRST: -120, + BRT: -180, + BST: 60, + BTT: 360, + CAST: 480, + CAT: 120, + CCT: 390, + CDT: -300, + CEST: 120, + CET: 60, + CHADT: 825, + CHAST: 765, + CKT: -600, + CLST: -180, + CLT: -240, + COT: -300, + CST: -360, + CVT: -60, + CXT: 420, + ChST: 600, + DAVT: 420, + EASST: -300, + EAST: -360, + EAT: 180, + ECT: -300, + EDT: -240, + EEST: 180, + EET: 120, + EGST: 0, + EGT: -60, + EST: -300, + ET: -300, + FJST: 780, + FJT: 720, + FKST: -180, + FKT: -240, + FNT: -120, + GALT: -360, + GAMT: -540, + GET: 240, + GFT: -180, + GILT: 720, + GMT: 0, + GST: 240, + GYT: -240, + HAA: -180, + HAC: -300, + HADT: -540, + HAE: -240, + HAP: -420, + HAR: -360, + HAST: -600, + HAT: -90, + HAY: -480, + HKT: 480, + HLV: -210, + HNA: -240, + HNC: -360, + HNE: -300, + HNP: -480, + HNR: -420, + HNT: -150, + HNY: -540, + HOVT: 420, + ICT: 420, + IDT: 180, + IOT: 360, + IRDT: 270, + IRKST: 540, + IRKT: 540, + IRST: 210, + IST: 330, + JST: 540, + KGT: 360, + KRAST: 480, + KRAT: 480, + KST: 540, + KUYT: 240, + LHDT: 660, + LHST: 630, + LINT: 840, + MAGST: 720, + MAGT: 720, + MART: -510, + MAWT: 300, + MDT: -360, + MESZ: 120, + MEZ: 60, + MHT: 720, + MMT: 390, + MSD: 240, + MSK: 180, + MST: -420, + MUT: 240, + MVT: 300, + MYT: 480, + NCT: 660, + NDT: -90, + NFT: 690, + NOVST: 420, + NOVT: 360, + NPT: 345, + NST: -150, + NUT: -660, + NZDT: 780, + NZST: 720, + OMSST: 420, + OMST: 420, + PDT: -420, + PET: -300, + PETST: 720, + PETT: 720, + PGT: 600, + PHOT: 780, + PHT: 480, + PKT: 300, + PMDT: -120, + PMST: -180, + PONT: 660, + PST: -480, + PT: -480, + PWT: 540, + PYST: -180, + PYT: -240, + RET: 240, + SAMT: 240, + SAST: 120, + SBT: 660, + SCT: 240, + SGT: 480, + SRT: -180, + SST: -660, + TAHT: -600, + TFT: 300, + TJT: 300, + TKT: 780, + TLT: 540, + TMT: 300, + TVT: 720, + ULAT: 480, + UTC: 0, + UYST: -120, + UYT: -180, + UZT: 300, + VET: -210, + VLAST: 660, + VLAT: 660, + VUT: 660, + WAST: 120, + WAT: 60, + WEST: 60, + WESZ: 60, + WET: 0, + WEZ: 0, + WFT: 720, + WGST: -120, + WGT: -180, + WIB: 420, + WIT: 540, + WITA: 480, + WST: 780, + WT: 0, + YAKST: 600, + YAKT: 600, + YAPT: 600, + YEKST: 360, + YEKT: 360 + }; + function toTimezoneOffset(timezoneInput) { + var _a; + if (timezoneInput === null || timezoneInput === void 0) { + return null; + } + if (typeof timezoneInput === "number") { + return timezoneInput; + } + return (_a = exports.TIMEZONE_ABBR_MAP[timezoneInput]) !== null && _a !== void 0 ? _a : null; + } + exports.toTimezoneOffset = toTimezoneOffset; + } +}); + +// node_modules/chrono-node/dist/results.js +var require_results = __commonJS({ + "node_modules/chrono-node/dist/results.js"(exports) { + "use strict"; + var __importDefault = exports && exports.__importDefault || function(mod) { + return mod && mod.__esModule ? mod : { "default": mod }; + }; + Object.defineProperty(exports, "__esModule", { value: true }); + exports.ParsingResult = exports.ParsingComponents = exports.ReferenceWithTimezone = void 0; + var quarterOfYear_1 = __importDefault(require_quarterOfYear()); + var dayjs_1 = __importDefault(require_dayjs_min()); + var dayjs_2 = require_dayjs(); + var timezone_1 = require_timezone(); + dayjs_1.default.extend(quarterOfYear_1.default); + var ReferenceWithTimezone = class { + constructor(input) { + var _a; + input = input !== null && input !== void 0 ? input : new Date(); + if (input instanceof Date) { + this.instant = input; + } else { + this.instant = (_a = input.instant) !== null && _a !== void 0 ? _a : new Date(); + this.timezoneOffset = timezone_1.toTimezoneOffset(input.timezone); + } + } + }; + exports.ReferenceWithTimezone = ReferenceWithTimezone; + var ParsingComponents = class { + constructor(reference, knownComponents) { + this.reference = reference; + this.knownValues = {}; + this.impliedValues = {}; + if (knownComponents) { + for (const key in knownComponents) { + this.knownValues[key] = knownComponents[key]; + } + } + const refDayJs = dayjs_1.default(reference.instant); + this.imply("day", refDayJs.date()); + this.imply("month", refDayJs.month() + 1); + this.imply("year", refDayJs.year()); + this.imply("hour", 12); + this.imply("minute", 0); + this.imply("second", 0); + this.imply("millisecond", 0); + } + get(component) { + if (component in this.knownValues) { + return this.knownValues[component]; + } + if (component in this.impliedValues) { + return this.impliedValues[component]; + } + return null; + } + isCertain(component) { + return component in this.knownValues; + } + getCertainComponents() { + return Object.keys(this.knownValues); + } + imply(component, value) { + if (component in this.knownValues) { + return this; + } + this.impliedValues[component] = value; + return this; + } + assign(component, value) { + this.knownValues[component] = value; + delete this.impliedValues[component]; + return this; + } + delete(component) { + delete this.knownValues[component]; + delete this.impliedValues[component]; + } + clone() { + const component = new ParsingComponents(this.reference); + component.knownValues = {}; + component.impliedValues = {}; + for (const key in this.knownValues) { + component.knownValues[key] = this.knownValues[key]; + } + for (const key in this.impliedValues) { + component.impliedValues[key] = this.impliedValues[key]; + } + return component; + } + isOnlyDate() { + return !this.isCertain("hour") && !this.isCertain("minute") && !this.isCertain("second"); + } + isOnlyTime() { + return !this.isCertain("weekday") && !this.isCertain("day") && !this.isCertain("month"); + } + isOnlyWeekdayComponent() { + return this.isCertain("weekday") && !this.isCertain("day") && !this.isCertain("month"); + } + isOnlyDayMonthComponent() { + return this.isCertain("day") && this.isCertain("month") && !this.isCertain("year"); + } + isValidDate() { + const date = this.dateWithoutTimezoneAdjustment(); + if (date.getFullYear() !== this.get("year")) + return false; + if (date.getMonth() !== this.get("month") - 1) + return false; + if (date.getDate() !== this.get("day")) + return false; + if (this.get("hour") != null && date.getHours() != this.get("hour")) + return false; + if (this.get("minute") != null && date.getMinutes() != this.get("minute")) + return false; + return true; + } + toString() { + return `[ParsingComponents {knownValues: ${JSON.stringify(this.knownValues)}, impliedValues: ${JSON.stringify(this.impliedValues)}}, reference: ${JSON.stringify(this.reference)}]`; + } + dayjs() { + return dayjs_1.default(this.date()); + } + date() { + const date = this.dateWithoutTimezoneAdjustment(); + return new Date(date.getTime() + this.getSystemTimezoneAdjustmentMinute(date) * 6e4); + } + dateWithoutTimezoneAdjustment() { + const date = new Date(this.get("year"), this.get("month") - 1, this.get("day"), this.get("hour"), this.get("minute"), this.get("second"), this.get("millisecond")); + date.setFullYear(this.get("year")); + return date; + } + getSystemTimezoneAdjustmentMinute(date) { + var _a, _b; + if (!date || date.getTime() < 0) { + date = new Date(); + } + const currentTimezoneOffset = -date.getTimezoneOffset(); + const targetTimezoneOffset = (_b = (_a = this.get("timezoneOffset")) !== null && _a !== void 0 ? _a : this.reference.timezoneOffset) !== null && _b !== void 0 ? _b : currentTimezoneOffset; + return currentTimezoneOffset - targetTimezoneOffset; + } + static createRelativeFromReference(reference, fragments) { + let date = dayjs_1.default(reference.instant); + for (const key in fragments) { + date = date.add(fragments[key], key); + } + const components = new ParsingComponents(reference); + if (fragments["hour"] || fragments["minute"] || fragments["second"]) { + dayjs_2.assignSimilarTime(components, date); + dayjs_2.assignSimilarDate(components, date); + if (reference.timezoneOffset !== null) { + components.assign("timezoneOffset", -reference.instant.getTimezoneOffset()); + } + } else { + dayjs_2.implySimilarTime(components, date); + if (reference.timezoneOffset !== null) { + components.imply("timezoneOffset", -reference.instant.getTimezoneOffset()); + } + if (fragments["d"]) { + components.assign("day", date.date()); + components.assign("month", date.month() + 1); + components.assign("year", date.year()); + } else { + if (fragments["week"]) { + components.imply("weekday", date.day()); + } + components.imply("day", date.date()); + if (fragments["month"]) { + components.assign("month", date.month() + 1); + components.assign("year", date.year()); + } else { + components.imply("month", date.month() + 1); + if (fragments["year"]) { + components.assign("year", date.year()); + } else { + components.imply("year", date.year()); + } + } + } + } + return components; + } + }; + exports.ParsingComponents = ParsingComponents; + var ParsingResult = class { + constructor(reference, index, text2, start, end) { + this.reference = reference; + this.refDate = reference.instant; + this.index = index; + this.text = text2; + this.start = start || new ParsingComponents(reference); + this.end = end; + } + clone() { + const result = new ParsingResult(this.reference, this.index, this.text); + result.start = this.start ? this.start.clone() : null; + result.end = this.end ? this.end.clone() : null; + return result; + } + date() { + return this.start.date(); + } + toString() { + return `[ParsingResult {index: ${this.index}, text: '${this.text}', ...}]`; + } + }; + exports.ParsingResult = ParsingResult; + } +}); + +// node_modules/chrono-node/dist/common/parsers/AbstractParserWithWordBoundary.js +var require_AbstractParserWithWordBoundary = __commonJS({ + "node_modules/chrono-node/dist/common/parsers/AbstractParserWithWordBoundary.js"(exports) { + "use strict"; + Object.defineProperty(exports, "__esModule", { value: true }); + exports.AbstractParserWithWordBoundaryChecking = void 0; + var AbstractParserWithWordBoundaryChecking = class { + constructor() { + this.cachedInnerPattern = null; + this.cachedPattern = null; + } + patternLeftBoundary() { + return `(\\W|^)`; + } + pattern(context) { + const innerPattern = this.innerPattern(context); + if (innerPattern == this.cachedInnerPattern) { + return this.cachedPattern; + } + this.cachedPattern = new RegExp(`${this.patternLeftBoundary()}${innerPattern.source}`, innerPattern.flags); + this.cachedInnerPattern = innerPattern; + return this.cachedPattern; + } + extract(context, match) { + var _a; + const header = (_a = match[1]) !== null && _a !== void 0 ? _a : ""; + match.index = match.index + header.length; + match[0] = match[0].substring(header.length); + for (let i = 2; i < match.length; i++) { + match[i - 1] = match[i]; + } + return this.innerExtract(context, match); + } + }; + exports.AbstractParserWithWordBoundaryChecking = AbstractParserWithWordBoundaryChecking; + } +}); + +// node_modules/chrono-node/dist/locales/en/parsers/ENTimeUnitWithinFormatParser.js +var require_ENTimeUnitWithinFormatParser = __commonJS({ + "node_modules/chrono-node/dist/locales/en/parsers/ENTimeUnitWithinFormatParser.js"(exports) { + "use strict"; + Object.defineProperty(exports, "__esModule", { value: true }); + var constants_1 = require_constants(); + var results_1 = require_results(); + var AbstractParserWithWordBoundary_1 = require_AbstractParserWithWordBoundary(); + var PATTERN_WITH_PREFIX = new RegExp(`(?:within|in|for)\\s*(?:(?:about|around|roughly|approximately|just)\\s*(?:~\\s*)?)?(${constants_1.TIME_UNITS_PATTERN})(?=\\W|$)`, "i"); + var PATTERN_WITHOUT_PREFIX = new RegExp(`(?:(?:about|around|roughly|approximately|just)\\s*(?:~\\s*)?)?(${constants_1.TIME_UNITS_PATTERN})(?=\\W|$)`, "i"); + var ENTimeUnitWithinFormatParser = class extends AbstractParserWithWordBoundary_1.AbstractParserWithWordBoundaryChecking { + innerPattern(context) { + return context.option.forwardDate ? PATTERN_WITHOUT_PREFIX : PATTERN_WITH_PREFIX; + } + innerExtract(context, match) { + const timeUnits = constants_1.parseTimeUnits(match[1]); + return results_1.ParsingComponents.createRelativeFromReference(context.reference, timeUnits); + } + }; + exports.default = ENTimeUnitWithinFormatParser; + } +}); + +// node_modules/chrono-node/dist/locales/en/parsers/ENMonthNameLittleEndianParser.js +var require_ENMonthNameLittleEndianParser = __commonJS({ + "node_modules/chrono-node/dist/locales/en/parsers/ENMonthNameLittleEndianParser.js"(exports) { + "use strict"; + Object.defineProperty(exports, "__esModule", { value: true }); + var years_1 = require_years(); + var constants_1 = require_constants(); + var constants_2 = require_constants(); + var constants_3 = require_constants(); + var pattern_1 = require_pattern(); + var AbstractParserWithWordBoundary_1 = require_AbstractParserWithWordBoundary(); + var PATTERN = new RegExp(`(?:on\\s{0,3})?(${constants_3.ORDINAL_NUMBER_PATTERN})(?:\\s{0,3}(?:to|\\-|\\\u2013|until|through|till)?\\s{0,3}(${constants_3.ORDINAL_NUMBER_PATTERN}))?(?:-|/|\\s{0,3}(?:of)?\\s{0,3})(${pattern_1.matchAnyPattern(constants_1.MONTH_DICTIONARY)})(?:(?:-|/|,?\\s{0,3})(${constants_2.YEAR_PATTERN}(?![^\\s]\\d)))?(?=\\W|$)`, "i"); + var DATE_GROUP = 1; + var DATE_TO_GROUP = 2; + var MONTH_NAME_GROUP = 3; + var YEAR_GROUP = 4; + var ENMonthNameLittleEndianParser = class extends AbstractParserWithWordBoundary_1.AbstractParserWithWordBoundaryChecking { + innerPattern() { + return PATTERN; + } + innerExtract(context, match) { + const result = context.createParsingResult(match.index, match[0]); + const month = constants_1.MONTH_DICTIONARY[match[MONTH_NAME_GROUP].toLowerCase()]; + const day = constants_3.parseOrdinalNumberPattern(match[DATE_GROUP]); + if (day > 31) { + match.index = match.index + match[DATE_GROUP].length; + return null; + } + result.start.assign("month", month); + result.start.assign("day", day); + if (match[YEAR_GROUP]) { + const yearNumber = constants_2.parseYear(match[YEAR_GROUP]); + result.start.assign("year", yearNumber); + } else { + const year = years_1.findYearClosestToRef(context.refDate, day, month); + result.start.imply("year", year); + } + if (match[DATE_TO_GROUP]) { + const endDate = constants_3.parseOrdinalNumberPattern(match[DATE_TO_GROUP]); + result.end = result.start.clone(); + result.end.assign("day", endDate); + } + return result; + } + }; + exports.default = ENMonthNameLittleEndianParser; + } +}); + +// node_modules/chrono-node/dist/locales/en/parsers/ENMonthNameMiddleEndianParser.js +var require_ENMonthNameMiddleEndianParser = __commonJS({ + "node_modules/chrono-node/dist/locales/en/parsers/ENMonthNameMiddleEndianParser.js"(exports) { + "use strict"; + Object.defineProperty(exports, "__esModule", { value: true }); + var years_1 = require_years(); + var constants_1 = require_constants(); + var constants_2 = require_constants(); + var constants_3 = require_constants(); + var pattern_1 = require_pattern(); + var AbstractParserWithWordBoundary_1 = require_AbstractParserWithWordBoundary(); + var PATTERN = new RegExp(`(${pattern_1.matchAnyPattern(constants_1.MONTH_DICTIONARY)})(?:-|/|\\s*,?\\s*)(${constants_2.ORDINAL_NUMBER_PATTERN})(?!\\s*(?:am|pm))\\s*(?:(?:to|\\-)\\s*(${constants_2.ORDINAL_NUMBER_PATTERN})\\s*)?(?:(?:-|/|\\s*,?\\s*)(${constants_3.YEAR_PATTERN}))?(?=\\W|$)(?!\\:\\d)`, "i"); + var MONTH_NAME_GROUP = 1; + var DATE_GROUP = 2; + var DATE_TO_GROUP = 3; + var YEAR_GROUP = 4; + var ENMonthNameMiddleEndianParser = class extends AbstractParserWithWordBoundary_1.AbstractParserWithWordBoundaryChecking { + innerPattern() { + return PATTERN; + } + innerExtract(context, match) { + const month = constants_1.MONTH_DICTIONARY[match[MONTH_NAME_GROUP].toLowerCase()]; + const day = constants_2.parseOrdinalNumberPattern(match[DATE_GROUP]); + if (day > 31) { + return null; + } + const components = context.createParsingComponents({ + day, + month + }); + if (match[YEAR_GROUP]) { + const year = constants_3.parseYear(match[YEAR_GROUP]); + components.assign("year", year); + } else { + const year = years_1.findYearClosestToRef(context.refDate, day, month); + components.imply("year", year); + } + if (!match[DATE_TO_GROUP]) { + return components; + } + const endDate = constants_2.parseOrdinalNumberPattern(match[DATE_TO_GROUP]); + const result = context.createParsingResult(match.index, match[0]); + result.start = components; + result.end = components.clone(); + result.end.assign("day", endDate); + return result; + } + }; + exports.default = ENMonthNameMiddleEndianParser; + } +}); + +// node_modules/chrono-node/dist/locales/en/parsers/ENMonthNameParser.js +var require_ENMonthNameParser = __commonJS({ + "node_modules/chrono-node/dist/locales/en/parsers/ENMonthNameParser.js"(exports) { + "use strict"; + Object.defineProperty(exports, "__esModule", { value: true }); + var constants_1 = require_constants(); + var years_1 = require_years(); + var pattern_1 = require_pattern(); + var constants_2 = require_constants(); + var AbstractParserWithWordBoundary_1 = require_AbstractParserWithWordBoundary(); + var PATTERN = new RegExp(`((?:in)\\s*)?(${pattern_1.matchAnyPattern(constants_1.MONTH_DICTIONARY)})\\s*(?:[,-]?\\s*(${constants_2.YEAR_PATTERN})?)?(?=[^\\s\\w]|\\s+[^0-9]|\\s+$|$)`, "i"); + var PREFIX_GROUP = 1; + var MONTH_NAME_GROUP = 2; + var YEAR_GROUP = 3; + var ENMonthNameParser = class extends AbstractParserWithWordBoundary_1.AbstractParserWithWordBoundaryChecking { + innerPattern() { + return PATTERN; + } + innerExtract(context, match) { + const monthName = match[MONTH_NAME_GROUP].toLowerCase(); + if (match[0].length <= 3 && !constants_1.FULL_MONTH_NAME_DICTIONARY[monthName]) { + return null; + } + const result = context.createParsingResult(match.index + (match[PREFIX_GROUP] || "").length, match.index + match[0].length); + result.start.imply("day", 1); + const month = constants_1.MONTH_DICTIONARY[monthName]; + result.start.assign("month", month); + if (match[YEAR_GROUP]) { + const year = constants_2.parseYear(match[YEAR_GROUP]); + result.start.assign("year", year); + } else { + const year = years_1.findYearClosestToRef(context.refDate, 1, month); + result.start.imply("year", year); + } + return result; + } + }; + exports.default = ENMonthNameParser; + } +}); + +// node_modules/chrono-node/dist/locales/en/parsers/ENCasualYearMonthDayParser.js +var require_ENCasualYearMonthDayParser = __commonJS({ + "node_modules/chrono-node/dist/locales/en/parsers/ENCasualYearMonthDayParser.js"(exports) { + "use strict"; + Object.defineProperty(exports, "__esModule", { value: true }); + var constants_1 = require_constants(); + var pattern_1 = require_pattern(); + var AbstractParserWithWordBoundary_1 = require_AbstractParserWithWordBoundary(); + var PATTERN = new RegExp(`([0-9]{4})[\\.\\/\\s](?:(${pattern_1.matchAnyPattern(constants_1.MONTH_DICTIONARY)})|([0-9]{1,2}))[\\.\\/\\s]([0-9]{1,2})(?=\\W|$)`, "i"); + var YEAR_NUMBER_GROUP = 1; + var MONTH_NAME_GROUP = 2; + var MONTH_NUMBER_GROUP = 3; + var DATE_NUMBER_GROUP = 4; + var ENCasualYearMonthDayParser = class extends AbstractParserWithWordBoundary_1.AbstractParserWithWordBoundaryChecking { + innerPattern() { + return PATTERN; + } + innerExtract(context, match) { + const month = match[MONTH_NUMBER_GROUP] ? parseInt(match[MONTH_NUMBER_GROUP]) : constants_1.MONTH_DICTIONARY[match[MONTH_NAME_GROUP].toLowerCase()]; + if (month < 1 || month > 12) { + return null; + } + const year = parseInt(match[YEAR_NUMBER_GROUP]); + const day = parseInt(match[DATE_NUMBER_GROUP]); + return { + day, + month, + year + }; + } + }; + exports.default = ENCasualYearMonthDayParser; + } +}); + +// node_modules/chrono-node/dist/locales/en/parsers/ENSlashMonthFormatParser.js +var require_ENSlashMonthFormatParser = __commonJS({ + "node_modules/chrono-node/dist/locales/en/parsers/ENSlashMonthFormatParser.js"(exports) { + "use strict"; + Object.defineProperty(exports, "__esModule", { value: true }); + var AbstractParserWithWordBoundary_1 = require_AbstractParserWithWordBoundary(); + var PATTERN = new RegExp("([0-9]|0[1-9]|1[012])/([0-9]{4})", "i"); + var MONTH_GROUP = 1; + var YEAR_GROUP = 2; + var ENSlashMonthFormatParser = class extends AbstractParserWithWordBoundary_1.AbstractParserWithWordBoundaryChecking { + innerPattern() { + return PATTERN; + } + innerExtract(context, match) { + const year = parseInt(match[YEAR_GROUP]); + const month = parseInt(match[MONTH_GROUP]); + return context.createParsingComponents().imply("day", 1).assign("month", month).assign("year", year); + } + }; + exports.default = ENSlashMonthFormatParser; + } +}); + +// node_modules/chrono-node/dist/common/parsers/AbstractTimeExpressionParser.js +var require_AbstractTimeExpressionParser = __commonJS({ + "node_modules/chrono-node/dist/common/parsers/AbstractTimeExpressionParser.js"(exports) { + "use strict"; + Object.defineProperty(exports, "__esModule", { value: true }); + exports.AbstractTimeExpressionParser = void 0; + var index_1 = require_dist(); + function primaryTimePattern(leftBoundary, primaryPrefix, primarySuffix, flags) { + return new RegExp(`${leftBoundary}${primaryPrefix}(\\d{1,4})(?:(?:\\.|:|\uFF1A)(\\d{1,2})(?:(?::|\uFF1A)(\\d{2})(?:\\.(\\d{1,6}))?)?)?(?:\\s*(a\\.m\\.|p\\.m\\.|am?|pm?))?${primarySuffix}`, flags); + } + function followingTimePatten(followingPhase, followingSuffix) { + return new RegExp(`^(${followingPhase})(\\d{1,4})(?:(?:\\.|\\:|\\\uFF1A)(\\d{1,2})(?:(?:\\.|\\:|\\\uFF1A)(\\d{1,2})(?:\\.(\\d{1,6}))?)?)?(?:\\s*(a\\.m\\.|p\\.m\\.|am?|pm?))?${followingSuffix}`, "i"); + } + var HOUR_GROUP = 2; + var MINUTE_GROUP = 3; + var SECOND_GROUP = 4; + var MILLI_SECOND_GROUP = 5; + var AM_PM_HOUR_GROUP = 6; + var AbstractTimeExpressionParser = class { + constructor(strictMode = false) { + this.cachedPrimaryPrefix = null; + this.cachedPrimarySuffix = null; + this.cachedPrimaryTimePattern = null; + this.cachedFollowingPhase = null; + this.cachedFollowingSuffix = null; + this.cachedFollowingTimePatten = null; + this.strictMode = strictMode; + } + patternFlags() { + return "i"; + } + primaryPatternLeftBoundary() { + return `(^|\\s|T|\\b)`; + } + primarySuffix() { + return `(?=\\W|$)`; + } + followingSuffix() { + return `(?=\\W|$)`; + } + pattern(context) { + return this.getPrimaryTimePatternThroughCache(); + } + extract(context, match) { + const startComponents = this.extractPrimaryTimeComponents(context, match); + if (!startComponents) { + match.index += match[0].length; + return null; + } + const index = match.index + match[1].length; + const text2 = match[0].substring(match[1].length); + const result = context.createParsingResult(index, text2, startComponents); + match.index += match[0].length; + const remainingText = context.text.substring(match.index); + const followingPattern = this.getFollowingTimePatternThroughCache(); + const followingMatch = followingPattern.exec(remainingText); + if (text2.match(/^\d{3,4}/) && followingMatch && followingMatch[0].match(/^\s*([+-])\s*\d{2,4}$/)) { + return null; + } + if (!followingMatch || followingMatch[0].match(/^\s*([+-])\s*\d{3,4}$/)) { + return this.checkAndReturnWithoutFollowingPattern(result); + } + result.end = this.extractFollowingTimeComponents(context, followingMatch, result); + if (result.end) { + result.text += followingMatch[0]; + } + return this.checkAndReturnWithFollowingPattern(result); + } + extractPrimaryTimeComponents(context, match, strict = false) { + const components = context.createParsingComponents(); + let minute = 0; + let meridiem = null; + let hour = parseInt(match[HOUR_GROUP]); + if (hour > 100) { + if (this.strictMode || match[MINUTE_GROUP] != null) { + return null; + } + minute = hour % 100; + hour = Math.floor(hour / 100); + } + if (hour > 24) { + return null; + } + if (match[MINUTE_GROUP] != null) { + if (match[MINUTE_GROUP].length == 1 && !match[AM_PM_HOUR_GROUP]) { + return null; + } + minute = parseInt(match[MINUTE_GROUP]); + } + if (minute >= 60) { + return null; + } + if (hour > 12) { + meridiem = index_1.Meridiem.PM; + } + if (match[AM_PM_HOUR_GROUP] != null) { + if (hour > 12) + return null; + const ampm = match[AM_PM_HOUR_GROUP][0].toLowerCase(); + if (ampm == "a") { + meridiem = index_1.Meridiem.AM; + if (hour == 12) { + hour = 0; + } + } + if (ampm == "p") { + meridiem = index_1.Meridiem.PM; + if (hour != 12) { + hour += 12; + } + } + } + components.assign("hour", hour); + components.assign("minute", minute); + if (meridiem !== null) { + components.assign("meridiem", meridiem); + } else { + if (hour < 12) { + components.imply("meridiem", index_1.Meridiem.AM); + } else { + components.imply("meridiem", index_1.Meridiem.PM); + } + } + if (match[MILLI_SECOND_GROUP] != null) { + const millisecond = parseInt(match[MILLI_SECOND_GROUP].substring(0, 3)); + if (millisecond >= 1e3) + return null; + components.assign("millisecond", millisecond); + } + if (match[SECOND_GROUP] != null) { + const second = parseInt(match[SECOND_GROUP]); + if (second >= 60) + return null; + components.assign("second", second); + } + return components; + } + extractFollowingTimeComponents(context, match, result) { + const components = context.createParsingComponents(); + if (match[MILLI_SECOND_GROUP] != null) { + const millisecond = parseInt(match[MILLI_SECOND_GROUP].substring(0, 3)); + if (millisecond >= 1e3) + return null; + components.assign("millisecond", millisecond); + } + if (match[SECOND_GROUP] != null) { + const second = parseInt(match[SECOND_GROUP]); + if (second >= 60) + return null; + components.assign("second", second); + } + let hour = parseInt(match[HOUR_GROUP]); + let minute = 0; + let meridiem = -1; + if (match[MINUTE_GROUP] != null) { + minute = parseInt(match[MINUTE_GROUP]); + } else if (hour > 100) { + minute = hour % 100; + hour = Math.floor(hour / 100); + } + if (minute >= 60 || hour > 24) { + return null; + } + if (hour >= 12) { + meridiem = index_1.Meridiem.PM; + } + if (match[AM_PM_HOUR_GROUP] != null) { + if (hour > 12) { + return null; + } + const ampm = match[AM_PM_HOUR_GROUP][0].toLowerCase(); + if (ampm == "a") { + meridiem = index_1.Meridiem.AM; + if (hour == 12) { + hour = 0; + if (!components.isCertain("day")) { + components.imply("day", components.get("day") + 1); + } + } + } + if (ampm == "p") { + meridiem = index_1.Meridiem.PM; + if (hour != 12) + hour += 12; + } + if (!result.start.isCertain("meridiem")) { + if (meridiem == index_1.Meridiem.AM) { + result.start.imply("meridiem", index_1.Meridiem.AM); + if (result.start.get("hour") == 12) { + result.start.assign("hour", 0); + } + } else { + result.start.imply("meridiem", index_1.Meridiem.PM); + if (result.start.get("hour") != 12) { + result.start.assign("hour", result.start.get("hour") + 12); + } + } + } + } + components.assign("hour", hour); + components.assign("minute", minute); + if (meridiem >= 0) { + components.assign("meridiem", meridiem); + } else { + const startAtPM = result.start.isCertain("meridiem") && result.start.get("hour") > 12; + if (startAtPM) { + if (result.start.get("hour") - 12 > hour) { + components.imply("meridiem", index_1.Meridiem.AM); + } else if (hour <= 12) { + components.assign("hour", hour + 12); + components.assign("meridiem", index_1.Meridiem.PM); + } + } else if (hour > 12) { + components.imply("meridiem", index_1.Meridiem.PM); + } else if (hour <= 12) { + components.imply("meridiem", index_1.Meridiem.AM); + } + } + if (components.date().getTime() < result.start.date().getTime()) { + components.imply("day", components.get("day") + 1); + } + return components; + } + checkAndReturnWithoutFollowingPattern(result) { + if (result.text.match(/^\d$/)) { + return null; + } + if (result.text.match(/^\d\d\d+$/)) { + return null; + } + if (result.text.match(/\d[apAP]$/)) { + return null; + } + const endingWithNumbers = result.text.match(/[^\d:.](\d[\d.]+)$/); + if (endingWithNumbers) { + const endingNumbers = endingWithNumbers[1]; + if (this.strictMode) { + return null; + } + if (endingNumbers.includes(".") && !endingNumbers.match(/\d(\.\d{2})+$/)) { + return null; + } + const endingNumberVal = parseInt(endingNumbers); + if (endingNumberVal > 24) { + return null; + } + } + return result; + } + checkAndReturnWithFollowingPattern(result) { + if (result.text.match(/^\d+-\d+$/)) { + return null; + } + const endingWithNumbers = result.text.match(/[^\d:.](\d[\d.]+)\s*-\s*(\d[\d.]+)$/); + if (endingWithNumbers) { + if (this.strictMode) { + return null; + } + const startingNumbers = endingWithNumbers[1]; + const endingNumbers = endingWithNumbers[2]; + if (endingNumbers.includes(".") && !endingNumbers.match(/\d(\.\d{2})+$/)) { + return null; + } + const endingNumberVal = parseInt(endingNumbers); + const startingNumberVal = parseInt(startingNumbers); + if (endingNumberVal > 24 || startingNumberVal > 24) { + return null; + } + } + return result; + } + getPrimaryTimePatternThroughCache() { + const primaryPrefix = this.primaryPrefix(); + const primarySuffix = this.primarySuffix(); + if (this.cachedPrimaryPrefix === primaryPrefix && this.cachedPrimarySuffix === primarySuffix) { + return this.cachedPrimaryTimePattern; + } + this.cachedPrimaryTimePattern = primaryTimePattern(this.primaryPatternLeftBoundary(), primaryPrefix, primarySuffix, this.patternFlags()); + this.cachedPrimaryPrefix = primaryPrefix; + this.cachedPrimarySuffix = primarySuffix; + return this.cachedPrimaryTimePattern; + } + getFollowingTimePatternThroughCache() { + const followingPhase = this.followingPhase(); + const followingSuffix = this.followingSuffix(); + if (this.cachedFollowingPhase === followingPhase && this.cachedFollowingSuffix === followingSuffix) { + return this.cachedFollowingTimePatten; + } + this.cachedFollowingTimePatten = followingTimePatten(followingPhase, followingSuffix); + this.cachedFollowingPhase = followingPhase; + this.cachedFollowingSuffix = followingSuffix; + return this.cachedFollowingTimePatten; + } + }; + exports.AbstractTimeExpressionParser = AbstractTimeExpressionParser; + } +}); + +// node_modules/chrono-node/dist/locales/en/parsers/ENTimeExpressionParser.js +var require_ENTimeExpressionParser = __commonJS({ + "node_modules/chrono-node/dist/locales/en/parsers/ENTimeExpressionParser.js"(exports) { + "use strict"; + Object.defineProperty(exports, "__esModule", { value: true }); + var index_1 = require_dist(); + var AbstractTimeExpressionParser_1 = require_AbstractTimeExpressionParser(); + var ENTimeExpressionParser = class extends AbstractTimeExpressionParser_1.AbstractTimeExpressionParser { + constructor(strictMode) { + super(strictMode); + } + followingPhase() { + return "\\s*(?:\\-|\\\u2013|\\~|\\\u301C|to|\\?)\\s*"; + } + primaryPrefix() { + return "(?:(?:at|from)\\s*)??"; + } + primarySuffix() { + return "(?:\\s*(?:o\\W*clock|at\\s*night|in\\s*the\\s*(?:morning|afternoon)))?(?!/)(?=\\W|$)"; + } + extractPrimaryTimeComponents(context, match) { + const components = super.extractPrimaryTimeComponents(context, match); + if (components) { + if (match[0].endsWith("night")) { + const hour = components.get("hour"); + if (hour >= 6 && hour < 12) { + components.assign("hour", components.get("hour") + 12); + components.assign("meridiem", index_1.Meridiem.PM); + } else if (hour < 6) { + components.assign("meridiem", index_1.Meridiem.AM); + } + } + if (match[0].endsWith("afternoon")) { + components.assign("meridiem", index_1.Meridiem.PM); + const hour = components.get("hour"); + if (hour >= 0 && hour <= 6) { + components.assign("hour", components.get("hour") + 12); + } + } + if (match[0].endsWith("morning")) { + components.assign("meridiem", index_1.Meridiem.AM); + const hour = components.get("hour"); + if (hour < 12) { + components.assign("hour", components.get("hour")); + } + } + } + return components; + } + }; + exports.default = ENTimeExpressionParser; + } +}); + +// node_modules/chrono-node/dist/utils/timeunits.js +var require_timeunits = __commonJS({ + "node_modules/chrono-node/dist/utils/timeunits.js"(exports) { + "use strict"; + Object.defineProperty(exports, "__esModule", { value: true }); + exports.addImpliedTimeUnits = exports.reverseTimeUnits = void 0; + function reverseTimeUnits(timeUnits) { + const reversed = {}; + for (const key in timeUnits) { + reversed[key] = -timeUnits[key]; + } + return reversed; + } + exports.reverseTimeUnits = reverseTimeUnits; + function addImpliedTimeUnits(components, timeUnits) { + const output = components.clone(); + let date = components.dayjs(); + for (const key in timeUnits) { + date = date.add(timeUnits[key], key); + } + if ("day" in timeUnits || "d" in timeUnits || "week" in timeUnits || "month" in timeUnits || "year" in timeUnits) { + output.imply("day", date.date()); + output.imply("month", date.month() + 1); + output.imply("year", date.year()); + } + if ("second" in timeUnits || "minute" in timeUnits || "hour" in timeUnits) { + output.imply("second", date.second()); + output.imply("minute", date.minute()); + output.imply("hour", date.hour()); + } + return output; + } + exports.addImpliedTimeUnits = addImpliedTimeUnits; + } +}); + +// node_modules/chrono-node/dist/locales/en/parsers/ENTimeUnitAgoFormatParser.js +var require_ENTimeUnitAgoFormatParser = __commonJS({ + "node_modules/chrono-node/dist/locales/en/parsers/ENTimeUnitAgoFormatParser.js"(exports) { + "use strict"; + Object.defineProperty(exports, "__esModule", { value: true }); + var constants_1 = require_constants(); + var results_1 = require_results(); + var AbstractParserWithWordBoundary_1 = require_AbstractParserWithWordBoundary(); + var timeunits_1 = require_timeunits(); + var PATTERN = new RegExp(`(${constants_1.TIME_UNITS_PATTERN})\\s{0,5}(?:ago|before|earlier)(?=(?:\\W|$))`, "i"); + var STRICT_PATTERN = new RegExp(`(${constants_1.TIME_UNITS_PATTERN})\\s{0,5}ago(?=(?:\\W|$))`, "i"); + var ENTimeUnitAgoFormatParser = class extends AbstractParserWithWordBoundary_1.AbstractParserWithWordBoundaryChecking { + constructor(strictMode) { + super(); + this.strictMode = strictMode; + } + innerPattern() { + return this.strictMode ? STRICT_PATTERN : PATTERN; + } + innerExtract(context, match) { + const timeUnits = constants_1.parseTimeUnits(match[1]); + const outputTimeUnits = timeunits_1.reverseTimeUnits(timeUnits); + return results_1.ParsingComponents.createRelativeFromReference(context.reference, outputTimeUnits); + } + }; + exports.default = ENTimeUnitAgoFormatParser; + } +}); + +// node_modules/chrono-node/dist/locales/en/parsers/ENTimeUnitLaterFormatParser.js +var require_ENTimeUnitLaterFormatParser = __commonJS({ + "node_modules/chrono-node/dist/locales/en/parsers/ENTimeUnitLaterFormatParser.js"(exports) { + "use strict"; + Object.defineProperty(exports, "__esModule", { value: true }); + var constants_1 = require_constants(); + var results_1 = require_results(); + var AbstractParserWithWordBoundary_1 = require_AbstractParserWithWordBoundary(); + var PATTERN = new RegExp(`(${constants_1.TIME_UNITS_PATTERN})\\s{0,5}(?:later|after|from now|henceforth|forward|out)(?=(?:\\W|$))`, "i"); + var STRICT_PATTERN = new RegExp("(" + constants_1.TIME_UNITS_PATTERN + ")(later|from now)(?=(?:\\W|$))", "i"); + var GROUP_NUM_TIMEUNITS = 1; + var ENTimeUnitLaterFormatParser = class extends AbstractParserWithWordBoundary_1.AbstractParserWithWordBoundaryChecking { + constructor(strictMode) { + super(); + this.strictMode = strictMode; + } + innerPattern() { + return this.strictMode ? STRICT_PATTERN : PATTERN; + } + innerExtract(context, match) { + const fragments = constants_1.parseTimeUnits(match[GROUP_NUM_TIMEUNITS]); + return results_1.ParsingComponents.createRelativeFromReference(context.reference, fragments); + } + }; + exports.default = ENTimeUnitLaterFormatParser; + } +}); + +// node_modules/chrono-node/dist/common/abstractRefiners.js +var require_abstractRefiners = __commonJS({ + "node_modules/chrono-node/dist/common/abstractRefiners.js"(exports) { + "use strict"; + Object.defineProperty(exports, "__esModule", { value: true }); + exports.MergingRefiner = exports.Filter = void 0; + var Filter2 = class { + refine(context, results) { + return results.filter((r) => this.isValid(context, r)); + } + }; + exports.Filter = Filter2; + var MergingRefiner = class { + refine(context, results) { + if (results.length < 2) { + return results; + } + const mergedResults = []; + let curResult = results[0]; + let nextResult = null; + for (let i = 1; i < results.length; i++) { + nextResult = results[i]; + const textBetween = context.text.substring(curResult.index + curResult.text.length, nextResult.index); + if (!this.shouldMergeResults(textBetween, curResult, nextResult, context)) { + mergedResults.push(curResult); + curResult = nextResult; + } else { + const left = curResult; + const right = nextResult; + const mergedResult = this.mergeResults(textBetween, left, right, context); + context.debug(() => { + console.log(`${this.constructor.name} merged ${left} and ${right} into ${mergedResult}`); + }); + curResult = mergedResult; + } + } + if (curResult != null) { + mergedResults.push(curResult); + } + return mergedResults; + } + }; + exports.MergingRefiner = MergingRefiner; + } +}); + +// node_modules/chrono-node/dist/common/refiners/AbstractMergeDateRangeRefiner.js +var require_AbstractMergeDateRangeRefiner = __commonJS({ + "node_modules/chrono-node/dist/common/refiners/AbstractMergeDateRangeRefiner.js"(exports) { + "use strict"; + Object.defineProperty(exports, "__esModule", { value: true }); + var abstractRefiners_1 = require_abstractRefiners(); + var AbstractMergeDateRangeRefiner = class extends abstractRefiners_1.MergingRefiner { + shouldMergeResults(textBetween, currentResult, nextResult) { + return !currentResult.end && !nextResult.end && textBetween.match(this.patternBetween()) != null; + } + mergeResults(textBetween, fromResult, toResult) { + if (!fromResult.start.isOnlyWeekdayComponent() && !toResult.start.isOnlyWeekdayComponent()) { + toResult.start.getCertainComponents().forEach((key) => { + if (!fromResult.start.isCertain(key)) { + fromResult.start.assign(key, toResult.start.get(key)); + } + }); + fromResult.start.getCertainComponents().forEach((key) => { + if (!toResult.start.isCertain(key)) { + toResult.start.assign(key, fromResult.start.get(key)); + } + }); + } + if (fromResult.start.date().getTime() > toResult.start.date().getTime()) { + let fromMoment = fromResult.start.dayjs(); + let toMoment = toResult.start.dayjs(); + if (fromResult.start.isOnlyWeekdayComponent() && fromMoment.add(-7, "days").isBefore(toMoment)) { + fromMoment = fromMoment.add(-7, "days"); + fromResult.start.imply("day", fromMoment.date()); + fromResult.start.imply("month", fromMoment.month() + 1); + fromResult.start.imply("year", fromMoment.year()); + } else if (toResult.start.isOnlyWeekdayComponent() && toMoment.add(7, "days").isAfter(fromMoment)) { + toMoment = toMoment.add(7, "days"); + toResult.start.imply("day", toMoment.date()); + toResult.start.imply("month", toMoment.month() + 1); + toResult.start.imply("year", toMoment.year()); + } else { + [toResult, fromResult] = [fromResult, toResult]; + } + } + const result = fromResult.clone(); + result.start = fromResult.start; + result.end = toResult.start; + result.index = Math.min(fromResult.index, toResult.index); + if (fromResult.index < toResult.index) { + result.text = fromResult.text + textBetween + toResult.text; + } else { + result.text = toResult.text + textBetween + fromResult.text; + } + return result; + } + }; + exports.default = AbstractMergeDateRangeRefiner; + } +}); + +// node_modules/chrono-node/dist/locales/en/refiners/ENMergeDateRangeRefiner.js +var require_ENMergeDateRangeRefiner = __commonJS({ + "node_modules/chrono-node/dist/locales/en/refiners/ENMergeDateRangeRefiner.js"(exports) { + "use strict"; + var __importDefault = exports && exports.__importDefault || function(mod) { + return mod && mod.__esModule ? mod : { "default": mod }; + }; + Object.defineProperty(exports, "__esModule", { value: true }); + var AbstractMergeDateRangeRefiner_1 = __importDefault(require_AbstractMergeDateRangeRefiner()); + var ENMergeDateRangeRefiner = class extends AbstractMergeDateRangeRefiner_1.default { + patternBetween() { + return /^\s*(to|-)\s*$/i; + } + }; + exports.default = ENMergeDateRangeRefiner; + } +}); + +// node_modules/chrono-node/dist/calculation/mergingCalculation.js +var require_mergingCalculation = __commonJS({ + "node_modules/chrono-node/dist/calculation/mergingCalculation.js"(exports) { + "use strict"; + Object.defineProperty(exports, "__esModule", { value: true }); + exports.mergeDateTimeComponent = exports.mergeDateTimeResult = void 0; + var index_1 = require_dist(); + function mergeDateTimeResult(dateResult, timeResult) { + const result = dateResult.clone(); + const beginDate = dateResult.start; + const beginTime = timeResult.start; + result.start = mergeDateTimeComponent(beginDate, beginTime); + if (dateResult.end != null || timeResult.end != null) { + const endDate = dateResult.end == null ? dateResult.start : dateResult.end; + const endTime = timeResult.end == null ? timeResult.start : timeResult.end; + const endDateTime = mergeDateTimeComponent(endDate, endTime); + if (dateResult.end == null && endDateTime.date().getTime() < result.start.date().getTime()) { + if (endDateTime.isCertain("day")) { + endDateTime.assign("day", endDateTime.get("day") + 1); + } else { + endDateTime.imply("day", endDateTime.get("day") + 1); + } + } + result.end = endDateTime; + } + return result; + } + exports.mergeDateTimeResult = mergeDateTimeResult; + function mergeDateTimeComponent(dateComponent, timeComponent) { + const dateTimeComponent = dateComponent.clone(); + if (timeComponent.isCertain("hour")) { + dateTimeComponent.assign("hour", timeComponent.get("hour")); + dateTimeComponent.assign("minute", timeComponent.get("minute")); + if (timeComponent.isCertain("second")) { + dateTimeComponent.assign("second", timeComponent.get("second")); + if (timeComponent.isCertain("millisecond")) { + dateTimeComponent.assign("millisecond", timeComponent.get("millisecond")); + } else { + dateTimeComponent.imply("millisecond", timeComponent.get("millisecond")); + } + } else { + dateTimeComponent.imply("second", timeComponent.get("second")); + dateTimeComponent.imply("millisecond", timeComponent.get("millisecond")); + } + } else { + dateTimeComponent.imply("hour", timeComponent.get("hour")); + dateTimeComponent.imply("minute", timeComponent.get("minute")); + dateTimeComponent.imply("second", timeComponent.get("second")); + dateTimeComponent.imply("millisecond", timeComponent.get("millisecond")); + } + if (timeComponent.isCertain("timezoneOffset")) { + dateTimeComponent.assign("timezoneOffset", timeComponent.get("timezoneOffset")); + } + if (timeComponent.isCertain("meridiem")) { + dateTimeComponent.assign("meridiem", timeComponent.get("meridiem")); + } else if (timeComponent.get("meridiem") != null && dateTimeComponent.get("meridiem") == null) { + dateTimeComponent.imply("meridiem", timeComponent.get("meridiem")); + } + if (dateTimeComponent.get("meridiem") == index_1.Meridiem.PM && dateTimeComponent.get("hour") < 12) { + if (timeComponent.isCertain("hour")) { + dateTimeComponent.assign("hour", dateTimeComponent.get("hour") + 12); + } else { + dateTimeComponent.imply("hour", dateTimeComponent.get("hour") + 12); + } + } + return dateTimeComponent; + } + exports.mergeDateTimeComponent = mergeDateTimeComponent; + } +}); + +// node_modules/chrono-node/dist/common/refiners/AbstractMergeDateTimeRefiner.js +var require_AbstractMergeDateTimeRefiner = __commonJS({ + "node_modules/chrono-node/dist/common/refiners/AbstractMergeDateTimeRefiner.js"(exports) { + "use strict"; + Object.defineProperty(exports, "__esModule", { value: true }); + var abstractRefiners_1 = require_abstractRefiners(); + var mergingCalculation_1 = require_mergingCalculation(); + var ENMergeDateTimeRefiner = class extends abstractRefiners_1.MergingRefiner { + shouldMergeResults(textBetween, currentResult, nextResult) { + return (currentResult.start.isOnlyDate() && nextResult.start.isOnlyTime() || nextResult.start.isOnlyDate() && currentResult.start.isOnlyTime()) && textBetween.match(this.patternBetween()) != null; + } + mergeResults(textBetween, currentResult, nextResult) { + const result = currentResult.start.isOnlyDate() ? mergingCalculation_1.mergeDateTimeResult(currentResult, nextResult) : mergingCalculation_1.mergeDateTimeResult(nextResult, currentResult); + result.index = currentResult.index; + result.text = currentResult.text + textBetween + nextResult.text; + return result; + } + }; + exports.default = ENMergeDateTimeRefiner; + } +}); + +// node_modules/chrono-node/dist/locales/en/refiners/ENMergeDateTimeRefiner.js +var require_ENMergeDateTimeRefiner = __commonJS({ + "node_modules/chrono-node/dist/locales/en/refiners/ENMergeDateTimeRefiner.js"(exports) { + "use strict"; + var __importDefault = exports && exports.__importDefault || function(mod) { + return mod && mod.__esModule ? mod : { "default": mod }; + }; + Object.defineProperty(exports, "__esModule", { value: true }); + var AbstractMergeDateTimeRefiner_1 = __importDefault(require_AbstractMergeDateTimeRefiner()); + var ENMergeDateTimeRefiner = class extends AbstractMergeDateTimeRefiner_1.default { + patternBetween() { + return new RegExp("^\\s*(T|at|after|before|on|of|,|-)?\\s*$"); + } + }; + exports.default = ENMergeDateTimeRefiner; + } +}); + +// node_modules/chrono-node/dist/common/refiners/ExtractTimezoneAbbrRefiner.js +var require_ExtractTimezoneAbbrRefiner = __commonJS({ + "node_modules/chrono-node/dist/common/refiners/ExtractTimezoneAbbrRefiner.js"(exports) { + "use strict"; + Object.defineProperty(exports, "__esModule", { value: true }); + var TIMEZONE_NAME_PATTERN = new RegExp("^\\s*,?\\s*\\(?([A-Z]{2,4})\\)?(?=\\W|$)", "i"); + var DEFAULT_TIMEZONE_ABBR_MAP = { + ACDT: 630, + ACST: 570, + ADT: -180, + AEDT: 660, + AEST: 600, + AFT: 270, + AKDT: -480, + AKST: -540, + ALMT: 360, + AMST: -180, + AMT: -240, + ANAST: 720, + ANAT: 720, + AQTT: 300, + ART: -180, + AST: -240, + AWDT: 540, + AWST: 480, + AZOST: 0, + AZOT: -60, + AZST: 300, + AZT: 240, + BNT: 480, + BOT: -240, + BRST: -120, + BRT: -180, + BST: 60, + BTT: 360, + CAST: 480, + CAT: 120, + CCT: 390, + CDT: -300, + CEST: 120, + CET: 60, + CHADT: 825, + CHAST: 765, + CKT: -600, + CLST: -180, + CLT: -240, + COT: -300, + CST: -360, + CVT: -60, + CXT: 420, + ChST: 600, + DAVT: 420, + EASST: -300, + EAST: -360, + EAT: 180, + ECT: -300, + EDT: -240, + EEST: 180, + EET: 120, + EGST: 0, + EGT: -60, + EST: -300, + ET: -300, + FJST: 780, + FJT: 720, + FKST: -180, + FKT: -240, + FNT: -120, + GALT: -360, + GAMT: -540, + GET: 240, + GFT: -180, + GILT: 720, + GMT: 0, + GST: 240, + GYT: -240, + HAA: -180, + HAC: -300, + HADT: -540, + HAE: -240, + HAP: -420, + HAR: -360, + HAST: -600, + HAT: -90, + HAY: -480, + HKT: 480, + HLV: -210, + HNA: -240, + HNC: -360, + HNE: -300, + HNP: -480, + HNR: -420, + HNT: -150, + HNY: -540, + HOVT: 420, + ICT: 420, + IDT: 180, + IOT: 360, + IRDT: 270, + IRKST: 540, + IRKT: 540, + IRST: 210, + IST: 330, + JST: 540, + KGT: 360, + KRAST: 480, + KRAT: 480, + KST: 540, + KUYT: 240, + LHDT: 660, + LHST: 630, + LINT: 840, + MAGST: 720, + MAGT: 720, + MART: -510, + MAWT: 300, + MDT: -360, + MESZ: 120, + MEZ: 60, + MHT: 720, + MMT: 390, + MSD: 240, + MSK: 240, + MST: -420, + MUT: 240, + MVT: 300, + MYT: 480, + NCT: 660, + NDT: -90, + NFT: 690, + NOVST: 420, + NOVT: 360, + NPT: 345, + NST: -150, + NUT: -660, + NZDT: 780, + NZST: 720, + OMSST: 420, + OMST: 420, + PDT: -420, + PET: -300, + PETST: 720, + PETT: 720, + PGT: 600, + PHOT: 780, + PHT: 480, + PKT: 300, + PMDT: -120, + PMST: -180, + PONT: 660, + PST: -480, + PT: -480, + PWT: 540, + PYST: -180, + PYT: -240, + RET: 240, + SAMT: 240, + SAST: 120, + SBT: 660, + SCT: 240, + SGT: 480, + SRT: -180, + SST: -660, + TAHT: -600, + TFT: 300, + TJT: 300, + TKT: 780, + TLT: 540, + TMT: 300, + TVT: 720, + ULAT: 480, + UTC: 0, + UYST: -120, + UYT: -180, + UZT: 300, + VET: -210, + VLAST: 660, + VLAT: 660, + VUT: 660, + WAST: 120, + WAT: 60, + WEST: 60, + WESZ: 60, + WET: 0, + WEZ: 0, + WFT: 720, + WGST: -120, + WGT: -180, + WIB: 420, + WIT: 540, + WITA: 480, + WST: 780, + WT: 0, + YAKST: 600, + YAKT: 600, + YAPT: 600, + YEKST: 360, + YEKT: 360 + }; + var ExtractTimezoneAbbrRefiner = class { + constructor(timezoneOverrides) { + this.timezone = Object.assign(Object.assign({}, DEFAULT_TIMEZONE_ABBR_MAP), timezoneOverrides); + } + refine(context, results) { + var _a; + const timezoneOverrides = (_a = context.option.timezones) !== null && _a !== void 0 ? _a : {}; + results.forEach((result) => { + var _a2, _b; + const suffix = context.text.substring(result.index + result.text.length); + const match = TIMEZONE_NAME_PATTERN.exec(suffix); + if (!match) { + return; + } + const timezoneAbbr = match[1].toUpperCase(); + const extractedTimezoneOffset = (_b = (_a2 = timezoneOverrides[timezoneAbbr]) !== null && _a2 !== void 0 ? _a2 : this.timezone[timezoneAbbr]) !== null && _b !== void 0 ? _b : null; + if (extractedTimezoneOffset === null) { + return; + } + context.debug(() => { + console.log(`Extracting timezone: '${timezoneAbbr}' into: ${extractedTimezoneOffset} for: ${result.start}`); + }); + const currentTimezoneOffset = result.start.get("timezoneOffset"); + if (currentTimezoneOffset !== null && extractedTimezoneOffset != currentTimezoneOffset) { + if (result.start.isCertain("timezoneOffset")) { + return; + } + if (timezoneAbbr != match[1]) { + return; + } + } + if (result.start.isOnlyDate()) { + if (timezoneAbbr != match[1]) { + return; + } + } + result.text += match[0]; + if (!result.start.isCertain("timezoneOffset")) { + result.start.assign("timezoneOffset", extractedTimezoneOffset); + } + if (result.end != null && !result.end.isCertain("timezoneOffset")) { + result.end.assign("timezoneOffset", extractedTimezoneOffset); + } + }); + return results; + } + }; + exports.default = ExtractTimezoneAbbrRefiner; + } +}); + +// node_modules/chrono-node/dist/common/refiners/ExtractTimezoneOffsetRefiner.js +var require_ExtractTimezoneOffsetRefiner = __commonJS({ + "node_modules/chrono-node/dist/common/refiners/ExtractTimezoneOffsetRefiner.js"(exports) { + "use strict"; + Object.defineProperty(exports, "__esModule", { value: true }); + var TIMEZONE_OFFSET_PATTERN = new RegExp("^\\s*(?:\\(?(?:GMT|UTC)\\s?)?([+-])(\\d{1,2})(?::?(\\d{2}))?\\)?", "i"); + var TIMEZONE_OFFSET_SIGN_GROUP = 1; + var TIMEZONE_OFFSET_HOUR_OFFSET_GROUP = 2; + var TIMEZONE_OFFSET_MINUTE_OFFSET_GROUP = 3; + var ExtractTimezoneOffsetRefiner = class { + refine(context, results) { + results.forEach(function(result) { + if (result.start.isCertain("timezoneOffset")) { + return; + } + const suffix = context.text.substring(result.index + result.text.length); + const match = TIMEZONE_OFFSET_PATTERN.exec(suffix); + if (!match) { + return; + } + context.debug(() => { + console.log(`Extracting timezone: '${match[0]}' into : ${result}`); + }); + const hourOffset = parseInt(match[TIMEZONE_OFFSET_HOUR_OFFSET_GROUP]); + const minuteOffset = parseInt(match[TIMEZONE_OFFSET_MINUTE_OFFSET_GROUP] || "0"); + let timezoneOffset = hourOffset * 60 + minuteOffset; + if (timezoneOffset > 14 * 60) { + return; + } + if (match[TIMEZONE_OFFSET_SIGN_GROUP] === "-") { + timezoneOffset = -timezoneOffset; + } + if (result.end != null) { + result.end.assign("timezoneOffset", timezoneOffset); + } + result.start.assign("timezoneOffset", timezoneOffset); + result.text += match[0]; + }); + return results; + } + }; + exports.default = ExtractTimezoneOffsetRefiner; + } +}); + +// node_modules/chrono-node/dist/common/refiners/OverlapRemovalRefiner.js +var require_OverlapRemovalRefiner = __commonJS({ + "node_modules/chrono-node/dist/common/refiners/OverlapRemovalRefiner.js"(exports) { + "use strict"; + Object.defineProperty(exports, "__esModule", { value: true }); + var OverlapRemovalRefiner = class { + refine(context, results) { + if (results.length < 2) { + return results; + } + const filteredResults = []; + let prevResult = results[0]; + for (let i = 1; i < results.length; i++) { + const result = results[i]; + if (result.index < prevResult.index + prevResult.text.length) { + if (result.text.length > prevResult.text.length) { + prevResult = result; + } + } else { + filteredResults.push(prevResult); + prevResult = result; + } + } + if (prevResult != null) { + filteredResults.push(prevResult); + } + return filteredResults; + } + }; + exports.default = OverlapRemovalRefiner; + } +}); + +// node_modules/chrono-node/dist/common/refiners/ForwardDateRefiner.js +var require_ForwardDateRefiner = __commonJS({ + "node_modules/chrono-node/dist/common/refiners/ForwardDateRefiner.js"(exports) { + "use strict"; + var __importDefault = exports && exports.__importDefault || function(mod) { + return mod && mod.__esModule ? mod : { "default": mod }; + }; + Object.defineProperty(exports, "__esModule", { value: true }); + var dayjs_1 = __importDefault(require_dayjs_min()); + var ForwardDateRefiner = class { + refine(context, results) { + if (!context.option.forwardDate) { + return results; + } + results.forEach(function(result) { + let refMoment = dayjs_1.default(context.refDate); + if (result.start.isOnlyDayMonthComponent() && refMoment.isAfter(result.start.dayjs())) { + for (let i = 0; i < 3 && refMoment.isAfter(result.start.dayjs()); i++) { + result.start.imply("year", result.start.get("year") + 1); + context.debug(() => { + console.log(`Forward yearly adjusted for ${result} (${result.start})`); + }); + if (result.end && !result.end.isCertain("year")) { + result.end.imply("year", result.end.get("year") + 1); + context.debug(() => { + console.log(`Forward yearly adjusted for ${result} (${result.end})`); + }); + } + } + } + if (result.start.isOnlyWeekdayComponent() && refMoment.isAfter(result.start.dayjs())) { + if (refMoment.day() >= result.start.get("weekday")) { + refMoment = refMoment.day(result.start.get("weekday") + 7); + } else { + refMoment = refMoment.day(result.start.get("weekday")); + } + result.start.imply("day", refMoment.date()); + result.start.imply("month", refMoment.month() + 1); + result.start.imply("year", refMoment.year()); + context.debug(() => { + console.log(`Forward weekly adjusted for ${result} (${result.start})`); + }); + if (result.end && result.end.isOnlyWeekdayComponent()) { + if (refMoment.day() > result.end.get("weekday")) { + refMoment = refMoment.day(result.end.get("weekday") + 7); + } else { + refMoment = refMoment.day(result.end.get("weekday")); + } + result.end.imply("day", refMoment.date()); + result.end.imply("month", refMoment.month() + 1); + result.end.imply("year", refMoment.year()); + context.debug(() => { + console.log(`Forward weekly adjusted for ${result} (${result.end})`); + }); + } + } + }); + return results; + } + }; + exports.default = ForwardDateRefiner; + } +}); + +// node_modules/chrono-node/dist/common/refiners/UnlikelyFormatFilter.js +var require_UnlikelyFormatFilter = __commonJS({ + "node_modules/chrono-node/dist/common/refiners/UnlikelyFormatFilter.js"(exports) { + "use strict"; + Object.defineProperty(exports, "__esModule", { value: true }); + var abstractRefiners_1 = require_abstractRefiners(); + var UnlikelyFormatFilter = class extends abstractRefiners_1.Filter { + constructor(strictMode) { + super(); + this.strictMode = strictMode; + } + isValid(context, result) { + if (result.text.replace(" ", "").match(/^\d*(\.\d*)?$/)) { + context.debug(() => { + console.log(`Removing unlikely result '${result.text}'`); + }); + return false; + } + if (!result.start.isValidDate()) { + context.debug(() => { + console.log(`Removing invalid result: ${result} (${result.start})`); + }); + return false; + } + if (result.end && !result.end.isValidDate()) { + context.debug(() => { + console.log(`Removing invalid result: ${result} (${result.end})`); + }); + return false; + } + if (this.strictMode) { + return this.isStrictModeValid(context, result); + } + return true; + } + isStrictModeValid(context, result) { + if (result.start.isOnlyWeekdayComponent()) { + context.debug(() => { + console.log(`(Strict) Removing weekday only component: ${result} (${result.end})`); + }); + return false; + } + if (result.start.isOnlyTime() && (!result.start.isCertain("hour") || !result.start.isCertain("minute"))) { + context.debug(() => { + console.log(`(Strict) Removing uncertain time component: ${result} (${result.end})`); + }); + return false; + } + return true; + } + }; + exports.default = UnlikelyFormatFilter; + } +}); + +// node_modules/chrono-node/dist/common/parsers/ISOFormatParser.js +var require_ISOFormatParser = __commonJS({ + "node_modules/chrono-node/dist/common/parsers/ISOFormatParser.js"(exports) { + "use strict"; + Object.defineProperty(exports, "__esModule", { value: true }); + var AbstractParserWithWordBoundary_1 = require_AbstractParserWithWordBoundary(); + var PATTERN = new RegExp("([0-9]{4})\\-([0-9]{1,2})\\-([0-9]{1,2})(?:T([0-9]{1,2}):([0-9]{1,2})(?::([0-9]{1,2})(?:\\.(\\d{1,4}))?)?(?:Z|([+-]\\d{2}):?(\\d{2})?)?)?(?=\\W|$)", "i"); + var YEAR_NUMBER_GROUP = 1; + var MONTH_NUMBER_GROUP = 2; + var DATE_NUMBER_GROUP = 3; + var HOUR_NUMBER_GROUP = 4; + var MINUTE_NUMBER_GROUP = 5; + var SECOND_NUMBER_GROUP = 6; + var MILLISECOND_NUMBER_GROUP = 7; + var TZD_HOUR_OFFSET_GROUP = 8; + var TZD_MINUTE_OFFSET_GROUP = 9; + var ISOFormatParser = class extends AbstractParserWithWordBoundary_1.AbstractParserWithWordBoundaryChecking { + innerPattern() { + return PATTERN; + } + innerExtract(context, match) { + const components = {}; + components["year"] = parseInt(match[YEAR_NUMBER_GROUP]); + components["month"] = parseInt(match[MONTH_NUMBER_GROUP]); + components["day"] = parseInt(match[DATE_NUMBER_GROUP]); + if (match[HOUR_NUMBER_GROUP] != null) { + components["hour"] = parseInt(match[HOUR_NUMBER_GROUP]); + components["minute"] = parseInt(match[MINUTE_NUMBER_GROUP]); + if (match[SECOND_NUMBER_GROUP] != null) { + components["second"] = parseInt(match[SECOND_NUMBER_GROUP]); + } + if (match[MILLISECOND_NUMBER_GROUP] != null) { + components["millisecond"] = parseInt(match[MILLISECOND_NUMBER_GROUP]); + } + if (match[TZD_HOUR_OFFSET_GROUP] == null) { + components["timezoneOffset"] = 0; + } else { + const hourOffset = parseInt(match[TZD_HOUR_OFFSET_GROUP]); + let minuteOffset = 0; + if (match[TZD_MINUTE_OFFSET_GROUP] != null) { + minuteOffset = parseInt(match[TZD_MINUTE_OFFSET_GROUP]); + } + let offset2 = hourOffset * 60; + if (offset2 < 0) { + offset2 -= minuteOffset; + } else { + offset2 += minuteOffset; + } + components["timezoneOffset"] = offset2; + } + } + return components; + } + }; + exports.default = ISOFormatParser; + } +}); + +// node_modules/chrono-node/dist/common/refiners/MergeWeekdayComponentRefiner.js +var require_MergeWeekdayComponentRefiner = __commonJS({ + "node_modules/chrono-node/dist/common/refiners/MergeWeekdayComponentRefiner.js"(exports) { + "use strict"; + Object.defineProperty(exports, "__esModule", { value: true }); + var abstractRefiners_1 = require_abstractRefiners(); + var MergeWeekdayComponentRefiner = class extends abstractRefiners_1.MergingRefiner { + mergeResults(textBetween, currentResult, nextResult) { + const newResult = nextResult.clone(); + newResult.index = currentResult.index; + newResult.text = currentResult.text + textBetween + newResult.text; + newResult.start.assign("weekday", currentResult.start.get("weekday")); + if (newResult.end) { + newResult.end.assign("weekday", currentResult.start.get("weekday")); + } + return newResult; + } + shouldMergeResults(textBetween, currentResult, nextResult) { + const weekdayThenNormalDate = currentResult.start.isOnlyWeekdayComponent() && !currentResult.start.isCertain("hour") && nextResult.start.isCertain("day"); + return weekdayThenNormalDate && textBetween.match(/^,?\s*$/) != null; + } + }; + exports.default = MergeWeekdayComponentRefiner; + } +}); + +// node_modules/chrono-node/dist/configurations.js +var require_configurations = __commonJS({ + "node_modules/chrono-node/dist/configurations.js"(exports) { + "use strict"; + var __importDefault = exports && exports.__importDefault || function(mod) { + return mod && mod.__esModule ? mod : { "default": mod }; + }; + Object.defineProperty(exports, "__esModule", { value: true }); + exports.includeCommonConfiguration = void 0; + var ExtractTimezoneAbbrRefiner_1 = __importDefault(require_ExtractTimezoneAbbrRefiner()); + var ExtractTimezoneOffsetRefiner_1 = __importDefault(require_ExtractTimezoneOffsetRefiner()); + var OverlapRemovalRefiner_1 = __importDefault(require_OverlapRemovalRefiner()); + var ForwardDateRefiner_1 = __importDefault(require_ForwardDateRefiner()); + var UnlikelyFormatFilter_1 = __importDefault(require_UnlikelyFormatFilter()); + var ISOFormatParser_1 = __importDefault(require_ISOFormatParser()); + var MergeWeekdayComponentRefiner_1 = __importDefault(require_MergeWeekdayComponentRefiner()); + function includeCommonConfiguration(configuration, strictMode = false) { + configuration.parsers.unshift(new ISOFormatParser_1.default()); + configuration.refiners.unshift(new MergeWeekdayComponentRefiner_1.default()); + configuration.refiners.unshift(new ExtractTimezoneAbbrRefiner_1.default()); + configuration.refiners.unshift(new ExtractTimezoneOffsetRefiner_1.default()); + configuration.refiners.unshift(new OverlapRemovalRefiner_1.default()); + configuration.refiners.push(new OverlapRemovalRefiner_1.default()); + configuration.refiners.push(new ForwardDateRefiner_1.default()); + configuration.refiners.push(new UnlikelyFormatFilter_1.default(strictMode)); + return configuration; + } + exports.includeCommonConfiguration = includeCommonConfiguration; + } +}); + +// node_modules/chrono-node/dist/common/casualReferences.js +var require_casualReferences = __commonJS({ + "node_modules/chrono-node/dist/common/casualReferences.js"(exports) { + "use strict"; + var __importDefault = exports && exports.__importDefault || function(mod) { + return mod && mod.__esModule ? mod : { "default": mod }; + }; + Object.defineProperty(exports, "__esModule", { value: true }); + exports.noon = exports.morning = exports.midnight = exports.yesterdayEvening = exports.evening = exports.lastNight = exports.tonight = exports.theDayAfter = exports.tomorrow = exports.theDayBefore = exports.yesterday = exports.today = exports.now = void 0; + var results_1 = require_results(); + var dayjs_1 = __importDefault(require_dayjs_min()); + var dayjs_2 = require_dayjs(); + var index_1 = require_dist(); + function now(reference) { + const targetDate = dayjs_1.default(reference.instant); + const component = new results_1.ParsingComponents(reference, {}); + dayjs_2.assignSimilarDate(component, targetDate); + dayjs_2.assignSimilarTime(component, targetDate); + if (reference.timezoneOffset !== null) { + component.assign("timezoneOffset", targetDate.utcOffset()); + } + return component; + } + exports.now = now; + function today(reference) { + const targetDate = dayjs_1.default(reference.instant); + const component = new results_1.ParsingComponents(reference, {}); + dayjs_2.assignSimilarDate(component, targetDate); + dayjs_2.implySimilarTime(component, targetDate); + return component; + } + exports.today = today; + function yesterday(reference) { + return theDayBefore(reference, 1); + } + exports.yesterday = yesterday; + function theDayBefore(reference, numDay) { + return theDayAfter(reference, -numDay); + } + exports.theDayBefore = theDayBefore; + function tomorrow(reference) { + return theDayAfter(reference, 1); + } + exports.tomorrow = tomorrow; + function theDayAfter(reference, nDays) { + let targetDate = dayjs_1.default(reference.instant); + const component = new results_1.ParsingComponents(reference, {}); + targetDate = targetDate.add(nDays, "day"); + dayjs_2.assignSimilarDate(component, targetDate); + dayjs_2.implySimilarTime(component, targetDate); + return component; + } + exports.theDayAfter = theDayAfter; + function tonight(reference, implyHour = 22) { + const targetDate = dayjs_1.default(reference.instant); + const component = new results_1.ParsingComponents(reference, {}); + component.imply("hour", implyHour); + component.imply("meridiem", index_1.Meridiem.PM); + dayjs_2.assignSimilarDate(component, targetDate); + return component; + } + exports.tonight = tonight; + function lastNight(reference, implyHour = 0) { + let targetDate = dayjs_1.default(reference.instant); + const component = new results_1.ParsingComponents(reference, {}); + if (targetDate.hour() < 6) { + targetDate = targetDate.add(-1, "day"); + } + dayjs_2.assignSimilarDate(component, targetDate); + component.imply("hour", implyHour); + return component; + } + exports.lastNight = lastNight; + function evening(reference, implyHour = 20) { + const component = new results_1.ParsingComponents(reference, {}); + component.imply("meridiem", index_1.Meridiem.PM); + component.imply("hour", implyHour); + return component; + } + exports.evening = evening; + function yesterdayEvening(reference, implyHour = 20) { + let targetDate = dayjs_1.default(reference.instant); + const component = new results_1.ParsingComponents(reference, {}); + targetDate = targetDate.add(-1, "day"); + dayjs_2.assignSimilarDate(component, targetDate); + component.imply("hour", implyHour); + component.imply("meridiem", index_1.Meridiem.PM); + return component; + } + exports.yesterdayEvening = yesterdayEvening; + function midnight(reference) { + const component = new results_1.ParsingComponents(reference, {}); + component.imply("hour", 0); + component.imply("minute", 0); + component.imply("second", 0); + return component; + } + exports.midnight = midnight; + function morning(reference, implyHour = 6) { + const component = new results_1.ParsingComponents(reference, {}); + component.imply("meridiem", index_1.Meridiem.AM); + component.imply("hour", implyHour); + return component; + } + exports.morning = morning; + function noon(reference) { + const component = new results_1.ParsingComponents(reference, {}); + component.imply("meridiem", index_1.Meridiem.AM); + component.imply("hour", 12); + return component; + } + exports.noon = noon; + } +}); + +// node_modules/chrono-node/dist/locales/en/parsers/ENCasualDateParser.js +var require_ENCasualDateParser = __commonJS({ + "node_modules/chrono-node/dist/locales/en/parsers/ENCasualDateParser.js"(exports) { + "use strict"; + var __createBinding = exports && exports.__createBinding || (Object.create ? function(o, m, k, k2) { + if (k2 === void 0) + k2 = k; + Object.defineProperty(o, k2, { enumerable: true, get: function() { + return m[k]; + } }); + } : function(o, m, k, k2) { + if (k2 === void 0) + k2 = k; + o[k2] = m[k]; + }); + var __setModuleDefault = exports && exports.__setModuleDefault || (Object.create ? function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); + } : function(o, v) { + o["default"] = v; + }); + var __importStar = exports && exports.__importStar || function(mod) { + if (mod && mod.__esModule) + return mod; + var result = {}; + if (mod != null) { + for (var k in mod) + if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) + __createBinding(result, mod, k); + } + __setModuleDefault(result, mod); + return result; + }; + var __importDefault = exports && exports.__importDefault || function(mod) { + return mod && mod.__esModule ? mod : { "default": mod }; + }; + Object.defineProperty(exports, "__esModule", { value: true }); + var dayjs_1 = __importDefault(require_dayjs_min()); + var AbstractParserWithWordBoundary_1 = require_AbstractParserWithWordBoundary(); + var dayjs_2 = require_dayjs(); + var references = __importStar(require_casualReferences()); + var PATTERN = /(now|today|tonight|tomorrow|tmr|tmrw|yesterday|last\s*night)(?=\W|$)/i; + var ENCasualDateParser = class extends AbstractParserWithWordBoundary_1.AbstractParserWithWordBoundaryChecking { + innerPattern(context) { + return PATTERN; + } + innerExtract(context, match) { + let targetDate = dayjs_1.default(context.refDate); + const lowerText = match[0].toLowerCase(); + const component = context.createParsingComponents(); + switch (lowerText) { + case "now": + return references.now(context.reference); + case "today": + return references.today(context.reference); + case "yesterday": + return references.yesterday(context.reference); + case "tomorrow": + case "tmr": + case "tmrw": + return references.tomorrow(context.reference); + case "tonight": + return references.tonight(context.reference); + default: + if (lowerText.match(/last\s*night/)) { + if (targetDate.hour() > 6) { + targetDate = targetDate.add(-1, "day"); + } + dayjs_2.assignSimilarDate(component, targetDate); + component.imply("hour", 0); + } + break; + } + return component; + } + }; + exports.default = ENCasualDateParser; + } +}); + +// node_modules/chrono-node/dist/locales/en/parsers/ENCasualTimeParser.js +var require_ENCasualTimeParser = __commonJS({ + "node_modules/chrono-node/dist/locales/en/parsers/ENCasualTimeParser.js"(exports) { + "use strict"; + var __importDefault = exports && exports.__importDefault || function(mod) { + return mod && mod.__esModule ? mod : { "default": mod }; + }; + Object.defineProperty(exports, "__esModule", { value: true }); + var index_1 = require_dist(); + var AbstractParserWithWordBoundary_1 = require_AbstractParserWithWordBoundary(); + var dayjs_1 = __importDefault(require_dayjs_min()); + var dayjs_2 = require_dayjs(); + var PATTERN = /(?:this)?\s{0,3}(morning|afternoon|evening|night|midnight|noon)(?=\W|$)/i; + var ENCasualTimeParser = class extends AbstractParserWithWordBoundary_1.AbstractParserWithWordBoundaryChecking { + innerPattern() { + return PATTERN; + } + innerExtract(context, match) { + const targetDate = dayjs_1.default(context.refDate); + const component = context.createParsingComponents(); + switch (match[1].toLowerCase()) { + case "afternoon": + component.imply("meridiem", index_1.Meridiem.PM); + component.imply("hour", 15); + break; + case "evening": + case "night": + component.imply("meridiem", index_1.Meridiem.PM); + component.imply("hour", 20); + break; + case "midnight": + dayjs_2.assignTheNextDay(component, targetDate); + component.imply("hour", 0); + component.imply("minute", 0); + component.imply("second", 0); + break; + case "morning": + component.imply("meridiem", index_1.Meridiem.AM); + component.imply("hour", 6); + break; + case "noon": + component.imply("meridiem", index_1.Meridiem.AM); + component.imply("hour", 12); + break; + } + return component; + } + }; + exports.default = ENCasualTimeParser; + } +}); + +// node_modules/chrono-node/dist/calculation/weeks.js +var require_weeks = __commonJS({ + "node_modules/chrono-node/dist/calculation/weeks.js"(exports) { + "use strict"; + var __importDefault = exports && exports.__importDefault || function(mod) { + return mod && mod.__esModule ? mod : { "default": mod }; + }; + Object.defineProperty(exports, "__esModule", { value: true }); + exports.toDayJSClosestWeekday = exports.toDayJSWeekday = void 0; + var dayjs_1 = __importDefault(require_dayjs_min()); + function toDayJSWeekday(refDate, offset2, modifier) { + if (!modifier) { + return toDayJSClosestWeekday(refDate, offset2); + } + let date = dayjs_1.default(refDate); + switch (modifier) { + case "this": + date = date.day(offset2); + break; + case "next": + date = date.day(offset2 + 7); + break; + case "last": + date = date.day(offset2 - 7); + break; + } + return date; + } + exports.toDayJSWeekday = toDayJSWeekday; + function toDayJSClosestWeekday(refDate, offset2) { + let date = dayjs_1.default(refDate); + const refOffset = date.day(); + if (Math.abs(offset2 - 7 - refOffset) < Math.abs(offset2 - refOffset)) { + date = date.day(offset2 - 7); + } else if (Math.abs(offset2 + 7 - refOffset) < Math.abs(offset2 - refOffset)) { + date = date.day(offset2 + 7); + } else { + date = date.day(offset2); + } + return date; + } + exports.toDayJSClosestWeekday = toDayJSClosestWeekday; + } +}); + +// node_modules/chrono-node/dist/locales/en/parsers/ENWeekdayParser.js +var require_ENWeekdayParser = __commonJS({ + "node_modules/chrono-node/dist/locales/en/parsers/ENWeekdayParser.js"(exports) { + "use strict"; + Object.defineProperty(exports, "__esModule", { value: true }); + var constants_1 = require_constants(); + var pattern_1 = require_pattern(); + var AbstractParserWithWordBoundary_1 = require_AbstractParserWithWordBoundary(); + var weeks_1 = require_weeks(); + var PATTERN = new RegExp(`(?:(?:\\,|\\(|\\\uFF08)\\s*)?(?:on\\s*?)?(?:(this|last|past|next)\\s*)?(${pattern_1.matchAnyPattern(constants_1.WEEKDAY_DICTIONARY)})(?:\\s*(?:\\,|\\)|\\\uFF09))?(?:\\s*(this|last|past|next)\\s*week)?(?=\\W|$)`, "i"); + var PREFIX_GROUP = 1; + var WEEKDAY_GROUP = 2; + var POSTFIX_GROUP = 3; + var ENWeekdayParser = class extends AbstractParserWithWordBoundary_1.AbstractParserWithWordBoundaryChecking { + innerPattern() { + return PATTERN; + } + innerExtract(context, match) { + const dayOfWeek = match[WEEKDAY_GROUP].toLowerCase(); + const offset2 = constants_1.WEEKDAY_DICTIONARY[dayOfWeek]; + const prefix = match[PREFIX_GROUP]; + const postfix = match[POSTFIX_GROUP]; + let modifierWord = prefix || postfix; + modifierWord = modifierWord || ""; + modifierWord = modifierWord.toLowerCase(); + let modifier = null; + if (modifierWord == "last" || modifierWord == "past") { + modifier = "last"; + } else if (modifierWord == "next") { + modifier = "next"; + } else if (modifierWord == "this") { + modifier = "this"; + } + const date = weeks_1.toDayJSWeekday(context.refDate, offset2, modifier); + return context.createParsingComponents().assign("weekday", offset2).imply("day", date.date()).imply("month", date.month() + 1).imply("year", date.year()); + } + }; + exports.default = ENWeekdayParser; + } +}); + +// node_modules/chrono-node/dist/locales/en/parsers/ENRelativeDateFormatParser.js +var require_ENRelativeDateFormatParser = __commonJS({ + "node_modules/chrono-node/dist/locales/en/parsers/ENRelativeDateFormatParser.js"(exports) { + "use strict"; + var __importDefault = exports && exports.__importDefault || function(mod) { + return mod && mod.__esModule ? mod : { "default": mod }; + }; + Object.defineProperty(exports, "__esModule", { value: true }); + var constants_1 = require_constants(); + var results_1 = require_results(); + var dayjs_1 = __importDefault(require_dayjs_min()); + var AbstractParserWithWordBoundary_1 = require_AbstractParserWithWordBoundary(); + var pattern_1 = require_pattern(); + var PATTERN = new RegExp(`(this|last|past|next|after\\s*this)\\s*(${pattern_1.matchAnyPattern(constants_1.TIME_UNIT_DICTIONARY)})(?=\\s*)(?=\\W|$)`, "i"); + var MODIFIER_WORD_GROUP = 1; + var RELATIVE_WORD_GROUP = 2; + var ENRelativeDateFormatParser = class extends AbstractParserWithWordBoundary_1.AbstractParserWithWordBoundaryChecking { + innerPattern() { + return PATTERN; + } + innerExtract(context, match) { + const modifier = match[MODIFIER_WORD_GROUP].toLowerCase(); + const unitWord = match[RELATIVE_WORD_GROUP].toLowerCase(); + const timeunit = constants_1.TIME_UNIT_DICTIONARY[unitWord]; + if (modifier == "next" || modifier.startsWith("after")) { + const timeUnits = {}; + timeUnits[timeunit] = 1; + return results_1.ParsingComponents.createRelativeFromReference(context.reference, timeUnits); + } + if (modifier == "last" || modifier == "past") { + const timeUnits = {}; + timeUnits[timeunit] = -1; + return results_1.ParsingComponents.createRelativeFromReference(context.reference, timeUnits); + } + const components = context.createParsingComponents(); + let date = dayjs_1.default(context.reference.instant); + if (unitWord.match(/week/i)) { + date = date.add(-date.get("d"), "d"); + components.imply("day", date.date()); + components.imply("month", date.month() + 1); + components.imply("year", date.year()); + } else if (unitWord.match(/month/i)) { + date = date.add(-date.date() + 1, "d"); + components.imply("day", date.date()); + components.assign("year", date.year()); + components.assign("month", date.month() + 1); + } else if (unitWord.match(/year/i)) { + date = date.add(-date.date() + 1, "d"); + date = date.add(-date.month(), "month"); + components.imply("day", date.date()); + components.imply("month", date.month() + 1); + components.assign("year", date.year()); + } + return components; + } + }; + exports.default = ENRelativeDateFormatParser; + } +}); + +// node_modules/chrono-node/dist/chrono.js +var require_chrono = __commonJS({ + "node_modules/chrono-node/dist/chrono.js"(exports) { + "use strict"; + Object.defineProperty(exports, "__esModule", { value: true }); + exports.ParsingContext = exports.Chrono = void 0; + var results_1 = require_results(); + var en_1 = require_en(); + var Chrono = class { + constructor(configuration) { + configuration = configuration || en_1.createCasualConfiguration(); + this.parsers = [...configuration.parsers]; + this.refiners = [...configuration.refiners]; + } + clone() { + return new Chrono({ + parsers: [...this.parsers], + refiners: [...this.refiners] + }); + } + parseDate(text2, referenceDate, option) { + const results = this.parse(text2, referenceDate, option); + return results.length > 0 ? results[0].start.date() : null; + } + parse(text2, referenceDate, option) { + const context = new ParsingContext(text2, referenceDate, option); + let results = []; + this.parsers.forEach((parser) => { + const parsedResults = Chrono.executeParser(context, parser); + results = results.concat(parsedResults); + }); + results.sort((a, b) => { + return a.index - b.index; + }); + this.refiners.forEach(function(refiner) { + results = refiner.refine(context, results); + }); + return results; + } + static executeParser(context, parser) { + const results = []; + const pattern = parser.pattern(context); + const originalText = context.text; + let remainingText = context.text; + let match = pattern.exec(remainingText); + while (match) { + const index = match.index + originalText.length - remainingText.length; + match.index = index; + const result = parser.extract(context, match); + if (!result) { + remainingText = originalText.substring(match.index + 1); + match = pattern.exec(remainingText); + continue; + } + let parsedResult = null; + if (result instanceof results_1.ParsingResult) { + parsedResult = result; + } else if (result instanceof results_1.ParsingComponents) { + parsedResult = context.createParsingResult(match.index, match[0]); + parsedResult.start = result; + } else { + parsedResult = context.createParsingResult(match.index, match[0], result); + } + context.debug(() => console.log(`${parser.constructor.name} extracted result ${parsedResult}`)); + results.push(parsedResult); + remainingText = originalText.substring(index + parsedResult.text.length); + match = pattern.exec(remainingText); + } + return results; + } + }; + exports.Chrono = Chrono; + var ParsingContext = class { + constructor(text2, refDate, option) { + this.text = text2; + this.reference = new results_1.ReferenceWithTimezone(refDate); + this.option = option !== null && option !== void 0 ? option : {}; + this.refDate = this.reference.instant; + } + createParsingComponents(components) { + if (components instanceof results_1.ParsingComponents) { + return components; + } + return new results_1.ParsingComponents(this.reference, components); + } + createParsingResult(index, textOrEndIndex, startComponents, endComponents) { + const text2 = typeof textOrEndIndex === "string" ? textOrEndIndex : this.text.substring(index, textOrEndIndex); + const start = startComponents ? this.createParsingComponents(startComponents) : null; + const end = endComponents ? this.createParsingComponents(endComponents) : null; + return new results_1.ParsingResult(this.reference, index, text2, start, end); + } + debug(block) { + if (this.option.debug) { + if (this.option.debug instanceof Function) { + this.option.debug(block); + } else { + const handler = this.option.debug; + handler.debug(block); + } + } + } + }; + exports.ParsingContext = ParsingContext; + } +}); + +// node_modules/chrono-node/dist/common/parsers/SlashDateFormatParser.js +var require_SlashDateFormatParser = __commonJS({ + "node_modules/chrono-node/dist/common/parsers/SlashDateFormatParser.js"(exports) { + "use strict"; + Object.defineProperty(exports, "__esModule", { value: true }); + var years_1 = require_years(); + var PATTERN = new RegExp("([^\\d]|^)([0-3]{0,1}[0-9]{1})[\\/\\.\\-]([0-3]{0,1}[0-9]{1})(?:[\\/\\.\\-]([0-9]{4}|[0-9]{2}))?(\\W|$)", "i"); + var OPENING_GROUP = 1; + var ENDING_GROUP = 5; + var FIRST_NUMBERS_GROUP = 2; + var SECOND_NUMBERS_GROUP = 3; + var YEAR_GROUP = 4; + var SlashDateFormatParser = class { + constructor(littleEndian) { + this.groupNumberMonth = littleEndian ? SECOND_NUMBERS_GROUP : FIRST_NUMBERS_GROUP; + this.groupNumberDay = littleEndian ? FIRST_NUMBERS_GROUP : SECOND_NUMBERS_GROUP; + } + pattern() { + return PATTERN; + } + extract(context, match) { + if (match[OPENING_GROUP] == "/" || match[ENDING_GROUP] == "/") { + match.index += match[0].length; + return; + } + const index = match.index + match[OPENING_GROUP].length; + const text2 = match[0].substr(match[OPENING_GROUP].length, match[0].length - match[OPENING_GROUP].length - match[ENDING_GROUP].length); + if (text2.match(/^\d\.\d$/) || text2.match(/^\d\.\d{1,2}\.\d{1,2}\s*$/)) { + return; + } + if (!match[YEAR_GROUP] && match[0].indexOf("/") < 0) { + return; + } + const result = context.createParsingResult(index, text2); + let month = parseInt(match[this.groupNumberMonth]); + let day = parseInt(match[this.groupNumberDay]); + if (month < 1 || month > 12) { + if (month > 12) { + if (day >= 1 && day <= 12 && month <= 31) { + [day, month] = [month, day]; + } else { + return null; + } + } + } + if (day < 1 || day > 31) { + return null; + } + result.start.assign("day", day); + result.start.assign("month", month); + if (match[YEAR_GROUP]) { + const rawYearNumber = parseInt(match[YEAR_GROUP]); + const year = years_1.findMostLikelyADYear(rawYearNumber); + result.start.assign("year", year); + } else { + const year = years_1.findYearClosestToRef(context.refDate, day, month); + result.start.imply("year", year); + } + return result; + } + }; + exports.default = SlashDateFormatParser; + } +}); + +// node_modules/chrono-node/dist/locales/en/parsers/ENTimeUnitCasualRelativeFormatParser.js +var require_ENTimeUnitCasualRelativeFormatParser = __commonJS({ + "node_modules/chrono-node/dist/locales/en/parsers/ENTimeUnitCasualRelativeFormatParser.js"(exports) { + "use strict"; + Object.defineProperty(exports, "__esModule", { value: true }); + var constants_1 = require_constants(); + var results_1 = require_results(); + var AbstractParserWithWordBoundary_1 = require_AbstractParserWithWordBoundary(); + var timeunits_1 = require_timeunits(); + var PATTERN = new RegExp(`(this|last|past|next|after|\\+|-)\\s*(${constants_1.TIME_UNITS_PATTERN})(?=\\W|$)`, "i"); + var ENTimeUnitCasualRelativeFormatParser = class extends AbstractParserWithWordBoundary_1.AbstractParserWithWordBoundaryChecking { + innerPattern() { + return PATTERN; + } + innerExtract(context, match) { + const prefix = match[1].toLowerCase(); + let timeUnits = constants_1.parseTimeUnits(match[2]); + switch (prefix) { + case "last": + case "past": + case "-": + timeUnits = timeunits_1.reverseTimeUnits(timeUnits); + break; + } + return results_1.ParsingComponents.createRelativeFromReference(context.reference, timeUnits); + } + }; + exports.default = ENTimeUnitCasualRelativeFormatParser; + } +}); + +// node_modules/chrono-node/dist/locales/en/refiners/ENMergeRelativeDateRefiner.js +var require_ENMergeRelativeDateRefiner = __commonJS({ + "node_modules/chrono-node/dist/locales/en/refiners/ENMergeRelativeDateRefiner.js"(exports) { + "use strict"; + Object.defineProperty(exports, "__esModule", { value: true }); + var abstractRefiners_1 = require_abstractRefiners(); + var results_1 = require_results(); + var constants_1 = require_constants(); + var timeunits_1 = require_timeunits(); + function hasImpliedEarlierReferenceDate(result) { + return result.text.match(/\s+(before|from)$/i) != null; + } + function hasImpliedLaterReferenceDate(result) { + return result.text.match(/\s+(after|since)$/i) != null; + } + var ENMergeRelativeDateRefiner = class extends abstractRefiners_1.MergingRefiner { + patternBetween() { + return /^\s*$/i; + } + shouldMergeResults(textBetween, currentResult, nextResult) { + if (!textBetween.match(this.patternBetween())) { + return false; + } + if (!hasImpliedEarlierReferenceDate(currentResult) && !hasImpliedLaterReferenceDate(currentResult)) { + return false; + } + return !!nextResult.start.get("day") && !!nextResult.start.get("month") && !!nextResult.start.get("year"); + } + mergeResults(textBetween, currentResult, nextResult) { + let timeUnits = constants_1.parseTimeUnits(currentResult.text); + if (hasImpliedEarlierReferenceDate(currentResult)) { + timeUnits = timeunits_1.reverseTimeUnits(timeUnits); + } + const components = results_1.ParsingComponents.createRelativeFromReference(new results_1.ReferenceWithTimezone(nextResult.start.date()), timeUnits); + return new results_1.ParsingResult(nextResult.reference, currentResult.index, `${currentResult.text}${textBetween}${nextResult.text}`, components); + } + }; + exports.default = ENMergeRelativeDateRefiner; + } +}); + +// node_modules/chrono-node/dist/locales/en/index.js +var require_en = __commonJS({ + "node_modules/chrono-node/dist/locales/en/index.js"(exports) { + "use strict"; + var __importDefault = exports && exports.__importDefault || function(mod) { + return mod && mod.__esModule ? mod : { "default": mod }; + }; + Object.defineProperty(exports, "__esModule", { value: true }); + exports.createConfiguration = exports.createCasualConfiguration = exports.parseDate = exports.parse = exports.GB = exports.strict = exports.casual = void 0; + var ENTimeUnitWithinFormatParser_1 = __importDefault(require_ENTimeUnitWithinFormatParser()); + var ENMonthNameLittleEndianParser_1 = __importDefault(require_ENMonthNameLittleEndianParser()); + var ENMonthNameMiddleEndianParser_1 = __importDefault(require_ENMonthNameMiddleEndianParser()); + var ENMonthNameParser_1 = __importDefault(require_ENMonthNameParser()); + var ENCasualYearMonthDayParser_1 = __importDefault(require_ENCasualYearMonthDayParser()); + var ENSlashMonthFormatParser_1 = __importDefault(require_ENSlashMonthFormatParser()); + var ENTimeExpressionParser_1 = __importDefault(require_ENTimeExpressionParser()); + var ENTimeUnitAgoFormatParser_1 = __importDefault(require_ENTimeUnitAgoFormatParser()); + var ENTimeUnitLaterFormatParser_1 = __importDefault(require_ENTimeUnitLaterFormatParser()); + var ENMergeDateRangeRefiner_1 = __importDefault(require_ENMergeDateRangeRefiner()); + var ENMergeDateTimeRefiner_1 = __importDefault(require_ENMergeDateTimeRefiner()); + var configurations_1 = require_configurations(); + var ENCasualDateParser_1 = __importDefault(require_ENCasualDateParser()); + var ENCasualTimeParser_1 = __importDefault(require_ENCasualTimeParser()); + var ENWeekdayParser_1 = __importDefault(require_ENWeekdayParser()); + var ENRelativeDateFormatParser_1 = __importDefault(require_ENRelativeDateFormatParser()); + var chrono_1 = require_chrono(); + var SlashDateFormatParser_1 = __importDefault(require_SlashDateFormatParser()); + var ENTimeUnitCasualRelativeFormatParser_1 = __importDefault(require_ENTimeUnitCasualRelativeFormatParser()); + var ENMergeRelativeDateRefiner_1 = __importDefault(require_ENMergeRelativeDateRefiner()); + exports.casual = new chrono_1.Chrono(createCasualConfiguration(false)); + exports.strict = new chrono_1.Chrono(createConfiguration(true, false)); + exports.GB = new chrono_1.Chrono(createConfiguration(false, true)); + function parse4(text2, ref, option) { + return exports.casual.parse(text2, ref, option); + } + exports.parse = parse4; + function parseDate3(text2, ref, option) { + return exports.casual.parseDate(text2, ref, option); + } + exports.parseDate = parseDate3; + function createCasualConfiguration(littleEndian = false) { + const option = createConfiguration(false, littleEndian); + option.parsers.unshift(new ENCasualDateParser_1.default()); + option.parsers.unshift(new ENCasualTimeParser_1.default()); + option.parsers.unshift(new ENMonthNameParser_1.default()); + option.parsers.unshift(new ENRelativeDateFormatParser_1.default()); + option.parsers.unshift(new ENTimeUnitCasualRelativeFormatParser_1.default()); + return option; + } + exports.createCasualConfiguration = createCasualConfiguration; + function createConfiguration(strictMode = true, littleEndian = false) { + return configurations_1.includeCommonConfiguration({ + parsers: [ + new SlashDateFormatParser_1.default(littleEndian), + new ENTimeUnitWithinFormatParser_1.default(), + new ENMonthNameLittleEndianParser_1.default(), + new ENMonthNameMiddleEndianParser_1.default(), + new ENWeekdayParser_1.default(), + new ENCasualYearMonthDayParser_1.default(), + new ENSlashMonthFormatParser_1.default(), + new ENTimeExpressionParser_1.default(strictMode), + new ENTimeUnitAgoFormatParser_1.default(strictMode), + new ENTimeUnitLaterFormatParser_1.default(strictMode) + ], + refiners: [new ENMergeRelativeDateRefiner_1.default(), new ENMergeDateTimeRefiner_1.default(), new ENMergeDateRangeRefiner_1.default()] + }, strictMode); + } + exports.createConfiguration = createConfiguration; + } +}); + +// node_modules/chrono-node/dist/locales/de/parsers/DETimeExpressionParser.js +var require_DETimeExpressionParser = __commonJS({ + "node_modules/chrono-node/dist/locales/de/parsers/DETimeExpressionParser.js"(exports) { + "use strict"; + Object.defineProperty(exports, "__esModule", { value: true }); + var AbstractTimeExpressionParser_1 = require_AbstractTimeExpressionParser(); + var DETimeExpressionParser = class extends AbstractTimeExpressionParser_1.AbstractTimeExpressionParser { + primaryPrefix() { + return "(?:(?:um|von)\\s*)?"; + } + followingPhase() { + return "\\s*(?:\\-|\\\u2013|\\~|\\\u301C|bis)\\s*"; + } + extractPrimaryTimeComponents(context, match) { + if (match[0].match(/^\s*\d{4}\s*$/)) { + return null; + } + return super.extractPrimaryTimeComponents(context, match); + } + }; + exports.default = DETimeExpressionParser; + } +}); + +// node_modules/chrono-node/dist/locales/de/constants.js +var require_constants2 = __commonJS({ + "node_modules/chrono-node/dist/locales/de/constants.js"(exports) { + "use strict"; + Object.defineProperty(exports, "__esModule", { value: true }); + exports.parseTimeUnits = exports.TIME_UNITS_PATTERN = exports.parseYear = exports.YEAR_PATTERN = exports.parseNumberPattern = exports.NUMBER_PATTERN = exports.TIME_UNIT_DICTIONARY = exports.INTEGER_WORD_DICTIONARY = exports.MONTH_DICTIONARY = exports.WEEKDAY_DICTIONARY = void 0; + var pattern_1 = require_pattern(); + var years_1 = require_years(); + exports.WEEKDAY_DICTIONARY = { + "sonntag": 0, + "so": 0, + "montag": 1, + "mo": 1, + "dienstag": 2, + "di": 2, + "mittwoch": 3, + "mi": 3, + "donnerstag": 4, + "do": 4, + "freitag": 5, + "fr": 5, + "samstag": 6, + "sa": 6 + }; + exports.MONTH_DICTIONARY = { + "januar": 1, + "j\xE4nner": 1, + "janner": 1, + "jan": 1, + "jan.": 1, + "februar": 2, + "feber": 2, + "feb": 2, + "feb.": 2, + "m\xE4rz": 3, + "maerz": 3, + "m\xE4r": 3, + "m\xE4r.": 3, + "mrz": 3, + "mrz.": 3, + "april": 4, + "apr": 4, + "apr.": 4, + "mai": 5, + "juni": 6, + "jun": 6, + "jun.": 6, + "juli": 7, + "jul": 7, + "jul.": 7, + "august": 8, + "aug": 8, + "aug.": 8, + "september": 9, + "sep": 9, + "sep.": 9, + "sept": 9, + "sept.": 9, + "oktober": 10, + "okt": 10, + "okt.": 10, + "november": 11, + "nov": 11, + "nov.": 11, + "dezember": 12, + "dez": 12, + "dez.": 12 + }; + exports.INTEGER_WORD_DICTIONARY = { + "eins": 1, + "eine": 1, + "einem": 1, + "einen": 1, + "einer": 1, + "zwei": 2, + "drei": 3, + "vier": 4, + "f\xFCnf": 5, + "fuenf": 5, + "sechs": 6, + "sieben": 7, + "acht": 8, + "neun": 9, + "zehn": 10, + "elf": 11, + "zw\xF6lf": 12, + "zwoelf": 12 + }; + exports.TIME_UNIT_DICTIONARY = { + sek: "second", + sekunde: "second", + sekunden: "second", + min: "minute", + minute: "minute", + minuten: "minute", + h: "hour", + std: "hour", + stunde: "hour", + stunden: "hour", + tag: "d", + tage: "d", + tagen: "d", + woche: "week", + wochen: "week", + monat: "month", + monate: "month", + monaten: "month", + monats: "month", + quartal: "quarter", + quartals: "quarter", + quartale: "quarter", + quartalen: "quarter", + a: "year", + j: "year", + jr: "year", + jahr: "year", + jahre: "year", + jahren: "year", + jahres: "year" + }; + exports.NUMBER_PATTERN = `(?:${pattern_1.matchAnyPattern(exports.INTEGER_WORD_DICTIONARY)}|[0-9]+|[0-9]+\\.[0-9]+|half(?:\\s*an?)?|an?\\b(?:\\s*few)?|few|several|a?\\s*couple\\s*(?:of)?)`; + function parseNumberPattern(match) { + const num = match.toLowerCase(); + if (exports.INTEGER_WORD_DICTIONARY[num] !== void 0) { + return exports.INTEGER_WORD_DICTIONARY[num]; + } else if (num === "a" || num === "an") { + return 1; + } else if (num.match(/few/)) { + return 3; + } else if (num.match(/half/)) { + return 0.5; + } else if (num.match(/couple/)) { + return 2; + } else if (num.match(/several/)) { + return 7; + } + return parseFloat(num); + } + exports.parseNumberPattern = parseNumberPattern; + exports.YEAR_PATTERN = `(?:[0-9]{1,4}(?:\\s*[vn]\\.?\\s*(?:C(?:hr)?|(?:u\\.?|d\\.?(?:\\s*g\\.?)?)?\\s*Z)\\.?|\\s*(?:u\\.?|d\\.?(?:\\s*g\\.)?)\\s*Z\\.?)?)`; + function parseYear(match) { + if (/v/i.test(match)) { + return -parseInt(match.replace(/[^0-9]+/gi, "")); + } + if (/n/i.test(match)) { + return parseInt(match.replace(/[^0-9]+/gi, "")); + } + if (/z/i.test(match)) { + return parseInt(match.replace(/[^0-9]+/gi, "")); + } + const rawYearNumber = parseInt(match); + return years_1.findMostLikelyADYear(rawYearNumber); + } + exports.parseYear = parseYear; + var SINGLE_TIME_UNIT_PATTERN = `(${exports.NUMBER_PATTERN})\\s{0,5}(${pattern_1.matchAnyPattern(exports.TIME_UNIT_DICTIONARY)})\\s{0,5}`; + var SINGLE_TIME_UNIT_REGEX = new RegExp(SINGLE_TIME_UNIT_PATTERN, "i"); + exports.TIME_UNITS_PATTERN = pattern_1.repeatedTimeunitPattern("", SINGLE_TIME_UNIT_PATTERN); + function parseTimeUnits(timeunitText) { + const fragments = {}; + let remainingText = timeunitText; + let match = SINGLE_TIME_UNIT_REGEX.exec(remainingText); + while (match) { + collectDateTimeFragment(fragments, match); + remainingText = remainingText.substring(match[0].length); + match = SINGLE_TIME_UNIT_REGEX.exec(remainingText); + } + return fragments; + } + exports.parseTimeUnits = parseTimeUnits; + function collectDateTimeFragment(fragments, match) { + const num = parseNumberPattern(match[1]); + const unit = exports.TIME_UNIT_DICTIONARY[match[2].toLowerCase()]; + fragments[unit] = num; + } + } +}); + +// node_modules/chrono-node/dist/locales/de/parsers/DEWeekdayParser.js +var require_DEWeekdayParser = __commonJS({ + "node_modules/chrono-node/dist/locales/de/parsers/DEWeekdayParser.js"(exports) { + "use strict"; + Object.defineProperty(exports, "__esModule", { value: true }); + var constants_1 = require_constants2(); + var pattern_1 = require_pattern(); + var AbstractParserWithWordBoundary_1 = require_AbstractParserWithWordBoundary(); + var weeks_1 = require_weeks(); + var PATTERN = new RegExp(`(?:(?:\\,|\\(|\\\uFF08)\\s*)?(?:a[mn]\\s*?)?(?:(diese[mn]|letzte[mn]|n(?:\xE4|ae)chste[mn])\\s*)?(${pattern_1.matchAnyPattern(constants_1.WEEKDAY_DICTIONARY)})(?:\\s*(?:\\,|\\)|\\\uFF09))?(?:\\s*(diese|letzte|n(?:\xE4|ae)chste)\\s*woche)?(?=\\W|$)`, "i"); + var PREFIX_GROUP = 1; + var SUFFIX_GROUP = 3; + var WEEKDAY_GROUP = 2; + var DEWeekdayParser = class extends AbstractParserWithWordBoundary_1.AbstractParserWithWordBoundaryChecking { + innerPattern() { + return PATTERN; + } + innerExtract(context, match) { + const dayOfWeek = match[WEEKDAY_GROUP].toLowerCase(); + const offset2 = constants_1.WEEKDAY_DICTIONARY[dayOfWeek]; + const prefix = match[PREFIX_GROUP]; + const postfix = match[SUFFIX_GROUP]; + let modifierWord = prefix || postfix; + modifierWord = modifierWord || ""; + modifierWord = modifierWord.toLowerCase(); + let modifier = null; + if (modifierWord.match(/letzte/)) { + modifier = "last"; + } else if (modifierWord.match(/chste/)) { + modifier = "next"; + } else if (modifierWord.match(/diese/)) { + modifier = "this"; + } + const date = weeks_1.toDayJSWeekday(context.refDate, offset2, modifier); + return context.createParsingComponents().assign("weekday", offset2).imply("day", date.date()).imply("month", date.month() + 1).imply("year", date.year()); + } + }; + exports.default = DEWeekdayParser; + } +}); + +// node_modules/chrono-node/dist/locales/de/parsers/DESpecificTimeExpressionParser.js +var require_DESpecificTimeExpressionParser = __commonJS({ + "node_modules/chrono-node/dist/locales/de/parsers/DESpecificTimeExpressionParser.js"(exports) { + "use strict"; + Object.defineProperty(exports, "__esModule", { value: true }); + var index_1 = require_dist(); + var FIRST_REG_PATTERN = new RegExp("(^|\\s|T)(?:(?:um|von)\\s*)?(\\d{1,2})(?:h|:)?(?:(\\d{1,2})(?:m|:)?)?(?:(\\d{1,2})(?:s)?)?(?:\\s*Uhr)?(?:\\s*(morgens|vormittags|nachmittags|abends|nachts|am\\s+(?:Morgen|Vormittag|Nachmittag|Abend)|in\\s+der\\s+Nacht))?(?=\\W|$)", "i"); + var SECOND_REG_PATTERN = new RegExp("^\\s*(\\-|\\\u2013|\\~|\\\u301C|bis(?:\\s+um)?|\\?)\\s*(\\d{1,2})(?:h|:)?(?:(\\d{1,2})(?:m|:)?)?(?:(\\d{1,2})(?:s)?)?(?:\\s*Uhr)?(?:\\s*(morgens|vormittags|nachmittags|abends|nachts|am\\s+(?:Morgen|Vormittag|Nachmittag|Abend)|in\\s+der\\s+Nacht))?(?=\\W|$)", "i"); + var HOUR_GROUP = 2; + var MINUTE_GROUP = 3; + var SECOND_GROUP = 4; + var AM_PM_HOUR_GROUP = 5; + var DESpecificTimeExpressionParser = class { + pattern(context) { + return FIRST_REG_PATTERN; + } + extract(context, match) { + const result = context.createParsingResult(match.index + match[1].length, match[0].substring(match[1].length)); + if (result.text.match(/^\d{4}$/)) { + match.index += match[0].length; + return null; + } + result.start = DESpecificTimeExpressionParser.extractTimeComponent(result.start.clone(), match); + if (!result.start) { + match.index += match[0].length; + return null; + } + const remainingText = context.text.substring(match.index + match[0].length); + const secondMatch = SECOND_REG_PATTERN.exec(remainingText); + if (secondMatch) { + result.end = DESpecificTimeExpressionParser.extractTimeComponent(result.start.clone(), secondMatch); + if (result.end) { + result.text += secondMatch[0]; + } + } + return result; + } + static extractTimeComponent(extractingComponents, match) { + let hour = 0; + let minute = 0; + let meridiem = null; + hour = parseInt(match[HOUR_GROUP]); + if (match[MINUTE_GROUP] != null) { + minute = parseInt(match[MINUTE_GROUP]); + } + if (minute >= 60 || hour > 24) { + return null; + } + if (hour >= 12) { + meridiem = index_1.Meridiem.PM; + } + if (match[AM_PM_HOUR_GROUP] != null) { + if (hour > 12) + return null; + const ampm = match[AM_PM_HOUR_GROUP].toLowerCase(); + if (ampm.match(/morgen|vormittag/)) { + meridiem = index_1.Meridiem.AM; + if (hour == 12) { + hour = 0; + } + } + if (ampm.match(/nachmittag|abend/)) { + meridiem = index_1.Meridiem.PM; + if (hour != 12) { + hour += 12; + } + } + if (ampm.match(/nacht/)) { + if (hour == 12) { + meridiem = index_1.Meridiem.AM; + hour = 0; + } else if (hour < 6) { + meridiem = index_1.Meridiem.AM; + } else { + meridiem = index_1.Meridiem.PM; + hour += 12; + } + } + } + extractingComponents.assign("hour", hour); + extractingComponents.assign("minute", minute); + if (meridiem !== null) { + extractingComponents.assign("meridiem", meridiem); + } else { + if (hour < 12) { + extractingComponents.imply("meridiem", index_1.Meridiem.AM); + } else { + extractingComponents.imply("meridiem", index_1.Meridiem.PM); + } + } + if (match[SECOND_GROUP] != null) { + const second = parseInt(match[SECOND_GROUP]); + if (second >= 60) + return null; + extractingComponents.assign("second", second); + } + return extractingComponents; + } + }; + exports.default = DESpecificTimeExpressionParser; + } +}); + +// node_modules/chrono-node/dist/locales/de/refiners/DEMergeDateRangeRefiner.js +var require_DEMergeDateRangeRefiner = __commonJS({ + "node_modules/chrono-node/dist/locales/de/refiners/DEMergeDateRangeRefiner.js"(exports) { + "use strict"; + var __importDefault = exports && exports.__importDefault || function(mod) { + return mod && mod.__esModule ? mod : { "default": mod }; + }; + Object.defineProperty(exports, "__esModule", { value: true }); + var AbstractMergeDateRangeRefiner_1 = __importDefault(require_AbstractMergeDateRangeRefiner()); + var DEMergeDateRangeRefiner = class extends AbstractMergeDateRangeRefiner_1.default { + patternBetween() { + return /^\s*(bis(?:\s*(?:am|zum))?|-)\s*$/i; + } + }; + exports.default = DEMergeDateRangeRefiner; + } +}); + +// node_modules/chrono-node/dist/locales/de/refiners/DEMergeDateTimeRefiner.js +var require_DEMergeDateTimeRefiner = __commonJS({ + "node_modules/chrono-node/dist/locales/de/refiners/DEMergeDateTimeRefiner.js"(exports) { + "use strict"; + var __importDefault = exports && exports.__importDefault || function(mod) { + return mod && mod.__esModule ? mod : { "default": mod }; + }; + Object.defineProperty(exports, "__esModule", { value: true }); + var AbstractMergeDateTimeRefiner_1 = __importDefault(require_AbstractMergeDateTimeRefiner()); + var DEMergeDateTimeRefiner = class extends AbstractMergeDateTimeRefiner_1.default { + patternBetween() { + return new RegExp("^\\s*(T|um|am|,|-)?\\s*$"); + } + }; + exports.default = DEMergeDateTimeRefiner; + } +}); + +// node_modules/chrono-node/dist/locales/de/parsers/DECasualTimeParser.js +var require_DECasualTimeParser = __commonJS({ + "node_modules/chrono-node/dist/locales/de/parsers/DECasualTimeParser.js"(exports) { + "use strict"; + var __importDefault = exports && exports.__importDefault || function(mod) { + return mod && mod.__esModule ? mod : { "default": mod }; + }; + Object.defineProperty(exports, "__esModule", { value: true }); + var dayjs_1 = __importDefault(require_dayjs_min()); + var index_1 = require_dist(); + var AbstractParserWithWordBoundary_1 = require_AbstractParserWithWordBoundary(); + var dayjs_2 = require_dayjs(); + var timeunits_1 = require_timeunits(); + var DECasualTimeParser = class extends AbstractParserWithWordBoundary_1.AbstractParserWithWordBoundaryChecking { + innerPattern(context) { + return /(diesen)?\s*(morgen|vormittag|mittags?|nachmittag|abend|nacht|mitternacht)(?=\W|$)/i; + } + innerExtract(context, match) { + const targetDate = dayjs_1.default(context.refDate); + const timeKeywordPattern = match[2].toLowerCase(); + const component = context.createParsingComponents(); + dayjs_2.implySimilarTime(component, targetDate); + return DECasualTimeParser.extractTimeComponents(component, timeKeywordPattern); + } + static extractTimeComponents(component, timeKeywordPattern) { + switch (timeKeywordPattern) { + case "morgen": + component.imply("hour", 6); + component.imply("minute", 0); + component.imply("second", 0); + component.imply("meridiem", index_1.Meridiem.AM); + break; + case "vormittag": + component.imply("hour", 9); + component.imply("minute", 0); + component.imply("second", 0); + component.imply("meridiem", index_1.Meridiem.AM); + break; + case "mittag": + case "mittags": + component.imply("hour", 12); + component.imply("minute", 0); + component.imply("second", 0); + component.imply("meridiem", index_1.Meridiem.AM); + break; + case "nachmittag": + component.imply("hour", 15); + component.imply("minute", 0); + component.imply("second", 0); + component.imply("meridiem", index_1.Meridiem.PM); + break; + case "abend": + component.imply("hour", 18); + component.imply("minute", 0); + component.imply("second", 0); + component.imply("meridiem", index_1.Meridiem.PM); + break; + case "nacht": + component.imply("hour", 22); + component.imply("minute", 0); + component.imply("second", 0); + component.imply("meridiem", index_1.Meridiem.PM); + break; + case "mitternacht": + if (component.get("hour") > 1) { + component = timeunits_1.addImpliedTimeUnits(component, { "day": 1 }); + } + component.imply("hour", 0); + component.imply("minute", 0); + component.imply("second", 0); + component.imply("meridiem", index_1.Meridiem.AM); + break; + } + return component; + } + }; + exports.default = DECasualTimeParser; + } +}); + +// node_modules/chrono-node/dist/locales/de/parsers/DECasualDateParser.js +var require_DECasualDateParser = __commonJS({ + "node_modules/chrono-node/dist/locales/de/parsers/DECasualDateParser.js"(exports) { + "use strict"; + var __createBinding = exports && exports.__createBinding || (Object.create ? function(o, m, k, k2) { + if (k2 === void 0) + k2 = k; + Object.defineProperty(o, k2, { enumerable: true, get: function() { + return m[k]; + } }); + } : function(o, m, k, k2) { + if (k2 === void 0) + k2 = k; + o[k2] = m[k]; + }); + var __setModuleDefault = exports && exports.__setModuleDefault || (Object.create ? function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); + } : function(o, v) { + o["default"] = v; + }); + var __importStar = exports && exports.__importStar || function(mod) { + if (mod && mod.__esModule) + return mod; + var result = {}; + if (mod != null) { + for (var k in mod) + if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) + __createBinding(result, mod, k); + } + __setModuleDefault(result, mod); + return result; + }; + var __importDefault = exports && exports.__importDefault || function(mod) { + return mod && mod.__esModule ? mod : { "default": mod }; + }; + Object.defineProperty(exports, "__esModule", { value: true }); + var dayjs_1 = __importDefault(require_dayjs_min()); + var AbstractParserWithWordBoundary_1 = require_AbstractParserWithWordBoundary(); + var dayjs_2 = require_dayjs(); + var DECasualTimeParser_1 = __importDefault(require_DECasualTimeParser()); + var references = __importStar(require_casualReferences()); + var PATTERN = new RegExp(`(jetzt|heute|morgen|\xFCbermorgen|uebermorgen|gestern|vorgestern|letzte\\s*nacht)(?:\\s*(morgen|vormittag|mittags?|nachmittag|abend|nacht|mitternacht))?(?=\\W|$)`, "i"); + var DATE_GROUP = 1; + var TIME_GROUP = 2; + var DECasualDateParser = class extends AbstractParserWithWordBoundary_1.AbstractParserWithWordBoundaryChecking { + innerPattern(context) { + return PATTERN; + } + innerExtract(context, match) { + let targetDate = dayjs_1.default(context.refDate); + const dateKeyword = (match[DATE_GROUP] || "").toLowerCase(); + const timeKeyword = (match[TIME_GROUP] || "").toLowerCase(); + let component = context.createParsingComponents(); + switch (dateKeyword) { + case "jetzt": + component = references.now(context.reference); + break; + case "heute": + component = references.today(context.reference); + break; + case "morgen": + dayjs_2.assignTheNextDay(component, targetDate); + break; + case "\xFCbermorgen": + case "uebermorgen": + targetDate = targetDate.add(1, "day"); + dayjs_2.assignTheNextDay(component, targetDate); + break; + case "gestern": + targetDate = targetDate.add(-1, "day"); + dayjs_2.assignSimilarDate(component, targetDate); + dayjs_2.implySimilarTime(component, targetDate); + break; + case "vorgestern": + targetDate = targetDate.add(-2, "day"); + dayjs_2.assignSimilarDate(component, targetDate); + dayjs_2.implySimilarTime(component, targetDate); + break; + default: + if (dateKeyword.match(/letzte\s*nacht/)) { + if (targetDate.hour() > 6) { + targetDate = targetDate.add(-1, "day"); + } + dayjs_2.assignSimilarDate(component, targetDate); + component.imply("hour", 0); + } + break; + } + if (timeKeyword) { + component = DECasualTimeParser_1.default.extractTimeComponents(component, timeKeyword); + } + return component; + } + }; + exports.default = DECasualDateParser; + } +}); + +// node_modules/chrono-node/dist/locales/de/parsers/DEMonthNameLittleEndianParser.js +var require_DEMonthNameLittleEndianParser = __commonJS({ + "node_modules/chrono-node/dist/locales/de/parsers/DEMonthNameLittleEndianParser.js"(exports) { + "use strict"; + Object.defineProperty(exports, "__esModule", { value: true }); + var years_1 = require_years(); + var constants_1 = require_constants2(); + var constants_2 = require_constants2(); + var pattern_1 = require_pattern(); + var AbstractParserWithWordBoundary_1 = require_AbstractParserWithWordBoundary(); + var PATTERN = new RegExp(`(?:am\\s*?)?(?:den\\s*?)?([0-9]{1,2})\\.(?:\\s*(?:bis(?:\\s*(?:am|zum))?|\\-|\\\u2013|\\s)\\s*([0-9]{1,2})\\.?)?\\s*(${pattern_1.matchAnyPattern(constants_1.MONTH_DICTIONARY)})(?:(?:-|/|,?\\s*)(${constants_2.YEAR_PATTERN}(?![^\\s]\\d)))?(?=\\W|$)`, "i"); + var DATE_GROUP = 1; + var DATE_TO_GROUP = 2; + var MONTH_NAME_GROUP = 3; + var YEAR_GROUP = 4; + var DEMonthNameLittleEndianParser = class extends AbstractParserWithWordBoundary_1.AbstractParserWithWordBoundaryChecking { + innerPattern() { + return PATTERN; + } + innerExtract(context, match) { + const result = context.createParsingResult(match.index, match[0]); + const month = constants_1.MONTH_DICTIONARY[match[MONTH_NAME_GROUP].toLowerCase()]; + const day = parseInt(match[DATE_GROUP]); + if (day > 31) { + match.index = match.index + match[DATE_GROUP].length; + return null; + } + result.start.assign("month", month); + result.start.assign("day", day); + if (match[YEAR_GROUP]) { + const yearNumber = constants_2.parseYear(match[YEAR_GROUP]); + result.start.assign("year", yearNumber); + } else { + const year = years_1.findYearClosestToRef(context.refDate, day, month); + result.start.imply("year", year); + } + if (match[DATE_TO_GROUP]) { + const endDate = parseInt(match[DATE_TO_GROUP]); + result.end = result.start.clone(); + result.end.assign("day", endDate); + } + return result; + } + }; + exports.default = DEMonthNameLittleEndianParser; + } +}); + +// node_modules/chrono-node/dist/locales/de/parsers/DETimeUnitRelativeFormatParser.js +var require_DETimeUnitRelativeFormatParser = __commonJS({ + "node_modules/chrono-node/dist/locales/de/parsers/DETimeUnitRelativeFormatParser.js"(exports) { + "use strict"; + Object.defineProperty(exports, "__esModule", { value: true }); + var constants_1 = require_constants2(); + var results_1 = require_results(); + var AbstractParserWithWordBoundary_1 = require_AbstractParserWithWordBoundary(); + var timeunits_1 = require_timeunits(); + var pattern_1 = require_pattern(); + var DETimeUnitAgoFormatParser = class extends AbstractParserWithWordBoundary_1.AbstractParserWithWordBoundaryChecking { + constructor() { + super(); + } + innerPattern() { + return new RegExp(`(?:\\s*((?:n\xE4chste|kommende|folgende|letzte|vergangene|vorige|vor(?:her|an)gegangene)(?:s|n|m|r)?|vor|in)\\s*)?(${constants_1.NUMBER_PATTERN})?(?:\\s*(n\xE4chste|kommende|folgende|letzte|vergangene|vorige|vor(?:her|an)gegangene)(?:s|n|m|r)?)?\\s*(${pattern_1.matchAnyPattern(constants_1.TIME_UNIT_DICTIONARY)})`, "i"); + } + innerExtract(context, match) { + const num = match[2] ? constants_1.parseNumberPattern(match[2]) : 1; + const unit = constants_1.TIME_UNIT_DICTIONARY[match[4].toLowerCase()]; + let timeUnits = {}; + timeUnits[unit] = num; + let modifier = match[1] || match[3] || ""; + modifier = modifier.toLowerCase(); + if (!modifier) { + return; + } + if (/vor/.test(modifier) || /letzte/.test(modifier) || /vergangen/.test(modifier)) { + timeUnits = timeunits_1.reverseTimeUnits(timeUnits); + } + return results_1.ParsingComponents.createRelativeFromReference(context.reference, timeUnits); + } + }; + exports.default = DETimeUnitAgoFormatParser; + } +}); + +// node_modules/chrono-node/dist/locales/de/index.js +var require_de = __commonJS({ + "node_modules/chrono-node/dist/locales/de/index.js"(exports) { + "use strict"; + var __importDefault = exports && exports.__importDefault || function(mod) { + return mod && mod.__esModule ? mod : { "default": mod }; + }; + Object.defineProperty(exports, "__esModule", { value: true }); + exports.createConfiguration = exports.createCasualConfiguration = exports.parseDate = exports.parse = exports.strict = exports.casual = void 0; + var configurations_1 = require_configurations(); + var chrono_1 = require_chrono(); + var SlashDateFormatParser_1 = __importDefault(require_SlashDateFormatParser()); + var ISOFormatParser_1 = __importDefault(require_ISOFormatParser()); + var DETimeExpressionParser_1 = __importDefault(require_DETimeExpressionParser()); + var DEWeekdayParser_1 = __importDefault(require_DEWeekdayParser()); + var DESpecificTimeExpressionParser_1 = __importDefault(require_DESpecificTimeExpressionParser()); + var DEMergeDateRangeRefiner_1 = __importDefault(require_DEMergeDateRangeRefiner()); + var DEMergeDateTimeRefiner_1 = __importDefault(require_DEMergeDateTimeRefiner()); + var DECasualDateParser_1 = __importDefault(require_DECasualDateParser()); + var DECasualTimeParser_1 = __importDefault(require_DECasualTimeParser()); + var DEMonthNameLittleEndianParser_1 = __importDefault(require_DEMonthNameLittleEndianParser()); + var DETimeUnitRelativeFormatParser_1 = __importDefault(require_DETimeUnitRelativeFormatParser()); + exports.casual = new chrono_1.Chrono(createCasualConfiguration()); + exports.strict = new chrono_1.Chrono(createConfiguration(true)); + function parse4(text2, ref, option) { + return exports.casual.parse(text2, ref, option); + } + exports.parse = parse4; + function parseDate3(text2, ref, option) { + return exports.casual.parseDate(text2, ref, option); + } + exports.parseDate = parseDate3; + function createCasualConfiguration(littleEndian = true) { + const option = createConfiguration(false, littleEndian); + option.parsers.unshift(new DECasualTimeParser_1.default()); + option.parsers.unshift(new DECasualDateParser_1.default()); + option.parsers.unshift(new DETimeUnitRelativeFormatParser_1.default()); + return option; + } + exports.createCasualConfiguration = createCasualConfiguration; + function createConfiguration(strictMode = true, littleEndian = true) { + return configurations_1.includeCommonConfiguration({ + parsers: [ + new ISOFormatParser_1.default(), + new SlashDateFormatParser_1.default(littleEndian), + new DETimeExpressionParser_1.default(), + new DESpecificTimeExpressionParser_1.default(), + new DEMonthNameLittleEndianParser_1.default(), + new DEWeekdayParser_1.default() + ], + refiners: [new DEMergeDateRangeRefiner_1.default(), new DEMergeDateTimeRefiner_1.default()] + }, strictMode); + } + exports.createConfiguration = createConfiguration; + } +}); + +// node_modules/chrono-node/dist/locales/fr/parsers/FRCasualDateParser.js +var require_FRCasualDateParser = __commonJS({ + "node_modules/chrono-node/dist/locales/fr/parsers/FRCasualDateParser.js"(exports) { + "use strict"; + var __createBinding = exports && exports.__createBinding || (Object.create ? function(o, m, k, k2) { + if (k2 === void 0) + k2 = k; + Object.defineProperty(o, k2, { enumerable: true, get: function() { + return m[k]; + } }); + } : function(o, m, k, k2) { + if (k2 === void 0) + k2 = k; + o[k2] = m[k]; + }); + var __setModuleDefault = exports && exports.__setModuleDefault || (Object.create ? function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); + } : function(o, v) { + o["default"] = v; + }); + var __importStar = exports && exports.__importStar || function(mod) { + if (mod && mod.__esModule) + return mod; + var result = {}; + if (mod != null) { + for (var k in mod) + if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) + __createBinding(result, mod, k); + } + __setModuleDefault(result, mod); + return result; + }; + var __importDefault = exports && exports.__importDefault || function(mod) { + return mod && mod.__esModule ? mod : { "default": mod }; + }; + Object.defineProperty(exports, "__esModule", { value: true }); + var dayjs_1 = __importDefault(require_dayjs_min()); + var index_1 = require_dist(); + var AbstractParserWithWordBoundary_1 = require_AbstractParserWithWordBoundary(); + var dayjs_2 = require_dayjs(); + var references = __importStar(require_casualReferences()); + var FRCasualDateParser = class extends AbstractParserWithWordBoundary_1.AbstractParserWithWordBoundaryChecking { + innerPattern(context) { + return /(maintenant|aujourd'hui|demain|hier|cette\s*nuit|la\s*veille)(?=\W|$)/i; + } + innerExtract(context, match) { + let targetDate = dayjs_1.default(context.refDate); + const lowerText = match[0].toLowerCase(); + const component = context.createParsingComponents(); + switch (lowerText) { + case "maintenant": + return references.now(context.reference); + case "aujourd'hui": + return references.today(context.reference); + case "hier": + return references.yesterday(context.reference); + case "demain": + return references.tomorrow(context.reference); + default: + if (lowerText.match(/cette\s*nuit/)) { + dayjs_2.assignSimilarDate(component, targetDate); + component.imply("hour", 22); + component.imply("meridiem", index_1.Meridiem.PM); + } else if (lowerText.match(/la\s*veille/)) { + targetDate = targetDate.add(-1, "day"); + dayjs_2.assignSimilarDate(component, targetDate); + component.imply("hour", 0); + } + } + return component; + } + }; + exports.default = FRCasualDateParser; + } +}); + +// node_modules/chrono-node/dist/locales/fr/parsers/FRCasualTimeParser.js +var require_FRCasualTimeParser = __commonJS({ + "node_modules/chrono-node/dist/locales/fr/parsers/FRCasualTimeParser.js"(exports) { + "use strict"; + Object.defineProperty(exports, "__esModule", { value: true }); + var index_1 = require_dist(); + var AbstractParserWithWordBoundary_1 = require_AbstractParserWithWordBoundary(); + var FRCasualTimeParser = class extends AbstractParserWithWordBoundary_1.AbstractParserWithWordBoundaryChecking { + innerPattern(context) { + return /(cet?)?\s*(matin|soir|après-midi|aprem|a midi|à minuit)(?=\W|$)/i; + } + innerExtract(context, match) { + const suffixLower = match[2].toLowerCase(); + const component = context.createParsingComponents(); + switch (suffixLower) { + case "apr\xE8s-midi": + case "aprem": + component.imply("hour", 14); + component.imply("minute", 0); + component.imply("meridiem", index_1.Meridiem.PM); + break; + case "soir": + component.imply("hour", 18); + component.imply("minute", 0); + component.imply("meridiem", index_1.Meridiem.PM); + break; + case "matin": + component.imply("hour", 8); + component.imply("minute", 0); + component.imply("meridiem", index_1.Meridiem.AM); + break; + case "a midi": + component.imply("hour", 12); + component.imply("minute", 0); + component.imply("meridiem", index_1.Meridiem.AM); + break; + case "\xE0 minuit": + component.imply("hour", 0); + component.imply("meridiem", index_1.Meridiem.AM); + break; + } + return component; + } + }; + exports.default = FRCasualTimeParser; + } +}); + +// node_modules/chrono-node/dist/locales/fr/parsers/FRTimeExpressionParser.js +var require_FRTimeExpressionParser = __commonJS({ + "node_modules/chrono-node/dist/locales/fr/parsers/FRTimeExpressionParser.js"(exports) { + "use strict"; + Object.defineProperty(exports, "__esModule", { value: true }); + var AbstractTimeExpressionParser_1 = require_AbstractTimeExpressionParser(); + var FRTimeExpressionParser = class extends AbstractTimeExpressionParser_1.AbstractTimeExpressionParser { + primaryPrefix() { + return "(?:(?:[\xE0a])\\s*)?"; + } + followingPhase() { + return "\\s*(?:\\-|\\\u2013|\\~|\\\u301C|[\xE0a]|\\?)\\s*"; + } + extractPrimaryTimeComponents(context, match) { + if (match[0].match(/^\s*\d{4}\s*$/)) { + return null; + } + return super.extractPrimaryTimeComponents(context, match); + } + }; + exports.default = FRTimeExpressionParser; + } +}); + +// node_modules/chrono-node/dist/locales/fr/refiners/FRMergeDateTimeRefiner.js +var require_FRMergeDateTimeRefiner = __commonJS({ + "node_modules/chrono-node/dist/locales/fr/refiners/FRMergeDateTimeRefiner.js"(exports) { + "use strict"; + var __importDefault = exports && exports.__importDefault || function(mod) { + return mod && mod.__esModule ? mod : { "default": mod }; + }; + Object.defineProperty(exports, "__esModule", { value: true }); + var AbstractMergeDateTimeRefiner_1 = __importDefault(require_AbstractMergeDateTimeRefiner()); + var FRMergeDateTimeRefiner = class extends AbstractMergeDateTimeRefiner_1.default { + patternBetween() { + return new RegExp("^\\s*(T|\xE0|a|vers|de|,|-)?\\s*$"); + } + }; + exports.default = FRMergeDateTimeRefiner; + } +}); + +// node_modules/chrono-node/dist/locales/fr/refiners/FRMergeDateRangeRefiner.js +var require_FRMergeDateRangeRefiner = __commonJS({ + "node_modules/chrono-node/dist/locales/fr/refiners/FRMergeDateRangeRefiner.js"(exports) { + "use strict"; + var __importDefault = exports && exports.__importDefault || function(mod) { + return mod && mod.__esModule ? mod : { "default": mod }; + }; + Object.defineProperty(exports, "__esModule", { value: true }); + var AbstractMergeDateRangeRefiner_1 = __importDefault(require_AbstractMergeDateRangeRefiner()); + var FRMergeDateRangeRefiner = class extends AbstractMergeDateRangeRefiner_1.default { + patternBetween() { + return /^\s*(à|a|-)\s*$/i; + } + }; + exports.default = FRMergeDateRangeRefiner; + } +}); + +// node_modules/chrono-node/dist/locales/fr/constants.js +var require_constants3 = __commonJS({ + "node_modules/chrono-node/dist/locales/fr/constants.js"(exports) { + "use strict"; + Object.defineProperty(exports, "__esModule", { value: true }); + exports.parseTimeUnits = exports.TIME_UNITS_PATTERN = exports.parseYear = exports.YEAR_PATTERN = exports.parseOrdinalNumberPattern = exports.ORDINAL_NUMBER_PATTERN = exports.parseNumberPattern = exports.NUMBER_PATTERN = exports.TIME_UNIT_DICTIONARY = exports.INTEGER_WORD_DICTIONARY = exports.MONTH_DICTIONARY = exports.WEEKDAY_DICTIONARY = void 0; + var pattern_1 = require_pattern(); + exports.WEEKDAY_DICTIONARY = { + "dimanche": 0, + "dim": 0, + "lundi": 1, + "lun": 1, + "mardi": 2, + "mar": 2, + "mercredi": 3, + "mer": 3, + "jeudi": 4, + "jeu": 4, + "vendredi": 5, + "ven": 5, + "samedi": 6, + "sam": 6 + }; + exports.MONTH_DICTIONARY = { + "janvier": 1, + "jan": 1, + "jan.": 1, + "f\xE9vrier": 2, + "f\xE9v": 2, + "f\xE9v.": 2, + "fevrier": 2, + "fev": 2, + "fev.": 2, + "mars": 3, + "mar": 3, + "mar.": 3, + "avril": 4, + "avr": 4, + "avr.": 4, + "mai": 5, + "juin": 6, + "jun": 6, + "juillet": 7, + "juil": 7, + "jul": 7, + "jul.": 7, + "ao\xFBt": 8, + "aout": 8, + "septembre": 9, + "sep": 9, + "sep.": 9, + "sept": 9, + "sept.": 9, + "octobre": 10, + "oct": 10, + "oct.": 10, + "novembre": 11, + "nov": 11, + "nov.": 11, + "d\xE9cembre": 12, + "decembre": 12, + "dec": 12, + "dec.": 12 + }; + exports.INTEGER_WORD_DICTIONARY = { + "un": 1, + "deux": 2, + "trois": 3, + "quatre": 4, + "cinq": 5, + "six": 6, + "sept": 7, + "huit": 8, + "neuf": 9, + "dix": 10, + "onze": 11, + "douze": 12, + "treize": 13 + }; + exports.TIME_UNIT_DICTIONARY = { + "sec": "second", + "seconde": "second", + "secondes": "second", + "min": "minute", + "mins": "minute", + "minute": "minute", + "minutes": "minute", + "h": "hour", + "hr": "hour", + "hrs": "hour", + "heure": "hour", + "heures": "hour", + "jour": "d", + "jours": "d", + "semaine": "week", + "semaines": "week", + "mois": "month", + "trimestre": "quarter", + "trimestres": "quarter", + "ans": "year", + "ann\xE9e": "year", + "ann\xE9es": "year" + }; + exports.NUMBER_PATTERN = `(?:${pattern_1.matchAnyPattern(exports.INTEGER_WORD_DICTIONARY)}|[0-9]+|[0-9]+\\.[0-9]+|une?\\b|quelques?|demi-?)`; + function parseNumberPattern(match) { + const num = match.toLowerCase(); + if (exports.INTEGER_WORD_DICTIONARY[num] !== void 0) { + return exports.INTEGER_WORD_DICTIONARY[num]; + } else if (num === "une" || num === "un") { + return 1; + } else if (num.match(/quelques?/)) { + return 3; + } else if (num.match(/demi-?/)) { + return 0.5; + } + return parseFloat(num); + } + exports.parseNumberPattern = parseNumberPattern; + exports.ORDINAL_NUMBER_PATTERN = `(?:[0-9]{1,2}(?:er)?)`; + function parseOrdinalNumberPattern(match) { + let num = match.toLowerCase(); + num = num.replace(/(?:er)$/i, ""); + return parseInt(num); + } + exports.parseOrdinalNumberPattern = parseOrdinalNumberPattern; + exports.YEAR_PATTERN = `(?:[1-9][0-9]{0,3}\\s*(?:AC|AD|p\\.\\s*C(?:hr?)?\\.\\s*n\\.)|[1-2][0-9]{3}|[5-9][0-9])`; + function parseYear(match) { + if (/AC/i.test(match)) { + match = match.replace(/BC/i, ""); + return -parseInt(match); + } + if (/AD/i.test(match) || /C/i.test(match)) { + match = match.replace(/[^\d]+/i, ""); + return parseInt(match); + } + let yearNumber = parseInt(match); + if (yearNumber < 100) { + if (yearNumber > 50) { + yearNumber = yearNumber + 1900; + } else { + yearNumber = yearNumber + 2e3; + } + } + return yearNumber; + } + exports.parseYear = parseYear; + var SINGLE_TIME_UNIT_PATTERN = `(${exports.NUMBER_PATTERN})\\s{0,5}(${pattern_1.matchAnyPattern(exports.TIME_UNIT_DICTIONARY)})\\s{0,5}`; + var SINGLE_TIME_UNIT_REGEX = new RegExp(SINGLE_TIME_UNIT_PATTERN, "i"); + exports.TIME_UNITS_PATTERN = pattern_1.repeatedTimeunitPattern("", SINGLE_TIME_UNIT_PATTERN); + function parseTimeUnits(timeunitText) { + const fragments = {}; + let remainingText = timeunitText; + let match = SINGLE_TIME_UNIT_REGEX.exec(remainingText); + while (match) { + collectDateTimeFragment(fragments, match); + remainingText = remainingText.substring(match[0].length); + match = SINGLE_TIME_UNIT_REGEX.exec(remainingText); + } + return fragments; + } + exports.parseTimeUnits = parseTimeUnits; + function collectDateTimeFragment(fragments, match) { + const num = parseNumberPattern(match[1]); + const unit = exports.TIME_UNIT_DICTIONARY[match[2].toLowerCase()]; + fragments[unit] = num; + } + } +}); + +// node_modules/chrono-node/dist/locales/fr/parsers/FRWeekdayParser.js +var require_FRWeekdayParser = __commonJS({ + "node_modules/chrono-node/dist/locales/fr/parsers/FRWeekdayParser.js"(exports) { + "use strict"; + Object.defineProperty(exports, "__esModule", { value: true }); + var constants_1 = require_constants3(); + var pattern_1 = require_pattern(); + var AbstractParserWithWordBoundary_1 = require_AbstractParserWithWordBoundary(); + var weeks_1 = require_weeks(); + var PATTERN = new RegExp(`(?:(?:\\,|\\(|\\\uFF08)\\s*)?(?:(?:ce)\\s*)?(${pattern_1.matchAnyPattern(constants_1.WEEKDAY_DICTIONARY)})(?:\\s*(?:\\,|\\)|\\\uFF09))?(?:\\s*(dernier|prochain)\\s*)?(?=\\W|\\d|$)`, "i"); + var WEEKDAY_GROUP = 1; + var POSTFIX_GROUP = 2; + var FRWeekdayParser = class extends AbstractParserWithWordBoundary_1.AbstractParserWithWordBoundaryChecking { + innerPattern() { + return PATTERN; + } + innerExtract(context, match) { + const dayOfWeek = match[WEEKDAY_GROUP].toLowerCase(); + const offset2 = constants_1.WEEKDAY_DICTIONARY[dayOfWeek]; + if (offset2 === void 0) { + return null; + } + let suffix = match[POSTFIX_GROUP]; + suffix = suffix || ""; + suffix = suffix.toLowerCase(); + let modifier = null; + if (suffix == "dernier") { + modifier = "last"; + } else if (suffix == "prochain") { + modifier = "next"; + } + const date = weeks_1.toDayJSWeekday(context.refDate, offset2, modifier); + return context.createParsingComponents().assign("weekday", offset2).imply("day", date.date()).imply("month", date.month() + 1).imply("year", date.year()); + } + }; + exports.default = FRWeekdayParser; + } +}); + +// node_modules/chrono-node/dist/locales/fr/parsers/FRSpecificTimeExpressionParser.js +var require_FRSpecificTimeExpressionParser = __commonJS({ + "node_modules/chrono-node/dist/locales/fr/parsers/FRSpecificTimeExpressionParser.js"(exports) { + "use strict"; + Object.defineProperty(exports, "__esModule", { value: true }); + var index_1 = require_dist(); + var FIRST_REG_PATTERN = new RegExp("(^|\\s|T)(?:(?:[\xE0a])\\s*)?(\\d{1,2})(?:h|:)?(?:(\\d{1,2})(?:m|:)?)?(?:(\\d{1,2})(?:s|:)?)?(?:\\s*(A\\.M\\.|P\\.M\\.|AM?|PM?))?(?=\\W|$)", "i"); + var SECOND_REG_PATTERN = new RegExp("^\\s*(\\-|\\\u2013|\\~|\\\u301C|[\xE0a]|\\?)\\s*(\\d{1,2})(?:h|:)?(?:(\\d{1,2})(?:m|:)?)?(?:(\\d{1,2})(?:s|:)?)?(?:\\s*(A\\.M\\.|P\\.M\\.|AM?|PM?))?(?=\\W|$)", "i"); + var HOUR_GROUP = 2; + var MINUTE_GROUP = 3; + var SECOND_GROUP = 4; + var AM_PM_HOUR_GROUP = 5; + var FRSpecificTimeExpressionParser = class { + pattern(context) { + return FIRST_REG_PATTERN; + } + extract(context, match) { + const result = context.createParsingResult(match.index + match[1].length, match[0].substring(match[1].length)); + if (result.text.match(/^\d{4}$/)) { + match.index += match[0].length; + return null; + } + result.start = FRSpecificTimeExpressionParser.extractTimeComponent(result.start.clone(), match); + if (!result.start) { + match.index += match[0].length; + return null; + } + const remainingText = context.text.substring(match.index + match[0].length); + const secondMatch = SECOND_REG_PATTERN.exec(remainingText); + if (secondMatch) { + result.end = FRSpecificTimeExpressionParser.extractTimeComponent(result.start.clone(), secondMatch); + if (result.end) { + result.text += secondMatch[0]; + } + } + return result; + } + static extractTimeComponent(extractingComponents, match) { + let hour = 0; + let minute = 0; + let meridiem = null; + hour = parseInt(match[HOUR_GROUP]); + if (match[MINUTE_GROUP] != null) { + minute = parseInt(match[MINUTE_GROUP]); + } + if (minute >= 60 || hour > 24) { + return null; + } + if (hour >= 12) { + meridiem = index_1.Meridiem.PM; + } + if (match[AM_PM_HOUR_GROUP] != null) { + if (hour > 12) + return null; + const ampm = match[AM_PM_HOUR_GROUP][0].toLowerCase(); + if (ampm == "a") { + meridiem = index_1.Meridiem.AM; + if (hour == 12) { + hour = 0; + } + } + if (ampm == "p") { + meridiem = index_1.Meridiem.PM; + if (hour != 12) { + hour += 12; + } + } + } + extractingComponents.assign("hour", hour); + extractingComponents.assign("minute", minute); + if (meridiem !== null) { + extractingComponents.assign("meridiem", meridiem); + } else { + if (hour < 12) { + extractingComponents.imply("meridiem", index_1.Meridiem.AM); + } else { + extractingComponents.imply("meridiem", index_1.Meridiem.PM); + } + } + if (match[SECOND_GROUP] != null) { + const second = parseInt(match[SECOND_GROUP]); + if (second >= 60) + return null; + extractingComponents.assign("second", second); + } + return extractingComponents; + } + }; + exports.default = FRSpecificTimeExpressionParser; + } +}); + +// node_modules/chrono-node/dist/locales/fr/parsers/FRMonthNameLittleEndianParser.js +var require_FRMonthNameLittleEndianParser = __commonJS({ + "node_modules/chrono-node/dist/locales/fr/parsers/FRMonthNameLittleEndianParser.js"(exports) { + "use strict"; + Object.defineProperty(exports, "__esModule", { value: true }); + var years_1 = require_years(); + var constants_1 = require_constants3(); + var constants_2 = require_constants3(); + var constants_3 = require_constants3(); + var pattern_1 = require_pattern(); + var AbstractParserWithWordBoundary_1 = require_AbstractParserWithWordBoundary(); + var PATTERN = new RegExp(`(?:on\\s*?)?(${constants_3.ORDINAL_NUMBER_PATTERN})(?:\\s*(?:au|\\-|\\\u2013|jusqu'au?|\\s)\\s*(${constants_3.ORDINAL_NUMBER_PATTERN}))?(?:-|/|\\s*(?:de)?\\s*)(${pattern_1.matchAnyPattern(constants_1.MONTH_DICTIONARY)})(?:(?:-|/|,?\\s*)(${constants_2.YEAR_PATTERN}(?![^\\s]\\d)))?(?=\\W|$)`, "i"); + var DATE_GROUP = 1; + var DATE_TO_GROUP = 2; + var MONTH_NAME_GROUP = 3; + var YEAR_GROUP = 4; + var FRMonthNameLittleEndianParser = class extends AbstractParserWithWordBoundary_1.AbstractParserWithWordBoundaryChecking { + innerPattern() { + return PATTERN; + } + innerExtract(context, match) { + const result = context.createParsingResult(match.index, match[0]); + const month = constants_1.MONTH_DICTIONARY[match[MONTH_NAME_GROUP].toLowerCase()]; + const day = constants_3.parseOrdinalNumberPattern(match[DATE_GROUP]); + if (day > 31) { + match.index = match.index + match[DATE_GROUP].length; + return null; + } + result.start.assign("month", month); + result.start.assign("day", day); + if (match[YEAR_GROUP]) { + const yearNumber = constants_2.parseYear(match[YEAR_GROUP]); + result.start.assign("year", yearNumber); + } else { + const year = years_1.findYearClosestToRef(context.refDate, day, month); + result.start.imply("year", year); + } + if (match[DATE_TO_GROUP]) { + const endDate = constants_3.parseOrdinalNumberPattern(match[DATE_TO_GROUP]); + result.end = result.start.clone(); + result.end.assign("day", endDate); + } + return result; + } + }; + exports.default = FRMonthNameLittleEndianParser; + } +}); + +// node_modules/chrono-node/dist/locales/fr/parsers/FRTimeUnitAgoFormatParser.js +var require_FRTimeUnitAgoFormatParser = __commonJS({ + "node_modules/chrono-node/dist/locales/fr/parsers/FRTimeUnitAgoFormatParser.js"(exports) { + "use strict"; + Object.defineProperty(exports, "__esModule", { value: true }); + var constants_1 = require_constants3(); + var results_1 = require_results(); + var AbstractParserWithWordBoundary_1 = require_AbstractParserWithWordBoundary(); + var timeunits_1 = require_timeunits(); + var FRTimeUnitAgoFormatParser = class extends AbstractParserWithWordBoundary_1.AbstractParserWithWordBoundaryChecking { + constructor() { + super(); + } + innerPattern() { + return new RegExp(`il y a\\s*(${constants_1.TIME_UNITS_PATTERN})(?=(?:\\W|$))`, "i"); + } + innerExtract(context, match) { + const timeUnits = constants_1.parseTimeUnits(match[1]); + const outputTimeUnits = timeunits_1.reverseTimeUnits(timeUnits); + return results_1.ParsingComponents.createRelativeFromReference(context.reference, outputTimeUnits); + } + }; + exports.default = FRTimeUnitAgoFormatParser; + } +}); + +// node_modules/chrono-node/dist/locales/fr/parsers/FRTimeUnitWithinFormatParser.js +var require_FRTimeUnitWithinFormatParser = __commonJS({ + "node_modules/chrono-node/dist/locales/fr/parsers/FRTimeUnitWithinFormatParser.js"(exports) { + "use strict"; + Object.defineProperty(exports, "__esModule", { value: true }); + var constants_1 = require_constants3(); + var results_1 = require_results(); + var AbstractParserWithWordBoundary_1 = require_AbstractParserWithWordBoundary(); + var FRTimeUnitWithinFormatParser = class extends AbstractParserWithWordBoundary_1.AbstractParserWithWordBoundaryChecking { + innerPattern() { + return new RegExp(`(?:dans|en|pour|pendant|de)\\s*(${constants_1.TIME_UNITS_PATTERN})(?=\\W|$)`, "i"); + } + innerExtract(context, match) { + const timeUnits = constants_1.parseTimeUnits(match[1]); + return results_1.ParsingComponents.createRelativeFromReference(context.reference, timeUnits); + } + }; + exports.default = FRTimeUnitWithinFormatParser; + } +}); + +// node_modules/chrono-node/dist/locales/fr/parsers/FRTimeUnitRelativeFormatParser.js +var require_FRTimeUnitRelativeFormatParser = __commonJS({ + "node_modules/chrono-node/dist/locales/fr/parsers/FRTimeUnitRelativeFormatParser.js"(exports) { + "use strict"; + Object.defineProperty(exports, "__esModule", { value: true }); + var constants_1 = require_constants3(); + var results_1 = require_results(); + var AbstractParserWithWordBoundary_1 = require_AbstractParserWithWordBoundary(); + var timeunits_1 = require_timeunits(); + var pattern_1 = require_pattern(); + var FRTimeUnitAgoFormatParser = class extends AbstractParserWithWordBoundary_1.AbstractParserWithWordBoundaryChecking { + constructor() { + super(); + } + innerPattern() { + return new RegExp(`(?:les?|la|l'|du|des?)\\s*(${constants_1.NUMBER_PATTERN})?(?:\\s*(prochaine?s?|derni[e\xE8]re?s?|pass[\xE9e]e?s?|pr[\xE9e]c[\xE9e]dents?|suivante?s?))?\\s*(${pattern_1.matchAnyPattern(constants_1.TIME_UNIT_DICTIONARY)})(?:\\s*(prochaine?s?|derni[e\xE8]re?s?|pass[\xE9e]e?s?|pr[\xE9e]c[\xE9e]dents?|suivante?s?))?`, "i"); + } + innerExtract(context, match) { + const num = match[1] ? constants_1.parseNumberPattern(match[1]) : 1; + const unit = constants_1.TIME_UNIT_DICTIONARY[match[3].toLowerCase()]; + let timeUnits = {}; + timeUnits[unit] = num; + let modifier = match[2] || match[4] || ""; + modifier = modifier.toLowerCase(); + if (!modifier) { + return; + } + if (/derni[eè]re?s?/.test(modifier) || /pass[ée]e?s?/.test(modifier) || /pr[ée]c[ée]dents?/.test(modifier)) { + timeUnits = timeunits_1.reverseTimeUnits(timeUnits); + } + return results_1.ParsingComponents.createRelativeFromReference(context.reference, timeUnits); + } + }; + exports.default = FRTimeUnitAgoFormatParser; + } +}); + +// node_modules/chrono-node/dist/locales/fr/index.js +var require_fr = __commonJS({ + "node_modules/chrono-node/dist/locales/fr/index.js"(exports) { + "use strict"; + var __importDefault = exports && exports.__importDefault || function(mod) { + return mod && mod.__esModule ? mod : { "default": mod }; + }; + Object.defineProperty(exports, "__esModule", { value: true }); + exports.createConfiguration = exports.createCasualConfiguration = exports.parseDate = exports.parse = exports.strict = exports.casual = void 0; + var configurations_1 = require_configurations(); + var chrono_1 = require_chrono(); + var FRCasualDateParser_1 = __importDefault(require_FRCasualDateParser()); + var FRCasualTimeParser_1 = __importDefault(require_FRCasualTimeParser()); + var SlashDateFormatParser_1 = __importDefault(require_SlashDateFormatParser()); + var FRTimeExpressionParser_1 = __importDefault(require_FRTimeExpressionParser()); + var FRMergeDateTimeRefiner_1 = __importDefault(require_FRMergeDateTimeRefiner()); + var FRMergeDateRangeRefiner_1 = __importDefault(require_FRMergeDateRangeRefiner()); + var FRWeekdayParser_1 = __importDefault(require_FRWeekdayParser()); + var FRSpecificTimeExpressionParser_1 = __importDefault(require_FRSpecificTimeExpressionParser()); + var FRMonthNameLittleEndianParser_1 = __importDefault(require_FRMonthNameLittleEndianParser()); + var FRTimeUnitAgoFormatParser_1 = __importDefault(require_FRTimeUnitAgoFormatParser()); + var FRTimeUnitWithinFormatParser_1 = __importDefault(require_FRTimeUnitWithinFormatParser()); + var FRTimeUnitRelativeFormatParser_1 = __importDefault(require_FRTimeUnitRelativeFormatParser()); + exports.casual = new chrono_1.Chrono(createCasualConfiguration()); + exports.strict = new chrono_1.Chrono(createConfiguration(true)); + function parse4(text2, ref, option) { + return exports.casual.parse(text2, ref, option); + } + exports.parse = parse4; + function parseDate3(text2, ref, option) { + return exports.casual.parseDate(text2, ref, option); + } + exports.parseDate = parseDate3; + function createCasualConfiguration(littleEndian = true) { + const option = createConfiguration(false, littleEndian); + option.parsers.unshift(new FRCasualDateParser_1.default()); + option.parsers.unshift(new FRCasualTimeParser_1.default()); + option.parsers.unshift(new FRTimeUnitRelativeFormatParser_1.default()); + return option; + } + exports.createCasualConfiguration = createCasualConfiguration; + function createConfiguration(strictMode = true, littleEndian = true) { + return configurations_1.includeCommonConfiguration({ + parsers: [ + new SlashDateFormatParser_1.default(littleEndian), + new FRMonthNameLittleEndianParser_1.default(), + new FRTimeExpressionParser_1.default(), + new FRSpecificTimeExpressionParser_1.default(), + new FRTimeUnitAgoFormatParser_1.default(), + new FRTimeUnitWithinFormatParser_1.default(), + new FRWeekdayParser_1.default() + ], + refiners: [new FRMergeDateTimeRefiner_1.default(), new FRMergeDateRangeRefiner_1.default()] + }, strictMode); + } + exports.createConfiguration = createConfiguration; + } +}); + +// node_modules/chrono-node/dist/locales/ja/constants.js +var require_constants4 = __commonJS({ + "node_modules/chrono-node/dist/locales/ja/constants.js"(exports) { + "use strict"; + Object.defineProperty(exports, "__esModule", { value: true }); + exports.toHankaku = void 0; + function toHankaku(text2) { + return String(text2).replace(/\u2019/g, "'").replace(/\u201D/g, '"').replace(/\u3000/g, " ").replace(/\uFFE5/g, "\xA5").replace(/[\uFF01\uFF03-\uFF06\uFF08\uFF09\uFF0C-\uFF19\uFF1C-\uFF1F\uFF21-\uFF3B\uFF3D\uFF3F\uFF41-\uFF5B\uFF5D\uFF5E]/g, alphaNum); + } + exports.toHankaku = toHankaku; + function alphaNum(token) { + return String.fromCharCode(token.charCodeAt(0) - 65248); + } + } +}); + +// node_modules/chrono-node/dist/locales/ja/parsers/JPStandardParser.js +var require_JPStandardParser = __commonJS({ + "node_modules/chrono-node/dist/locales/ja/parsers/JPStandardParser.js"(exports) { + "use strict"; + var __importDefault = exports && exports.__importDefault || function(mod) { + return mod && mod.__esModule ? mod : { "default": mod }; + }; + Object.defineProperty(exports, "__esModule", { value: true }); + var constants_1 = require_constants4(); + var years_1 = require_years(); + var dayjs_1 = __importDefault(require_dayjs_min()); + var PATTERN = /(?:(?:([同今本])|((昭和|平成|令和)?([0-90-9]{1,4}|元)))年\s*)?([0-90-9]{1,2})月\s*([0-90-9]{1,2})日/i; + var SPECIAL_YEAR_GROUP = 1; + var TYPICAL_YEAR_GROUP = 2; + var ERA_GROUP = 3; + var YEAR_NUMBER_GROUP = 4; + var MONTH_GROUP = 5; + var DAY_GROUP = 6; + var JPStandardParser = class { + pattern() { + return PATTERN; + } + extract(context, match) { + const month = parseInt(constants_1.toHankaku(match[MONTH_GROUP])); + const day = parseInt(constants_1.toHankaku(match[DAY_GROUP])); + const components = context.createParsingComponents({ + day, + month + }); + if (match[SPECIAL_YEAR_GROUP] && match[SPECIAL_YEAR_GROUP].match("\u540C|\u4ECA|\u672C")) { + const moment = dayjs_1.default(context.refDate); + components.assign("year", moment.year()); + } + if (match[TYPICAL_YEAR_GROUP]) { + const yearNumText = match[YEAR_NUMBER_GROUP]; + let year = yearNumText == "\u5143" ? 1 : parseInt(constants_1.toHankaku(yearNumText)); + if (match[ERA_GROUP] == "\u4EE4\u548C") { + year += 2018; + } else if (match[ERA_GROUP] == "\u5E73\u6210") { + year += 1988; + } else if (match[ERA_GROUP] == "\u662D\u548C") { + year += 1925; + } + components.assign("year", year); + } else { + const year = years_1.findYearClosestToRef(context.refDate, day, month); + components.imply("year", year); + } + return components; + } + }; + exports.default = JPStandardParser; + } +}); + +// node_modules/chrono-node/dist/locales/ja/refiners/JPMergeDateRangeRefiner.js +var require_JPMergeDateRangeRefiner = __commonJS({ + "node_modules/chrono-node/dist/locales/ja/refiners/JPMergeDateRangeRefiner.js"(exports) { + "use strict"; + var __importDefault = exports && exports.__importDefault || function(mod) { + return mod && mod.__esModule ? mod : { "default": mod }; + }; + Object.defineProperty(exports, "__esModule", { value: true }); + var AbstractMergeDateRangeRefiner_1 = __importDefault(require_AbstractMergeDateRangeRefiner()); + var JPMergeDateRangeRefiner = class extends AbstractMergeDateRangeRefiner_1.default { + patternBetween() { + return /^\s*(から|ー|-)\s*$/i; + } + }; + exports.default = JPMergeDateRangeRefiner; + } +}); + +// node_modules/chrono-node/dist/locales/ja/parsers/JPCasualDateParser.js +var require_JPCasualDateParser = __commonJS({ + "node_modules/chrono-node/dist/locales/ja/parsers/JPCasualDateParser.js"(exports) { + "use strict"; + var __createBinding = exports && exports.__createBinding || (Object.create ? function(o, m, k, k2) { + if (k2 === void 0) + k2 = k; + Object.defineProperty(o, k2, { enumerable: true, get: function() { + return m[k]; + } }); + } : function(o, m, k, k2) { + if (k2 === void 0) + k2 = k; + o[k2] = m[k]; + }); + var __setModuleDefault = exports && exports.__setModuleDefault || (Object.create ? function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); + } : function(o, v) { + o["default"] = v; + }); + var __importStar = exports && exports.__importStar || function(mod) { + if (mod && mod.__esModule) + return mod; + var result = {}; + if (mod != null) { + for (var k in mod) + if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) + __createBinding(result, mod, k); + } + __setModuleDefault(result, mod); + return result; + }; + var __importDefault = exports && exports.__importDefault || function(mod) { + return mod && mod.__esModule ? mod : { "default": mod }; + }; + Object.defineProperty(exports, "__esModule", { value: true }); + var dayjs_1 = __importDefault(require_dayjs_min()); + var index_1 = require_dist(); + var references = __importStar(require_casualReferences()); + var PATTERN = /今日|当日|昨日|明日|今夜|今夕|今晩|今朝/i; + var JPCasualDateParser = class { + pattern() { + return PATTERN; + } + extract(context, match) { + const text2 = match[0]; + const date = dayjs_1.default(context.refDate); + const components = context.createParsingComponents(); + switch (text2) { + case "\u6628\u65E5": + return references.yesterday(context.reference); + case "\u660E\u65E5": + return references.tomorrow(context.reference); + case "\u4ECA\u65E5": + case "\u5F53\u65E5": + return references.today(context.reference); + } + if (text2 == "\u4ECA\u591C" || text2 == "\u4ECA\u5915" || text2 == "\u4ECA\u6669") { + components.imply("hour", 22); + components.assign("meridiem", index_1.Meridiem.PM); + } else if (text2.match("\u4ECA\u671D")) { + components.imply("hour", 6); + components.assign("meridiem", index_1.Meridiem.AM); + } + components.assign("day", date.date()); + components.assign("month", date.month() + 1); + components.assign("year", date.year()); + return components; + } + }; + exports.default = JPCasualDateParser; + } +}); + +// node_modules/chrono-node/dist/locales/ja/index.js +var require_ja = __commonJS({ + "node_modules/chrono-node/dist/locales/ja/index.js"(exports) { + "use strict"; + var __importDefault = exports && exports.__importDefault || function(mod) { + return mod && mod.__esModule ? mod : { "default": mod }; + }; + Object.defineProperty(exports, "__esModule", { value: true }); + exports.createConfiguration = exports.createCasualConfiguration = exports.parseDate = exports.parse = exports.strict = exports.casual = void 0; + var JPStandardParser_1 = __importDefault(require_JPStandardParser()); + var JPMergeDateRangeRefiner_1 = __importDefault(require_JPMergeDateRangeRefiner()); + var JPCasualDateParser_1 = __importDefault(require_JPCasualDateParser()); + var chrono_1 = require_chrono(); + exports.casual = new chrono_1.Chrono(createCasualConfiguration()); + exports.strict = new chrono_1.Chrono(createConfiguration()); + function parse4(text2, ref, option) { + return exports.casual.parse(text2, ref, option); + } + exports.parse = parse4; + function parseDate3(text2, ref, option) { + return exports.casual.parseDate(text2, ref, option); + } + exports.parseDate = parseDate3; + function createCasualConfiguration() { + const option = createConfiguration(); + option.parsers.unshift(new JPCasualDateParser_1.default()); + return option; + } + exports.createCasualConfiguration = createCasualConfiguration; + function createConfiguration() { + return { + parsers: [new JPStandardParser_1.default()], + refiners: [new JPMergeDateRangeRefiner_1.default()] + }; + } + exports.createConfiguration = createConfiguration; + } +}); + +// node_modules/chrono-node/dist/locales/pt/constants.js +var require_constants5 = __commonJS({ + "node_modules/chrono-node/dist/locales/pt/constants.js"(exports) { + "use strict"; + Object.defineProperty(exports, "__esModule", { value: true }); + exports.parseYear = exports.YEAR_PATTERN = exports.MONTH_DICTIONARY = exports.WEEKDAY_DICTIONARY = void 0; + exports.WEEKDAY_DICTIONARY = { + "domingo": 0, + "dom": 0, + "segunda": 1, + "segunda-feira": 1, + "seg": 1, + "ter\xE7a": 2, + "ter\xE7a-feira": 2, + "ter": 2, + "quarta": 3, + "quarta-feira": 3, + "qua": 3, + "quinta": 4, + "quinta-feira": 4, + "qui": 4, + "sexta": 5, + "sexta-feira": 5, + "sex": 5, + "s\xE1bado": 6, + "sabado": 6, + "sab": 6 + }; + exports.MONTH_DICTIONARY = { + "janeiro": 1, + "jan": 1, + "jan.": 1, + "fevereiro": 2, + "fev": 2, + "fev.": 2, + "mar\xE7o": 3, + "mar": 3, + "mar.": 3, + "abril": 4, + "abr": 4, + "abr.": 4, + "maio": 5, + "mai": 5, + "mai.": 5, + "junho": 6, + "jun": 6, + "jun.": 6, + "julho": 7, + "jul": 7, + "jul.": 7, + "agosto": 8, + "ago": 8, + "ago.": 8, + "setembro": 9, + "set": 9, + "set.": 9, + "outubro": 10, + "out": 10, + "out.": 10, + "novembro": 11, + "nov": 11, + "nov.": 11, + "dezembro": 12, + "dez": 12, + "dez.": 12 + }; + exports.YEAR_PATTERN = "[0-9]{1,4}(?![^\\s]\\d)(?:\\s*[a|d]\\.?\\s*c\\.?|\\s*a\\.?\\s*d\\.?)?"; + function parseYear(match) { + if (match.match(/^[0-9]{1,4}$/)) { + let yearNumber = parseInt(match); + if (yearNumber < 100) { + if (yearNumber > 50) { + yearNumber = yearNumber + 1900; + } else { + yearNumber = yearNumber + 2e3; + } + } + return yearNumber; + } + if (match.match(/a\.?\s*c\.?/i)) { + match = match.replace(/a\.?\s*c\.?/i, ""); + return -parseInt(match); + } + return parseInt(match); + } + exports.parseYear = parseYear; + } +}); + +// node_modules/chrono-node/dist/locales/pt/parsers/PTWeekdayParser.js +var require_PTWeekdayParser = __commonJS({ + "node_modules/chrono-node/dist/locales/pt/parsers/PTWeekdayParser.js"(exports) { + "use strict"; + Object.defineProperty(exports, "__esModule", { value: true }); + var constants_1 = require_constants5(); + var pattern_1 = require_pattern(); + var AbstractParserWithWordBoundary_1 = require_AbstractParserWithWordBoundary(); + var weeks_1 = require_weeks(); + var PATTERN = new RegExp(`(?:(?:\\,|\\(|\\\uFF08)\\s*)?(?:(este|esta|passado|pr[o\xF3]ximo)\\s*)?(${pattern_1.matchAnyPattern(constants_1.WEEKDAY_DICTIONARY)})(?:\\s*(?:\\,|\\)|\\\uFF09))?(?:\\s*(este|esta|passado|pr[\xF3o]ximo)\\s*semana)?(?=\\W|\\d|$)`, "i"); + var PREFIX_GROUP = 1; + var WEEKDAY_GROUP = 2; + var POSTFIX_GROUP = 3; + var PTWeekdayParser = class extends AbstractParserWithWordBoundary_1.AbstractParserWithWordBoundaryChecking { + innerPattern() { + return PATTERN; + } + innerExtract(context, match) { + const dayOfWeek = match[WEEKDAY_GROUP].toLowerCase(); + const offset2 = constants_1.WEEKDAY_DICTIONARY[dayOfWeek]; + if (offset2 === void 0) { + return null; + } + const prefix = match[PREFIX_GROUP]; + const postfix = match[POSTFIX_GROUP]; + let norm = prefix || postfix || ""; + norm = norm.toLowerCase(); + let modifier = null; + if (norm == "passado") { + modifier = "this"; + } else if (norm == "pr\xF3ximo" || norm == "proximo") { + modifier = "next"; + } else if (norm == "este") { + modifier = "this"; + } + const date = weeks_1.toDayJSWeekday(context.refDate, offset2, modifier); + return context.createParsingComponents().assign("weekday", offset2).imply("day", date.date()).imply("month", date.month() + 1).imply("year", date.year()); + } + }; + exports.default = PTWeekdayParser; + } +}); + +// node_modules/chrono-node/dist/locales/pt/parsers/PTTimeExpressionParser.js +var require_PTTimeExpressionParser = __commonJS({ + "node_modules/chrono-node/dist/locales/pt/parsers/PTTimeExpressionParser.js"(exports) { + "use strict"; + Object.defineProperty(exports, "__esModule", { value: true }); + var AbstractTimeExpressionParser_1 = require_AbstractTimeExpressionParser(); + var PTTimeExpressionParser = class extends AbstractTimeExpressionParser_1.AbstractTimeExpressionParser { + primaryPrefix() { + return "(?:(?:ao?|\xE0s?|das|da|de|do)\\s*)?"; + } + followingPhase() { + return "\\s*(?:\\-|\\\u2013|\\~|\\\u301C|a(?:o)?|\\?)\\s*"; + } + }; + exports.default = PTTimeExpressionParser; + } +}); + +// node_modules/chrono-node/dist/locales/pt/refiners/PTMergeDateTimeRefiner.js +var require_PTMergeDateTimeRefiner = __commonJS({ + "node_modules/chrono-node/dist/locales/pt/refiners/PTMergeDateTimeRefiner.js"(exports) { + "use strict"; + var __importDefault = exports && exports.__importDefault || function(mod) { + return mod && mod.__esModule ? mod : { "default": mod }; + }; + Object.defineProperty(exports, "__esModule", { value: true }); + var AbstractMergeDateTimeRefiner_1 = __importDefault(require_AbstractMergeDateTimeRefiner()); + var PTMergeDateTimeRefiner = class extends AbstractMergeDateTimeRefiner_1.default { + patternBetween() { + return new RegExp("^\\s*(?:,|\xE0)?\\s*$"); + } + }; + exports.default = PTMergeDateTimeRefiner; + } +}); + +// node_modules/chrono-node/dist/locales/pt/refiners/PTMergeDateRangeRefiner.js +var require_PTMergeDateRangeRefiner = __commonJS({ + "node_modules/chrono-node/dist/locales/pt/refiners/PTMergeDateRangeRefiner.js"(exports) { + "use strict"; + var __importDefault = exports && exports.__importDefault || function(mod) { + return mod && mod.__esModule ? mod : { "default": mod }; + }; + Object.defineProperty(exports, "__esModule", { value: true }); + var AbstractMergeDateRangeRefiner_1 = __importDefault(require_AbstractMergeDateRangeRefiner()); + var PTMergeDateRangeRefiner = class extends AbstractMergeDateRangeRefiner_1.default { + patternBetween() { + return /^\s*(?:-)\s*$/i; + } + }; + exports.default = PTMergeDateRangeRefiner; + } +}); + +// node_modules/chrono-node/dist/locales/pt/parsers/PTMonthNameLittleEndianParser.js +var require_PTMonthNameLittleEndianParser = __commonJS({ + "node_modules/chrono-node/dist/locales/pt/parsers/PTMonthNameLittleEndianParser.js"(exports) { + "use strict"; + Object.defineProperty(exports, "__esModule", { value: true }); + var years_1 = require_years(); + var constants_1 = require_constants5(); + var constants_2 = require_constants5(); + var pattern_1 = require_pattern(); + var AbstractParserWithWordBoundary_1 = require_AbstractParserWithWordBoundary(); + var PATTERN = new RegExp(`([0-9]{1,2})(?:\xBA|\xAA|\xB0)?(?:\\s*(?:desde|de|\\-|\\\u2013|ao?|\\s)\\s*([0-9]{1,2})(?:\xBA|\xAA|\xB0)?)?\\s*(?:de)?\\s*(?:-|/|\\s*(?:de|,)?\\s*)(${pattern_1.matchAnyPattern(constants_1.MONTH_DICTIONARY)})(?:\\s*(?:de|,)?\\s*(${constants_2.YEAR_PATTERN}))?(?=\\W|$)`, "i"); + var DATE_GROUP = 1; + var DATE_TO_GROUP = 2; + var MONTH_NAME_GROUP = 3; + var YEAR_GROUP = 4; + var PTMonthNameLittleEndianParser = class extends AbstractParserWithWordBoundary_1.AbstractParserWithWordBoundaryChecking { + innerPattern() { + return PATTERN; + } + innerExtract(context, match) { + const result = context.createParsingResult(match.index, match[0]); + const month = constants_1.MONTH_DICTIONARY[match[MONTH_NAME_GROUP].toLowerCase()]; + const day = parseInt(match[DATE_GROUP]); + if (day > 31) { + match.index = match.index + match[DATE_GROUP].length; + return null; + } + result.start.assign("month", month); + result.start.assign("day", day); + if (match[YEAR_GROUP]) { + const yearNumber = constants_2.parseYear(match[YEAR_GROUP]); + result.start.assign("year", yearNumber); + } else { + const year = years_1.findYearClosestToRef(context.refDate, day, month); + result.start.imply("year", year); + } + if (match[DATE_TO_GROUP]) { + const endDate = parseInt(match[DATE_TO_GROUP]); + result.end = result.start.clone(); + result.end.assign("day", endDate); + } + return result; + } + }; + exports.default = PTMonthNameLittleEndianParser; + } +}); + +// node_modules/chrono-node/dist/locales/pt/parsers/PTCasualDateParser.js +var require_PTCasualDateParser = __commonJS({ + "node_modules/chrono-node/dist/locales/pt/parsers/PTCasualDateParser.js"(exports) { + "use strict"; + var __createBinding = exports && exports.__createBinding || (Object.create ? function(o, m, k, k2) { + if (k2 === void 0) + k2 = k; + Object.defineProperty(o, k2, { enumerable: true, get: function() { + return m[k]; + } }); + } : function(o, m, k, k2) { + if (k2 === void 0) + k2 = k; + o[k2] = m[k]; + }); + var __setModuleDefault = exports && exports.__setModuleDefault || (Object.create ? function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); + } : function(o, v) { + o["default"] = v; + }); + var __importStar = exports && exports.__importStar || function(mod) { + if (mod && mod.__esModule) + return mod; + var result = {}; + if (mod != null) { + for (var k in mod) + if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) + __createBinding(result, mod, k); + } + __setModuleDefault(result, mod); + return result; + }; + Object.defineProperty(exports, "__esModule", { value: true }); + var AbstractParserWithWordBoundary_1 = require_AbstractParserWithWordBoundary(); + var references = __importStar(require_casualReferences()); + var PTCasualDateParser = class extends AbstractParserWithWordBoundary_1.AbstractParserWithWordBoundaryChecking { + innerPattern(context) { + return /(agora|hoje|amanha|amanhã|ontem)(?=\W|$)/i; + } + innerExtract(context, match) { + const lowerText = match[0].toLowerCase(); + const component = context.createParsingComponents(); + switch (lowerText) { + case "agora": + return references.now(context.reference); + case "hoje": + return references.today(context.reference); + case "amanha": + case "amanh\xE3": + return references.tomorrow(context.reference); + case "ontem": + return references.yesterday(context.reference); + } + return component; + } + }; + exports.default = PTCasualDateParser; + } +}); + +// node_modules/chrono-node/dist/locales/pt/parsers/PTCasualTimeParser.js +var require_PTCasualTimeParser = __commonJS({ + "node_modules/chrono-node/dist/locales/pt/parsers/PTCasualTimeParser.js"(exports) { + "use strict"; + var __importDefault = exports && exports.__importDefault || function(mod) { + return mod && mod.__esModule ? mod : { "default": mod }; + }; + Object.defineProperty(exports, "__esModule", { value: true }); + var index_1 = require_dist(); + var AbstractParserWithWordBoundary_1 = require_AbstractParserWithWordBoundary(); + var dayjs_1 = require_dayjs(); + var dayjs_2 = __importDefault(require_dayjs_min()); + var PTCasualTimeParser = class extends AbstractParserWithWordBoundary_1.AbstractParserWithWordBoundaryChecking { + innerPattern() { + return /(?:esta\s*)?(manha|manhã|tarde|meia-noite|meio-dia|noite)(?=\W|$)/i; + } + innerExtract(context, match) { + const targetDate = dayjs_2.default(context.refDate); + const component = context.createParsingComponents(); + switch (match[1].toLowerCase()) { + case "tarde": + component.imply("meridiem", index_1.Meridiem.PM); + component.imply("hour", 15); + break; + case "noite": + component.imply("meridiem", index_1.Meridiem.PM); + component.imply("hour", 22); + break; + case "manha": + case "manh\xE3": + component.imply("meridiem", index_1.Meridiem.AM); + component.imply("hour", 6); + break; + case "meia-noite": + dayjs_1.assignTheNextDay(component, targetDate); + component.imply("hour", 0); + component.imply("minute", 0); + component.imply("second", 0); + break; + case "meio-dia": + component.imply("meridiem", index_1.Meridiem.AM); + component.imply("hour", 12); + break; + } + return component; + } + }; + exports.default = PTCasualTimeParser; + } +}); + +// node_modules/chrono-node/dist/locales/pt/index.js +var require_pt = __commonJS({ + "node_modules/chrono-node/dist/locales/pt/index.js"(exports) { + "use strict"; + var __importDefault = exports && exports.__importDefault || function(mod) { + return mod && mod.__esModule ? mod : { "default": mod }; + }; + Object.defineProperty(exports, "__esModule", { value: true }); + exports.createConfiguration = exports.createCasualConfiguration = exports.parseDate = exports.parse = exports.strict = exports.casual = void 0; + var configurations_1 = require_configurations(); + var chrono_1 = require_chrono(); + var SlashDateFormatParser_1 = __importDefault(require_SlashDateFormatParser()); + var PTWeekdayParser_1 = __importDefault(require_PTWeekdayParser()); + var PTTimeExpressionParser_1 = __importDefault(require_PTTimeExpressionParser()); + var PTMergeDateTimeRefiner_1 = __importDefault(require_PTMergeDateTimeRefiner()); + var PTMergeDateRangeRefiner_1 = __importDefault(require_PTMergeDateRangeRefiner()); + var PTMonthNameLittleEndianParser_1 = __importDefault(require_PTMonthNameLittleEndianParser()); + var PTCasualDateParser_1 = __importDefault(require_PTCasualDateParser()); + var PTCasualTimeParser_1 = __importDefault(require_PTCasualTimeParser()); + exports.casual = new chrono_1.Chrono(createCasualConfiguration()); + exports.strict = new chrono_1.Chrono(createConfiguration(true)); + function parse4(text2, ref, option) { + return exports.casual.parse(text2, ref, option); + } + exports.parse = parse4; + function parseDate3(text2, ref, option) { + return exports.casual.parseDate(text2, ref, option); + } + exports.parseDate = parseDate3; + function createCasualConfiguration(littleEndian = true) { + const option = createConfiguration(false, littleEndian); + option.parsers.push(new PTCasualDateParser_1.default()); + option.parsers.push(new PTCasualTimeParser_1.default()); + return option; + } + exports.createCasualConfiguration = createCasualConfiguration; + function createConfiguration(strictMode = true, littleEndian = true) { + return configurations_1.includeCommonConfiguration({ + parsers: [ + new SlashDateFormatParser_1.default(littleEndian), + new PTWeekdayParser_1.default(), + new PTTimeExpressionParser_1.default(), + new PTMonthNameLittleEndianParser_1.default() + ], + refiners: [new PTMergeDateTimeRefiner_1.default(), new PTMergeDateRangeRefiner_1.default()] + }, strictMode); + } + exports.createConfiguration = createConfiguration; + } +}); + +// node_modules/chrono-node/dist/locales/nl/refiners/NLMergeDateRangeRefiner.js +var require_NLMergeDateRangeRefiner = __commonJS({ + "node_modules/chrono-node/dist/locales/nl/refiners/NLMergeDateRangeRefiner.js"(exports) { + "use strict"; + var __importDefault = exports && exports.__importDefault || function(mod) { + return mod && mod.__esModule ? mod : { "default": mod }; + }; + Object.defineProperty(exports, "__esModule", { value: true }); + var AbstractMergeDateRangeRefiner_1 = __importDefault(require_AbstractMergeDateRangeRefiner()); + var NLMergeDateRangeRefiner = class extends AbstractMergeDateRangeRefiner_1.default { + patternBetween() { + return /^\s*(tot|-)\s*$/i; + } + }; + exports.default = NLMergeDateRangeRefiner; + } +}); + +// node_modules/chrono-node/dist/locales/nl/refiners/NLMergeDateTimeRefiner.js +var require_NLMergeDateTimeRefiner = __commonJS({ + "node_modules/chrono-node/dist/locales/nl/refiners/NLMergeDateTimeRefiner.js"(exports) { + "use strict"; + var __importDefault = exports && exports.__importDefault || function(mod) { + return mod && mod.__esModule ? mod : { "default": mod }; + }; + Object.defineProperty(exports, "__esModule", { value: true }); + var AbstractMergeDateTimeRefiner_1 = __importDefault(require_AbstractMergeDateTimeRefiner()); + var NLMergeDateTimeRefiner = class extends AbstractMergeDateTimeRefiner_1.default { + patternBetween() { + return new RegExp("^\\s*(om|na|voor|in de|,|-)?\\s*$"); + } + }; + exports.default = NLMergeDateTimeRefiner; + } +}); + +// node_modules/chrono-node/dist/locales/nl/parsers/NLCasualDateParser.js +var require_NLCasualDateParser = __commonJS({ + "node_modules/chrono-node/dist/locales/nl/parsers/NLCasualDateParser.js"(exports) { + "use strict"; + var __createBinding = exports && exports.__createBinding || (Object.create ? function(o, m, k, k2) { + if (k2 === void 0) + k2 = k; + Object.defineProperty(o, k2, { enumerable: true, get: function() { + return m[k]; + } }); + } : function(o, m, k, k2) { + if (k2 === void 0) + k2 = k; + o[k2] = m[k]; + }); + var __setModuleDefault = exports && exports.__setModuleDefault || (Object.create ? function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); + } : function(o, v) { + o["default"] = v; + }); + var __importStar = exports && exports.__importStar || function(mod) { + if (mod && mod.__esModule) + return mod; + var result = {}; + if (mod != null) { + for (var k in mod) + if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) + __createBinding(result, mod, k); + } + __setModuleDefault(result, mod); + return result; + }; + Object.defineProperty(exports, "__esModule", { value: true }); + var AbstractParserWithWordBoundary_1 = require_AbstractParserWithWordBoundary(); + var references = __importStar(require_casualReferences()); + var NLCasualDateParser = class extends AbstractParserWithWordBoundary_1.AbstractParserWithWordBoundaryChecking { + innerPattern(context) { + return /(nu|vandaag|morgen|morgend|gisteren)(?=\W|$)/i; + } + innerExtract(context, match) { + const lowerText = match[0].toLowerCase(); + const component = context.createParsingComponents(); + switch (lowerText) { + case "nu": + return references.now(context.reference); + case "vandaag": + return references.today(context.reference); + case "morgen": + case "morgend": + return references.tomorrow(context.reference); + case "gisteren": + return references.yesterday(context.reference); + } + return component; + } + }; + exports.default = NLCasualDateParser; + } +}); + +// node_modules/chrono-node/dist/locales/nl/parsers/NLCasualTimeParser.js +var require_NLCasualTimeParser = __commonJS({ + "node_modules/chrono-node/dist/locales/nl/parsers/NLCasualTimeParser.js"(exports) { + "use strict"; + var __importDefault = exports && exports.__importDefault || function(mod) { + return mod && mod.__esModule ? mod : { "default": mod }; + }; + Object.defineProperty(exports, "__esModule", { value: true }); + var index_1 = require_dist(); + var AbstractParserWithWordBoundary_1 = require_AbstractParserWithWordBoundary(); + var dayjs_1 = __importDefault(require_dayjs_min()); + var dayjs_2 = require_dayjs(); + var DAY_GROUP = 1; + var MOMENT_GROUP = 2; + var NLCasualTimeParser = class extends AbstractParserWithWordBoundary_1.AbstractParserWithWordBoundaryChecking { + innerPattern() { + return /(deze)?\s*(namiddag|avond|middernacht|ochtend|middag|'s middags|'s avonds|'s ochtends)(?=\W|$)/i; + } + innerExtract(context, match) { + const targetDate = dayjs_1.default(context.refDate); + const component = context.createParsingComponents(); + if (match[DAY_GROUP] === "deze") { + component.assign("day", context.refDate.getDate()); + component.assign("month", context.refDate.getMonth() + 1); + component.assign("year", context.refDate.getFullYear()); + } + switch (match[MOMENT_GROUP].toLowerCase()) { + case "namiddag": + case "'s namiddags": + component.imply("meridiem", index_1.Meridiem.PM); + component.imply("hour", 15); + break; + case "avond": + case "'s avonds'": + component.imply("meridiem", index_1.Meridiem.PM); + component.imply("hour", 20); + break; + case "middernacht": + dayjs_2.assignTheNextDay(component, targetDate); + component.imply("hour", 0); + component.imply("minute", 0); + component.imply("second", 0); + break; + case "ochtend": + case "'s ochtends": + component.imply("meridiem", index_1.Meridiem.AM); + component.imply("hour", 6); + break; + case "middag": + case "'s middags": + component.imply("meridiem", index_1.Meridiem.AM); + component.imply("hour", 12); + break; + } + return component; + } + }; + exports.default = NLCasualTimeParser; + } +}); + +// node_modules/chrono-node/dist/locales/nl/constants.js +var require_constants6 = __commonJS({ + "node_modules/chrono-node/dist/locales/nl/constants.js"(exports) { + "use strict"; + Object.defineProperty(exports, "__esModule", { value: true }); + exports.parseTimeUnits = exports.TIME_UNITS_PATTERN = exports.parseYear = exports.YEAR_PATTERN = exports.parseOrdinalNumberPattern = exports.ORDINAL_NUMBER_PATTERN = exports.parseNumberPattern = exports.NUMBER_PATTERN = exports.TIME_UNIT_DICTIONARY = exports.ORDINAL_WORD_DICTIONARY = exports.INTEGER_WORD_DICTIONARY = exports.MONTH_DICTIONARY = exports.WEEKDAY_DICTIONARY = void 0; + var pattern_1 = require_pattern(); + var years_1 = require_years(); + exports.WEEKDAY_DICTIONARY = { + zondag: 0, + zon: 0, + "zon.": 0, + zo: 0, + "zo.": 0, + maandag: 1, + ma: 1, + "ma.": 1, + dinsdag: 2, + din: 2, + "din.": 2, + di: 2, + "di.": 2, + woensdag: 3, + woe: 3, + "woe.": 3, + wo: 3, + "wo.": 3, + donderdag: 4, + dond: 4, + "dond.": 4, + do: 4, + "do.": 4, + vrijdag: 5, + vrij: 5, + "vrij.": 5, + vr: 5, + "vr.": 5, + zaterdag: 6, + zat: 6, + "zat.": 6, + "za": 6, + "za.": 6 + }; + exports.MONTH_DICTIONARY = { + januari: 1, + jan: 1, + "jan.": 1, + februari: 2, + feb: 2, + "feb.": 2, + maart: 3, + mar: 3, + "mar.": 3, + april: 4, + apr: 4, + "apr.": 4, + mei: 5, + juni: 6, + jun: 6, + "jun.": 6, + juli: 7, + jul: 7, + "jul.": 7, + augustus: 8, + aug: 8, + "aug.": 8, + september: 9, + sep: 9, + "sep.": 9, + sept: 9, + "sept.": 9, + oktober: 10, + okt: 10, + "okt.": 10, + november: 11, + nov: 11, + "nov.": 11, + december: 12, + dec: 12, + "dec.": 12 + }; + exports.INTEGER_WORD_DICTIONARY = { + een: 1, + twee: 2, + drie: 3, + vier: 4, + vijf: 5, + zes: 6, + zeven: 7, + acht: 8, + negen: 9, + tien: 10, + elf: 11, + twaalf: 12 + }; + exports.ORDINAL_WORD_DICTIONARY = { + eerste: 1, + tweede: 2, + derde: 3, + vierde: 4, + vijfde: 5, + zesde: 6, + zevende: 7, + achtste: 8, + negende: 9, + tiende: 10, + elfde: 11, + twaalfde: 12, + dertiende: 13, + veertiende: 14, + vijftiende: 15, + zestiende: 16, + zeventiende: 17, + achttiende: 18, + negentiende: 19, + twintigste: 20, + "eenentwintigste": 21, + "twee\xEBntwintigste": 22, + "drieentwintigste": 23, + "vierentwintigste": 24, + "vijfentwintigste": 25, + "zesentwintigste": 26, + "zevenentwintigste": 27, + "achtentwintig": 28, + "negenentwintig": 29, + "dertigste": 30, + "eenendertigste": 31 + }; + exports.TIME_UNIT_DICTIONARY = { + sec: "second", + second: "second", + seconden: "second", + min: "minute", + mins: "minute", + minute: "minute", + minuut: "minute", + minuten: "minute", + minuutje: "minute", + h: "hour", + hr: "hour", + hrs: "hour", + uur: "hour", + u: "hour", + uren: "hour", + dag: "d", + dagen: "d", + week: "week", + weken: "week", + maand: "month", + maanden: "month", + jaar: "year", + jr: "year", + jaren: "year" + }; + exports.NUMBER_PATTERN = `(?:${pattern_1.matchAnyPattern(exports.INTEGER_WORD_DICTIONARY)}|[0-9]+|[0-9]+[\\.,][0-9]+|halve?|half|paar)`; + function parseNumberPattern(match) { + const num = match.toLowerCase(); + if (exports.INTEGER_WORD_DICTIONARY[num] !== void 0) { + return exports.INTEGER_WORD_DICTIONARY[num]; + } else if (num === "paar") { + return 2; + } else if (num === "half" || num.match(/halve?/)) { + return 0.5; + } + return parseFloat(num.replace(",", ".")); + } + exports.parseNumberPattern = parseNumberPattern; + exports.ORDINAL_NUMBER_PATTERN = `(?:${pattern_1.matchAnyPattern(exports.ORDINAL_WORD_DICTIONARY)}|[0-9]{1,2}(?:ste|de)?)`; + function parseOrdinalNumberPattern(match) { + let num = match.toLowerCase(); + if (exports.ORDINAL_WORD_DICTIONARY[num] !== void 0) { + return exports.ORDINAL_WORD_DICTIONARY[num]; + } + num = num.replace(/(?:ste|de)$/i, ""); + return parseInt(num); + } + exports.parseOrdinalNumberPattern = parseOrdinalNumberPattern; + exports.YEAR_PATTERN = `(?:[1-9][0-9]{0,3}\\s*(?:voor Christus|na Christus)|[1-2][0-9]{3}|[5-9][0-9])`; + function parseYear(match) { + if (/voor Christus/i.test(match)) { + match = match.replace(/voor Christus/i, ""); + return -parseInt(match); + } + if (/na Christus/i.test(match)) { + match = match.replace(/na Christus/i, ""); + return parseInt(match); + } + const rawYearNumber = parseInt(match); + return years_1.findMostLikelyADYear(rawYearNumber); + } + exports.parseYear = parseYear; + var SINGLE_TIME_UNIT_PATTERN = `(${exports.NUMBER_PATTERN})\\s{0,5}(${pattern_1.matchAnyPattern(exports.TIME_UNIT_DICTIONARY)})\\s{0,5}`; + var SINGLE_TIME_UNIT_REGEX = new RegExp(SINGLE_TIME_UNIT_PATTERN, "i"); + exports.TIME_UNITS_PATTERN = pattern_1.repeatedTimeunitPattern(`(?:(?:binnen|in)\\s*)?`, SINGLE_TIME_UNIT_PATTERN); + function parseTimeUnits(timeunitText) { + const fragments = {}; + let remainingText = timeunitText; + let match = SINGLE_TIME_UNIT_REGEX.exec(remainingText); + while (match) { + collectDateTimeFragment(fragments, match); + remainingText = remainingText.substring(match[0].length); + match = SINGLE_TIME_UNIT_REGEX.exec(remainingText); + } + return fragments; + } + exports.parseTimeUnits = parseTimeUnits; + function collectDateTimeFragment(fragments, match) { + const num = parseNumberPattern(match[1]); + const unit = exports.TIME_UNIT_DICTIONARY[match[2].toLowerCase()]; + fragments[unit] = num; + } + } +}); + +// node_modules/chrono-node/dist/locales/nl/parsers/NLTimeUnitWithinFormatParser.js +var require_NLTimeUnitWithinFormatParser = __commonJS({ + "node_modules/chrono-node/dist/locales/nl/parsers/NLTimeUnitWithinFormatParser.js"(exports) { + "use strict"; + Object.defineProperty(exports, "__esModule", { value: true }); + var constants_1 = require_constants6(); + var results_1 = require_results(); + var AbstractParserWithWordBoundary_1 = require_AbstractParserWithWordBoundary(); + var NLTimeUnitWithinFormatParser = class extends AbstractParserWithWordBoundary_1.AbstractParserWithWordBoundaryChecking { + innerPattern() { + return new RegExp(`(?:binnen|in|binnen de|voor)\\s*(` + constants_1.TIME_UNITS_PATTERN + `)(?=\\W|$)`, "i"); + } + innerExtract(context, match) { + const timeUnits = constants_1.parseTimeUnits(match[1]); + return results_1.ParsingComponents.createRelativeFromReference(context.reference, timeUnits); + } + }; + exports.default = NLTimeUnitWithinFormatParser; + } +}); + +// node_modules/chrono-node/dist/locales/nl/parsers/NLWeekdayParser.js +var require_NLWeekdayParser = __commonJS({ + "node_modules/chrono-node/dist/locales/nl/parsers/NLWeekdayParser.js"(exports) { + "use strict"; + Object.defineProperty(exports, "__esModule", { value: true }); + var constants_1 = require_constants6(); + var pattern_1 = require_pattern(); + var AbstractParserWithWordBoundary_1 = require_AbstractParserWithWordBoundary(); + var weeks_1 = require_weeks(); + var PATTERN = new RegExp(`(?:(?:\\,|\\(|\\\uFF08)\\s*)?(?:op\\s*?)?(?:(deze|vorige|volgende)\\s*(?:week\\s*)?)?(${pattern_1.matchAnyPattern(constants_1.WEEKDAY_DICTIONARY)})(?=\\W|$)`, "i"); + var PREFIX_GROUP = 1; + var WEEKDAY_GROUP = 2; + var POSTFIX_GROUP = 3; + var NLWeekdayParser = class extends AbstractParserWithWordBoundary_1.AbstractParserWithWordBoundaryChecking { + innerPattern() { + return PATTERN; + } + innerExtract(context, match) { + const dayOfWeek = match[WEEKDAY_GROUP].toLowerCase(); + const offset2 = constants_1.WEEKDAY_DICTIONARY[dayOfWeek]; + const prefix = match[PREFIX_GROUP]; + const postfix = match[POSTFIX_GROUP]; + let modifierWord = prefix || postfix; + modifierWord = modifierWord || ""; + modifierWord = modifierWord.toLowerCase(); + let modifier = null; + if (modifierWord == "vorige") { + modifier = "last"; + } else if (modifierWord == "volgende") { + modifier = "next"; + } else if (modifierWord == "deze") { + modifier = "this"; + } + const date = weeks_1.toDayJSWeekday(context.refDate, offset2, modifier); + return context.createParsingComponents().assign("weekday", offset2).imply("day", date.date()).imply("month", date.month() + 1).imply("year", date.year()); + } + }; + exports.default = NLWeekdayParser; + } +}); + +// node_modules/chrono-node/dist/locales/nl/parsers/NLMonthNameMiddleEndianParser.js +var require_NLMonthNameMiddleEndianParser = __commonJS({ + "node_modules/chrono-node/dist/locales/nl/parsers/NLMonthNameMiddleEndianParser.js"(exports) { + "use strict"; + Object.defineProperty(exports, "__esModule", { value: true }); + var years_1 = require_years(); + var constants_1 = require_constants6(); + var constants_2 = require_constants6(); + var constants_3 = require_constants6(); + var pattern_1 = require_pattern(); + var AbstractParserWithWordBoundary_1 = require_AbstractParserWithWordBoundary(); + var PATTERN = new RegExp(`(?:on\\s*?)?(${constants_2.ORDINAL_NUMBER_PATTERN})(?:\\s*(?:tot|\\-|\\\u2013|until|through|till|\\s)\\s*(${constants_2.ORDINAL_NUMBER_PATTERN}))?(?:-|/|\\s*(?:of)?\\s*)(` + pattern_1.matchAnyPattern(constants_1.MONTH_DICTIONARY) + `)(?:(?:-|/|,?\\s*)(${constants_3.YEAR_PATTERN}(?![^\\s]\\d)))?(?=\\W|$)`, "i"); + var MONTH_NAME_GROUP = 3; + var DATE_GROUP = 1; + var DATE_TO_GROUP = 2; + var YEAR_GROUP = 4; + var NLMonthNameMiddleEndianParser = class extends AbstractParserWithWordBoundary_1.AbstractParserWithWordBoundaryChecking { + innerPattern() { + return PATTERN; + } + innerExtract(context, match) { + const month = constants_1.MONTH_DICTIONARY[match[MONTH_NAME_GROUP].toLowerCase()]; + const day = constants_2.parseOrdinalNumberPattern(match[DATE_GROUP]); + if (day > 31) { + match.index = match.index + match[DATE_GROUP].length; + return null; + } + const components = context.createParsingComponents({ + day, + month + }); + if (match[YEAR_GROUP]) { + const year = constants_3.parseYear(match[YEAR_GROUP]); + components.assign("year", year); + } else { + const year = years_1.findYearClosestToRef(context.refDate, day, month); + components.imply("year", year); + } + if (!match[DATE_TO_GROUP]) { + return components; + } + const endDate = constants_2.parseOrdinalNumberPattern(match[DATE_TO_GROUP]); + const result = context.createParsingResult(match.index, match[0]); + result.start = components; + result.end = components.clone(); + result.end.assign("day", endDate); + return result; + } + }; + exports.default = NLMonthNameMiddleEndianParser; + } +}); + +// node_modules/chrono-node/dist/locales/nl/parsers/NLMonthNameParser.js +var require_NLMonthNameParser = __commonJS({ + "node_modules/chrono-node/dist/locales/nl/parsers/NLMonthNameParser.js"(exports) { + "use strict"; + Object.defineProperty(exports, "__esModule", { value: true }); + var constants_1 = require_constants6(); + var years_1 = require_years(); + var pattern_1 = require_pattern(); + var constants_2 = require_constants6(); + var AbstractParserWithWordBoundary_1 = require_AbstractParserWithWordBoundary(); + var PATTERN = new RegExp(`(${pattern_1.matchAnyPattern(constants_1.MONTH_DICTIONARY)})\\s*(?:[,-]?\\s*(${constants_2.YEAR_PATTERN})?)?(?=[^\\s\\w]|\\s+[^0-9]|\\s+$|$)`, "i"); + var MONTH_NAME_GROUP = 1; + var YEAR_GROUP = 2; + var NLMonthNameParser = class extends AbstractParserWithWordBoundary_1.AbstractParserWithWordBoundaryChecking { + innerPattern() { + return PATTERN; + } + innerExtract(context, match) { + const components = context.createParsingComponents(); + components.imply("day", 1); + const monthName = match[MONTH_NAME_GROUP]; + const month = constants_1.MONTH_DICTIONARY[monthName.toLowerCase()]; + components.assign("month", month); + if (match[YEAR_GROUP]) { + const year = constants_2.parseYear(match[YEAR_GROUP]); + components.assign("year", year); + } else { + const year = years_1.findYearClosestToRef(context.refDate, 1, month); + components.imply("year", year); + } + return components; + } + }; + exports.default = NLMonthNameParser; + } +}); + +// node_modules/chrono-node/dist/locales/nl/parsers/NLSlashMonthFormatParser.js +var require_NLSlashMonthFormatParser = __commonJS({ + "node_modules/chrono-node/dist/locales/nl/parsers/NLSlashMonthFormatParser.js"(exports) { + "use strict"; + Object.defineProperty(exports, "__esModule", { value: true }); + var AbstractParserWithWordBoundary_1 = require_AbstractParserWithWordBoundary(); + var PATTERN = new RegExp("([0-9]|0[1-9]|1[012])/([0-9]{4})", "i"); + var MONTH_GROUP = 1; + var YEAR_GROUP = 2; + var NLSlashMonthFormatParser = class extends AbstractParserWithWordBoundary_1.AbstractParserWithWordBoundaryChecking { + innerPattern() { + return PATTERN; + } + innerExtract(context, match) { + const year = parseInt(match[YEAR_GROUP]); + const month = parseInt(match[MONTH_GROUP]); + return context.createParsingComponents().imply("day", 1).assign("month", month).assign("year", year); + } + }; + exports.default = NLSlashMonthFormatParser; + } +}); + +// node_modules/chrono-node/dist/locales/nl/parsers/NLTimeExpressionParser.js +var require_NLTimeExpressionParser = __commonJS({ + "node_modules/chrono-node/dist/locales/nl/parsers/NLTimeExpressionParser.js"(exports) { + "use strict"; + Object.defineProperty(exports, "__esModule", { value: true }); + var AbstractTimeExpressionParser_1 = require_AbstractTimeExpressionParser(); + var NLTimeExpressionParser = class extends AbstractTimeExpressionParser_1.AbstractTimeExpressionParser { + primaryPrefix() { + return "(?:(?:om)\\s*)?"; + } + followingPhase() { + return "\\s*(?:\\-|\\\u2013|\\~|\\\u301C|om|\\?)\\s*"; + } + primarySuffix() { + return "(?:\\s*(?:uur))?(?!/)(?=\\W|$)"; + } + extractPrimaryTimeComponents(context, match) { + if (match[0].match(/^\s*\d{4}\s*$/)) { + return null; + } + return super.extractPrimaryTimeComponents(context, match); + } + }; + exports.default = NLTimeExpressionParser; + } +}); + +// node_modules/chrono-node/dist/locales/nl/parsers/NLCasualYearMonthDayParser.js +var require_NLCasualYearMonthDayParser = __commonJS({ + "node_modules/chrono-node/dist/locales/nl/parsers/NLCasualYearMonthDayParser.js"(exports) { + "use strict"; + Object.defineProperty(exports, "__esModule", { value: true }); + var constants_1 = require_constants6(); + var pattern_1 = require_pattern(); + var AbstractParserWithWordBoundary_1 = require_AbstractParserWithWordBoundary(); + var PATTERN = new RegExp(`([0-9]{4})[\\.\\/\\s](?:(${pattern_1.matchAnyPattern(constants_1.MONTH_DICTIONARY)})|([0-9]{1,2}))[\\.\\/\\s]([0-9]{1,2})(?=\\W|$)`, "i"); + var YEAR_NUMBER_GROUP = 1; + var MONTH_NAME_GROUP = 2; + var MONTH_NUMBER_GROUP = 3; + var DATE_NUMBER_GROUP = 4; + var NLCasualYearMonthDayParser = class extends AbstractParserWithWordBoundary_1.AbstractParserWithWordBoundaryChecking { + innerPattern() { + return PATTERN; + } + innerExtract(context, match) { + const month = match[MONTH_NUMBER_GROUP] ? parseInt(match[MONTH_NUMBER_GROUP]) : constants_1.MONTH_DICTIONARY[match[MONTH_NAME_GROUP].toLowerCase()]; + if (month < 1 || month > 12) { + return null; + } + const year = parseInt(match[YEAR_NUMBER_GROUP]); + const day = parseInt(match[DATE_NUMBER_GROUP]); + return { + day, + month, + year + }; + } + }; + exports.default = NLCasualYearMonthDayParser; + } +}); + +// node_modules/chrono-node/dist/locales/nl/parsers/NLCasualDateTimeParser.js +var require_NLCasualDateTimeParser = __commonJS({ + "node_modules/chrono-node/dist/locales/nl/parsers/NLCasualDateTimeParser.js"(exports) { + "use strict"; + var __importDefault = exports && exports.__importDefault || function(mod) { + return mod && mod.__esModule ? mod : { "default": mod }; + }; + Object.defineProperty(exports, "__esModule", { value: true }); + var AbstractParserWithWordBoundary_1 = require_AbstractParserWithWordBoundary(); + var index_1 = require_dist(); + var dayjs_1 = require_dayjs(); + var dayjs_2 = __importDefault(require_dayjs_min()); + var DATE_GROUP = 1; + var TIME_OF_DAY_GROUP = 2; + var NLCasualDateTimeParser = class extends AbstractParserWithWordBoundary_1.AbstractParserWithWordBoundaryChecking { + innerPattern(context) { + return /(gisteren|morgen|van)(ochtend|middag|namiddag|avond|nacht)(?=\W|$)/i; + } + innerExtract(context, match) { + const dateText = match[DATE_GROUP].toLowerCase(); + const timeText = match[TIME_OF_DAY_GROUP].toLowerCase(); + const component = context.createParsingComponents(); + const targetDate = dayjs_2.default(context.refDate); + switch (dateText) { + case "gisteren": + dayjs_1.assignSimilarDate(component, targetDate.add(-1, "day")); + break; + case "van": + dayjs_1.assignSimilarDate(component, targetDate); + break; + case "morgen": + dayjs_1.assignTheNextDay(component, targetDate); + break; + } + switch (timeText) { + case "ochtend": + component.imply("meridiem", index_1.Meridiem.AM); + component.imply("hour", 6); + break; + case "middag": + component.imply("meridiem", index_1.Meridiem.AM); + component.imply("hour", 12); + break; + case "namiddag": + component.imply("meridiem", index_1.Meridiem.PM); + component.imply("hour", 15); + break; + case "avond": + component.imply("meridiem", index_1.Meridiem.PM); + component.imply("hour", 20); + break; + } + return component; + } + }; + exports.default = NLCasualDateTimeParser; + } +}); + +// node_modules/chrono-node/dist/locales/nl/parsers/NLTimeUnitCasualRelativeFormatParser.js +var require_NLTimeUnitCasualRelativeFormatParser = __commonJS({ + "node_modules/chrono-node/dist/locales/nl/parsers/NLTimeUnitCasualRelativeFormatParser.js"(exports) { + "use strict"; + Object.defineProperty(exports, "__esModule", { value: true }); + var constants_1 = require_constants6(); + var results_1 = require_results(); + var AbstractParserWithWordBoundary_1 = require_AbstractParserWithWordBoundary(); + var timeunits_1 = require_timeunits(); + var PATTERN = new RegExp(`(deze|vorige|afgelopen|komende|over|\\+|-)\\s*(${constants_1.TIME_UNITS_PATTERN})(?=\\W|$)`, "i"); + var NLTimeUnitCasualRelativeFormatParser = class extends AbstractParserWithWordBoundary_1.AbstractParserWithWordBoundaryChecking { + innerPattern() { + return PATTERN; + } + innerExtract(context, match) { + const prefix = match[1].toLowerCase(); + let timeUnits = constants_1.parseTimeUnits(match[2]); + switch (prefix) { + case "vorige": + case "afgelopen": + case "-": + timeUnits = timeunits_1.reverseTimeUnits(timeUnits); + break; + } + return results_1.ParsingComponents.createRelativeFromReference(context.reference, timeUnits); + } + }; + exports.default = NLTimeUnitCasualRelativeFormatParser; + } +}); + +// node_modules/chrono-node/dist/locales/nl/parsers/NLRelativeDateFormatParser.js +var require_NLRelativeDateFormatParser = __commonJS({ + "node_modules/chrono-node/dist/locales/nl/parsers/NLRelativeDateFormatParser.js"(exports) { + "use strict"; + var __importDefault = exports && exports.__importDefault || function(mod) { + return mod && mod.__esModule ? mod : { "default": mod }; + }; + Object.defineProperty(exports, "__esModule", { value: true }); + var constants_1 = require_constants6(); + var results_1 = require_results(); + var dayjs_1 = __importDefault(require_dayjs_min()); + var AbstractParserWithWordBoundary_1 = require_AbstractParserWithWordBoundary(); + var pattern_1 = require_pattern(); + var PATTERN = new RegExp(`(dit|deze|komende|volgend|volgende|afgelopen|vorige)\\s*(${pattern_1.matchAnyPattern(constants_1.TIME_UNIT_DICTIONARY)})(?=\\s*)(?=\\W|$)`, "i"); + var MODIFIER_WORD_GROUP = 1; + var RELATIVE_WORD_GROUP = 2; + var NLRelativeDateFormatParser = class extends AbstractParserWithWordBoundary_1.AbstractParserWithWordBoundaryChecking { + innerPattern() { + return PATTERN; + } + innerExtract(context, match) { + const modifier = match[MODIFIER_WORD_GROUP].toLowerCase(); + const unitWord = match[RELATIVE_WORD_GROUP].toLowerCase(); + const timeunit = constants_1.TIME_UNIT_DICTIONARY[unitWord]; + if (modifier == "volgend" || modifier == "volgende" || modifier == "komende") { + const timeUnits = {}; + timeUnits[timeunit] = 1; + return results_1.ParsingComponents.createRelativeFromReference(context.reference, timeUnits); + } + if (modifier == "afgelopen" || modifier == "vorige") { + const timeUnits = {}; + timeUnits[timeunit] = -1; + return results_1.ParsingComponents.createRelativeFromReference(context.reference, timeUnits); + } + const components = context.createParsingComponents(); + let date = dayjs_1.default(context.reference.instant); + if (unitWord.match(/week/i)) { + date = date.add(-date.get("d"), "d"); + components.imply("day", date.date()); + components.imply("month", date.month() + 1); + components.imply("year", date.year()); + } else if (unitWord.match(/maand/i)) { + date = date.add(-date.date() + 1, "d"); + components.imply("day", date.date()); + components.assign("year", date.year()); + components.assign("month", date.month() + 1); + } else if (unitWord.match(/jaar/i)) { + date = date.add(-date.date() + 1, "d"); + date = date.add(-date.month(), "month"); + components.imply("day", date.date()); + components.imply("month", date.month() + 1); + components.assign("year", date.year()); + } + return components; + } + }; + exports.default = NLRelativeDateFormatParser; + } +}); + +// node_modules/chrono-node/dist/locales/nl/parsers/NLTimeUnitAgoFormatParser.js +var require_NLTimeUnitAgoFormatParser = __commonJS({ + "node_modules/chrono-node/dist/locales/nl/parsers/NLTimeUnitAgoFormatParser.js"(exports) { + "use strict"; + Object.defineProperty(exports, "__esModule", { value: true }); + var constants_1 = require_constants6(); + var results_1 = require_results(); + var AbstractParserWithWordBoundary_1 = require_AbstractParserWithWordBoundary(); + var timeunits_1 = require_timeunits(); + var PATTERN = new RegExp("(" + constants_1.TIME_UNITS_PATTERN + ")(?:geleden|voor|eerder)(?=(?:\\W|$))", "i"); + var STRICT_PATTERN = new RegExp("(" + constants_1.TIME_UNITS_PATTERN + ")geleden(?=(?:\\W|$))", "i"); + var NLTimeUnitAgoFormatParser = class extends AbstractParserWithWordBoundary_1.AbstractParserWithWordBoundaryChecking { + constructor(strictMode) { + super(); + this.strictMode = strictMode; + } + innerPattern() { + return this.strictMode ? STRICT_PATTERN : PATTERN; + } + innerExtract(context, match) { + const timeUnits = constants_1.parseTimeUnits(match[1]); + const outputTimeUnits = timeunits_1.reverseTimeUnits(timeUnits); + return results_1.ParsingComponents.createRelativeFromReference(context.reference, outputTimeUnits); + } + }; + exports.default = NLTimeUnitAgoFormatParser; + } +}); + +// node_modules/chrono-node/dist/locales/nl/parsers/NLTimeUnitLaterFormatParser.js +var require_NLTimeUnitLaterFormatParser = __commonJS({ + "node_modules/chrono-node/dist/locales/nl/parsers/NLTimeUnitLaterFormatParser.js"(exports) { + "use strict"; + Object.defineProperty(exports, "__esModule", { value: true }); + var constants_1 = require_constants6(); + var results_1 = require_results(); + var AbstractParserWithWordBoundary_1 = require_AbstractParserWithWordBoundary(); + var PATTERN = new RegExp("(" + constants_1.TIME_UNITS_PATTERN + ")(later|na|vanaf nu|voortaan|vooruit|uit)(?=(?:\\W|$))", "i"); + var STRICT_PATTERN = new RegExp("(" + constants_1.TIME_UNITS_PATTERN + ")(later|vanaf nu)(?=(?:\\W|$))", "i"); + var GROUP_NUM_TIMEUNITS = 1; + var NLTimeUnitLaterFormatParser = class extends AbstractParserWithWordBoundary_1.AbstractParserWithWordBoundaryChecking { + constructor(strictMode) { + super(); + this.strictMode = strictMode; + } + innerPattern() { + return this.strictMode ? STRICT_PATTERN : PATTERN; + } + innerExtract(context, match) { + const fragments = constants_1.parseTimeUnits(match[GROUP_NUM_TIMEUNITS]); + return results_1.ParsingComponents.createRelativeFromReference(context.reference, fragments); + } + }; + exports.default = NLTimeUnitLaterFormatParser; + } +}); + +// node_modules/chrono-node/dist/locales/nl/index.js +var require_nl = __commonJS({ + "node_modules/chrono-node/dist/locales/nl/index.js"(exports) { + "use strict"; + var __importDefault = exports && exports.__importDefault || function(mod) { + return mod && mod.__esModule ? mod : { "default": mod }; + }; + Object.defineProperty(exports, "__esModule", { value: true }); + exports.createConfiguration = exports.createCasualConfiguration = exports.parseDate = exports.parse = exports.strict = exports.casual = void 0; + var configurations_1 = require_configurations(); + var chrono_1 = require_chrono(); + var NLMergeDateRangeRefiner_1 = __importDefault(require_NLMergeDateRangeRefiner()); + var NLMergeDateTimeRefiner_1 = __importDefault(require_NLMergeDateTimeRefiner()); + var NLCasualDateParser_1 = __importDefault(require_NLCasualDateParser()); + var NLCasualTimeParser_1 = __importDefault(require_NLCasualTimeParser()); + var SlashDateFormatParser_1 = __importDefault(require_SlashDateFormatParser()); + var NLTimeUnitWithinFormatParser_1 = __importDefault(require_NLTimeUnitWithinFormatParser()); + var NLWeekdayParser_1 = __importDefault(require_NLWeekdayParser()); + var NLMonthNameMiddleEndianParser_1 = __importDefault(require_NLMonthNameMiddleEndianParser()); + var NLMonthNameParser_1 = __importDefault(require_NLMonthNameParser()); + var NLSlashMonthFormatParser_1 = __importDefault(require_NLSlashMonthFormatParser()); + var NLTimeExpressionParser_1 = __importDefault(require_NLTimeExpressionParser()); + var NLCasualYearMonthDayParser_1 = __importDefault(require_NLCasualYearMonthDayParser()); + var NLCasualDateTimeParser_1 = __importDefault(require_NLCasualDateTimeParser()); + var NLTimeUnitCasualRelativeFormatParser_1 = __importDefault(require_NLTimeUnitCasualRelativeFormatParser()); + var NLRelativeDateFormatParser_1 = __importDefault(require_NLRelativeDateFormatParser()); + var NLTimeUnitAgoFormatParser_1 = __importDefault(require_NLTimeUnitAgoFormatParser()); + var NLTimeUnitLaterFormatParser_1 = __importDefault(require_NLTimeUnitLaterFormatParser()); + exports.casual = new chrono_1.Chrono(createCasualConfiguration()); + exports.strict = new chrono_1.Chrono(createConfiguration(true)); + function parse4(text2, ref, option) { + return exports.casual.parse(text2, ref, option); + } + exports.parse = parse4; + function parseDate3(text2, ref, option) { + return exports.casual.parseDate(text2, ref, option); + } + exports.parseDate = parseDate3; + function createCasualConfiguration(littleEndian = true) { + const option = createConfiguration(false, littleEndian); + option.parsers.unshift(new NLCasualDateParser_1.default()); + option.parsers.unshift(new NLCasualTimeParser_1.default()); + option.parsers.unshift(new NLCasualDateTimeParser_1.default()); + option.parsers.unshift(new NLMonthNameParser_1.default()); + option.parsers.unshift(new NLRelativeDateFormatParser_1.default()); + option.parsers.unshift(new NLTimeUnitCasualRelativeFormatParser_1.default()); + return option; + } + exports.createCasualConfiguration = createCasualConfiguration; + function createConfiguration(strictMode = true, littleEndian = true) { + return configurations_1.includeCommonConfiguration({ + parsers: [ + new SlashDateFormatParser_1.default(littleEndian), + new NLTimeUnitWithinFormatParser_1.default(), + new NLMonthNameMiddleEndianParser_1.default(), + new NLMonthNameParser_1.default(), + new NLWeekdayParser_1.default(), + new NLCasualYearMonthDayParser_1.default(), + new NLSlashMonthFormatParser_1.default(), + new NLTimeExpressionParser_1.default(strictMode), + new NLTimeUnitAgoFormatParser_1.default(strictMode), + new NLTimeUnitLaterFormatParser_1.default(strictMode) + ], + refiners: [new NLMergeDateTimeRefiner_1.default(), new NLMergeDateRangeRefiner_1.default()] + }, strictMode); + } + exports.createConfiguration = createConfiguration; + } +}); + +// node_modules/chrono-node/dist/locales/zh/hant/parsers/ZHHantCasualDateParser.js +var require_ZHHantCasualDateParser = __commonJS({ + "node_modules/chrono-node/dist/locales/zh/hant/parsers/ZHHantCasualDateParser.js"(exports) { + "use strict"; + var __importDefault = exports && exports.__importDefault || function(mod) { + return mod && mod.__esModule ? mod : { "default": mod }; + }; + Object.defineProperty(exports, "__esModule", { value: true }); + var dayjs_1 = __importDefault(require_dayjs_min()); + var AbstractParserWithWordBoundary_1 = require_AbstractParserWithWordBoundary(); + var NOW_GROUP = 1; + var DAY_GROUP_1 = 2; + var TIME_GROUP_1 = 3; + var TIME_GROUP_2 = 4; + var DAY_GROUP_3 = 5; + var TIME_GROUP_3 = 6; + var ZHHantCasualDateParser = class extends AbstractParserWithWordBoundary_1.AbstractParserWithWordBoundaryChecking { + innerPattern(context) { + return new RegExp("(\u800C\u5BB6|\u7ACB(?:\u523B|\u5373)|\u5373\u523B)|(\u4ECA|\u660E|\u524D|\u5927\u524D|\u5F8C|\u5927\u5F8C|\u807D|\u6628|\u5C0B|\u7434)(\u65E9|\u671D|\u665A)|(\u4E0A(?:\u5348|\u665D)|\u671D(?:\u65E9)|\u65E9(?:\u4E0A)|\u4E0B(?:\u5348|\u665D)|\u664F(?:\u665D)|\u665A(?:\u4E0A)|\u591C(?:\u665A)?|\u4E2D(?:\u5348)|\u51CC(?:\u6668))|(\u4ECA|\u660E|\u524D|\u5927\u524D|\u5F8C|\u5927\u5F8C|\u807D|\u6628|\u5C0B|\u7434)(?:\u65E5|\u5929)(?:[\\s|,|\uFF0C]*)(?:(\u4E0A(?:\u5348|\u665D)|\u671D(?:\u65E9)|\u65E9(?:\u4E0A)|\u4E0B(?:\u5348|\u665D)|\u664F(?:\u665D)|\u665A(?:\u4E0A)|\u591C(?:\u665A)?|\u4E2D(?:\u5348)|\u51CC(?:\u6668)))?", "i"); + } + innerExtract(context, match) { + const index = match.index; + const result = context.createParsingResult(index, match[0]); + const refMoment = dayjs_1.default(context.refDate); + let startMoment = refMoment; + if (match[NOW_GROUP]) { + result.start.imply("hour", refMoment.hour()); + result.start.imply("minute", refMoment.minute()); + result.start.imply("second", refMoment.second()); + result.start.imply("millisecond", refMoment.millisecond()); + } else if (match[DAY_GROUP_1]) { + const day1 = match[DAY_GROUP_1]; + const time1 = match[TIME_GROUP_1]; + if (day1 == "\u660E" || day1 == "\u807D") { + if (refMoment.hour() > 1) { + startMoment = startMoment.add(1, "day"); + } + } else if (day1 == "\u6628" || day1 == "\u5C0B" || day1 == "\u7434") { + startMoment = startMoment.add(-1, "day"); + } else if (day1 == "\u524D") { + startMoment = startMoment.add(-2, "day"); + } else if (day1 == "\u5927\u524D") { + startMoment = startMoment.add(-3, "day"); + } else if (day1 == "\u5F8C") { + startMoment = startMoment.add(2, "day"); + } else if (day1 == "\u5927\u5F8C") { + startMoment = startMoment.add(3, "day"); + } + if (time1 == "\u65E9" || time1 == "\u671D") { + result.start.imply("hour", 6); + } else if (time1 == "\u665A") { + result.start.imply("hour", 22); + result.start.imply("meridiem", 1); + } + } else if (match[TIME_GROUP_2]) { + const timeString2 = match[TIME_GROUP_2]; + const time2 = timeString2[0]; + if (time2 == "\u65E9" || time2 == "\u671D" || time2 == "\u4E0A") { + result.start.imply("hour", 6); + } else if (time2 == "\u4E0B" || time2 == "\u664F") { + result.start.imply("hour", 15); + result.start.imply("meridiem", 1); + } else if (time2 == "\u4E2D") { + result.start.imply("hour", 12); + result.start.imply("meridiem", 1); + } else if (time2 == "\u591C" || time2 == "\u665A") { + result.start.imply("hour", 22); + result.start.imply("meridiem", 1); + } else if (time2 == "\u51CC") { + result.start.imply("hour", 0); + } + } else if (match[DAY_GROUP_3]) { + const day3 = match[DAY_GROUP_3]; + if (day3 == "\u660E" || day3 == "\u807D") { + if (refMoment.hour() > 1) { + startMoment = startMoment.add(1, "day"); + } + } else if (day3 == "\u6628" || day3 == "\u5C0B" || day3 == "\u7434") { + startMoment = startMoment.add(-1, "day"); + } else if (day3 == "\u524D") { + startMoment = startMoment.add(-2, "day"); + } else if (day3 == "\u5927\u524D") { + startMoment = startMoment.add(-3, "day"); + } else if (day3 == "\u5F8C") { + startMoment = startMoment.add(2, "day"); + } else if (day3 == "\u5927\u5F8C") { + startMoment = startMoment.add(3, "day"); + } + const timeString3 = match[TIME_GROUP_3]; + if (timeString3) { + const time3 = timeString3[0]; + if (time3 == "\u65E9" || time3 == "\u671D" || time3 == "\u4E0A") { + result.start.imply("hour", 6); + } else if (time3 == "\u4E0B" || time3 == "\u664F") { + result.start.imply("hour", 15); + result.start.imply("meridiem", 1); + } else if (time3 == "\u4E2D") { + result.start.imply("hour", 12); + result.start.imply("meridiem", 1); + } else if (time3 == "\u591C" || time3 == "\u665A") { + result.start.imply("hour", 22); + result.start.imply("meridiem", 1); + } else if (time3 == "\u51CC") { + result.start.imply("hour", 0); + } + } + } + result.start.assign("day", startMoment.date()); + result.start.assign("month", startMoment.month() + 1); + result.start.assign("year", startMoment.year()); + return result; + } + }; + exports.default = ZHHantCasualDateParser; + } +}); + +// node_modules/chrono-node/dist/locales/zh/hant/constants.js +var require_constants7 = __commonJS({ + "node_modules/chrono-node/dist/locales/zh/hant/constants.js"(exports) { + "use strict"; + Object.defineProperty(exports, "__esModule", { value: true }); + exports.zhStringToYear = exports.zhStringToNumber = exports.WEEKDAY_OFFSET = exports.NUMBER = void 0; + exports.NUMBER = { + "\u96F6": 0, + "\u4E00": 1, + "\u4E8C": 2, + "\u5169": 2, + "\u4E09": 3, + "\u56DB": 4, + "\u4E94": 5, + "\u516D": 6, + "\u4E03": 7, + "\u516B": 8, + "\u4E5D": 9, + "\u5341": 10, + "\u5EFF": 20, + "\u5345": 30 + }; + exports.WEEKDAY_OFFSET = { + "\u5929": 0, + "\u65E5": 0, + "\u4E00": 1, + "\u4E8C": 2, + "\u4E09": 3, + "\u56DB": 4, + "\u4E94": 5, + "\u516D": 6 + }; + function zhStringToNumber(text2) { + let number = 0; + for (let i = 0; i < text2.length; i++) { + const char = text2[i]; + if (char === "\u5341") { + number = number === 0 ? exports.NUMBER[char] : number * exports.NUMBER[char]; + } else { + number += exports.NUMBER[char]; + } + } + return number; + } + exports.zhStringToNumber = zhStringToNumber; + function zhStringToYear(text2) { + let string = ""; + for (let i = 0; i < text2.length; i++) { + const char = text2[i]; + string = string + exports.NUMBER[char]; + } + return parseInt(string); + } + exports.zhStringToYear = zhStringToYear; + } +}); + +// node_modules/chrono-node/dist/locales/zh/hant/parsers/ZHHantDateParser.js +var require_ZHHantDateParser = __commonJS({ + "node_modules/chrono-node/dist/locales/zh/hant/parsers/ZHHantDateParser.js"(exports) { + "use strict"; + var __importDefault = exports && exports.__importDefault || function(mod) { + return mod && mod.__esModule ? mod : { "default": mod }; + }; + Object.defineProperty(exports, "__esModule", { value: true }); + var dayjs_1 = __importDefault(require_dayjs_min()); + var AbstractParserWithWordBoundary_1 = require_AbstractParserWithWordBoundary(); + var constants_1 = require_constants7(); + var YEAR_GROUP = 1; + var MONTH_GROUP = 2; + var DAY_GROUP = 3; + var ZHHantDateParser = class extends AbstractParserWithWordBoundary_1.AbstractParserWithWordBoundaryChecking { + innerPattern() { + return new RegExp("(\\d{2,4}|[" + Object.keys(constants_1.NUMBER).join("") + "]{4}|[" + Object.keys(constants_1.NUMBER).join("") + "]{2})?(?:\\s*)(?:\u5E74)?(?:[\\s|,|\uFF0C]*)(\\d{1,2}|[" + Object.keys(constants_1.NUMBER).join("") + "]{1,2})(?:\\s*)(?:\u6708)(?:\\s*)(\\d{1,2}|[" + Object.keys(constants_1.NUMBER).join("") + "]{1,2})?(?:\\s*)(?:\u65E5|\u865F)?"); + } + innerExtract(context, match) { + const startMoment = dayjs_1.default(context.refDate); + const result = context.createParsingResult(match.index, match[0]); + let month = parseInt(match[MONTH_GROUP]); + if (isNaN(month)) + month = constants_1.zhStringToNumber(match[MONTH_GROUP]); + result.start.assign("month", month); + if (match[DAY_GROUP]) { + let day = parseInt(match[DAY_GROUP]); + if (isNaN(day)) + day = constants_1.zhStringToNumber(match[DAY_GROUP]); + result.start.assign("day", day); + } else { + result.start.imply("day", startMoment.date()); + } + if (match[YEAR_GROUP]) { + let year = parseInt(match[YEAR_GROUP]); + if (isNaN(year)) + year = constants_1.zhStringToYear(match[YEAR_GROUP]); + result.start.assign("year", year); + } else { + result.start.imply("year", startMoment.year()); + } + return result; + } + }; + exports.default = ZHHantDateParser; + } +}); + +// node_modules/chrono-node/dist/locales/zh/hant/parsers/ZHHantDeadlineFormatParser.js +var require_ZHHantDeadlineFormatParser = __commonJS({ + "node_modules/chrono-node/dist/locales/zh/hant/parsers/ZHHantDeadlineFormatParser.js"(exports) { + "use strict"; + var __importDefault = exports && exports.__importDefault || function(mod) { + return mod && mod.__esModule ? mod : { "default": mod }; + }; + Object.defineProperty(exports, "__esModule", { value: true }); + var dayjs_1 = __importDefault(require_dayjs_min()); + var AbstractParserWithWordBoundary_1 = require_AbstractParserWithWordBoundary(); + var constants_1 = require_constants7(); + var PATTERN = new RegExp("(\\d+|[" + Object.keys(constants_1.NUMBER).join("") + "]+|\u534A|\u5E7E)(?:\\s*)(?:\u500B)?(\u79D2(?:\u9418)?|\u5206\u9418|\u5C0F\u6642|\u9418|\u65E5|\u5929|\u661F\u671F|\u79AE\u62DC|\u6708|\u5E74)(?:(?:\u4E4B|\u904E)?\u5F8C|(?:\u4E4B)?\u5167)", "i"); + var NUMBER_GROUP = 1; + var UNIT_GROUP = 2; + var ZHHantDeadlineFormatParser = class extends AbstractParserWithWordBoundary_1.AbstractParserWithWordBoundaryChecking { + innerPattern() { + return PATTERN; + } + innerExtract(context, match) { + const result = context.createParsingResult(match.index, match[0]); + let number = parseInt(match[NUMBER_GROUP]); + if (isNaN(number)) { + number = constants_1.zhStringToNumber(match[NUMBER_GROUP]); + } + if (isNaN(number)) { + const string = match[NUMBER_GROUP]; + if (string === "\u5E7E") { + number = 3; + } else if (string === "\u534A") { + number = 0.5; + } else { + return null; + } + } + let date = dayjs_1.default(context.refDate); + const unit = match[UNIT_GROUP]; + const unitAbbr = unit[0]; + if (unitAbbr.match(/[日天星禮月年]/)) { + if (unitAbbr == "\u65E5" || unitAbbr == "\u5929") { + date = date.add(number, "d"); + } else if (unitAbbr == "\u661F" || unitAbbr == "\u79AE") { + date = date.add(number * 7, "d"); + } else if (unitAbbr == "\u6708") { + date = date.add(number, "month"); + } else if (unitAbbr == "\u5E74") { + date = date.add(number, "year"); + } + result.start.assign("year", date.year()); + result.start.assign("month", date.month() + 1); + result.start.assign("day", date.date()); + return result; + } + if (unitAbbr == "\u79D2") { + date = date.add(number, "second"); + } else if (unitAbbr == "\u5206") { + date = date.add(number, "minute"); + } else if (unitAbbr == "\u5C0F" || unitAbbr == "\u9418") { + date = date.add(number, "hour"); + } + result.start.imply("year", date.year()); + result.start.imply("month", date.month() + 1); + result.start.imply("day", date.date()); + result.start.assign("hour", date.hour()); + result.start.assign("minute", date.minute()); + result.start.assign("second", date.second()); + return result; + } + }; + exports.default = ZHHantDeadlineFormatParser; + } +}); + +// node_modules/chrono-node/dist/locales/zh/hant/parsers/ZHHantRelationWeekdayParser.js +var require_ZHHantRelationWeekdayParser = __commonJS({ + "node_modules/chrono-node/dist/locales/zh/hant/parsers/ZHHantRelationWeekdayParser.js"(exports) { + "use strict"; + var __importDefault = exports && exports.__importDefault || function(mod) { + return mod && mod.__esModule ? mod : { "default": mod }; + }; + Object.defineProperty(exports, "__esModule", { value: true }); + var dayjs_1 = __importDefault(require_dayjs_min()); + var AbstractParserWithWordBoundary_1 = require_AbstractParserWithWordBoundary(); + var constants_1 = require_constants7(); + var PATTERN = new RegExp("(?\u4E0A|\u4ECA|\u4E0B|\u9019|\u5462)(?:\u500B)?(?:\u661F\u671F|\u79AE\u62DC|\u9031)(?" + Object.keys(constants_1.WEEKDAY_OFFSET).join("|") + ")"); + var ZHHantRelationWeekdayParser = class extends AbstractParserWithWordBoundary_1.AbstractParserWithWordBoundaryChecking { + innerPattern() { + return PATTERN; + } + innerExtract(context, match) { + const result = context.createParsingResult(match.index, match[0]); + const dayOfWeek = match.groups.weekday; + const offset2 = constants_1.WEEKDAY_OFFSET[dayOfWeek]; + if (offset2 === void 0) + return null; + let modifier = null; + const prefix = match.groups.prefix; + if (prefix == "\u4E0A") { + modifier = "last"; + } else if (prefix == "\u4E0B") { + modifier = "next"; + } else if (prefix == "\u4ECA" || prefix == "\u9019" || prefix == "\u5462") { + modifier = "this"; + } + let startMoment = dayjs_1.default(context.refDate); + let startMomentFixed = false; + const refOffset = startMoment.day(); + if (modifier == "last" || modifier == "past") { + startMoment = startMoment.day(offset2 - 7); + startMomentFixed = true; + } else if (modifier == "next") { + startMoment = startMoment.day(offset2 + 7); + startMomentFixed = true; + } else if (modifier == "this") { + startMoment = startMoment.day(offset2); + } else { + if (Math.abs(offset2 - 7 - refOffset) < Math.abs(offset2 - refOffset)) { + startMoment = startMoment.day(offset2 - 7); + } else if (Math.abs(offset2 + 7 - refOffset) < Math.abs(offset2 - refOffset)) { + startMoment = startMoment.day(offset2 + 7); + } else { + startMoment = startMoment.day(offset2); + } + } + result.start.assign("weekday", offset2); + if (startMomentFixed) { + result.start.assign("day", startMoment.date()); + result.start.assign("month", startMoment.month() + 1); + result.start.assign("year", startMoment.year()); + } else { + result.start.imply("day", startMoment.date()); + result.start.imply("month", startMoment.month() + 1); + result.start.imply("year", startMoment.year()); + } + return result; + } + }; + exports.default = ZHHantRelationWeekdayParser; + } +}); + +// node_modules/chrono-node/dist/locales/zh/hant/parsers/ZHHantTimeExpressionParser.js +var require_ZHHantTimeExpressionParser = __commonJS({ + "node_modules/chrono-node/dist/locales/zh/hant/parsers/ZHHantTimeExpressionParser.js"(exports) { + "use strict"; + var __importDefault = exports && exports.__importDefault || function(mod) { + return mod && mod.__esModule ? mod : { "default": mod }; + }; + Object.defineProperty(exports, "__esModule", { value: true }); + var dayjs_1 = __importDefault(require_dayjs_min()); + var AbstractParserWithWordBoundary_1 = require_AbstractParserWithWordBoundary(); + var constants_1 = require_constants7(); + var FIRST_REG_PATTERN = new RegExp("(?:\u7531|\u5F9E|\u81EA)?(?:(\u4ECA|\u660E|\u524D|\u5927\u524D|\u5F8C|\u5927\u5F8C|\u807D|\u6628|\u5C0B|\u7434)(\u65E9|\u671D|\u665A)|(\u4E0A(?:\u5348|\u665D)|\u671D(?:\u65E9)|\u65E9(?:\u4E0A)|\u4E0B(?:\u5348|\u665D)|\u664F(?:\u665D)|\u665A(?:\u4E0A)|\u591C(?:\u665A)?|\u4E2D(?:\u5348)|\u51CC(?:\u6668))|(\u4ECA|\u660E|\u524D|\u5927\u524D|\u5F8C|\u5927\u5F8C|\u807D|\u6628|\u5C0B|\u7434)(?:\u65E5|\u5929)(?:[\\s,\uFF0C]*)(?:(\u4E0A(?:\u5348|\u665D)|\u671D(?:\u65E9)|\u65E9(?:\u4E0A)|\u4E0B(?:\u5348|\u665D)|\u664F(?:\u665D)|\u665A(?:\u4E0A)|\u591C(?:\u665A)?|\u4E2D(?:\u5348)|\u51CC(?:\u6668)))?)?(?:[\\s,\uFF0C]*)(?:(\\d+|[" + Object.keys(constants_1.NUMBER).join("") + "]+)(?:\\s*)(?:\u9EDE|\u6642|:|\uFF1A)(?:\\s*)(\\d+|\u534A|\u6B63|\u6574|[" + Object.keys(constants_1.NUMBER).join("") + "]+)?(?:\\s*)(?:\u5206|:|\uFF1A)?(?:\\s*)(\\d+|[" + Object.keys(constants_1.NUMBER).join("") + "]+)?(?:\\s*)(?:\u79D2)?)(?:\\s*(A.M.|P.M.|AM?|PM?))?", "i"); + var SECOND_REG_PATTERN = new RegExp("(?:^\\s*(?:\u5230|\u81F3|\\-|\\\u2013|\\~|\\\u301C)\\s*)(?:(\u4ECA|\u660E|\u524D|\u5927\u524D|\u5F8C|\u5927\u5F8C|\u807D|\u6628|\u5C0B|\u7434)(\u65E9|\u671D|\u665A)|(\u4E0A(?:\u5348|\u665D)|\u671D(?:\u65E9)|\u65E9(?:\u4E0A)|\u4E0B(?:\u5348|\u665D)|\u664F(?:\u665D)|\u665A(?:\u4E0A)|\u591C(?:\u665A)?|\u4E2D(?:\u5348)|\u51CC(?:\u6668))|(\u4ECA|\u660E|\u524D|\u5927\u524D|\u5F8C|\u5927\u5F8C|\u807D|\u6628|\u5C0B|\u7434)(?:\u65E5|\u5929)(?:[\\s,\uFF0C]*)(?:(\u4E0A(?:\u5348|\u665D)|\u671D(?:\u65E9)|\u65E9(?:\u4E0A)|\u4E0B(?:\u5348|\u665D)|\u664F(?:\u665D)|\u665A(?:\u4E0A)|\u591C(?:\u665A)?|\u4E2D(?:\u5348)|\u51CC(?:\u6668)))?)?(?:[\\s,\uFF0C]*)(?:(\\d+|[" + Object.keys(constants_1.NUMBER).join("") + "]+)(?:\\s*)(?:\u9EDE|\u6642|:|\uFF1A)(?:\\s*)(\\d+|\u534A|\u6B63|\u6574|[" + Object.keys(constants_1.NUMBER).join("") + "]+)?(?:\\s*)(?:\u5206|:|\uFF1A)?(?:\\s*)(\\d+|[" + Object.keys(constants_1.NUMBER).join("") + "]+)?(?:\\s*)(?:\u79D2)?)(?:\\s*(A.M.|P.M.|AM?|PM?))?", "i"); + var DAY_GROUP_1 = 1; + var ZH_AM_PM_HOUR_GROUP_1 = 2; + var ZH_AM_PM_HOUR_GROUP_2 = 3; + var DAY_GROUP_3 = 4; + var ZH_AM_PM_HOUR_GROUP_3 = 5; + var HOUR_GROUP = 6; + var MINUTE_GROUP = 7; + var SECOND_GROUP = 8; + var AM_PM_HOUR_GROUP = 9; + var ZHHantTimeExpressionParser = class extends AbstractParserWithWordBoundary_1.AbstractParserWithWordBoundaryChecking { + innerPattern() { + return FIRST_REG_PATTERN; + } + innerExtract(context, match) { + if (match.index > 0 && context.text[match.index - 1].match(/\w/)) { + return null; + } + const refMoment = dayjs_1.default(context.refDate); + const result = context.createParsingResult(match.index, match[0]); + const startMoment = refMoment.clone(); + if (match[DAY_GROUP_1]) { + var day1 = match[DAY_GROUP_1]; + if (day1 == "\u660E" || day1 == "\u807D") { + if (refMoment.hour() > 1) { + startMoment.add(1, "day"); + } + } else if (day1 == "\u6628" || day1 == "\u5C0B" || day1 == "\u7434") { + startMoment.add(-1, "day"); + } else if (day1 == "\u524D") { + startMoment.add(-2, "day"); + } else if (day1 == "\u5927\u524D") { + startMoment.add(-3, "day"); + } else if (day1 == "\u5F8C") { + startMoment.add(2, "day"); + } else if (day1 == "\u5927\u5F8C") { + startMoment.add(3, "day"); + } + result.start.assign("day", startMoment.date()); + result.start.assign("month", startMoment.month() + 1); + result.start.assign("year", startMoment.year()); + } else if (match[DAY_GROUP_3]) { + var day3 = match[DAY_GROUP_3]; + if (day3 == "\u660E" || day3 == "\u807D") { + startMoment.add(1, "day"); + } else if (day3 == "\u6628" || day3 == "\u5C0B" || day3 == "\u7434") { + startMoment.add(-1, "day"); + } else if (day3 == "\u524D") { + startMoment.add(-2, "day"); + } else if (day3 == "\u5927\u524D") { + startMoment.add(-3, "day"); + } else if (day3 == "\u5F8C") { + startMoment.add(2, "day"); + } else if (day3 == "\u5927\u5F8C") { + startMoment.add(3, "day"); + } + result.start.assign("day", startMoment.date()); + result.start.assign("month", startMoment.month() + 1); + result.start.assign("year", startMoment.year()); + } else { + result.start.imply("day", startMoment.date()); + result.start.imply("month", startMoment.month() + 1); + result.start.imply("year", startMoment.year()); + } + let hour = 0; + let minute = 0; + let meridiem = -1; + if (match[SECOND_GROUP]) { + var second = parseInt(match[SECOND_GROUP]); + if (isNaN(second)) { + second = constants_1.zhStringToNumber(match[SECOND_GROUP]); + } + if (second >= 60) + return null; + result.start.assign("second", second); + } + hour = parseInt(match[HOUR_GROUP]); + if (isNaN(hour)) { + hour = constants_1.zhStringToNumber(match[HOUR_GROUP]); + } + if (match[MINUTE_GROUP]) { + if (match[MINUTE_GROUP] == "\u534A") { + minute = 30; + } else if (match[MINUTE_GROUP] == "\u6B63" || match[MINUTE_GROUP] == "\u6574") { + minute = 0; + } else { + minute = parseInt(match[MINUTE_GROUP]); + if (isNaN(minute)) { + minute = constants_1.zhStringToNumber(match[MINUTE_GROUP]); + } + } + } else if (hour > 100) { + minute = hour % 100; + hour = Math.floor(hour / 100); + } + if (minute >= 60) { + return null; + } + if (hour > 24) { + return null; + } + if (hour >= 12) { + meridiem = 1; + } + if (match[AM_PM_HOUR_GROUP]) { + if (hour > 12) + return null; + var ampm = match[AM_PM_HOUR_GROUP][0].toLowerCase(); + if (ampm == "a") { + meridiem = 0; + if (hour == 12) + hour = 0; + } + if (ampm == "p") { + meridiem = 1; + if (hour != 12) + hour += 12; + } + } else if (match[ZH_AM_PM_HOUR_GROUP_1]) { + var zhAMPMString1 = match[ZH_AM_PM_HOUR_GROUP_1]; + var zhAMPM1 = zhAMPMString1[0]; + if (zhAMPM1 == "\u671D" || zhAMPM1 == "\u65E9") { + meridiem = 0; + if (hour == 12) + hour = 0; + } else if (zhAMPM1 == "\u665A") { + meridiem = 1; + if (hour != 12) + hour += 12; + } + } else if (match[ZH_AM_PM_HOUR_GROUP_2]) { + var zhAMPMString2 = match[ZH_AM_PM_HOUR_GROUP_2]; + var zhAMPM2 = zhAMPMString2[0]; + if (zhAMPM2 == "\u4E0A" || zhAMPM2 == "\u671D" || zhAMPM2 == "\u65E9" || zhAMPM2 == "\u51CC") { + meridiem = 0; + if (hour == 12) + hour = 0; + } else if (zhAMPM2 == "\u4E0B" || zhAMPM2 == "\u664F" || zhAMPM2 == "\u665A") { + meridiem = 1; + if (hour != 12) + hour += 12; + } + } else if (match[ZH_AM_PM_HOUR_GROUP_3]) { + var zhAMPMString3 = match[ZH_AM_PM_HOUR_GROUP_3]; + var zhAMPM3 = zhAMPMString3[0]; + if (zhAMPM3 == "\u4E0A" || zhAMPM3 == "\u671D" || zhAMPM3 == "\u65E9" || zhAMPM3 == "\u51CC") { + meridiem = 0; + if (hour == 12) + hour = 0; + } else if (zhAMPM3 == "\u4E0B" || zhAMPM3 == "\u664F" || zhAMPM3 == "\u665A") { + meridiem = 1; + if (hour != 12) + hour += 12; + } + } + result.start.assign("hour", hour); + result.start.assign("minute", minute); + if (meridiem >= 0) { + result.start.assign("meridiem", meridiem); + } else { + if (hour < 12) { + result.start.imply("meridiem", 0); + } else { + result.start.imply("meridiem", 1); + } + } + match = SECOND_REG_PATTERN.exec(context.text.substring(result.index + result.text.length)); + if (!match) { + if (result.text.match(/^\d+$/)) { + return null; + } + return result; + } + const endMoment = startMoment.clone(); + result.end = context.createParsingComponents(); + if (match[DAY_GROUP_1]) { + var day1 = match[DAY_GROUP_1]; + if (day1 == "\u660E" || day1 == "\u807D") { + if (refMoment.hour() > 1) { + endMoment.add(1, "day"); + } + } else if (day1 == "\u6628" || day1 == "\u5C0B" || day1 == "\u7434") { + endMoment.add(-1, "day"); + } else if (day1 == "\u524D") { + endMoment.add(-2, "day"); + } else if (day1 == "\u5927\u524D") { + endMoment.add(-3, "day"); + } else if (day1 == "\u5F8C") { + endMoment.add(2, "day"); + } else if (day1 == "\u5927\u5F8C") { + endMoment.add(3, "day"); + } + result.end.assign("day", endMoment.date()); + result.end.assign("month", endMoment.month() + 1); + result.end.assign("year", endMoment.year()); + } else if (match[DAY_GROUP_3]) { + var day3 = match[DAY_GROUP_3]; + if (day3 == "\u660E" || day3 == "\u807D") { + endMoment.add(1, "day"); + } else if (day3 == "\u6628" || day3 == "\u5C0B" || day3 == "\u7434") { + endMoment.add(-1, "day"); + } else if (day3 == "\u524D") { + endMoment.add(-2, "day"); + } else if (day3 == "\u5927\u524D") { + endMoment.add(-3, "day"); + } else if (day3 == "\u5F8C") { + endMoment.add(2, "day"); + } else if (day3 == "\u5927\u5F8C") { + endMoment.add(3, "day"); + } + result.end.assign("day", endMoment.date()); + result.end.assign("month", endMoment.month() + 1); + result.end.assign("year", endMoment.year()); + } else { + result.end.imply("day", endMoment.date()); + result.end.imply("month", endMoment.month() + 1); + result.end.imply("year", endMoment.year()); + } + hour = 0; + minute = 0; + meridiem = -1; + if (match[SECOND_GROUP]) { + var second = parseInt(match[SECOND_GROUP]); + if (isNaN(second)) { + second = constants_1.zhStringToNumber(match[SECOND_GROUP]); + } + if (second >= 60) + return null; + result.end.assign("second", second); + } + hour = parseInt(match[HOUR_GROUP]); + if (isNaN(hour)) { + hour = constants_1.zhStringToNumber(match[HOUR_GROUP]); + } + if (match[MINUTE_GROUP]) { + if (match[MINUTE_GROUP] == "\u534A") { + minute = 30; + } else if (match[MINUTE_GROUP] == "\u6B63" || match[MINUTE_GROUP] == "\u6574") { + minute = 0; + } else { + minute = parseInt(match[MINUTE_GROUP]); + if (isNaN(minute)) { + minute = constants_1.zhStringToNumber(match[MINUTE_GROUP]); + } + } + } else if (hour > 100) { + minute = hour % 100; + hour = Math.floor(hour / 100); + } + if (minute >= 60) { + return null; + } + if (hour > 24) { + return null; + } + if (hour >= 12) { + meridiem = 1; + } + if (match[AM_PM_HOUR_GROUP]) { + if (hour > 12) + return null; + var ampm = match[AM_PM_HOUR_GROUP][0].toLowerCase(); + if (ampm == "a") { + meridiem = 0; + if (hour == 12) + hour = 0; + } + if (ampm == "p") { + meridiem = 1; + if (hour != 12) + hour += 12; + } + if (!result.start.isCertain("meridiem")) { + if (meridiem == 0) { + result.start.imply("meridiem", 0); + if (result.start.get("hour") == 12) { + result.start.assign("hour", 0); + } + } else { + result.start.imply("meridiem", 1); + if (result.start.get("hour") != 12) { + result.start.assign("hour", result.start.get("hour") + 12); + } + } + } + } else if (match[ZH_AM_PM_HOUR_GROUP_1]) { + var zhAMPMString1 = match[ZH_AM_PM_HOUR_GROUP_1]; + var zhAMPM1 = zhAMPMString1[0]; + if (zhAMPM1 == "\u671D" || zhAMPM1 == "\u65E9") { + meridiem = 0; + if (hour == 12) + hour = 0; + } else if (zhAMPM1 == "\u665A") { + meridiem = 1; + if (hour != 12) + hour += 12; + } + } else if (match[ZH_AM_PM_HOUR_GROUP_2]) { + var zhAMPMString2 = match[ZH_AM_PM_HOUR_GROUP_2]; + var zhAMPM2 = zhAMPMString2[0]; + if (zhAMPM2 == "\u4E0A" || zhAMPM2 == "\u671D" || zhAMPM2 == "\u65E9" || zhAMPM2 == "\u51CC") { + meridiem = 0; + if (hour == 12) + hour = 0; + } else if (zhAMPM2 == "\u4E0B" || zhAMPM2 == "\u664F" || zhAMPM2 == "\u665A") { + meridiem = 1; + if (hour != 12) + hour += 12; + } + } else if (match[ZH_AM_PM_HOUR_GROUP_3]) { + var zhAMPMString3 = match[ZH_AM_PM_HOUR_GROUP_3]; + var zhAMPM3 = zhAMPMString3[0]; + if (zhAMPM3 == "\u4E0A" || zhAMPM3 == "\u671D" || zhAMPM3 == "\u65E9" || zhAMPM3 == "\u51CC") { + meridiem = 0; + if (hour == 12) + hour = 0; + } else if (zhAMPM3 == "\u4E0B" || zhAMPM3 == "\u664F" || zhAMPM3 == "\u665A") { + meridiem = 1; + if (hour != 12) + hour += 12; + } + } + result.text = result.text + match[0]; + result.end.assign("hour", hour); + result.end.assign("minute", minute); + if (meridiem >= 0) { + result.end.assign("meridiem", meridiem); + } else { + const startAtPM = result.start.isCertain("meridiem") && result.start.get("meridiem") == 1; + if (startAtPM && result.start.get("hour") > hour) { + result.end.imply("meridiem", 0); + } else if (hour > 12) { + result.end.imply("meridiem", 1); + } + } + if (result.end.date().getTime() < result.start.date().getTime()) { + result.end.imply("day", result.end.get("day") + 1); + } + return result; + } + }; + exports.default = ZHHantTimeExpressionParser; + } +}); + +// node_modules/chrono-node/dist/locales/zh/hant/parsers/ZHHantWeekdayParser.js +var require_ZHHantWeekdayParser = __commonJS({ + "node_modules/chrono-node/dist/locales/zh/hant/parsers/ZHHantWeekdayParser.js"(exports) { + "use strict"; + var __importDefault = exports && exports.__importDefault || function(mod) { + return mod && mod.__esModule ? mod : { "default": mod }; + }; + Object.defineProperty(exports, "__esModule", { value: true }); + var dayjs_1 = __importDefault(require_dayjs_min()); + var AbstractParserWithWordBoundary_1 = require_AbstractParserWithWordBoundary(); + var constants_1 = require_constants7(); + var PATTERN = new RegExp("(?:\u661F\u671F|\u79AE\u62DC|\u9031)(?" + Object.keys(constants_1.WEEKDAY_OFFSET).join("|") + ")"); + var ZHHantWeekdayParser = class extends AbstractParserWithWordBoundary_1.AbstractParserWithWordBoundaryChecking { + innerPattern() { + return PATTERN; + } + innerExtract(context, match) { + const result = context.createParsingResult(match.index, match[0]); + const dayOfWeek = match.groups.weekday; + const offset2 = constants_1.WEEKDAY_OFFSET[dayOfWeek]; + if (offset2 === void 0) + return null; + let startMoment = dayjs_1.default(context.refDate); + const startMomentFixed = false; + const refOffset = startMoment.day(); + if (Math.abs(offset2 - 7 - refOffset) < Math.abs(offset2 - refOffset)) { + startMoment = startMoment.day(offset2 - 7); + } else if (Math.abs(offset2 + 7 - refOffset) < Math.abs(offset2 - refOffset)) { + startMoment = startMoment.day(offset2 + 7); + } else { + startMoment = startMoment.day(offset2); + } + result.start.assign("weekday", offset2); + if (startMomentFixed) { + result.start.assign("day", startMoment.date()); + result.start.assign("month", startMoment.month() + 1); + result.start.assign("year", startMoment.year()); + } else { + result.start.imply("day", startMoment.date()); + result.start.imply("month", startMoment.month() + 1); + result.start.imply("year", startMoment.year()); + } + return result; + } + }; + exports.default = ZHHantWeekdayParser; + } +}); + +// node_modules/chrono-node/dist/locales/zh/hant/refiners/ZHHantMergeDateRangeRefiner.js +var require_ZHHantMergeDateRangeRefiner = __commonJS({ + "node_modules/chrono-node/dist/locales/zh/hant/refiners/ZHHantMergeDateRangeRefiner.js"(exports) { + "use strict"; + var __importDefault = exports && exports.__importDefault || function(mod) { + return mod && mod.__esModule ? mod : { "default": mod }; + }; + Object.defineProperty(exports, "__esModule", { value: true }); + var AbstractMergeDateRangeRefiner_1 = __importDefault(require_AbstractMergeDateRangeRefiner()); + var ZHHantMergeDateRangeRefiner = class extends AbstractMergeDateRangeRefiner_1.default { + patternBetween() { + return /^\s*(至|到|\-|\~|~|-|ー)\s*$/i; + } + }; + exports.default = ZHHantMergeDateRangeRefiner; + } +}); + +// node_modules/chrono-node/dist/locales/zh/hant/refiners/ZHHantMergeDateTimeRefiner.js +var require_ZHHantMergeDateTimeRefiner = __commonJS({ + "node_modules/chrono-node/dist/locales/zh/hant/refiners/ZHHantMergeDateTimeRefiner.js"(exports) { + "use strict"; + var __importDefault = exports && exports.__importDefault || function(mod) { + return mod && mod.__esModule ? mod : { "default": mod }; + }; + Object.defineProperty(exports, "__esModule", { value: true }); + var AbstractMergeDateTimeRefiner_1 = __importDefault(require_AbstractMergeDateTimeRefiner()); + var ZHHantMergeDateTimeRefiner = class extends AbstractMergeDateTimeRefiner_1.default { + patternBetween() { + return /^\s*$/i; + } + }; + exports.default = ZHHantMergeDateTimeRefiner; + } +}); + +// node_modules/chrono-node/dist/locales/zh/hant/index.js +var require_hant = __commonJS({ + "node_modules/chrono-node/dist/locales/zh/hant/index.js"(exports) { + "use strict"; + var __importDefault = exports && exports.__importDefault || function(mod) { + return mod && mod.__esModule ? mod : { "default": mod }; + }; + Object.defineProperty(exports, "__esModule", { value: true }); + exports.createConfiguration = exports.createCasualConfiguration = exports.parseDate = exports.parse = exports.strict = exports.casual = exports.hant = void 0; + var chrono_1 = require_chrono(); + var ExtractTimezoneOffsetRefiner_1 = __importDefault(require_ExtractTimezoneOffsetRefiner()); + var configurations_1 = require_configurations(); + var ZHHantCasualDateParser_1 = __importDefault(require_ZHHantCasualDateParser()); + var ZHHantDateParser_1 = __importDefault(require_ZHHantDateParser()); + var ZHHantDeadlineFormatParser_1 = __importDefault(require_ZHHantDeadlineFormatParser()); + var ZHHantRelationWeekdayParser_1 = __importDefault(require_ZHHantRelationWeekdayParser()); + var ZHHantTimeExpressionParser_1 = __importDefault(require_ZHHantTimeExpressionParser()); + var ZHHantWeekdayParser_1 = __importDefault(require_ZHHantWeekdayParser()); + var ZHHantMergeDateRangeRefiner_1 = __importDefault(require_ZHHantMergeDateRangeRefiner()); + var ZHHantMergeDateTimeRefiner_1 = __importDefault(require_ZHHantMergeDateTimeRefiner()); + exports.hant = new chrono_1.Chrono(createCasualConfiguration()); + exports.casual = new chrono_1.Chrono(createCasualConfiguration()); + exports.strict = new chrono_1.Chrono(createConfiguration()); + function parse4(text2, ref, option) { + return exports.casual.parse(text2, ref, option); + } + exports.parse = parse4; + function parseDate3(text2, ref, option) { + return exports.casual.parseDate(text2, ref, option); + } + exports.parseDate = parseDate3; + function createCasualConfiguration() { + const option = createConfiguration(); + option.parsers.unshift(new ZHHantCasualDateParser_1.default()); + return option; + } + exports.createCasualConfiguration = createCasualConfiguration; + function createConfiguration() { + const configuration = configurations_1.includeCommonConfiguration({ + parsers: [ + new ZHHantDateParser_1.default(), + new ZHHantRelationWeekdayParser_1.default(), + new ZHHantWeekdayParser_1.default(), + new ZHHantTimeExpressionParser_1.default(), + new ZHHantDeadlineFormatParser_1.default() + ], + refiners: [new ZHHantMergeDateRangeRefiner_1.default(), new ZHHantMergeDateTimeRefiner_1.default()] + }); + configuration.refiners = configuration.refiners.filter((refiner) => !(refiner instanceof ExtractTimezoneOffsetRefiner_1.default)); + return configuration; + } + exports.createConfiguration = createConfiguration; + } +}); + +// node_modules/chrono-node/dist/locales/zh/hans/parsers/ZHHansCasualDateParser.js +var require_ZHHansCasualDateParser = __commonJS({ + "node_modules/chrono-node/dist/locales/zh/hans/parsers/ZHHansCasualDateParser.js"(exports) { + "use strict"; + var __importDefault = exports && exports.__importDefault || function(mod) { + return mod && mod.__esModule ? mod : { "default": mod }; + }; + Object.defineProperty(exports, "__esModule", { value: true }); + var dayjs_1 = __importDefault(require_dayjs_min()); + var AbstractParserWithWordBoundary_1 = require_AbstractParserWithWordBoundary(); + var NOW_GROUP = 1; + var DAY_GROUP_1 = 2; + var TIME_GROUP_1 = 3; + var TIME_GROUP_2 = 4; + var DAY_GROUP_3 = 5; + var TIME_GROUP_3 = 6; + var ZHHansCasualDateParser = class extends AbstractParserWithWordBoundary_1.AbstractParserWithWordBoundaryChecking { + innerPattern(context) { + return new RegExp("(\u73B0\u5728|\u7ACB(?:\u523B|\u5373)|\u5373\u523B)|(\u4ECA|\u660E|\u524D|\u5927\u524D|\u540E|\u5927\u540E|\u6628)(\u65E9|\u665A)|(\u4E0A(?:\u5348)|\u65E9(?:\u4E0A)|\u4E0B(?:\u5348)|\u665A(?:\u4E0A)|\u591C(?:\u665A)?|\u4E2D(?:\u5348)|\u51CC(?:\u6668))|(\u4ECA|\u660E|\u524D|\u5927\u524D|\u540E|\u5927\u540E|\u6628)(?:\u65E5|\u5929)(?:[\\s|,|\uFF0C]*)(?:(\u4E0A(?:\u5348)|\u65E9(?:\u4E0A)|\u4E0B(?:\u5348)|\u665A(?:\u4E0A)|\u591C(?:\u665A)?|\u4E2D(?:\u5348)|\u51CC(?:\u6668)))?", "i"); + } + innerExtract(context, match) { + const index = match.index; + const result = context.createParsingResult(index, match[0]); + const refMoment = dayjs_1.default(context.refDate); + let startMoment = refMoment; + if (match[NOW_GROUP]) { + result.start.imply("hour", refMoment.hour()); + result.start.imply("minute", refMoment.minute()); + result.start.imply("second", refMoment.second()); + result.start.imply("millisecond", refMoment.millisecond()); + } else if (match[DAY_GROUP_1]) { + const day1 = match[DAY_GROUP_1]; + const time1 = match[TIME_GROUP_1]; + if (day1 == "\u660E") { + if (refMoment.hour() > 1) { + startMoment = startMoment.add(1, "day"); + } + } else if (day1 == "\u6628") { + startMoment = startMoment.add(-1, "day"); + } else if (day1 == "\u524D") { + startMoment = startMoment.add(-2, "day"); + } else if (day1 == "\u5927\u524D") { + startMoment = startMoment.add(-3, "day"); + } else if (day1 == "\u540E") { + startMoment = startMoment.add(2, "day"); + } else if (day1 == "\u5927\u540E") { + startMoment = startMoment.add(3, "day"); + } + if (time1 == "\u65E9") { + result.start.imply("hour", 6); + } else if (time1 == "\u665A") { + result.start.imply("hour", 22); + result.start.imply("meridiem", 1); + } + } else if (match[TIME_GROUP_2]) { + const timeString2 = match[TIME_GROUP_2]; + const time2 = timeString2[0]; + if (time2 == "\u65E9" || time2 == "\u4E0A") { + result.start.imply("hour", 6); + } else if (time2 == "\u4E0B") { + result.start.imply("hour", 15); + result.start.imply("meridiem", 1); + } else if (time2 == "\u4E2D") { + result.start.imply("hour", 12); + result.start.imply("meridiem", 1); + } else if (time2 == "\u591C" || time2 == "\u665A") { + result.start.imply("hour", 22); + result.start.imply("meridiem", 1); + } else if (time2 == "\u51CC") { + result.start.imply("hour", 0); + } + } else if (match[DAY_GROUP_3]) { + const day3 = match[DAY_GROUP_3]; + if (day3 == "\u660E") { + if (refMoment.hour() > 1) { + startMoment = startMoment.add(1, "day"); + } + } else if (day3 == "\u6628") { + startMoment = startMoment.add(-1, "day"); + } else if (day3 == "\u524D") { + startMoment = startMoment.add(-2, "day"); + } else if (day3 == "\u5927\u524D") { + startMoment = startMoment.add(-3, "day"); + } else if (day3 == "\u540E") { + startMoment = startMoment.add(2, "day"); + } else if (day3 == "\u5927\u540E") { + startMoment = startMoment.add(3, "day"); + } + const timeString3 = match[TIME_GROUP_3]; + if (timeString3) { + const time3 = timeString3[0]; + if (time3 == "\u65E9" || time3 == "\u4E0A") { + result.start.imply("hour", 6); + } else if (time3 == "\u4E0B") { + result.start.imply("hour", 15); + result.start.imply("meridiem", 1); + } else if (time3 == "\u4E2D") { + result.start.imply("hour", 12); + result.start.imply("meridiem", 1); + } else if (time3 == "\u591C" || time3 == "\u665A") { + result.start.imply("hour", 22); + result.start.imply("meridiem", 1); + } else if (time3 == "\u51CC") { + result.start.imply("hour", 0); + } + } + } + result.start.assign("day", startMoment.date()); + result.start.assign("month", startMoment.month() + 1); + result.start.assign("year", startMoment.year()); + return result; + } + }; + exports.default = ZHHansCasualDateParser; + } +}); + +// node_modules/chrono-node/dist/locales/zh/hans/constants.js +var require_constants8 = __commonJS({ + "node_modules/chrono-node/dist/locales/zh/hans/constants.js"(exports) { + "use strict"; + Object.defineProperty(exports, "__esModule", { value: true }); + exports.zhStringToYear = exports.zhStringToNumber = exports.WEEKDAY_OFFSET = exports.NUMBER = void 0; + exports.NUMBER = { + "\u96F6": 0, + "\u3007": 0, + "\u4E00": 1, + "\u4E8C": 2, + "\u4E24": 2, + "\u4E09": 3, + "\u56DB": 4, + "\u4E94": 5, + "\u516D": 6, + "\u4E03": 7, + "\u516B": 8, + "\u4E5D": 9, + "\u5341": 10 + }; + exports.WEEKDAY_OFFSET = { + "\u5929": 0, + "\u65E5": 0, + "\u4E00": 1, + "\u4E8C": 2, + "\u4E09": 3, + "\u56DB": 4, + "\u4E94": 5, + "\u516D": 6 + }; + function zhStringToNumber(text2) { + let number = 0; + for (let i = 0; i < text2.length; i++) { + const char = text2[i]; + if (char === "\u5341") { + number = number === 0 ? exports.NUMBER[char] : number * exports.NUMBER[char]; + } else { + number += exports.NUMBER[char]; + } + } + return number; + } + exports.zhStringToNumber = zhStringToNumber; + function zhStringToYear(text2) { + let string = ""; + for (let i = 0; i < text2.length; i++) { + const char = text2[i]; + string = string + exports.NUMBER[char]; + } + return parseInt(string); + } + exports.zhStringToYear = zhStringToYear; + } +}); + +// node_modules/chrono-node/dist/locales/zh/hans/parsers/ZHHansDateParser.js +var require_ZHHansDateParser = __commonJS({ + "node_modules/chrono-node/dist/locales/zh/hans/parsers/ZHHansDateParser.js"(exports) { + "use strict"; + var __importDefault = exports && exports.__importDefault || function(mod) { + return mod && mod.__esModule ? mod : { "default": mod }; + }; + Object.defineProperty(exports, "__esModule", { value: true }); + var dayjs_1 = __importDefault(require_dayjs_min()); + var AbstractParserWithWordBoundary_1 = require_AbstractParserWithWordBoundary(); + var constants_1 = require_constants8(); + var YEAR_GROUP = 1; + var MONTH_GROUP = 2; + var DAY_GROUP = 3; + var ZHHansDateParser = class extends AbstractParserWithWordBoundary_1.AbstractParserWithWordBoundaryChecking { + innerPattern() { + return new RegExp("(\\d{2,4}|[" + Object.keys(constants_1.NUMBER).join("") + "]{4}|[" + Object.keys(constants_1.NUMBER).join("") + "]{2})?(?:\\s*)(?:\u5E74)?(?:[\\s|,|\uFF0C]*)(\\d{1,2}|[" + Object.keys(constants_1.NUMBER).join("") + "]{1,3})(?:\\s*)(?:\u6708)(?:\\s*)(\\d{1,2}|[" + Object.keys(constants_1.NUMBER).join("") + "]{1,3})?(?:\\s*)(?:\u65E5|\u53F7)?"); + } + innerExtract(context, match) { + const startMoment = dayjs_1.default(context.refDate); + const result = context.createParsingResult(match.index, match[0]); + let month = parseInt(match[MONTH_GROUP]); + if (isNaN(month)) + month = constants_1.zhStringToNumber(match[MONTH_GROUP]); + result.start.assign("month", month); + if (match[DAY_GROUP]) { + let day = parseInt(match[DAY_GROUP]); + if (isNaN(day)) + day = constants_1.zhStringToNumber(match[DAY_GROUP]); + result.start.assign("day", day); + } else { + result.start.imply("day", startMoment.date()); + } + if (match[YEAR_GROUP]) { + let year = parseInt(match[YEAR_GROUP]); + if (isNaN(year)) + year = constants_1.zhStringToYear(match[YEAR_GROUP]); + result.start.assign("year", year); + } else { + result.start.imply("year", startMoment.year()); + } + return result; + } + }; + exports.default = ZHHansDateParser; + } +}); + +// node_modules/chrono-node/dist/locales/zh/hans/parsers/ZHHansDeadlineFormatParser.js +var require_ZHHansDeadlineFormatParser = __commonJS({ + "node_modules/chrono-node/dist/locales/zh/hans/parsers/ZHHansDeadlineFormatParser.js"(exports) { + "use strict"; + var __importDefault = exports && exports.__importDefault || function(mod) { + return mod && mod.__esModule ? mod : { "default": mod }; + }; + Object.defineProperty(exports, "__esModule", { value: true }); + var dayjs_1 = __importDefault(require_dayjs_min()); + var AbstractParserWithWordBoundary_1 = require_AbstractParserWithWordBoundary(); + var constants_1 = require_constants8(); + var PATTERN = new RegExp("(\\d+|[" + Object.keys(constants_1.NUMBER).join("") + "]+|\u534A|\u51E0)(?:\\s*)(?:\u4E2A)?(\u79D2(?:\u949F)?|\u5206\u949F|\u5C0F\u65F6|\u949F|\u65E5|\u5929|\u661F\u671F|\u793C\u62DC|\u6708|\u5E74)(?:(?:\u4E4B|\u8FC7)?\u540E|(?:\u4E4B)?\u5185)", "i"); + var NUMBER_GROUP = 1; + var UNIT_GROUP = 2; + var ZHHansDeadlineFormatParser = class extends AbstractParserWithWordBoundary_1.AbstractParserWithWordBoundaryChecking { + innerPattern() { + return PATTERN; + } + innerExtract(context, match) { + const result = context.createParsingResult(match.index, match[0]); + let number = parseInt(match[NUMBER_GROUP]); + if (isNaN(number)) { + number = constants_1.zhStringToNumber(match[NUMBER_GROUP]); + } + if (isNaN(number)) { + const string = match[NUMBER_GROUP]; + if (string === "\u51E0") { + number = 3; + } else if (string === "\u534A") { + number = 0.5; + } else { + return null; + } + } + let date = dayjs_1.default(context.refDate); + const unit = match[UNIT_GROUP]; + const unitAbbr = unit[0]; + if (unitAbbr.match(/[日天星礼月年]/)) { + if (unitAbbr == "\u65E5" || unitAbbr == "\u5929") { + date = date.add(number, "d"); + } else if (unitAbbr == "\u661F" || unitAbbr == "\u793C") { + date = date.add(number * 7, "d"); + } else if (unitAbbr == "\u6708") { + date = date.add(number, "month"); + } else if (unitAbbr == "\u5E74") { + date = date.add(number, "year"); + } + result.start.assign("year", date.year()); + result.start.assign("month", date.month() + 1); + result.start.assign("day", date.date()); + return result; + } + if (unitAbbr == "\u79D2") { + date = date.add(number, "second"); + } else if (unitAbbr == "\u5206") { + date = date.add(number, "minute"); + } else if (unitAbbr == "\u5C0F" || unitAbbr == "\u949F") { + date = date.add(number, "hour"); + } + result.start.imply("year", date.year()); + result.start.imply("month", date.month() + 1); + result.start.imply("day", date.date()); + result.start.assign("hour", date.hour()); + result.start.assign("minute", date.minute()); + result.start.assign("second", date.second()); + return result; + } + }; + exports.default = ZHHansDeadlineFormatParser; + } +}); + +// node_modules/chrono-node/dist/locales/zh/hans/parsers/ZHHansRelationWeekdayParser.js +var require_ZHHansRelationWeekdayParser = __commonJS({ + "node_modules/chrono-node/dist/locales/zh/hans/parsers/ZHHansRelationWeekdayParser.js"(exports) { + "use strict"; + var __importDefault = exports && exports.__importDefault || function(mod) { + return mod && mod.__esModule ? mod : { "default": mod }; + }; + Object.defineProperty(exports, "__esModule", { value: true }); + var dayjs_1 = __importDefault(require_dayjs_min()); + var AbstractParserWithWordBoundary_1 = require_AbstractParserWithWordBoundary(); + var constants_1 = require_constants8(); + var PATTERN = new RegExp("(?\u4E0A|\u4E0B|\u8FD9)(?:\u4E2A)?(?:\u661F\u671F|\u793C\u62DC|\u5468)(?" + Object.keys(constants_1.WEEKDAY_OFFSET).join("|") + ")"); + var ZHHansRelationWeekdayParser = class extends AbstractParserWithWordBoundary_1.AbstractParserWithWordBoundaryChecking { + innerPattern() { + return PATTERN; + } + innerExtract(context, match) { + const result = context.createParsingResult(match.index, match[0]); + const dayOfWeek = match.groups.weekday; + const offset2 = constants_1.WEEKDAY_OFFSET[dayOfWeek]; + if (offset2 === void 0) + return null; + let modifier = null; + const prefix = match.groups.prefix; + if (prefix == "\u4E0A") { + modifier = "last"; + } else if (prefix == "\u4E0B") { + modifier = "next"; + } else if (prefix == "\u8FD9") { + modifier = "this"; + } + let startMoment = dayjs_1.default(context.refDate); + let startMomentFixed = false; + const refOffset = startMoment.day(); + if (modifier == "last" || modifier == "past") { + startMoment = startMoment.day(offset2 - 7); + startMomentFixed = true; + } else if (modifier == "next") { + startMoment = startMoment.day(offset2 + 7); + startMomentFixed = true; + } else if (modifier == "this") { + startMoment = startMoment.day(offset2); + } else { + if (Math.abs(offset2 - 7 - refOffset) < Math.abs(offset2 - refOffset)) { + startMoment = startMoment.day(offset2 - 7); + } else if (Math.abs(offset2 + 7 - refOffset) < Math.abs(offset2 - refOffset)) { + startMoment = startMoment.day(offset2 + 7); + } else { + startMoment = startMoment.day(offset2); + } + } + result.start.assign("weekday", offset2); + if (startMomentFixed) { + result.start.assign("day", startMoment.date()); + result.start.assign("month", startMoment.month() + 1); + result.start.assign("year", startMoment.year()); + } else { + result.start.imply("day", startMoment.date()); + result.start.imply("month", startMoment.month() + 1); + result.start.imply("year", startMoment.year()); + } + return result; + } + }; + exports.default = ZHHansRelationWeekdayParser; + } +}); + +// node_modules/chrono-node/dist/locales/zh/hans/parsers/ZHHansTimeExpressionParser.js +var require_ZHHansTimeExpressionParser = __commonJS({ + "node_modules/chrono-node/dist/locales/zh/hans/parsers/ZHHansTimeExpressionParser.js"(exports) { + "use strict"; + var __importDefault = exports && exports.__importDefault || function(mod) { + return mod && mod.__esModule ? mod : { "default": mod }; + }; + Object.defineProperty(exports, "__esModule", { value: true }); + var dayjs_1 = __importDefault(require_dayjs_min()); + var AbstractParserWithWordBoundary_1 = require_AbstractParserWithWordBoundary(); + var constants_1 = require_constants8(); + var FIRST_REG_PATTERN = new RegExp("(?:\u4ECE|\u81EA)?(?:(\u4ECA|\u660E|\u524D|\u5927\u524D|\u540E|\u5927\u540E|\u6628)(\u65E9|\u671D|\u665A)|(\u4E0A(?:\u5348)|\u65E9(?:\u4E0A)|\u4E0B(?:\u5348)|\u665A(?:\u4E0A)|\u591C(?:\u665A)?|\u4E2D(?:\u5348)|\u51CC(?:\u6668))|(\u4ECA|\u660E|\u524D|\u5927\u524D|\u540E|\u5927\u540E|\u6628)(?:\u65E5|\u5929)(?:[\\s,\uFF0C]*)(?:(\u4E0A(?:\u5348)|\u65E9(?:\u4E0A)|\u4E0B(?:\u5348)|\u665A(?:\u4E0A)|\u591C(?:\u665A)?|\u4E2D(?:\u5348)|\u51CC(?:\u6668)))?)?(?:[\\s,\uFF0C]*)(?:(\\d+|[" + Object.keys(constants_1.NUMBER).join("") + "]+)(?:\\s*)(?:\u70B9|\u65F6|:|\uFF1A)(?:\\s*)(\\d+|\u534A|\u6B63|\u6574|[" + Object.keys(constants_1.NUMBER).join("") + "]+)?(?:\\s*)(?:\u5206|:|\uFF1A)?(?:\\s*)(\\d+|[" + Object.keys(constants_1.NUMBER).join("") + "]+)?(?:\\s*)(?:\u79D2)?)(?:\\s*(A.M.|P.M.|AM?|PM?))?", "i"); + var SECOND_REG_PATTERN = new RegExp("(?:^\\s*(?:\u5230|\u81F3|\\-|\\\u2013|\\~|\\\u301C)\\s*)(?:(\u4ECA|\u660E|\u524D|\u5927\u524D|\u540E|\u5927\u540E|\u6628)(\u65E9|\u671D|\u665A)|(\u4E0A(?:\u5348)|\u65E9(?:\u4E0A)|\u4E0B(?:\u5348)|\u665A(?:\u4E0A)|\u591C(?:\u665A)?|\u4E2D(?:\u5348)|\u51CC(?:\u6668))|(\u4ECA|\u660E|\u524D|\u5927\u524D|\u540E|\u5927\u540E|\u6628)(?:\u65E5|\u5929)(?:[\\s,\uFF0C]*)(?:(\u4E0A(?:\u5348)|\u65E9(?:\u4E0A)|\u4E0B(?:\u5348)|\u665A(?:\u4E0A)|\u591C(?:\u665A)?|\u4E2D(?:\u5348)|\u51CC(?:\u6668)))?)?(?:[\\s,\uFF0C]*)(?:(\\d+|[" + Object.keys(constants_1.NUMBER).join("") + "]+)(?:\\s*)(?:\u70B9|\u65F6|:|\uFF1A)(?:\\s*)(\\d+|\u534A|\u6B63|\u6574|[" + Object.keys(constants_1.NUMBER).join("") + "]+)?(?:\\s*)(?:\u5206|:|\uFF1A)?(?:\\s*)(\\d+|[" + Object.keys(constants_1.NUMBER).join("") + "]+)?(?:\\s*)(?:\u79D2)?)(?:\\s*(A.M.|P.M.|AM?|PM?))?", "i"); + var DAY_GROUP_1 = 1; + var ZH_AM_PM_HOUR_GROUP_1 = 2; + var ZH_AM_PM_HOUR_GROUP_2 = 3; + var DAY_GROUP_3 = 4; + var ZH_AM_PM_HOUR_GROUP_3 = 5; + var HOUR_GROUP = 6; + var MINUTE_GROUP = 7; + var SECOND_GROUP = 8; + var AM_PM_HOUR_GROUP = 9; + var ZHHansTimeExpressionParser = class extends AbstractParserWithWordBoundary_1.AbstractParserWithWordBoundaryChecking { + innerPattern() { + return FIRST_REG_PATTERN; + } + innerExtract(context, match) { + if (match.index > 0 && context.text[match.index - 1].match(/\w/)) { + return null; + } + const refMoment = dayjs_1.default(context.refDate); + const result = context.createParsingResult(match.index, match[0]); + const startMoment = refMoment.clone(); + if (match[DAY_GROUP_1]) { + const day1 = match[DAY_GROUP_1]; + if (day1 == "\u660E") { + if (refMoment.hour() > 1) { + startMoment.add(1, "day"); + } + } else if (day1 == "\u6628") { + startMoment.add(-1, "day"); + } else if (day1 == "\u524D") { + startMoment.add(-2, "day"); + } else if (day1 == "\u5927\u524D") { + startMoment.add(-3, "day"); + } else if (day1 == "\u540E") { + startMoment.add(2, "day"); + } else if (day1 == "\u5927\u540E") { + startMoment.add(3, "day"); + } + result.start.assign("day", startMoment.date()); + result.start.assign("month", startMoment.month() + 1); + result.start.assign("year", startMoment.year()); + } else if (match[DAY_GROUP_3]) { + const day3 = match[DAY_GROUP_3]; + if (day3 == "\u660E") { + startMoment.add(1, "day"); + } else if (day3 == "\u6628") { + startMoment.add(-1, "day"); + } else if (day3 == "\u524D") { + startMoment.add(-2, "day"); + } else if (day3 == "\u5927\u524D") { + startMoment.add(-3, "day"); + } else if (day3 == "\u540E") { + startMoment.add(2, "day"); + } else if (day3 == "\u5927\u540E") { + startMoment.add(3, "day"); + } + result.start.assign("day", startMoment.date()); + result.start.assign("month", startMoment.month() + 1); + result.start.assign("year", startMoment.year()); + } else { + result.start.imply("day", startMoment.date()); + result.start.imply("month", startMoment.month() + 1); + result.start.imply("year", startMoment.year()); + } + let hour = 0; + let minute = 0; + let meridiem = -1; + if (match[SECOND_GROUP]) { + let second = parseInt(match[SECOND_GROUP]); + if (isNaN(second)) { + second = constants_1.zhStringToNumber(match[SECOND_GROUP]); + } + if (second >= 60) + return null; + result.start.assign("second", second); + } + hour = parseInt(match[HOUR_GROUP]); + if (isNaN(hour)) { + hour = constants_1.zhStringToNumber(match[HOUR_GROUP]); + } + if (match[MINUTE_GROUP]) { + if (match[MINUTE_GROUP] == "\u534A") { + minute = 30; + } else if (match[MINUTE_GROUP] == "\u6B63" || match[MINUTE_GROUP] == "\u6574") { + minute = 0; + } else { + minute = parseInt(match[MINUTE_GROUP]); + if (isNaN(minute)) { + minute = constants_1.zhStringToNumber(match[MINUTE_GROUP]); + } + } + } else if (hour > 100) { + minute = hour % 100; + hour = Math.floor(hour / 100); + } + if (minute >= 60) { + return null; + } + if (hour > 24) { + return null; + } + if (hour >= 12) { + meridiem = 1; + } + if (match[AM_PM_HOUR_GROUP]) { + if (hour > 12) + return null; + const ampm = match[AM_PM_HOUR_GROUP][0].toLowerCase(); + if (ampm == "a") { + meridiem = 0; + if (hour == 12) + hour = 0; + } + if (ampm == "p") { + meridiem = 1; + if (hour != 12) + hour += 12; + } + } else if (match[ZH_AM_PM_HOUR_GROUP_1]) { + const zhAMPMString1 = match[ZH_AM_PM_HOUR_GROUP_1]; + const zhAMPM1 = zhAMPMString1[0]; + if (zhAMPM1 == "\u65E9") { + meridiem = 0; + if (hour == 12) + hour = 0; + } else if (zhAMPM1 == "\u665A") { + meridiem = 1; + if (hour != 12) + hour += 12; + } + } else if (match[ZH_AM_PM_HOUR_GROUP_2]) { + const zhAMPMString2 = match[ZH_AM_PM_HOUR_GROUP_2]; + const zhAMPM2 = zhAMPMString2[0]; + if (zhAMPM2 == "\u4E0A" || zhAMPM2 == "\u65E9" || zhAMPM2 == "\u51CC") { + meridiem = 0; + if (hour == 12) + hour = 0; + } else if (zhAMPM2 == "\u4E0B" || zhAMPM2 == "\u665A") { + meridiem = 1; + if (hour != 12) + hour += 12; + } + } else if (match[ZH_AM_PM_HOUR_GROUP_3]) { + const zhAMPMString3 = match[ZH_AM_PM_HOUR_GROUP_3]; + const zhAMPM3 = zhAMPMString3[0]; + if (zhAMPM3 == "\u4E0A" || zhAMPM3 == "\u65E9" || zhAMPM3 == "\u51CC") { + meridiem = 0; + if (hour == 12) + hour = 0; + } else if (zhAMPM3 == "\u4E0B" || zhAMPM3 == "\u665A") { + meridiem = 1; + if (hour != 12) + hour += 12; + } + } + result.start.assign("hour", hour); + result.start.assign("minute", minute); + if (meridiem >= 0) { + result.start.assign("meridiem", meridiem); + } else { + if (hour < 12) { + result.start.imply("meridiem", 0); + } else { + result.start.imply("meridiem", 1); + } + } + match = SECOND_REG_PATTERN.exec(context.text.substring(result.index + result.text.length)); + if (!match) { + if (result.text.match(/^\d+$/)) { + return null; + } + return result; + } + const endMoment = startMoment.clone(); + result.end = context.createParsingComponents(); + if (match[DAY_GROUP_1]) { + const day1 = match[DAY_GROUP_1]; + if (day1 == "\u660E") { + if (refMoment.hour() > 1) { + endMoment.add(1, "day"); + } + } else if (day1 == "\u6628") { + endMoment.add(-1, "day"); + } else if (day1 == "\u524D") { + endMoment.add(-2, "day"); + } else if (day1 == "\u5927\u524D") { + endMoment.add(-3, "day"); + } else if (day1 == "\u540E") { + endMoment.add(2, "day"); + } else if (day1 == "\u5927\u540E") { + endMoment.add(3, "day"); + } + result.end.assign("day", endMoment.date()); + result.end.assign("month", endMoment.month() + 1); + result.end.assign("year", endMoment.year()); + } else if (match[DAY_GROUP_3]) { + const day3 = match[DAY_GROUP_3]; + if (day3 == "\u660E") { + endMoment.add(1, "day"); + } else if (day3 == "\u6628") { + endMoment.add(-1, "day"); + } else if (day3 == "\u524D") { + endMoment.add(-2, "day"); + } else if (day3 == "\u5927\u524D") { + endMoment.add(-3, "day"); + } else if (day3 == "\u540E") { + endMoment.add(2, "day"); + } else if (day3 == "\u5927\u540E") { + endMoment.add(3, "day"); + } + result.end.assign("day", endMoment.date()); + result.end.assign("month", endMoment.month() + 1); + result.end.assign("year", endMoment.year()); + } else { + result.end.imply("day", endMoment.date()); + result.end.imply("month", endMoment.month() + 1); + result.end.imply("year", endMoment.year()); + } + hour = 0; + minute = 0; + meridiem = -1; + if (match[SECOND_GROUP]) { + let second = parseInt(match[SECOND_GROUP]); + if (isNaN(second)) { + second = constants_1.zhStringToNumber(match[SECOND_GROUP]); + } + if (second >= 60) + return null; + result.end.assign("second", second); + } + hour = parseInt(match[HOUR_GROUP]); + if (isNaN(hour)) { + hour = constants_1.zhStringToNumber(match[HOUR_GROUP]); + } + if (match[MINUTE_GROUP]) { + if (match[MINUTE_GROUP] == "\u534A") { + minute = 30; + } else if (match[MINUTE_GROUP] == "\u6B63" || match[MINUTE_GROUP] == "\u6574") { + minute = 0; + } else { + minute = parseInt(match[MINUTE_GROUP]); + if (isNaN(minute)) { + minute = constants_1.zhStringToNumber(match[MINUTE_GROUP]); + } + } + } else if (hour > 100) { + minute = hour % 100; + hour = Math.floor(hour / 100); + } + if (minute >= 60) { + return null; + } + if (hour > 24) { + return null; + } + if (hour >= 12) { + meridiem = 1; + } + if (match[AM_PM_HOUR_GROUP]) { + if (hour > 12) + return null; + const ampm = match[AM_PM_HOUR_GROUP][0].toLowerCase(); + if (ampm == "a") { + meridiem = 0; + if (hour == 12) + hour = 0; + } + if (ampm == "p") { + meridiem = 1; + if (hour != 12) + hour += 12; + } + if (!result.start.isCertain("meridiem")) { + if (meridiem == 0) { + result.start.imply("meridiem", 0); + if (result.start.get("hour") == 12) { + result.start.assign("hour", 0); + } + } else { + result.start.imply("meridiem", 1); + if (result.start.get("hour") != 12) { + result.start.assign("hour", result.start.get("hour") + 12); + } + } + } + } else if (match[ZH_AM_PM_HOUR_GROUP_1]) { + const zhAMPMString1 = match[ZH_AM_PM_HOUR_GROUP_1]; + const zhAMPM1 = zhAMPMString1[0]; + if (zhAMPM1 == "\u65E9") { + meridiem = 0; + if (hour == 12) + hour = 0; + } else if (zhAMPM1 == "\u665A") { + meridiem = 1; + if (hour != 12) + hour += 12; + } + } else if (match[ZH_AM_PM_HOUR_GROUP_2]) { + const zhAMPMString2 = match[ZH_AM_PM_HOUR_GROUP_2]; + const zhAMPM2 = zhAMPMString2[0]; + if (zhAMPM2 == "\u4E0A" || zhAMPM2 == "\u65E9" || zhAMPM2 == "\u51CC") { + meridiem = 0; + if (hour == 12) + hour = 0; + } else if (zhAMPM2 == "\u4E0B" || zhAMPM2 == "\u665A") { + meridiem = 1; + if (hour != 12) + hour += 12; + } + } else if (match[ZH_AM_PM_HOUR_GROUP_3]) { + const zhAMPMString3 = match[ZH_AM_PM_HOUR_GROUP_3]; + const zhAMPM3 = zhAMPMString3[0]; + if (zhAMPM3 == "\u4E0A" || zhAMPM3 == "\u65E9" || zhAMPM3 == "\u51CC") { + meridiem = 0; + if (hour == 12) + hour = 0; + } else if (zhAMPM3 == "\u4E0B" || zhAMPM3 == "\u665A") { + meridiem = 1; + if (hour != 12) + hour += 12; + } + } + result.text = result.text + match[0]; + result.end.assign("hour", hour); + result.end.assign("minute", minute); + if (meridiem >= 0) { + result.end.assign("meridiem", meridiem); + } else { + const startAtPM = result.start.isCertain("meridiem") && result.start.get("meridiem") == 1; + if (startAtPM && result.start.get("hour") > hour) { + result.end.imply("meridiem", 0); + } else if (hour > 12) { + result.end.imply("meridiem", 1); + } + } + if (result.end.date().getTime() < result.start.date().getTime()) { + result.end.imply("day", result.end.get("day") + 1); + } + return result; + } + }; + exports.default = ZHHansTimeExpressionParser; + } +}); + +// node_modules/chrono-node/dist/locales/zh/hans/parsers/ZHHansWeekdayParser.js +var require_ZHHansWeekdayParser = __commonJS({ + "node_modules/chrono-node/dist/locales/zh/hans/parsers/ZHHansWeekdayParser.js"(exports) { + "use strict"; + var __importDefault = exports && exports.__importDefault || function(mod) { + return mod && mod.__esModule ? mod : { "default": mod }; + }; + Object.defineProperty(exports, "__esModule", { value: true }); + var dayjs_1 = __importDefault(require_dayjs_min()); + var AbstractParserWithWordBoundary_1 = require_AbstractParserWithWordBoundary(); + var constants_1 = require_constants8(); + var PATTERN = new RegExp("(?:\u661F\u671F|\u793C\u62DC|\u5468)(?" + Object.keys(constants_1.WEEKDAY_OFFSET).join("|") + ")"); + var ZHHansWeekdayParser = class extends AbstractParserWithWordBoundary_1.AbstractParserWithWordBoundaryChecking { + innerPattern() { + return PATTERN; + } + innerExtract(context, match) { + const result = context.createParsingResult(match.index, match[0]); + const dayOfWeek = match.groups.weekday; + const offset2 = constants_1.WEEKDAY_OFFSET[dayOfWeek]; + if (offset2 === void 0) + return null; + let startMoment = dayjs_1.default(context.refDate); + const startMomentFixed = false; + const refOffset = startMoment.day(); + if (Math.abs(offset2 - 7 - refOffset) < Math.abs(offset2 - refOffset)) { + startMoment = startMoment.day(offset2 - 7); + } else if (Math.abs(offset2 + 7 - refOffset) < Math.abs(offset2 - refOffset)) { + startMoment = startMoment.day(offset2 + 7); + } else { + startMoment = startMoment.day(offset2); + } + result.start.assign("weekday", offset2); + if (startMomentFixed) { + result.start.assign("day", startMoment.date()); + result.start.assign("month", startMoment.month() + 1); + result.start.assign("year", startMoment.year()); + } else { + result.start.imply("day", startMoment.date()); + result.start.imply("month", startMoment.month() + 1); + result.start.imply("year", startMoment.year()); + } + return result; + } + }; + exports.default = ZHHansWeekdayParser; + } +}); + +// node_modules/chrono-node/dist/locales/zh/hans/refiners/ZHHansMergeDateRangeRefiner.js +var require_ZHHansMergeDateRangeRefiner = __commonJS({ + "node_modules/chrono-node/dist/locales/zh/hans/refiners/ZHHansMergeDateRangeRefiner.js"(exports) { + "use strict"; + var __importDefault = exports && exports.__importDefault || function(mod) { + return mod && mod.__esModule ? mod : { "default": mod }; + }; + Object.defineProperty(exports, "__esModule", { value: true }); + var AbstractMergeDateRangeRefiner_1 = __importDefault(require_AbstractMergeDateRangeRefiner()); + var ZHHansMergeDateRangeRefiner = class extends AbstractMergeDateRangeRefiner_1.default { + patternBetween() { + return /^\s*(至|到|-|~|~|-|ー)\s*$/i; + } + }; + exports.default = ZHHansMergeDateRangeRefiner; + } +}); + +// node_modules/chrono-node/dist/locales/zh/hans/refiners/ZHHansMergeDateTimeRefiner.js +var require_ZHHansMergeDateTimeRefiner = __commonJS({ + "node_modules/chrono-node/dist/locales/zh/hans/refiners/ZHHansMergeDateTimeRefiner.js"(exports) { + "use strict"; + var __importDefault = exports && exports.__importDefault || function(mod) { + return mod && mod.__esModule ? mod : { "default": mod }; + }; + Object.defineProperty(exports, "__esModule", { value: true }); + var AbstractMergeDateTimeRefiner_1 = __importDefault(require_AbstractMergeDateTimeRefiner()); + var ZHHansMergeDateTimeRefiner = class extends AbstractMergeDateTimeRefiner_1.default { + patternBetween() { + return /^\s*$/i; + } + }; + exports.default = ZHHansMergeDateTimeRefiner; + } +}); + +// node_modules/chrono-node/dist/locales/zh/hans/index.js +var require_hans = __commonJS({ + "node_modules/chrono-node/dist/locales/zh/hans/index.js"(exports) { + "use strict"; + var __importDefault = exports && exports.__importDefault || function(mod) { + return mod && mod.__esModule ? mod : { "default": mod }; + }; + Object.defineProperty(exports, "__esModule", { value: true }); + exports.createConfiguration = exports.createCasualConfiguration = exports.parseDate = exports.parse = exports.strict = exports.casual = exports.hans = void 0; + var chrono_1 = require_chrono(); + var ExtractTimezoneOffsetRefiner_1 = __importDefault(require_ExtractTimezoneOffsetRefiner()); + var configurations_1 = require_configurations(); + var ZHHansCasualDateParser_1 = __importDefault(require_ZHHansCasualDateParser()); + var ZHHansDateParser_1 = __importDefault(require_ZHHansDateParser()); + var ZHHansDeadlineFormatParser_1 = __importDefault(require_ZHHansDeadlineFormatParser()); + var ZHHansRelationWeekdayParser_1 = __importDefault(require_ZHHansRelationWeekdayParser()); + var ZHHansTimeExpressionParser_1 = __importDefault(require_ZHHansTimeExpressionParser()); + var ZHHansWeekdayParser_1 = __importDefault(require_ZHHansWeekdayParser()); + var ZHHansMergeDateRangeRefiner_1 = __importDefault(require_ZHHansMergeDateRangeRefiner()); + var ZHHansMergeDateTimeRefiner_1 = __importDefault(require_ZHHansMergeDateTimeRefiner()); + exports.hans = new chrono_1.Chrono(createCasualConfiguration()); + exports.casual = new chrono_1.Chrono(createCasualConfiguration()); + exports.strict = new chrono_1.Chrono(createConfiguration()); + function parse4(text2, ref, option) { + return exports.casual.parse(text2, ref, option); + } + exports.parse = parse4; + function parseDate3(text2, ref, option) { + return exports.casual.parseDate(text2, ref, option); + } + exports.parseDate = parseDate3; + function createCasualConfiguration() { + const option = createConfiguration(); + option.parsers.unshift(new ZHHansCasualDateParser_1.default()); + return option; + } + exports.createCasualConfiguration = createCasualConfiguration; + function createConfiguration() { + const configuration = configurations_1.includeCommonConfiguration({ + parsers: [ + new ZHHansDateParser_1.default(), + new ZHHansRelationWeekdayParser_1.default(), + new ZHHansWeekdayParser_1.default(), + new ZHHansTimeExpressionParser_1.default(), + new ZHHansDeadlineFormatParser_1.default() + ], + refiners: [new ZHHansMergeDateRangeRefiner_1.default(), new ZHHansMergeDateTimeRefiner_1.default()] + }); + configuration.refiners = configuration.refiners.filter((refiner) => !(refiner instanceof ExtractTimezoneOffsetRefiner_1.default)); + return configuration; + } + exports.createConfiguration = createConfiguration; + } +}); + +// node_modules/chrono-node/dist/locales/zh/index.js +var require_zh = __commonJS({ + "node_modules/chrono-node/dist/locales/zh/index.js"(exports) { + "use strict"; + var __createBinding = exports && exports.__createBinding || (Object.create ? function(o, m, k, k2) { + if (k2 === void 0) + k2 = k; + Object.defineProperty(o, k2, { enumerable: true, get: function() { + return m[k]; + } }); + } : function(o, m, k, k2) { + if (k2 === void 0) + k2 = k; + o[k2] = m[k]; + }); + var __setModuleDefault = exports && exports.__setModuleDefault || (Object.create ? function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); + } : function(o, v) { + o["default"] = v; + }); + var __exportStar = exports && exports.__exportStar || function(m, exports2) { + for (var p in m) + if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports2, p)) + __createBinding(exports2, m, p); + }; + var __importStar = exports && exports.__importStar || function(mod) { + if (mod && mod.__esModule) + return mod; + var result = {}; + if (mod != null) { + for (var k in mod) + if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) + __createBinding(result, mod, k); + } + __setModuleDefault(result, mod); + return result; + }; + Object.defineProperty(exports, "__esModule", { value: true }); + exports.hans = void 0; + __exportStar(require_hant(), exports); + exports.hans = __importStar(require_hans()); + } +}); + +// node_modules/chrono-node/dist/locales/ru/constants.js +var require_constants9 = __commonJS({ + "node_modules/chrono-node/dist/locales/ru/constants.js"(exports) { + "use strict"; + Object.defineProperty(exports, "__esModule", { value: true }); + exports.parseTimeUnits = exports.TIME_UNITS_PATTERN = exports.parseYear = exports.YEAR_PATTERN = exports.parseOrdinalNumberPattern = exports.ORDINAL_NUMBER_PATTERN = exports.parseNumberPattern = exports.NUMBER_PATTERN = exports.TIME_UNIT_DICTIONARY = exports.ORDINAL_WORD_DICTIONARY = exports.INTEGER_WORD_DICTIONARY = exports.MONTH_DICTIONARY = exports.FULL_MONTH_NAME_DICTIONARY = exports.WEEKDAY_DICTIONARY = exports.REGEX_PARTS = void 0; + var pattern_1 = require_pattern(); + var years_1 = require_years(); + exports.REGEX_PARTS = { + leftBoundary: "([^\\p{L}\\p{N}_]|^)", + rightBoundary: "(?=[^\\p{L}\\p{N}_]|$)", + flags: "iu" + }; + exports.WEEKDAY_DICTIONARY = { + \u0432\u043E\u0441\u043A\u0440\u0435\u0441\u0435\u043D\u044C\u0435: 0, + \u0432\u043E\u0441\u043A\u0440\u0435\u0441\u0435\u043D\u044C\u044F: 0, + \u0432\u0441\u043A: 0, + "\u0432\u0441\u043A.": 0, + \u043F\u043E\u043D\u0435\u0434\u0435\u043B\u044C\u043D\u0438\u043A: 1, + \u043F\u043E\u043D\u0435\u0434\u0435\u043B\u044C\u043D\u0438\u043A\u0430: 1, + \u043F\u043D: 1, + "\u043F\u043D.": 1, + \u0432\u0442\u043E\u0440\u043D\u0438\u043A: 2, + \u0432\u0442\u043E\u0440\u043D\u0438\u043A\u0430: 2, + \u0432\u0442: 2, + "\u0432\u0442.": 2, + \u0441\u0440\u0435\u0434\u0430: 3, + \u0441\u0440\u0435\u0434\u044B: 3, + \u0441\u0440\u0435\u0434\u0443: 3, + \u0441\u0440: 3, + "\u0441\u0440.": 3, + \u0447\u0435\u0442\u0432\u0435\u0440\u0433: 4, + \u0447\u0435\u0442\u0432\u0435\u0440\u0433\u0430: 4, + \u0447\u0442: 4, + "\u0447\u0442.": 4, + \u043F\u044F\u0442\u043D\u0438\u0446\u0430: 5, + \u043F\u044F\u0442\u043D\u0438\u0446\u0443: 5, + \u043F\u044F\u0442\u043D\u0438\u0446\u044B: 5, + \u043F\u0442: 5, + "\u043F\u0442.": 5, + \u0441\u0443\u0431\u0431\u043E\u0442\u0430: 6, + \u0441\u0443\u0431\u0431\u043E\u0442\u0443: 6, + \u0441\u0443\u0431\u0431\u043E\u0442\u044B: 6, + \u0441\u0431: 6, + "\u0441\u0431.": 6 + }; + exports.FULL_MONTH_NAME_DICTIONARY = { + \u044F\u043D\u0432\u0430\u0440\u044C: 1, + \u044F\u043D\u0432\u0430\u0440\u044F: 1, + \u044F\u043D\u0432\u0430\u0440\u0435: 1, + \u0444\u0435\u0432\u0440\u044F\u043B\u044C: 2, + \u0444\u0435\u0432\u0440\u044F\u043B\u044F: 2, + \u0444\u0435\u0432\u0440\u044F\u043B\u0435: 2, + \u043C\u0430\u0440\u0442: 3, + \u043C\u0430\u0440\u0442\u0430: 3, + \u043C\u0430\u0440\u0442\u0435: 3, + \u0430\u043F\u0440\u0435\u043B\u044C: 4, + \u0430\u043F\u0440\u0435\u043B\u044F: 4, + \u0430\u043F\u0440\u0435\u043B\u0435: 4, + \u043C\u0430\u0439: 5, + \u043C\u0430\u044F: 5, + \u043C\u0430\u0435: 5, + \u0438\u044E\u043D\u044C: 6, + \u0438\u044E\u043D\u044F: 6, + \u0438\u044E\u043D\u0435: 6, + \u0438\u044E\u043B\u044C: 7, + \u0438\u044E\u043B\u044F: 7, + \u0438\u044E\u043B\u0435: 7, + \u0430\u0432\u0433\u0443\u0441\u0442: 8, + \u0430\u0432\u0433\u0443\u0441\u0442\u0430: 8, + \u0430\u0432\u0433\u0443\u0441\u0442\u0435: 8, + \u0441\u0435\u043D\u0442\u044F\u0431\u0440\u044C: 9, + \u0441\u0435\u043D\u0442\u044F\u0431\u0440\u044F: 9, + \u0441\u0435\u043D\u0442\u044F\u0431\u0440\u0435: 9, + \u043E\u043A\u0442\u044F\u0431\u0440\u044C: 10, + \u043E\u043A\u0442\u044F\u0431\u0440\u044F: 10, + \u043E\u043A\u0442\u044F\u0431\u0440\u0435: 10, + \u043D\u043E\u044F\u0431\u0440\u044C: 11, + \u043D\u043E\u044F\u0431\u0440\u044F: 11, + \u043D\u043E\u044F\u0431\u0440\u0435: 11, + \u0434\u0435\u043A\u0430\u0431\u0440\u044C: 12, + \u0434\u0435\u043A\u0430\u0431\u0440\u044F: 12, + \u0434\u0435\u043A\u0430\u0431\u0440\u0435: 12 + }; + exports.MONTH_DICTIONARY = Object.assign(Object.assign({}, exports.FULL_MONTH_NAME_DICTIONARY), { \u044F\u043D\u0432: 1, "\u044F\u043D\u0432.": 1, \u0444\u0435\u0432: 2, "\u0444\u0435\u0432.": 2, \u043C\u0430\u0440: 3, "\u043C\u0430\u0440.": 3, \u0430\u043F\u0440: 4, "\u0430\u043F\u0440.": 4, \u0430\u0432\u0433: 8, "\u0430\u0432\u0433.": 8, \u0441\u0435\u043D: 9, "\u0441\u0435\u043D.": 9, \u043E\u043A\u0442: 10, "\u043E\u043A\u0442.": 10, \u043D\u043E\u044F: 11, "\u043D\u043E\u044F.": 11, \u0434\u0435\u043A: 12, "\u0434\u0435\u043A.": 12 }); + exports.INTEGER_WORD_DICTIONARY = { + \u043E\u0434\u0438\u043D: 1, + \u043E\u0434\u043D\u0430: 1, + \u043E\u0434\u043D\u043E\u0439: 1, + \u043E\u0434\u043D\u0443: 1, + \u0434\u0432\u0435: 2, + \u0434\u0432\u0430: 2, + \u0434\u0432\u0443\u0445: 2, + \u0442\u0440\u0438: 3, + \u0442\u0440\u0435\u0445: 3, + \u0442\u0440\u0451\u0445: 3, + \u0447\u0435\u0442\u044B\u0440\u0435: 4, + \u0447\u0435\u0442\u044B\u0440\u0435\u0445: 4, + \u0447\u0435\u0442\u044B\u0440\u0451\u0445: 4, + \u043F\u044F\u0442\u044C: 5, + \u043F\u044F\u0442\u0438: 5, + \u0448\u0435\u0441\u0442\u044C: 6, + \u0448\u0435\u0441\u0442\u0438: 6, + \u0441\u0435\u043C\u044C: 7, + \u0441\u0435\u043C\u0438: 7, + \u0432\u043E\u0441\u0435\u043C\u044C: 8, + \u0432\u043E\u0441\u0435\u043C\u044C\u043C\u0438: 8, + \u0434\u0435\u0432\u044F\u0442\u044C: 9, + \u0434\u0435\u0432\u044F\u0442\u0438: 9, + \u0434\u0435\u0441\u044F\u0442\u044C: 10, + \u0434\u0435\u0441\u044F\u0442\u0438: 10, + \u043E\u0434\u0438\u043D\u043D\u0430\u0434\u0446\u0430\u0442\u044C: 11, + \u043E\u0434\u0438\u043D\u043D\u0430\u0434\u0446\u0430\u0442\u0438: 11, + \u0434\u0432\u0435\u043D\u0430\u0434\u0446\u0430\u0442\u044C: 12, + \u0434\u0432\u0435\u043D\u0430\u0434\u0446\u0430\u0442\u0438: 12 + }; + exports.ORDINAL_WORD_DICTIONARY = { + \u043F\u0435\u0440\u0432\u043E\u0435: 1, + \u043F\u0435\u0440\u0432\u043E\u0433\u043E: 1, + \u0432\u0442\u043E\u0440\u043E\u0435: 2, + \u0432\u0442\u043E\u0440\u043E\u0433\u043E: 2, + \u0442\u0440\u0435\u0442\u044C\u0435: 3, + \u0442\u0440\u0435\u0442\u044C\u0435\u0433\u043E: 3, + \u0447\u0435\u0442\u0432\u0435\u0440\u0442\u043E\u0435: 4, + \u0447\u0435\u0442\u0432\u0435\u0440\u0442\u043E\u0433\u043E: 4, + \u043F\u044F\u0442\u043E\u0435: 5, + \u043F\u044F\u0442\u043E\u0433\u043E: 5, + \u0448\u0435\u0441\u0442\u043E\u0435: 6, + \u0448\u0435\u0441\u0442\u043E\u0433\u043E: 6, + \u0441\u0435\u0434\u044C\u043C\u043E\u0435: 7, + \u0441\u0435\u0434\u044C\u043C\u043E\u0433\u043E: 7, + \u0432\u043E\u0441\u044C\u043C\u043E\u0435: 8, + \u0432\u043E\u0441\u044C\u043C\u043E\u0433\u043E: 8, + \u0434\u0435\u0432\u044F\u0442\u043E\u0435: 9, + \u0434\u0435\u0432\u044F\u0442\u043E\u0433\u043E: 9, + \u0434\u0435\u0441\u044F\u0442\u043E\u0435: 10, + \u0434\u0435\u0441\u044F\u0442\u043E\u0433\u043E: 10, + \u043E\u0434\u0438\u043D\u043D\u0430\u0434\u0446\u0430\u0442\u043E\u0435: 11, + \u043E\u0434\u0438\u043D\u043D\u0430\u0434\u0446\u0430\u0442\u043E\u0433\u043E: 11, + \u0434\u0432\u0435\u043D\u0430\u0434\u0446\u0430\u0442\u043E\u0435: 12, + \u0434\u0432\u0435\u043D\u0430\u0434\u0446\u0430\u0442\u043E\u0433\u043E: 12, + \u0442\u0440\u0438\u043D\u0430\u0434\u0446\u0430\u0442\u043E\u0435: 13, + \u0442\u0440\u0438\u043D\u0430\u0434\u0446\u0430\u0442\u043E\u0433\u043E: 13, + \u0447\u0435\u0442\u044B\u0440\u043D\u0430\u0434\u0446\u0430\u0442\u043E\u0435: 14, + \u0447\u0435\u0442\u044B\u0440\u043D\u0430\u0434\u0446\u0430\u0442\u043E\u0433\u043E: 14, + \u043F\u044F\u0442\u043D\u0430\u0434\u0446\u0430\u0442\u043E\u0435: 15, + \u043F\u044F\u0442\u043D\u0430\u0434\u0446\u0430\u0442\u043E\u0433\u043E: 15, + \u0448\u0435\u0441\u0442\u043D\u0430\u0434\u0446\u0430\u0442\u043E\u0435: 16, + \u0448\u0435\u0441\u0442\u043D\u0430\u0434\u0446\u0430\u0442\u043E\u0433\u043E: 16, + \u0441\u0435\u043C\u043D\u0430\u0434\u0446\u0430\u0442\u043E\u0435: 17, + \u0441\u0435\u043C\u043D\u0430\u0434\u0446\u0430\u0442\u043E\u0433\u043E: 17, + \u0432\u043E\u0441\u0435\u043C\u043D\u0430\u0434\u0446\u0430\u0442\u043E\u0435: 18, + \u0432\u043E\u0441\u0435\u043C\u043D\u0430\u0434\u0446\u0430\u0442\u043E\u0433\u043E: 18, + \u0434\u0435\u0432\u044F\u0442\u043D\u0430\u0434\u0446\u0430\u0442\u043E\u0435: 19, + \u0434\u0435\u0432\u044F\u0442\u043D\u0430\u0434\u0446\u0430\u0442\u043E\u0433\u043E: 19, + \u0434\u0432\u0430\u0434\u0446\u0430\u0442\u043E\u0435: 20, + \u0434\u0432\u0430\u0434\u0446\u0430\u0442\u043E\u0433\u043E: 20, + "\u0434\u0432\u0430\u0434\u0446\u0430\u0442\u044C \u043F\u0435\u0440\u0432\u043E\u0435": 21, + "\u0434\u0432\u0430\u0434\u0446\u0430\u0442\u044C \u043F\u0435\u0440\u0432\u043E\u0433\u043E": 21, + "\u0434\u0432\u0430\u0434\u0446\u0430\u0442\u044C \u0432\u0442\u043E\u0440\u043E\u0435": 22, + "\u0434\u0432\u0430\u0434\u0446\u0430\u0442\u044C \u0432\u0442\u043E\u0440\u043E\u0433\u043E": 22, + "\u0434\u0432\u0430\u0434\u0446\u0430\u0442\u044C \u0442\u0440\u0435\u0442\u044C\u0435": 23, + "\u0434\u0432\u0430\u0434\u0446\u0430\u0442\u044C \u0442\u0440\u0435\u0442\u044C\u0435\u0433\u043E": 23, + "\u0434\u0432\u0430\u0434\u0446\u0430\u0442\u044C \u0447\u0435\u0442\u0432\u0435\u0440\u0442\u043E\u0435": 24, + "\u0434\u0432\u0430\u0434\u0446\u0430\u0442\u044C \u0447\u0435\u0442\u0432\u0435\u0440\u0442\u043E\u0433\u043E": 24, + "\u0434\u0432\u0430\u0434\u0446\u0430\u0442\u044C \u043F\u044F\u0442\u043E\u0435": 25, + "\u0434\u0432\u0430\u0434\u0446\u0430\u0442\u044C \u043F\u044F\u0442\u043E\u0433\u043E": 25, + "\u0434\u0432\u0430\u0434\u0446\u0430\u0442\u044C \u0448\u0435\u0441\u0442\u043E\u0435": 26, + "\u0434\u0432\u0430\u0434\u0446\u0430\u0442\u044C \u0448\u0435\u0441\u0442\u043E\u0433\u043E": 26, + "\u0434\u0432\u0430\u0434\u0446\u0430\u0442\u044C \u0441\u0435\u0434\u044C\u043C\u043E\u0435": 27, + "\u0434\u0432\u0430\u0434\u0446\u0430\u0442\u044C \u0441\u0435\u0434\u044C\u043C\u043E\u0433\u043E": 27, + "\u0434\u0432\u0430\u0434\u0446\u0430\u0442\u044C \u0432\u043E\u0441\u044C\u043C\u043E\u0435": 28, + "\u0434\u0432\u0430\u0434\u0446\u0430\u0442\u044C \u0432\u043E\u0441\u044C\u043C\u043E\u0433\u043E": 28, + "\u0434\u0432\u0430\u0434\u0446\u0430\u0442\u044C \u0434\u0435\u0432\u044F\u0442\u043E\u0435": 29, + "\u0434\u0432\u0430\u0434\u0446\u0430\u0442\u044C \u0434\u0435\u0432\u044F\u0442\u043E\u0433\u043E": 29, + "\u0442\u0440\u0438\u0434\u0446\u0430\u0442\u043E\u0435": 30, + "\u0442\u0440\u0438\u0434\u0446\u0430\u0442\u043E\u0433\u043E": 30, + "\u0442\u0440\u0438\u0434\u0446\u0430\u0442\u044C \u043F\u0435\u0440\u0432\u043E\u0435": 31, + "\u0442\u0440\u0438\u0434\u0446\u0430\u0442\u044C \u043F\u0435\u0440\u0432\u043E\u0433\u043E": 31 + }; + exports.TIME_UNIT_DICTIONARY = { + \u0441\u0435\u043A: "second", + \u0441\u0435\u043A\u0443\u043D\u0434\u0430: "second", + \u0441\u0435\u043A\u0443\u043D\u0434: "second", + \u0441\u0435\u043A\u0443\u043D\u0434\u044B: "second", + \u0441\u0435\u043A\u0443\u043D\u0434\u0443: "second", + \u0441\u0435\u043A\u0443\u043D\u0434\u043E\u0447\u043A\u0430: "second", + \u0441\u0435\u043A\u0443\u043D\u0434\u043E\u0447\u043A\u0438: "second", + \u0441\u0435\u043A\u0443\u043D\u0434\u043E\u0447\u0435\u043A: "second", + \u0441\u0435\u043A\u0443\u043D\u0434\u043E\u0447\u043A\u0443: "second", + \u043C\u0438\u043D: "minute", + \u043C\u0438\u043D\u0443\u0442\u0430: "minute", + \u043C\u0438\u043D\u0443\u0442: "minute", + \u043C\u0438\u043D\u0443\u0442\u044B: "minute", + \u043C\u0438\u043D\u0443\u0442\u0443: "minute", + \u043C\u0438\u043D\u0443\u0442\u043E\u043A: "minute", + \u043C\u0438\u043D\u0443\u0442\u043A\u0438: "minute", + \u043C\u0438\u043D\u0443\u0442\u043A\u0443: "minute", + \u0447\u0430\u0441: "hour", + \u0447\u0430\u0441\u043E\u0432: "hour", + \u0447\u0430\u0441\u0430: "hour", + \u0447\u0430\u0441\u0443: "hour", + \u0447\u0430\u0441\u0438\u043A\u043E\u0432: "hour", + \u0447\u0430\u0441\u0438\u043A\u0430: "hour", + \u0447\u0430\u0441\u0438\u043A\u0435: "hour", + \u0447\u0430\u0441\u0438\u043A: "hour", + \u0434\u0435\u043D\u044C: "d", + \u0434\u043D\u044F: "d", + \u0434\u043D\u0435\u0439: "d", + \u0441\u0443\u0442\u043E\u043A: "d", + \u0441\u0443\u0442\u043A\u0438: "d", + \u043D\u0435\u0434\u0435\u043B\u044F: "week", + \u043D\u0435\u0434\u0435\u043B\u0435: "week", + \u043D\u0435\u0434\u0435\u043B\u0438: "week", + \u043D\u0435\u0434\u0435\u043B\u044E: "week", + \u043D\u0435\u0434\u0435\u043B\u044C: "week", + \u043D\u0435\u0434\u0435\u043B\u044C\u043A\u0435: "week", + \u043D\u0435\u0434\u0435\u043B\u044C\u043A\u0438: "week", + \u043D\u0435\u0434\u0435\u043B\u0435\u043A: "week", + \u043C\u0435\u0441\u044F\u0446: "month", + \u043C\u0435\u0441\u044F\u0446\u0435: "month", + \u043C\u0435\u0441\u044F\u0446\u0435\u0432: "month", + \u043C\u0435\u0441\u044F\u0446\u0430: "month", + \u043A\u0432\u0430\u0440\u0442\u0430\u043B: "quarter", + \u043A\u0432\u0430\u0440\u0442\u0430\u043B\u0435: "quarter", + \u043A\u0432\u0430\u0440\u0442\u0430\u043B\u043E\u0432: "quarter", + \u0433\u043E\u0434: "year", + \u0433\u043E\u0434\u0430: "year", + \u0433\u043E\u0434\u0443: "year", + \u0433\u043E\u0434\u043E\u0432: "year", + \u043B\u0435\u0442: "year", + \u0433\u043E\u0434\u0438\u043A: "year", + \u0433\u043E\u0434\u0438\u043A\u0430: "year", + \u0433\u043E\u0434\u0438\u043A\u043E\u0432: "year" + }; + exports.NUMBER_PATTERN = `(?:${pattern_1.matchAnyPattern(exports.INTEGER_WORD_DICTIONARY)}|[0-9]+|[0-9]+\\.[0-9]+|\u043F\u043E\u043B|\u043D\u0435\u0441\u043A\u043E\u043B\u044C\u043A\u043E|\u043F\u0430\u0440(?:\u044B|\u0443)|\\s{0,3})`; + function parseNumberPattern(match) { + const num = match.toLowerCase(); + if (exports.INTEGER_WORD_DICTIONARY[num] !== void 0) { + return exports.INTEGER_WORD_DICTIONARY[num]; + } + if (num.match(/несколько/)) { + return 3; + } else if (num.match(/пол/)) { + return 0.5; + } else if (num.match(/пар/)) { + return 2; + } else if (num === "") { + return 1; + } + return parseFloat(num); + } + exports.parseNumberPattern = parseNumberPattern; + exports.ORDINAL_NUMBER_PATTERN = `(?:${pattern_1.matchAnyPattern(exports.ORDINAL_WORD_DICTIONARY)}|[0-9]{1,2}(?:\u0433\u043E|\u043E\u0433\u043E|\u0435|\u043E\u0435)?)`; + function parseOrdinalNumberPattern(match) { + let num = match.toLowerCase(); + if (exports.ORDINAL_WORD_DICTIONARY[num] !== void 0) { + return exports.ORDINAL_WORD_DICTIONARY[num]; + } + num = num.replace(/(?:st|nd|rd|th)$/i, ""); + return parseInt(num); + } + exports.parseOrdinalNumberPattern = parseOrdinalNumberPattern; + var year = "(?:\\s+(?:\u0433\u043E\u0434\u0443|\u0433\u043E\u0434\u0430|\u0433\u043E\u0434|\u0433|\u0433.))?"; + exports.YEAR_PATTERN = `(?:[1-9][0-9]{0,3}${year}\\s*(?:\u043D.\u044D.|\u0434\u043E \u043D.\u044D.|\u043D. \u044D.|\u0434\u043E \u043D. \u044D.)|[1-2][0-9]{3}${year}|[5-9][0-9]${year})`; + function parseYear(match) { + if (/(год|года|г|г.)/i.test(match)) { + match = match.replace(/(год|года|г|г.)/i, ""); + } + if (/(до н.э.|до н. э.)/i.test(match)) { + match = match.replace(/(до н.э.|до н. э.)/i, ""); + return -parseInt(match); + } + if (/(н. э.|н.э.)/i.test(match)) { + match = match.replace(/(н. э.|н.э.)/i, ""); + return parseInt(match); + } + const rawYearNumber = parseInt(match); + return years_1.findMostLikelyADYear(rawYearNumber); + } + exports.parseYear = parseYear; + var SINGLE_TIME_UNIT_PATTERN = `(${exports.NUMBER_PATTERN})\\s{0,3}(${pattern_1.matchAnyPattern(exports.TIME_UNIT_DICTIONARY)})`; + var SINGLE_TIME_UNIT_REGEX = new RegExp(SINGLE_TIME_UNIT_PATTERN, "i"); + exports.TIME_UNITS_PATTERN = pattern_1.repeatedTimeunitPattern(`(?:(?:\u043E\u043A\u043E\u043B\u043E|\u043F\u0440\u0438\u043C\u0435\u0440\u043D\u043E)\\s{0,3})?`, SINGLE_TIME_UNIT_PATTERN); + function parseTimeUnits(timeunitText) { + const fragments = {}; + let remainingText = timeunitText; + let match = SINGLE_TIME_UNIT_REGEX.exec(remainingText); + while (match) { + collectDateTimeFragment(fragments, match); + remainingText = remainingText.substring(match[0].length).trim(); + match = SINGLE_TIME_UNIT_REGEX.exec(remainingText); + } + return fragments; + } + exports.parseTimeUnits = parseTimeUnits; + function collectDateTimeFragment(fragments, match) { + const num = parseNumberPattern(match[1]); + const unit = exports.TIME_UNIT_DICTIONARY[match[2].toLowerCase()]; + fragments[unit] = num; + } + } +}); + +// node_modules/chrono-node/dist/locales/ru/parsers/RUTimeUnitWithinFormatParser.js +var require_RUTimeUnitWithinFormatParser = __commonJS({ + "node_modules/chrono-node/dist/locales/ru/parsers/RUTimeUnitWithinFormatParser.js"(exports) { + "use strict"; + Object.defineProperty(exports, "__esModule", { value: true }); + var constants_1 = require_constants9(); + var results_1 = require_results(); + var AbstractParserWithWordBoundary_1 = require_AbstractParserWithWordBoundary(); + var PATTERN = `(?:(?:\u043E\u043A\u043E\u043B\u043E|\u043F\u0440\u0438\u043C\u0435\u0440\u043D\u043E)\\s*(?:~\\s*)?)?(${constants_1.TIME_UNITS_PATTERN})${constants_1.REGEX_PARTS.rightBoundary}`; + var PATTERN_WITH_PREFIX = new RegExp(`(?:\u0432 \u0442\u0435\u0447\u0435\u043D\u0438\u0435|\u0432 \u0442\u0435\u0447\u0435\u043D\u0438\u0438)\\s*${PATTERN}`, constants_1.REGEX_PARTS.flags); + var PATTERN_WITHOUT_PREFIX = new RegExp(PATTERN, "i"); + var RUTimeUnitWithinFormatParser = class extends AbstractParserWithWordBoundary_1.AbstractParserWithWordBoundaryChecking { + patternLeftBoundary() { + return constants_1.REGEX_PARTS.leftBoundary; + } + innerPattern(context) { + return context.option.forwardDate ? PATTERN_WITHOUT_PREFIX : PATTERN_WITH_PREFIX; + } + innerExtract(context, match) { + const timeUnits = constants_1.parseTimeUnits(match[1]); + return results_1.ParsingComponents.createRelativeFromReference(context.reference, timeUnits); + } + }; + exports.default = RUTimeUnitWithinFormatParser; + } +}); + +// node_modules/chrono-node/dist/locales/ru/parsers/RUMonthNameLittleEndianParser.js +var require_RUMonthNameLittleEndianParser = __commonJS({ + "node_modules/chrono-node/dist/locales/ru/parsers/RUMonthNameLittleEndianParser.js"(exports) { + "use strict"; + Object.defineProperty(exports, "__esModule", { value: true }); + var years_1 = require_years(); + var constants_1 = require_constants9(); + var constants_2 = require_constants9(); + var constants_3 = require_constants9(); + var pattern_1 = require_pattern(); + var AbstractParserWithWordBoundary_1 = require_AbstractParserWithWordBoundary(); + var PATTERN = new RegExp(`(?:\u0441)?\\s*(${constants_3.ORDINAL_NUMBER_PATTERN})(?:\\s{0,3}(?:\u043F\u043E|-|\u2013|\u0434\u043E)?\\s{0,3}(${constants_3.ORDINAL_NUMBER_PATTERN}))?(?:-|\\/|\\s{0,3}(?:of)?\\s{0,3})(${pattern_1.matchAnyPattern(constants_1.MONTH_DICTIONARY)})(?:(?:-|\\/|,?\\s{0,3})(${constants_2.YEAR_PATTERN}(?![^\\s]\\d)))?${constants_1.REGEX_PARTS.rightBoundary}`, constants_1.REGEX_PARTS.flags); + var DATE_GROUP = 1; + var DATE_TO_GROUP = 2; + var MONTH_NAME_GROUP = 3; + var YEAR_GROUP = 4; + var RUMonthNameLittleEndianParser = class extends AbstractParserWithWordBoundary_1.AbstractParserWithWordBoundaryChecking { + patternLeftBoundary() { + return constants_1.REGEX_PARTS.leftBoundary; + } + innerPattern() { + return PATTERN; + } + innerExtract(context, match) { + const result = context.createParsingResult(match.index, match[0]); + const month = constants_1.MONTH_DICTIONARY[match[MONTH_NAME_GROUP].toLowerCase()]; + const day = constants_3.parseOrdinalNumberPattern(match[DATE_GROUP]); + if (day > 31) { + match.index = match.index + match[DATE_GROUP].length; + return null; + } + result.start.assign("month", month); + result.start.assign("day", day); + if (match[YEAR_GROUP]) { + const yearNumber = constants_2.parseYear(match[YEAR_GROUP]); + result.start.assign("year", yearNumber); + } else { + const year = years_1.findYearClosestToRef(context.refDate, day, month); + result.start.imply("year", year); + } + if (match[DATE_TO_GROUP]) { + const endDate = constants_3.parseOrdinalNumberPattern(match[DATE_TO_GROUP]); + result.end = result.start.clone(); + result.end.assign("day", endDate); + } + return result; + } + }; + exports.default = RUMonthNameLittleEndianParser; + } +}); + +// node_modules/chrono-node/dist/locales/ru/parsers/RUMonthNameParser.js +var require_RUMonthNameParser = __commonJS({ + "node_modules/chrono-node/dist/locales/ru/parsers/RUMonthNameParser.js"(exports) { + "use strict"; + Object.defineProperty(exports, "__esModule", { value: true }); + var constants_1 = require_constants9(); + var years_1 = require_years(); + var pattern_1 = require_pattern(); + var constants_2 = require_constants9(); + var AbstractParserWithWordBoundary_1 = require_AbstractParserWithWordBoundary(); + var PATTERN = new RegExp(`((?:\u0432)\\s*)?(${pattern_1.matchAnyPattern(constants_1.MONTH_DICTIONARY)})\\s*(?:[,-]?\\s*(${constants_2.YEAR_PATTERN})?)?(?=[^\\s\\w]|\\s+[^0-9]|\\s+$|$)`, constants_1.REGEX_PARTS.flags); + var MONTH_NAME_GROUP = 2; + var YEAR_GROUP = 3; + var RUMonthNameParser = class extends AbstractParserWithWordBoundary_1.AbstractParserWithWordBoundaryChecking { + patternLeftBoundary() { + return constants_1.REGEX_PARTS.leftBoundary; + } + innerPattern() { + return PATTERN; + } + innerExtract(context, match) { + const monthName = match[MONTH_NAME_GROUP].toLowerCase(); + if (match[0].length <= 3 && !constants_1.FULL_MONTH_NAME_DICTIONARY[monthName]) { + return null; + } + const result = context.createParsingResult(match.index, match.index + match[0].length); + result.start.imply("day", 1); + const month = constants_1.MONTH_DICTIONARY[monthName]; + result.start.assign("month", month); + if (match[YEAR_GROUP]) { + const year = constants_2.parseYear(match[YEAR_GROUP]); + result.start.assign("year", year); + } else { + const year = years_1.findYearClosestToRef(context.refDate, 1, month); + result.start.imply("year", year); + } + return result; + } + }; + exports.default = RUMonthNameParser; + } +}); + +// node_modules/chrono-node/dist/locales/ru/parsers/RUTimeExpressionParser.js +var require_RUTimeExpressionParser = __commonJS({ + "node_modules/chrono-node/dist/locales/ru/parsers/RUTimeExpressionParser.js"(exports) { + "use strict"; + Object.defineProperty(exports, "__esModule", { value: true }); + var index_1 = require_dist(); + var AbstractTimeExpressionParser_1 = require_AbstractTimeExpressionParser(); + var constants_1 = require_constants9(); + var RUTimeExpressionParser = class extends AbstractTimeExpressionParser_1.AbstractTimeExpressionParser { + constructor(strictMode) { + super(strictMode); + } + patternFlags() { + return constants_1.REGEX_PARTS.flags; + } + primaryPatternLeftBoundary() { + return `(^|\\s|T|(?:[^\\p{L}\\p{N}_]))`; + } + followingPhase() { + return `\\s*(?:\\-|\\\u2013|\\~|\\\u301C|\u0434\u043E|\u0438|\u043F\u043E|\\?)\\s*`; + } + primaryPrefix() { + return `(?:(?:\u0432|\u0441)\\s*)??`; + } + primarySuffix() { + return `(?:\\s*(?:\u0443\u0442\u0440\u0430|\u0432\u0435\u0447\u0435\u0440\u0430|\u043F\u043E\u0441\u043B\u0435 \u043F\u043E\u043B\u0443\u0434\u043D\u044F))?(?!\\/)${constants_1.REGEX_PARTS.rightBoundary}`; + } + extractPrimaryTimeComponents(context, match) { + const components = super.extractPrimaryTimeComponents(context, match); + if (components) { + if (match[0].endsWith("\u0432\u0435\u0447\u0435\u0440\u0430")) { + const hour = components.get("hour"); + if (hour >= 6 && hour < 12) { + components.assign("hour", components.get("hour") + 12); + components.assign("meridiem", index_1.Meridiem.PM); + } else if (hour < 6) { + components.assign("meridiem", index_1.Meridiem.AM); + } + } + if (match[0].endsWith("\u043F\u043E\u0441\u043B\u0435 \u043F\u043E\u043B\u0443\u0434\u043D\u044F")) { + components.assign("meridiem", index_1.Meridiem.PM); + const hour = components.get("hour"); + if (hour >= 0 && hour <= 6) { + components.assign("hour", components.get("hour") + 12); + } + } + if (match[0].endsWith("\u0443\u0442\u0440\u0430")) { + components.assign("meridiem", index_1.Meridiem.AM); + const hour = components.get("hour"); + if (hour < 12) { + components.assign("hour", components.get("hour")); + } + } + } + return components; + } + }; + exports.default = RUTimeExpressionParser; + } +}); + +// node_modules/chrono-node/dist/locales/ru/parsers/RUTimeUnitAgoFormatParser.js +var require_RUTimeUnitAgoFormatParser = __commonJS({ + "node_modules/chrono-node/dist/locales/ru/parsers/RUTimeUnitAgoFormatParser.js"(exports) { + "use strict"; + Object.defineProperty(exports, "__esModule", { value: true }); + var constants_1 = require_constants9(); + var results_1 = require_results(); + var AbstractParserWithWordBoundary_1 = require_AbstractParserWithWordBoundary(); + var timeunits_1 = require_timeunits(); + var PATTERN = new RegExp(`(${constants_1.TIME_UNITS_PATTERN})\\s{0,5}\u043D\u0430\u0437\u0430\u0434(?=(?:\\W|$))`, constants_1.REGEX_PARTS.flags); + var RUTimeUnitAgoFormatParser = class extends AbstractParserWithWordBoundary_1.AbstractParserWithWordBoundaryChecking { + patternLeftBoundary() { + return constants_1.REGEX_PARTS.leftBoundary; + } + innerPattern() { + return PATTERN; + } + innerExtract(context, match) { + const timeUnits = constants_1.parseTimeUnits(match[1]); + const outputTimeUnits = timeunits_1.reverseTimeUnits(timeUnits); + return results_1.ParsingComponents.createRelativeFromReference(context.reference, outputTimeUnits); + } + }; + exports.default = RUTimeUnitAgoFormatParser; + } +}); + +// node_modules/chrono-node/dist/locales/ru/refiners/RUMergeDateRangeRefiner.js +var require_RUMergeDateRangeRefiner = __commonJS({ + "node_modules/chrono-node/dist/locales/ru/refiners/RUMergeDateRangeRefiner.js"(exports) { + "use strict"; + var __importDefault = exports && exports.__importDefault || function(mod) { + return mod && mod.__esModule ? mod : { "default": mod }; + }; + Object.defineProperty(exports, "__esModule", { value: true }); + var AbstractMergeDateRangeRefiner_1 = __importDefault(require_AbstractMergeDateRangeRefiner()); + var xf = class extends AbstractMergeDateRangeRefiner_1.default { + patternBetween() { + return /^\s*(и до|и по|до|по|-)\s*$/i; + } + }; + exports.default = xf; + } +}); + +// node_modules/chrono-node/dist/locales/ru/refiners/RUMergeDateTimeRefiner.js +var require_RUMergeDateTimeRefiner = __commonJS({ + "node_modules/chrono-node/dist/locales/ru/refiners/RUMergeDateTimeRefiner.js"(exports) { + "use strict"; + var __importDefault = exports && exports.__importDefault || function(mod) { + return mod && mod.__esModule ? mod : { "default": mod }; + }; + Object.defineProperty(exports, "__esModule", { value: true }); + var AbstractMergeDateTimeRefiner_1 = __importDefault(require_AbstractMergeDateTimeRefiner()); + var RUMergeDateTimeRefiner = class extends AbstractMergeDateTimeRefiner_1.default { + patternBetween() { + return new RegExp(`^\\s*(T|\u0432|,|-)?\\s*$`); + } + }; + exports.default = RUMergeDateTimeRefiner; + } +}); + +// node_modules/chrono-node/dist/locales/ru/parsers/RUCasualDateParser.js +var require_RUCasualDateParser = __commonJS({ + "node_modules/chrono-node/dist/locales/ru/parsers/RUCasualDateParser.js"(exports) { + "use strict"; + var __createBinding = exports && exports.__createBinding || (Object.create ? function(o, m, k, k2) { + if (k2 === void 0) + k2 = k; + Object.defineProperty(o, k2, { enumerable: true, get: function() { + return m[k]; + } }); + } : function(o, m, k, k2) { + if (k2 === void 0) + k2 = k; + o[k2] = m[k]; + }); + var __setModuleDefault = exports && exports.__setModuleDefault || (Object.create ? function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); + } : function(o, v) { + o["default"] = v; + }); + var __importStar = exports && exports.__importStar || function(mod) { + if (mod && mod.__esModule) + return mod; + var result = {}; + if (mod != null) { + for (var k in mod) + if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) + __createBinding(result, mod, k); + } + __setModuleDefault(result, mod); + return result; + }; + Object.defineProperty(exports, "__esModule", { value: true }); + var AbstractParserWithWordBoundary_1 = require_AbstractParserWithWordBoundary(); + var references = __importStar(require_casualReferences()); + var constants_1 = require_constants9(); + var PATTERN = new RegExp(`(?:\u0441|\u0441\u043E)?\\s*(\u0441\u0435\u0433\u043E\u0434\u043D\u044F|\u0432\u0447\u0435\u0440\u0430|\u0437\u0430\u0432\u0442\u0440\u0430|\u043F\u043E\u0441\u043B\u0435\u0437\u0430\u0432\u0442\u0440\u0430|\u043F\u043E\u0437\u0430\u0432\u0447\u0435\u0440\u0430)${constants_1.REGEX_PARTS.rightBoundary}`, constants_1.REGEX_PARTS.flags); + var RUCasualDateParser = class extends AbstractParserWithWordBoundary_1.AbstractParserWithWordBoundaryChecking { + patternLeftBoundary() { + return constants_1.REGEX_PARTS.leftBoundary; + } + innerPattern(context) { + return PATTERN; + } + innerExtract(context, match) { + const lowerText = match[1].toLowerCase(); + const component = context.createParsingComponents(); + switch (lowerText) { + case "\u0441\u0435\u0433\u043E\u0434\u043D\u044F": + return references.today(context.reference); + case "\u0432\u0447\u0435\u0440\u0430": + return references.yesterday(context.reference); + case "\u0437\u0430\u0432\u0442\u0440\u0430": + return references.tomorrow(context.reference); + case "\u043F\u043E\u0441\u043B\u0435\u0437\u0430\u0432\u0442\u0440\u0430": + return references.theDayAfter(context.reference, 2); + case "\u043F\u043E\u0437\u0430\u0432\u0447\u0435\u0440\u0430": + return references.theDayBefore(context.reference, 2); + } + return component; + } + }; + exports.default = RUCasualDateParser; + } +}); + +// node_modules/chrono-node/dist/locales/ru/parsers/RUCasualTimeParser.js +var require_RUCasualTimeParser = __commonJS({ + "node_modules/chrono-node/dist/locales/ru/parsers/RUCasualTimeParser.js"(exports) { + "use strict"; + var __createBinding = exports && exports.__createBinding || (Object.create ? function(o, m, k, k2) { + if (k2 === void 0) + k2 = k; + Object.defineProperty(o, k2, { enumerable: true, get: function() { + return m[k]; + } }); + } : function(o, m, k, k2) { + if (k2 === void 0) + k2 = k; + o[k2] = m[k]; + }); + var __setModuleDefault = exports && exports.__setModuleDefault || (Object.create ? function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); + } : function(o, v) { + o["default"] = v; + }); + var __importStar = exports && exports.__importStar || function(mod) { + if (mod && mod.__esModule) + return mod; + var result = {}; + if (mod != null) { + for (var k in mod) + if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) + __createBinding(result, mod, k); + } + __setModuleDefault(result, mod); + return result; + }; + var __importDefault = exports && exports.__importDefault || function(mod) { + return mod && mod.__esModule ? mod : { "default": mod }; + }; + Object.defineProperty(exports, "__esModule", { value: true }); + var AbstractParserWithWordBoundary_1 = require_AbstractParserWithWordBoundary(); + var references = __importStar(require_casualReferences()); + var dayjs_1 = require_dayjs(); + var dayjs_2 = __importDefault(require_dayjs_min()); + var constants_1 = require_constants9(); + var PATTERN = new RegExp(`(\u0441\u0435\u0439\u0447\u0430\u0441|\u043F\u0440\u043E\u0448\u043B\u044B\u043C\\s*\u0432\u0435\u0447\u0435\u0440\u043E\u043C|\u043F\u0440\u043E\u0448\u043B\u043E\u0439\\s*\u043D\u043E\u0447\u044C\u044E|\u0441\u043B\u0435\u0434\u0443\u044E\u0449\u0435\u0439\\s*\u043D\u043E\u0447\u044C\u044E|\u0441\u0435\u0433\u043E\u0434\u043D\u044F\\s*\u043D\u043E\u0447\u044C\u044E|\u044D\u0442\u043E\u0439\\s*\u043D\u043E\u0447\u044C\u044E|\u043D\u043E\u0447\u044C\u044E|\u044D\u0442\u0438\u043C \u0443\u0442\u0440\u043E\u043C|\u0443\u0442\u0440\u043E\u043C|\u0443\u0442\u0440\u0430|\u0432\\s*\u043F\u043E\u043B\u0434\u0435\u043D\u044C|\u0432\u0435\u0447\u0435\u0440\u043E\u043C|\u0432\u0435\u0447\u0435\u0440\u0430|\u0432\\s*\u043F\u043E\u043B\u043D\u043E\u0447\u044C)${constants_1.REGEX_PARTS.rightBoundary}`, constants_1.REGEX_PARTS.flags); + var RUCasualTimeParser = class extends AbstractParserWithWordBoundary_1.AbstractParserWithWordBoundaryChecking { + patternLeftBoundary() { + return constants_1.REGEX_PARTS.leftBoundary; + } + innerPattern() { + return PATTERN; + } + innerExtract(context, match) { + let targetDate = dayjs_2.default(context.refDate); + const lowerText = match[0].toLowerCase(); + const component = context.createParsingComponents(); + if (lowerText === "\u0441\u0435\u0439\u0447\u0430\u0441") { + return references.now(context.reference); + } + if (lowerText === "\u0432\u0435\u0447\u0435\u0440\u043E\u043C" || lowerText === "\u0432\u0435\u0447\u0435\u0440\u0430") { + return references.evening(context.reference); + } + if (lowerText.endsWith("\u0443\u0442\u0440\u043E\u043C") || lowerText.endsWith("\u0443\u0442\u0440\u0430")) { + return references.morning(context.reference); + } + if (lowerText.match(/в\s*полдень/)) { + return references.noon(context.reference); + } + if (lowerText.match(/прошлой\s*ночью/)) { + return references.lastNight(context.reference); + } + if (lowerText.match(/прошлым\s*вечером/)) { + return references.yesterdayEvening(context.reference); + } + if (lowerText.match(/следующей\s*ночью/)) { + const daysToAdd = targetDate.hour() < 22 ? 1 : 2; + targetDate = targetDate.add(daysToAdd, "day"); + dayjs_1.assignSimilarDate(component, targetDate); + component.imply("hour", 0); + } + if (lowerText.match(/в\s*полночь/) || lowerText.endsWith("\u043D\u043E\u0447\u044C\u044E")) { + return references.midnight(context.reference); + } + return component; + } + }; + exports.default = RUCasualTimeParser; + } +}); + +// node_modules/chrono-node/dist/locales/ru/parsers/RUWeekdayParser.js +var require_RUWeekdayParser = __commonJS({ + "node_modules/chrono-node/dist/locales/ru/parsers/RUWeekdayParser.js"(exports) { + "use strict"; + Object.defineProperty(exports, "__esModule", { value: true }); + var constants_1 = require_constants9(); + var pattern_1 = require_pattern(); + var AbstractParserWithWordBoundary_1 = require_AbstractParserWithWordBoundary(); + var weeks_1 = require_weeks(); + var PATTERN = new RegExp(`(?:(?:,|\\(|\uFF08)\\s*)?(?:\u0432\\s*?)?(?:(\u044D\u0442\u0443|\u044D\u0442\u043E\u0442|\u043F\u0440\u043E\u0448\u043B\u044B\u0439|\u043F\u0440\u043E\u0448\u043B\u0443\u044E|\u0441\u043B\u0435\u0434\u0443\u044E\u0449\u0438\u0439|\u0441\u043B\u0435\u0434\u0443\u044E\u0449\u0443\u044E|\u0441\u043B\u0435\u0434\u0443\u044E\u0449\u0435\u0433\u043E)\\s*)?(${pattern_1.matchAnyPattern(constants_1.WEEKDAY_DICTIONARY)})(?:\\s*(?:,|\\)|\uFF09))?(?:\\s*\u043D\u0430\\s*(\u044D\u0442\u043E\u0439|\u043F\u0440\u043E\u0448\u043B\u043E\u0439|\u0441\u043B\u0435\u0434\u0443\u044E\u0449\u0435\u0439)\\s*\u043D\u0435\u0434\u0435\u043B\u0435)?${constants_1.REGEX_PARTS.rightBoundary}`, constants_1.REGEX_PARTS.flags); + var PREFIX_GROUP = 1; + var WEEKDAY_GROUP = 2; + var POSTFIX_GROUP = 3; + var RUWeekdayParser = class extends AbstractParserWithWordBoundary_1.AbstractParserWithWordBoundaryChecking { + innerPattern() { + return PATTERN; + } + patternLeftBoundary() { + return constants_1.REGEX_PARTS.leftBoundary; + } + innerExtract(context, match) { + const dayOfWeek = match[WEEKDAY_GROUP].toLowerCase(); + const offset2 = constants_1.WEEKDAY_DICTIONARY[dayOfWeek]; + const prefix = match[PREFIX_GROUP]; + const postfix = match[POSTFIX_GROUP]; + let modifierWord = prefix || postfix; + modifierWord = modifierWord || ""; + modifierWord = modifierWord.toLowerCase(); + let modifier = null; + if (modifierWord == "\u043F\u0440\u043E\u0448\u043B\u044B\u0439" || modifierWord == "\u043F\u0440\u043E\u0448\u043B\u0443\u044E" || modifierWord == "\u043F\u0440\u043E\u0448\u043B\u043E\u0439") { + modifier = "last"; + } else if (modifierWord == "\u0441\u043B\u0435\u0434\u0443\u044E\u0449\u0438\u0439" || modifierWord == "\u0441\u043B\u0435\u0434\u0443\u044E\u0449\u0443\u044E" || modifierWord == "\u0441\u043B\u0435\u0434\u0443\u044E\u0449\u0435\u0439" || modifierWord == "\u0441\u043B\u0435\u0434\u0443\u044E\u0449\u0435\u0433\u043E") { + modifier = "next"; + } else if (modifierWord == "\u044D\u0442\u043E\u0442" || modifierWord == "\u044D\u0442\u0443" || modifierWord == "\u044D\u0442\u043E\u0439") { + modifier = "this"; + } + const date = weeks_1.toDayJSWeekday(context.refDate, offset2, modifier); + return context.createParsingComponents().assign("weekday", offset2).imply("day", date.date()).imply("month", date.month() + 1).imply("year", date.year()); + } + }; + exports.default = RUWeekdayParser; + } +}); + +// node_modules/chrono-node/dist/locales/ru/parsers/RURelativeDateFormatParser.js +var require_RURelativeDateFormatParser = __commonJS({ + "node_modules/chrono-node/dist/locales/ru/parsers/RURelativeDateFormatParser.js"(exports) { + "use strict"; + var __importDefault = exports && exports.__importDefault || function(mod) { + return mod && mod.__esModule ? mod : { "default": mod }; + }; + Object.defineProperty(exports, "__esModule", { value: true }); + var constants_1 = require_constants9(); + var results_1 = require_results(); + var dayjs_1 = __importDefault(require_dayjs_min()); + var AbstractParserWithWordBoundary_1 = require_AbstractParserWithWordBoundary(); + var pattern_1 = require_pattern(); + var PATTERN = new RegExp(`(\u0432 \u043F\u0440\u043E\u0448\u043B\u043E\u043C|\u043D\u0430 \u043F\u0440\u043E\u0448\u043B\u043E\u0439|\u043D\u0430 \u0441\u043B\u0435\u0434\u0443\u044E\u0449\u0435\u0439|\u0432 \u0441\u043B\u0435\u0434\u0443\u044E\u0449\u0435\u043C|\u043D\u0430 \u044D\u0442\u043E\u0439|\u0432 \u044D\u0442\u043E\u043C)\\s*(${pattern_1.matchAnyPattern(constants_1.TIME_UNIT_DICTIONARY)})(?=\\s*)${constants_1.REGEX_PARTS.rightBoundary}`, constants_1.REGEX_PARTS.flags); + var MODIFIER_WORD_GROUP = 1; + var RELATIVE_WORD_GROUP = 2; + var RURelativeDateFormatParser = class extends AbstractParserWithWordBoundary_1.AbstractParserWithWordBoundaryChecking { + patternLeftBoundary() { + return constants_1.REGEX_PARTS.leftBoundary; + } + innerPattern() { + return PATTERN; + } + innerExtract(context, match) { + const modifier = match[MODIFIER_WORD_GROUP].toLowerCase(); + const unitWord = match[RELATIVE_WORD_GROUP].toLowerCase(); + const timeunit = constants_1.TIME_UNIT_DICTIONARY[unitWord]; + if (modifier == "\u043D\u0430 \u0441\u043B\u0435\u0434\u0443\u044E\u0449\u0435\u0439" || modifier == "\u0432 \u0441\u043B\u0435\u0434\u0443\u044E\u0449\u0435\u043C") { + const timeUnits = {}; + timeUnits[timeunit] = 1; + return results_1.ParsingComponents.createRelativeFromReference(context.reference, timeUnits); + } + if (modifier == "\u0432 \u043F\u0440\u043E\u0448\u043B\u043E\u043C" || modifier == "\u043D\u0430 \u043F\u0440\u043E\u0448\u043B\u043E\u0439") { + const timeUnits = {}; + timeUnits[timeunit] = -1; + return results_1.ParsingComponents.createRelativeFromReference(context.reference, timeUnits); + } + const components = context.createParsingComponents(); + let date = dayjs_1.default(context.reference.instant); + if (timeunit.match(/week/i)) { + date = date.add(-date.get("d"), "d"); + components.imply("day", date.date()); + components.imply("month", date.month() + 1); + components.imply("year", date.year()); + } else if (timeunit.match(/month/i)) { + date = date.add(-date.date() + 1, "d"); + components.imply("day", date.date()); + components.assign("year", date.year()); + components.assign("month", date.month() + 1); + } else if (timeunit.match(/year/i)) { + date = date.add(-date.date() + 1, "d"); + date = date.add(-date.month(), "month"); + components.imply("day", date.date()); + components.imply("month", date.month() + 1); + components.assign("year", date.year()); + } + return components; + } + }; + exports.default = RURelativeDateFormatParser; + } +}); + +// node_modules/chrono-node/dist/locales/ru/parsers/RUTimeUnitCasualRelativeFormatParser.js +var require_RUTimeUnitCasualRelativeFormatParser = __commonJS({ + "node_modules/chrono-node/dist/locales/ru/parsers/RUTimeUnitCasualRelativeFormatParser.js"(exports) { + "use strict"; + Object.defineProperty(exports, "__esModule", { value: true }); + var constants_1 = require_constants9(); + var results_1 = require_results(); + var AbstractParserWithWordBoundary_1 = require_AbstractParserWithWordBoundary(); + var timeunits_1 = require_timeunits(); + var PATTERN = new RegExp(`(\u044D\u0442\u0438|\u043F\u043E\u0441\u043B\u0435\u0434\u043D\u0438\u0435|\u043F\u0440\u043E\u0448\u043B\u044B\u0435|\u0441\u043B\u0435\u0434\u0443\u044E\u0449\u0438\u0435|\u043F\u043E\u0441\u043B\u0435|\u0447\u0435\u0440\u0435\u0437|\\+|-)\\s*(${constants_1.TIME_UNITS_PATTERN})${constants_1.REGEX_PARTS.rightBoundary}`, constants_1.REGEX_PARTS.flags); + var RUTimeUnitCasualRelativeFormatParser = class extends AbstractParserWithWordBoundary_1.AbstractParserWithWordBoundaryChecking { + patternLeftBoundary() { + return constants_1.REGEX_PARTS.leftBoundary; + } + innerPattern() { + return PATTERN; + } + innerExtract(context, match) { + const prefix = match[1].toLowerCase(); + let timeUnits = constants_1.parseTimeUnits(match[2]); + switch (prefix) { + case "\u043F\u043E\u0441\u043B\u0435\u0434\u043D\u0438\u0435": + case "\u043F\u0440\u043E\u0448\u043B\u044B\u0435": + case "-": + timeUnits = timeunits_1.reverseTimeUnits(timeUnits); + break; + } + return results_1.ParsingComponents.createRelativeFromReference(context.reference, timeUnits); + } + }; + exports.default = RUTimeUnitCasualRelativeFormatParser; + } +}); + +// node_modules/chrono-node/dist/locales/ru/index.js +var require_ru = __commonJS({ + "node_modules/chrono-node/dist/locales/ru/index.js"(exports) { + "use strict"; + var __importDefault = exports && exports.__importDefault || function(mod) { + return mod && mod.__esModule ? mod : { "default": mod }; + }; + Object.defineProperty(exports, "__esModule", { value: true }); + exports.createConfiguration = exports.createCasualConfiguration = exports.parseDate = exports.parse = exports.strict = exports.casual = void 0; + var RUTimeUnitWithinFormatParser_1 = __importDefault(require_RUTimeUnitWithinFormatParser()); + var RUMonthNameLittleEndianParser_1 = __importDefault(require_RUMonthNameLittleEndianParser()); + var RUMonthNameParser_1 = __importDefault(require_RUMonthNameParser()); + var RUTimeExpressionParser_1 = __importDefault(require_RUTimeExpressionParser()); + var RUTimeUnitAgoFormatParser_1 = __importDefault(require_RUTimeUnitAgoFormatParser()); + var RUMergeDateRangeRefiner_1 = __importDefault(require_RUMergeDateRangeRefiner()); + var RUMergeDateTimeRefiner_1 = __importDefault(require_RUMergeDateTimeRefiner()); + var configurations_1 = require_configurations(); + var RUCasualDateParser_1 = __importDefault(require_RUCasualDateParser()); + var RUCasualTimeParser_1 = __importDefault(require_RUCasualTimeParser()); + var RUWeekdayParser_1 = __importDefault(require_RUWeekdayParser()); + var RURelativeDateFormatParser_1 = __importDefault(require_RURelativeDateFormatParser()); + var chrono_1 = require_chrono(); + var SlashDateFormatParser_1 = __importDefault(require_SlashDateFormatParser()); + var RUTimeUnitCasualRelativeFormatParser_1 = __importDefault(require_RUTimeUnitCasualRelativeFormatParser()); + exports.casual = new chrono_1.Chrono(createCasualConfiguration()); + exports.strict = new chrono_1.Chrono(createConfiguration(true)); + function parse4(text2, ref, option) { + return exports.casual.parse(text2, ref, option); + } + exports.parse = parse4; + function parseDate3(text2, ref, option) { + return exports.casual.parseDate(text2, ref, option); + } + exports.parseDate = parseDate3; + function createCasualConfiguration() { + const option = createConfiguration(false); + option.parsers.unshift(new RUCasualDateParser_1.default()); + option.parsers.unshift(new RUCasualTimeParser_1.default()); + option.parsers.unshift(new RUMonthNameParser_1.default()); + option.parsers.unshift(new RURelativeDateFormatParser_1.default()); + option.parsers.unshift(new RUTimeUnitCasualRelativeFormatParser_1.default()); + return option; + } + exports.createCasualConfiguration = createCasualConfiguration; + function createConfiguration(strictMode = true) { + return configurations_1.includeCommonConfiguration({ + parsers: [ + new SlashDateFormatParser_1.default(true), + new RUTimeUnitWithinFormatParser_1.default(), + new RUMonthNameLittleEndianParser_1.default(), + new RUWeekdayParser_1.default(), + new RUTimeExpressionParser_1.default(strictMode), + new RUTimeUnitAgoFormatParser_1.default() + ], + refiners: [new RUMergeDateTimeRefiner_1.default(), new RUMergeDateRangeRefiner_1.default()] + }, strictMode); + } + exports.createConfiguration = createConfiguration; + } +}); + +// node_modules/chrono-node/dist/index.js +var require_dist = __commonJS({ + "node_modules/chrono-node/dist/index.js"(exports) { + "use strict"; + var __createBinding = exports && exports.__createBinding || (Object.create ? function(o, m, k, k2) { + if (k2 === void 0) + k2 = k; + Object.defineProperty(o, k2, { enumerable: true, get: function() { + return m[k]; + } }); + } : function(o, m, k, k2) { + if (k2 === void 0) + k2 = k; + o[k2] = m[k]; + }); + var __setModuleDefault = exports && exports.__setModuleDefault || (Object.create ? function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); + } : function(o, v) { + o["default"] = v; + }); + var __importStar = exports && exports.__importStar || function(mod) { + if (mod && mod.__esModule) + return mod; + var result = {}; + if (mod != null) { + for (var k in mod) + if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) + __createBinding(result, mod, k); + } + __setModuleDefault(result, mod); + return result; + }; + Object.defineProperty(exports, "__esModule", { value: true }); + exports.parseDate = exports.parse = exports.casual = exports.strict = exports.ru = exports.zh = exports.nl = exports.pt = exports.ja = exports.fr = exports.de = exports.Meridiem = exports.Chrono = exports.en = void 0; + var en = __importStar(require_en()); + exports.en = en; + var chrono_1 = require_chrono(); + Object.defineProperty(exports, "Chrono", { enumerable: true, get: function() { + return chrono_1.Chrono; + } }); + var Meridiem; + (function(Meridiem2) { + Meridiem2[Meridiem2["AM"] = 0] = "AM"; + Meridiem2[Meridiem2["PM"] = 1] = "PM"; + })(Meridiem = exports.Meridiem || (exports.Meridiem = {})); + var de = __importStar(require_de()); + exports.de = de; + var fr = __importStar(require_fr()); + exports.fr = fr; + var ja = __importStar(require_ja()); + exports.ja = ja; + var pt = __importStar(require_pt()); + exports.pt = pt; + var nl = __importStar(require_nl()); + exports.nl = nl; + var zh = __importStar(require_zh()); + exports.zh = zh; + var ru = __importStar(require_ru()); + exports.ru = ru; + exports.strict = en.strict; + exports.casual = en.casual; + function parse4(text2, ref, option) { + return exports.casual.parse(text2, ref, option); + } + exports.parse = parse4; + function parseDate3(text2, ref, option) { + return exports.casual.parseDate(text2, ref, option); + } + exports.parseDate = parseDate3; + } +}); + +// node_modules/eventemitter2/lib/eventemitter2.js +var require_eventemitter2 = __commonJS({ + "node_modules/eventemitter2/lib/eventemitter2.js"(exports, module2) { + !function(undefined2) { + var hasOwnProperty = Object.hasOwnProperty; + var isArray3 = Array.isArray ? Array.isArray : function _isArray(obj) { + return Object.prototype.toString.call(obj) === "[object Array]"; + }; + var defaultMaxListeners = 10; + var nextTickSupported = typeof process == "object" && typeof process.nextTick == "function"; + var symbolsSupported = typeof Symbol === "function"; + var reflectSupported = typeof Reflect === "object"; + var setImmediateSupported = typeof setImmediate === "function"; + var _setImmediate = setImmediateSupported ? setImmediate : setTimeout; + var ownKeys = symbolsSupported ? reflectSupported && typeof Reflect.ownKeys === "function" ? Reflect.ownKeys : function(obj) { + var arr = Object.getOwnPropertyNames(obj); + arr.push.apply(arr, Object.getOwnPropertySymbols(obj)); + return arr; + } : Object.keys; + function init2() { + this._events = {}; + if (this._conf) { + configure.call(this, this._conf); + } + } + function configure(conf) { + if (conf) { + this._conf = conf; + conf.delimiter && (this.delimiter = conf.delimiter); + if (conf.maxListeners !== undefined2) { + this._maxListeners = conf.maxListeners; + } + conf.wildcard && (this.wildcard = conf.wildcard); + conf.newListener && (this._newListener = conf.newListener); + conf.removeListener && (this._removeListener = conf.removeListener); + conf.verboseMemoryLeak && (this.verboseMemoryLeak = conf.verboseMemoryLeak); + conf.ignoreErrors && (this.ignoreErrors = conf.ignoreErrors); + if (this.wildcard) { + this.listenerTree = {}; + } + } + } + function logPossibleMemoryLeak(count, eventName) { + var errorMsg = "(node) warning: possible EventEmitter memory leak detected. " + count + " listeners added. Use emitter.setMaxListeners() to increase limit."; + if (this.verboseMemoryLeak) { + errorMsg += " Event name: " + eventName + "."; + } + if (typeof process !== "undefined" && process.emitWarning) { + var e = new Error(errorMsg); + e.name = "MaxListenersExceededWarning"; + e.emitter = this; + e.count = count; + process.emitWarning(e); + } else { + console.error(errorMsg); + if (console.trace) { + console.trace(); + } + } + } + var toArray2 = function(a, b, c) { + var n = arguments.length; + switch (n) { + case 0: + return []; + case 1: + return [a]; + case 2: + return [a, b]; + case 3: + return [a, b, c]; + default: + var arr = new Array(n); + while (n--) { + arr[n] = arguments[n]; + } + return arr; + } + }; + function toObject(keys, values) { + var obj = {}; + var key; + var len = keys.length; + var valuesCount = values ? values.length : 0; + for (var i = 0; i < len; i++) { + key = keys[i]; + obj[key] = i < valuesCount ? values[i] : undefined2; + } + return obj; + } + function TargetObserver(emitter, target, options) { + this._emitter = emitter; + this._target = target; + this._listeners = {}; + this._listenersCount = 0; + var on, off; + if (options.on || options.off) { + on = options.on; + off = options.off; + } + if (target.addEventListener) { + on = target.addEventListener; + off = target.removeEventListener; + } else if (target.addListener) { + on = target.addListener; + off = target.removeListener; + } else if (target.on) { + on = target.on; + off = target.off; + } + if (!on && !off) { + throw Error("target does not implement any known event API"); + } + if (typeof on !== "function") { + throw TypeError("on method must be a function"); + } + if (typeof off !== "function") { + throw TypeError("off method must be a function"); + } + this._on = on; + this._off = off; + var _observers = emitter._observers; + if (_observers) { + _observers.push(this); + } else { + emitter._observers = [this]; + } + } + Object.assign(TargetObserver.prototype, { + subscribe: function(event, localEvent, reducer) { + var observer = this; + var target = this._target; + var emitter = this._emitter; + var listeners = this._listeners; + var handler = function() { + var args = toArray2.apply(null, arguments); + var eventObj = { + data: args, + name: localEvent, + original: event + }; + if (reducer) { + var result = reducer.call(target, eventObj); + if (result !== false) { + emitter.emit.apply(emitter, [eventObj.name].concat(args)); + } + return; + } + emitter.emit.apply(emitter, [localEvent].concat(args)); + }; + if (listeners[event]) { + throw Error("Event '" + event + "' is already listening"); + } + this._listenersCount++; + if (emitter._newListener && emitter._removeListener && !observer._onNewListener) { + this._onNewListener = function(_event) { + if (_event === localEvent && listeners[event] === null) { + listeners[event] = handler; + observer._on.call(target, event, handler); + } + }; + emitter.on("newListener", this._onNewListener); + this._onRemoveListener = function(_event) { + if (_event === localEvent && !emitter.hasListeners(_event) && listeners[event]) { + listeners[event] = null; + observer._off.call(target, event, handler); + } + }; + listeners[event] = null; + emitter.on("removeListener", this._onRemoveListener); + } else { + listeners[event] = handler; + observer._on.call(target, event, handler); + } + }, + unsubscribe: function(event) { + var observer = this; + var listeners = this._listeners; + var emitter = this._emitter; + var handler; + var events; + var off = this._off; + var target = this._target; + var i; + if (event && typeof event !== "string") { + throw TypeError("event must be a string"); + } + function clearRefs() { + if (observer._onNewListener) { + emitter.off("newListener", observer._onNewListener); + emitter.off("removeListener", observer._onRemoveListener); + observer._onNewListener = null; + observer._onRemoveListener = null; + } + var index = findTargetIndex.call(emitter, observer); + emitter._observers.splice(index, 1); + } + if (event) { + handler = listeners[event]; + if (!handler) + return; + off.call(target, event, handler); + delete listeners[event]; + if (!--this._listenersCount) { + clearRefs(); + } + } else { + events = ownKeys(listeners); + i = events.length; + while (i-- > 0) { + event = events[i]; + off.call(target, event, listeners[event]); + } + this._listeners = {}; + this._listenersCount = 0; + clearRefs(); + } + } + }); + function resolveOptions(options, schema, reducers, allowUnknown) { + var computedOptions = Object.assign({}, schema); + if (!options) + return computedOptions; + if (typeof options !== "object") { + throw TypeError("options must be an object"); + } + var keys = Object.keys(options); + var length = keys.length; + var option, value; + var reducer; + function reject(reason) { + throw Error('Invalid "' + option + '" option value' + (reason ? ". Reason: " + reason : "")); + } + for (var i = 0; i < length; i++) { + option = keys[i]; + if (!allowUnknown && !hasOwnProperty.call(schema, option)) { + throw Error('Unknown "' + option + '" option'); + } + value = options[option]; + if (value !== undefined2) { + reducer = reducers[option]; + computedOptions[option] = reducer ? reducer(value, reject) : value; + } + } + return computedOptions; + } + function constructorReducer(value, reject) { + if (typeof value !== "function" || !value.hasOwnProperty("prototype")) { + reject("value must be a constructor"); + } + return value; + } + function makeTypeReducer(types) { + var message = "value must be type of " + types.join("|"); + var len = types.length; + var firstType = types[0]; + var secondType = types[1]; + if (len === 1) { + return function(v, reject) { + if (typeof v === firstType) { + return v; + } + reject(message); + }; + } + if (len === 2) { + return function(v, reject) { + var kind = typeof v; + if (kind === firstType || kind === secondType) + return v; + reject(message); + }; + } + return function(v, reject) { + var kind = typeof v; + var i = len; + while (i-- > 0) { + if (kind === types[i]) + return v; + } + reject(message); + }; + } + var functionReducer = makeTypeReducer(["function"]); + var objectFunctionReducer = makeTypeReducer(["object", "function"]); + function makeCancelablePromise(Promise2, executor, options) { + var isCancelable; + var callbacks; + var timer = 0; + var subscriptionClosed; + var promise = new Promise2(function(resolve, reject, onCancel) { + options = resolveOptions(options, { + timeout: 0, + overload: false + }, { + timeout: function(value, reject2) { + value *= 1; + if (typeof value !== "number" || value < 0 || !Number.isFinite(value)) { + reject2("timeout must be a positive number"); + } + return value; + } + }); + isCancelable = !options.overload && typeof Promise2.prototype.cancel === "function" && typeof onCancel === "function"; + function cleanup() { + if (callbacks) { + callbacks = null; + } + if (timer) { + clearTimeout(timer); + timer = 0; + } + } + var _resolve = function(value) { + cleanup(); + resolve(value); + }; + var _reject = function(err) { + cleanup(); + reject(err); + }; + if (isCancelable) { + executor(_resolve, _reject, onCancel); + } else { + callbacks = [function(reason) { + _reject(reason || Error("canceled")); + }]; + executor(_resolve, _reject, function(cb) { + if (subscriptionClosed) { + throw Error("Unable to subscribe on cancel event asynchronously"); + } + if (typeof cb !== "function") { + throw TypeError("onCancel callback must be a function"); + } + callbacks.push(cb); + }); + subscriptionClosed = true; + } + if (options.timeout > 0) { + timer = setTimeout(function() { + var reason = Error("timeout"); + reason.code = "ETIMEDOUT"; + timer = 0; + promise.cancel(reason); + reject(reason); + }, options.timeout); + } + }); + if (!isCancelable) { + promise.cancel = function(reason) { + if (!callbacks) { + return; + } + var length = callbacks.length; + for (var i = 1; i < length; i++) { + callbacks[i](reason); + } + callbacks[0](reason); + callbacks = null; + }; + } + return promise; + } + function findTargetIndex(observer) { + var observers = this._observers; + if (!observers) { + return -1; + } + var len = observers.length; + for (var i = 0; i < len; i++) { + if (observers[i]._target === observer) + return i; + } + return -1; + } + function searchListenerTree(handlers, type, tree, i, typeLength) { + if (!tree) { + return null; + } + if (i === 0) { + var kind = typeof type; + if (kind === "string") { + var ns, n, l = 0, j = 0, delimiter = this.delimiter, dl = delimiter.length; + if ((n = type.indexOf(delimiter)) !== -1) { + ns = new Array(5); + do { + ns[l++] = type.slice(j, n); + j = n + dl; + } while ((n = type.indexOf(delimiter, j)) !== -1); + ns[l++] = type.slice(j); + type = ns; + typeLength = l; + } else { + type = [type]; + typeLength = 1; + } + } else if (kind === "object") { + typeLength = type.length; + } else { + type = [type]; + typeLength = 1; + } + } + var listeners = null, branch, xTree, xxTree, isolatedBranch, endReached, currentType = type[i], nextType = type[i + 1], branches, _listeners; + if (i === typeLength) { + if (tree._listeners) { + if (typeof tree._listeners === "function") { + handlers && handlers.push(tree._listeners); + listeners = [tree]; + } else { + handlers && handlers.push.apply(handlers, tree._listeners); + listeners = [tree]; + } + } + } else { + if (currentType === "*") { + branches = ownKeys(tree); + n = branches.length; + while (n-- > 0) { + branch = branches[n]; + if (branch !== "_listeners") { + _listeners = searchListenerTree(handlers, type, tree[branch], i + 1, typeLength); + if (_listeners) { + if (listeners) { + listeners.push.apply(listeners, _listeners); + } else { + listeners = _listeners; + } + } + } + } + return listeners; + } else if (currentType === "**") { + endReached = i + 1 === typeLength || i + 2 === typeLength && nextType === "*"; + if (endReached && tree._listeners) { + listeners = searchListenerTree(handlers, type, tree, typeLength, typeLength); + } + branches = ownKeys(tree); + n = branches.length; + while (n-- > 0) { + branch = branches[n]; + if (branch !== "_listeners") { + if (branch === "*" || branch === "**") { + if (tree[branch]._listeners && !endReached) { + _listeners = searchListenerTree(handlers, type, tree[branch], typeLength, typeLength); + if (_listeners) { + if (listeners) { + listeners.push.apply(listeners, _listeners); + } else { + listeners = _listeners; + } + } + } + _listeners = searchListenerTree(handlers, type, tree[branch], i, typeLength); + } else if (branch === nextType) { + _listeners = searchListenerTree(handlers, type, tree[branch], i + 2, typeLength); + } else { + _listeners = searchListenerTree(handlers, type, tree[branch], i, typeLength); + } + if (_listeners) { + if (listeners) { + listeners.push.apply(listeners, _listeners); + } else { + listeners = _listeners; + } + } + } + } + return listeners; + } else if (tree[currentType]) { + listeners = searchListenerTree(handlers, type, tree[currentType], i + 1, typeLength); + } + } + xTree = tree["*"]; + if (xTree) { + searchListenerTree(handlers, type, xTree, i + 1, typeLength); + } + xxTree = tree["**"]; + if (xxTree) { + if (i < typeLength) { + if (xxTree._listeners) { + searchListenerTree(handlers, type, xxTree, typeLength, typeLength); + } + branches = ownKeys(xxTree); + n = branches.length; + while (n-- > 0) { + branch = branches[n]; + if (branch !== "_listeners") { + if (branch === nextType) { + searchListenerTree(handlers, type, xxTree[branch], i + 2, typeLength); + } else if (branch === currentType) { + searchListenerTree(handlers, type, xxTree[branch], i + 1, typeLength); + } else { + isolatedBranch = {}; + isolatedBranch[branch] = xxTree[branch]; + searchListenerTree(handlers, type, { "**": isolatedBranch }, i + 1, typeLength); + } + } + } + } else if (xxTree._listeners) { + searchListenerTree(handlers, type, xxTree, typeLength, typeLength); + } else if (xxTree["*"] && xxTree["*"]._listeners) { + searchListenerTree(handlers, type, xxTree["*"], typeLength, typeLength); + } + } + return listeners; + } + function growListenerTree(type, listener, prepend) { + var len = 0, j = 0, i, delimiter = this.delimiter, dl = delimiter.length, ns; + if (typeof type === "string") { + if ((i = type.indexOf(delimiter)) !== -1) { + ns = new Array(5); + do { + ns[len++] = type.slice(j, i); + j = i + dl; + } while ((i = type.indexOf(delimiter, j)) !== -1); + ns[len++] = type.slice(j); + } else { + ns = [type]; + len = 1; + } + } else { + ns = type; + len = type.length; + } + if (len > 1) { + for (i = 0; i + 1 < len; i++) { + if (ns[i] === "**" && ns[i + 1] === "**") { + return; + } + } + } + var tree = this.listenerTree, name; + for (i = 0; i < len; i++) { + name = ns[i]; + tree = tree[name] || (tree[name] = {}); + if (i === len - 1) { + if (!tree._listeners) { + tree._listeners = listener; + } else { + if (typeof tree._listeners === "function") { + tree._listeners = [tree._listeners]; + } + if (prepend) { + tree._listeners.unshift(listener); + } else { + tree._listeners.push(listener); + } + if (!tree._listeners.warned && this._maxListeners > 0 && tree._listeners.length > this._maxListeners) { + tree._listeners.warned = true; + logPossibleMemoryLeak.call(this, tree._listeners.length, name); + } + } + return true; + } + } + return true; + } + function collectTreeEvents(tree, events, root, asArray) { + var branches = ownKeys(tree); + var i = branches.length; + var branch, branchName, path; + var hasListeners = tree["_listeners"]; + var isArrayPath; + while (i-- > 0) { + branchName = branches[i]; + branch = tree[branchName]; + if (branchName === "_listeners") { + path = root; + } else { + path = root ? root.concat(branchName) : [branchName]; + } + isArrayPath = asArray || typeof branchName === "symbol"; + hasListeners && events.push(isArrayPath ? path : path.join(this.delimiter)); + if (typeof branch === "object") { + collectTreeEvents.call(this, branch, events, path, isArrayPath); + } + } + return events; + } + function recursivelyGarbageCollect(root) { + var keys = ownKeys(root); + var i = keys.length; + var obj, key, flag; + while (i-- > 0) { + key = keys[i]; + obj = root[key]; + if (obj) { + flag = true; + if (key !== "_listeners" && !recursivelyGarbageCollect(obj)) { + delete root[key]; + } + } + } + return flag; + } + function Listener(emitter, event, listener) { + this.emitter = emitter; + this.event = event; + this.listener = listener; + } + Listener.prototype.off = function() { + this.emitter.off(this.event, this.listener); + return this; + }; + function setupListener(event, listener, options) { + if (options === true) { + promisify = true; + } else if (options === false) { + async = true; + } else { + if (!options || typeof options !== "object") { + throw TypeError("options should be an object or true"); + } + var async = options.async; + var promisify = options.promisify; + var nextTick = options.nextTick; + var objectify = options.objectify; + } + if (async || nextTick || promisify) { + var _listener = listener; + var _origin = listener._origin || listener; + if (nextTick && !nextTickSupported) { + throw Error("process.nextTick is not supported"); + } + if (promisify === undefined2) { + promisify = listener.constructor.name === "AsyncFunction"; + } + listener = function() { + var args = arguments; + var context = this; + var event2 = this.event; + return promisify ? nextTick ? Promise.resolve() : new Promise(function(resolve) { + _setImmediate(resolve); + }).then(function() { + context.event = event2; + return _listener.apply(context, args); + }) : (nextTick ? process.nextTick : _setImmediate)(function() { + context.event = event2; + _listener.apply(context, args); + }); + }; + listener._async = true; + listener._origin = _origin; + } + return [listener, objectify ? new Listener(this, event, listener) : this]; + } + function EventEmitter(conf) { + this._events = {}; + this._newListener = false; + this._removeListener = false; + this.verboseMemoryLeak = false; + configure.call(this, conf); + } + EventEmitter.EventEmitter2 = EventEmitter; + EventEmitter.prototype.listenTo = function(target, events, options) { + if (typeof target !== "object") { + throw TypeError("target musts be an object"); + } + var emitter = this; + options = resolveOptions(options, { + on: undefined2, + off: undefined2, + reducers: undefined2 + }, { + on: functionReducer, + off: functionReducer, + reducers: objectFunctionReducer + }); + function listen2(events2) { + if (typeof events2 !== "object") { + throw TypeError("events must be an object"); + } + var reducers = options.reducers; + var index = findTargetIndex.call(emitter, target); + var observer; + if (index === -1) { + observer = new TargetObserver(emitter, target, options); + } else { + observer = emitter._observers[index]; + } + var keys = ownKeys(events2); + var len = keys.length; + var event; + var isSingleReducer = typeof reducers === "function"; + for (var i = 0; i < len; i++) { + event = keys[i]; + observer.subscribe( + event, + events2[event] || event, + isSingleReducer ? reducers : reducers && reducers[event] + ); + } + } + isArray3(events) ? listen2(toObject(events)) : typeof events === "string" ? listen2(toObject(events.split(/\s+/))) : listen2(events); + return this; + }; + EventEmitter.prototype.stopListeningTo = function(target, event) { + var observers = this._observers; + if (!observers) { + return false; + } + var i = observers.length; + var observer; + var matched = false; + if (target && typeof target !== "object") { + throw TypeError("target should be an object"); + } + while (i-- > 0) { + observer = observers[i]; + if (!target || observer._target === target) { + observer.unsubscribe(event); + matched = true; + } + } + return matched; + }; + EventEmitter.prototype.delimiter = "."; + EventEmitter.prototype.setMaxListeners = function(n) { + if (n !== undefined2) { + this._maxListeners = n; + if (!this._conf) + this._conf = {}; + this._conf.maxListeners = n; + } + }; + EventEmitter.prototype.getMaxListeners = function() { + return this._maxListeners; + }; + EventEmitter.prototype.event = ""; + EventEmitter.prototype.once = function(event, fn, options) { + return this._once(event, fn, false, options); + }; + EventEmitter.prototype.prependOnceListener = function(event, fn, options) { + return this._once(event, fn, true, options); + }; + EventEmitter.prototype._once = function(event, fn, prepend, options) { + return this._many(event, 1, fn, prepend, options); + }; + EventEmitter.prototype.many = function(event, ttl, fn, options) { + return this._many(event, ttl, fn, false, options); + }; + EventEmitter.prototype.prependMany = function(event, ttl, fn, options) { + return this._many(event, ttl, fn, true, options); + }; + EventEmitter.prototype._many = function(event, ttl, fn, prepend, options) { + var self2 = this; + if (typeof fn !== "function") { + throw new Error("many only accepts instances of Function"); + } + function listener() { + if (--ttl === 0) { + self2.off(event, listener); + } + return fn.apply(this, arguments); + } + listener._origin = fn; + return this._on(event, listener, prepend, options); + }; + EventEmitter.prototype.emit = function() { + if (!this._events && !this._all) { + return false; + } + this._events || init2.call(this); + var type = arguments[0], ns, wildcard = this.wildcard; + var args, l, i, j, containsSymbol; + if (type === "newListener" && !this._newListener) { + if (!this._events.newListener) { + return false; + } + } + if (wildcard) { + ns = type; + if (type !== "newListener" && type !== "removeListener") { + if (typeof type === "object") { + l = type.length; + if (symbolsSupported) { + for (i = 0; i < l; i++) { + if (typeof type[i] === "symbol") { + containsSymbol = true; + break; + } + } + } + if (!containsSymbol) { + type = type.join(this.delimiter); + } + } + } + } + var al = arguments.length; + var handler; + if (this._all && this._all.length) { + handler = this._all.slice(); + for (i = 0, l = handler.length; i < l; i++) { + this.event = type; + switch (al) { + case 1: + handler[i].call(this, type); + break; + case 2: + handler[i].call(this, type, arguments[1]); + break; + case 3: + handler[i].call(this, type, arguments[1], arguments[2]); + break; + default: + handler[i].apply(this, arguments); + } + } + } + if (wildcard) { + handler = []; + searchListenerTree.call(this, handler, ns, this.listenerTree, 0, l); + } else { + handler = this._events[type]; + if (typeof handler === "function") { + this.event = type; + switch (al) { + case 1: + handler.call(this); + break; + case 2: + handler.call(this, arguments[1]); + break; + case 3: + handler.call(this, arguments[1], arguments[2]); + break; + default: + args = new Array(al - 1); + for (j = 1; j < al; j++) + args[j - 1] = arguments[j]; + handler.apply(this, args); + } + return true; + } else if (handler) { + handler = handler.slice(); + } + } + if (handler && handler.length) { + if (al > 3) { + args = new Array(al - 1); + for (j = 1; j < al; j++) + args[j - 1] = arguments[j]; + } + for (i = 0, l = handler.length; i < l; i++) { + this.event = type; + switch (al) { + case 1: + handler[i].call(this); + break; + case 2: + handler[i].call(this, arguments[1]); + break; + case 3: + handler[i].call(this, arguments[1], arguments[2]); + break; + default: + handler[i].apply(this, args); + } + } + return true; + } else if (!this.ignoreErrors && !this._all && type === "error") { + if (arguments[1] instanceof Error) { + throw arguments[1]; + } else { + throw new Error("Uncaught, unspecified 'error' event."); + } + } + return !!this._all; + }; + EventEmitter.prototype.emitAsync = function() { + if (!this._events && !this._all) { + return false; + } + this._events || init2.call(this); + var type = arguments[0], wildcard = this.wildcard, ns, containsSymbol; + var args, l, i, j; + if (type === "newListener" && !this._newListener) { + if (!this._events.newListener) { + return Promise.resolve([false]); + } + } + if (wildcard) { + ns = type; + if (type !== "newListener" && type !== "removeListener") { + if (typeof type === "object") { + l = type.length; + if (symbolsSupported) { + for (i = 0; i < l; i++) { + if (typeof type[i] === "symbol") { + containsSymbol = true; + break; + } + } + } + if (!containsSymbol) { + type = type.join(this.delimiter); + } + } + } + } + var promises = []; + var al = arguments.length; + var handler; + if (this._all) { + for (i = 0, l = this._all.length; i < l; i++) { + this.event = type; + switch (al) { + case 1: + promises.push(this._all[i].call(this, type)); + break; + case 2: + promises.push(this._all[i].call(this, type, arguments[1])); + break; + case 3: + promises.push(this._all[i].call(this, type, arguments[1], arguments[2])); + break; + default: + promises.push(this._all[i].apply(this, arguments)); + } + } + } + if (wildcard) { + handler = []; + searchListenerTree.call(this, handler, ns, this.listenerTree, 0); + } else { + handler = this._events[type]; + } + if (typeof handler === "function") { + this.event = type; + switch (al) { + case 1: + promises.push(handler.call(this)); + break; + case 2: + promises.push(handler.call(this, arguments[1])); + break; + case 3: + promises.push(handler.call(this, arguments[1], arguments[2])); + break; + default: + args = new Array(al - 1); + for (j = 1; j < al; j++) + args[j - 1] = arguments[j]; + promises.push(handler.apply(this, args)); + } + } else if (handler && handler.length) { + handler = handler.slice(); + if (al > 3) { + args = new Array(al - 1); + for (j = 1; j < al; j++) + args[j - 1] = arguments[j]; + } + for (i = 0, l = handler.length; i < l; i++) { + this.event = type; + switch (al) { + case 1: + promises.push(handler[i].call(this)); + break; + case 2: + promises.push(handler[i].call(this, arguments[1])); + break; + case 3: + promises.push(handler[i].call(this, arguments[1], arguments[2])); + break; + default: + promises.push(handler[i].apply(this, args)); + } + } + } else if (!this.ignoreErrors && !this._all && type === "error") { + if (arguments[1] instanceof Error) { + return Promise.reject(arguments[1]); + } else { + return Promise.reject("Uncaught, unspecified 'error' event."); + } + } + return Promise.all(promises); + }; + EventEmitter.prototype.on = function(type, listener, options) { + return this._on(type, listener, false, options); + }; + EventEmitter.prototype.prependListener = function(type, listener, options) { + return this._on(type, listener, true, options); + }; + EventEmitter.prototype.onAny = function(fn) { + return this._onAny(fn, false); + }; + EventEmitter.prototype.prependAny = function(fn) { + return this._onAny(fn, true); + }; + EventEmitter.prototype.addListener = EventEmitter.prototype.on; + EventEmitter.prototype._onAny = function(fn, prepend) { + if (typeof fn !== "function") { + throw new Error("onAny only accepts instances of Function"); + } + if (!this._all) { + this._all = []; + } + if (prepend) { + this._all.unshift(fn); + } else { + this._all.push(fn); + } + return this; + }; + EventEmitter.prototype._on = function(type, listener, prepend, options) { + if (typeof type === "function") { + this._onAny(type, listener); + return this; + } + if (typeof listener !== "function") { + throw new Error("on only accepts instances of Function"); + } + this._events || init2.call(this); + var returnValue = this, temp; + if (options !== undefined2) { + temp = setupListener.call(this, type, listener, options); + listener = temp[0]; + returnValue = temp[1]; + } + if (this._newListener) { + this.emit("newListener", type, listener); + } + if (this.wildcard) { + growListenerTree.call(this, type, listener, prepend); + return returnValue; + } + if (!this._events[type]) { + this._events[type] = listener; + } else { + if (typeof this._events[type] === "function") { + this._events[type] = [this._events[type]]; + } + if (prepend) { + this._events[type].unshift(listener); + } else { + this._events[type].push(listener); + } + if (!this._events[type].warned && this._maxListeners > 0 && this._events[type].length > this._maxListeners) { + this._events[type].warned = true; + logPossibleMemoryLeak.call(this, this._events[type].length, type); + } + } + return returnValue; + }; + EventEmitter.prototype.off = function(type, listener) { + if (typeof listener !== "function") { + throw new Error("removeListener only takes instances of Function"); + } + var handlers, leafs = []; + if (this.wildcard) { + var ns = typeof type === "string" ? type.split(this.delimiter) : type.slice(); + leafs = searchListenerTree.call(this, null, ns, this.listenerTree, 0); + if (!leafs) + return this; + } else { + if (!this._events[type]) + return this; + handlers = this._events[type]; + leafs.push({ _listeners: handlers }); + } + for (var iLeaf = 0; iLeaf < leafs.length; iLeaf++) { + var leaf = leafs[iLeaf]; + handlers = leaf._listeners; + if (isArray3(handlers)) { + var position = -1; + for (var i = 0, length = handlers.length; i < length; i++) { + if (handlers[i] === listener || handlers[i].listener && handlers[i].listener === listener || handlers[i]._origin && handlers[i]._origin === listener) { + position = i; + break; + } + } + if (position < 0) { + continue; + } + if (this.wildcard) { + leaf._listeners.splice(position, 1); + } else { + this._events[type].splice(position, 1); + } + if (handlers.length === 0) { + if (this.wildcard) { + delete leaf._listeners; + } else { + delete this._events[type]; + } + } + if (this._removeListener) + this.emit("removeListener", type, listener); + return this; + } else if (handlers === listener || handlers.listener && handlers.listener === listener || handlers._origin && handlers._origin === listener) { + if (this.wildcard) { + delete leaf._listeners; + } else { + delete this._events[type]; + } + if (this._removeListener) + this.emit("removeListener", type, listener); + } + } + this.listenerTree && recursivelyGarbageCollect(this.listenerTree); + return this; + }; + EventEmitter.prototype.offAny = function(fn) { + var i = 0, l = 0, fns; + if (fn && this._all && this._all.length > 0) { + fns = this._all; + for (i = 0, l = fns.length; i < l; i++) { + if (fn === fns[i]) { + fns.splice(i, 1); + if (this._removeListener) + this.emit("removeListenerAny", fn); + return this; + } + } + } else { + fns = this._all; + if (this._removeListener) { + for (i = 0, l = fns.length; i < l; i++) + this.emit("removeListenerAny", fns[i]); + } + this._all = []; + } + return this; + }; + EventEmitter.prototype.removeListener = EventEmitter.prototype.off; + EventEmitter.prototype.removeAllListeners = function(type) { + if (type === undefined2) { + !this._events || init2.call(this); + return this; + } + if (this.wildcard) { + var leafs = searchListenerTree.call(this, null, type, this.listenerTree, 0), leaf, i; + if (!leafs) + return this; + for (i = 0; i < leafs.length; i++) { + leaf = leafs[i]; + leaf._listeners = null; + } + this.listenerTree && recursivelyGarbageCollect(this.listenerTree); + } else if (this._events) { + this._events[type] = null; + } + return this; + }; + EventEmitter.prototype.listeners = function(type) { + var _events = this._events; + var keys, listeners, allListeners; + var i; + var listenerTree; + if (type === undefined2) { + if (this.wildcard) { + throw Error("event name required for wildcard emitter"); + } + if (!_events) { + return []; + } + keys = ownKeys(_events); + i = keys.length; + allListeners = []; + while (i-- > 0) { + listeners = _events[keys[i]]; + if (typeof listeners === "function") { + allListeners.push(listeners); + } else { + allListeners.push.apply(allListeners, listeners); + } + } + return allListeners; + } else { + if (this.wildcard) { + listenerTree = this.listenerTree; + if (!listenerTree) + return []; + var handlers = []; + var ns = typeof type === "string" ? type.split(this.delimiter) : type.slice(); + searchListenerTree.call(this, handlers, ns, listenerTree, 0); + return handlers; + } + if (!_events) { + return []; + } + listeners = _events[type]; + if (!listeners) { + return []; + } + return typeof listeners === "function" ? [listeners] : listeners; + } + }; + EventEmitter.prototype.eventNames = function(nsAsArray) { + var _events = this._events; + return this.wildcard ? collectTreeEvents.call(this, this.listenerTree, [], null, nsAsArray) : _events ? ownKeys(_events) : []; + }; + EventEmitter.prototype.listenerCount = function(type) { + return this.listeners(type).length; + }; + EventEmitter.prototype.hasListeners = function(type) { + if (this.wildcard) { + var handlers = []; + var ns = typeof type === "string" ? type.split(this.delimiter) : type.slice(); + searchListenerTree.call(this, handlers, ns, this.listenerTree, 0); + return handlers.length > 0; + } + var _events = this._events; + var _all = this._all; + return !!(_all && _all.length || _events && (type === undefined2 ? ownKeys(_events).length : _events[type])); + }; + EventEmitter.prototype.listenersAny = function() { + if (this._all) { + return this._all; + } else { + return []; + } + }; + EventEmitter.prototype.waitFor = function(event, options) { + var self2 = this; + var type = typeof options; + if (type === "number") { + options = { timeout: options }; + } else if (type === "function") { + options = { filter: options }; + } + options = resolveOptions(options, { + timeout: 0, + filter: undefined2, + handleError: false, + Promise, + overload: false + }, { + filter: functionReducer, + Promise: constructorReducer + }); + return makeCancelablePromise(options.Promise, function(resolve, reject, onCancel) { + function listener() { + var filter = options.filter; + if (filter && !filter.apply(self2, arguments)) { + return; + } + self2.off(event, listener); + if (options.handleError) { + var err = arguments[0]; + err ? reject(err) : resolve(toArray2.apply(null, arguments).slice(1)); + } else { + resolve(toArray2.apply(null, arguments)); + } + } + onCancel(function() { + self2.off(event, listener); + }); + self2._on(event, listener, false); + }, { + timeout: options.timeout, + overload: options.overload + }); + }; + function once(emitter, name, options) { + options = resolveOptions(options, { + Promise, + timeout: 0, + overload: false + }, { + Promise: constructorReducer + }); + var _Promise = options.Promise; + return makeCancelablePromise(_Promise, function(resolve, reject, onCancel) { + var handler; + if (typeof emitter.addEventListener === "function") { + handler = function() { + resolve(toArray2.apply(null, arguments)); + }; + onCancel(function() { + emitter.removeEventListener(name, handler); + }); + emitter.addEventListener( + name, + handler, + { once: true } + ); + return; + } + var eventListener = function() { + errorListener && emitter.removeListener("error", errorListener); + resolve(toArray2.apply(null, arguments)); + }; + var errorListener; + if (name !== "error") { + errorListener = function(err) { + emitter.removeListener(name, eventListener); + reject(err); + }; + emitter.once("error", errorListener); + } + onCancel(function() { + errorListener && emitter.removeListener("error", errorListener); + emitter.removeListener(name, eventListener); + }); + emitter.once(name, eventListener); + }, { + timeout: options.timeout, + overload: options.overload + }); + } + var prototype = EventEmitter.prototype; + Object.defineProperties(EventEmitter, { + defaultMaxListeners: { + get: function() { + return prototype._maxListeners; + }, + set: function(n) { + if (typeof n !== "number" || n < 0 || Number.isNaN(n)) { + throw TypeError("n must be a non-negative number"); + } + prototype._maxListeners = n; + }, + enumerable: true + }, + once: { + value: once, + writable: true, + configurable: true + } + }); + Object.defineProperties(prototype, { + _maxListeners: { + value: defaultMaxListeners, + writable: true, + configurable: true + }, + _observers: { value: null, writable: true, configurable: true } + }); + if (typeof define === "function" && define.amd) { + define(function() { + return EventEmitter; + }); + } else if (typeof exports === "object") { + module2.exports = EventEmitter; + } else { + var _global = new Function("", "return this")(); + _global.EventEmitter2 = EventEmitter; + } + }(); + } +}); + +// node_modules/mustache-validator/dist/index.js +var require_dist2 = __commonJS({ + "node_modules/mustache-validator/dist/index.js"(exports) { + "use strict"; + Object.defineProperty(exports, "__esModule", { value: true }); + var PathSymbol = Symbol("MustacheDataPath"); + function createPropertyPathArray({ target, propertyName }) { + return [...target[PathSymbol] || [], propertyName]; + } + function proxyMustacheData(data, options) { + if (typeof data !== "object") { + return data; + } + return new Proxy(data, { + get(target, propertyName) { + let value = target[propertyName]; + if (value === void 0 && !(propertyName in target)) { + const pathSegments = createPropertyPathArray({ target, propertyName }); + if (options === null || options === void 0 ? void 0 : options.handleError) { + options.handleError(pathSegments); + return value; + } + throw Error(`Missing Mustache data property: ${pathSegments.join(" > ")}`); + } + if (value && typeof value === "object") { + value[PathSymbol] = createPropertyPathArray({ target, propertyName }); + return proxyMustacheData(value, options); + } + return value; + } + }); + } + exports.default = proxyMustacheData; + } +}); + +// node_modules/boon-js/lib/types.js +var require_types = __commonJS({ + "node_modules/boon-js/lib/types.js"(exports) { + "use strict"; + exports.__esModule = true; + exports.Tokens = exports.StructuralCharacters = exports.Operators = void 0; + var Operators; + (function(Operators2) { + Operators2["AND"] = "AND"; + Operators2["OR"] = "OR"; + Operators2["XOR"] = "XOR"; + Operators2["NOT"] = "NOT"; + })(Operators = exports.Operators || (exports.Operators = {})); + var StructuralCharacters; + (function(StructuralCharacters2) { + StructuralCharacters2["OPEN_PARENTHESIS"] = "("; + StructuralCharacters2["CLOSE_PARENTHESIS"] = ")"; + })(StructuralCharacters = exports.StructuralCharacters || (exports.StructuralCharacters = {})); + var Tokens; + (function(Tokens2) { + Tokens2["IDENTIFIER"] = "IDENTIFIER"; + Tokens2["OPERATOR"] = "OPERATOR"; + Tokens2["STRUCTURAL_CHARACTER"] = "STRUCTURAL_CHARACTER"; + Tokens2["EOF"] = "EOF"; + Tokens2["COMMENT"] = "COMMENT"; + })(Tokens = exports.Tokens || (exports.Tokens = {})); + } +}); + +// node_modules/boon-js/lib/parse/const.js +var require_const = __commonJS({ + "node_modules/boon-js/lib/parse/const.js"(exports) { + "use strict"; + exports.__esModule = true; + exports.VALID_TOKENS = exports.OPERATOR_PRECEDENCE = void 0; + var types_1 = require_types(); + exports.OPERATOR_PRECEDENCE = { + NOT: 0, + XOR: 1, + AND: 2, + OR: 3 + }; + exports.VALID_TOKENS = { + identifierOnly: [ + { name: types_1.Tokens.IDENTIFIER }, + { + name: types_1.Tokens.STRUCTURAL_CHARACTER, + value: types_1.StructuralCharacters.OPEN_PARENTHESIS + } + ], + identifierOrNot: [ + { name: types_1.Tokens.IDENTIFIER }, + { + name: types_1.Tokens.STRUCTURAL_CHARACTER, + value: types_1.StructuralCharacters.OPEN_PARENTHESIS + }, + { name: types_1.Tokens.OPERATOR, value: types_1.Operators.NOT } + ], + binaryOperator: [ + { name: types_1.Tokens.OPERATOR, value: types_1.Operators.AND }, + { name: types_1.Tokens.OPERATOR, value: types_1.Operators.OR }, + { name: types_1.Tokens.OPERATOR, value: types_1.Operators.XOR } + ], + binaryOperatorOrClose: [ + { name: types_1.Tokens.OPERATOR, value: types_1.Operators.AND }, + { name: types_1.Tokens.OPERATOR, value: types_1.Operators.OR }, + { name: types_1.Tokens.OPERATOR, value: types_1.Operators.XOR }, + { + name: types_1.Tokens.STRUCTURAL_CHARACTER, + value: types_1.StructuralCharacters.CLOSE_PARENTHESIS + } + ] + }; + } +}); + +// node_modules/boon-js/lib/lex/const.js +var require_const2 = __commonJS({ + "node_modules/boon-js/lib/lex/const.js"(exports) { + "use strict"; + exports.__esModule = true; + exports.ESCAPE_CHARACTER = exports.EOL = exports.COMMENT_DELIMITER = exports.QUOTED_IDENTIFIER_DELIMITER = exports.SEPARATORS = exports.OPERATORS = exports.STRUCTURAL_CHARACTERS = void 0; + var types_1 = require_types(); + exports.STRUCTURAL_CHARACTERS = { + "(": types_1.StructuralCharacters.OPEN_PARENTHESIS, + ")": types_1.StructuralCharacters.CLOSE_PARENTHESIS + }; + exports.OPERATORS = { + AND: types_1.Operators.AND, + OR: types_1.Operators.OR, + XOR: types_1.Operators.XOR, + NOT: types_1.Operators.NOT + }; + exports.SEPARATORS = new Set([ + 32, + 9, + 10, + 13 + ].map(function(separator) { + return String.fromCodePoint(separator); + })); + exports.QUOTED_IDENTIFIER_DELIMITER = String.fromCodePoint(34); + exports.COMMENT_DELIMITER = String.fromCodePoint(35); + exports.EOL = String.fromCodePoint(10); + exports.ESCAPE_CHARACTER = String.fromCodePoint(92); + } +}); + +// node_modules/boon-js/lib/lex/utils.js +var require_utils = __commonJS({ + "node_modules/boon-js/lib/lex/utils.js"(exports) { + "use strict"; + var __assign2 = exports && exports.__assign || function() { + __assign2 = Object.assign || function(t) { + for (var s, i = 1, n = arguments.length; i < n; i++) { + s = arguments[i]; + for (var p in s) + if (Object.prototype.hasOwnProperty.call(s, p)) + t[p] = s[p]; + } + return t; + }; + return __assign2.apply(this, arguments); + }; + exports.__esModule = true; + exports.getQuotedIdentifier = exports.getComment = exports.createResult = void 0; + var types_1 = require_types(); + var const_1 = require_const2(); + var createResult = function(name, value, remainingString) { + return { + token: __assign2({ name }, value !== null ? { value } : {}), + remainingString + }; + }; + exports.createResult = createResult; + var getComment = function(expression) { + var tokenEnd = expression.length; + for (var i = 0; i < expression.length; i += 1) { + var letter = expression[i]; + if (letter === const_1.EOL) { + tokenEnd = i; + break; + } + } + return (0, exports.createResult)(types_1.Tokens.COMMENT, expression.slice(0, tokenEnd), expression.slice(tokenEnd + 1)); + }; + exports.getComment = getComment; + var getQuotedIdentifier = function(expression) { + var escapeQuotation = false; + var value = ""; + var tokenEnd = null; + for (var i = 0; i < expression.length; i += 1) { + var char = expression[i]; + if (tokenEnd === null) { + if (char === const_1.QUOTED_IDENTIFIER_DELIMITER) { + if (escapeQuotation) { + value = value.slice(-1) + const_1.QUOTED_IDENTIFIER_DELIMITER; + } else { + tokenEnd = i; + } + } else { + if (char === const_1.ESCAPE_CHARACTER) { + escapeQuotation = true; + } else { + escapeQuotation = false; + } + value = value += char; + } + } else { + if (!const_1.SEPARATORS.has(char) && !const_1.STRUCTURAL_CHARACTERS[char]) { + throw new Error("Unexpected character: ".concat(char, " Expected ) character or separator")); + } + break; + } + } + if (tokenEnd === null) { + throw new Error("Unexpected end of expression: expected ".concat(const_1.QUOTED_IDENTIFIER_DELIMITER, " character")); + } + return (0, exports.createResult)(types_1.Tokens.IDENTIFIER, value, expression.slice(tokenEnd + 1)); + }; + exports.getQuotedIdentifier = getQuotedIdentifier; + } +}); + +// node_modules/boon-js/lib/lex/lex.js +var require_lex = __commonJS({ + "node_modules/boon-js/lib/lex/lex.js"(exports) { + "use strict"; + exports.__esModule = true; + exports.lex = void 0; + var types_1 = require_types(); + var const_1 = require_const2(); + var utils_1 = require_utils(); + var lex = function(expression) { + var tokenStart = null; + var tokenEnd = null; + var delimitingCharacter = null; + for (var i = 0; i < expression.length; i += 1) { + var char = expression[i]; + if (tokenStart === null) { + if (!const_1.SEPARATORS.has(char)) { + var structuralChar = const_1.STRUCTURAL_CHARACTERS[char]; + if (structuralChar) { + var nextChar = expression[i + 1]; + if (structuralChar === types_1.StructuralCharacters.CLOSE_PARENTHESIS && nextChar && !const_1.SEPARATORS.has(nextChar) && nextChar !== types_1.StructuralCharacters.CLOSE_PARENTHESIS) { + throw new Error("Unexpected character: ".concat(nextChar, ". A closing parenthesis should be followed by another closing parenthesis or whitespace")); + } + return (0, utils_1.createResult)(types_1.Tokens.STRUCTURAL_CHARACTER, const_1.STRUCTURAL_CHARACTERS[char], expression.slice(i + 1)); + } + if (char === const_1.QUOTED_IDENTIFIER_DELIMITER) { + return (0, utils_1.getQuotedIdentifier)(expression.slice(i + 1)); + } + if (char === const_1.COMMENT_DELIMITER) { + return (0, utils_1.getComment)(expression.slice(i + 1)); + } + tokenStart = i; + } + } else { + if (const_1.SEPARATORS.has(char) || const_1.STRUCTURAL_CHARACTERS[char]) { + tokenEnd = i; + delimitingCharacter = char; + break; + } else { + if (char === const_1.QUOTED_IDENTIFIER_DELIMITER || char === const_1.COMMENT_DELIMITER) { + throw new Error("Unexpected character: ".concat(char)); + } + } + } + } + if (tokenStart !== null) { + tokenEnd = tokenEnd !== null && tokenEnd !== void 0 ? tokenEnd : expression.length; + var value = expression.slice(tokenStart, tokenEnd); + var remainingString = expression.slice(tokenEnd); + if (const_1.OPERATORS[value]) { + if (delimitingCharacter && !const_1.SEPARATORS.has(delimitingCharacter)) { + throw new Error("Unexpected character: ".concat(delimitingCharacter, ". Operators should be separated using whitespace")); + } + return (0, utils_1.createResult)(types_1.Tokens.OPERATOR, const_1.OPERATORS[value], remainingString); + } else { + return (0, utils_1.createResult)(types_1.Tokens.IDENTIFIER, value, remainingString); + } + } + return (0, utils_1.createResult)(types_1.Tokens.EOF, null, ""); + }; + exports.lex = lex; + } +}); + +// node_modules/boon-js/lib/parse/utils.js +var require_utils2 = __commonJS({ + "node_modules/boon-js/lib/parse/utils.js"(exports) { + "use strict"; + var __spreadArray2 = exports && exports.__spreadArray || function(to, from, pack) { + if (pack || arguments.length === 2) + for (var i = 0, l = from.length, ar; i < l; i++) { + if (ar || !(i in from)) { + if (!ar) + ar = Array.prototype.slice.call(from, 0, i); + ar[i] = from[i]; + } + } + return to.concat(ar || Array.prototype.slice.call(from)); + }; + exports.__esModule = true; + exports.validateToken = exports.previousOperatorTakesPrecedent = exports.getValue = exports.newTokenGenerator = void 0; + var lex_1 = require_lex(); + var types_1 = require_types(); + var const_1 = require_const(); + var newTokenGenerator = function(expression) { + var remainingExpression = expression; + return function(validTokens, endIsValid) { + if (endIsValid === void 0) { + endIsValid = false; + } + while (true) { + var _a = (0, lex_1.lex)(remainingExpression), token = _a.token, remainingString = _a.remainingString; + remainingExpression = remainingString; + if (token.name !== types_1.Tokens.COMMENT) { + (0, exports.validateToken)(token, validTokens, endIsValid); + return token; + } + } + }; + }; + exports.newTokenGenerator = newTokenGenerator; + var getValue = function(getNextToken, parser) { + var nextToken = getNextToken(const_1.VALID_TOKENS.identifierOrNot); + var negatedValue = nextToken.value === types_1.Operators.NOT; + if (negatedValue) { + nextToken = getNextToken(const_1.VALID_TOKENS.identifierOnly); + } + var value = nextToken.name === types_1.Tokens.STRUCTURAL_CHARACTER ? parser(getNextToken, true) : [nextToken]; + return negatedValue ? __spreadArray2(__spreadArray2([], value, true), [{ name: types_1.Tokens.OPERATOR, value: types_1.Operators.NOT }], false) : value; + }; + exports.getValue = getValue; + var previousOperatorTakesPrecedent = function(previousOperator, nextOperator) { + return const_1.OPERATOR_PRECEDENCE[previousOperator] <= const_1.OPERATOR_PRECEDENCE[nextOperator]; + }; + exports.previousOperatorTakesPrecedent = previousOperatorTakesPrecedent; + var validateToken = function(token, validTokens, endIsValid) { + if (endIsValid === void 0) { + endIsValid = false; + } + if (token.name === types_1.Tokens.EOF) { + if (endIsValid) { + return; + } + throw new Error("Unexpected end of expression"); + } + for (var _i = 0, validTokens_1 = validTokens; _i < validTokens_1.length; _i++) { + var validToken = validTokens_1[_i]; + if (validToken.name === token.name) { + if (!validToken.value || validToken.value === token.value) { + return; + } + } + } + throw new TypeError("Invalid token"); + }; + exports.validateToken = validateToken; + } +}); + +// node_modules/boon-js/lib/parse/parse.js +var require_parse = __commonJS({ + "node_modules/boon-js/lib/parse/parse.js"(exports) { + "use strict"; + var __spreadArray2 = exports && exports.__spreadArray || function(to, from, pack) { + if (pack || arguments.length === 2) + for (var i = 0, l = from.length, ar; i < l; i++) { + if (ar || !(i in from)) { + if (!ar) + ar = Array.prototype.slice.call(from, 0, i); + ar[i] = from[i]; + } + } + return to.concat(ar || Array.prototype.slice.call(from)); + }; + exports.__esModule = true; + exports.parse = void 0; + var types_1 = require_types(); + var const_1 = require_const(); + var utils_1 = require_utils2(); + var parse4 = function(expression) { + if (typeof expression !== "string") { + throw new Error("Expected string but received ".concat(typeof expression)); + } + var getNextToken = (0, utils_1.newTokenGenerator)(expression); + return parseInternal(getNextToken); + }; + exports.parse = parse4; + var parseInternal = function(getNextToken, nested) { + if (nested === void 0) { + nested = false; + } + var output = __spreadArray2([], (0, utils_1.getValue)(getNextToken, parseInternal), true); + var operators = []; + while (true) { + var validTokens = nested ? const_1.VALID_TOKENS.binaryOperatorOrClose : const_1.VALID_TOKENS.binaryOperator; + var nextToken = getNextToken(validTokens, !nested); + if (nextToken.name === types_1.Tokens.EOF || nextToken.name === types_1.Tokens.STRUCTURAL_CHARACTER) { + return __spreadArray2(__spreadArray2([], output, true), __spreadArray2([], operators, true).reverse(), true); + } + while (operators.length) { + var previousOperator = operators[operators.length - 1] || null; + if (previousOperator && (0, utils_1.previousOperatorTakesPrecedent)(previousOperator.value, nextToken.value)) { + output = __spreadArray2(__spreadArray2([], output, true), [previousOperator], false); + operators = operators.slice(0, -1); + } else { + break; + } + } + operators = __spreadArray2(__spreadArray2([], operators, true), [nextToken], false); + output = __spreadArray2(__spreadArray2([], output, true), (0, utils_1.getValue)(getNextToken, parseInternal), true); + } + }; + } +}); + +// node_modules/boon-js/lib/evaluate/utils.js +var require_utils3 = __commonJS({ + "node_modules/boon-js/lib/evaluate/utils.js"(exports) { + "use strict"; + exports.__esModule = true; + exports.throwInvalidExpression = exports.isOperator = exports.isIdentifier = exports.notUtil = exports.xorUtil = exports.orUtil = exports.andUtil = void 0; + var types_1 = require_types(); + var andUtil = function(left, right) { + return left && right; + }; + exports.andUtil = andUtil; + var orUtil = function(left, right) { + return left || right; + }; + exports.orUtil = orUtil; + var xorUtil = function(left, right) { + return !(left === right); + }; + exports.xorUtil = xorUtil; + var notUtil = function(identifier) { + return !identifier; + }; + exports.notUtil = notUtil; + var isIdentifier = function(_a) { + var name = _a.name, value = _a.value; + return name === types_1.Tokens.IDENTIFIER && typeof value === "string"; + }; + exports.isIdentifier = isIdentifier; + var isOperator = function(_a) { + var name = _a.name, value = _a.value; + return name === types_1.Tokens.OPERATOR && typeof value === "string"; + }; + exports.isOperator = isOperator; + var throwInvalidExpression = function(message) { + throw new TypeError("Invalid postfix expression: ".concat(message)); + }; + exports.throwInvalidExpression = throwInvalidExpression; + } +}); + +// node_modules/boon-js/lib/evaluate/const.js +var require_const3 = __commonJS({ + "node_modules/boon-js/lib/evaluate/const.js"(exports) { + "use strict"; + var _a; + exports.__esModule = true; + exports.OPERATOR_MAP = void 0; + var types_1 = require_types(); + var utils_1 = require_utils3(); + exports.OPERATOR_MAP = (_a = {}, _a[types_1.Operators.AND] = utils_1.andUtil, _a[types_1.Operators.OR] = utils_1.orUtil, _a[types_1.Operators.XOR] = utils_1.xorUtil, _a); + } +}); + +// node_modules/boon-js/lib/evaluate/evaluate.js +var require_evaluate = __commonJS({ + "node_modules/boon-js/lib/evaluate/evaluate.js"(exports) { + "use strict"; + var __spreadArray2 = exports && exports.__spreadArray || function(to, from, pack) { + if (pack || arguments.length === 2) + for (var i = 0, l = from.length, ar; i < l; i++) { + if (ar || !(i in from)) { + if (!ar) + ar = Array.prototype.slice.call(from, 0, i); + ar[i] = from[i]; + } + } + return to.concat(ar || Array.prototype.slice.call(from)); + }; + exports.__esModule = true; + exports.evaluate = exports.getEvaluator = void 0; + var parse_1 = require_parse(); + var types_1 = require_types(); + var const_1 = require_const3(); + var utils_1 = require_utils3(); + var getEvaluator = function(expression) { + var parsedExpression = (0, parse_1.parse)(expression); + return function(booleanMap) { + return (0, exports.evaluate)(parsedExpression, booleanMap); + }; + }; + exports.getEvaluator = getEvaluator; + var evaluate2 = function(expression, booleanMap) { + if (!Array.isArray(expression)) { + throw new Error("".concat(expression, " should be an array. evaluate takes in a parsed expression. Use in combination with parse or use getEvaluator")); + } + var evaluatedExpression = expression.reduce(function(stack, token, i) { + if (!(token && ((0, utils_1.isIdentifier)(token) || (0, utils_1.isOperator)(token)))) { + throw new Error("Invalid token: ".concat(token, ". Found in parsed expression at index ").concat(i)); + } + if (token.name === types_1.Tokens.IDENTIFIER) { + return __spreadArray2(__spreadArray2([], stack, true), [Boolean(booleanMap[token.value])], false); + } + var secondLastItem = stack[stack.length - 2]; + var lastItem = stack[stack.length - 1]; + if (token.value === types_1.Operators.NOT) { + if (lastItem === void 0) { + (0, utils_1.throwInvalidExpression)("missing identifier"); + } + return __spreadArray2(__spreadArray2([], stack.slice(0, -1), true), [(0, utils_1.notUtil)(lastItem)], false); + } + if (lastItem === void 0 || secondLastItem === void 0) { + (0, utils_1.throwInvalidExpression)("missing identifier"); + } + var operatorUtil = const_1.OPERATOR_MAP[token.value]; + if (!operatorUtil) { + (0, utils_1.throwInvalidExpression)("unknown operator"); + } + return __spreadArray2(__spreadArray2([], stack.slice(0, -2), true), [operatorUtil(secondLastItem, lastItem)], false); + }, []); + if (evaluatedExpression.length !== 1) { + (0, utils_1.throwInvalidExpression)("too many identifiers after evaluation"); + } + return evaluatedExpression[0]; + }; + exports.evaluate = evaluate2; + } +}); + +// node_modules/boon-js/lib/index.js +var require_lib = __commonJS({ + "node_modules/boon-js/lib/index.js"(exports) { + "use strict"; + var __createBinding = exports && exports.__createBinding || (Object.create ? function(o, m, k, k2) { + if (k2 === void 0) + k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { + return m[k]; + } }; + } + Object.defineProperty(o, k2, desc); + } : function(o, m, k, k2) { + if (k2 === void 0) + k2 = k; + o[k2] = m[k]; + }); + exports.__esModule = true; + exports.parse = exports.evaluate = exports.getEvaluator = void 0; + var evaluate_1 = require_evaluate(); + __createBinding(exports, evaluate_1, "getEvaluator"); + __createBinding(exports, evaluate_1, "evaluate"); + var parse_1 = require_parse(); + __createBinding(exports, parse_1, "parse"); + } +}); + +// src/main.ts +var main_exports = {}; +__export(main_exports, { + default: () => TasksPlugin +}); +module.exports = __toCommonJS(main_exports); +var import_obsidian18 = require("obsidian"); + +// src/Obsidian/Cache.ts +var import_obsidian4 = require("obsidian"); + +// node_modules/async-mutex/index.mjs +var E_TIMEOUT = new Error("timeout while waiting for mutex to become available"); +var E_ALREADY_LOCKED = new Error("mutex already locked"); +var E_CANCELED = new Error("request for lock canceled"); +var __awaiter$2 = function(thisArg, _arguments, P, generator) { + function adopt(value) { + return value instanceof P ? value : new P(function(resolve) { + resolve(value); + }); + } + return new (P || (P = Promise))(function(resolve, reject) { + function fulfilled(value) { + try { + step(generator.next(value)); + } catch (e) { + reject(e); + } + } + function rejected(value) { + try { + step(generator["throw"](value)); + } catch (e) { + reject(e); + } + } + function step(result) { + result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); + } + step((generator = generator.apply(thisArg, _arguments || [])).next()); + }); +}; +var Semaphore = class { + constructor(_value, _cancelError = E_CANCELED) { + this._value = _value; + this._cancelError = _cancelError; + this._weightedQueues = []; + this._weightedWaiters = []; + } + acquire(weight = 1) { + if (weight <= 0) + throw new Error(`invalid weight ${weight}: must be positive`); + return new Promise((resolve, reject) => { + if (!this._weightedQueues[weight - 1]) + this._weightedQueues[weight - 1] = []; + this._weightedQueues[weight - 1].push({ resolve, reject }); + this._dispatch(); + }); + } + runExclusive(callback, weight = 1) { + return __awaiter$2(this, void 0, void 0, function* () { + const [value, release] = yield this.acquire(weight); + try { + return yield callback(value); + } finally { + release(); + } + }); + } + waitForUnlock(weight = 1) { + if (weight <= 0) + throw new Error(`invalid weight ${weight}: must be positive`); + return new Promise((resolve) => { + if (!this._weightedWaiters[weight - 1]) + this._weightedWaiters[weight - 1] = []; + this._weightedWaiters[weight - 1].push(resolve); + this._dispatch(); + }); + } + isLocked() { + return this._value <= 0; + } + getValue() { + return this._value; + } + setValue(value) { + this._value = value; + this._dispatch(); + } + release(weight = 1) { + if (weight <= 0) + throw new Error(`invalid weight ${weight}: must be positive`); + this._value += weight; + this._dispatch(); + } + cancel() { + this._weightedQueues.forEach((queue) => queue.forEach((entry) => entry.reject(this._cancelError))); + this._weightedQueues = []; + } + _dispatch() { + var _a; + for (let weight = this._value; weight > 0; weight--) { + const queueEntry = (_a = this._weightedQueues[weight - 1]) === null || _a === void 0 ? void 0 : _a.shift(); + if (!queueEntry) + continue; + const previousValue = this._value; + const previousWeight = weight; + this._value -= weight; + weight = this._value + 1; + queueEntry.resolve([previousValue, this._newReleaser(previousWeight)]); + } + this._drainUnlockWaiters(); + } + _newReleaser(weight) { + let called = false; + return () => { + if (called) + return; + called = true; + this.release(weight); + }; + } + _drainUnlockWaiters() { + for (let weight = this._value; weight > 0; weight--) { + if (!this._weightedWaiters[weight - 1]) + continue; + this._weightedWaiters[weight - 1].forEach((waiter) => waiter()); + this._weightedWaiters[weight - 1] = []; + } + } +}; +var __awaiter$1 = function(thisArg, _arguments, P, generator) { + function adopt(value) { + return value instanceof P ? value : new P(function(resolve) { + resolve(value); + }); + } + return new (P || (P = Promise))(function(resolve, reject) { + function fulfilled(value) { + try { + step(generator.next(value)); + } catch (e) { + reject(e); + } + } + function rejected(value) { + try { + step(generator["throw"](value)); + } catch (e) { + reject(e); + } + } + function step(result) { + result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); + } + step((generator = generator.apply(thisArg, _arguments || [])).next()); + }); +}; +var Mutex = class { + constructor(cancelError) { + this._semaphore = new Semaphore(1, cancelError); + } + acquire() { + return __awaiter$1(this, void 0, void 0, function* () { + const [, releaser] = yield this._semaphore.acquire(); + return releaser; + }); + } + runExclusive(callback) { + return this._semaphore.runExclusive(() => callback()); + } + isLocked() { + return this._semaphore.isLocked(); + } + waitForUnlock() { + return this._semaphore.waitForUnlock(); + } + release() { + if (this._semaphore.isLocked()) + this._semaphore.release(); + } + cancel() { + return this._semaphore.cancel(); + } +}; + +// src/Scripting/TasksFile.ts +var TasksFile = class { + constructor(path) { + this._path = path; + } + get path() { + return this._path; + } + get pathWithoutExtension() { + return this.withoutExtension(this.path); + } + withoutExtension(value) { + return value.replace(/\.md$/, ""); + } + get root() { + let path = this.path.replace(/\\/g, "/"); + if (path.charAt(0) === "/") { + path = path.substring(1); + } + const separatorIndex = path.indexOf("/"); + if (separatorIndex == -1) { + return "/"; + } + return path.substring(0, separatorIndex + 1); + } + get folder() { + const path = this.path; + const fileNameWithExtension = this.filename; + const folder = path.substring(0, path.lastIndexOf(fileNameWithExtension)); + if (folder === "") { + return "/"; + } + return folder; + } + get filename() { + const fileNameMatch = this.path.match(/([^/]+)$/); + if (fileNameMatch !== null) { + return fileNameMatch[1]; + } else { + return ""; + } + } + get filenameWithoutExtension() { + return this.withoutExtension(this.filename); + } +}; + +// src/Query/DateParser.ts +var chrono = __toESM(require_dist()); + +// src/Query/DateRange.ts +var DateRange = class { + constructor(start, end) { + this.start = start; + this.end = end; + if (end.isBefore(start)) { + this.start = end; + this.end = start; + } + this.start = this.start.startOf("day"); + this.end = this.end.startOf("day"); + } + static buildRelative(range2) { + const unitOfTime = range2 === "week" ? "isoWeek" : range2; + return new DateRange( + window.moment().startOf(unitOfTime).startOf("day"), + window.moment().endOf(unitOfTime).startOf("day") + ); + } + static buildInvalid() { + return new DateRange(window.moment.invalid(), window.moment.invalid()); + } + isValid() { + return this.start.isValid() && this.end.isValid(); + } + moveToPrevious(duration) { + const delta = window.moment.duration(1, duration); + this.start.subtract(delta); + this.end.subtract(delta); + if (duration === "month" || duration === "quarter") { + this.end = this.end.endOf(duration).startOf("day"); + } + } + moveToNext(duration) { + const delta = window.moment.duration(1, duration); + this.start.add(delta); + this.end.add(delta); + if (duration === "month" || duration === "quarter") { + this.end = this.end.endOf(duration).startOf("day"); + } + } +}; + +// src/Query/DateParser.ts +var DateParser = class { + static parseDate(input, forwardDate = false) { + return window.moment( + chrono.parseDate(input, void 0, { + forwardDate + }) + ).startOf("day"); + } + static parseDateRange(input, forwardDate = false) { + const dateRangeParsers = [ + DateParser.parseRelativeDateRange, + DateParser.parseNumberedDateRange, + DateParser.parseAbsoluteDateRange + ]; + for (const parser of dateRangeParsers) { + const parsedDateRange = parser(input, forwardDate); + if (parsedDateRange.isValid()) { + return parsedDateRange; + } + } + return DateRange.buildInvalid(); + } + static parseAbsoluteDateRange(input, forwardDate) { + const result = chrono.parse(input, void 0, { + forwardDate + }); + if (result.length === 0) { + return DateRange.buildInvalid(); + } + const startDate = result[0].start; + const endDate = result[1] && result[1].start ? result[1].start : startDate; + const start = window.moment(startDate.date()); + const end = window.moment(endDate.date()); + return new DateRange(start, end); + } + static parseRelativeDateRange(input, _forwardDate) { + const relativeDateRangeRegexp = /(last|this|next) (week|month|quarter|year)/; + const relativeDateRangeMatch = input.match(relativeDateRangeRegexp); + if (relativeDateRangeMatch && relativeDateRangeMatch.length === 3) { + const lastThisNext = relativeDateRangeMatch[1]; + const range2 = relativeDateRangeMatch[2]; + const dateRange = DateRange.buildRelative(range2); + switch (lastThisNext) { + case "last": + dateRange.moveToPrevious(range2); + break; + case "next": + dateRange.moveToNext(range2); + break; + } + return dateRange; + } + return DateRange.buildInvalid(); + } + static parseNumberedDateRange(input, _forwardDate) { + const parsingVectors = [ + [/^\s*[0-9]{4}\s*$/, "YYYY", "year"], + [/^\s*[0-9]{4}-Q[1-4]\s*$/, "YYYY-Q", "quarter"], + [/^\s*[0-9]{4}-[0-9]{2}\s*$/, "YYYY-MM", "month"], + [/^\s*[0-9]{4}-W[0-9]{2}\s*$/, "YYYY-WW", "isoWeek"] + ]; + for (const [regexp, dateFormat, range2] of parsingVectors) { + const matched = input.match(regexp); + if (matched) { + const date = matched[0].trim(); + return new DateRange( + window.moment(date, dateFormat).startOf(range2), + window.moment(date, dateFormat).endOf(range2) + ); + } + } + return DateRange.buildInvalid(); + } +}; + +// src/lib/DateAbbreviations.ts +var abbreviations = { + td: "today", + tm: "tomorrow", + yd: "yesterday", + tw: "this week", + nw: "next week", + weekend: "sat", + we: "sat" +}; +function doAutocomplete(date) { + for (const [key, val] of Object.entries(abbreviations)) { + date = date.replace(RegExp(`\\b${key}\\s`, "i"), val); + } + return date; +} + +// node_modules/rrule/dist/esm/weekday.js +var ALL_WEEKDAYS = [ + "MO", + "TU", + "WE", + "TH", + "FR", + "SA", + "SU" +]; +var Weekday = function() { + function Weekday2(weekday, n) { + if (n === 0) + throw new Error("Can't create weekday with n == 0"); + this.weekday = weekday; + this.n = n; + } + Weekday2.fromStr = function(str) { + return new Weekday2(ALL_WEEKDAYS.indexOf(str)); + }; + Weekday2.prototype.nth = function(n) { + return this.n === n ? this : new Weekday2(this.weekday, n); + }; + Weekday2.prototype.equals = function(other) { + return this.weekday === other.weekday && this.n === other.n; + }; + Weekday2.prototype.toString = function() { + var s = ALL_WEEKDAYS[this.weekday]; + if (this.n) + s = (this.n > 0 ? "+" : "") + String(this.n) + s; + return s; + }; + Weekday2.prototype.getJsWeekday = function() { + return this.weekday === 6 ? 0 : this.weekday + 1; + }; + return Weekday2; +}(); + +// node_modules/rrule/dist/esm/helpers.js +var isPresent = function(value) { + return value !== null && value !== void 0; +}; +var isNumber = function(value) { + return typeof value === "number"; +}; +var isWeekdayStr = function(value) { + return typeof value === "string" && ALL_WEEKDAYS.includes(value); +}; +var isArray = Array.isArray; +var range = function(start, end) { + if (end === void 0) { + end = start; + } + if (arguments.length === 1) { + end = start; + start = 0; + } + var rang = []; + for (var i = start; i < end; i++) + rang.push(i); + return rang; +}; +var repeat = function(value, times) { + var i = 0; + var array = []; + if (isArray(value)) { + for (; i < times; i++) + array[i] = [].concat(value); + } else { + for (; i < times; i++) + array[i] = value; + } + return array; +}; +var toArray = function(item) { + if (isArray(item)) { + return item; + } + return [item]; +}; +function padStart(item, targetLength, padString) { + if (padString === void 0) { + padString = " "; + } + var str = String(item); + targetLength = targetLength >> 0; + if (str.length > targetLength) { + return String(str); + } + targetLength = targetLength - str.length; + if (targetLength > padString.length) { + padString += repeat(padString, targetLength / padString.length); + } + return padString.slice(0, targetLength) + String(str); +} +var split = function(str, sep, num) { + var splits = str.split(sep); + return num ? splits.slice(0, num).concat([splits.slice(num).join(sep)]) : splits; +}; +var pymod = function(a, b) { + var r = a % b; + return r * b < 0 ? r + b : r; +}; +var divmod = function(a, b) { + return { div: Math.floor(a / b), mod: pymod(a, b) }; +}; +var empty = function(obj) { + return !isPresent(obj) || obj.length === 0; +}; +var notEmpty = function(obj) { + return !empty(obj); +}; +var includes = function(arr, val) { + return notEmpty(arr) && arr.indexOf(val) !== -1; +}; + +// node_modules/rrule/dist/esm/dateutil.js +var datetime = function(y, m, d, h, i, s) { + if (h === void 0) { + h = 0; + } + if (i === void 0) { + i = 0; + } + if (s === void 0) { + s = 0; + } + return new Date(Date.UTC(y, m - 1, d, h, i, s)); +}; +var MONTH_DAYS = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31]; +var ONE_DAY = 1e3 * 60 * 60 * 24; +var MAXYEAR = 9999; +var ORDINAL_BASE = datetime(1970, 1, 1); +var PY_WEEKDAYS = [6, 0, 1, 2, 3, 4, 5]; +var isLeapYear = function(year) { + return year % 4 === 0 && year % 100 !== 0 || year % 400 === 0; +}; +var isDate = function(value) { + return value instanceof Date; +}; +var isValidDate = function(value) { + return isDate(value) && !isNaN(value.getTime()); +}; +var tzOffset = function(date) { + return date.getTimezoneOffset() * 60 * 1e3; +}; +var daysBetween = function(date1, date2) { + var date1ms = date1.getTime() - tzOffset(date1); + var date2ms = date2.getTime() - tzOffset(date2); + var differencems = date1ms - date2ms; + return Math.round(differencems / ONE_DAY); +}; +var toOrdinal = function(date) { + return daysBetween(date, ORDINAL_BASE); +}; +var fromOrdinal = function(ordinal) { + return new Date(ORDINAL_BASE.getTime() + ordinal * ONE_DAY); +}; +var getMonthDays = function(date) { + var month = date.getUTCMonth(); + return month === 1 && isLeapYear(date.getUTCFullYear()) ? 29 : MONTH_DAYS[month]; +}; +var getWeekday = function(date) { + return PY_WEEKDAYS[date.getUTCDay()]; +}; +var monthRange = function(year, month) { + var date = datetime(year, month + 1, 1); + return [getWeekday(date), getMonthDays(date)]; +}; +var combine = function(date, time) { + time = time || date; + return new Date(Date.UTC(date.getUTCFullYear(), date.getUTCMonth(), date.getUTCDate(), time.getHours(), time.getMinutes(), time.getSeconds(), time.getMilliseconds())); +}; +var clone = function(date) { + var dolly = new Date(date.getTime()); + return dolly; +}; +var cloneDates = function(dates) { + var clones = []; + for (var i = 0; i < dates.length; i++) { + clones.push(clone(dates[i])); + } + return clones; +}; +var sort = function(dates) { + dates.sort(function(a, b) { + return a.getTime() - b.getTime(); + }); +}; +var timeToUntilString = function(time, utc) { + if (utc === void 0) { + utc = true; + } + var date = new Date(time); + return [ + padStart(date.getUTCFullYear().toString(), 4, "0"), + padStart(date.getUTCMonth() + 1, 2, "0"), + padStart(date.getUTCDate(), 2, "0"), + "T", + padStart(date.getUTCHours(), 2, "0"), + padStart(date.getUTCMinutes(), 2, "0"), + padStart(date.getUTCSeconds(), 2, "0"), + utc ? "Z" : "" + ].join(""); +}; +var untilStringToDate = function(until) { + var re = /^(\d{4})(\d{2})(\d{2})(T(\d{2})(\d{2})(\d{2})Z?)?$/; + var bits = re.exec(until); + if (!bits) + throw new Error("Invalid UNTIL value: ".concat(until)); + return new Date(Date.UTC(parseInt(bits[1], 10), parseInt(bits[2], 10) - 1, parseInt(bits[3], 10), parseInt(bits[5], 10) || 0, parseInt(bits[6], 10) || 0, parseInt(bits[7], 10) || 0)); +}; +var dateTZtoISO8601 = function(date, timeZone) { + var dateStr = date.toLocaleString("sv-SE", { timeZone }); + return dateStr.replace(" ", "T") + "Z"; +}; +var dateInTimeZone = function(date, timeZone) { + var localTimeZone = Intl.DateTimeFormat().resolvedOptions().timeZone; + var dateInLocalTZ = new Date(dateTZtoISO8601(date, localTimeZone)); + var dateInTargetTZ = new Date(dateTZtoISO8601(date, timeZone !== null && timeZone !== void 0 ? timeZone : "UTC")); + var tzOffset2 = dateInTargetTZ.getTime() - dateInLocalTZ.getTime(); + return new Date(date.getTime() - tzOffset2); +}; + +// node_modules/rrule/dist/esm/iterresult.js +var IterResult = function() { + function IterResult2(method, args) { + this.minDate = null; + this.maxDate = null; + this._result = []; + this.total = 0; + this.method = method; + this.args = args; + if (method === "between") { + this.maxDate = args.inc ? args.before : new Date(args.before.getTime() - 1); + this.minDate = args.inc ? args.after : new Date(args.after.getTime() + 1); + } else if (method === "before") { + this.maxDate = args.inc ? args.dt : new Date(args.dt.getTime() - 1); + } else if (method === "after") { + this.minDate = args.inc ? args.dt : new Date(args.dt.getTime() + 1); + } + } + IterResult2.prototype.accept = function(date) { + ++this.total; + var tooEarly = this.minDate && date < this.minDate; + var tooLate = this.maxDate && date > this.maxDate; + if (this.method === "between") { + if (tooEarly) + return true; + if (tooLate) + return false; + } else if (this.method === "before") { + if (tooLate) + return false; + } else if (this.method === "after") { + if (tooEarly) + return true; + this.add(date); + return false; + } + return this.add(date); + }; + IterResult2.prototype.add = function(date) { + this._result.push(date); + return true; + }; + IterResult2.prototype.getValue = function() { + var res = this._result; + switch (this.method) { + case "all": + case "between": + return res; + case "before": + case "after": + default: + return res.length ? res[res.length - 1] : null; + } + }; + IterResult2.prototype.clone = function() { + return new IterResult2(this.method, this.args); + }; + return IterResult2; +}(); +var iterresult_default = IterResult; + +// node_modules/rrule/node_modules/tslib/tslib.es6.js +var extendStatics = function(d, b) { + extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(d2, b2) { + d2.__proto__ = b2; + } || function(d2, b2) { + for (var p in b2) + if (Object.prototype.hasOwnProperty.call(b2, p)) + d2[p] = b2[p]; + }; + return extendStatics(d, b); +}; +function __extends(d, b) { + if (typeof b !== "function" && b !== null) + throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); + extendStatics(d, b); + function __() { + this.constructor = d; + } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); +} +var __assign = function() { + __assign = Object.assign || function __assign2(t) { + for (var s, i = 1, n = arguments.length; i < n; i++) { + s = arguments[i]; + for (var p in s) + if (Object.prototype.hasOwnProperty.call(s, p)) + t[p] = s[p]; + } + return t; + }; + return __assign.apply(this, arguments); +}; +function __spreadArray(to, from, pack) { + if (pack || arguments.length === 2) + for (var i = 0, l = from.length, ar; i < l; i++) { + if (ar || !(i in from)) { + if (!ar) + ar = Array.prototype.slice.call(from, 0, i); + ar[i] = from[i]; + } + } + return to.concat(ar || Array.prototype.slice.call(from)); +} + +// node_modules/rrule/dist/esm/callbackiterresult.js +var CallbackIterResult = function(_super) { + __extends(CallbackIterResult2, _super); + function CallbackIterResult2(method, args, iterator) { + var _this = _super.call(this, method, args) || this; + _this.iterator = iterator; + return _this; + } + CallbackIterResult2.prototype.add = function(date) { + if (this.iterator(date, this._result.length)) { + this._result.push(date); + return true; + } + return false; + }; + return CallbackIterResult2; +}(iterresult_default); +var callbackiterresult_default = CallbackIterResult; + +// node_modules/rrule/dist/esm/nlp/i18n.js +var ENGLISH = { + dayNames: [ + "Sunday", + "Monday", + "Tuesday", + "Wednesday", + "Thursday", + "Friday", + "Saturday" + ], + monthNames: [ + "January", + "February", + "March", + "April", + "May", + "June", + "July", + "August", + "September", + "October", + "November", + "December" + ], + tokens: { + SKIP: /^[ \r\n\t]+|^\.$/, + number: /^[1-9][0-9]*/, + numberAsText: /^(one|two|three)/i, + every: /^every/i, + "day(s)": /^days?/i, + "weekday(s)": /^weekdays?/i, + "week(s)": /^weeks?/i, + "hour(s)": /^hours?/i, + "minute(s)": /^minutes?/i, + "month(s)": /^months?/i, + "year(s)": /^years?/i, + on: /^(on|in)/i, + at: /^(at)/i, + the: /^the/i, + first: /^first/i, + second: /^second/i, + third: /^third/i, + nth: /^([1-9][0-9]*)(\.|th|nd|rd|st)/i, + last: /^last/i, + for: /^for/i, + "time(s)": /^times?/i, + until: /^(un)?til/i, + monday: /^mo(n(day)?)?/i, + tuesday: /^tu(e(s(day)?)?)?/i, + wednesday: /^we(d(n(esday)?)?)?/i, + thursday: /^th(u(r(sday)?)?)?/i, + friday: /^fr(i(day)?)?/i, + saturday: /^sa(t(urday)?)?/i, + sunday: /^su(n(day)?)?/i, + january: /^jan(uary)?/i, + february: /^feb(ruary)?/i, + march: /^mar(ch)?/i, + april: /^apr(il)?/i, + may: /^may/i, + june: /^june?/i, + july: /^july?/i, + august: /^aug(ust)?/i, + september: /^sep(t(ember)?)?/i, + october: /^oct(ober)?/i, + november: /^nov(ember)?/i, + december: /^dec(ember)?/i, + comma: /^(,\s*|(and|or)\s*)+/i + } +}; +var i18n_default = ENGLISH; + +// node_modules/rrule/dist/esm/nlp/totext.js +var contains = function(arr, val) { + return arr.indexOf(val) !== -1; +}; +var defaultGetText = function(id) { + return id.toString(); +}; +var defaultDateFormatter = function(year, month, day) { + return "".concat(month, " ").concat(day, ", ").concat(year); +}; +var ToText = function() { + function ToText2(rrule, gettext, language, dateFormatter) { + if (gettext === void 0) { + gettext = defaultGetText; + } + if (language === void 0) { + language = i18n_default; + } + if (dateFormatter === void 0) { + dateFormatter = defaultDateFormatter; + } + this.text = []; + this.language = language || i18n_default; + this.gettext = gettext; + this.dateFormatter = dateFormatter; + this.rrule = rrule; + this.options = rrule.options; + this.origOptions = rrule.origOptions; + if (this.origOptions.bymonthday) { + var bymonthday = [].concat(this.options.bymonthday); + var bynmonthday = [].concat(this.options.bynmonthday); + bymonthday.sort(function(a, b) { + return a - b; + }); + bynmonthday.sort(function(a, b) { + return b - a; + }); + this.bymonthday = bymonthday.concat(bynmonthday); + if (!this.bymonthday.length) + this.bymonthday = null; + } + if (isPresent(this.origOptions.byweekday)) { + var byweekday = !isArray(this.origOptions.byweekday) ? [this.origOptions.byweekday] : this.origOptions.byweekday; + var days = String(byweekday); + this.byweekday = { + allWeeks: byweekday.filter(function(weekday) { + return !weekday.n; + }), + someWeeks: byweekday.filter(function(weekday) { + return Boolean(weekday.n); + }), + isWeekdays: days.indexOf("MO") !== -1 && days.indexOf("TU") !== -1 && days.indexOf("WE") !== -1 && days.indexOf("TH") !== -1 && days.indexOf("FR") !== -1 && days.indexOf("SA") === -1 && days.indexOf("SU") === -1, + isEveryDay: days.indexOf("MO") !== -1 && days.indexOf("TU") !== -1 && days.indexOf("WE") !== -1 && days.indexOf("TH") !== -1 && days.indexOf("FR") !== -1 && days.indexOf("SA") !== -1 && days.indexOf("SU") !== -1 + }; + var sortWeekDays = function(a, b) { + return a.weekday - b.weekday; + }; + this.byweekday.allWeeks.sort(sortWeekDays); + this.byweekday.someWeeks.sort(sortWeekDays); + if (!this.byweekday.allWeeks.length) + this.byweekday.allWeeks = null; + if (!this.byweekday.someWeeks.length) + this.byweekday.someWeeks = null; + } else { + this.byweekday = null; + } + } + ToText2.isFullyConvertible = function(rrule) { + var canConvert = true; + if (!(rrule.options.freq in ToText2.IMPLEMENTED)) + return false; + if (rrule.origOptions.until && rrule.origOptions.count) + return false; + for (var key in rrule.origOptions) { + if (contains(["dtstart", "wkst", "freq"], key)) + return true; + if (!contains(ToText2.IMPLEMENTED[rrule.options.freq], key)) + return false; + } + return canConvert; + }; + ToText2.prototype.isFullyConvertible = function() { + return ToText2.isFullyConvertible(this.rrule); + }; + ToText2.prototype.toString = function() { + var gettext = this.gettext; + if (!(this.options.freq in ToText2.IMPLEMENTED)) { + return gettext("RRule error: Unable to fully convert this rrule to text"); + } + this.text = [gettext("every")]; + this[RRule.FREQUENCIES[this.options.freq]](); + if (this.options.until) { + this.add(gettext("until")); + var until = this.options.until; + this.add(this.dateFormatter(until.getUTCFullYear(), this.language.monthNames[until.getUTCMonth()], until.getUTCDate())); + } else if (this.options.count) { + this.add(gettext("for")).add(this.options.count.toString()).add(this.plural(this.options.count) ? gettext("times") : gettext("time")); + } + if (!this.isFullyConvertible()) + this.add(gettext("(~ approximate)")); + return this.text.join(""); + }; + ToText2.prototype.HOURLY = function() { + var gettext = this.gettext; + if (this.options.interval !== 1) + this.add(this.options.interval.toString()); + this.add(this.plural(this.options.interval) ? gettext("hours") : gettext("hour")); + }; + ToText2.prototype.MINUTELY = function() { + var gettext = this.gettext; + if (this.options.interval !== 1) + this.add(this.options.interval.toString()); + this.add(this.plural(this.options.interval) ? gettext("minutes") : gettext("minute")); + }; + ToText2.prototype.DAILY = function() { + var gettext = this.gettext; + if (this.options.interval !== 1) + this.add(this.options.interval.toString()); + if (this.byweekday && this.byweekday.isWeekdays) { + this.add(this.plural(this.options.interval) ? gettext("weekdays") : gettext("weekday")); + } else { + this.add(this.plural(this.options.interval) ? gettext("days") : gettext("day")); + } + if (this.origOptions.bymonth) { + this.add(gettext("in")); + this._bymonth(); + } + if (this.bymonthday) { + this._bymonthday(); + } else if (this.byweekday) { + this._byweekday(); + } else if (this.origOptions.byhour) { + this._byhour(); + } + }; + ToText2.prototype.WEEKLY = function() { + var gettext = this.gettext; + if (this.options.interval !== 1) { + this.add(this.options.interval.toString()).add(this.plural(this.options.interval) ? gettext("weeks") : gettext("week")); + } + if (this.byweekday && this.byweekday.isWeekdays) { + if (this.options.interval === 1) { + this.add(this.plural(this.options.interval) ? gettext("weekdays") : gettext("weekday")); + } else { + this.add(gettext("on")).add(gettext("weekdays")); + } + } else if (this.byweekday && this.byweekday.isEveryDay) { + this.add(this.plural(this.options.interval) ? gettext("days") : gettext("day")); + } else { + if (this.options.interval === 1) + this.add(gettext("week")); + if (this.origOptions.bymonth) { + this.add(gettext("in")); + this._bymonth(); + } + if (this.bymonthday) { + this._bymonthday(); + } else if (this.byweekday) { + this._byweekday(); + } + } + }; + ToText2.prototype.MONTHLY = function() { + var gettext = this.gettext; + if (this.origOptions.bymonth) { + if (this.options.interval !== 1) { + this.add(this.options.interval.toString()).add(gettext("months")); + if (this.plural(this.options.interval)) + this.add(gettext("in")); + } else { + } + this._bymonth(); + } else { + if (this.options.interval !== 1) { + this.add(this.options.interval.toString()); + } + this.add(this.plural(this.options.interval) ? gettext("months") : gettext("month")); + } + if (this.bymonthday) { + this._bymonthday(); + } else if (this.byweekday && this.byweekday.isWeekdays) { + this.add(gettext("on")).add(gettext("weekdays")); + } else if (this.byweekday) { + this._byweekday(); + } + }; + ToText2.prototype.YEARLY = function() { + var gettext = this.gettext; + if (this.origOptions.bymonth) { + if (this.options.interval !== 1) { + this.add(this.options.interval.toString()); + this.add(gettext("years")); + } else { + } + this._bymonth(); + } else { + if (this.options.interval !== 1) { + this.add(this.options.interval.toString()); + } + this.add(this.plural(this.options.interval) ? gettext("years") : gettext("year")); + } + if (this.bymonthday) { + this._bymonthday(); + } else if (this.byweekday) { + this._byweekday(); + } + if (this.options.byyearday) { + this.add(gettext("on the")).add(this.list(this.options.byyearday, this.nth, gettext("and"))).add(gettext("day")); + } + if (this.options.byweekno) { + this.add(gettext("in")).add(this.plural(this.options.byweekno.length) ? gettext("weeks") : gettext("week")).add(this.list(this.options.byweekno, void 0, gettext("and"))); + } + }; + ToText2.prototype._bymonthday = function() { + var gettext = this.gettext; + if (this.byweekday && this.byweekday.allWeeks) { + this.add(gettext("on")).add(this.list(this.byweekday.allWeeks, this.weekdaytext, gettext("or"))).add(gettext("the")).add(this.list(this.bymonthday, this.nth, gettext("or"))); + } else { + this.add(gettext("on the")).add(this.list(this.bymonthday, this.nth, gettext("and"))); + } + }; + ToText2.prototype._byweekday = function() { + var gettext = this.gettext; + if (this.byweekday.allWeeks && !this.byweekday.isWeekdays) { + this.add(gettext("on")).add(this.list(this.byweekday.allWeeks, this.weekdaytext)); + } + if (this.byweekday.someWeeks) { + if (this.byweekday.allWeeks) + this.add(gettext("and")); + this.add(gettext("on the")).add(this.list(this.byweekday.someWeeks, this.weekdaytext, gettext("and"))); + } + }; + ToText2.prototype._byhour = function() { + var gettext = this.gettext; + this.add(gettext("at")).add(this.list(this.origOptions.byhour, void 0, gettext("and"))); + }; + ToText2.prototype._bymonth = function() { + this.add(this.list(this.options.bymonth, this.monthtext, this.gettext("and"))); + }; + ToText2.prototype.nth = function(n) { + n = parseInt(n.toString(), 10); + var nth; + var gettext = this.gettext; + if (n === -1) + return gettext("last"); + var npos = Math.abs(n); + switch (npos) { + case 1: + case 21: + case 31: + nth = npos + gettext("st"); + break; + case 2: + case 22: + nth = npos + gettext("nd"); + break; + case 3: + case 23: + nth = npos + gettext("rd"); + break; + default: + nth = npos + gettext("th"); + } + return n < 0 ? nth + " " + gettext("last") : nth; + }; + ToText2.prototype.monthtext = function(m) { + return this.language.monthNames[m - 1]; + }; + ToText2.prototype.weekdaytext = function(wday) { + var weekday = isNumber(wday) ? (wday + 1) % 7 : wday.getJsWeekday(); + return (wday.n ? this.nth(wday.n) + " " : "") + this.language.dayNames[weekday]; + }; + ToText2.prototype.plural = function(n) { + return n % 100 !== 1; + }; + ToText2.prototype.add = function(s) { + this.text.push(" "); + this.text.push(s); + return this; + }; + ToText2.prototype.list = function(arr, callback, finalDelim, delim) { + var _this = this; + if (delim === void 0) { + delim = ","; + } + if (!isArray(arr)) { + arr = [arr]; + } + var delimJoin = function(array, delimiter, finalDelimiter) { + var list = ""; + for (var i = 0; i < array.length; i++) { + if (i !== 0) { + if (i === array.length - 1) { + list += " " + finalDelimiter + " "; + } else { + list += delimiter + " "; + } + } + list += array[i]; + } + return list; + }; + callback = callback || function(o) { + return o.toString(); + }; + var realCallback = function(arg) { + return callback && callback.call(_this, arg); + }; + if (finalDelim) { + return delimJoin(arr.map(realCallback), delim, finalDelim); + } else { + return arr.map(realCallback).join(delim + " "); + } + }; + return ToText2; +}(); +var totext_default = ToText; + +// node_modules/rrule/dist/esm/nlp/parsetext.js +var Parser = function() { + function Parser2(rules) { + this.done = true; + this.rules = rules; + } + Parser2.prototype.start = function(text2) { + this.text = text2; + this.done = false; + return this.nextSymbol(); + }; + Parser2.prototype.isDone = function() { + return this.done && this.symbol === null; + }; + Parser2.prototype.nextSymbol = function() { + var best; + var bestSymbol; + this.symbol = null; + this.value = null; + do { + if (this.done) + return false; + var rule = void 0; + best = null; + for (var name_1 in this.rules) { + rule = this.rules[name_1]; + var match = rule.exec(this.text); + if (match) { + if (best === null || match[0].length > best[0].length) { + best = match; + bestSymbol = name_1; + } + } + } + if (best != null) { + this.text = this.text.substr(best[0].length); + if (this.text === "") + this.done = true; + } + if (best == null) { + this.done = true; + this.symbol = null; + this.value = null; + return; + } + } while (bestSymbol === "SKIP"); + this.symbol = bestSymbol; + this.value = best; + return true; + }; + Parser2.prototype.accept = function(name) { + if (this.symbol === name) { + if (this.value) { + var v = this.value; + this.nextSymbol(); + return v; + } + this.nextSymbol(); + return true; + } + return false; + }; + Parser2.prototype.acceptNumber = function() { + return this.accept("number"); + }; + Parser2.prototype.expect = function(name) { + if (this.accept(name)) + return true; + throw new Error("expected " + name + " but found " + this.symbol); + }; + return Parser2; +}(); +function parseText(text2, language) { + if (language === void 0) { + language = i18n_default; + } + var options = {}; + var ttr = new Parser(language.tokens); + if (!ttr.start(text2)) + return null; + S(); + return options; + function S() { + ttr.expect("every"); + var n = ttr.acceptNumber(); + if (n) + options.interval = parseInt(n[0], 10); + if (ttr.isDone()) + throw new Error("Unexpected end"); + switch (ttr.symbol) { + case "day(s)": + options.freq = RRule.DAILY; + if (ttr.nextSymbol()) { + AT(); + F(); + } + break; + case "weekday(s)": + options.freq = RRule.WEEKLY; + options.byweekday = [RRule.MO, RRule.TU, RRule.WE, RRule.TH, RRule.FR]; + ttr.nextSymbol(); + F(); + break; + case "week(s)": + options.freq = RRule.WEEKLY; + if (ttr.nextSymbol()) { + ON(); + F(); + } + break; + case "hour(s)": + options.freq = RRule.HOURLY; + if (ttr.nextSymbol()) { + ON(); + F(); + } + break; + case "minute(s)": + options.freq = RRule.MINUTELY; + if (ttr.nextSymbol()) { + ON(); + F(); + } + break; + case "month(s)": + options.freq = RRule.MONTHLY; + if (ttr.nextSymbol()) { + ON(); + F(); + } + break; + case "year(s)": + options.freq = RRule.YEARLY; + if (ttr.nextSymbol()) { + ON(); + F(); + } + break; + case "monday": + case "tuesday": + case "wednesday": + case "thursday": + case "friday": + case "saturday": + case "sunday": + options.freq = RRule.WEEKLY; + var key = ttr.symbol.substr(0, 2).toUpperCase(); + options.byweekday = [RRule[key]]; + if (!ttr.nextSymbol()) + return; + while (ttr.accept("comma")) { + if (ttr.isDone()) + throw new Error("Unexpected end"); + var wkd = decodeWKD(); + if (!wkd) { + throw new Error("Unexpected symbol " + ttr.symbol + ", expected weekday"); + } + options.byweekday.push(RRule[wkd]); + ttr.nextSymbol(); + } + MDAYs(); + F(); + break; + case "january": + case "february": + case "march": + case "april": + case "may": + case "june": + case "july": + case "august": + case "september": + case "october": + case "november": + case "december": + options.freq = RRule.YEARLY; + options.bymonth = [decodeM()]; + if (!ttr.nextSymbol()) + return; + while (ttr.accept("comma")) { + if (ttr.isDone()) + throw new Error("Unexpected end"); + var m = decodeM(); + if (!m) { + throw new Error("Unexpected symbol " + ttr.symbol + ", expected month"); + } + options.bymonth.push(m); + ttr.nextSymbol(); + } + ON(); + F(); + break; + default: + throw new Error("Unknown symbol"); + } + } + function ON() { + var on = ttr.accept("on"); + var the = ttr.accept("the"); + if (!(on || the)) + return; + do { + var nth = decodeNTH(); + var wkd = decodeWKD(); + var m = decodeM(); + if (nth) { + if (wkd) { + ttr.nextSymbol(); + if (!options.byweekday) + options.byweekday = []; + options.byweekday.push(RRule[wkd].nth(nth)); + } else { + if (!options.bymonthday) + options.bymonthday = []; + options.bymonthday.push(nth); + ttr.accept("day(s)"); + } + } else if (wkd) { + ttr.nextSymbol(); + if (!options.byweekday) + options.byweekday = []; + options.byweekday.push(RRule[wkd]); + } else if (ttr.symbol === "weekday(s)") { + ttr.nextSymbol(); + if (!options.byweekday) { + options.byweekday = [RRule.MO, RRule.TU, RRule.WE, RRule.TH, RRule.FR]; + } + } else if (ttr.symbol === "week(s)") { + ttr.nextSymbol(); + var n = ttr.acceptNumber(); + if (!n) { + throw new Error("Unexpected symbol " + ttr.symbol + ", expected week number"); + } + options.byweekno = [parseInt(n[0], 10)]; + while (ttr.accept("comma")) { + n = ttr.acceptNumber(); + if (!n) { + throw new Error("Unexpected symbol " + ttr.symbol + "; expected monthday"); + } + options.byweekno.push(parseInt(n[0], 10)); + } + } else if (m) { + ttr.nextSymbol(); + if (!options.bymonth) + options.bymonth = []; + options.bymonth.push(m); + } else { + return; + } + } while (ttr.accept("comma") || ttr.accept("the") || ttr.accept("on")); + } + function AT() { + var at = ttr.accept("at"); + if (!at) + return; + do { + var n = ttr.acceptNumber(); + if (!n) { + throw new Error("Unexpected symbol " + ttr.symbol + ", expected hour"); + } + options.byhour = [parseInt(n[0], 10)]; + while (ttr.accept("comma")) { + n = ttr.acceptNumber(); + if (!n) { + throw new Error("Unexpected symbol " + ttr.symbol + "; expected hour"); + } + options.byhour.push(parseInt(n[0], 10)); + } + } while (ttr.accept("comma") || ttr.accept("at")); + } + function decodeM() { + switch (ttr.symbol) { + case "january": + return 1; + case "february": + return 2; + case "march": + return 3; + case "april": + return 4; + case "may": + return 5; + case "june": + return 6; + case "july": + return 7; + case "august": + return 8; + case "september": + return 9; + case "october": + return 10; + case "november": + return 11; + case "december": + return 12; + default: + return false; + } + } + function decodeWKD() { + switch (ttr.symbol) { + case "monday": + case "tuesday": + case "wednesday": + case "thursday": + case "friday": + case "saturday": + case "sunday": + return ttr.symbol.substr(0, 2).toUpperCase(); + default: + return false; + } + } + function decodeNTH() { + switch (ttr.symbol) { + case "last": + ttr.nextSymbol(); + return -1; + case "first": + ttr.nextSymbol(); + return 1; + case "second": + ttr.nextSymbol(); + return ttr.accept("last") ? -2 : 2; + case "third": + ttr.nextSymbol(); + return ttr.accept("last") ? -3 : 3; + case "nth": + var v = parseInt(ttr.value[1], 10); + if (v < -366 || v > 366) + throw new Error("Nth out of range: " + v); + ttr.nextSymbol(); + return ttr.accept("last") ? -v : v; + default: + return false; + } + } + function MDAYs() { + ttr.accept("on"); + ttr.accept("the"); + var nth = decodeNTH(); + if (!nth) + return; + options.bymonthday = [nth]; + ttr.nextSymbol(); + while (ttr.accept("comma")) { + nth = decodeNTH(); + if (!nth) { + throw new Error("Unexpected symbol " + ttr.symbol + "; expected monthday"); + } + options.bymonthday.push(nth); + ttr.nextSymbol(); + } + } + function F() { + if (ttr.symbol === "until") { + var date = Date.parse(ttr.text); + if (!date) + throw new Error("Cannot parse until date:" + ttr.text); + options.until = new Date(date); + } else if (ttr.accept("for")) { + options.count = parseInt(ttr.value[0], 10); + ttr.expect("number"); + } + } +} + +// node_modules/rrule/dist/esm/types.js +var Frequency; +(function(Frequency2) { + Frequency2[Frequency2["YEARLY"] = 0] = "YEARLY"; + Frequency2[Frequency2["MONTHLY"] = 1] = "MONTHLY"; + Frequency2[Frequency2["WEEKLY"] = 2] = "WEEKLY"; + Frequency2[Frequency2["DAILY"] = 3] = "DAILY"; + Frequency2[Frequency2["HOURLY"] = 4] = "HOURLY"; + Frequency2[Frequency2["MINUTELY"] = 5] = "MINUTELY"; + Frequency2[Frequency2["SECONDLY"] = 6] = "SECONDLY"; +})(Frequency || (Frequency = {})); +function freqIsDailyOrGreater(freq) { + return freq < Frequency.HOURLY; +} + +// node_modules/rrule/dist/esm/nlp/index.js +var fromText = function(text2, language) { + if (language === void 0) { + language = i18n_default; + } + return new RRule(parseText(text2, language) || void 0); +}; +var common = [ + "count", + "until", + "interval", + "byweekday", + "bymonthday", + "bymonth" +]; +totext_default.IMPLEMENTED = []; +totext_default.IMPLEMENTED[Frequency.HOURLY] = common; +totext_default.IMPLEMENTED[Frequency.MINUTELY] = common; +totext_default.IMPLEMENTED[Frequency.DAILY] = ["byhour"].concat(common); +totext_default.IMPLEMENTED[Frequency.WEEKLY] = common; +totext_default.IMPLEMENTED[Frequency.MONTHLY] = common; +totext_default.IMPLEMENTED[Frequency.YEARLY] = ["byweekno", "byyearday"].concat(common); +var toText = function(rrule, gettext, language, dateFormatter) { + return new totext_default(rrule, gettext, language, dateFormatter).toString(); +}; +var isFullyConvertible = totext_default.isFullyConvertible; + +// node_modules/rrule/dist/esm/datetime.js +var Time = function() { + function Time2(hour, minute, second, millisecond) { + this.hour = hour; + this.minute = minute; + this.second = second; + this.millisecond = millisecond || 0; + } + Time2.prototype.getHours = function() { + return this.hour; + }; + Time2.prototype.getMinutes = function() { + return this.minute; + }; + Time2.prototype.getSeconds = function() { + return this.second; + }; + Time2.prototype.getMilliseconds = function() { + return this.millisecond; + }; + Time2.prototype.getTime = function() { + return (this.hour * 60 * 60 + this.minute * 60 + this.second) * 1e3 + this.millisecond; + }; + return Time2; +}(); +var DateTime = function(_super) { + __extends(DateTime2, _super); + function DateTime2(year, month, day, hour, minute, second, millisecond) { + var _this = _super.call(this, hour, minute, second, millisecond) || this; + _this.year = year; + _this.month = month; + _this.day = day; + return _this; + } + DateTime2.fromDate = function(date) { + return new this(date.getUTCFullYear(), date.getUTCMonth() + 1, date.getUTCDate(), date.getUTCHours(), date.getUTCMinutes(), date.getUTCSeconds(), date.valueOf() % 1e3); + }; + DateTime2.prototype.getWeekday = function() { + return getWeekday(new Date(this.getTime())); + }; + DateTime2.prototype.getTime = function() { + return new Date(Date.UTC(this.year, this.month - 1, this.day, this.hour, this.minute, this.second, this.millisecond)).getTime(); + }; + DateTime2.prototype.getDay = function() { + return this.day; + }; + DateTime2.prototype.getMonth = function() { + return this.month; + }; + DateTime2.prototype.getYear = function() { + return this.year; + }; + DateTime2.prototype.addYears = function(years) { + this.year += years; + }; + DateTime2.prototype.addMonths = function(months) { + this.month += months; + if (this.month > 12) { + var yearDiv = Math.floor(this.month / 12); + var monthMod = pymod(this.month, 12); + this.month = monthMod; + this.year += yearDiv; + if (this.month === 0) { + this.month = 12; + --this.year; + } + } + }; + DateTime2.prototype.addWeekly = function(days, wkst) { + if (wkst > this.getWeekday()) { + this.day += -(this.getWeekday() + 1 + (6 - wkst)) + days * 7; + } else { + this.day += -(this.getWeekday() - wkst) + days * 7; + } + this.fixDay(); + }; + DateTime2.prototype.addDaily = function(days) { + this.day += days; + this.fixDay(); + }; + DateTime2.prototype.addHours = function(hours, filtered, byhour) { + if (filtered) { + this.hour += Math.floor((23 - this.hour) / hours) * hours; + } + for (; ; ) { + this.hour += hours; + var _a = divmod(this.hour, 24), dayDiv = _a.div, hourMod = _a.mod; + if (dayDiv) { + this.hour = hourMod; + this.addDaily(dayDiv); + } + if (empty(byhour) || includes(byhour, this.hour)) + break; + } + }; + DateTime2.prototype.addMinutes = function(minutes, filtered, byhour, byminute) { + if (filtered) { + this.minute += Math.floor((1439 - (this.hour * 60 + this.minute)) / minutes) * minutes; + } + for (; ; ) { + this.minute += minutes; + var _a = divmod(this.minute, 60), hourDiv = _a.div, minuteMod = _a.mod; + if (hourDiv) { + this.minute = minuteMod; + this.addHours(hourDiv, false, byhour); + } + if ((empty(byhour) || includes(byhour, this.hour)) && (empty(byminute) || includes(byminute, this.minute))) { + break; + } + } + }; + DateTime2.prototype.addSeconds = function(seconds, filtered, byhour, byminute, bysecond) { + if (filtered) { + this.second += Math.floor((86399 - (this.hour * 3600 + this.minute * 60 + this.second)) / seconds) * seconds; + } + for (; ; ) { + this.second += seconds; + var _a = divmod(this.second, 60), minuteDiv = _a.div, secondMod = _a.mod; + if (minuteDiv) { + this.second = secondMod; + this.addMinutes(minuteDiv, false, byhour, byminute); + } + if ((empty(byhour) || includes(byhour, this.hour)) && (empty(byminute) || includes(byminute, this.minute)) && (empty(bysecond) || includes(bysecond, this.second))) { + break; + } + } + }; + DateTime2.prototype.fixDay = function() { + if (this.day <= 28) { + return; + } + var daysinmonth = monthRange(this.year, this.month - 1)[1]; + if (this.day <= daysinmonth) { + return; + } + while (this.day > daysinmonth) { + this.day -= daysinmonth; + ++this.month; + if (this.month === 13) { + this.month = 1; + ++this.year; + if (this.year > MAXYEAR) { + return; + } + } + daysinmonth = monthRange(this.year, this.month - 1)[1]; + } + }; + DateTime2.prototype.add = function(options, filtered) { + var freq = options.freq, interval = options.interval, wkst = options.wkst, byhour = options.byhour, byminute = options.byminute, bysecond = options.bysecond; + switch (freq) { + case Frequency.YEARLY: + return this.addYears(interval); + case Frequency.MONTHLY: + return this.addMonths(interval); + case Frequency.WEEKLY: + return this.addWeekly(interval, wkst); + case Frequency.DAILY: + return this.addDaily(interval); + case Frequency.HOURLY: + return this.addHours(interval, filtered, byhour); + case Frequency.MINUTELY: + return this.addMinutes(interval, filtered, byhour, byminute); + case Frequency.SECONDLY: + return this.addSeconds(interval, filtered, byhour, byminute, bysecond); + } + }; + return DateTime2; +}(Time); + +// node_modules/rrule/dist/esm/parseoptions.js +function initializeOptions(options) { + var invalid = []; + var keys = Object.keys(options); + for (var _i = 0, keys_1 = keys; _i < keys_1.length; _i++) { + var key = keys_1[_i]; + if (!includes(defaultKeys, key)) + invalid.push(key); + if (isDate(options[key]) && !isValidDate(options[key])) { + invalid.push(key); + } + } + if (invalid.length) { + throw new Error("Invalid options: " + invalid.join(", ")); + } + return __assign({}, options); +} +function parseOptions(options) { + var opts = __assign(__assign({}, DEFAULT_OPTIONS), initializeOptions(options)); + if (isPresent(opts.byeaster)) + opts.freq = RRule.YEARLY; + if (!(isPresent(opts.freq) && RRule.FREQUENCIES[opts.freq])) { + throw new Error("Invalid frequency: ".concat(opts.freq, " ").concat(options.freq)); + } + if (!opts.dtstart) + opts.dtstart = new Date(new Date().setMilliseconds(0)); + if (!isPresent(opts.wkst)) { + opts.wkst = RRule.MO.weekday; + } else if (isNumber(opts.wkst)) { + } else { + opts.wkst = opts.wkst.weekday; + } + if (isPresent(opts.bysetpos)) { + if (isNumber(opts.bysetpos)) + opts.bysetpos = [opts.bysetpos]; + for (var i = 0; i < opts.bysetpos.length; i++) { + var v = opts.bysetpos[i]; + if (v === 0 || !(v >= -366 && v <= 366)) { + throw new Error("bysetpos must be between 1 and 366, or between -366 and -1"); + } + } + } + if (!(Boolean(opts.byweekno) || notEmpty(opts.byweekno) || notEmpty(opts.byyearday) || Boolean(opts.bymonthday) || notEmpty(opts.bymonthday) || isPresent(opts.byweekday) || isPresent(opts.byeaster))) { + switch (opts.freq) { + case RRule.YEARLY: + if (!opts.bymonth) + opts.bymonth = opts.dtstart.getUTCMonth() + 1; + opts.bymonthday = opts.dtstart.getUTCDate(); + break; + case RRule.MONTHLY: + opts.bymonthday = opts.dtstart.getUTCDate(); + break; + case RRule.WEEKLY: + opts.byweekday = [getWeekday(opts.dtstart)]; + break; + } + } + if (isPresent(opts.bymonth) && !isArray(opts.bymonth)) { + opts.bymonth = [opts.bymonth]; + } + if (isPresent(opts.byyearday) && !isArray(opts.byyearday) && isNumber(opts.byyearday)) { + opts.byyearday = [opts.byyearday]; + } + if (!isPresent(opts.bymonthday)) { + opts.bymonthday = []; + opts.bynmonthday = []; + } else if (isArray(opts.bymonthday)) { + var bymonthday = []; + var bynmonthday = []; + for (var i = 0; i < opts.bymonthday.length; i++) { + var v = opts.bymonthday[i]; + if (v > 0) { + bymonthday.push(v); + } else if (v < 0) { + bynmonthday.push(v); + } + } + opts.bymonthday = bymonthday; + opts.bynmonthday = bynmonthday; + } else if (opts.bymonthday < 0) { + opts.bynmonthday = [opts.bymonthday]; + opts.bymonthday = []; + } else { + opts.bynmonthday = []; + opts.bymonthday = [opts.bymonthday]; + } + if (isPresent(opts.byweekno) && !isArray(opts.byweekno)) { + opts.byweekno = [opts.byweekno]; + } + if (!isPresent(opts.byweekday)) { + opts.bynweekday = null; + } else if (isNumber(opts.byweekday)) { + opts.byweekday = [opts.byweekday]; + opts.bynweekday = null; + } else if (isWeekdayStr(opts.byweekday)) { + opts.byweekday = [Weekday.fromStr(opts.byweekday).weekday]; + opts.bynweekday = null; + } else if (opts.byweekday instanceof Weekday) { + if (!opts.byweekday.n || opts.freq > RRule.MONTHLY) { + opts.byweekday = [opts.byweekday.weekday]; + opts.bynweekday = null; + } else { + opts.bynweekday = [[opts.byweekday.weekday, opts.byweekday.n]]; + opts.byweekday = null; + } + } else { + var byweekday = []; + var bynweekday = []; + for (var i = 0; i < opts.byweekday.length; i++) { + var wday = opts.byweekday[i]; + if (isNumber(wday)) { + byweekday.push(wday); + continue; + } else if (isWeekdayStr(wday)) { + byweekday.push(Weekday.fromStr(wday).weekday); + continue; + } + if (!wday.n || opts.freq > RRule.MONTHLY) { + byweekday.push(wday.weekday); + } else { + bynweekday.push([wday.weekday, wday.n]); + } + } + opts.byweekday = notEmpty(byweekday) ? byweekday : null; + opts.bynweekday = notEmpty(bynweekday) ? bynweekday : null; + } + if (!isPresent(opts.byhour)) { + opts.byhour = opts.freq < RRule.HOURLY ? [opts.dtstart.getUTCHours()] : null; + } else if (isNumber(opts.byhour)) { + opts.byhour = [opts.byhour]; + } + if (!isPresent(opts.byminute)) { + opts.byminute = opts.freq < RRule.MINUTELY ? [opts.dtstart.getUTCMinutes()] : null; + } else if (isNumber(opts.byminute)) { + opts.byminute = [opts.byminute]; + } + if (!isPresent(opts.bysecond)) { + opts.bysecond = opts.freq < RRule.SECONDLY ? [opts.dtstart.getUTCSeconds()] : null; + } else if (isNumber(opts.bysecond)) { + opts.bysecond = [opts.bysecond]; + } + return { parsedOptions: opts }; +} +function buildTimeset(opts) { + var millisecondModulo = opts.dtstart.getTime() % 1e3; + if (!freqIsDailyOrGreater(opts.freq)) { + return []; + } + var timeset = []; + opts.byhour.forEach(function(hour) { + opts.byminute.forEach(function(minute) { + opts.bysecond.forEach(function(second) { + timeset.push(new Time(hour, minute, second, millisecondModulo)); + }); + }); + }); + return timeset; +} + +// node_modules/rrule/dist/esm/parsestring.js +function parseString(rfcString) { + var options = rfcString.split("\n").map(parseLine).filter(function(x) { + return x !== null; + }); + return __assign(__assign({}, options[0]), options[1]); +} +function parseDtstart(line) { + var options = {}; + var dtstartWithZone = /DTSTART(?:;TZID=([^:=]+?))?(?::|=)([^;\s]+)/i.exec(line); + if (!dtstartWithZone) { + return options; + } + var tzid = dtstartWithZone[1], dtstart = dtstartWithZone[2]; + if (tzid) { + options.tzid = tzid; + } + options.dtstart = untilStringToDate(dtstart); + return options; +} +function parseLine(rfcString) { + rfcString = rfcString.replace(/^\s+|\s+$/, ""); + if (!rfcString.length) + return null; + var header = /^([A-Z]+?)[:;]/.exec(rfcString.toUpperCase()); + if (!header) { + return parseRrule(rfcString); + } + var key = header[1]; + switch (key.toUpperCase()) { + case "RRULE": + case "EXRULE": + return parseRrule(rfcString); + case "DTSTART": + return parseDtstart(rfcString); + default: + throw new Error("Unsupported RFC prop ".concat(key, " in ").concat(rfcString)); + } +} +function parseRrule(line) { + var strippedLine = line.replace(/^RRULE:/i, ""); + var options = parseDtstart(strippedLine); + var attrs = line.replace(/^(?:RRULE|EXRULE):/i, "").split(";"); + attrs.forEach(function(attr2) { + var _a = attr2.split("="), key = _a[0], value = _a[1]; + switch (key.toUpperCase()) { + case "FREQ": + options.freq = Frequency[value.toUpperCase()]; + break; + case "WKST": + options.wkst = Days[value.toUpperCase()]; + break; + case "COUNT": + case "INTERVAL": + case "BYSETPOS": + case "BYMONTH": + case "BYMONTHDAY": + case "BYYEARDAY": + case "BYWEEKNO": + case "BYHOUR": + case "BYMINUTE": + case "BYSECOND": + var num = parseNumber(value); + var optionKey = key.toLowerCase(); + options[optionKey] = num; + break; + case "BYWEEKDAY": + case "BYDAY": + options.byweekday = parseWeekday(value); + break; + case "DTSTART": + case "TZID": + var dtstart = parseDtstart(line); + options.tzid = dtstart.tzid; + options.dtstart = dtstart.dtstart; + break; + case "UNTIL": + options.until = untilStringToDate(value); + break; + case "BYEASTER": + options.byeaster = Number(value); + break; + default: + throw new Error("Unknown RRULE property '" + key + "'"); + } + }); + return options; +} +function parseNumber(value) { + if (value.indexOf(",") !== -1) { + var values = value.split(","); + return values.map(parseIndividualNumber); + } + return parseIndividualNumber(value); +} +function parseIndividualNumber(value) { + if (/^[+-]?\d+$/.test(value)) { + return Number(value); + } + return value; +} +function parseWeekday(value) { + var days = value.split(","); + return days.map(function(day) { + if (day.length === 2) { + return Days[day]; + } + var parts = day.match(/^([+-]?\d{1,2})([A-Z]{2})$/); + if (!parts || parts.length < 3) { + throw new SyntaxError("Invalid weekday string: ".concat(day)); + } + var n = Number(parts[1]); + var wdaypart = parts[2]; + var wday = Days[wdaypart].weekday; + return new Weekday(wday, n); + }); +} + +// node_modules/rrule/dist/esm/datewithzone.js +var DateWithZone = function() { + function DateWithZone2(date, tzid) { + if (isNaN(date.getTime())) { + throw new RangeError("Invalid date passed to DateWithZone"); + } + this.date = date; + this.tzid = tzid; + } + Object.defineProperty(DateWithZone2.prototype, "isUTC", { + get: function() { + return !this.tzid || this.tzid.toUpperCase() === "UTC"; + }, + enumerable: false, + configurable: true + }); + DateWithZone2.prototype.toString = function() { + var datestr = timeToUntilString(this.date.getTime(), this.isUTC); + if (!this.isUTC) { + return ";TZID=".concat(this.tzid, ":").concat(datestr); + } + return ":".concat(datestr); + }; + DateWithZone2.prototype.getTime = function() { + return this.date.getTime(); + }; + DateWithZone2.prototype.rezonedDate = function() { + if (this.isUTC) { + return this.date; + } + return dateInTimeZone(this.date, this.tzid); + }; + return DateWithZone2; +}(); + +// node_modules/rrule/dist/esm/optionstostring.js +function optionsToString(options) { + var rrule = []; + var dtstart = ""; + var keys = Object.keys(options); + var defaultKeys2 = Object.keys(DEFAULT_OPTIONS); + for (var i = 0; i < keys.length; i++) { + if (keys[i] === "tzid") + continue; + if (!includes(defaultKeys2, keys[i])) + continue; + var key = keys[i].toUpperCase(); + var value = options[keys[i]]; + var outValue = ""; + if (!isPresent(value) || isArray(value) && !value.length) + continue; + switch (key) { + case "FREQ": + outValue = RRule.FREQUENCIES[options.freq]; + break; + case "WKST": + if (isNumber(value)) { + outValue = new Weekday(value).toString(); + } else { + outValue = value.toString(); + } + break; + case "BYWEEKDAY": + key = "BYDAY"; + outValue = toArray(value).map(function(wday) { + if (wday instanceof Weekday) { + return wday; + } + if (isArray(wday)) { + return new Weekday(wday[0], wday[1]); + } + return new Weekday(wday); + }).toString(); + break; + case "DTSTART": + dtstart = buildDtstart(value, options.tzid); + break; + case "UNTIL": + outValue = timeToUntilString(value, !options.tzid); + break; + default: + if (isArray(value)) { + var strValues = []; + for (var j = 0; j < value.length; j++) { + strValues[j] = String(value[j]); + } + outValue = strValues.toString(); + } else { + outValue = String(value); + } + } + if (outValue) { + rrule.push([key, outValue]); + } + } + var rules = rrule.map(function(_a) { + var key2 = _a[0], value2 = _a[1]; + return "".concat(key2, "=").concat(value2.toString()); + }).join(";"); + var ruleString = ""; + if (rules !== "") { + ruleString = "RRULE:".concat(rules); + } + return [dtstart, ruleString].filter(function(x) { + return !!x; + }).join("\n"); +} +function buildDtstart(dtstart, tzid) { + if (!dtstart) { + return ""; + } + return "DTSTART" + new DateWithZone(new Date(dtstart), tzid).toString(); +} + +// node_modules/rrule/dist/esm/cache.js +function argsMatch(left, right) { + if (Array.isArray(left)) { + if (!Array.isArray(right)) + return false; + if (left.length !== right.length) + return false; + return left.every(function(date, i) { + return date.getTime() === right[i].getTime(); + }); + } + if (left instanceof Date) { + return right instanceof Date && left.getTime() === right.getTime(); + } + return left === right; +} +var Cache = function() { + function Cache3() { + this.all = false; + this.before = []; + this.after = []; + this.between = []; + } + Cache3.prototype._cacheAdd = function(what, value, args) { + if (value) { + value = value instanceof Date ? clone(value) : cloneDates(value); + } + if (what === "all") { + this.all = value; + } else { + args._value = value; + this[what].push(args); + } + }; + Cache3.prototype._cacheGet = function(what, args) { + var cached = false; + var argsKeys = args ? Object.keys(args) : []; + var findCacheDiff = function(item2) { + for (var i2 = 0; i2 < argsKeys.length; i2++) { + var key = argsKeys[i2]; + if (!argsMatch(args[key], item2[key])) { + return true; + } + } + return false; + }; + var cachedObject = this[what]; + if (what === "all") { + cached = this.all; + } else if (isArray(cachedObject)) { + for (var i = 0; i < cachedObject.length; i++) { + var item = cachedObject[i]; + if (argsKeys.length && findCacheDiff(item)) + continue; + cached = item._value; + break; + } + } + if (!cached && this.all) { + var iterResult = new iterresult_default(what, args); + for (var i = 0; i < this.all.length; i++) { + if (!iterResult.accept(this.all[i])) + break; + } + cached = iterResult.getValue(); + this._cacheAdd(what, cached, args); + } + return isArray(cached) ? cloneDates(cached) : cached instanceof Date ? clone(cached) : cached; + }; + return Cache3; +}(); + +// node_modules/rrule/dist/esm/masks.js +var M365MASK = __spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray([], repeat(1, 31), true), repeat(2, 28), true), repeat(3, 31), true), repeat(4, 30), true), repeat(5, 31), true), repeat(6, 30), true), repeat(7, 31), true), repeat(8, 31), true), repeat(9, 30), true), repeat(10, 31), true), repeat(11, 30), true), repeat(12, 31), true), repeat(1, 7), true); +var M366MASK = __spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray([], repeat(1, 31), true), repeat(2, 29), true), repeat(3, 31), true), repeat(4, 30), true), repeat(5, 31), true), repeat(6, 30), true), repeat(7, 31), true), repeat(8, 31), true), repeat(9, 30), true), repeat(10, 31), true), repeat(11, 30), true), repeat(12, 31), true), repeat(1, 7), true); +var M28 = range(1, 29); +var M29 = range(1, 30); +var M30 = range(1, 31); +var M31 = range(1, 32); +var MDAY366MASK = __spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray([], M31, true), M29, true), M31, true), M30, true), M31, true), M30, true), M31, true), M31, true), M30, true), M31, true), M30, true), M31, true), M31.slice(0, 7), true); +var MDAY365MASK = __spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray([], M31, true), M28, true), M31, true), M30, true), M31, true), M30, true), M31, true), M31, true), M30, true), M31, true), M30, true), M31, true), M31.slice(0, 7), true); +var NM28 = range(-28, 0); +var NM29 = range(-29, 0); +var NM30 = range(-30, 0); +var NM31 = range(-31, 0); +var NMDAY366MASK = __spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray([], NM31, true), NM29, true), NM31, true), NM30, true), NM31, true), NM30, true), NM31, true), NM31, true), NM30, true), NM31, true), NM30, true), NM31, true), NM31.slice(0, 7), true); +var NMDAY365MASK = __spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray([], NM31, true), NM28, true), NM31, true), NM30, true), NM31, true), NM30, true), NM31, true), NM31, true), NM30, true), NM31, true), NM30, true), NM31, true), NM31.slice(0, 7), true); +var M366RANGE = [0, 31, 60, 91, 121, 152, 182, 213, 244, 274, 305, 335, 366]; +var M365RANGE = [0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334, 365]; +var WDAYMASK = function() { + var wdaymask = []; + for (var i = 0; i < 55; i++) + wdaymask = wdaymask.concat(range(7)); + return wdaymask; +}(); + +// node_modules/rrule/dist/esm/iterinfo/yearinfo.js +function rebuildYear(year, options) { + var firstyday = datetime(year, 1, 1); + var yearlen = isLeapYear(year) ? 366 : 365; + var nextyearlen = isLeapYear(year + 1) ? 366 : 365; + var yearordinal = toOrdinal(firstyday); + var yearweekday = getWeekday(firstyday); + var result = __assign(__assign({ yearlen, nextyearlen, yearordinal, yearweekday }, baseYearMasks(year)), { wnomask: null }); + if (empty(options.byweekno)) { + return result; + } + result.wnomask = repeat(0, yearlen + 7); + var firstwkst; + var wyearlen; + var no1wkst = firstwkst = pymod(7 - yearweekday + options.wkst, 7); + if (no1wkst >= 4) { + no1wkst = 0; + wyearlen = result.yearlen + pymod(yearweekday - options.wkst, 7); + } else { + wyearlen = yearlen - no1wkst; + } + var div = Math.floor(wyearlen / 7); + var mod = pymod(wyearlen, 7); + var numweeks = Math.floor(div + mod / 4); + for (var j = 0; j < options.byweekno.length; j++) { + var n = options.byweekno[j]; + if (n < 0) { + n += numweeks + 1; + } + if (!(n > 0 && n <= numweeks)) { + continue; + } + var i = void 0; + if (n > 1) { + i = no1wkst + (n - 1) * 7; + if (no1wkst !== firstwkst) { + i -= 7 - firstwkst; + } + } else { + i = no1wkst; + } + for (var k = 0; k < 7; k++) { + result.wnomask[i] = 1; + i++; + if (result.wdaymask[i] === options.wkst) + break; + } + } + if (includes(options.byweekno, 1)) { + var i = no1wkst + numweeks * 7; + if (no1wkst !== firstwkst) + i -= 7 - firstwkst; + if (i < yearlen) { + for (var j = 0; j < 7; j++) { + result.wnomask[i] = 1; + i += 1; + if (result.wdaymask[i] === options.wkst) + break; + } + } + } + if (no1wkst) { + var lnumweeks = void 0; + if (!includes(options.byweekno, -1)) { + var lyearweekday = getWeekday(datetime(year - 1, 1, 1)); + var lno1wkst = pymod(7 - lyearweekday.valueOf() + options.wkst, 7); + var lyearlen = isLeapYear(year - 1) ? 366 : 365; + var weekst = void 0; + if (lno1wkst >= 4) { + lno1wkst = 0; + weekst = lyearlen + pymod(lyearweekday - options.wkst, 7); + } else { + weekst = yearlen - no1wkst; + } + lnumweeks = Math.floor(52 + pymod(weekst, 7) / 4); + } else { + lnumweeks = -1; + } + if (includes(options.byweekno, lnumweeks)) { + for (var i = 0; i < no1wkst; i++) + result.wnomask[i] = 1; + } + } + return result; +} +function baseYearMasks(year) { + var yearlen = isLeapYear(year) ? 366 : 365; + var firstyday = datetime(year, 1, 1); + var wday = getWeekday(firstyday); + if (yearlen === 365) { + return { + mmask: M365MASK, + mdaymask: MDAY365MASK, + nmdaymask: NMDAY365MASK, + wdaymask: WDAYMASK.slice(wday), + mrange: M365RANGE + }; + } + return { + mmask: M366MASK, + mdaymask: MDAY366MASK, + nmdaymask: NMDAY366MASK, + wdaymask: WDAYMASK.slice(wday), + mrange: M366RANGE + }; +} + +// node_modules/rrule/dist/esm/iterinfo/monthinfo.js +function rebuildMonth(year, month, yearlen, mrange, wdaymask, options) { + var result = { + lastyear: year, + lastmonth: month, + nwdaymask: [] + }; + var ranges = []; + if (options.freq === RRule.YEARLY) { + if (empty(options.bymonth)) { + ranges = [[0, yearlen]]; + } else { + for (var j = 0; j < options.bymonth.length; j++) { + month = options.bymonth[j]; + ranges.push(mrange.slice(month - 1, month + 1)); + } + } + } else if (options.freq === RRule.MONTHLY) { + ranges = [mrange.slice(month - 1, month + 1)]; + } + if (empty(ranges)) { + return result; + } + result.nwdaymask = repeat(0, yearlen); + for (var j = 0; j < ranges.length; j++) { + var rang = ranges[j]; + var first = rang[0]; + var last = rang[1] - 1; + for (var k = 0; k < options.bynweekday.length; k++) { + var i = void 0; + var _a = options.bynweekday[k], wday = _a[0], n = _a[1]; + if (n < 0) { + i = last + (n + 1) * 7; + i -= pymod(wdaymask[i] - wday, 7); + } else { + i = first + (n - 1) * 7; + i += pymod(7 - wdaymask[i] + wday, 7); + } + if (first <= i && i <= last) + result.nwdaymask[i] = 1; + } + } + return result; +} + +// node_modules/rrule/dist/esm/iterinfo/easter.js +function easter(y, offset2) { + if (offset2 === void 0) { + offset2 = 0; + } + var a = y % 19; + var b = Math.floor(y / 100); + var c = y % 100; + var d = Math.floor(b / 4); + var e = b % 4; + var f = Math.floor((b + 8) / 25); + var g = Math.floor((b - f + 1) / 3); + var h = Math.floor(19 * a + b - d - g + 15) % 30; + var i = Math.floor(c / 4); + var k = c % 4; + var l = Math.floor(32 + 2 * e + 2 * i - h - k) % 7; + var m = Math.floor((a + 11 * h + 22 * l) / 451); + var month = Math.floor((h + l - 7 * m + 114) / 31); + var day = (h + l - 7 * m + 114) % 31 + 1; + var date = Date.UTC(y, month - 1, day + offset2); + var yearStart = Date.UTC(y, 0, 1); + return [Math.ceil((date - yearStart) / (1e3 * 60 * 60 * 24))]; +} + +// node_modules/rrule/dist/esm/iterinfo/index.js +var Iterinfo = function() { + function Iterinfo2(options) { + this.options = options; + } + Iterinfo2.prototype.rebuild = function(year, month) { + var options = this.options; + if (year !== this.lastyear) { + this.yearinfo = rebuildYear(year, options); + } + if (notEmpty(options.bynweekday) && (month !== this.lastmonth || year !== this.lastyear)) { + var _a = this.yearinfo, yearlen = _a.yearlen, mrange = _a.mrange, wdaymask = _a.wdaymask; + this.monthinfo = rebuildMonth(year, month, yearlen, mrange, wdaymask, options); + } + if (isPresent(options.byeaster)) { + this.eastermask = easter(year, options.byeaster); + } + }; + Object.defineProperty(Iterinfo2.prototype, "lastyear", { + get: function() { + return this.monthinfo ? this.monthinfo.lastyear : null; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(Iterinfo2.prototype, "lastmonth", { + get: function() { + return this.monthinfo ? this.monthinfo.lastmonth : null; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(Iterinfo2.prototype, "yearlen", { + get: function() { + return this.yearinfo.yearlen; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(Iterinfo2.prototype, "yearordinal", { + get: function() { + return this.yearinfo.yearordinal; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(Iterinfo2.prototype, "mrange", { + get: function() { + return this.yearinfo.mrange; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(Iterinfo2.prototype, "wdaymask", { + get: function() { + return this.yearinfo.wdaymask; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(Iterinfo2.prototype, "mmask", { + get: function() { + return this.yearinfo.mmask; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(Iterinfo2.prototype, "wnomask", { + get: function() { + return this.yearinfo.wnomask; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(Iterinfo2.prototype, "nwdaymask", { + get: function() { + return this.monthinfo ? this.monthinfo.nwdaymask : []; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(Iterinfo2.prototype, "nextyearlen", { + get: function() { + return this.yearinfo.nextyearlen; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(Iterinfo2.prototype, "mdaymask", { + get: function() { + return this.yearinfo.mdaymask; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(Iterinfo2.prototype, "nmdaymask", { + get: function() { + return this.yearinfo.nmdaymask; + }, + enumerable: false, + configurable: true + }); + Iterinfo2.prototype.ydayset = function() { + return [range(this.yearlen), 0, this.yearlen]; + }; + Iterinfo2.prototype.mdayset = function(_, month) { + var start = this.mrange[month - 1]; + var end = this.mrange[month]; + var set = repeat(null, this.yearlen); + for (var i = start; i < end; i++) + set[i] = i; + return [set, start, end]; + }; + Iterinfo2.prototype.wdayset = function(year, month, day) { + var set = repeat(null, this.yearlen + 7); + var i = toOrdinal(datetime(year, month, day)) - this.yearordinal; + var start = i; + for (var j = 0; j < 7; j++) { + set[i] = i; + ++i; + if (this.wdaymask[i] === this.options.wkst) + break; + } + return [set, start, i]; + }; + Iterinfo2.prototype.ddayset = function(year, month, day) { + var set = repeat(null, this.yearlen); + var i = toOrdinal(datetime(year, month, day)) - this.yearordinal; + set[i] = i; + return [set, i, i + 1]; + }; + Iterinfo2.prototype.htimeset = function(hour, _, second, millisecond) { + var _this = this; + var set = []; + this.options.byminute.forEach(function(minute) { + set = set.concat(_this.mtimeset(hour, minute, second, millisecond)); + }); + sort(set); + return set; + }; + Iterinfo2.prototype.mtimeset = function(hour, minute, _, millisecond) { + var set = this.options.bysecond.map(function(second) { + return new Time(hour, minute, second, millisecond); + }); + sort(set); + return set; + }; + Iterinfo2.prototype.stimeset = function(hour, minute, second, millisecond) { + return [new Time(hour, minute, second, millisecond)]; + }; + Iterinfo2.prototype.getdayset = function(freq) { + switch (freq) { + case Frequency.YEARLY: + return this.ydayset.bind(this); + case Frequency.MONTHLY: + return this.mdayset.bind(this); + case Frequency.WEEKLY: + return this.wdayset.bind(this); + case Frequency.DAILY: + return this.ddayset.bind(this); + default: + return this.ddayset.bind(this); + } + }; + Iterinfo2.prototype.gettimeset = function(freq) { + switch (freq) { + case Frequency.HOURLY: + return this.htimeset.bind(this); + case Frequency.MINUTELY: + return this.mtimeset.bind(this); + case Frequency.SECONDLY: + return this.stimeset.bind(this); + } + }; + return Iterinfo2; +}(); +var iterinfo_default = Iterinfo; + +// node_modules/rrule/dist/esm/iter/poslist.js +function buildPoslist(bysetpos, timeset, start, end, ii, dayset) { + var poslist = []; + for (var j = 0; j < bysetpos.length; j++) { + var daypos = void 0; + var timepos = void 0; + var pos = bysetpos[j]; + if (pos < 0) { + daypos = Math.floor(pos / timeset.length); + timepos = pymod(pos, timeset.length); + } else { + daypos = Math.floor((pos - 1) / timeset.length); + timepos = pymod(pos - 1, timeset.length); + } + var tmp = []; + for (var k = start; k < end; k++) { + var val = dayset[k]; + if (!isPresent(val)) + continue; + tmp.push(val); + } + var i = void 0; + if (daypos < 0) { + i = tmp.slice(daypos)[0]; + } else { + i = tmp[daypos]; + } + var time = timeset[timepos]; + var date = fromOrdinal(ii.yearordinal + i); + var res = combine(date, time); + if (!includes(poslist, res)) + poslist.push(res); + } + sort(poslist); + return poslist; +} + +// node_modules/rrule/dist/esm/iter/index.js +function iter(iterResult, options) { + var dtstart = options.dtstart, freq = options.freq, interval = options.interval, until = options.until, bysetpos = options.bysetpos; + var count = options.count; + if (count === 0 || interval === 0) { + return emitResult(iterResult); + } + var counterDate = DateTime.fromDate(dtstart); + var ii = new iterinfo_default(options); + ii.rebuild(counterDate.year, counterDate.month); + var timeset = makeTimeset(ii, counterDate, options); + for (; ; ) { + var _a = ii.getdayset(freq)(counterDate.year, counterDate.month, counterDate.day), dayset = _a[0], start = _a[1], end = _a[2]; + var filtered = removeFilteredDays(dayset, start, end, ii, options); + if (notEmpty(bysetpos)) { + var poslist = buildPoslist(bysetpos, timeset, start, end, ii, dayset); + for (var j = 0; j < poslist.length; j++) { + var res = poslist[j]; + if (until && res > until) { + return emitResult(iterResult); + } + if (res >= dtstart) { + var rezonedDate = rezoneIfNeeded(res, options); + if (!iterResult.accept(rezonedDate)) { + return emitResult(iterResult); + } + if (count) { + --count; + if (!count) { + return emitResult(iterResult); + } + } + } + } + } else { + for (var j = start; j < end; j++) { + var currentDay = dayset[j]; + if (!isPresent(currentDay)) { + continue; + } + var date = fromOrdinal(ii.yearordinal + currentDay); + for (var k = 0; k < timeset.length; k++) { + var time = timeset[k]; + var res = combine(date, time); + if (until && res > until) { + return emitResult(iterResult); + } + if (res >= dtstart) { + var rezonedDate = rezoneIfNeeded(res, options); + if (!iterResult.accept(rezonedDate)) { + return emitResult(iterResult); + } + if (count) { + --count; + if (!count) { + return emitResult(iterResult); + } + } + } + } + } + } + if (options.interval === 0) { + return emitResult(iterResult); + } + counterDate.add(options, filtered); + if (counterDate.year > MAXYEAR) { + return emitResult(iterResult); + } + if (!freqIsDailyOrGreater(freq)) { + timeset = ii.gettimeset(freq)(counterDate.hour, counterDate.minute, counterDate.second, 0); + } + ii.rebuild(counterDate.year, counterDate.month); + } +} +function isFiltered(ii, currentDay, options) { + var bymonth = options.bymonth, byweekno = options.byweekno, byweekday = options.byweekday, byeaster = options.byeaster, bymonthday = options.bymonthday, bynmonthday = options.bynmonthday, byyearday = options.byyearday; + return notEmpty(bymonth) && !includes(bymonth, ii.mmask[currentDay]) || notEmpty(byweekno) && !ii.wnomask[currentDay] || notEmpty(byweekday) && !includes(byweekday, ii.wdaymask[currentDay]) || notEmpty(ii.nwdaymask) && !ii.nwdaymask[currentDay] || byeaster !== null && !includes(ii.eastermask, currentDay) || (notEmpty(bymonthday) || notEmpty(bynmonthday)) && !includes(bymonthday, ii.mdaymask[currentDay]) && !includes(bynmonthday, ii.nmdaymask[currentDay]) || notEmpty(byyearday) && (currentDay < ii.yearlen && !includes(byyearday, currentDay + 1) && !includes(byyearday, -ii.yearlen + currentDay) || currentDay >= ii.yearlen && !includes(byyearday, currentDay + 1 - ii.yearlen) && !includes(byyearday, -ii.nextyearlen + currentDay - ii.yearlen)); +} +function rezoneIfNeeded(date, options) { + return new DateWithZone(date, options.tzid).rezonedDate(); +} +function emitResult(iterResult) { + return iterResult.getValue(); +} +function removeFilteredDays(dayset, start, end, ii, options) { + var filtered = false; + for (var dayCounter = start; dayCounter < end; dayCounter++) { + var currentDay = dayset[dayCounter]; + filtered = isFiltered(ii, currentDay, options); + if (filtered) + dayset[currentDay] = null; + } + return filtered; +} +function makeTimeset(ii, counterDate, options) { + var freq = options.freq, byhour = options.byhour, byminute = options.byminute, bysecond = options.bysecond; + if (freqIsDailyOrGreater(freq)) { + return buildTimeset(options); + } + if (freq >= RRule.HOURLY && notEmpty(byhour) && !includes(byhour, counterDate.hour) || freq >= RRule.MINUTELY && notEmpty(byminute) && !includes(byminute, counterDate.minute) || freq >= RRule.SECONDLY && notEmpty(bysecond) && !includes(bysecond, counterDate.second)) { + return []; + } + return ii.gettimeset(freq)(counterDate.hour, counterDate.minute, counterDate.second, counterDate.millisecond); +} + +// node_modules/rrule/dist/esm/rrule.js +var Days = { + MO: new Weekday(0), + TU: new Weekday(1), + WE: new Weekday(2), + TH: new Weekday(3), + FR: new Weekday(4), + SA: new Weekday(5), + SU: new Weekday(6) +}; +var DEFAULT_OPTIONS = { + freq: Frequency.YEARLY, + dtstart: null, + interval: 1, + wkst: Days.MO, + count: null, + until: null, + tzid: null, + bysetpos: null, + bymonth: null, + bymonthday: null, + bynmonthday: null, + byyearday: null, + byweekno: null, + byweekday: null, + bynweekday: null, + byhour: null, + byminute: null, + bysecond: null, + byeaster: null +}; +var defaultKeys = Object.keys(DEFAULT_OPTIONS); +var RRule = function() { + function RRule2(options, noCache) { + if (options === void 0) { + options = {}; + } + if (noCache === void 0) { + noCache = false; + } + this._cache = noCache ? null : new Cache(); + this.origOptions = initializeOptions(options); + var parsedOptions = parseOptions(options).parsedOptions; + this.options = parsedOptions; + } + RRule2.parseText = function(text2, language) { + return parseText(text2, language); + }; + RRule2.fromText = function(text2, language) { + return fromText(text2, language); + }; + RRule2.fromString = function(str) { + return new RRule2(RRule2.parseString(str) || void 0); + }; + RRule2.prototype._iter = function(iterResult) { + return iter(iterResult, this.options); + }; + RRule2.prototype._cacheGet = function(what, args) { + if (!this._cache) + return false; + return this._cache._cacheGet(what, args); + }; + RRule2.prototype._cacheAdd = function(what, value, args) { + if (!this._cache) + return; + return this._cache._cacheAdd(what, value, args); + }; + RRule2.prototype.all = function(iterator) { + if (iterator) { + return this._iter(new callbackiterresult_default("all", {}, iterator)); + } + var result = this._cacheGet("all"); + if (result === false) { + result = this._iter(new iterresult_default("all", {})); + this._cacheAdd("all", result); + } + return result; + }; + RRule2.prototype.between = function(after, before, inc, iterator) { + if (inc === void 0) { + inc = false; + } + if (!isValidDate(after) || !isValidDate(before)) { + throw new Error("Invalid date passed in to RRule.between"); + } + var args = { + before, + after, + inc + }; + if (iterator) { + return this._iter(new callbackiterresult_default("between", args, iterator)); + } + var result = this._cacheGet("between", args); + if (result === false) { + result = this._iter(new iterresult_default("between", args)); + this._cacheAdd("between", result, args); + } + return result; + }; + RRule2.prototype.before = function(dt, inc) { + if (inc === void 0) { + inc = false; + } + if (!isValidDate(dt)) { + throw new Error("Invalid date passed in to RRule.before"); + } + var args = { dt, inc }; + var result = this._cacheGet("before", args); + if (result === false) { + result = this._iter(new iterresult_default("before", args)); + this._cacheAdd("before", result, args); + } + return result; + }; + RRule2.prototype.after = function(dt, inc) { + if (inc === void 0) { + inc = false; + } + if (!isValidDate(dt)) { + throw new Error("Invalid date passed in to RRule.after"); + } + var args = { dt, inc }; + var result = this._cacheGet("after", args); + if (result === false) { + result = this._iter(new iterresult_default("after", args)); + this._cacheAdd("after", result, args); + } + return result; + }; + RRule2.prototype.count = function() { + return this.all().length; + }; + RRule2.prototype.toString = function() { + return optionsToString(this.origOptions); + }; + RRule2.prototype.toText = function(gettext, language, dateFormatter) { + return toText(this, gettext, language, dateFormatter); + }; + RRule2.prototype.isFullyConvertibleToText = function() { + return isFullyConvertible(this); + }; + RRule2.prototype.clone = function() { + return new RRule2(this.origOptions); + }; + RRule2.FREQUENCIES = [ + "YEARLY", + "MONTHLY", + "WEEKLY", + "DAILY", + "HOURLY", + "MINUTELY", + "SECONDLY" + ]; + RRule2.YEARLY = Frequency.YEARLY; + RRule2.MONTHLY = Frequency.MONTHLY; + RRule2.WEEKLY = Frequency.WEEKLY; + RRule2.DAILY = Frequency.DAILY; + RRule2.HOURLY = Frequency.HOURLY; + RRule2.MINUTELY = Frequency.MINUTELY; + RRule2.SECONDLY = Frequency.SECONDLY; + RRule2.MO = Days.MO; + RRule2.TU = Days.TU; + RRule2.WE = Days.WE; + RRule2.TH = Days.TH; + RRule2.FR = Days.FR; + RRule2.SA = Days.SA; + RRule2.SU = Days.SU; + RRule2.parseString = parseString; + RRule2.optionsToString = optionsToString; + return RRule2; +}(); + +// node_modules/rrule/dist/esm/iterset.js +function iterSet(iterResult, _rrule, _exrule, _rdate, _exdate, tzid) { + var _exdateHash = {}; + var _accept = iterResult.accept; + function evalExdate(after, before) { + _exrule.forEach(function(rrule) { + rrule.between(after, before, true).forEach(function(date) { + _exdateHash[Number(date)] = true; + }); + }); + } + _exdate.forEach(function(date) { + var zonedDate2 = new DateWithZone(date, tzid).rezonedDate(); + _exdateHash[Number(zonedDate2)] = true; + }); + iterResult.accept = function(date) { + var dt = Number(date); + if (isNaN(dt)) + return _accept.call(this, date); + if (!_exdateHash[dt]) { + evalExdate(new Date(dt - 1), new Date(dt + 1)); + if (!_exdateHash[dt]) { + _exdateHash[dt] = true; + return _accept.call(this, date); + } + } + return true; + }; + if (iterResult.method === "between") { + evalExdate(iterResult.args.after, iterResult.args.before); + iterResult.accept = function(date) { + var dt = Number(date); + if (!_exdateHash[dt]) { + _exdateHash[dt] = true; + return _accept.call(this, date); + } + return true; + }; + } + for (var i = 0; i < _rdate.length; i++) { + var zonedDate = new DateWithZone(_rdate[i], tzid).rezonedDate(); + if (!iterResult.accept(new Date(zonedDate.getTime()))) + break; + } + _rrule.forEach(function(rrule) { + iter(iterResult, rrule.options); + }); + var res = iterResult._result; + sort(res); + switch (iterResult.method) { + case "all": + case "between": + return res; + case "before": + return res.length && res[res.length - 1] || null; + case "after": + default: + return res.length && res[0] || null; + } +} + +// node_modules/rrule/dist/esm/rrulestr.js +var DEFAULT_OPTIONS2 = { + dtstart: null, + cache: false, + unfold: false, + forceset: false, + compatible: false, + tzid: null +}; +function parseInput(s, options) { + var rrulevals = []; + var rdatevals = []; + var exrulevals = []; + var exdatevals = []; + var parsedDtstart = parseDtstart(s); + var dtstart = parsedDtstart.dtstart; + var tzid = parsedDtstart.tzid; + var lines = splitIntoLines(s, options.unfold); + lines.forEach(function(line) { + var _a; + if (!line) + return; + var _b = breakDownLine(line), name = _b.name, parms = _b.parms, value = _b.value; + switch (name.toUpperCase()) { + case "RRULE": + if (parms.length) { + throw new Error("unsupported RRULE parm: ".concat(parms.join(","))); + } + rrulevals.push(parseString(line)); + break; + case "RDATE": + var _c = (_a = /RDATE(?:;TZID=([^:=]+))?/i.exec(line)) !== null && _a !== void 0 ? _a : [], rdateTzid = _c[1]; + if (rdateTzid && !tzid) { + tzid = rdateTzid; + } + rdatevals = rdatevals.concat(parseRDate(value, parms)); + break; + case "EXRULE": + if (parms.length) { + throw new Error("unsupported EXRULE parm: ".concat(parms.join(","))); + } + exrulevals.push(parseString(value)); + break; + case "EXDATE": + exdatevals = exdatevals.concat(parseRDate(value, parms)); + break; + case "DTSTART": + break; + default: + throw new Error("unsupported property: " + name); + } + }); + return { + dtstart, + tzid, + rrulevals, + rdatevals, + exrulevals, + exdatevals + }; +} +function buildRule(s, options) { + var _a = parseInput(s, options), rrulevals = _a.rrulevals, rdatevals = _a.rdatevals, exrulevals = _a.exrulevals, exdatevals = _a.exdatevals, dtstart = _a.dtstart, tzid = _a.tzid; + var noCache = options.cache === false; + if (options.compatible) { + options.forceset = true; + options.unfold = true; + } + if (options.forceset || rrulevals.length > 1 || rdatevals.length || exrulevals.length || exdatevals.length) { + var rset_1 = new RRuleSet(noCache); + rset_1.dtstart(dtstart); + rset_1.tzid(tzid || void 0); + rrulevals.forEach(function(val2) { + rset_1.rrule(new RRule(groomRruleOptions(val2, dtstart, tzid), noCache)); + }); + rdatevals.forEach(function(date) { + rset_1.rdate(date); + }); + exrulevals.forEach(function(val2) { + rset_1.exrule(new RRule(groomRruleOptions(val2, dtstart, tzid), noCache)); + }); + exdatevals.forEach(function(date) { + rset_1.exdate(date); + }); + if (options.compatible && options.dtstart) + rset_1.rdate(dtstart); + return rset_1; + } + var val = rrulevals[0] || {}; + return new RRule(groomRruleOptions(val, val.dtstart || options.dtstart || dtstart, val.tzid || options.tzid || tzid), noCache); +} +function rrulestr(s, options) { + if (options === void 0) { + options = {}; + } + return buildRule(s, initializeOptions2(options)); +} +function groomRruleOptions(val, dtstart, tzid) { + return __assign(__assign({}, val), { dtstart, tzid }); +} +function initializeOptions2(options) { + var invalid = []; + var keys = Object.keys(options); + var defaultKeys2 = Object.keys(DEFAULT_OPTIONS2); + keys.forEach(function(key) { + if (!includes(defaultKeys2, key)) + invalid.push(key); + }); + if (invalid.length) { + throw new Error("Invalid options: " + invalid.join(", ")); + } + return __assign(__assign({}, DEFAULT_OPTIONS2), options); +} +function extractName(line) { + if (line.indexOf(":") === -1) { + return { + name: "RRULE", + value: line + }; + } + var _a = split(line, ":", 1), name = _a[0], value = _a[1]; + return { + name, + value + }; +} +function breakDownLine(line) { + var _a = extractName(line), name = _a.name, value = _a.value; + var parms = name.split(";"); + if (!parms) + throw new Error("empty property name"); + return { + name: parms[0].toUpperCase(), + parms: parms.slice(1), + value + }; +} +function splitIntoLines(s, unfold) { + if (unfold === void 0) { + unfold = false; + } + s = s && s.trim(); + if (!s) + throw new Error("Invalid empty string"); + if (!unfold) { + return s.split(/\s/); + } + var lines = s.split("\n"); + var i = 0; + while (i < lines.length) { + var line = lines[i] = lines[i].replace(/\s+$/g, ""); + if (!line) { + lines.splice(i, 1); + } else if (i > 0 && line[0] === " ") { + lines[i - 1] += line.slice(1); + lines.splice(i, 1); + } else { + i += 1; + } + } + return lines; +} +function validateDateParm(parms) { + parms.forEach(function(parm) { + if (!/(VALUE=DATE(-TIME)?)|(TZID=)/.test(parm)) { + throw new Error("unsupported RDATE/EXDATE parm: " + parm); + } + }); +} +function parseRDate(rdateval, parms) { + validateDateParm(parms); + return rdateval.split(",").map(function(datestr) { + return untilStringToDate(datestr); + }); +} + +// node_modules/rrule/dist/esm/rruleset.js +function createGetterSetter(fieldName) { + var _this = this; + return function(field) { + if (field !== void 0) { + _this["_".concat(fieldName)] = field; + } + if (_this["_".concat(fieldName)] !== void 0) { + return _this["_".concat(fieldName)]; + } + for (var i = 0; i < _this._rrule.length; i++) { + var field_1 = _this._rrule[i].origOptions[fieldName]; + if (field_1) { + return field_1; + } + } + }; +} +var RRuleSet = function(_super) { + __extends(RRuleSet2, _super); + function RRuleSet2(noCache) { + if (noCache === void 0) { + noCache = false; + } + var _this = _super.call(this, {}, noCache) || this; + _this.dtstart = createGetterSetter.apply(_this, ["dtstart"]); + _this.tzid = createGetterSetter.apply(_this, ["tzid"]); + _this._rrule = []; + _this._rdate = []; + _this._exrule = []; + _this._exdate = []; + return _this; + } + RRuleSet2.prototype._iter = function(iterResult) { + return iterSet(iterResult, this._rrule, this._exrule, this._rdate, this._exdate, this.tzid()); + }; + RRuleSet2.prototype.rrule = function(rrule) { + _addRule(rrule, this._rrule); + }; + RRuleSet2.prototype.exrule = function(rrule) { + _addRule(rrule, this._exrule); + }; + RRuleSet2.prototype.rdate = function(date) { + _addDate(date, this._rdate); + }; + RRuleSet2.prototype.exdate = function(date) { + _addDate(date, this._exdate); + }; + RRuleSet2.prototype.rrules = function() { + return this._rrule.map(function(e) { + return rrulestr(e.toString()); + }); + }; + RRuleSet2.prototype.exrules = function() { + return this._exrule.map(function(e) { + return rrulestr(e.toString()); + }); + }; + RRuleSet2.prototype.rdates = function() { + return this._rdate.map(function(e) { + return new Date(e.getTime()); + }); + }; + RRuleSet2.prototype.exdates = function() { + return this._exdate.map(function(e) { + return new Date(e.getTime()); + }); + }; + RRuleSet2.prototype.valueOf = function() { + var result = []; + if (!this._rrule.length && this._dtstart) { + result = result.concat(optionsToString({ dtstart: this._dtstart })); + } + this._rrule.forEach(function(rrule) { + result = result.concat(rrule.toString().split("\n")); + }); + this._exrule.forEach(function(exrule) { + result = result.concat(exrule.toString().split("\n").map(function(line) { + return line.replace(/^RRULE:/, "EXRULE:"); + }).filter(function(line) { + return !/^DTSTART/.test(line); + })); + }); + if (this._rdate.length) { + result.push(rdatesToString("RDATE", this._rdate, this.tzid())); + } + if (this._exdate.length) { + result.push(rdatesToString("EXDATE", this._exdate, this.tzid())); + } + return result; + }; + RRuleSet2.prototype.toString = function() { + return this.valueOf().join("\n"); + }; + RRuleSet2.prototype.clone = function() { + var rrs = new RRuleSet2(!!this._cache); + this._rrule.forEach(function(rule) { + return rrs.rrule(rule.clone()); + }); + this._exrule.forEach(function(rule) { + return rrs.exrule(rule.clone()); + }); + this._rdate.forEach(function(date) { + return rrs.rdate(new Date(date.getTime())); + }); + this._exdate.forEach(function(date) { + return rrs.exdate(new Date(date.getTime())); + }); + return rrs; + }; + return RRuleSet2; +}(RRule); +function _addRule(rrule, collection) { + if (!(rrule instanceof RRule)) { + throw new TypeError(String(rrule) + " is not RRule instance"); + } + if (!includes(collection.map(String), String(rrule))) { + collection.push(rrule); + } +} +function _addDate(date, collection) { + if (!(date instanceof Date)) { + throw new TypeError(String(date) + " is not Date instance"); + } + if (!includes(collection.map(Number), Number(date))) { + collection.push(date); + sort(collection); + } +} +function rdatesToString(param, rdates, tzid) { + var isUTC = !tzid || tzid.toUpperCase() === "UTC"; + var header = isUTC ? "".concat(param, ":") : "".concat(param, ";TZID=").concat(tzid, ":"); + var dateString = rdates.map(function(rdate) { + return timeToUntilString(rdate.valueOf(), isUTC); + }).join(","); + return "".concat(header).concat(dateString); +} + +// src/lib/DateTools.ts +var chrono2 = __toESM(require_dist()); +function compareByDate(a, b) { + if (a !== null && b === null) { + return -1; + } + if (a === null && b !== null) { + return 1; + } + if (!(a !== null && b !== null)) { + return 0; + } + if (a.isValid() && !b.isValid()) { + return 1; + } else if (!a.isValid() && b.isValid()) { + return -1; + } + if (a.isAfter(b)) { + return 1; + } else if (a.isBefore(b)) { + return -1; + } else { + return 0; + } +} +function parseTypedDateForDisplay(fieldName, typedDate, forwardDate = void 0) { + if (!typedDate) { + return `no ${fieldName} date`; + } + const parsed = chrono2.parseDate(typedDate, forwardDate, { + forwardDate: forwardDate != void 0 + }); + if (parsed !== null) { + const parsedMoment = window.moment(parsed); + if (fieldName === "reminder") { + const typedDateFormatIsDateTime = isDateTime(window.moment(typedDate)); + return typedDateFormatIsDateTime ? parsedMoment.format("YYYY-MM-DD HH:mm") : parsedMoment.format("YYYY-MM-DD"); + } + return parsedMoment.format("YYYY-MM-DD"); + } + return `invalid ${fieldName} date`; +} +function parseTypedDateForDisplayUsingFutureDate(fieldName, typedDate, forwardOnly) { + return parseTypedDateForDisplay(fieldName, typedDate, forwardOnly ? new Date() : void 0); +} +function parseTypedDateForSaving(typedDate, forwardDate) { + let date = null; + const parsedDate = chrono2.parseDate(typedDate, new Date(), { forwardDate }); + if (parsedDate !== null) { + date = window.moment(parsedDate); + } + return date; +} +function parseTypedDateorDateTimeForSavingReminder(typedDate, forwardDate) { + let date = null; + const parsedDate = chrono2.parseDate(typedDate, new Date(), { forwardDate }); + if (parsedDate !== null) { + date = window.moment(parsedDate); + const dateString = isDateTime(window.moment(typedDate)) ? date.format("YYYY-MM-DD HH:mm") : date.format("YYYY-MM-DD"); + date = window.moment(dateString); + } + return date; +} +function isDateTime(dateObj) { + let hasTime = false; + if (dateObj != null) { + hasTime = dateObj.creationData().format === "YYYY-MM-DD HH:mm"; + } + return hasTime; +} + +// src/Task/Recurrence.ts +var Recurrence = class { + constructor({ + rrule, + baseOnToday, + referenceDate, + startDate, + scheduledDate, + dueDate, + reminderDate + }) { + this.rrule = rrule; + this.baseOnToday = baseOnToday; + this.referenceDate = referenceDate; + this.startDate = startDate; + this.scheduledDate = scheduledDate; + this.dueDate = dueDate; + this.reminderDate = reminderDate; + } + static fromText({ + recurrenceRuleText, + startDate, + scheduledDate, + dueDate, + reminderDate + }) { + try { + const match = recurrenceRuleText.match(/^([a-zA-Z0-9, !]+?)( when done)?$/i); + if (match == null) { + return null; + } + const isolatedRuleText = match[1].trim(); + const baseOnToday = match[2] !== void 0; + const options = RRule.parseText(isolatedRuleText); + if (options !== null) { + let referenceDate = null; + if (dueDate) { + referenceDate = window.moment(dueDate); + } else if (reminderDate) { + referenceDate = window.moment(reminderDate); + } else if (scheduledDate) { + referenceDate = window.moment(scheduledDate); + } else if (startDate) { + referenceDate = window.moment(startDate); + } + if (!baseOnToday && referenceDate !== null) { + options.dtstart = window.moment(referenceDate).startOf("day").utc(true).toDate(); + } else { + options.dtstart = window.moment().startOf("day").utc(true).toDate(); + } + const rrule = new RRule(options); + return new Recurrence({ + rrule, + baseOnToday, + referenceDate, + startDate, + scheduledDate, + dueDate, + reminderDate + }); + } + } catch (e) { + if (e instanceof Error) { + console.log(e.message); + } + } + return null; + } + toText() { + let text2 = this.rrule.toText(); + if (this.baseOnToday) { + text2 += " when done"; + } + return text2; + } + next(today = window.moment()) { + const next = this.nextReferenceDate(today); + if (next !== null) { + let startDate = null; + let scheduledDate = null; + let dueDate = null; + let reminderDate = null; + if (this.referenceDate) { + if (this.startDate) { + const originalDifference = window.moment.duration(this.startDate.diff(this.referenceDate)); + startDate = window.moment(next); + startDate.add(Math.round(originalDifference.asDays()), "days"); + } + if (this.scheduledDate) { + const originalDifference = window.moment.duration(this.scheduledDate.diff(this.referenceDate)); + scheduledDate = window.moment(next); + scheduledDate.add(Math.round(originalDifference.asDays()), "days"); + } + if (this.dueDate) { + const originalDifference = window.moment.duration(this.dueDate.diff(this.referenceDate)); + dueDate = window.moment(next); + dueDate.add(Math.round(originalDifference.asDays()), "days"); + } + if (this.reminderDate) { + const originalDifference = window.moment.duration(this.reminderDate.diff(this.referenceDate)); + reminderDate = window.moment(next); + reminderDate.add(Math.round(originalDifference.asDays()), "days"); + } + } + return { + startDate, + scheduledDate, + dueDate, + reminderDate + }; + } + return null; + } + identicalTo(other) { + if (this.baseOnToday !== other.baseOnToday) { + return false; + } + if (compareByDate(this.startDate, other.startDate) !== 0) { + return false; + } + if (compareByDate(this.scheduledDate, other.scheduledDate) !== 0) { + return false; + } + if (compareByDate(this.dueDate, other.dueDate) !== 0) { + return false; + } + if (compareByDate(this.reminderDate, other.reminderDate) !== 0) { + return false; + } + return this.toText() === other.toText(); + } + nextReferenceDate(today) { + if (this.baseOnToday) { + return this.nextReferenceDateFromToday(today).toDate(); + } else { + return this.nextReferenceDateFromOriginalReferenceDate().toDate(); + } + } + nextReferenceDateFromToday(today) { + const ruleBasedOnToday = new RRule(__spreadProps(__spreadValues({}, this.rrule.origOptions), { + dtstart: today.startOf("day").utc(true).toDate() + })); + return this.nextAfter(today.endOf("day"), ruleBasedOnToday); + } + nextReferenceDateFromOriginalReferenceDate() { + var _a; + const after = window.moment((_a = this.referenceDate) != null ? _a : void 0).endOf("day"); + return this.nextAfter(after, this.rrule); + } + nextAfter(after, rrule) { + after.utc(true); + let next = window.moment(rrule.after(after.toDate())); + const asText = this.toText(); + const monthMatch = asText.match(/every( \d+)? month(s)?(.*)?/); + if (monthMatch !== null) { + if (!asText.includes(" on ")) { + next = Recurrence.nextAfterMonths(after, next, rrule, monthMatch[1]); + } + } + const yearMatch = asText.match(/every( \d+)? year(s)?(.*)?/); + if (yearMatch !== null) { + next = Recurrence.nextAfterYears(after, next, rrule, yearMatch[1]); + } + return Recurrence.addTimezone(next); + } + static nextAfterMonths(after, next, rrule, skippingMonths) { + let parsedSkippingMonths = 1; + if (skippingMonths !== void 0) { + parsedSkippingMonths = Number.parseInt(skippingMonths.trim(), 10); + } + while (Recurrence.isSkippingTooManyMonths(after, next, parsedSkippingMonths)) { + next = Recurrence.fromOneDayEarlier(after, rrule); + } + return next; + } + static isSkippingTooManyMonths(after, next, skippingMonths) { + let diffMonths = next.month() - after.month(); + const diffYears = next.year() - after.year(); + diffMonths += diffYears * 12; + return diffMonths > skippingMonths; + } + static nextAfterYears(after, next, rrule, skippingYears) { + let parsedSkippingYears = 1; + if (skippingYears !== void 0) { + parsedSkippingYears = Number.parseInt(skippingYears.trim(), 10); + } + while (Recurrence.isSkippingTooManyYears(after, next, parsedSkippingYears)) { + next = Recurrence.fromOneDayEarlier(after, rrule); + } + return next; + } + static isSkippingTooManyYears(after, next, skippingYears) { + const diff = next.year() - after.year(); + return diff > skippingYears; + } + static fromOneDayEarlier(after, rrule) { + after.subtract(1, "days").endOf("day"); + const options = rrule.origOptions; + options.dtstart = after.startOf("day").toDate(); + rrule = new RRule(options); + return window.moment(rrule.after(after.toDate())); + } + static addTimezone(date) { + const localTimeZone = window.moment.utc(date).local(true); + return localTimeZone.startOf("day"); + } +}; + +// src/Layout/TaskLayoutOptions.ts +var TaskLayoutComponent = /* @__PURE__ */ ((TaskLayoutComponent2) => { + TaskLayoutComponent2["Description"] = "description"; + TaskLayoutComponent2["Id"] = "id"; + TaskLayoutComponent2["DependsOn"] = "dependsOn"; + TaskLayoutComponent2["Priority"] = "priority"; + TaskLayoutComponent2["RecurrenceRule"] = "recurrenceRule"; + TaskLayoutComponent2["CreatedDate"] = "createdDate"; + TaskLayoutComponent2["StartDate"] = "startDate"; + TaskLayoutComponent2["ScheduledDate"] = "scheduledDate"; + TaskLayoutComponent2["DueDate"] = "dueDate"; + TaskLayoutComponent2["ReminderDate"] = "reminderDate"; + TaskLayoutComponent2["CancelledDate"] = "cancelledDate"; + TaskLayoutComponent2["DoneDate"] = "doneDate"; + TaskLayoutComponent2["BlockLink"] = "blockLink"; + return TaskLayoutComponent2; +})(TaskLayoutComponent || {}); +var taskLayoutComponents = Object.values(TaskLayoutComponent); +var TaskLayoutOptions = class { + constructor() { + this.visible = {}; + this.tagsVisible = true; + taskLayoutComponents.forEach((component) => { + this.visible[component] = true; + }); + } + isShown(component) { + return this.visible[component]; + } + areTagsShown() { + return this.tagsVisible; + } + hide(component) { + this.visible[component] = false; + } + setVisibility(component, visible) { + this.visible[component] = visible; + } + setTagsVisibility(visibility) { + this.tagsVisible = visibility; + } + get shownComponents() { + return taskLayoutComponents.filter((component) => { + return this.visible[component]; + }); + } + get hiddenComponents() { + return taskLayoutComponents.filter((component) => { + return !this.visible[component]; + }); + } + get toggleableComponents() { + return taskLayoutComponents.filter((component) => { + return component !== "description" /* Description */ && component !== "blockLink" /* BlockLink */; + }); + } + toggleVisibilityExceptDescriptionAndBlockLink() { + this.toggleableComponents.forEach((component) => { + this.visible[component] = !this.visible[component]; + }); + this.setTagsVisibility(!this.areTagsShown()); + } +}; + +// src/Task/TaskRegularExpressions.ts +var _TaskRegularExpressions = class { +}; +var TaskRegularExpressions = _TaskRegularExpressions; +TaskRegularExpressions.dateFormat = "YYYY-MM-DD"; +TaskRegularExpressions.dateTimeFormat = "YYYY-MM-DD HH:mm"; +TaskRegularExpressions.indentationRegex = /^([\s\t>]*)/; +TaskRegularExpressions.listMarkerRegex = /([-*+]|[0-9]+\.)/; +TaskRegularExpressions.checkboxRegex = /\[(.)\]/u; +TaskRegularExpressions.afterCheckboxRegex = / *(.*)/u; +TaskRegularExpressions.taskRegex = new RegExp( + _TaskRegularExpressions.indentationRegex.source + _TaskRegularExpressions.listMarkerRegex.source + " +" + _TaskRegularExpressions.checkboxRegex.source + _TaskRegularExpressions.afterCheckboxRegex.source, + "u" +); +TaskRegularExpressions.nonTaskRegex = new RegExp( + _TaskRegularExpressions.indentationRegex.source + _TaskRegularExpressions.listMarkerRegex.source + "? *(" + _TaskRegularExpressions.checkboxRegex.source + ")?" + _TaskRegularExpressions.afterCheckboxRegex.source, + "u" +); +TaskRegularExpressions.listItemRegex = new RegExp( + _TaskRegularExpressions.indentationRegex.source + _TaskRegularExpressions.listMarkerRegex.source +); +TaskRegularExpressions.blockLinkRegex = / \^[a-zA-Z0-9-]+$/u; +TaskRegularExpressions.hashTags = /(^|\s)#[^ !@#$%^&*(),.?":{}|<>]+/g; +TaskRegularExpressions.hashTagsFromEnd = new RegExp(_TaskRegularExpressions.hashTags.source + "$"); + +// src/TaskSerializer/DefaultTaskSerializer.ts +var taskIdRegex = /[a-zA-Z0-9-_]+/; +var taskIdSequenceRegex = new RegExp(taskIdRegex.source + "( *, *" + taskIdRegex.source + " *)*"); +var DEFAULT_SYMBOLS = { + prioritySymbols: { + Highest: "\u{1F53A}", + High: "\u23EB", + Medium: "\u{1F53C}", + Low: "\u{1F53D}", + Lowest: "\u23EC", + None: "" + }, + startDateSymbol: "\u{1F6EB}", + createdDateSymbol: "\u2795", + scheduledDateSymbol: "\u23F3", + dueDateSymbol: "\u{1F4C5}", + reminderDateSymbol: "\u23F0", + doneDateSymbol: "\u2705", + cancelledDateSymbol: "\u274C", + recurrenceSymbol: "\u{1F501}", + dependsOnSymbol: "\u26D4", + idSymbol: "\u{1F194}", + TaskFormatRegularExpressions: { + priorityRegex: /([🔺⏫🔼🔽⏬])\uFE0F?$/u, + startDateRegex: /🛫 *(\d{4}-\d{2}-\d{2})$/u, + createdDateRegex: /➕ *(\d{4}-\d{2}-\d{2})$/u, + scheduledDateRegex: /[⏳⌛] *(\d{4}-\d{2}-\d{2})$/u, + dueDateRegex: /[📅📆🗓] *(\d{4}-\d{2}-\d{2})$/u, + reminderDateRegex: /[⏰] *(\d{4}-\d{2}-\d{2})$/u, + reminderDateTimeRegex: /[⏰] *(\d{4}-\d{2}-\d{2} \d{2}:\d{2})$/u, + doneDateRegex: /✅ *(\d{4}-\d{2}-\d{2})$/u, + cancelledDateRegex: /❌ *(\d{4}-\d{2}-\d{2})$/u, + recurrenceRegex: /🔁 ?([a-zA-Z0-9, !]+)$/iu, + dependsOnRegex: new RegExp("\u26D4\uFE0F? *(" + taskIdSequenceRegex.source + ")$", "iu"), + idRegex: new RegExp("\u{1F194} *(" + taskIdRegex.source + ")$", "iu") + } +}; +function symbolAndStringValue(shortMode, symbol, value) { + if (!value) + return ""; + return shortMode ? " " + symbol : ` ${symbol} ${value}`; +} +function symbolAndDateValue(shortMode, symbol, date) { + if (!date) + return ""; + return shortMode ? " " + symbol : ` ${symbol} ${date.format( + isDateTime(date) ? TaskRegularExpressions.dateTimeFormat : TaskRegularExpressions.dateFormat + )}`; +} +var DefaultTaskSerializer = class { + constructor(symbols) { + this.symbols = symbols; + } + serialize(task) { + const taskLayoutOptions = new TaskLayoutOptions(); + let taskString = ""; + const shortMode = false; + for (const component of taskLayoutOptions.shownComponents) { + taskString += this.componentToString(task, shortMode, component); + } + return taskString; + } + componentToString(task, shortMode, component) { + var _a; + const { + prioritySymbols, + startDateSymbol, + createdDateSymbol, + scheduledDateSymbol, + doneDateSymbol, + cancelledDateSymbol, + recurrenceSymbol, + dueDateSymbol, + reminderDateSymbol, + dependsOnSymbol, + idSymbol + } = this.symbols; + switch (component) { + case "description" /* Description */: + return task.description; + case "priority" /* Priority */: { + let priority = ""; + if (task.priority === "0" /* Highest */) { + priority = " " + prioritySymbols.Highest; + } else if (task.priority === "1" /* High */) { + priority = " " + prioritySymbols.High; + } else if (task.priority === "2" /* Medium */) { + priority = " " + prioritySymbols.Medium; + } else if (task.priority === "4" /* Low */) { + priority = " " + prioritySymbols.Low; + } else if (task.priority === "5" /* Lowest */) { + priority = " " + prioritySymbols.Lowest; + } + return priority; + } + case "startDate" /* StartDate */: + return symbolAndDateValue(shortMode, startDateSymbol, task.startDate); + case "createdDate" /* CreatedDate */: + return symbolAndDateValue(shortMode, createdDateSymbol, task.createdDate); + case "scheduledDate" /* ScheduledDate */: + if (task.scheduledDateIsInferred) + return ""; + return symbolAndDateValue(shortMode, scheduledDateSymbol, task.scheduledDate); + case "doneDate" /* DoneDate */: + return symbolAndDateValue(shortMode, doneDateSymbol, task.doneDate); + case "cancelledDate" /* CancelledDate */: + return symbolAndDateValue(shortMode, cancelledDateSymbol, task.cancelledDate); + case "dueDate" /* DueDate */: + return symbolAndDateValue(shortMode, dueDateSymbol, task.dueDate); + case "reminderDate" /* ReminderDate */: + return symbolAndDateValue(shortMode, reminderDateSymbol, task.reminderDate); + case "recurrenceRule" /* RecurrenceRule */: + if (!task.recurrence) + return ""; + return symbolAndStringValue(shortMode, recurrenceSymbol, task.recurrence.toText()); + case "dependsOn" /* DependsOn */: { + if (task.dependsOn.length === 0) + return ""; + return symbolAndStringValue(shortMode, dependsOnSymbol, task.dependsOn.join(",")); + } + case "id" /* Id */: + return symbolAndStringValue(shortMode, idSymbol, task.id); + case "blockLink" /* BlockLink */: + return (_a = task.blockLink) != null ? _a : ""; + default: + throw new Error(`Don't know how to render task component of type '${component}'`); + } + } + parsePriority(p) { + const { prioritySymbols } = this.symbols; + switch (p) { + case prioritySymbols.Lowest: + return "5" /* Lowest */; + case prioritySymbols.Low: + return "4" /* Low */; + case prioritySymbols.Medium: + return "2" /* Medium */; + case prioritySymbols.High: + return "1" /* High */; + case prioritySymbols.Highest: + return "0" /* Highest */; + default: + return "3" /* None */; + } + } + deserialize(line) { + const { TaskFormatRegularExpressions } = this.symbols; + let matched; + let priority = "3" /* None */; + let startDate = null; + let scheduledDate = null; + let dueDate = null; + let reminderDate = null; + let doneDate = null; + let cancelledDate = null; + let createdDate = null; + let recurrenceRule = ""; + let recurrence = null; + let id = ""; + let dependsOn = []; + let trailingTags = ""; + const maxRuns = 20; + let runs = 0; + do { + matched = false; + const priorityMatch = line.match(TaskFormatRegularExpressions.priorityRegex); + if (priorityMatch !== null) { + priority = this.parsePriority(priorityMatch[1]); + line = line.replace(TaskFormatRegularExpressions.priorityRegex, "").trim(); + matched = true; + } + const doneDateMatch = line.match(TaskFormatRegularExpressions.doneDateRegex); + if (doneDateMatch !== null) { + doneDate = window.moment(doneDateMatch[1], TaskRegularExpressions.dateFormat); + line = line.replace(TaskFormatRegularExpressions.doneDateRegex, "").trim(); + matched = true; + } + const cancelledDateMatch = line.match(TaskFormatRegularExpressions.cancelledDateRegex); + if (cancelledDateMatch !== null) { + cancelledDate = window.moment(cancelledDateMatch[1], TaskRegularExpressions.dateFormat); + line = line.replace(TaskFormatRegularExpressions.cancelledDateRegex, "").trim(); + matched = true; + } + const dueDateMatch = line.match(TaskFormatRegularExpressions.dueDateRegex); + if (dueDateMatch !== null) { + dueDate = window.moment(dueDateMatch[1], TaskRegularExpressions.dateFormat); + line = line.replace(TaskFormatRegularExpressions.dueDateRegex, "").trim(); + matched = true; + } + const reminderDateTimeMatch = line.match(TaskFormatRegularExpressions.reminderDateTimeRegex); + const reminderDateMatch = line.match(TaskFormatRegularExpressions.reminderDateRegex); + if (reminderDateTimeMatch !== null) { + reminderDate = window.moment(reminderDateTimeMatch[1], TaskRegularExpressions.dateTimeFormat); + line = line.replace(TaskFormatRegularExpressions.reminderDateTimeRegex, "").trim(); + matched = true; + } else if (reminderDateMatch !== null) { + reminderDate = window.moment(reminderDateMatch[1], TaskRegularExpressions.dateFormat); + line = line.replace(TaskFormatRegularExpressions.reminderDateRegex, "").trim(); + matched = true; + } + const scheduledDateMatch = line.match(TaskFormatRegularExpressions.scheduledDateRegex); + if (scheduledDateMatch !== null) { + scheduledDate = window.moment(scheduledDateMatch[1], TaskRegularExpressions.dateFormat); + line = line.replace(TaskFormatRegularExpressions.scheduledDateRegex, "").trim(); + matched = true; + } + const startDateMatch = line.match(TaskFormatRegularExpressions.startDateRegex); + if (startDateMatch !== null) { + startDate = window.moment(startDateMatch[1], TaskRegularExpressions.dateFormat); + line = line.replace(TaskFormatRegularExpressions.startDateRegex, "").trim(); + matched = true; + } + const createdDateMatch = line.match(TaskFormatRegularExpressions.createdDateRegex); + if (createdDateMatch !== null) { + createdDate = window.moment(createdDateMatch[1], TaskRegularExpressions.dateFormat); + line = line.replace(TaskFormatRegularExpressions.createdDateRegex, "").trim(); + matched = true; + } + const recurrenceMatch = line.match(TaskFormatRegularExpressions.recurrenceRegex); + if (recurrenceMatch !== null) { + recurrenceRule = recurrenceMatch[1].trim(); + line = line.replace(TaskFormatRegularExpressions.recurrenceRegex, "").trim(); + matched = true; + } + const tagsMatch = line.match(TaskRegularExpressions.hashTagsFromEnd); + if (tagsMatch != null) { + line = line.replace(TaskRegularExpressions.hashTagsFromEnd, "").trim(); + matched = true; + const tagName = tagsMatch[0].trim(); + trailingTags = trailingTags.length > 0 ? [tagName, trailingTags].join(" ") : tagName; + } + const idMatch = line.match(TaskFormatRegularExpressions.idRegex); + if (idMatch != null) { + line = line.replace(TaskFormatRegularExpressions.idRegex, "").trim(); + id = idMatch[1].trim(); + matched = true; + } + const dependsOnMatch = line.match(TaskFormatRegularExpressions.dependsOnRegex); + if (dependsOnMatch != null) { + line = line.replace(TaskFormatRegularExpressions.dependsOnRegex, "").trim(); + dependsOn = dependsOnMatch[1].replace(/ /g, "").split(",").filter((item) => item !== ""); + matched = true; + } + runs++; + } while (matched && runs <= maxRuns); + if (recurrenceRule.length > 0) { + recurrence = Recurrence.fromText({ + recurrenceRuleText: recurrenceRule, + startDate, + scheduledDate, + dueDate, + reminderDate + }); + } + if (trailingTags.length > 0) + line += " " + trailingTags; + return { + description: line, + priority, + startDate, + createdDate, + scheduledDate, + dueDate, + reminderDate, + doneDate, + cancelledDate, + recurrence, + id, + dependsOn, + tags: Task.extractHashtags(line) + }; + } +}; + +// src/Task/TaskDependency.ts +function generateUniqueId(existingIds) { + let id = ""; + let keepGenerating = true; + while (keepGenerating) { + id = Math.random().toString(36).substring(2, 6 + 2); + if (!existingIds.includes(id)) { + keepGenerating = false; + } + } + return id; +} +function ensureTaskHasId(child, existingIds) { + if (child.id !== "") + return child; + return new Task(__spreadProps(__spreadValues({}, child), { id: generateUniqueId(existingIds) })); +} +function addDependencyToParent(parent, child) { + let newParent = parent; + if (!parent.dependsOn.includes(child.id)) { + const newDependsOn = [...parent.dependsOn, child.id]; + newParent = new Task(__spreadProps(__spreadValues({}, parent), { dependsOn: newDependsOn })); + } + return newParent; +} +function removeDependency(parent, child) { + let newParent = parent; + if (parent.dependsOn.includes(child.id)) { + const newDependsOn = parent.dependsOn.filter((dependsOn) => dependsOn !== child.id); + newParent = new Task(__spreadProps(__spreadValues({}, parent), { dependsOn: newDependsOn })); + } + return newParent; +} + +// src/lib/RegExpTools.ts +function escapeRegExp(s) { + return s.replace(/([.*+?^${}()|[\]/\\])/g, "\\$1"); +} + +// src/Config/GlobalFilter.ts +var _GlobalFilter = class { + constructor() { + this._globalFilter = ""; + this._removeGlobalFilter = false; + } + static getInstance() { + if (!_GlobalFilter.instance) { + _GlobalFilter.instance = new _GlobalFilter(); + } + return _GlobalFilter.instance; + } + get() { + return this._globalFilter; + } + set(value) { + this._globalFilter = value; + } + reset() { + this.set(_GlobalFilter.empty); + } + isEmpty() { + return this.get() === _GlobalFilter.empty; + } + equals(tag) { + return this.get() === tag; + } + includedIn(description) { + const globalFilter = this.get(); + return description.includes(globalFilter); + } + prependTo(description) { + return this.get() + " " + description; + } + removeAsWordFromDependingOnSettings(description) { + const removeGlobalFilter = this.getRemoveGlobalFilter(); + if (removeGlobalFilter) { + return this.removeAsWordFrom(description); + } + return description; + } + getRemoveGlobalFilter() { + return this._removeGlobalFilter; + } + setRemoveGlobalFilter(removeGlobalFilter) { + this._removeGlobalFilter = removeGlobalFilter; + } + removeAsWordFrom(description) { + if (this.isEmpty()) { + return description; + } + const theRegExp = RegExp("(^|\\s)" + escapeRegExp(this.get()) + "($|\\s)", "ug"); + if (description.search(theRegExp) > -1) { + description = description.replace(theRegExp, "$1$2").replace(" ", " ").trim(); + } + return description; + } + removeAsSubstringFrom(description) { + const globalFilter = this.get(); + return description.replace(globalFilter, "").trim(); + } +}; +var GlobalFilter = _GlobalFilter; +GlobalFilter.empty = ""; + +// src/ui/DependencyHelpers.ts +var import_obsidian = require("obsidian"); +var MAX_SEARCH_RESULTS = 20; +function descriptionAdjustedForDependencySearch(task) { + return GlobalFilter.getInstance().removeAsWordFrom(task.description); +} +function searchDescriptionWithoutTags(query, allTasks) { + if (query === "") { + return allTasks; + } + const preparedSearch = (0, import_obsidian.prepareSimpleSearch)(query); + const minimumScoreCutoff = -4; + const matches = allTasks.map((task) => { + const result = preparedSearch(descriptionAdjustedForDependencySearch(task)); + if (result && result.score > minimumScoreCutoff) { + return { + item: task, + match: result + }; + } + return null; + }).filter(Boolean); + const sortedMatches = matches.sort((a, b) => b.match.score - a.match.score); + return sortedMatches.map((item) => item.item); +} +function searchForCandidateTasksForDependency(search, allTasks, task, blockedBy, blocking) { + let results = searchDescriptionWithoutTags(search, allTasks); + results = results.filter((item) => { + if (item.isDone) { + return false; + } + if (item.description.includes("<%") && item.description.includes("%>")) { + return false; + } + const sameTask = item.description === (task == null ? void 0 : task.description) && item.taskLocation.path === (task == null ? void 0 : task.taskLocation.path) && item.originalMarkdown === (task == null ? void 0 : task.originalMarkdown); + if (sameTask) { + return false; + } + if ((blockedBy == null ? void 0 : blockedBy.includes(item)) || (blocking == null ? void 0 : blocking.includes(item))) { + return false; + } + return true; + }); + if (task) { + results.sort((a, b) => { + const aInSamePath = a.taskLocation.path === task.taskLocation.path; + const bInSamePath = b.taskLocation.path === task.taskLocation.path; + if (aInSamePath && bInSamePath) { + return Math.abs(a.taskLocation.lineNumber - task.taskLocation.lineNumber) - Math.abs(b.taskLocation.lineNumber - task.taskLocation.lineNumber); + } else if (aInSamePath) { + return -1; + } else if (bInSamePath) { + return 1; + } else { + return 0; + } + }); + } + return results.slice(0, MAX_SEARCH_RESULTS); +} + +// src/Suggestor/Suggestor.ts +var DEFAULT_MAX_GENERIC_SUGGESTIONS = 5; +var showDependencySuggestionsDefault = false; +globalThis.SHOW_DEPENDENCY_SUGGESTIONS = showDependencySuggestionsDefault; +function makeDefaultSuggestionBuilder(symbols, maxGenericSuggestions, dataviewMode) { + const datePrefixRegex = [ + symbols.startDateSymbol, + symbols.scheduledDateSymbol, + symbols.dueDateSymbol, + symbols.reminderDateSymbol + ].join("|"); + return (line, cursorPos, settings2, allTasks, taskToSuggestFor) => { + let suggestions = []; + suggestions = suggestions.concat( + addDatesSuggestions(line, cursorPos, settings2, datePrefixRegex, maxGenericSuggestions, dataviewMode) + ); + suggestions = suggestions.concat( + addRecurrenceSuggestions(line, cursorPos, settings2, symbols.recurrenceSymbol, dataviewMode) + ); + if (globalThis.SHOW_DEPENDENCY_SUGGESTIONS) { + suggestions = suggestions.concat(addIDSuggestion(line, cursorPos, symbols.idSymbol, allTasks)); + suggestions = suggestions.concat( + addDependsOnSuggestions(line, cursorPos, settings2, symbols.dependsOnSymbol, allTasks, taskToSuggestFor) + ); + } + suggestions = suggestions.concat(addTaskPropertySuggestions(line, cursorPos, settings2, symbols, dataviewMode)); + if (suggestions.length > 0 && !suggestions.some((value) => value.suggestionType === "match")) { + if (!dataviewMode) { + suggestions.unshift({ + suggestionType: "empty", + displayText: "\u23CE", + appendText: "\n" + }); + } + } + suggestions = suggestions.slice(0, settings2.autoSuggestMaxItems); + return suggestions; + }; +} +function getAdjusters(dataviewMode, line, cursorPos) { + const closingBracket = lastOpenBracket(line.substring(0, cursorPos), [ + ["(", ")"], + ["[", "]"] + ]) == "(" ? ")" : "]"; + const postfix = dataviewMode ? closingBracket + " " : " "; + const insertSkip = dataviewMode && line.length > cursorPos && line.charAt(cursorPos) === closingBracket ? 1 : 0; + return { postfix, insertSkip }; +} +function addTaskPropertySuggestions(line, cursorPos, _settings, symbols, dataviewMode) { + const hasPriority = (line2) => Object.values(symbols.prioritySymbols).some((value) => value.length > 0 && line2.includes(value)); + const genericSuggestions = []; + const { postfix, insertSkip } = getAdjusters(dataviewMode, line, cursorPos); + if (!line.includes(symbols.dueDateSymbol)) + genericSuggestions.push({ + displayText: `${symbols.dueDateSymbol} due date`, + appendText: `${symbols.dueDateSymbol} ` + }); + if (!line.includes(symbols.reminderDateSymbol)) + genericSuggestions.push({ + displayText: `${symbols.reminderDateSymbol} reminder date`, + appendText: `${symbols.reminderDateSymbol} ` + }); + if (!line.includes(symbols.startDateSymbol)) + genericSuggestions.push({ + displayText: `${symbols.startDateSymbol} start date`, + appendText: `${symbols.startDateSymbol} ` + }); + if (!line.includes(symbols.scheduledDateSymbol)) + genericSuggestions.push({ + displayText: `${symbols.scheduledDateSymbol} scheduled date`, + appendText: `${symbols.scheduledDateSymbol} ` + }); + if (globalThis.SHOW_DEPENDENCY_SUGGESTIONS) { + if (!line.includes(symbols.idSymbol)) + genericSuggestions.push({ + displayText: `${symbols.idSymbol} Task ID`, + appendText: `${symbols.idSymbol}` + }); + if (!line.includes(symbols.dependsOnSymbol)) + genericSuggestions.push({ + displayText: `${symbols.dependsOnSymbol} Task depends on ID`, + appendText: `${symbols.dependsOnSymbol}` + }); + } + if (!hasPriority(line)) { + const prioritySymbols = symbols.prioritySymbols; + const priorityTexts = ["High", "Medium", "Low", "Highest", "Lowest"]; + for (let i = 0; i < priorityTexts.length; i++) { + const priorityText = priorityTexts[i]; + const prioritySymbol = prioritySymbols[priorityText]; + genericSuggestions.push({ + displayText: dataviewMode ? `${prioritySymbol} priority` : `${prioritySymbol} ${priorityText.toLowerCase()} priority`, + appendText: `${prioritySymbol}${postfix}`, + insertSkip: dataviewMode ? insertSkip : void 0 + }); + } + } + if (!line.includes(symbols.recurrenceSymbol)) + genericSuggestions.push({ + displayText: `${symbols.recurrenceSymbol} recurring (repeat)`, + appendText: `${symbols.recurrenceSymbol} ` + }); + if (!line.includes(symbols.createdDateSymbol)) { + const parsedDate = DateParser.parseDate("today", true); + const formattedDate = parsedDate.format(TaskRegularExpressions.dateFormat); + genericSuggestions.push({ + textToMatch: `${symbols.createdDateSymbol} created`, + displayText: `${symbols.createdDateSymbol} created today (${formattedDate})`, + appendText: `${symbols.createdDateSymbol} ${formattedDate}` + postfix, + insertSkip: dataviewMode ? insertSkip : void 0 + }); + } + const wordMatch = matchIfCursorInRegex(line, /([a-zA-Z'_-]*)/g, cursorPos); + const matchingSuggestions = []; + if (wordMatch && wordMatch.length > 0) { + const wordUnderCursor = wordMatch[0]; + if (wordUnderCursor.length >= Math.max(1, _settings.autoSuggestMinMatch)) { + const filteredSuggestions = genericSuggestions.filter((suggestInfo) => { + const textToMatch = suggestInfo.textToMatch || suggestInfo.displayText; + return textToMatch.toLowerCase().includes(wordUnderCursor.toLowerCase()); + }); + for (const filtered of filteredSuggestions) { + const insertSkipValue = dataviewMode && (filtered.displayText.includes("priority") || filtered.displayText.includes("created")) ? wordUnderCursor.length + insertSkip : wordUnderCursor.length; + matchingSuggestions.push({ + suggestionType: "match", + displayText: filtered.displayText, + appendText: filtered.appendText, + insertAt: wordMatch.index, + insertSkip: insertSkipValue + }); + } + } + } + if (matchingSuggestions.length === 0 && _settings.autoSuggestMinMatch === 0) + return genericSuggestions; + return matchingSuggestions; +} +function addDatesSuggestions(line, cursorPos, settings2, datePrefixRegex, maxGenericSuggestions, dataviewMode) { + const genericSuggestions = [ + "today", + "tomorrow", + "Sunday", + "Monday", + "Tuesday", + "Wednesday", + "Thursday", + "Friday", + "Saturday", + "next week", + "next month", + "next year" + ]; + const { postfix, insertSkip } = getAdjusters(dataviewMode, line, cursorPos); + const results = []; + const dateRegex = new RegExp(`(${datePrefixRegex})\\s*([0-9a-zA-Z ]*)`, "ug"); + const dateMatch = matchIfCursorInRegex(line, dateRegex, cursorPos); + if (dateMatch && dateMatch.length >= 2) { + const datePrefix = dateMatch[1]; + const dateString = dateMatch[2]; + if (dateString.length < settings2.autoSuggestMinMatch) { + return []; + } + const possibleDate = dateString && dateString.length > 1 ? DateParser.parseDate(doAutocomplete(dateString), true) : null; + if (possibleDate && possibleDate.isValid()) { + results.push({ + displayText: `${possibleDate.format(TaskRegularExpressions.dateFormat)}`, + appendText: `${datePrefix} ${possibleDate.format(TaskRegularExpressions.dateFormat)} `, + insertAt: dateMatch.index, + insertSkip: dateMatch[0].length + }); + } + const minMatch = 1; + let genericMatches = genericSuggestions.filter( + (value) => dateString && dateString.length >= minMatch && value.toLowerCase().includes(dateString.toLowerCase()) + ).slice(0, maxGenericSuggestions); + if (genericMatches.length === 0) { + genericMatches = genericSuggestions.slice(0, maxGenericSuggestions); + } + for (const match of genericMatches) { + const parsedDate = DateParser.parseDate(match, true); + const formattedDate = `${parsedDate.format(TaskRegularExpressions.dateFormat)}`; + const insertSkipValue = dataviewMode ? dateMatch[0].length + insertSkip : dateMatch[0].length; + results.push({ + suggestionType: "match", + displayText: `${match} (${formattedDate})`, + appendText: `${datePrefix} ${formattedDate}` + postfix, + insertAt: dateMatch.index, + insertSkip: insertSkipValue + }); + } + } + return results; +} +function addRecurrenceSuggestions(line, cursorPos, settings2, recurrenceSymbol, dataviewMode) { + var _a; + const genericSuggestions = [ + "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" + ]; + const { postfix, insertSkip } = getAdjusters(dataviewMode, line, cursorPos); + const results = []; + const recurrenceRegex = new RegExp(`(${recurrenceSymbol})\\s*([0-9a-zA-Z ]*)`, "ug"); + const recurrenceMatch = matchIfCursorInRegex(line, recurrenceRegex, cursorPos); + if (recurrenceMatch && recurrenceMatch.length >= 2) { + const recurrencePrefix = recurrenceMatch[1]; + const recurrenceString = recurrenceMatch[2]; + if (recurrenceString.length < settings2.autoSuggestMinMatch) + return []; + if (recurrenceString.length > 0) { + const parsedRecurrence = (_a = Recurrence.fromText({ + recurrenceRuleText: recurrenceString, + startDate: null, + scheduledDate: null, + dueDate: null, + reminderDate: null + })) == null ? void 0 : _a.toText(); + if (parsedRecurrence) { + const appendedText = `${recurrencePrefix} ${parsedRecurrence}` + postfix; + const insertSkipValue = dataviewMode ? recurrenceMatch[0].length + insertSkip : recurrenceMatch[0].length; + results.push({ + suggestionType: "match", + displayText: `\u2705 ${parsedRecurrence}`, + appendText: appendedText, + insertAt: recurrenceMatch.index, + insertSkip: insertSkipValue + }); + if (recurrenceMatch[0] == appendedText) + return []; + } + } + const minMatch = 1; + const maxGenericDateSuggestions = settings2.autoSuggestMaxItems / 2; + let genericMatches = genericSuggestions.filter( + (value) => recurrenceString && recurrenceString.length >= minMatch && value.toLowerCase().includes(recurrenceString.toLowerCase()) + ).slice(0, maxGenericDateSuggestions); + if (genericMatches.length === 0 && recurrenceString.trim().length === 0) { + genericMatches = genericSuggestions.slice(0, maxGenericDateSuggestions); + } + for (const match of genericMatches) { + results.push({ + suggestionType: "match", + displayText: `${match}`, + appendText: `${recurrencePrefix} ${match} `, + insertAt: recurrenceMatch.index, + insertSkip: recurrenceMatch[0].length + }); + } + } + return results; +} +function addIDSuggestion(line, cursorPos, idSymbol, allTasks) { + const results = []; + const idRegex = new RegExp(`(${idSymbol})\\s*(${taskIdRegex.source})?`, "ug"); + const idMatch = matchIfCursorInRegex(line, idRegex, cursorPos); + if (idMatch && idMatch[0].trim().length <= idSymbol.length) { + const ID = generateUniqueId(allTasks.map((task) => task.id)); + results.push({ + suggestionType: "match", + displayText: "Auto Generate Unique ID", + appendText: `${idSymbol} ${ID}`, + insertAt: idMatch.index, + insertSkip: idSymbol.length + }); + } + return results; +} +function addDependsOnSuggestions(line, cursorPos, settings2, dependsOnSymbol, allTasks, taskToSuggestFor) { + const results = []; + const dependsOnRegex = new RegExp(`(${dependsOnSymbol})([0-9a-zA-Z-_ ^,]*,)*([0-9a-zA-Z ^,]*)`, "ug"); + const dependsOnMatch = matchIfCursorInRegex(line, dependsOnRegex, cursorPos); + if (dependsOnMatch && dependsOnMatch.length >= 1) { + const existingDependsOnIdStrings = dependsOnMatch[2] || ""; + const newTaskToAppend = dependsOnMatch[3]; + let blockingTasks = []; + if (existingDependsOnIdStrings) { + const idsArray = existingDependsOnIdStrings.split(",").map((id) => id.trim()); + blockingTasks = allTasks.filter((task) => task.id && idsArray.includes(task.id)); + } + if (newTaskToAppend.length >= settings2.autoSuggestMinMatch) { + const genericMatches = searchForCandidateTasksForDependency( + newTaskToAppend.trim(), + allTasks, + taskToSuggestFor, + [], + blockingTasks + ); + for (const task of genericMatches) { + results.push({ + suggestionType: "match", + displayText: `${task.descriptionWithoutTags} - From: ${task.filename}.md`, + appendText: `${dependsOnSymbol}${existingDependsOnIdStrings}`, + insertAt: dependsOnMatch.index, + insertSkip: dependsOnSymbol.length + existingDependsOnIdStrings.length + newTaskToAppend.length, + taskItDependsOn: task + }); + } + } + } + return results; +} +function matchIfCursorInRegex(s, r, position) { + const matches = s.matchAll(r); + for (const match of matches) { + if ((match == null ? void 0 : match.index) && match.index < position && position <= match.index + match[0].length) + return match; + } +} +function isAnyBracketOpen(line, brackets) { + if (brackets.length === 0) { + return false; + } + const numOpeningBrackets = Object.fromEntries(brackets.map(([open, _]) => [open, 0])); + const openingOf = Object.fromEntries(brackets.map(([open, close]) => [close, open])); + for (const c of line) { + if (c in numOpeningBrackets) { + numOpeningBrackets[c]++; + } else if (c in openingOf) { + numOpeningBrackets[openingOf[c]] = Math.max(0, numOpeningBrackets[openingOf[c]] - 1); + } + } + return Object.values(numOpeningBrackets).some((n) => n > 0); +} +function lastOpenBracket(line, brackets) { + if (brackets.length === 0) { + return null; + } + const numOpeningBrackets = Object.fromEntries(brackets.map(([open, _]) => [open, 0])); + const openingOf = Object.fromEntries(brackets.map(([open, close]) => [close, open])); + const openBracketsStack = []; + for (let i = 0; i < line.length; i++) { + const c = line[i]; + if (c in numOpeningBrackets) { + numOpeningBrackets[c]++; + openBracketsStack.push({ bracket: c, idx: i }); + } else if (c in openingOf) { + if (numOpeningBrackets[openingOf[c]] >= 1) { + for (let idx = openBracketsStack.length - 1; idx >= 0; idx--) { + if (openBracketsStack[idx].bracket == openingOf[c]) { + openBracketsStack.splice(idx, 1); + break; + } + } + } + numOpeningBrackets[openingOf[c]] = Math.max(0, numOpeningBrackets[openingOf[c]] - 1); + } + } + return openBracketsStack.length > 0 ? openBracketsStack[openBracketsStack.length - 1].bracket : null; +} +function onlySuggestIfBracketOpen(fn, brackets) { + return (line, cursorPos, settings2, taskToSuggestFor, allTasks) => { + if (!isAnyBracketOpen(line.slice(0, cursorPos), brackets)) { + return []; + } + return fn(line, cursorPos, settings2, taskToSuggestFor, allTasks); + }; +} +function canSuggestForLine(line, cursor, editor) { + const lineHasGlobalFilter = GlobalFilter.getInstance().includedIn(line); + const didEditorRequest = editorIsRequestingSuggest(editor, cursor, lineHasGlobalFilter); + if (typeof didEditorRequest === "boolean") + return didEditorRequest; + return lineHasGlobalFilter && cursorIsInTaskLineDescription(line, cursor.ch); +} +function editorIsRequestingSuggest(editor, cursor, lineHasGlobalFilter) { + var _a, _b; + return (_b = (_a = editor == null ? void 0 : editor.editorComponent) == null ? void 0 : _a.showTasksPluginAutoSuggest) == null ? void 0 : _b.call(_a, cursor, editor, lineHasGlobalFilter); +} +function cursorIsInTaskLineDescription(line, cursorPosition) { + if (line.length === 0) { + return false; + } + const components = Task.extractTaskComponents(line); + if (!components) { + return false; + } + const beforeDescription = components.indentation + components.listMarker + " [" + components.status.symbol + "] "; + return cursorPosition >= beforeDescription.length; +} + +// src/TaskSerializer/DataviewTaskSerializer.ts +function toInlineFieldRegex(innerFieldRegex) { + const fieldRegex = [ + "(?:", + /(?=[^\]]+\])\[/, + "|", + /(?=[^)]+\))\(/, + ")", + / */, + innerFieldRegex, + / */, + /[)\]]/, + /(?: *,)?/, + /$/ + ].map((val) => val instanceof RegExp ? val.source : val).join(""); + return new RegExp(fieldRegex, innerFieldRegex.flags); +} +var DATAVIEW_SYMBOLS = { + prioritySymbols: { + Highest: "priority:: highest", + High: "priority:: high", + Medium: "priority:: medium", + Low: "priority:: low", + Lowest: "priority:: lowest", + None: "" + }, + startDateSymbol: "start::", + createdDateSymbol: "created::", + scheduledDateSymbol: "scheduled::", + dueDateSymbol: "due::", + reminderDateSymbol: "reminder::", + doneDateSymbol: "completion::", + cancelledDateSymbol: "cancelled::", + recurrenceSymbol: "repeat::", + idSymbol: "id::", + dependsOnSymbol: "dependsOn::", + TaskFormatRegularExpressions: { + priorityRegex: toInlineFieldRegex(/priority:: *(highest|high|medium|low|lowest)/), + startDateRegex: toInlineFieldRegex(/start:: *(\d{4}-\d{2}-\d{2})/), + createdDateRegex: toInlineFieldRegex(/created:: *(\d{4}-\d{2}-\d{2})/), + scheduledDateRegex: toInlineFieldRegex(/scheduled:: *(\d{4}-\d{2}-\d{2})/), + dueDateRegex: toInlineFieldRegex(/due:: *(\d{4}-\d{2}-\d{2})/), + reminderDateTimeRegex: toInlineFieldRegex(/reminder:: *(\d{4}-\d{2}-\d{2} \d{2}:\d{2})/), + reminderDateRegex: toInlineFieldRegex(/reminder:: *(\d{4}-\d{2}-\d{2})/), + doneDateRegex: toInlineFieldRegex(/completion:: *(\d{4}-\d{2}-\d{2})/), + cancelledDateRegex: toInlineFieldRegex(/cancelled:: *(\d{4}-\d{2}-\d{2})/), + recurrenceRegex: toInlineFieldRegex(/repeat:: *([a-zA-Z0-9, !]+)/), + dependsOnRegex: toInlineFieldRegex(new RegExp("dependsOn:: *(" + taskIdSequenceRegex.source + ")")), + idRegex: toInlineFieldRegex(new RegExp("id:: *(" + taskIdRegex.source + ")")) + } +}; +var DataviewTaskSerializer = class extends DefaultTaskSerializer { + constructor() { + super(DATAVIEW_SYMBOLS); + } + parsePriority(p) { + switch (p) { + case "highest": + return "0" /* Highest */; + case "high": + return "1" /* High */; + case "medium": + return "2" /* Medium */; + case "low": + return "4" /* Low */; + case "lowest": + return "5" /* Lowest */; + default: + return "3" /* None */; + } + } + componentToString(task, shortMode, component) { + const stringComponent = super.componentToString(task, shortMode, component); + const notInlineFieldComponents = [ + "blockLink" /* BlockLink */, + "description" /* Description */ + ]; + const shouldMakeInlineField = stringComponent !== "" && !notInlineFieldComponents.includes(component); + return shouldMakeInlineField ? ` [${stringComponent.trim()}]` : stringComponent; + } +}; + +// src/Statuses/StatusConfiguration.ts +var StatusType = /* @__PURE__ */ ((StatusType2) => { + StatusType2["TODO"] = "TODO"; + StatusType2["DONE"] = "DONE"; + StatusType2["IN_PROGRESS"] = "IN_PROGRESS"; + StatusType2["CANCELLED"] = "CANCELLED"; + StatusType2["NON_TASK"] = "NON_TASK"; + StatusType2["EMPTY"] = "EMPTY"; + return StatusType2; +})(StatusType || {}); +var StatusConfiguration = class { + constructor(symbol, name, nextStatusSymbol, availableAsCommand, type = "TODO" /* TODO */) { + this.symbol = symbol; + this.name = name; + this.nextStatusSymbol = nextStatusSymbol; + this.availableAsCommand = availableAsCommand; + this.type = type; + } +}; + +// src/Statuses/Status.ts +var _Status = class { + get symbol() { + return this.configuration.symbol; + } + get name() { + return this.configuration.name; + } + get nextStatusSymbol() { + return this.configuration.nextStatusSymbol; + } + get nextSymbol() { + return this.configuration.nextStatusSymbol; + } + get availableAsCommand() { + return this.configuration.availableAsCommand; + } + get type() { + return this.configuration.type; + } + get typeGroupText() { + const type = this.type; + let prefix; + switch (type) { + case "IN_PROGRESS" /* IN_PROGRESS */: + prefix = "1"; + break; + case "TODO" /* TODO */: + prefix = "2"; + break; + case "DONE" /* DONE */: + prefix = "3"; + break; + case "CANCELLED" /* CANCELLED */: + prefix = "4"; + break; + case "NON_TASK" /* NON_TASK */: + prefix = "5"; + break; + case "EMPTY" /* EMPTY */: + prefix = "6"; + break; + } + return `%%${prefix}%%${type}`; + } + constructor(configuration) { + this.configuration = configuration; + } + static makeDone() { + return new _Status(new StatusConfiguration("x", "Done", " ", true, "DONE" /* DONE */)); + } + static makeEmpty() { + return new _Status(new StatusConfiguration("", "EMPTY", "", true, "EMPTY" /* EMPTY */)); + } + static makeTodo() { + return new _Status(new StatusConfiguration(" ", "Todo", "x", true, "TODO" /* TODO */)); + } + static makeCancelled() { + return new _Status(new StatusConfiguration("-", "Cancelled", " ", true, "CANCELLED" /* CANCELLED */)); + } + static makeInProgress() { + return new _Status(new StatusConfiguration("/", "In Progress", "x", true, "IN_PROGRESS" /* IN_PROGRESS */)); + } + static makeNonTask() { + return new _Status(new StatusConfiguration("Q", "Non-Task", "A", true, "NON_TASK" /* NON_TASK */)); + } + static getTypeForUnknownSymbol(symbol) { + switch (symbol) { + case "x": + case "X": + return "DONE" /* DONE */; + case "/": + return "IN_PROGRESS" /* IN_PROGRESS */; + case "-": + return "CANCELLED" /* CANCELLED */; + case "": + return "EMPTY" /* EMPTY */; + case " ": + default: + return "TODO" /* TODO */; + } + } + static getTypeFromStatusTypeString(statusTypeAsString) { + return StatusType[statusTypeAsString] || "TODO" /* TODO */; + } + static createUnknownStatus(unknownSymbol) { + return new _Status(new StatusConfiguration(unknownSymbol, "Unknown", "x", false, "TODO" /* TODO */)); + } + static createFromImportedValue(imported) { + const symbol = imported[0]; + const type = _Status.getTypeFromStatusTypeString(imported[3]); + return new _Status(new StatusConfiguration(symbol, imported[1], imported[2], false, type)); + } + isCompleted() { + return this.type === "DONE" /* DONE */; + } + isCancelled() { + return this.type === "CANCELLED" /* CANCELLED */; + } + identicalTo(other) { + const args = [ + "symbol", + "name", + "nextStatusSymbol", + "availableAsCommand", + "type" + ]; + for (const el of args) { + if (this[el] !== other[el]) + return false; + } + return true; + } + previewText() { + let commandNotice = ""; + if (_Status.tasksPluginCanCreateCommandsForStatuses() && this.availableAsCommand) { + commandNotice = " Available as a command."; + } + return `- [${this.symbol}] => [${this.nextStatusSymbol}], name: '${this.name}', type: '${this.configuration.type}'.${commandNotice}`; + } + static tasksPluginCanCreateCommandsForStatuses() { + return false; + } +}; +var Status = _Status; +Status.DONE = _Status.makeDone(); +Status.EMPTY = _Status.makeEmpty(); +Status.TODO = _Status.makeTodo(); + +// src/Config/DebugSettings.ts +var DebugSettings = class { + constructor(ignoreSortInstructions = false, showTaskHiddenData = false, recordTimings = false) { + this.ignoreSortInstructions = ignoreSortInstructions; + this.showTaskHiddenData = showTaskHiddenData; + this.recordTimings = recordTimings; + } +}; + +// src/Config/StatusSettings.ts +var StatusSettings = class { + constructor() { + this.coreStatuses = [ + Status.makeTodo().configuration, + Status.makeDone().configuration + ]; + this.customStatuses = [ + Status.makeInProgress().configuration, + Status.makeCancelled().configuration + ]; + } + static addStatus(statuses, newStatus) { + statuses.push(newStatus); + } + static replaceStatus(statuses, originalStatus, newStatus) { + const index = this.findStatusIndex(originalStatus, statuses); + if (index <= -1) { + return false; + } + statuses.splice(index, 1, newStatus); + return true; + } + static findStatusIndex(statusConfiguration, statuses) { + const originalStatusAsStatus = new Status(statusConfiguration); + return statuses.findIndex((s) => { + return new Status(s).previewText() == originalStatusAsStatus.previewText(); + }); + } + static deleteStatus(statuses, status) { + const index = this.findStatusIndex(status, statuses); + if (index <= -1) { + return false; + } + statuses.splice(index, 1); + return true; + } + static deleteAllCustomStatuses(statusSettings) { + statusSettings.customStatuses.splice(0); + } + static resetAllCustomStatuses(statusSettings) { + StatusSettings.deleteAllCustomStatuses(statusSettings); + const defaultSettings2 = new StatusSettings(); + defaultSettings2.customStatuses.forEach((s) => { + StatusSettings.addStatus(statusSettings.customStatuses, s); + }); + } + static bulkAddStatusCollection(statusSettings, supportedStatuses) { + const notices = []; + supportedStatuses.forEach((importedStatus) => { + const hasStatus = statusSettings.customStatuses.find((element2) => { + return element2.symbol == importedStatus[0] && element2.name == importedStatus[1] && element2.nextStatusSymbol == importedStatus[2]; + }); + if (!hasStatus) { + StatusSettings.addStatus(statusSettings.customStatuses, Status.createFromImportedValue(importedStatus)); + } else { + notices.push(`The status ${importedStatus[1]} (${importedStatus[0]}) is already added.`); + } + }); + return notices; + } + static allStatuses(statusSettings) { + return statusSettings.coreStatuses.concat(statusSettings.customStatuses); + } + static applyToStatusRegistry(statusSettings, statusRegistry) { + statusRegistry.clearStatuses(); + StatusSettings.allStatuses(statusSettings).forEach((statusType) => { + statusRegistry.add(statusType); + }); + } +}; + +// src/Config/featureConfiguration.json +var featureConfiguration_default = [ + { + index: 9999, + internalName: "INTERNAL_TESTING_ENABLED_BY_DEFAULT", + displayName: "Test Item. Used to validate the Feature Framework.", + description: "Description", + enabledByDefault: true, + stable: false + } +]; + +// src/Config/Feature.ts +var Feature = class { + constructor(internalName, index, description, displayName, enabledByDefault, stable) { + this.internalName = internalName; + this.index = index; + this.description = description; + this.displayName = displayName; + this.enabledByDefault = enabledByDefault; + this.stable = stable; + } + static get values() { + let availableFeatures = []; + featureConfiguration_default.forEach((feature) => { + availableFeatures = [ + ...availableFeatures, + new Feature( + feature.internalName, + feature.index, + feature.description, + feature.displayName, + feature.enabledByDefault, + feature.stable + ) + ]; + }); + return availableFeatures; + } + static get settingsFlags() { + const featureFlags = {}; + Feature.values.forEach((feature) => { + featureFlags[feature.internalName] = feature.enabledByDefault; + }); + return featureFlags; + } + static fromString(name) { + for (const feature of Feature.values) { + if (name === feature.internalName) { + return feature; + } + } + throw new RangeError( + `Illegal argument passed to fromString(): ${name} does not correspond to any available Feature ${this.prototype.constructor.name}` + ); + } +}; + +// src/Config/Settings.ts +var TASK_FORMATS = { + tasksPluginEmoji: { + displayName: "Tasks Emoji Format", + taskSerializer: new DefaultTaskSerializer(DEFAULT_SYMBOLS), + buildSuggestions: makeDefaultSuggestionBuilder(DEFAULT_SYMBOLS, DEFAULT_MAX_GENERIC_SUGGESTIONS, false) + }, + dataview: { + displayName: "Dataview", + taskSerializer: new DataviewTaskSerializer(), + buildSuggestions: onlySuggestIfBracketOpen( + makeDefaultSuggestionBuilder(DATAVIEW_SYMBOLS, DEFAULT_MAX_GENERIC_SUGGESTIONS, true), + [ + ["(", ")"], + ["[", "]"] + ] + ) + } +}; +var defaultSettings = { + globalQuery: "", + globalFilter: "", + removeGlobalFilter: false, + taskFormat: "tasksPluginEmoji", + setCreatedDate: false, + setDoneDate: true, + setCancelledDate: true, + autoSuggestInEditor: true, + autoSuggestMinMatch: 0, + autoSuggestMaxItems: 6, + provideAccessKeys: true, + useFilenameAsScheduledDate: false, + filenameAsDateFolders: [], + recurrenceOnNextLine: false, + statusSettings: new StatusSettings(), + features: Feature.settingsFlags, + generalSettings: {}, + headingOpened: {}, + debugSettings: new DebugSettings(), + loggingOptions: { + minLevels: { + "": "info", + tasks: "info", + "tasks.Cache": "info", + "tasks.Events": "info", + "tasks.File": "info", + "tasks.Query": "info", + "tasks.Task": "info" + } + } +}; +var settings = __spreadValues({}, defaultSettings); +function addNewOptionsToUserSettings(defaultValues, userValues) { + for (const flag in defaultValues) { + if (userValues[flag] === void 0) { + userValues[flag] = defaultValues[flag]; + } + } +} +var getSettings = () => { + addNewOptionsToUserSettings(Feature.settingsFlags, settings.features); + addNewOptionsToUserSettings(defaultSettings.loggingOptions.minLevels, settings.loggingOptions.minLevels); + addNewOptionsToUserSettings(defaultSettings.debugSettings, settings.debugSettings); + settings.statusSettings.customStatuses.forEach((s, index, array) => { + var _a, _b; + const newType = Status.getTypeFromStatusTypeString(s.type); + array[index] = new StatusConfiguration( + (_a = s.symbol) != null ? _a : " ", + s.name, + (_b = s.nextStatusSymbol) != null ? _b : "x", + s.availableAsCommand, + newType + ); + }); + return __spreadValues({}, settings); +}; +var updateSettings = (newSettings) => { + settings = __spreadValues(__spreadValues({}, settings), newSettings); + return getSettings(); +}; +var updateGeneralSetting = (name, value) => { + settings.generalSettings[name] = value; + return getSettings(); +}; +var isFeatureEnabled = (internalName) => { + var _a; + return (_a = settings.features[internalName]) != null ? _a : false; +}; +function getUserSelectedTaskFormat() { + return TASK_FORMATS[getSettings().taskFormat]; +} + +// src/lib/HTMLCharacterEntities.ts +function htmlEncodeCharacter(character) { + const charactersToEntityNames = { + "<": "<", + ">": ">", + "&": "&", + '"': """ + }; + const candidateEntityName = charactersToEntityNames[character]; + if (candidateEntityName !== void 0) { + return candidateEntityName; + } + return character; +} +function htmlEncodeString(characters) { + const chars = [...characters]; + let result = ""; + chars.forEach((c) => { + result += htmlEncodeCharacter(c); + }); + return result; +} + +// src/Statuses/StatusRegistry.ts +var StatusRegistry = class { + constructor() { + this._registeredStatuses = []; + this.addDefaultStatusTypes(); + } + set(statuses) { + this.clearStatuses(); + statuses.forEach((status) => { + this.add(status); + }); + } + get registeredStatuses() { + return this._registeredStatuses.filter(({ symbol }) => symbol !== Status.EMPTY.symbol); + } + static getInstance() { + if (!StatusRegistry.instance) { + StatusRegistry.instance = new StatusRegistry(); + } + return StatusRegistry.instance; + } + add(status) { + if (!this.hasSymbol(status.symbol)) { + if (status instanceof Status) { + this._registeredStatuses.push(status); + } else { + this._registeredStatuses.push(new Status(status)); + } + } + } + bySymbol(symbol) { + if (this.hasSymbol(symbol)) { + return this.getSymbol(symbol); + } + return Status.EMPTY; + } + bySymbolOrCreate(symbol) { + if (this.hasSymbol(symbol)) { + return this.getSymbol(symbol); + } + return Status.createUnknownStatus(symbol); + } + byName(nameToFind) { + if (this._registeredStatuses.filter(({ name }) => name === nameToFind).length > 0) { + return this._registeredStatuses.filter(({ name }) => name === nameToFind)[0]; + } + return Status.EMPTY; + } + resetToDefaultStatuses() { + this.clearStatuses(); + this.addDefaultStatusTypes(); + } + clearStatuses() { + this._registeredStatuses = []; + } + getNextStatus(status) { + if (status.nextStatusSymbol !== "") { + const nextStatus = this.bySymbol(status.nextStatusSymbol); + if (nextStatus !== null) { + return nextStatus; + } + } + return Status.EMPTY; + } + getNextStatusOrCreate(status) { + const nextStatus = this.getNextStatus(status); + if (nextStatus.type !== "EMPTY" /* EMPTY */) { + return nextStatus; + } + return Status.createUnknownStatus(status.nextStatusSymbol); + } + getNextRecurrenceStatusOrCreate(newStatus) { + const nextStatus = this.getNextStatusOrCreate(newStatus); + const result1 = this.getNextRecurrenceStatusOfType(nextStatus, "TODO" /* TODO */); + if (result1) { + return result1; + } + const result2 = this.getNextRecurrenceStatusOfType(nextStatus, "IN_PROGRESS" /* IN_PROGRESS */); + if (result2) { + return result2; + } + return this.bySymbolOrCreate(" "); + } + getNextRecurrenceStatusOfType(nextStatus, wanted) { + if (nextStatus.type === wanted) { + return nextStatus; + } + let searchStatus = nextStatus; + for (let i = 0; i < this.registeredStatuses.length - 1; i++) { + searchStatus = this.getNextStatusOrCreate(searchStatus); + if (searchStatus.type === wanted) { + return searchStatus; + } + } + return void 0; + } + findUnknownStatuses(allStatuses) { + const unknownStatuses = allStatuses.filter((s) => { + return !this.hasSymbol(s.symbol); + }); + const newStatusRegistry = new StatusRegistry(); + const namedUniqueStatuses = []; + unknownStatuses.forEach((s) => { + if (newStatusRegistry.hasSymbol(s.symbol)) { + return; + } + const newStatus = StatusRegistry.copyStatusWithNewName(s, `Unknown (${s.symbol})`); + namedUniqueStatuses.push(newStatus); + newStatusRegistry.add(newStatus); + }); + return namedUniqueStatuses.sort((status1, status2) => { + return status1.symbol.localeCompare(status2.symbol, void 0, { numeric: true }); + }); + } + static copyStatusWithNewName(s, newName) { + const statusConfiguration = new StatusConfiguration( + s.symbol, + newName, + s.nextStatusSymbol, + s.availableAsCommand, + s.type + ); + return new Status(statusConfiguration); + } + getSymbol(symbolToFind) { + return this._registeredStatuses.filter(({ symbol }) => symbol === symbolToFind)[0]; + } + hasSymbol(symbolToFind) { + return this._registeredStatuses.find((element2) => { + return element2.symbol === symbolToFind; + }) !== void 0; + } + addDefaultStatusTypes() { + const defaultStatuses = [Status.makeTodo(), Status.makeInProgress(), Status.makeDone(), Status.makeCancelled()]; + defaultStatuses.forEach((status) => { + this.add(status); + }); + } + mermaidDiagram(includeDetails = false) { + const uniqueStatuses = this.registeredStatuses; + const language = "mermaid"; + const nodes = []; + const edges = []; + uniqueStatuses.forEach((status, index) => { + const label = this.getMermaidNodeLabel(status, includeDetails); + nodes.push(`${index + 1}${label}`); + const nextStatus = this.getNextStatus(status); + this.addEdgeIfNotToInternal(uniqueStatuses, nextStatus, edges, index, false); + if (status.type === "DONE" /* DONE */) { + const nextRecurringStatus = this.getNextRecurrenceStatusOrCreate(status); + const nextRecurringTypeDiffers = nextRecurringStatus.symbol !== nextStatus.symbol; + if (nextRecurringTypeDiffers) { + this.addEdgeIfNotToInternal(uniqueStatuses, nextRecurringStatus, edges, index, true); + } + } + }); + return ` +\`\`\`${language} flowchart LR classDef TODO stroke:#f33,stroke-width:3px; @@ -139,20 +15952,1202 @@ classDef IN_PROGRESS stroke:#fa0,stroke-width:3px; classDef CANCELLED stroke:#ddd,stroke-width:3px; classDef NON_TASK stroke:#99e,stroke-width:3px; -${i.join(` -`)} -${s.join(` -`)} +${nodes.join("\n")} +${edges.join("\n")} linkStyle default stroke:gray \`\`\` -`}addEdgeIfNotToInternal(e,t,n,i,s){let a=e.findIndex(l=>l.symbol===t.symbol),o=a!==-1,u=t.type!=="EMPTY";if(o&&u){let l;s?l='-. "\u{1F501}" .-> ':l=" --> ";let c=`${i+1}${l}${a+1}`;n.push(c)}}getMermaidNodeLabel(e,t){let n=yv(e.name),i=e.type;if(t){let s=ul(e.symbol),a=ul(e.nextStatusSymbol),o=`[${s}] -> [${a}]`,u=`'${n}'`,l=`(${i})`;return`["${u}
${o}
${l}"]:::${i}`}else return`["${n}"]:::${i}`}};var bv=require("obsidian");var en=class{constructor(e,t){this.name=e,this.sortOrder=t}get groupText(){return this.name!==""?`%%${this.sortOrder}%% ${this.name}`:""}};var Ye=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 en("Overdue",1):t.isSame(e,"day")?new en("Today",2):t.isValid()?new en("Future",3):new en("Invalid date",0):new en("Undated",4)}get fromNow(){let e=this.moment;if(!e)return new en("",0);let t=this.fromNowOrder(e);return new en(e.fromNow(),t)}fromNowOrder(e){if(!e.isValid())return 0;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)}postpone(e="days",t=1){if(!this._date)throw new bv.Notice("Cannot postpone a null date");let n=window.moment().startOf("day");return this._date.isSameOrAfter(n,"day")?this._date.clone().add(t,e):n.add(t,e)}};var Es=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 xn=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 xn.priorityNameUsingNone(e).replace("None","Normal")}};var iN=require("obsidian"),wv=pa(vv());var Um=class extends wv.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 Wm(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)}},Pt=new Um,Wm=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){r.debug(`${e} ==> ${i+1} : ${n.toFileLineString()}`)})}var wt=class{static fromPath(e){let{useFilenameAsScheduledDate:t,filenameAsDateFolders:n}=J();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 oe(be(X({},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 oe(be(X({},i),{scheduledDateIsInferred:!1}))),i))}};var Ar=class{static calculate(e){var n,i,s;let t=0;if((n=e.dueDate)!=null&&n.isValid()){let a=window.moment().startOf("day"),o=Math.round(a.diff(e.dueDate)/Ar.milliSecondsPerDay),u;o>=7?u=1:o>=-14?u=(o+14)*.8/21+.2:u=.2,t+=u*Ar.dueCoefficient}switch((i=e.scheduledDate)!=null&&i.isValid()&&window.moment().isSameOrAfter(e.scheduledDate)&&(t+=1*Ar.scheduledCoefficient),(s=e.startDate)!=null&&s.isValid()&&window.moment().isBefore(e.startDate)&&(t+=1*Ar.startedCoefficient),e.priority){case"0":t+=1.5*Ar.priorityCoefficient;break;case"1":t+=1*Ar.priorityCoefficient;break;case"2":t+=.65*Ar.priorityCoefficient;break;case"3":t+=.325*Ar.priorityCoefficient;break;case"5":t-=.3*Ar.priorityCoefficient;break}return t}},Rn=Ar;Rn.dueCoefficient=12,Rn.scheduledCoefficient=5,Rn.startedCoefficient=-3,Rn.priorityCoefficient=6,Rn.milliSecondsPerDay=1e3*60*60*24;var oe=class{constructor({status:e,description:t,taskLocation:n,indentation:i,listMarker:s,priority:a,createdDate:o,startDate:u,scheduledDate:l,dueDate:c,doneDate:d,cancelledDate:p,recurrence:m,dependsOn:b,id:g,blockLink:E,tags:R,originalMarkdown:x,scheduledDateIsInferred:v}){this._urgency=null;this.status=e,this.description=t,this.indentation=i,this.listMarker=s,this.taskLocation=n,this.tags=R,this.priority=a,this.createdDate=o,this.startDate=u,this.scheduledDate=l,this.dueDate=c,this.doneDate=d,this.cancelledDate=p,this.recurrence=m,this.dependsOn=b,this.id=g,this.blockLink=E,this.originalMarkdown=x,this.scheduledDateIsInferred=v}static fromLine({line:e,taskLocation:t,fallbackDate:n}){let i=oe.extractTaskComponents(e);return i===null||!ye.getInstance().includedIn(i.body)?null:oe.parseTaskSignifiers(e,t,n)}static parseTaskSignifiers(e,t,n){let i=oe.extractTaskComponents(e);if(i===null)return null;let{taskSerializer:s}=Eo(),a=s.deserialize(i.body),o=!1;return wt.canApplyFallback(a)&&n!==null&&(a.scheduledDate=n,o=!0),a.tags=a.tags.map(u=>u.trim()),a.tags=a.tags.filter(u=>!ye.getInstance().equals(u)),new oe(be(X(X({},i),a),{taskLocation:t,originalMarkdown:e,scheduledDateIsInferred:o}))}static extractTaskComponents(e){let t=e.match(Z.taskRegex);if(t===null)return null;let n=t[1],i=t[2],s=t[3],a=Oe.getInstance().bySymbolOrCreate(s),o=t[4].trim(),u=o.match(Z.blockLinkRegex),l=u!==null?u[0]:"";return l!==""&&(o=o.replace(Z.blockLinkRegex,"").trim()),{indentation:n,listMarker:i,status:a,body:o,blockLink:l}}toString(){return Eo().taskSerializer.serialize(this)}toFileLineString(){return`${this.indentation}${this.listMarker} [${this.status.symbol}] ${this.toString()}`}toggle(){let e=Pt.getLogger("tasks.Task"),t="toggle()";ll(e,t,this);let n=Oe.getInstance().getNextStatusOrCreate(this.status),i=this.handleNewStatus(n);return cl(e,t,i),i}handleNewStatus(e,t=window.moment()){if(e.identicalTo(this.status))return[this];let{setDoneDate:n}=J(),i=this.newDate(e,"DONE",this.doneDate,n,t),{setCancelledDate:s}=J(),a=this.newDate(e,"CANCELLED",this.cancelledDate,s,t),o=null;e.isCompleted()&&!this.status.isCompleted()&&this.recurrence!==null&&(o=this.recurrence.next(t));let u=new oe(be(X({},this),{status:e,doneDate:i,cancelledDate:a})),l=[];if(o!==null){let c=this.createNextOccurrence(e,o);l.push(c)}return l.push(u),l}newDate(e,t,n,i,s){let a=null;return e.type===t&&(this.status.type!==t?i&&(a=s):a=n),a}createNextOccurrence(e,t){let{setCreatedDate:n}=J(),i=null;n&&(i=window.moment());let s=null,a=null,u=Oe.getInstance().getNextRecurrenceStatusOrCreate(e);return new oe(be(X(X({},this),t),{status:u,blockLink:"",id:"",dependsOn:[],createdDate:i,cancelledDate:s,doneDate:a}))}toggleWithRecurrenceInUsersOrder(){let e=this.toggle();return this.putRecurrenceInUsersOrder(e)}handleNewStatusWithRecurrenceInUsersOrder(e,t=window.moment()){Pt.getLogger("tasks.Task").debug(`changed task ${this.taskLocation.path} ${this.taskLocation.lineNumber} ${this.originalMarkdown} status to '${e.symbol}'`);let i=this.handleNewStatus(e,t);return this.putRecurrenceInUsersOrder(i)}putRecurrenceInUsersOrder(e){let{recurrenceOnNextLine:t}=J();return t?e.reverse():e}get isDone(){return this.status.type==="DONE"||this.status.type==="CANCELLED"||this.status.type==="NON_TASK"}isBlocked(e){if(this.dependsOn.length===0||this.isDone)return!1;for(let t of this.dependsOn)if(!!e.find(i=>i.id===t&&!i.isDone))return!0;return!1}isBlocking(e){return this.id===""||this.isDone?!1:e.some(t=>t.isDone?!1:t.dependsOn.includes(this.id))}get priorityNumber(){return Number.parseInt(this.priority)}get priorityNameGroupText(){let e=xn.priorityNameUsingNormal(this.priority);return`%%${this.priority}%%${e} priority`}get descriptionWithoutTags(){return this.description.replace(Z.hashTags,"").trim()}get priorityName(){return xn.priorityNameUsingNormal(this.priority)}get urgency(){return this._urgency===null&&(this._urgency=Rn.calculate(this)),this._urgency}get path(){return this.taskLocation.path}get cancelled(){return new Ye(this.cancelledDate)}get created(){return new Ye(this.createdDate)}get done(){return new Ye(this.doneDate)}get due(){return new Ye(this.dueDate)}get scheduled(){return new Ye(this.scheduledDate)}get start(){return new Ye(this.startDate)}get happensDates(){return Array.of(this.startDate,this.scheduledDate,this.dueDate)}get happens(){let e=this.happensDates,t=Array.from(e).sort(br);for(let n of t)if(n!=null&&n.isValid())return new Ye(n);return new Ye(null)}get isRecurring(){return this.recurrence!==null}get recurrenceRule(){return this.recurrence?this.recurrence.toText():""}get heading(){return this.precedingHeader}get hasHeading(){return this.precedingHeader!==null}get file(){return new Es(this.path)}get filename(){let e=this.path.match(/([^/]+)\.md$/);return e!==null?e[1]:null}get lineNumber(){return this.taskLocation.lineNumber}get sectionStart(){return this.taskLocation.sectionStart}get sectionIndex(){return this.taskLocation.sectionIndex}get precedingHeader(){return this.taskLocation.precedingHeader}getLinkText({isFilenameUnique:e}){let t;return e?t=this.filename:t="/"+this.path,t===null?null:(this.precedingHeader!==null&&this.precedingHeader!==t&&(t=t+" > "+this.precedingHeader),t)}static tasksListsIdentical(e,t){return e.length!==t.length?!1:e.every((n,i)=>n.identicalTo(t[i]))}identicalTo(e){var s,a;let t=["description","path","indentation","listMarker","lineNumber","sectionStart","sectionIndex","precedingHeader","priority","blockLink","scheduledDateIsInferred","id","dependsOn"];for(let o of t)if(((s=this[o])==null?void 0:s.toString())!==((a=e[o])==null?void 0:a.toString()))return!1;if(!this.status.identicalTo(e.status)||this.tags.length!==e.tags.length||!this.tags.every(function(o,u){return o===e.tags[u]}))return!1;t=oe.allDateFields();for(let o of t){let u=this[o],l=e[o];if(br(u,l)!==0)return!1}let n=this.recurrence,i=e.recurrence;return n===null&&i!==null||n!==null&&i===null?!1:!(n&&i&&!n.identicalTo(i))}static allDateFields(){return["createdDate","startDate","scheduledDate","dueDate","doneDate","cancelledDate"]}static extractHashtags(e){var t,n;return(n=(t=e.match(Z.hashTags))==null?void 0:t.map(i=>i.trim()))!=null?n:[]}};var So=class{constructor(e){this.fetch=e;this._value=void 0}get value(){return this._value===void 0&&(this._value=this.fetch()),this._value}};var yt=class{constructor(e,t,n,i,s){this._path=e,this._lineNumber=t,this._sectionStart=n,this._sectionIndex=i,this._precedingHeader=s}static fromUnknownPosition(e){return new yt(e,0,0,0,null)}fromRenamedFile(e){return new yt(e,this.lineNumber,this.sectionStart,this.sectionIndex,this.precedingHeader)}get path(){return this._path}get lineNumber(){return this._lineNumber}get sectionStart(){return this._sectionStart}get sectionIndex(){return this._sectionIndex}get precedingHeader(){return this._precedingHeader}get hasKnownPath(){return this.path!==""}};var Pi=class{constructor({metadataCache:e,vault:t,events:n}){this.logger=Pt.getLogger("tasks.Cache");this.logger.debug("Creating Cache object"),this.metadataCache=e,this.metadataCacheEventReferences=[],this.vault=t,this.vaultEventReferences=[],this.events=n,this.eventsEventReferences=[],this.tasksMutex=new ru,this.state="Cold",this.logger.debug("Cache.constructor(): state = Cold"),this.tasks=[],this.loadedAfterFirstResolve=!1,this.subscribeToCache(),this.subscribeToVault(),this.subscribeToEvents(),this.loadVault()}unload(){this.logger.info("Unloading Cache");for(let e of this.metadataCacheEventReferences)this.metadataCache.offref(e);for(let e of this.vaultEventReferences)this.vault.offref(e);for(let e of this.eventsEventReferences)this.events.off(e)}getTasks(){return this.tasks}getState(){return this.state}notifySubscribers(){this.logger.debug("Cache.notifySubscribers()"),this.events.triggerCacheUpdate({tasks:this.tasks,state:this.state})}subscribeToCache(){this.logger.debug("Cache.subscribeToCache()");let e=this.metadataCache.on("resolved",()=>L(this,null,function*(){this.loadedAfterFirstResolve||(this.loadedAfterFirstResolve=!0,this.loadVault())}));this.metadataCacheEventReferences.push(e);let t=this.metadataCache.on("changed",n=>{this.tasksMutex.runExclusive(()=>{this.indexFile(n)})});this.metadataCacheEventReferences.push(t)}subscribeToVault(){this.logger.debug("Cache.subscribeToVault()");let{useFilenameAsScheduledDate:e}=J(),t=this.vault.on("create",s=>{s instanceof Ss.TFile&&(this.logger.debug(`Cache.subscribeToVault.createdEventReference() ${s.path}`),this.tasksMutex.runExclusive(()=>{this.indexFile(s)}))});this.vaultEventReferences.push(t);let n=this.vault.on("delete",s=>{s instanceof Ss.TFile&&(this.logger.debug(`Cache.subscribeToVault.deletedEventReference() ${s.path}`),this.tasksMutex.runExclusive(()=>{this.tasks=this.tasks.filter(a=>a.path!==s.path),this.notifySubscribers()}))});this.vaultEventReferences.push(n);let i=this.vault.on("rename",(s,a)=>{s instanceof Ss.TFile&&(this.logger.debug(`Cache.subscribeToVault.renamedEventReference() ${s.path}`),this.tasksMutex.runExclusive(()=>{let o=new So(()=>wt.fromPath(s.path));this.tasks=this.tasks.map(u=>u.path===a?e?wt.updateTaskPath(u,s.path,o.value):new oe(be(X({},u),{taskLocation:u.taskLocation.fromRenamedFile(s.path)})):u),this.notifySubscribers()}))});this.vaultEventReferences.push(i)}subscribeToEvents(){this.logger.debug("Cache.subscribeToEvents()");let e=this.events.onRequestCacheUpdate(t=>{t({tasks:this.tasks,state:this.state})});this.eventsEventReferences.push(e)}loadVault(){return this.logger.debug("Cache.loadVault()"),this.tasksMutex.runExclusive(()=>L(this,null,function*(){this.state="Initializing",this.logger.debug("Cache.loadVault(): state = Initializing"),yield Promise.all(this.vault.getMarkdownFiles().map(e=>this.indexFile(e))),this.state="Warm",this.logger.debug("Cache.loadVault(): state = Warm"),this.notifySubscribers()}))}indexFile(e){return L(this,null,function*(){let t=this.metadataCache.getFileCache(e);if(t==null)return;if(!e.path.endsWith(".md")){this.logger.debug("indexFile: skipping non-markdown file: "+e.path);return}this.logger.debug("Cache.indexFile: "+e.path);let n=this.tasks.filter(a=>a.path===e.path),i=t.listItems,s=[];if(i!==void 0){let a=yield this.vault.cachedRead(e);s=this.getTasksFromFileContent(a,i,t,e)}oe.tasksListsIdentical(n,s)||(this.tasks=this.tasks.filter(a=>a.path!==e.path),this.tasks.push(...s),this.logger.debug("Cache.indexFile: "+e.path+`: read ${s.length} task(s)`),this.notifySubscribers())})}getTasksFromFileContent(e,t,n,i){let s=[],a=e.split(` -`),o=a.length,u=new So(()=>wt.fromPath(i.path)),l=null,c=0;for(let d of t)if(d.task!==void 0){let p=d.position.start.line;if(p>=o)return this.logger.debug(`${i.path} Obsidian gave us a line number ${p} past the end of the file. ${o}.`),s;if((l===null||l.position.end.line status.symbol === nextStatus.symbol); + const nextStatusIsKnown = nextStatusIndex !== -1; + const nextStatusIsNotInternal = nextStatus.type !== "EMPTY" /* EMPTY */; + if (nextStatusIsKnown && nextStatusIsNotInternal) { + let joiner; + if (isForReccurenceOverride) { + joiner = '-. "\u{1F501}" .-> '; + } else { + joiner = " --> "; + } + const line = `${index + 1}${joiner}${nextStatusIndex + 1}`; + edges.push(line); + } + } + getMermaidNodeLabel(status, includeDetails) { + const statusName = htmlEncodeString(status.name); + const statusType = status.type; + if (includeDetails) { + const statusSymbol = htmlEncodeCharacter(status.symbol); + const statusNextStatusSymbol = htmlEncodeCharacter(status.nextStatusSymbol); + const transitionText = `[${statusSymbol}] -> [${statusNextStatusSymbol}]`; + const statusNameText = `'${statusName}'`; + const statusTypeText = `(${statusType})`; + return `["${statusNameText}
${transitionText}
${statusTypeText}"]:::${statusType}`; + } else { + return `["${statusName}"]:::${statusType}`; + } + } +}; + +// src/Scripting/TasksDate.ts +var import_obsidian2 = require("obsidian"); + +// src/lib/PropertyCategory.ts +var PropertyCategory = class { + constructor(name, sortOrder) { + this.name = name; + this.sortOrder = sortOrder; + } + get groupText() { + if (this.name !== "") { + return `%%${this.sortOrder}%% ${this.name}`; + } else { + return ""; + } + } +}; + +// src/Scripting/TasksDate.ts +var TasksDate = class { + constructor(date) { + this._date = null; + this._date = date; + } + get moment() { + return this._date; + } + formatAsDate(fallBackText = "") { + return this.format(TaskRegularExpressions.dateFormat, fallBackText); + } + formatAsDateAndTime(fallBackText = "") { + return this.format(TaskRegularExpressions.dateTimeFormat, fallBackText); + } + formatAsDateAndTimeOrDate(fallBackText = "") { + return isDateTime(this.moment) ? this.formatAsDateAndTime(fallBackText) : this.formatAsDate(fallBackText); + } + format(format, fallBackText = "") { + return this._date ? this._date.format(format) : fallBackText; + } + toISOString(keepOffset) { + return this._date ? this._date.toISOString(keepOffset) : ""; + } + get category() { + const today = window.moment(); + const date = this.moment; + if (!date) { + return new PropertyCategory("Undated", 4); + } + if (date.isBefore(today, "day")) { + return new PropertyCategory("Overdue", 1); + } + if (date.isSame(today, "day")) { + return new PropertyCategory("Today", 2); + } + if (!date.isValid()) { + return new PropertyCategory("Invalid date", 0); + } + return new PropertyCategory("Future", 3); + } + get fromNow() { + const date = this.moment; + if (!date) { + return new PropertyCategory("", 0); + } + const order = this.fromNowOrder(date); + return new PropertyCategory(date.fromNow(), order); + } + fromNowOrder(date) { + if (!date.isValid()) { + return 0; + } + const now = window.moment(); + const earlier = date.isSameOrBefore(now, "day"); + const startDateOfThisGroup = this.fromNowStartDateOfGroup(date, earlier, now); + const splitPastAndFutureDates = earlier ? 1 : 3; + return Number(splitPastAndFutureDates + startDateOfThisGroup.format("YYYYMMDD")); + } + fromNowStartDateOfGroup(date, earlier, now) { + const words = date.fromNow(true).split(" "); + let multiplier; + const word0AsNumber = Number(words[0]); + if (isNaN(word0AsNumber)) { + multiplier = 1; + } else { + multiplier = word0AsNumber; + } + const unit = words[1]; + return earlier ? now.subtract(multiplier, unit) : now.add(multiplier, unit); + } + postpone(unitOfTime = "days", amount = 1) { + if (!this._date) + throw new import_obsidian2.Notice("Cannot postpone a null date"); + const today = window.moment().startOf("day"); + const isDateBeforeToday = !this._date.isSameOrAfter(today, "day"); + if (isDateBeforeToday) { + return today.add(amount, unitOfTime); + } + return this._date.clone().add(amount, unitOfTime); + } +}; + +// src/lib/PriorityTools.ts +var PriorityTools = class { + static priorityNameUsingNone(priority) { + let priorityName = "ERROR"; + switch (priority) { + case "1" /* High */: + priorityName = "High"; + break; + case "0" /* Highest */: + priorityName = "Highest"; + break; + case "2" /* Medium */: + priorityName = "Medium"; + break; + case "3" /* None */: + priorityName = "None"; + break; + case "4" /* Low */: + priorityName = "Low"; + break; + case "5" /* Lowest */: + priorityName = "Lowest"; + break; + } + return priorityName; + } + static priorityNameUsingNormal(priority) { + return PriorityTools.priorityNameUsingNone(priority).replace("None", "Normal"); + } +}; + +// src/lib/logging.ts +var import_obsidian3 = require("obsidian"); +var import_eventemitter2 = __toESM(require_eventemitter2()); +var LogManager = class extends import_eventemitter2.EventEmitter2 { + constructor() { + super(...arguments); + this.options = { + minLevels: { + "": "info", + tasks: "info" + } + }; + this.consoleLoggerRegistered = false; + this.arrAvg = (arr) => arr.reduce((a, b) => a + b, 0) / arr.length; + } + configure(options) { + this.options = Object.assign({}, this.options, options); + return this; + } + getLogger(module2) { + let minLevel = "none"; + let match = ""; + for (const key in this.options.minLevels) { + if (module2.startsWith(key) && key.length >= match.length) { + minLevel = this.options.minLevels[key]; + match = key; + } + } + return new Logger(this, module2, minLevel); + } + onLogEntry(listener) { + this.on("log", listener); + return this; + } + registerConsoleLogger() { + if (this.consoleLoggerRegistered) + return this; + this.onLogEntry((logEntry) => { + let msg = `[${window.moment().format("YYYY-MM-DD-HH:mm:ss.SSS")}][${logEntry.level}][${logEntry.module}]`; + if (logEntry.traceId) { + msg += `[${logEntry.traceId}]`; + } + msg += ` ${logEntry.message}`; + if (logEntry.objects === void 0) { + logEntry.objects = ""; + } + switch (logEntry.level) { + case "trace": + console.trace(msg, logEntry.objects); + break; + case "debug": + console.debug(msg, logEntry.objects); + break; + case "info": + console.info(msg, logEntry.objects); + break; + case "warn": + console.warn(msg, logEntry.objects); + break; + case "error": + console.error(msg, logEntry.objects); + break; + default: + console.log(`{${logEntry.level}} ${msg}`, logEntry.objects); + } + }); + this.consoleLoggerRegistered = true; + return this; + } +}; +var logging = new LogManager(); +var Logger = class { + constructor(logManager, module2, minLevel) { + this.levels = { + trace: 1, + debug: 2, + info: 3, + warn: 4, + error: 5 + }; + this.logManager = logManager; + this.module = module2; + this.minLevel = this.levelToInt(minLevel); + } + levelToInt(minLevel) { + if (minLevel.toLowerCase() in this.levels) + return this.levels[minLevel.toLowerCase()]; + else + return 99; + } + log(logLevel, message, objects) { + const level = this.levelToInt(logLevel); + if (level < this.minLevel) + return; + const logEntry = { + level: logLevel, + module: this.module, + message, + objects, + traceId: void 0 + }; + this.logManager.emit("log", logEntry); + } + trace(message, objects) { + this.log("trace", message, objects); + } + debug(message, objects) { + this.log("debug", message, objects); + } + info(message, objects) { + this.log("info", message, objects); + } + warn(message, objects) { + this.log("warn", message, objects); + } + error(message, objects) { + this.log("error", message, objects); + } + logWithId(logLevel, traceId, message, objects) { + const level = this.levelToInt(logLevel); + if (level < this.minLevel) + return; + const logEntry = { + level: logLevel, + module: this.module, + message, + objects, + traceId + }; + this.logManager.emit("log", logEntry); + } + traceWithId(traceId, message, objects) { + this.logWithId("trace", traceId, message, objects); + } + debugWithId(traceId, message, objects) { + this.logWithId("debug", traceId, message, objects); + } + infoWithId(traceId, message, objects) { + this.logWithId("info", traceId, message, objects); + } + warnWithId(traceId, message, objects) { + this.logWithId("warn", traceId, message, objects); + } + errorWithId(traceId, message, objects) { + this.logWithId("error", traceId, message, objects); + } +}; +function log(logLevel, message) { + const logger = logging.getLogger("tasks"); + switch (logLevel) { + case "trace": + logger.trace(message); + break; + case "debug": + logger.debug(message); + break; + case "info": + logger.info(message); + break; + case "warn": + logger.warn(message); + break; + case "error": + logger.error(message); + break; + default: + break; + } +} + +// src/lib/LogTasksHelper.ts +function logStartOfTaskEdit(logger, codeLocation, originalTask) { + logger.debug( + `${codeLocation}: task line number: ${originalTask.taskLocation.lineNumber}. file path: "${originalTask.path}"` + ); + logger.debug(`${codeLocation} original: ${originalTask.originalMarkdown}`); +} +function logEndOfTaskEdit(logger, codeLocation, newTasks) { + newTasks.map((task, index) => { + logger.debug(`${codeLocation} ==> ${index + 1} : ${task.toFileLineString()}`); + }); +} + +// src/Task/DateFallback.ts +var DateFallback = class { + static fromPath(path) { + const { useFilenameAsScheduledDate, filenameAsDateFolders } = getSettings(); + if (!useFilenameAsScheduledDate) { + return null; + } + if (!this.matchesAnyFolder(filenameAsDateFolders, path)) { + return null; + } + return this.extractDateFromPath(path); + } + static matchesAnyFolder(folders, path) { + if (folders.length === 0) { + return true; + } + return folders.some((folder) => path.startsWith(folder + "/")); + } + static extractDateFromPath(path) { + const firstPos = Math.max(0, path.lastIndexOf("/") + 1); + const lastPos = path.lastIndexOf("."); + const basename = path.substring(firstPos, lastPos); + let dateMatch = /(\d{4})-(\d{2})-(\d{2})/.exec(basename); + if (!dateMatch) + dateMatch = /(\d{4})(\d{2})(\d{2})/.exec(basename); + if (dateMatch) { + const date = window.moment([parseInt(dateMatch[1]), parseInt(dateMatch[2]) - 1, parseInt(dateMatch[3])]); + if (date.isValid()) { + return date; + } + } + return null; + } + static canApplyFallback({ + startDate, + scheduledDate, + dueDate + }) { + return startDate === null && dueDate === null && scheduledDate === null; + } + static updateTaskPath(task, newPath, fallbackDate) { + let scheduledDate = task.scheduledDate; + let scheduledDateIsInferred = task.scheduledDateIsInferred; + if (fallbackDate === null) { + if (scheduledDateIsInferred) { + scheduledDateIsInferred = false; + scheduledDate = null; + } else { + } + } else { + if (scheduledDateIsInferred) { + scheduledDate = fallbackDate; + } else if (this.canApplyFallback(task)) { + scheduledDate = fallbackDate; + scheduledDateIsInferred = true; + } else { + } + } + return new Task(__spreadProps(__spreadValues({}, task), { + taskLocation: task.taskLocation.fromRenamedFile(new TasksFile(newPath)), + scheduledDate, + scheduledDateIsInferred + })); + } + static removeInferredStatusIfNeeded(originalTask, updatedTasks) { + const inferredScheduledDate = originalTask.scheduledDateIsInferred ? originalTask.scheduledDate : null; + return updatedTasks.map((task) => { + if (inferredScheduledDate !== null && !inferredScheduledDate.isSame(task.scheduledDate, "day")) { + task = new Task(__spreadProps(__spreadValues({}, task), { scheduledDateIsInferred: false })); + } + return task; + }); + } +}; + +// src/Task/ListItem.ts +var ListItem = class { + constructor(parent, children2) { + this.parent = null; + this.parent = parent; + this.children = children2; + } +}; + +// src/Task/Urgency.ts +var _Urgency = class { + static calculate(task) { + var _a, _b, _c; + let urgency = 0; + if ((_a = task.dueDate) == null ? void 0 : _a.isValid()) { + const startOfToday = window.moment().startOf("day"); + const daysOverdue = Math.round(startOfToday.diff(task.dueDate) / _Urgency.milliSecondsPerDay); + let dueMultiplier; + if (daysOverdue >= 7) { + dueMultiplier = 1; + } else if (daysOverdue >= -14) { + dueMultiplier = (daysOverdue + 14) * 0.8 / 21 + 0.2; + } else { + dueMultiplier = 0.2; + } + urgency += dueMultiplier * _Urgency.dueCoefficient; + } + if ((_b = task.scheduledDate) == null ? void 0 : _b.isValid()) { + if (window.moment().isSameOrAfter(task.scheduledDate)) { + urgency += 1 * _Urgency.scheduledCoefficient; + } + } + if ((_c = task.startDate) == null ? void 0 : _c.isValid()) { + if (window.moment().isBefore(task.startDate)) { + urgency += 1 * _Urgency.startedCoefficient; + } + } + switch (task.priority) { + case "0": + urgency += 1.5 * _Urgency.priorityCoefficient; + break; + case "1": + urgency += 1 * _Urgency.priorityCoefficient; + break; + case "2": + urgency += 0.65 * _Urgency.priorityCoefficient; + break; + case "3": + urgency += 0.325 * _Urgency.priorityCoefficient; + break; + case "5": + urgency -= 0.3 * _Urgency.priorityCoefficient; + break; + } + return urgency; + } +}; +var Urgency = _Urgency; +Urgency.dueCoefficient = 12; +Urgency.scheduledCoefficient = 5; +Urgency.startedCoefficient = -3; +Urgency.priorityCoefficient = 6; +Urgency.milliSecondsPerDay = 1e3 * 60 * 60 * 24; + +// src/Task/Task.ts +var Task = class extends ListItem { + constructor({ + status, + description, + taskLocation, + indentation, + listMarker, + priority, + createdDate, + startDate, + scheduledDate, + dueDate, + reminderDate, + doneDate, + cancelledDate, + recurrence, + dependsOn, + id, + blockLink, + tags, + originalMarkdown, + scheduledDateIsInferred + }) { + super(null, []); + this._urgency = null; + this.status = status; + this.description = description; + this.indentation = indentation; + this.listMarker = listMarker; + this.taskLocation = taskLocation; + this.tags = tags; + this.priority = priority; + this.createdDate = createdDate; + this.startDate = startDate; + this.scheduledDate = scheduledDate; + this.dueDate = dueDate; + this.reminderDate = reminderDate; + this.doneDate = doneDate; + this.cancelledDate = cancelledDate; + this.recurrence = recurrence; + this.dependsOn = dependsOn; + this.id = id; + this.blockLink = blockLink; + this.originalMarkdown = originalMarkdown; + this.scheduledDateIsInferred = scheduledDateIsInferred; + } + static fromLine({ + line, + taskLocation, + fallbackDate + }) { + const taskComponents = Task.extractTaskComponents(line); + if (taskComponents === null) { + return null; + } + if (!GlobalFilter.getInstance().includedIn(taskComponents.body)) { + return null; + } + return Task.parseTaskSignifiers(line, taskLocation, fallbackDate); + } + static parseTaskSignifiers(line, taskLocation, fallbackDate) { + const taskComponents = Task.extractTaskComponents(line); + if (taskComponents === null) { + return null; + } + const { taskSerializer } = getUserSelectedTaskFormat(); + const taskInfo = taskSerializer.deserialize(taskComponents.body); + let scheduledDateIsInferred = false; + if (DateFallback.canApplyFallback(taskInfo) && fallbackDate !== null) { + taskInfo.scheduledDate = fallbackDate; + scheduledDateIsInferred = true; + } + taskInfo.tags = taskInfo.tags.map((tag) => tag.trim()); + taskInfo.tags = taskInfo.tags.filter((tag) => !GlobalFilter.getInstance().equals(tag)); + return new Task(__spreadProps(__spreadValues(__spreadValues({}, taskComponents), taskInfo), { + taskLocation, + originalMarkdown: line, + scheduledDateIsInferred + })); + } + static extractTaskComponents(line) { + const regexMatch = line.match(TaskRegularExpressions.taskRegex); + if (regexMatch === null) { + return null; + } + const indentation = regexMatch[1]; + const listMarker = regexMatch[2]; + const statusString = regexMatch[3]; + const status = StatusRegistry.getInstance().bySymbolOrCreate(statusString); + let body = regexMatch[4].trim(); + const blockLinkMatch = body.match(TaskRegularExpressions.blockLinkRegex); + const blockLink = blockLinkMatch !== null ? blockLinkMatch[0] : ""; + if (blockLink !== "") { + body = body.replace(TaskRegularExpressions.blockLinkRegex, "").trim(); + } + return { indentation, listMarker, status, body, blockLink }; + } + toString() { + return getUserSelectedTaskFormat().taskSerializer.serialize(this); + } + toFileLineString() { + return `${this.indentation}${this.listMarker} [${this.status.symbol}] ${this.toString()}`; + } + toggle() { + const logger = logging.getLogger("tasks.Task"); + const codeLocation = "toggle()"; + logStartOfTaskEdit(logger, codeLocation, this); + const newStatus = StatusRegistry.getInstance().getNextStatusOrCreate(this.status); + const newTasks = this.handleNewStatus(newStatus); + logEndOfTaskEdit(logger, codeLocation, newTasks); + return newTasks; + } + handleNewStatus(newStatus, today = window.moment()) { + if (newStatus.identicalTo(this.status)) { + return [this]; + } + const { setDoneDate } = getSettings(); + const newDoneDate = this.newDate(newStatus, "DONE" /* DONE */, this.doneDate, setDoneDate, today); + const { setCancelledDate } = getSettings(); + const newCancelledDate = this.newDate( + newStatus, + "CANCELLED" /* CANCELLED */, + this.cancelledDate, + setCancelledDate, + today + ); + let nextOccurrence = null; + if (newStatus.isCompleted()) { + if (!this.status.isCompleted() && this.recurrence !== null) { + nextOccurrence = this.recurrence.next(today); + } + } + const toggledTask = new Task(__spreadProps(__spreadValues({}, this), { + status: newStatus, + doneDate: newDoneDate, + cancelledDate: newCancelledDate + })); + const newTasks = []; + if (nextOccurrence !== null) { + const nextTask = this.createNextOccurrence(newStatus, nextOccurrence); + newTasks.push(nextTask); + } + newTasks.push(toggledTask); + return newTasks; + } + newDate(newStatus, statusType, oldDate, dateEnabledInSettings, today) { + let newDate = null; + if (newStatus.type === statusType) { + if (this.status.type !== statusType) { + if (dateEnabledInSettings) { + newDate = today; + } + } else { + newDate = oldDate; + } + } + return newDate; + } + createNextOccurrence(newStatus, nextOccurrence) { + const { setCreatedDate } = getSettings(); + let createdDate = null; + if (setCreatedDate) { + createdDate = window.moment(); + } + const cancelledDate = null; + const doneDate = null; + const statusRegistry = StatusRegistry.getInstance(); + const nextStatus = statusRegistry.getNextRecurrenceStatusOrCreate(newStatus); + return new Task(__spreadProps(__spreadValues(__spreadValues({}, this), nextOccurrence), { + status: nextStatus, + blockLink: "", + id: "", + dependsOn: [], + createdDate, + cancelledDate, + doneDate + })); + } + toggleWithRecurrenceInUsersOrder() { + const newTasks = this.toggle(); + return this.putRecurrenceInUsersOrder(newTasks); + } + handleNewStatusWithRecurrenceInUsersOrder(newStatus, today = window.moment()) { + const logger = logging.getLogger("tasks.Task"); + logger.debug( + `changed task ${this.taskLocation.path} ${this.taskLocation.lineNumber} ${this.originalMarkdown} status to '${newStatus.symbol}'` + ); + const newTasks = this.handleNewStatus(newStatus, today); + return this.putRecurrenceInUsersOrder(newTasks); + } + putRecurrenceInUsersOrder(newTasks) { + const { recurrenceOnNextLine } = getSettings(); + return recurrenceOnNextLine ? newTasks.reverse() : newTasks; + } + get isDone() { + return this.status.type === "DONE" /* DONE */ || this.status.type === "CANCELLED" /* CANCELLED */ || this.status.type === "NON_TASK" /* NON_TASK */; + } + isBlocked(allTasks) { + if (this.dependsOn.length === 0) { + return false; + } + if (this.isDone) { + return false; + } + for (const depId of this.dependsOn) { + const depTask = allTasks.find((task) => task.id === depId && !task.isDone); + if (!depTask) { + continue; + } + return true; + } + return false; + } + isBlocking(allTasks) { + if (this.id === "") { + return false; + } + if (this.isDone) { + return false; + } + return allTasks.some((task) => { + if (task.isDone) { + return false; + } + return task.dependsOn.includes(this.id); + }); + } + get priorityNumber() { + return Number.parseInt(this.priority); + } + get priorityNameGroupText() { + const priorityName = PriorityTools.priorityNameUsingNormal(this.priority); + return `%%${this.priority}%%${priorityName} priority`; + } + get descriptionWithoutTags() { + return this.description.replace(TaskRegularExpressions.hashTags, "").trim(); + } + get priorityName() { + return PriorityTools.priorityNameUsingNormal(this.priority); + } + get urgency() { + if (this._urgency === null) { + this._urgency = Urgency.calculate(this); + } + return this._urgency; + } + get path() { + return this.taskLocation.path; + } + get cancelled() { + return new TasksDate(this.cancelledDate); + } + get created() { + return new TasksDate(this.createdDate); + } + get done() { + return new TasksDate(this.doneDate); + } + get due() { + return new TasksDate(this.dueDate); + } + get reminder() { + return new TasksDate(this.reminderDate); + } + get scheduled() { + return new TasksDate(this.scheduledDate); + } + get start() { + return new TasksDate(this.startDate); + } + get happensDates() { + return Array.of(this.startDate, this.scheduledDate, this.dueDate); + } + get happens() { + const happensDates = this.happensDates; + const sortedHappensDates = Array.from(happensDates).sort(compareByDate); + for (const date of sortedHappensDates) { + if (date == null ? void 0 : date.isValid()) { + return new TasksDate(date); + } + } + return new TasksDate(null); + } + get isRecurring() { + return this.recurrence !== null; + } + get recurrenceRule() { + return this.recurrence ? this.recurrence.toText() : ""; + } + get heading() { + return this.precedingHeader; + } + get hasHeading() { + return this.precedingHeader !== null; + } + get file() { + return this.taskLocation.tasksFile; + } + get filename() { + const fileNameMatch = this.path.match(/([^/]+)\.md$/); + if (fileNameMatch !== null) { + return fileNameMatch[1]; + } else { + return null; + } + } + get lineNumber() { + return this.taskLocation.lineNumber; + } + get sectionStart() { + return this.taskLocation.sectionStart; + } + get sectionIndex() { + return this.taskLocation.sectionIndex; + } + get precedingHeader() { + return this.taskLocation.precedingHeader; + } + getLinkText({ isFilenameUnique }) { + let linkText; + if (isFilenameUnique) { + linkText = this.filename; + } else { + linkText = "/" + this.path; + } + if (linkText === null) { + return null; + } + if (this.precedingHeader !== null && this.precedingHeader !== linkText) { + linkText = linkText + " > " + this.precedingHeader; + } + return linkText; + } + static tasksListsIdentical(oldTasks, newTasks) { + if (oldTasks.length !== newTasks.length) { + return false; + } + return oldTasks.every((oldTask, index) => oldTask.identicalTo(newTasks[index])); + } + identicalTo(other) { + var _a, _b; + let args = [ + "description", + "path", + "indentation", + "listMarker", + "lineNumber", + "sectionStart", + "sectionIndex", + "precedingHeader", + "priority", + "blockLink", + "scheduledDateIsInferred", + "id", + "dependsOn" + ]; + for (const el of args) { + if (((_a = this[el]) == null ? void 0 : _a.toString()) !== ((_b = other[el]) == null ? void 0 : _b.toString())) + return false; + } + if (!this.status.identicalTo(other.status)) { + return false; + } + if (this.tags.length !== other.tags.length) { + return false; + } + if (!this.tags.every(function(element2, index) { + return element2 === other.tags[index]; + })) { + return false; + } + args = Task.allDateFields(); + for (const el of args) { + const date1 = this[el]; + const date2 = other[el]; + if (compareByDate(date1, date2) !== 0) { + return false; + } + } + const recurrence1 = this.recurrence; + const recurrence2 = other.recurrence; + if (recurrence1 === null && recurrence2 !== null) { + return false; + } else if (recurrence1 !== null && recurrence2 === null) { + return false; + } else if (recurrence1 && recurrence2 && !recurrence1.identicalTo(recurrence2)) { + return false; + } + return true; + } + static allDateFields() { + return [ + "createdDate", + "startDate", + "scheduledDate", + "dueDate", + "reminderDate", + "doneDate", + "cancelledDate" + ]; + } + static extractHashtags(description) { + var _a, _b; + return (_b = (_a = description.match(TaskRegularExpressions.hashTags)) == null ? void 0 : _a.map((tag) => tag.trim())) != null ? _b : []; + } +}; + +// src/lib/Lazy.ts +var Lazy = class { + constructor(fetch) { + this.fetch = fetch; + this._value = void 0; + } + get value() { + if (this._value === void 0) { + this._value = this.fetch(); + } + return this._value; + } +}; + +// src/Task/TaskLocation.ts +var TaskLocation = class { + constructor(tasksFile, lineNumber, sectionStart, sectionIndex, precedingHeader) { + this._tasksFile = tasksFile; + this._lineNumber = lineNumber; + this._sectionStart = sectionStart; + this._sectionIndex = sectionIndex; + this._precedingHeader = precedingHeader; + } + static fromUnknownPosition(tasksFile) { + return new TaskLocation(tasksFile, 0, 0, 0, null); + } + fromRenamedFile(newTasksFile) { + return new TaskLocation( + newTasksFile, + this.lineNumber, + this.sectionStart, + this.sectionIndex, + this.precedingHeader + ); + } + get tasksFile() { + return this._tasksFile; + } + get path() { + return this._tasksFile.path; + } + get lineNumber() { + return this._lineNumber; + } + get sectionStart() { + return this._sectionStart; + } + get sectionIndex() { + return this._sectionIndex; + } + get precedingHeader() { + return this._precedingHeader; + } + get hasKnownPath() { + return this.path !== ""; + } +}; + +// src/Obsidian/Cache.ts +function getTasksFromFileContent2(filePath, fileContent, listItems, logger, fileCache, errorReporter) { + const tasksFile = new TasksFile(filePath); + const tasks = []; + const fileLines = fileContent.split("\n"); + const linesInFile = fileLines.length; + const dateFromFileName = new Lazy(() => DateFallback.fromPath(filePath)); + let currentSection = null; + let sectionIndex = 0; + for (const listItem of listItems) { + if (listItem.task !== void 0) { + const lineNumber = listItem.position.start.line; + if (lineNumber >= linesInFile) { + logger.debug( + `${filePath} Obsidian gave us a line number ${lineNumber} past the end of the file. ${linesInFile}.` + ); + return tasks; + } + if (currentSection === null || currentSection.position.end.line < lineNumber) { + currentSection = Cache2.getSection(lineNumber, fileCache.sections); + sectionIndex = 0; + } + if (currentSection === null) { + continue; + } + const line = fileLines[lineNumber]; + if (line === void 0) { + logger.debug(`${filePath}: line ${lineNumber} - ignoring 'undefined' line.`); + continue; + } + let task; + try { + task = Task.fromLine({ + line, + taskLocation: new TaskLocation( + tasksFile, + lineNumber, + currentSection.position.start.line, + sectionIndex, + Cache2.getPrecedingHeader(lineNumber, fileCache.headings) + ), + fallbackDate: dateFromFileName.value + }); + } catch (e) { + errorReporter(e, filePath, listItem, line); + continue; + } + if (task !== null) { + sectionIndex++; + tasks.push(task); + } + } + } + return tasks; +} +var Cache2 = class { + constructor({ metadataCache: metadataCache2, vault: vault2, events }) { + this.logger = logging.getLogger("tasks.Cache"); + this.logger.debug("Creating Cache object"); + this.metadataCache = metadataCache2; + this.metadataCacheEventReferences = []; + this.vault = vault2; + this.vaultEventReferences = []; + this.events = events; + this.eventsEventReferences = []; + this.tasksMutex = new Mutex(); + this.state = "Cold" /* Cold */; + this.logger.debug("Cache.constructor(): state = Cold"); + this.tasks = []; + this.loadedAfterFirstResolve = false; + this.subscribeToCache(); + this.subscribeToVault(); + this.subscribeToEvents(); + this.loadVault(); + } + unload() { + this.logger.info("Unloading Cache"); + for (const eventReference of this.metadataCacheEventReferences) { + this.metadataCache.offref(eventReference); + } + for (const eventReference of this.vaultEventReferences) { + this.vault.offref(eventReference); + } + for (const eventReference of this.eventsEventReferences) { + this.events.off(eventReference); + } + } + getTasks() { + return this.tasks; + } + getState() { + return this.state; + } + notifySubscribers() { + this.logger.debug("Cache.notifySubscribers()"); + this.events.triggerCacheUpdate({ + tasks: this.tasks, + state: this.state + }); + } + subscribeToCache() { + this.logger.debug("Cache.subscribeToCache()"); + const resolvedEventeReference = this.metadataCache.on("resolved", () => __async(this, null, function* () { + if (!this.loadedAfterFirstResolve) { + this.loadedAfterFirstResolve = true; + this.loadVault(); + } + })); + this.metadataCacheEventReferences.push(resolvedEventeReference); + const changedEventReference = this.metadataCache.on("changed", (file) => { + this.tasksMutex.runExclusive(() => { + this.indexFile(file); + }); + }); + this.metadataCacheEventReferences.push(changedEventReference); + } + subscribeToVault() { + this.logger.debug("Cache.subscribeToVault()"); + const { useFilenameAsScheduledDate } = getSettings(); + const createdEventReference = this.vault.on("create", (file) => { + if (!(file instanceof import_obsidian4.TFile)) { + return; + } + this.logger.debug(`Cache.subscribeToVault.createdEventReference() ${file.path}`); + this.tasksMutex.runExclusive(() => { + this.indexFile(file); + }); + }); + this.vaultEventReferences.push(createdEventReference); + const deletedEventReference = this.vault.on("delete", (file) => { + if (!(file instanceof import_obsidian4.TFile)) { + return; + } + this.logger.debug(`Cache.subscribeToVault.deletedEventReference() ${file.path}`); + this.tasksMutex.runExclusive(() => { + this.tasks = this.tasks.filter((task) => { + return task.path !== file.path; + }); + this.notifySubscribers(); + }); + }); + this.vaultEventReferences.push(deletedEventReference); + const renamedEventReference = this.vault.on("rename", (file, oldPath) => { + if (!(file instanceof import_obsidian4.TFile)) { + return; + } + this.logger.debug(`Cache.subscribeToVault.renamedEventReference() ${file.path}`); + this.tasksMutex.runExclusive(() => { + const tasksFile = new TasksFile(file.path); + const fallbackDate = new Lazy(() => DateFallback.fromPath(file.path)); + this.tasks = this.tasks.map((task) => { + if (task.path === oldPath) { + if (!useFilenameAsScheduledDate) { + return new Task(__spreadProps(__spreadValues({}, task), { + taskLocation: task.taskLocation.fromRenamedFile(tasksFile) + })); + } else { + return DateFallback.updateTaskPath(task, file.path, fallbackDate.value); + } + } else { + return task; + } + }); + this.notifySubscribers(); + }); + }); + this.vaultEventReferences.push(renamedEventReference); + } + subscribeToEvents() { + this.logger.debug("Cache.subscribeToEvents()"); + const requestReference = this.events.onRequestCacheUpdate((handler) => { + handler({ tasks: this.tasks, state: this.state }); + }); + this.eventsEventReferences.push(requestReference); + } + loadVault() { + this.logger.debug("Cache.loadVault()"); + return this.tasksMutex.runExclusive(() => __async(this, null, function* () { + this.state = "Initializing" /* Initializing */; + this.logger.debug("Cache.loadVault(): state = Initializing"); + yield Promise.all( + this.vault.getMarkdownFiles().map((file) => { + return this.indexFile(file); + }) + ); + this.state = "Warm" /* Warm */; + this.logger.debug("Cache.loadVault(): state = Warm"); + this.notifySubscribers(); + })); + } + indexFile(file) { + return __async(this, null, function* () { + const fileCache = this.metadataCache.getFileCache(file); + if (fileCache === null || fileCache === void 0) { + return; + } + if (!file.path.endsWith(".md")) { + this.logger.debug("indexFile: skipping non-markdown file: " + file.path); + return; + } + this.logger.debug("Cache.indexFile: " + file.path); + const oldTasks = this.tasks.filter((task) => { + return task.path === file.path; + }); + const listItems = fileCache.listItems; + let newTasks = []; + if (listItems !== void 0) { + const fileContent = yield this.vault.cachedRead(file); + newTasks = this.getTasksFromFileContent( + fileContent, + listItems, + fileCache, + file.path, + this.reportTaskParsingErrorToUser, + this.logger + ); + } + if (Task.tasksListsIdentical(oldTasks, newTasks)) { + return; + } + this.tasks = this.tasks.filter((task) => { + return task.path !== file.path; + }); + this.tasks.push(...newTasks); + this.logger.debug("Cache.indexFile: " + file.path + `: read ${newTasks.length} task(s)`); + this.notifySubscribers(); + }); + } + getTasksFromFileContent(fileContent, listItems, fileCache, filePath, errorReporter, logger) { + return getTasksFromFileContent2(filePath, fileContent, listItems, logger, fileCache, errorReporter); + } + reportTaskParsingErrorToUser(e, filePath, listItem, line) { + const msg = `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} -Task line: ${i} +File: ${filePath} +Line number: ${listItem.position.start.line} +Task line: ${line} Please create a bug report for this message at https://github.com/obsidian-tasks-group/obsidian-tasks/issues/new/choose @@ -165,13 +17160,750 @@ Include: 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. -`;this.logger.error(s),e instanceof Error&&this.logger.error(e.stack?e.stack:"Cannot determine stack"),this.state==="Initializing"&&new Ss.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 lh=require("obsidian");var _w=require("obsidian");function kt(){}function Ym(r){return r()}function kv(){return Object.create(null)}function Tr(r){r.forEach(Ym)}function pl(r){return typeof r=="function"}function Ms(r,e){return r!=r?e==e:r!==e||r&&typeof r=="object"||typeof r=="function"}function Ev(r){return Object.keys(r).length===0}var Sv=typeof window!="undefined"?window:typeof globalThis!="undefined"?globalThis:global,Do=class{constructor(e){this.options=e,this._listeners="WeakMap"in Sv?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)Do.entries.set(i.target,i),(n=this._listeners.get(i.target))===null||n===void 0||n(i)})}};Do.entries="WeakMap"in Sv?new WeakMap:void 0;var Ov=!1;function sN(){Ov=!0}function aN(){Ov=!1}function A(r,e){r.appendChild(e)}function Ie(r,e,t){r.insertBefore(e,t||null)}function Ce(r){r.parentNode&&r.parentNode.removeChild(r)}function Cs(r,e){for(let t=0;tr.removeEventListener(e,t,n)}function Dv(r){return function(e){return e.preventDefault(),r.call(this,e)}}function F(r,e,t){t==null?r.removeAttribute(e):r.getAttribute(e)!==t&&r.setAttribute(e,t)}function xv(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 uN(r){return Array.from(r.childNodes)}function Pr(r,e){e=""+e,r.data!==e&&(r.data=e)}function Nr(r,e){r.value=e==null?"":e}function Bm(r,e,t){for(let n=0;n{a.source===n.contentWindow&&e()})):(n.src="about:blank",n.onload=()=>{s=xe(n.contentWindow,"resize",e),e()}),A(r,n),()=>{(i||s&&n.contentWindow)&&s(),Ce(n)}}function Ir(r,e,t){r.classList[t?"add":"remove"](e)}var Rs=class{constructor(e=!1){this.is_svg=!1,this.is_svg=e,this.e=this.n=null}c(e){this.h(e)}m(e,t,n=null){this.e||(this.is_svg?this.e=oN(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;tr.indexOf(n)===-1?e.push(n):t.push(n)),t.forEach(n=>n()),xs=e}var fl=new Set,Ni;function Av(){Ni={r:0,c:[],p:Ni}}function Pv(){Ni.r||Tr(Ni.c),Ni=Ni.p}function _r(r,e){r&&r.i&&(fl.delete(r),r.i(e))}function Fr(r,e,t,n){if(r&&r.o){if(fl.has(r))return;fl.add(r),Ni.c.push(()=>{fl.delete(r),n&&(t&&r.d(1),n())}),r.o(e)}else n&&n()}var hN=["allowfullscreen","allowpaymentrequest","async","autofocus","autoplay","checked","controls","default","defer","disabled","formnovalidate","hidden","inert","ismap","loop","multiple","muted","nomodule","novalidate","open","playsinline","readonly","required","reversed","selected"],Xj=new Set([...hN]);function tr(r,e,t){let n=r.$$.props[e];n!==void 0&&(r.$$.bound[n]=t,t(r.$$.ctx[n]))}function Mn(r){r&&r.c()}function tn(r,e,t,n){let{fragment:i,after_update:s}=r.$$;i&&i.m(e,t),n||Ii(()=>{let a=r.$$.on_mount.map(Ym).filter(pl);r.$$.on_destroy?r.$$.on_destroy.push(...a):Tr(a),r.$$.on_mount=[]}),s.forEach(Ii)}function Lr(r,e){let t=r.$$;t.fragment!==null&&(mN(t.after_update),Tr(t.on_destroy),t.fragment&&t.fragment.d(e),t.on_destroy=t.fragment=null,t.ctx=[])}function gN(r,e){r.$$.dirty[0]===-1&&(Ds.push(r),fN(),r.$$.dirty.fill(0)),r.$$.dirty[e/31|0]|=1<{let b=m.length?m[0]:p;return l.ctx&&i(l.ctx[d],l.ctx[d]=b)&&(!l.skip_bound&&l.bound[d]&&l.bound[d](b),c&&gN(r,d)),p}):[],l.update(),c=!0,Tr(l.before_update),l.fragment=n?n(l.ctx):!1,e.target){if(e.hydrate){sN();let d=uN(e.target);l.fragment&&l.fragment.l(d),d.forEach(Ce)}else l.fragment&&l.fragment.c();e.intro&&_r(r.$$.fragment),tn(r,e.target,e.anchor,e.customElement),aN(),Cv()}Oo(u)}var yN;typeof HTMLElement=="function"&&(yN=class extends HTMLElement{constructor(){super(),this.attachShadow({mode:"open"})}connectedCallback(){let{on_mount:r}=this.$$;this.$$.on_disconnect=r.map(Ym).filter(pl);for(let e in this.$$.slotted)this.appendChild(this.$$.slotted[e])}attributeChangedCallback(r,e,t){this[r]=t}disconnectedCallback(){Tr(this.$$.on_disconnect)}$destroy(){Lr(this,1),this.$destroy=kt}$on(r,e){if(!pl(e))return kt;let t=this.$$.callbacks[r]||(this.$$.callbacks[r]=[]);return t.push(e),()=>{let n=t.indexOf(e);n!==-1&&t.splice(n,1)}}$set(r){this.$$set&&!Ev(r)&&(this.$$.skip_bound=!0,this.$$set(r),this.$$.skip_bound=!1)}});var Jn=class{$destroy(){Lr(this,1),this.$destroy=kt}$on(e,t){if(!pl(t))return kt;let n=this.$$.callbacks[e]||(this.$$.callbacks[e]=[]);return n.push(t),()=>{let i=n.indexOf(t);i!==-1&&n.splice(i,1)}}$set(e){this.$$set&&!Ev(e)&&(this.$$.skip_bound=!0,this.$$set(e),this.$$.skip_bound=!1)}};function Vm(r,e,t,n){function i(s){return s instanceof t?s:new t(function(a){a(s)})}return new(t||(t=Promise))(function(s,a){function o(c){try{l(n.next(c))}catch(d){a(d)}}function u(c){try{l(n.throw(c))}catch(d){a(d)}}function l(c){c.done?s(c.value):i(c.value).then(o,u)}l((n=n.apply(r,e||[])).next())})}function zm(r){let e="",t=!0;for(;t;)e=Math.random().toString(36).substring(2,6+2),r.includes(e)||(t=!1);return e}function Nv(r,e){return r.id!==""?r:new oe(be(X({},r),{id:zm(e)}))}function Iv(r,e){let t=r;if(!r.dependsOn.includes(e.id)){let n=[...r.dependsOn,e.id];t=new oe(be(X({},r),{dependsOn:n}))}return t}function Fv(r,e){let t=r;if(r.dependsOn.includes(e.id)){let n=r.dependsOn.filter(i=>i!==e.id);t=new oe(be(X({},r),{dependsOn:n}))}return t}var Mo=require("obsidian");var Ro,Km,Qm,bN=["md"];function gl(){return Pt.getLogger("tasks.File")}var Lv=({metadataCache:r,vault:e,workspace:t})=>{Ro=r,Km=e,Qm=t},rn=t=>L(void 0,[t],function*({originalTask:r,newTasks:e}){if(Km===void 0||Ro===void 0||Qm===void 0){ml("Tasks: cannot use File before initializing it.");return}Array.isArray(e)||(e=[e]);let n=gl(),i="replaceTaskWithTasks()";ll(n,i,r),cl(n,i,e),yield Wv({originalTask:r,newTasks:e,vault:Km,metadataCache:Ro,workspace:Qm,previousTries:0})});function ml(r){console.error(r),new Mo.Notice(r,15e3)}function Uv(r){console.warn(r),new Mo.Notice(r,1e4)}function TN(r){gl().debug(r)}var ei=class extends Error{},hl=class extends Error{},Wv=a=>L(void 0,[a],function*({originalTask:r,newTasks:e,vault:t,metadataCache:n,workspace:i,previousTries:s}){let o=gl();o.debug(`tryRepetitive after ${s} previous tries`);let u=()=>L(void 0,null,function*(){if(s>10){let c=`Tasks: Could not find the correct task line to update. +`; + this.logger.error(msg); + if (e instanceof Error) { + this.logger.error(e.stack ? e.stack : "Cannot determine stack"); + } + if (this.state === "Initializing" /* Initializing */) { + new import_obsidian4.Notice(msg, 1e4); + } + } + static getSection(lineNumberTask, sections) { + if (sections === void 0) { + return null; + } + for (const section of sections) { + if (section.position.start.line <= lineNumberTask && section.position.end.line >= lineNumberTask) { + return section; + } + } + return null; + } + static getPrecedingHeader(lineNumberTask, headings) { + if (headings === void 0) { + return null; + } + let precedingHeader = null; + for (const heading of headings) { + if (heading.position.start.line > lineNumberTask) { + return precedingHeader; + } + precedingHeader = heading.heading; + } + return precedingHeader; + } +}; + +// src/Commands/CreateOrEdit.ts +var import_obsidian7 = require("obsidian"); + +// src/Obsidian/TaskModal.ts +var import_obsidian6 = require("obsidian"); + +// node_modules/svelte/internal/index.mjs +function noop() { +} +function run(fn) { + return fn(); +} +function blank_object() { + return /* @__PURE__ */ Object.create(null); +} +function run_all(fns) { + fns.forEach(run); +} +function is_function(thing) { + return typeof thing === "function"; +} +function safe_not_equal(a, b) { + return a != a ? b == b : a !== b || (a && typeof a === "object" || typeof a === "function"); +} +function is_empty(obj) { + return Object.keys(obj).length === 0; +} +var globals = typeof window !== "undefined" ? window : typeof globalThis !== "undefined" ? globalThis : global; +var ResizeObserverSingleton = class { + constructor(options) { + this.options = options; + this._listeners = "WeakMap" in globals ? /* @__PURE__ */ new WeakMap() : void 0; + } + observe(element2, listener) { + this._listeners.set(element2, listener); + this._getObserver().observe(element2, this.options); + return () => { + this._listeners.delete(element2); + this._observer.unobserve(element2); + }; + } + _getObserver() { + var _a; + return (_a = this._observer) !== null && _a !== void 0 ? _a : this._observer = new ResizeObserver((entries) => { + var _a2; + for (const entry of entries) { + ResizeObserverSingleton.entries.set(entry.target, entry); + (_a2 = this._listeners.get(entry.target)) === null || _a2 === void 0 ? void 0 : _a2(entry); + } + }); + } +}; +ResizeObserverSingleton.entries = "WeakMap" in globals ? /* @__PURE__ */ new WeakMap() : void 0; +var is_hydrating = false; +function start_hydrating() { + is_hydrating = true; +} +function end_hydrating() { + is_hydrating = false; +} +function append(target, node) { + target.appendChild(node); +} +function insert(target, node, anchor) { + target.insertBefore(node, anchor || null); +} +function detach(node) { + if (node.parentNode) { + node.parentNode.removeChild(node); + } +} +function destroy_each(iterations, detaching) { + for (let i = 0; i < iterations.length; i += 1) { + if (iterations[i]) + iterations[i].d(detaching); + } +} +function element(name) { + return document.createElement(name); +} +function svg_element(name) { + return document.createElementNS("http://www.w3.org/2000/svg", name); +} +function text(data) { + return document.createTextNode(data); +} +function space() { + return text(" "); +} +function empty2() { + return text(""); +} +function listen(node, event, handler, options) { + node.addEventListener(event, handler, options); + return () => node.removeEventListener(event, handler, options); +} +function prevent_default(fn) { + return function(event) { + event.preventDefault(); + return fn.call(this, event); + }; +} +function attr(node, attribute, value) { + if (value == null) + node.removeAttribute(attribute); + else if (node.getAttribute(attribute) !== value) + node.setAttribute(attribute, value); +} +function init_binding_group(group) { + let _inputs; + return { + p(...inputs) { + _inputs = inputs; + _inputs.forEach((input) => group.push(input)); + }, + r() { + _inputs.forEach((input) => group.splice(group.indexOf(input), 1)); + } + }; +} +function children(element2) { + return Array.from(element2.childNodes); +} +function set_data(text2, data) { + data = "" + data; + if (text2.data === data) + return; + text2.data = data; +} +function set_input_value(input, value) { + input.value = value == null ? "" : value; +} +function select_option(select, value, mounting) { + for (let i = 0; i < select.options.length; i += 1) { + const option = select.options[i]; + if (option.__value === value) { + option.selected = true; + return; + } + } + if (!mounting || value !== void 0) { + select.selectedIndex = -1; + } +} +function select_value(select) { + const selected_option = select.querySelector(":checked"); + return selected_option && selected_option.__value; +} +var crossorigin; +function is_crossorigin() { + if (crossorigin === void 0) { + crossorigin = false; + try { + if (typeof window !== "undefined" && window.parent) { + void window.parent.document; + } + } catch (error) { + crossorigin = true; + } + } + return crossorigin; +} +function add_iframe_resize_listener(node, fn) { + const computed_style = getComputedStyle(node); + if (computed_style.position === "static") { + node.style.position = "relative"; + } + const iframe = element("iframe"); + iframe.setAttribute("style", "display: block; position: absolute; top: 0; left: 0; width: 100%; height: 100%; overflow: hidden; border: 0; opacity: 0; pointer-events: none; z-index: -1;"); + iframe.setAttribute("aria-hidden", "true"); + iframe.tabIndex = -1; + const crossorigin2 = is_crossorigin(); + let unsubscribe; + if (crossorigin2) { + iframe.src = "data:text/html,