Files
StudyDiary-20261009/.obsidian/plugins/obsidian-reminder-plugin/main.js
CrazyJasonwell e97be9ac8c commit all
2026-10-09 22:06:40 +08:00

90 lines
235 KiB
JavaScript
Executable File

/*
THIS IS A GENERATED/BUNDLED FILE BY ESBUILD
if you want to view the source, please visit the github repository of this plugin
*/
"use strict";var hs=Object.defineProperty;var mp=Object.getOwnPropertyDescriptor;var pp=Object.getOwnPropertyNames;var hp=Object.prototype.hasOwnProperty;var Iu=r=>{throw TypeError(r)};var gp=(r,e,t)=>e in r?hs(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t;var bp=(r,e)=>{for(var t in e)hs(r,t,{get:e[t],enumerable:!0})},vp=(r,e,t,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of pp(e))!hp.call(r,i)&&i!==t&&hs(r,i,{get:()=>e[i],enumerable:!(n=mp(e,i))||n.enumerable});return r};var yp=r=>vp(hs({},"__esModule",{value:!0}),r);var c=(r,e,t)=>gp(r,typeof e!="symbol"?e+"":e,t),fl=(r,e,t)=>e.has(r)||Iu("Cannot "+t);var h=(r,e,t)=>(fl(r,e,"read from private field"),t?t.call(r):e.get(r)),L=(r,e,t)=>e.has(r)?Iu("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(r):e.set(r,t),Z=(r,e,t,n)=>(fl(r,e,"write to private field"),n?n.call(r,t):e.set(r,t),t),U=(r,e,t)=>(fl(r,e,"access private method"),t);var _b={};bp(_b,{default:()=>ul});module.exports=yp(_b);var ho=class{constructor(e){c(this,"deps",e);c(this,"lastExpiredKeys",new Set)}startPeriodicTask(){let e=!0;this.periodicTask().finally(()=>{e=!1}),this.deps.registerInterval(window.setInterval(()=>{if(e){console.debug("Skip reminder interval task because task is already running.");return}e=!0,this.periodicTask().finally(()=>{e=!1})},this.deps.checkIntervalSec()*1e3))}async periodicTask(){if(this.deps.reloadUI(!1),this.deps.isScanned()||this.deps.reloadRemindersInAllFiles().then(()=>{this.deps.markScanned(),this.deps.saveData()}),this.deps.saveData(!1),this.deps.isPopupIntrusive()&&this.deps.isEditing())return;let e=this.deps.getExpiredReminders(),t=new Set(e.map(i=>i.key()));for(let i of t)if(!this.lastExpiredKeys.has(i)){this.deps.reloadUI(!0);break}if(this.lastExpiredKeys=t,!this.deps.isNotificationEnabled()||this.deps.isNotificationPaused())return;let n;for(let i of e)if(this.deps.isLayoutReady()){if(i.muteNotification)continue;if(n)for(;n.beingDisplayed;)await this.sleep(100);this.deps.showReminder(i),n=i}}async sleep(e){return new Promise(t=>window.setTimeout(t,e))}};function ml(r){let e=r.lastIndexOf("/");return(e===-1?r:r.slice(e+1)).replace(/\.md$/i,"")}function pl(r,e){let t=new Map;for(let o of r){let s=t.get(o.sequenceId);s===void 0?t.set(o.sequenceId,[o]):s.push(o)}let n=[],i=[];for(let o of t.values()){let s=o[o.length-1];if(s.event==="message_delete")continue;(s.atSeconds>e?n:i).push({sequenceId:s.sequenceId,atSeconds:s.atSeconds})}return{pending:n,delivered:i}}var go="obr-";function bo(r){return r.startsWith(go)}var Ip=16777619,_p=2166136261,Cp=2654435769;function _u(r,e){let t=e;for(let n=0;n<r.length;n++)t^=r.charCodeAt(n),t=Math.imul(t,Ip);return t>>>0}var xp=`
`;function Cu(r,e){return`${r}${xp}${e}`}function xu(r,e,t){let n=Cu(r,e),i=_u(n,_p).toString(36),o=_u(n,Cp).toString(36),s=`${go}${i}${o}`;return t===0?s:`${s}-${t}`}function hl(r){var i;let e=[...r].sort((o,s)=>o.file!==s.file?o.file<s.file?-1:1:o.rowNumber-s.rowNumber),t=new Map,n=new Map;for(let o of e){let s=Cu(o.file,o.title),a=(i=t.get(s))!=null?i:0;t.set(s,a+1),n.set(o,xu(o.file,o.title,a))}return n}var wp=10,Ap=1440*60;function gl(r){let{reminders:e,serverPending:t,serverDelivered:n=[],now:i,defaultTime:o,minLeadSeconds:s=wp,horizonSeconds:a=Ap}=r,l=i.getTimeInMillis(o),u=l+s*1e3,d=l+a*1e3,p=hl(e),f=new Map;for(let x of e){let X=x.time.getTimeInMillis(o),K=p.get(x);f.set(K,Math.floor(X/1e3))}let m=new Map;for(let x of e){let X=x.time.getTimeInMillis(o);if(X<=u||X>d)continue;let K=p.get(x);m.set(K,{sequenceId:K,atSeconds:Math.floor(X/1e3),reminder:x})}let b=new Map;for(let x of t)b.set(x.sequenceId,x);let g=[];for(let x of m.values()){let X=b.get(x.sequenceId);(X===void 0||X.atSeconds!==x.atSeconds)&&g.push(x)}let v=[],I=new Set;function w(x){I.has(x)||(I.add(x),v.push({sequenceId:x}))}for(let x of t)bo(x.sequenceId)&&(m.has(x.sequenceId)||wu(x,f)&&w(x.sequenceId));for(let x of n)wu(x,f)&&w(x.sequenceId);return{publish:g,delete:v}}function wu(r,e){if(!bo(r.sequenceId))return!1;let t=e.get(r.sequenceId);return t===void 0||t!==r.atSeconds}function bl(r){return r.map(e=>e.sequenceId).filter(bo)}var Rp=/^[-_A-Za-z0-9]{1,64}$/;function ai(r){return Rp.test(r)}var li=class{constructor(e){c(this,"_value",e)}get value(){return this._value}},bn=class{constructor(e){c(this,"_value",e);c(this,"onChangeFunctions",[])}onChanged(e){this.onChangeFunctions.push(e)}get value(){return this._value}set value(e){let t=this._value;this._value=e,this.onChangeFunctions.forEach(n=>{n(t,e)})}};var Au=require("obsidian"),P=Au.moment;var G=class r{constructor(e,t){c(this,"time",e);c(this,"_hasTimePart",t)}static now(){return new r(P(),!0)}static parse(e){return e.length>10?new r(P(e,"YYYY-MM-DD HH:mm"),!0):new r(P(e,"YYYY-MM-DD"),!1)}static ofEpochMillis(e){return new r(P(e),!0)}static duration(e,t,n,i){return t.fixedTime(i).diff(e.fixedTime(i),n)}getTimeInMillis(e){return this.fixedTime(e).valueOf()}format(e,t){return this.fixedTime(t).format(e)}toYYYYMMMM(e){return this.fixedTime(e).format("YYYY, MMMM")}toYYYYMMDD(e){return this.fixedTime(e).format("YYYY-MM-DD")}add(e,t,n){return new r(this.fixedTime(n).clone().add(e,t),this._hasTimePart)}fixedTime(e){return this._hasTimePart?this.time:e===void 0?this.time:this.time.clone().add(e.minutes,"minutes")}get hasTimePart(){return this._hasTimePart}moment(){return this.time}isValid(){return this.time.isValid()}clone(e){let t=e==null?this._hasTimePart:e,n=this.time.clone();return new r(n,t)}toString(){return this._hasTimePart?this.format("YYYY-MM-DD HH:mm"):this.format("YYYY-MM-DD")}equals(e){return this._hasTimePart===e._hasTimePart&&this.time.isSame(e.time)}},gs=class r{constructor(e,t){c(this,"hour",e);c(this,"minute",t)}static parse(e){if(!e.match(/^\d{1,2}:\d{1,2}$/))throw new Error(`Unexpected format time(${e}). Time must be HH:mm.`);let t=e.split(":");if(t.length!==2)throw new Error(`Unexpected format time(${e}). time must be HH:mm.`);let n=parseInt(t[0]),i=parseInt(t[1]);if(n>23||n<0)throw new Error("hour must be 0~23");if(i>59||i<0)throw new Error("minute must be 0~59");return new r(n,i)}get minutes(){return this.hour*60+this.minute}toString(){let e=t=>t<10?"0"+t:""+t;return`${e(this.hour)}:${e(this.minute)}`}};function ci(r,e){return()=>new G(P(),!0).add(r,e)}function Ru(r){return ci(r,"minutes")}function vl(r){return ci(r,"hours")}function kp(r){return ci(r,"days")}function Fp(r){return ci(r,"weeks")}function Sp(r){return ci(r,"months")}function Ep(r){return ci(r,"years")}function Zn(r){return()=>{let e=P();return e.isoWeekday()<=r?new G(e.isoWeekday(r),!1):new G(e.add(1,"weeks").isoWeekday(r),!1)}}function yl(){return()=>new G(P().add(1,"days"),!1)}function ku(){return()=>new G(P().add(1,"weeks"),!1)}function Tp(){return()=>new G(P().add(1,"months"),!1)}function Gp(){return()=>new G(P().add(1,"years"),!1)}var ve=class{constructor(e,t){c(this,"label",e);c(this,"later",t)}};function Fu(r){return r.split(`
`).map(e=>Bp(e.trim()))}function Bp(r){if(r=r.toLowerCase(),r.startsWith("in")){let e=r.split(" ");if(e.length!==3)throw new Error("Unsupported format. Should be 'In N (minutes|hours)'");let t=e[1]==="a"||e[1]==="an"?1:parseInt(e[1]);switch(e[2]){case"minute":case"minutes":{let n=t==1?"minute":"minutes";return new ve(`In ${t} ${n}`,Ru(t))}case"hour":case"hours":{let n=t==1?"hour":"hours";return new ve(`In ${t} ${n}`,vl(t))}case"day":case"days":{let n=t==1?"day":"days";return new ve(`In ${t} ${n}`,kp(t))}case"week":case"weeks":{let n=t==1?"week":"weeks";return new ve(`In ${t} ${n}`,Fp(t))}case"month":case"months":{let n=t==1?"month":"months";return new ve(`In ${t} ${n}`,Sp(t))}case"year":case"years":{let n=t==1?"year":"years";return new ve(`In ${t} ${n}`,Ep(t))}}}else if(r.startsWith("next")){let e=r.substring(5);switch(e){case"sunday":return new ve("Next Sunday",Zn(0));case"monday":return new ve("Next Monday",Zn(1));case"tuesday":return new ve("Next Tuesday",Zn(2));case"wednesday":return new ve("Next Wednesday",Zn(3));case"thursday":return new ve("Next Thursday",Zn(4));case"friday":return new ve("Next Friday",Zn(5));case"saturday":return new ve("Next Saturday",Zn(6));case"day":return new ve("Tomorrow",yl());case"week":return new ve("Next week",ku());case"month":return new ve("Next month",Tp());case"year":return new ve("Next year",Gp());default:throw new Error(`Unsupported weekday: ${e}`)}}else if(r==="tomorrow")return new ve("Tomorrow",yl());throw new Error(`Unsupported format: ${r}`)}var _l=[new ve("In 30 minutes",Ru(30)),new ve("In 1 hours",vl(1)),new ve("In 3 hours",vl(3)),new ve("Tomorrow",yl()),new ve("Next week",ku())],Il=class{constructor(){c(this,"dateFormat",new li("YYYY-MM-DD"));c(this,"dateTimeFormat",new li("YYYY-MM-DD HH:mm"));c(this,"strict",new li(!1))}setTimeFormat(e,t,n){this.dateFormat=e,this.dateTimeFormat=t,this.strict=n}parse(e){let t=this.doParse(e,!0);return t!=null?t:this.strict.value?null:this.doParse(e,!1)}doParse(e,t){let n=P(e,this.dateTimeFormat.value,t);if(n.isValid())return new G(n,!0);let i=P(e,this.dateFormat.value,t);return i.isValid()?new G(i,!1):null}toString(e){return e.hasTimePart?e.format(this.dateTimeFormat.value):e.format(this.dateFormat.value)}},xr=new Il;var Dp=1800*1e3,Np=10*1e3,Zp=200;function bs(r){let e=r.trim();return e.length===0?{}:{Authorization:`Bearer ${e}`}}function Eu(r){return r.trim().replace(/\/+$/,"")}function Tu(r,e){return`${r}/${encodeURIComponent(e)}/json?poll=1&sched=1`}function Gu(r,e,t){return`${r}/${encodeURIComponent(e)}/${encodeURIComponent(t)}`}function vs(r){let e=r.text.trim().slice(0,Zp);return e.length===0?`status=${r.status}`:`status=${r.status} body=${e}`}function Bu(r){return r===401||r===403}var vo=class{constructor(e){c(this,"deps",e);c(this,"debounceTimer");c(this,"syncing",!1);c(this,"syncQueued",!1);c(this,"stopped",!1);c(this,"previousEnabled");c(this,"authFailureNotified",!1)}start(){this.previousEnabled=this.deps.isEnabled(),this.sync(),this.deps.registerInterval(window.setInterval(()=>{this.sync()},Dp))}stop(){this.stopped=!0,this.debounceTimer!==void 0&&(window.clearTimeout(this.debounceTimer),this.debounceTimer=void 0)}notifyRemindersChanged(){this.stopped||(this.debounceTimer!==void 0&&window.clearTimeout(this.debounceTimer),this.debounceTimer=window.setTimeout(()=>{this.debounceTimer=void 0,this.sync()},Np))}notifySettingsChanged(){this.stopped||(this.authFailureNotified=!1,this.checkEnabledTransition(),this.notifyRemindersChanged())}noteAuthFailure(e){!Bu(e)||this.authFailureNotified||(this.authFailureNotified=!0,this.deps.notify(`Reminder: the ntfy server rejected the request (${e}). Scheduled notifications are not being published. Check the ntfy access token in the plugin settings.`))}checkEnabledTransition(){let e=this.deps.isEnabled(),t=this.previousEnabled;this.previousEnabled=e,t===!0&&!e&&this.cleanupAfterDisable()}async cleanupAfterDisable(){let e=this.resolveServerAndTopic();if(e===void 0)return;let{serverUrl:t,topic:n}=e;try{let{pending:i}=await this.fetchServerState(t,n),o=bl(i);for(let s of o)await this.deleteScheduled(t,n,s)}catch(i){console.error("[ntfy] Failed to clean up scheduled notifications after disabling: %o",i)}}async sync(){if(this.syncing){this.syncQueued=!0;return}this.syncing=!0;try{await this.doSync()}finally{this.syncing=!1,this.syncQueued&&(this.syncQueued=!1,this.sync())}}async doSync(){if(!this.deps.isEnabled())return;let e=this.resolveServerAndTopic();if(e===void 0)return;let{serverUrl:t,topic:n}=e;try{let{pending:i,delivered:o}=await this.fetchServerState(t,n),s=gl({reminders:this.deps.reminders(),serverPending:i,serverDelivered:o,now:G.now(),defaultTime:this.deps.defaultTime()});for(let a of s.delete)await this.deleteScheduled(t,n,a.sequenceId);for(let a of s.publish)await this.publish(t,n,a)}catch(i){console.error("[ntfy] Failed to sync scheduled notifications: %o",i)}}resolveServerAndTopic(){let e=Eu(this.deps.serverUrl()),t=this.deps.topic().trim();if(!(e.length===0||!ai(t)))return{serverUrl:e,topic:t}}async fetchServerState(e,t){let n=await this.deps.request({url:Tu(e,t),method:"GET",headers:bs(this.deps.accessToken())});if(n.status>=400)throw this.noteAuthFailure(n.status),new Error(`ntfy: failed to fetch the topic's scheduled messages: ${vs(n)}`);let i=[];for(let s of n.text.split(`
`)){let a=s.trim();if(a.length===0)continue;let l;try{l=JSON.parse(a)}catch(u){console.error("[ntfy] Failed to parse a poll response line: %o",u);continue}l.event!=="message"&&l.event!=="message_delete"||l.sequence_id===void 0||l.time===void 0||i.push({event:l.event,sequenceId:l.sequence_id,atSeconds:l.time})}let o=Math.floor(Date.now()/1e3);return pl(i,o)}async publish(e,t,n){let i=await this.deps.request({url:`${e}/`,method:"POST",headers:{...bs(this.deps.accessToken()),"Content-Type":"application/json","X-Sequence-ID":n.sequenceId},body:JSON.stringify({topic:t,title:n.reminder.title,message:ml(n.reminder.file),click:this.buildClickUrl(n.reminder),delay:String(n.atSeconds)})});i.status>=400&&(this.noteAuthFailure(i.status),console.error("[ntfy] Failed to publish a scheduled notification: %s",vs(i)))}async deleteScheduled(e,t,n){let i=await this.deps.request({url:Gu(e,t,n),method:"DELETE",headers:bs(this.deps.accessToken())});i.status>=400&&(this.noteAuthFailure(i.status),console.error("[ntfy] Failed to delete a scheduled notification: %s",vs(i)))}buildClickUrl(e){let t=e.file.replace(/\.md$/i,""),n=encodeURIComponent(this.deps.vaultName()),i=encodeURIComponent(t);return`obsidian://open?vault=${n}&file=${i}`}},Su=`${go}selftest`,Xp=1440*60;function Cl(r,e){let t=vs(e);return Bu(e.status)?`${r} was refused (${t}). Check the access token, and that it has read-write access to this topic.`:e.status===404?`${r} failed (${t}). Check the server URL.`:`${r} failed (${t}).`}async function Du(r,e){let t=Eu(e.serverUrl),n=e.topic.trim();if(t.length===0)return{ok:!1,message:"Set the ntfy server URL first."};if(n.length===0)return{ok:!1,message:"Set the ntfy topic first."};if(!ai(n))return{ok:!1,message:"The ntfy topic is not a valid topic name: use only letters, digits, dashes and underscores (1-64 characters)."};let i=bs(e.accessToken);try{let o=await r({url:Tu(t,n),method:"GET",headers:i});if(o.status>=400)return{ok:!1,message:Cl("Reading the topic",o)};let s=await r({url:`${t}/`,method:"POST",headers:{...i,"Content-Type":"application/json","X-Sequence-ID":Su},body:JSON.stringify({topic:n,title:"Reminder connection test",message:"Published by the Obsidian Reminder plugin to check the ntfy settings, and deleted again right away.",delay:String(Math.floor(Date.now()/1e3)+Xp)})});if(s.status>=400)return{ok:!1,message:Cl("Publishing a test message",s)};let a=await r({url:Gu(t,n,Su),method:"DELETE",headers:i});return a.status>=400?{ok:!1,message:`${Cl("Deleting the test message",a)} It stays scheduled until the next sync removes it.`}:{ok:!0,message:"Connected. Reading, publishing and deleting all succeeded."}}catch(o){return{ok:!1,message:`Could not reach ${t}: ${o instanceof Error?o.message:String(o)}`}}}var Yr=require("obsidian");var Jd=require("obsidian");var Nu=require("obsidian");function Zu(r,e){if(!e.reminders.getExpiredReminders(e.settings.reminderTime.value).some(i=>!i.muteNotification))return!1;if(r)return!0;let n=e.reminders.muteExpiredReminders(e.settings.reminderTime.value);return e.ui.reload(!0),e.data.save(!0),new Nu.Notice(`Muted ${n} reminder${n===1?"":"s"}`),!0}var xl=require("obsidian");var Xu=require("obsidian");var ys=class extends Xu.SuggestModal{constructor(t,n,i,o){super(t);c(this,"laters",n);c(this,"onSelect",i);c(this,"onCloseCallback",o);this.setPlaceholder("Pause reminder notifications for...")}getSuggestions(t){return this.laters.filter(n=>n.label.toLowerCase().includes(t.toLowerCase()))}renderSuggestion(t,n){n.createDiv({text:t.label})}onChooseSuggestion(t){this.onSelect(t)}onClose(){var t;(t=this.onCloseCallback)==null||t.call(this)}};function Up(r,e){let t=e.later();r.data.dndUntil.value=t,r.data.save(!0),r.ui.refreshDndStatusBar(),new xl.Notice(`Reminder notifications paused until ${t.format("YYYY-MM-DD HH:mm")}`)}function Is(r){r.data.dndUntil.value=null,r.data.save(!0),r.ui.refreshDndStatusBar(),new xl.Notice("Reminder notifications resumed")}function _s(r,e){new ys(r.app,r.settings.laters.value,t=>{Up(r,t)},e).open()}function Uu(r,e){return r||_s(e),!0}function ui(r,e){return r==null?!1:e.getTimeInMillis()<r.getTimeInMillis()}function Qu(r,e){return ui(e.data.dndUntil.value,G.now())?(r||Is(e),!0):!1}function Wu(r,e){return r||e.fileSystem.reloadRemindersInAllFiles(),!0}function Vu(r,e){return r||e.showReminderList(),!0}var yo="- [ ] ";function Yu(r,e,t,n){let i=r.appendReminder(yo+e,t,n==null?void 0:n+yo.length);return i==null||!i.insertedLine.startsWith(yo)?null:{insertedLine:i.insertedLine.substring(yo.length),caretPosition:Math.max(0,i.caretPosition-yo.length)}}var vn=class vn{constructor(e,t,n,i,o){c(this,"lineIndex",e);c(this,"prefix",t);c(this,"check",n);c(this,"suffix",i);c(this,"body",o)}static parse(e,t){let n=vn.regexp.exec(t);return n?new vn(e,n.groups.prefix,n.groups.check,n.groups.suffix,n.groups.body):null}toMarkdown(){return`${this.prefix}${this.check}${this.suffix}${this.body}`}isChecked(){return vn.checkedStatuses.some(e=>e===this.check)}setChecked(e){this.check=e?"x":" "}getHeaderLength(){return this.prefix.length+this.check.length+this.suffix.length}clone(){return vn.parse(this.lineIndex,this.toMarkdown())}};c(vn,"regexp",/^(?<prefix>((> ?)*)?\s*[-*+][ ]+\[)(?<check>.)(?<suffix>\]\s+)(?<body>.*)$/),c(vn,"checkedStatuses",["x","-"]);var di=vn;function Lu(r){if(di.parse(0,r)!==null)return r;let e=/^(?<lead>(?:> ?)*\s*)(?<rest>.*)$/.exec(r),t=e.groups.lead,n=e.groups.rest;if(/^#{1,6}[ ]/.test(n)||/^\d+[.)][ ]/.test(n)||n.startsWith("|")||n.startsWith("```"))return null;let i=/^(?<marker>[-*+])[ ]+(?<content>.*)$/.exec(n);if(i){let o=i.groups.marker,s=i.groups.content;return`${t}${o} [ ] ${s}`}return`${t}- [ ] ${n}`}var Cs=class Cs{constructor(e,t){c(this,"file",e);c(this,"lines",[]);c(this,"todos",[]);this.parse(t)}parse(e){this.lines=e.split(`
`),this.todos=[];let t=null,n=0;this.lines.forEach((i,o)=>{let s=Cs.fenceRegexp.exec(i),a=s==null?void 0:s.groups.fence,l=s==null?void 0:s.groups.info;if(t===null){if(a!==void 0&&(a[0]!=="`"||!l.includes("`"))){t=a[0],n=a.length;return}}else{a!==void 0&&a[0]===t&&a.length>=n&&l.trim()===""&&(t=null);return}let u=di.parse(o,i);u&&this.todos.push(u)})}getTodos(){return this.todos}insertTodo(e,t){t.lineIndex=e,this.lines.splice(e,0,t.toMarkdown());let n=-1;for(let[i,o]of this.todos.entries())o.lineIndex>=e&&(n<0&&(n=i),o.lineIndex++);n<=0?this.todos.splice(0,0,t):this.todos.splice(n,0,t)}getTodo(e){let t=this.todos.find(n=>n.lineIndex===e);return t==null?null:t}applyChanges(){this.todos.forEach(e=>{this.lines[e.lineIndex]=e.toMarkdown()})}toMarkdown(){return this.applyChanges(),this.lines.join(`
`)}};c(Cs,"fenceRegexp",/^\s*(?:> ?)*\s*(?<fence>`{3,}|~{3,})(?<info>.*)$/);var Lr=Cs;var Mu=require("obsidian");var Xn=window.require?window.require("electron"):void 0;function xs(){new Mu.Notice('Cannot insert a reminder here. Reminders can only be added to task lines such as "- [ ] task".')}function ws(r){return(r==null?void 0:r.dom.closest(".kanban-plugin__item-input"))!=null}function As(r,e,t,n,i,o){let s=r.appendReminder(e,t,n);if(s!=null)return s;if(o)return Yu(r,e,t,n);if(!i)return null;let a=Lu(e);if(a==null)return null;let l=n==null?void 0:n+(a.length-e.length);return r.appendReminder(a,t,l)}async function Ou(r,e){return Xn&&(await Xn.remote.dialog.showMessageBox({type:"question",title:"Obsidian Reminder",message:r,detail:e,buttons:["OK","Cancel"],cancelId:1})).response===0?0:1}var fi=class r{constructor(e,t,n,i,o){c(this,"file",e);c(this,"title",t);c(this,"time",n);c(this,"rowNumber",i);c(this,"done",o);c(this,"muteNotification",!1);c(this,"beingDisplayed",!1)}key(){return this.file+this.title+this.time.toString()}isExpired(e,t){return this.time.getTimeInMillis(t)<=e}equals(e){return this.rowNumber===e.rowNumber&&this.title===e.title&&this.time.equals(e.time)&&this.file===e.file}getFileName(){return r.extractFileName(this.file)}static extractFileName(e){let t=e.split(/[/\\]/);return t[t.length-1].replace(/^(.*?)(\..+)?$/,"$1")}},Rs=class{constructor(e){c(this,"onChange",e);c(this,"fileToReminders",new Map);c(this,"reminders",[]);c(this,"reminderTime")}getExpiredReminders(e){let t=new Date().getTime(),n=[];for(let i=0;i<this.reminders.length;i++){let o=this.reminders[i];if(o.isExpired(t,e))n.push(o);else break}return n}muteExpiredReminders(e){let t=0;for(let n of this.getExpiredReminders(e))n.muteNotification||(n.muteNotification=!0,t++);return t}byDate(e){return this.reminders.filter(t=>t.time.toYYYYMMDD()===e.toYYYYMMDD())}removeReminder(e){console.debug("Remove reminder: %o",e),this.reminders.remove(e);let t=this.fileToReminders.get(e.file);t&&(t.remove(e),t.length===0&&this.fileToReminders.delete(e.file)),this.onChange()}clear(){this.fileToReminders.clear(),this.reminders=[],this.onChange()}removeByFile(e){return this.fileToReminders.delete(e)?(this.sortReminders(),!0):!1}replaceFile(e,t){let n=this.fileToReminders.get(e);if(n){if(this.equals(n,t))return!1;let i=new Map;for(let o of n)i.set(o.key(),o.muteNotification);for(let o of t){let s=i.get(o.key());i.set(o.key(),o.muteNotification),s!==void 0&&(o.muteNotification=s)}}return this.fileToReminders.set(e,t),this.sortReminders(),!0}equals(e,t){if(e.length!==t.length)return!1;let n=[...e],i=[...t];return this.sort(n),this.sort(i),n.every((o,s)=>o.equals(i[s]))}sortReminders(){let e=[];for(let t of this.fileToReminders.values())e.push(...t);this.sort(e),this.reminders=e,this.onChange()}sort(e){e.sort((t,n)=>{var o,s;let i=t.time.getTimeInMillis((o=this.reminderTime)==null?void 0:o.value)-n.time.getTimeInMillis((s=this.reminderTime)==null?void 0:s.value);return i>0?1:i<0?-1:0})}},Pu=[{name:"US Style (12h)",format:{yearMonthFormat:"MMMM YYYY",monthDayFormat:"MM/DD",shortDateWithWeekdayFormat:"M/DD (ddd)",timeFormat:"h:mm A"}},{name:"US Style (24h)",format:{yearMonthFormat:"MMMM YYYY",monthDayFormat:"MM/DD",shortDateWithWeekdayFormat:"M/DD (ddd)",timeFormat:"HH:mm"}},{name:"EU Style (24h)",format:{yearMonthFormat:"MMMM YYYY",monthDayFormat:"DD/MM",shortDateWithWeekdayFormat:"D/MM (ddd)",timeFormat:"HH:mm"}},{name:"EU Style (12h)",format:{yearMonthFormat:"MMMM YYYY",monthDayFormat:"DD/MM",shortDateWithWeekdayFormat:"D/MM (ddd)",timeFormat:"h:mm A"}},{name:"JP Style (24h)",format:{yearMonthFormat:"YYYY\u5E74MM\u6708",monthDayFormat:"MM/DD",shortDateWithWeekdayFormat:"M\u6708D\u65E5 (ddd)",timeFormat:"HH:mm"}},{name:"JP Style (12h)",format:{yearMonthFormat:"YYYY\u5E74MM\u6708",monthDayFormat:"MM/DD",shortDateWithWeekdayFormat:"M\u6708D\u65E5 (ddd)",timeFormat:"h:mm A"}}];function $u(r,e,t,n){let i=G.duration(e,r,"days",t);if(i>30)return new yn(r.format(n.yearMonthFormat,t),o=>o.format(n.monthDayFormat,t));if(i>=7)return new yn("Over 1 week",o=>o.format(n.monthDayFormat,t));if(r.toYYYYMMDD(t)===e.toYYYYMMDD(t)){let o=new yn("Today",s=>s.format(n.timeFormat,t));return o.isToday=!0,o}return r.toYYYYMMDD(t)===e.add(1,"days",t).toYYYYMMDD()?new yn("Tomorrow",o=>o.format(n.timeFormat,t)):new yn(r.format(n.shortDateWithWeekdayFormat,t),o=>o.format(n.timeFormat,t))}var yn=class{constructor(e,t){c(this,"name",e);c(this,"timeToStringFunc",t);c(this,"isToday",!1);c(this,"isOverdue",!1)}timeToString(e){return this.timeToStringFunc(e)}};function Hu(r,e,t){let n=G.now(),i=n.getTimeInMillis(),o=[],s=[],a=[],l=$u(n,n,e,t);for(let u=0;u<r.length;u++){let d=r[u];if(d.muteNotification||d.isExpired(i,e)){a.push(d);continue}let p=$u(d.time,n,e,t);p.name!==l.name&&((s.length>0||l.isToday)&&o.push(new Io(l,s)),s=[]),s.push(d),l=p}if(s.length>0&&o.push(new Io(l,s)),a.length>0){let u=new yn("Overdue",d=>d.toYYYYMMDD(e)===n.toYYYYMMDD(e)?d.format(t.timeFormat,e):d.format(t.monthDayFormat,e));u.isOverdue=!0,o.splice(0,0,new Io(u,a))}return o}var Io=class{constructor(e,t){c(this,"group",e);c(this,"reminders",t)}get name(){return this.group.name}get isOverdue(){return this.group.isOverdue}timeToString(e){return this.group.timeToString(e)}};var pt=class pt{constructor(e,t){c(this,"key",e);c(this,"defaultValue",t)}};c(pt,"now",new pt("now",G.now())),c(pt,"useCustomEmojiForTasksPlugin",new pt("useCustomEmojiForTasksPlugin",!1)),c(pt,"removeTagsForTasksPlugin",new pt("removeTagsForTasksPlugin",!1)),c(pt,"useReminderTimeFallbackForTasksPlugin",new pt("useReminderTimeFallbackForTasksPlugin",!1)),c(pt,"dataviewReminderFieldName",new pt("dataviewReminderFieldName","reminder")),c(pt,"linkDatesToDailyNotes",new pt("linkDatesToDailyNotes",!1)),c(pt,"strictDateFormat",new pt("strictDateFormat",!1));var _e=pt,_o=class{constructor(){c(this,"parameters",new Map)}setParameter(e,t){this.parameters.set(e.key,()=>t.value)}setParameterFunc(e,t){this.parameters.set(e.key,t)}setParameterValue(e,t){this.parameters.set(e.key,()=>t)}getParameter(e){let t=this.parameters.get(e.key);return t==null?e.defaultValue:t()}},In=class{constructor(){c(this,"config",new _o)}setConfig(e){this.config=e}parse(e){return e.getTodos().map(t=>{let n=this.parseValidReminder(t);if(n==null)return null;let i=n.getTitle();if(i==null)return null;let o=n.getTime();if(o==null)return null;let s=new fi(e.file,i,o,t.lineIndex,this.isDone(t,n)),a=n.computeSpan(),l=t.getHeaderLength();return{reminder:s,columnStart:a.start+l,columnEnd:a.end+l}}).filter(t=>t!=null)}async modify(e,t,n){let i=e.getTodo(t.rowNumber);if(i===null)return console.warn("Not a todo: reminder=%o",t),!1;let o=this.parseValidReminder(i);return o===null||!this.modifyReminder(e,i,o,n)?!1:(i.body=o.toMarkdown(),!0)}parseValidReminder(e){let t=this.parseReminder(e);return t===null||!this.isValidReminder(t)?null:t}isDone(e,t){return e.isChecked()}isValidReminder(e){return e.getTime()!==null}modifyReminder(e,t,n,i){if(i.rawTime!==void 0){if(!n.setRawTime(i.rawTime))return console.warn("The reminder doesn't support raw time: parsed=%o",n),!1}else i.time!==void 0&&n.setTime(i.time);return i.checked!==void 0&&t.setChecked(i.checked),!0}appendReminder(e,t,n){let i=di.parse(0,e);if(i==null)return null;let o=this.parseReminder(i),s=i.getHeaderLength();return n!=null&&(n-=s),o!=null?o.setTime(t,n):(o=this.newReminder(i.body,t,n),o.setTime(t)),i.body=o.toMarkdown(),{insertedLine:i.toMarkdown(),caretPosition:s+o.getEndOfTimeTextIndex()}}isStrictDateFormat(){return this.config.getParameter(_e.strictDateFormat)}},ks=class{constructor(){c(this,"config");c(this,"formats",[])}setConfig(e){this.config=e,this.syncConfig()}parse(e){let t=[];for(let n of this.formats){let i=n.parse(e);i!=null&&t.push(...i)}return t}async modify(e,t,n){for(let i of this.formats)if(await i.modify(e,t,n))return!0;return!1}resetFormat(e){this.formats=e,this.syncConfig()}syncConfig(){this.config!=null&&this.formats.forEach(e=>e.setConfig(this.config))}appendReminder(e,t){return this.formats[0]==null?null:this.formats[0].appendReminder(e,t)}};var Ju="(?<open>[[(])(?<pre>\\s*)(?<key>[\\p{L}\\p{N}_-]+)::(?<mid>\\s*)(?<value>[^[\\]()]*?)(?<post>\\s*)(?<close>[)\\]])";function Qp(r,e){return r==="["&&e==="]"?"bracket":r==="("&&e===")"?"paren":null}function ju(r){let e=new RegExp(Ju,"gu"),t=[],n;for(;(n=e.exec(r))!==null;){let i=n.groups,o=Qp(i.open,i.close);o!=null&&t.push({key:i.key,value:i.value,style:o,start:n.index,end:n.index+n[0].length})}return t}function zu(r,e,t){let n=r.slice(e.start,e.end),o=new RegExp(`^${Ju}$`,"u").exec(n);if(o==null)return r;let s=o.groups,a=s.open.length+s.pre.length+s.key.length+2+s.mid.length,l=s.value.length,u=n.slice(0,a)+t+n.slice(a+l);return r.slice(0,e.start)+u+r.slice(e.end)}function Ku(r,e,t,n="bracket"){let[i,o]=n==="bracket"?["[","]"]:["(",")"],s=`${i}${e}:: ${t}${o}`;if(r.length===0)return s;let a=/\s$/.test(r)?"":" ";return`${r}${a}${s}`}function wl(r,e){let t=e.start,n=e.end;return t>0&&r[t-1]===" "?t-=1:n<r.length&&r[n]===" "&&(n+=1),r.slice(0,t)+r.slice(n)}var Co=["MO","TU","WE","TH","FR","SA","SU"],Ne=(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(Co.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=Co[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 be=function(r){return r!=null},Ut=function(r){return typeof r=="number"},Al=function(r){return typeof r=="string"&&Co.includes(r)},rt=Array.isArray,nr=function(r,e){e===void 0&&(e=r),arguments.length===1&&(e=r,r=0);for(var t=[],n=r;n<e;n++)t.push(n);return t};var ee=function(r,e){var t=0,n=[];if(rt(r))for(;t<e;t++)n[t]=[].concat(r);else for(;t<e;t++)n[t]=r;return n},qu=function(r){return rt(r)?r:[r]};function Un(r,e,t){t===void 0&&(t=" ");var n=String(r);return e=e>>0,n.length>e?String(n):(e=e-n.length,e>t.length&&(t+=ee(t,e/t.length)),t.slice(0,e)+String(n))}var ed=function(r,e,t){var n=r.split(e);return t?n.slice(0,t).concat([n.slice(t).join(e)]):n},ht=function(r,e){var t=r%e;return t*e<0?t+e:t},Fs=function(r,e){return{div:Math.floor(r/e),mod:ht(r,e)}},Qt=function(r){return!be(r)||r.length===0},Fe=function(r){return!Qt(r)},re=function(r,e){return Fe(r)&&r.indexOf(e)!==-1};var wr=function(r,e,t,n,i,o){return n===void 0&&(n=0),i===void 0&&(i=0),o===void 0&&(o=0),new Date(Date.UTC(r,e-1,t,n,i,o))},Wp=[31,28,31,30,31,30,31,31,30,31,30,31],rd=1e3*60*60*24,Ss=9999,nd=wr(1970,1,1),Vp=[6,0,1,2,3,4,5];var mi=function(r){return r%4===0&&r%100!==0||r%400===0},Rl=function(r){return r instanceof Date},Qn=function(r){return Rl(r)&&!isNaN(r.getTime())};var Yp=function(r,e){var t=r.getTime(),n=e.getTime(),i=t-n;return Math.round(i/rd)},xo=function(r){return Yp(r,nd)},Es=function(r){return new Date(nd.getTime()+r*rd)},Lp=function(r){var e=r.getUTCMonth();return e===1&&mi(r.getUTCFullYear())?29:Wp[e]},Mr=function(r){return Vp[r.getUTCDay()]},kl=function(r,e){var t=wr(r,e+1,1);return[Mr(t),Lp(t)]},Ts=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()))},Gs=function(r){var e=new Date(r.getTime());return e},Fl=function(r){for(var e=[],t=0;t<r.length;t++)e.push(Gs(r[t]));return e},Or=function(r){r.sort(function(e,t){return e.getTime()-t.getTime()})},pi=function(r,e){e===void 0&&(e=!0);var t=new Date(r);return[Un(t.getUTCFullYear().toString(),4,"0"),Un(t.getUTCMonth()+1,2,"0"),Un(t.getUTCDate(),2,"0"),"T",Un(t.getUTCHours(),2,"0"),Un(t.getUTCMinutes(),2,"0"),Un(t.getUTCSeconds(),2,"0"),e?"Z":""].join("")},wo=function(r){var e=/^(\d{4})(\d{2})(\d{2})(T(\d{2})(\d{2})(\d{2})Z?)?$/,t=e.exec(r);if(!t)throw new Error("Invalid UNTIL value: ".concat(r));return new Date(Date.UTC(parseInt(t[1],10),parseInt(t[2],10)-1,parseInt(t[3],10),parseInt(t[5],10)||0,parseInt(t[6],10)||0,parseInt(t[7],10)||0))},td=function(r,e){var t=r.toLocaleString("sv-SE",{timeZone:e});return t.replace(" ","T")+"Z"},id=function(r,e){var t=Intl.DateTimeFormat().resolvedOptions().timeZone,n=new Date(td(r,t)),i=new Date(td(r,e!=null?e:"UTC")),o=i.getTime()-n.getTime();return new Date(r.getTime()-o)};var Mp=(function(){function r(e,t){this.minDate=null,this.maxDate=null,this._result=[],this.total=0,this.method=e,this.args=t,e==="between"?(this.maxDate=t.inc?t.before:new Date(t.before.getTime()-1),this.minDate=t.inc?t.after:new Date(t.after.getTime()+1)):e==="before"?this.maxDate=t.inc?t.dt:new Date(t.dt.getTime()-1):e==="after"&&(this.minDate=t.inc?t.dt:new Date(t.dt.getTime()+1))}return r.prototype.accept=function(e){++this.total;var t=this.minDate&&e<this.minDate,n=this.maxDate&&e>this.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;default:return e.length?e[e.length-1]:null}},r.prototype.clone=function(){return new r(this.method,this.args)},r})(),$r=Mp;var Sl=function(r,e){return Sl=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])},Sl(r,e)};function hi(r,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");Sl(r,e);function t(){this.constructor=r}r.prototype=e===null?Object.create(e):(t.prototype=e.prototype,new t)}var nt=function(){return nt=Object.assign||function(e){for(var t,n=1,i=arguments.length;n<i;n++){t=arguments[n];for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o])}return e},nt.apply(this,arguments)};function A(r,e,t){if(t||arguments.length===2)for(var n=0,i=e.length,o;n<i;n++)(o||!(n in e))&&(o||(o=Array.prototype.slice.call(e,0,n)),o[n]=e[n]);return r.concat(o||Array.prototype.slice.call(e))}var Op=(function(r){hi(e,r);function e(t,n,i){var o=r.call(this,t,n)||this;return o.iterator=i,o}return e.prototype.add=function(t){return this.iterator(t,this._result.length)?(this._result.push(t),!0):!1},e})($r),El=Op;var $p={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}},Wn=$p;var od=function(r,e){return r.indexOf(e)!==-1},Pp=function(r){return r.toString()},Hp=function(r,e,t){return"".concat(e," ").concat(t,", ").concat(r)},Jp=(function(){function r(e,t,n,i){if(t===void 0&&(t=Pp),n===void 0&&(n=Wn),i===void 0&&(i=Hp),this.text=[],this.language=n||Wn,this.gettext=t,this.dateFormatter=i,this.rrule=e,this.options=e.options,this.origOptions=e.origOptions,this.origOptions.bymonthday){var o=[].concat(this.options.bymonthday),s=[].concat(this.options.bynmonthday);o.sort(function(d,p){return d-p}),s.sort(function(d,p){return p-d}),this.bymonthday=o.concat(s),this.bymonthday.length||(this.bymonthday=null)}if(be(this.origOptions.byweekday)){var a=rt(this.origOptions.byweekday)?this.origOptions.byweekday:[this.origOptions.byweekday],l=String(a);this.byweekday={allWeeks:a.filter(function(d){return!d.n}),someWeeks:a.filter(function(d){return!!d.n}),isWeekdays:l.indexOf("MO")!==-1&&l.indexOf("TU")!==-1&&l.indexOf("WE")!==-1&&l.indexOf("TH")!==-1&&l.indexOf("FR")!==-1&&l.indexOf("SA")===-1&&l.indexOf("SU")===-1,isEveryDay:l.indexOf("MO")!==-1&&l.indexOf("TU")!==-1&&l.indexOf("WE")!==-1&&l.indexOf("TH")!==-1&&l.indexOf("FR")!==-1&&l.indexOf("SA")!==-1&&l.indexOf("SU")!==-1};var u=function(d,p){return d.weekday-p.weekday};this.byweekday.allWeeks.sort(u),this.byweekday.someWeeks.sort(u),this.byweekday.allWeeks.length||(this.byweekday.allWeeks=null),this.byweekday.someWeeks.length||(this.byweekday.someWeeks=null)}else this.byweekday=null}return r.isFullyConvertible=function(e){var t=!0;if(!(e.options.freq in r.IMPLEMENTED)||e.origOptions.until&&e.origOptions.count)return!1;for(var n in e.origOptions){if(od(["dtstart","tzid","wkst","freq"],n))return!0;if(!od(r.IMPLEMENTED[e.options.freq],n))return!1}return t},r.prototype.isFullyConvertible=function(){return r.isFullyConvertible(this.rrule)},r.prototype.toString=function(){var e=this.gettext;if(!(this.options.freq in r.IMPLEMENTED))return e("RRule error: Unable to fully convert this rrule to text");if(this.text=[e("every")],this[F.FREQUENCIES[this.options.freq]](),this.options.until){this.add(e("until"));var t=this.options.until;this.add(this.dateFormatter(t.getUTCFullYear(),this.language.monthNames[t.getUTCMonth()],t.getUTCDate()))}else this.options.count&&this.add(e("for")).add(this.options.count.toString()).add(this.plural(this.options.count)?e("times"):e("time"));return this.isFullyConvertible()||this.add(e("(~ approximate)")),this.text.join("")},r.prototype.HOURLY=function(){var e=this.gettext;this.options.interval!==1&&this.add(this.options.interval.toString()),this.add(this.plural(this.options.interval)?e("hours"):e("hour"))},r.prototype.MINUTELY=function(){var e=this.gettext;this.options.interval!==1&&this.add(this.options.interval.toString()),this.add(this.plural(this.options.interval)?e("minutes"):e("minute"))},r.prototype.DAILY=function(){var e=this.gettext;this.options.interval!==1&&this.add(this.options.interval.toString()),this.byweekday&&this.byweekday.isWeekdays?this.add(this.plural(this.options.interval)?e("weekdays"):e("weekday")):this.add(this.plural(this.options.interval)?e("days"):e("day")),this.origOptions.bymonth&&(this.add(e("in")),this._bymonth()),this.bymonthday?this._bymonthday():this.byweekday?this._byweekday():this.origOptions.byhour&&this._byhour()},r.prototype.WEEKLY=function(){var e=this.gettext;this.options.interval!==1&&this.add(this.options.interval.toString()).add(this.plural(this.options.interval)?e("weeks"):e("week")),this.byweekday&&this.byweekday.isWeekdays?this.options.interval===1?this.add(this.plural(this.options.interval)?e("weekdays"):e("weekday")):this.add(e("on")).add(e("weekdays")):this.byweekday&&this.byweekday.isEveryDay?this.add(this.plural(this.options.interval)?e("days"):e("day")):(this.options.interval===1&&this.add(e("week")),this.origOptions.bymonth&&(this.add(e("in")),this._bymonth()),this.bymonthday?this._bymonthday():this.byweekday&&this._byweekday(),this.origOptions.byhour&&this._byhour())},r.prototype.MONTHLY=function(){var e=this.gettext;this.origOptions.bymonth?(this.options.interval!==1&&(this.add(this.options.interval.toString()).add(e("months")),this.plural(this.options.interval)&&this.add(e("in"))),this._bymonth()):(this.options.interval!==1&&this.add(this.options.interval.toString()),this.add(this.plural(this.options.interval)?e("months"):e("month"))),this.bymonthday?this._bymonthday():this.byweekday&&this.byweekday.isWeekdays?this.add(e("on")).add(e("weekdays")):this.byweekday&&this._byweekday()},r.prototype.YEARLY=function(){var e=this.gettext;this.origOptions.bymonth?(this.options.interval!==1&&(this.add(this.options.interval.toString()),this.add(e("years"))),this._bymonth()):(this.options.interval!==1&&this.add(this.options.interval.toString()),this.add(this.plural(this.options.interval)?e("years"):e("year"))),this.bymonthday?this._bymonthday():this.byweekday&&this._byweekday(),this.options.byyearday&&this.add(e("on the")).add(this.list(this.options.byyearday,this.nth,e("and"))).add(e("day")),this.options.byweekno&&this.add(e("in")).add(this.plural(this.options.byweekno.length)?e("weeks"):e("week")).add(this.list(this.options.byweekno,void 0,e("and")))},r.prototype._bymonthday=function(){var e=this.gettext;this.byweekday&&this.byweekday.allWeeks?this.add(e("on")).add(this.list(this.byweekday.allWeeks,this.weekdaytext,e("or"))).add(e("the")).add(this.list(this.bymonthday,this.nth,e("or"))):this.add(e("on the")).add(this.list(this.bymonthday,this.nth,e("and")))},r.prototype._byweekday=function(){var e=this.gettext;this.byweekday.allWeeks&&!this.byweekday.isWeekdays&&this.add(e("on")).add(this.list(this.byweekday.allWeeks,this.weekdaytext)),this.byweekday.someWeeks&&(this.byweekday.allWeeks&&this.add(e("and")),this.add(e("on the")).add(this.list(this.byweekday.someWeeks,this.weekdaytext,e("and"))))},r.prototype._byhour=function(){var e=this.gettext;this.add(e("at")).add(this.list(this.origOptions.byhour,void 0,e("and")))},r.prototype._bymonth=function(){this.add(this.list(this.options.bymonth,this.monthtext,this.gettext("and")))},r.prototype.nth=function(e){e=parseInt(e.toString(),10);var t,n=this.gettext;if(e===-1)return n("last");var i=Math.abs(e);switch(i){case 1:case 21:case 31:t=i+n("st");break;case 2:case 22:t=i+n("nd");break;case 3:case 23:t=i+n("rd");break;default:t=i+n("th")}return e<0?t+" "+n("last"):t},r.prototype.monthtext=function(e){return this.language.monthNames[e-1]},r.prototype.weekdaytext=function(e){var t=Ut(e)?(e+1)%7:e.getJsWeekday();return(e.n?this.nth(e.n)+" ":"")+this.language.dayNames[t]},r.prototype.plural=function(e){return e%100!==1},r.prototype.add=function(e){return this.text.push(" "),this.text.push(e),this},r.prototype.list=function(e,t,n,i){var o=this;i===void 0&&(i=","),rt(e)||(e=[e]);var s=function(l,u,d){for(var p="",f=0;f<l.length;f++)f!==0&&(f===l.length-1?p+=" "+d+" ":p+=u+" "),p+=l[f];return p};t=t||function(l){return l.toString()};var a=function(l){return t&&t.call(o,l)};return n?s(e.map(a),i,n):e.map(a).join(i+" ")},r})(),Ar=Jp;var jp=(function(){function r(e){this.done=!0,this.rules=e}return r.prototype.start=function(e){return this.text=e,this.done=!1,this.nextSymbol()},r.prototype.isDone=function(){return this.done&&this.symbol===null},r.prototype.nextSymbol=function(){var e,t;this.symbol=null,this.value=null;do{if(this.done)return!1;var n=void 0;e=null;for(var i in this.rules){n=this.rules[i];var o=n.exec(this.text);o&&(e===null||o[0].length>e[0].length)&&(e=o,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 Ao(r,e){e===void 0&&(e=Wn);var t={},n=new jp(e.tokens);if(!n.start(r))return null;return i(),t;function i(){n.expect("every");var f=n.acceptNumber();if(f&&(t.interval=parseInt(f[0],10)),n.isDone())throw new Error("Unexpected end");switch(n.symbol){case"day(s)":t.freq=F.DAILY,n.nextSymbol()&&(s(),p());break;case"weekday(s)":t.freq=F.WEEKLY,t.byweekday=[F.MO,F.TU,F.WE,F.TH,F.FR],n.nextSymbol(),s(),p();break;case"week(s)":t.freq=F.WEEKLY,n.nextSymbol()&&(o(),s(),p());break;case"hour(s)":t.freq=F.HOURLY,n.nextSymbol()&&(o(),p());break;case"minute(s)":t.freq=F.MINUTELY,n.nextSymbol()&&(o(),p());break;case"month(s)":t.freq=F.MONTHLY,n.nextSymbol()&&(o(),p());break;case"year(s)":t.freq=F.YEARLY,n.nextSymbol()&&(o(),p());break;case"monday":case"tuesday":case"wednesday":case"thursday":case"friday":case"saturday":case"sunday":t.freq=F.WEEKLY;var m=n.symbol.substr(0,2).toUpperCase();if(t.byweekday=[F[m]],!n.nextSymbol())return;for(;n.accept("comma");){if(n.isDone())throw new Error("Unexpected end");var b=l();if(!b)throw new Error("Unexpected symbol "+n.symbol+", expected weekday");t.byweekday.push(F[b]),n.nextSymbol()}s(),d(),p();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=F.YEARLY,t.bymonth=[a()],!n.nextSymbol())return;for(;n.accept("comma");){if(n.isDone())throw new Error("Unexpected end");var g=a();if(!g)throw new Error("Unexpected symbol "+n.symbol+", expected month");t.bymonth.push(g),n.nextSymbol()}o(),p();break;default:throw new Error("Unknown symbol")}}function o(){var f=n.accept("on"),m=n.accept("the");if(f||m)do{var b=u(),g=l(),v=a();if(b)g?(n.nextSymbol(),t.byweekday||(t.byweekday=[]),t.byweekday.push(F[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(F[g]);else if(n.symbol==="weekday(s)")n.nextSymbol(),t.byweekday||(t.byweekday=[F.MO,F.TU,F.WE,F.TH,F.FR]);else if(n.symbol==="week(s)"){n.nextSymbol();var I=n.acceptNumber();if(!I)throw new Error("Unexpected symbol "+n.symbol+", expected week number");for(t.byweekno=[parseInt(I[0],10)];n.accept("comma");){if(I=n.acceptNumber(),!I)throw new Error("Unexpected symbol "+n.symbol+"; expected monthday");t.byweekno.push(parseInt(I[0],10))}}else if(v)n.nextSymbol(),t.bymonth||(t.bymonth=[]),t.bymonth.push(v);else return}while(n.accept("comma")||n.accept("the")||n.accept("on"))}function s(){var f=n.accept("at");if(f)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 a(){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 l(){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 u(){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 f=parseInt(n.value[1],10);if(f<-366||f>366)throw new Error("Nth out of range: "+f);return n.nextSymbol(),n.accept("last")?-f:f;default:return!1}}function d(){n.accept("on"),n.accept("the");var f=u();if(f)for(t.bymonthday=[f],n.nextSymbol();n.accept("comma");){if(f=u(),!f)throw new Error("Unexpected symbol "+n.symbol+"; expected monthday");t.bymonthday.push(f),n.nextSymbol()}}function p(){if(n.symbol==="until"){var f=Date.parse(n.text);if(!f)throw new Error("Cannot parse until date:"+n.text);t.until=new Date(f)}else n.accept("for")&&(t.count=parseInt(n.value[0],10),n.expect("number"))}}var j;(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"})(j||(j={}));function Ro(r){return r<j.HOURLY}var sd=function(r,e){return e===void 0&&(e=Wn),new F(Ao(r,e)||void 0)},gi=["count","until","interval","byweekday","bymonthday","bymonth"];Ar.IMPLEMENTED=[];Ar.IMPLEMENTED[j.HOURLY]=gi;Ar.IMPLEMENTED[j.MINUTELY]=gi;Ar.IMPLEMENTED[j.DAILY]=["byhour"].concat(gi);Ar.IMPLEMENTED[j.WEEKLY]=gi;Ar.IMPLEMENTED[j.MONTHLY]=gi;Ar.IMPLEMENTED[j.YEARLY]=["byweekno","byyearday"].concat(gi);var ad=function(r,e,t,n){return new Ar(r,e,t,n).toString()},ld=Ar.isFullyConvertible;var bi=(function(){function r(e,t,n,i){this.hour=e,this.minute=t,this.second=n,this.millisecond=i||0}return r.prototype.getHours=function(){return this.hour},r.prototype.getMinutes=function(){return this.minute},r.prototype.getSeconds=function(){return this.second},r.prototype.getMilliseconds=function(){return this.millisecond},r.prototype.getTime=function(){return(this.hour*60*60+this.minute*60+this.second)*1e3+this.millisecond},r})();var cd=(function(r){hi(e,r);function e(t,n,i,o,s,a,l){var u=r.call(this,o,s,a,l)||this;return u.year=t,u.month=n,u.day=i,u}return e.fromDate=function(t){return new this(t.getUTCFullYear(),t.getUTCMonth()+1,t.getUTCDate(),t.getUTCHours(),t.getUTCMinutes(),t.getUTCSeconds(),t.valueOf()%1e3)},e.prototype.getWeekday=function(){return Mr(new Date(this.getTime()))},e.prototype.getTime=function(){return new Date(Date.UTC(this.year,this.month-1,this.day,this.hour,this.minute,this.second,this.millisecond)).getTime()},e.prototype.getDay=function(){return this.day},e.prototype.getMonth=function(){return this.month},e.prototype.getYear=function(){return this.year},e.prototype.addYears=function(t){this.year+=t},e.prototype.addMonths=function(t){if(this.month+=t,this.month>12){var n=Math.floor(this.month/12),i=ht(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 o=Fs(this.hour,24),s=o.div,a=o.mod;if(s&&(this.hour=a,this.addDaily(s)),Qt(i)||re(i,this.hour))break}},e.prototype.addMinutes=function(t,n,i,o){for(n&&(this.minute+=Math.floor((1439-(this.hour*60+this.minute))/t)*t);;){this.minute+=t;var s=Fs(this.minute,60),a=s.div,l=s.mod;if(a&&(this.minute=l,this.addHours(a,!1,i)),(Qt(i)||re(i,this.hour))&&(Qt(o)||re(o,this.minute)))break}},e.prototype.addSeconds=function(t,n,i,o,s){for(n&&(this.second+=Math.floor((86399-(this.hour*3600+this.minute*60+this.second))/t)*t);;){this.second+=t;var a=Fs(this.second,60),l=a.div,u=a.mod;if(l&&(this.second=u,this.addMinutes(l,!1,i,o)),(Qt(i)||re(i,this.hour))&&(Qt(o)||re(o,this.minute))&&(Qt(s)||re(s,this.second)))break}},e.prototype.fixDay=function(){if(!(this.day<=28)){var t=kl(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>Ss))return;t=kl(this.year,this.month-1)[1]}}},e.prototype.add=function(t,n){var i=t.freq,o=t.interval,s=t.wkst,a=t.byhour,l=t.byminute,u=t.bysecond;switch(i){case j.YEARLY:return this.addYears(o);case j.MONTHLY:return this.addMonths(o);case j.WEEKLY:return this.addWeekly(o,s);case j.DAILY:return this.addDaily(o);case j.HOURLY:return this.addHours(o,n,a);case j.MINUTELY:return this.addMinutes(o,n,a,l);case j.SECONDLY:return this.addSeconds(o,n,a,l,u)}},e})(bi);function Tl(r){for(var e=[],t=Object.keys(r),n=0,i=t;n<i.length;n++){var o=i[n];re(fd,o)||e.push(o),Rl(r[o])&&!Qn(r[o])&&e.push(o)}if(e.length)throw new Error("Invalid options: "+e.join(", "));return nt({},r)}function ud(r){var e=nt(nt({},ko),Tl(r));if(be(e.byeaster)&&(e.freq=F.YEARLY),!(be(e.freq)&&F.FREQUENCIES[e.freq]))throw new Error("Invalid frequency: ".concat(e.freq," ").concat(r.freq));if(e.dtstart||(e.dtstart=new Date(new Date().setMilliseconds(0))),be(e.wkst)?Ut(e.wkst)||(e.wkst=e.wkst.weekday):e.wkst=F.MO.weekday,be(e.bysetpos)){Ut(e.bysetpos)&&(e.bysetpos=[e.bysetpos]);for(var t=0;t<e.bysetpos.length;t++){var n=e.bysetpos[t];if(n===0||!(n>=-366&&n<=366))throw new Error("bysetpos must be between 1 and 366, or between -366 and -1")}}if(!(e.byweekno||Fe(e.byweekno)||Fe(e.byyearday)||e.bymonthday||Fe(e.bymonthday)||be(e.byweekday)||be(e.byeaster)))switch(e.freq){case F.YEARLY:e.bymonth||(e.bymonth=e.dtstart.getUTCMonth()+1),e.bymonthday=e.dtstart.getUTCDate();break;case F.MONTHLY:e.bymonthday=e.dtstart.getUTCDate();break;case F.WEEKLY:e.byweekday=[Mr(e.dtstart)];break}if(be(e.bymonth)&&!rt(e.bymonth)&&(e.bymonth=[e.bymonth]),be(e.byyearday)&&!rt(e.byyearday)&&Ut(e.byyearday)&&(e.byyearday=[e.byyearday]),!be(e.bymonthday))e.bymonthday=[],e.bynmonthday=[];else if(rt(e.bymonthday)){for(var i=[],o=[],t=0;t<e.bymonthday.length;t++){var n=e.bymonthday[t];n>0?i.push(n):n<0&&o.push(n)}e.bymonthday=i,e.bynmonthday=o}else e.bymonthday<0?(e.bynmonthday=[e.bymonthday],e.bymonthday=[]):(e.bynmonthday=[],e.bymonthday=[e.bymonthday]);if(be(e.byweekno)&&!rt(e.byweekno)&&(e.byweekno=[e.byweekno]),!be(e.byweekday))e.bynweekday=null;else if(Ut(e.byweekday))e.byweekday=[e.byweekday],e.bynweekday=null;else if(Al(e.byweekday))e.byweekday=[Ne.fromStr(e.byweekday).weekday],e.bynweekday=null;else if(e.byweekday instanceof Ne)!e.byweekday.n||e.freq>F.MONTHLY?(e.byweekday=[e.byweekday.weekday],e.bynweekday=null):(e.bynweekday=[[e.byweekday.weekday,e.byweekday.n]],e.byweekday=null);else{for(var s=[],a=[],t=0;t<e.byweekday.length;t++){var l=e.byweekday[t];if(Ut(l)){s.push(l);continue}else if(Al(l)){s.push(Ne.fromStr(l).weekday);continue}!l.n||e.freq>F.MONTHLY?s.push(l.weekday):a.push([l.weekday,l.n])}e.byweekday=Fe(s)?s:null,e.bynweekday=Fe(a)?a:null}return be(e.byhour)?Ut(e.byhour)&&(e.byhour=[e.byhour]):e.byhour=e.freq<F.HOURLY?[e.dtstart.getUTCHours()]:null,be(e.byminute)?Ut(e.byminute)&&(e.byminute=[e.byminute]):e.byminute=e.freq<F.MINUTELY?[e.dtstart.getUTCMinutes()]:null,be(e.bysecond)?Ut(e.bysecond)&&(e.bysecond=[e.bysecond]):e.bysecond=e.freq<F.SECONDLY?[e.dtstart.getUTCSeconds()]:null,{parsedOptions:e}}function dd(r){var e=r.dtstart.getTime()%1e3;if(!Ro(r.freq))return[];var t=[];return r.byhour.forEach(function(n){r.byminute.forEach(function(i){r.bysecond.forEach(function(o){t.push(new bi(n,i,o,e))})})}),t}function So(r){var e=r.split(`
`).map(zp).filter(function(t){return t!==null});return nt(nt({},e[0]),e[1])}function Fo(r){var e={},t=/DTSTART(?:;TZID=([^:=]+?))?(?::|=)([^;\s]+)/i.exec(r);if(!t)return e;var n=t[1],i=t[2];return n&&(e.tzid=n),e.dtstart=wo(i),e}function zp(r){if(r=r.replace(/^\s+|\s+$/,""),!r.length)return null;var e=/^([A-Z]+?)[:;]/.exec(r.toUpperCase());if(!e)return md(r);var t=e[1];switch(t.toUpperCase()){case"RRULE":case"EXRULE":return md(r);case"DTSTART":return Fo(r);default:throw new Error("Unsupported RFC prop ".concat(t," in ").concat(r))}}function md(r){var e=r.replace(/^RRULE:/i,""),t=Fo(e),n=r.replace(/^(?:RRULE|EXRULE):/i,"").split(";");return n.forEach(function(i){var o=i.split("="),s=o[0],a=o[1];switch(s.toUpperCase()){case"FREQ":t.freq=j[a.toUpperCase()];break;case"WKST":t.wkst=ir[a.toUpperCase()];break;case"COUNT":case"INTERVAL":case"BYSETPOS":case"BYMONTH":case"BYMONTHDAY":case"BYYEARDAY":case"BYWEEKNO":case"BYHOUR":case"BYMINUTE":case"BYSECOND":var l=Kp(a),u=s.toLowerCase();t[u]=l;break;case"BYWEEKDAY":case"BYDAY":t.byweekday=qp(a);break;case"DTSTART":case"TZID":var d=Fo(r);t.tzid=d.tzid,t.dtstart=d.dtstart;break;case"UNTIL":t.until=wo(a);break;case"BYEASTER":t.byeaster=Number(a);break;default:throw new Error("Unknown RRULE property '"+s+"'")}}),t}function Kp(r){if(r.indexOf(",")!==-1){var e=r.split(",");return e.map(pd)}return pd(r)}function pd(r){return/^[+-]?\d+$/.test(r)?Number(r):r}function qp(r){var e=r.split(",");return e.map(function(t){if(t.length===2)return ir[t];var n=t.match(/^([+-]?\d{1,2})([A-Z]{2})$/);if(!n||n.length<3)throw new SyntaxError("Invalid weekday string: ".concat(t));var i=Number(n[1]),o=n[2],s=ir[o].weekday;return new Ne(s,i)})}var Vn=(function(){function r(e,t){if(isNaN(e.getTime()))throw new RangeError("Invalid date passed to DateWithZone");this.date=e,this.tzid=t}return Object.defineProperty(r.prototype,"isUTC",{get:function(){return!this.tzid||this.tzid.toUpperCase()==="UTC"},enumerable:!1,configurable:!0}),r.prototype.toString=function(){var e=pi(this.date.getTime(),this.isUTC);return this.isUTC?":".concat(e):";TZID=".concat(this.tzid,":").concat(e)},r.prototype.getTime=function(){return this.date.getTime()},r.prototype.rezonedDate=function(){return this.isUTC?this.date:id(this.date,this.tzid)},r})();function Eo(r){for(var e=[],t="",n=Object.keys(r),i=Object.keys(ko),o=0;o<n.length;o++)if(n[o]!=="tzid"&&re(i,n[o])){var s=n[o].toUpperCase(),a=r[n[o]],l="";if(!(!be(a)||rt(a)&&!a.length)){switch(s){case"FREQ":l=F.FREQUENCIES[r.freq];break;case"WKST":Ut(a)?l=new Ne(a).toString():l=a.toString();break;case"BYWEEKDAY":s="BYDAY",l=qu(a).map(function(m){return m instanceof Ne?m:rt(m)?new Ne(m[0],m[1]):new Ne(m)}).toString();break;case"DTSTART":t=eh(a,r.tzid);break;case"UNTIL":l=pi(a,!r.tzid);break;default:if(rt(a)){for(var u=[],d=0;d<a.length;d++)u[d]=String(a[d]);l=u.toString()}else l=String(a)}l&&e.push([s,l])}}var p=e.map(function(m){var b=m[0],g=m[1];return"".concat(b,"=").concat(g.toString())}).join(";"),f="";return p!==""&&(f="RRULE:".concat(p)),[t,f].filter(function(m){return!!m}).join(`
`)}function eh(r,e){return r?"DTSTART"+new Vn(new Date(r),e).toString():""}function th(r,e){return Array.isArray(r)?!Array.isArray(e)||r.length!==e.length?!1:r.every(function(t,n){return t.getTime()===e[n].getTime()}):r instanceof Date?e instanceof Date&&r.getTime()===e.getTime():r===e}var hd=(function(){function r(){this.all=!1,this.before=[],this.after=[],this.between=[]}return r.prototype._cacheAdd=function(e,t,n){t&&(t=t instanceof Date?Gs(t):Fl(t)),e==="all"?this.all=t:(n._value=t,this[e].push(n))},r.prototype._cacheGet=function(e,t){var n=!1,i=t?Object.keys(t):[],o=function(d){for(var p=0;p<i.length;p++){var f=i[p];if(!th(t[f],d[f]))return!0}return!1},s=this[e];if(e==="all")n=this.all;else if(rt(s))for(var a=0;a<s.length;a++){var l=s[a];if(!(i.length&&o(l))){n=l._value;break}}if(!n&&this.all){for(var u=new $r(e,t),a=0;a<this.all.length&&u.accept(this.all[a]);a++);n=u.getValue(),this._cacheAdd(e,n,t)}return rt(n)?Fl(n):n instanceof Date?Gs(n):n},r})();var gd=A(A(A(A(A(A(A(A(A(A(A(A(A([],ee(1,31),!0),ee(2,28),!0),ee(3,31),!0),ee(4,30),!0),ee(5,31),!0),ee(6,30),!0),ee(7,31),!0),ee(8,31),!0),ee(9,30),!0),ee(10,31),!0),ee(11,30),!0),ee(12,31),!0),ee(1,7),!0),bd=A(A(A(A(A(A(A(A(A(A(A(A(A([],ee(1,31),!0),ee(2,29),!0),ee(3,31),!0),ee(4,30),!0),ee(5,31),!0),ee(6,30),!0),ee(7,31),!0),ee(8,31),!0),ee(9,30),!0),ee(10,31),!0),ee(11,30),!0),ee(12,31),!0),ee(1,7),!0),rh=nr(1,29),nh=nr(1,30),_n=nr(1,31),gt=nr(1,32),vd=A(A(A(A(A(A(A(A(A(A(A(A(A([],gt,!0),nh,!0),gt,!0),_n,!0),gt,!0),_n,!0),gt,!0),gt,!0),_n,!0),gt,!0),_n,!0),gt,!0),gt.slice(0,7),!0),yd=A(A(A(A(A(A(A(A(A(A(A(A(A([],gt,!0),rh,!0),gt,!0),_n,!0),gt,!0),_n,!0),gt,!0),gt,!0),_n,!0),gt,!0),_n,!0),gt,!0),gt.slice(0,7),!0),ih=nr(-28,0),oh=nr(-29,0),Cn=nr(-30,0),bt=nr(-31,0),Id=A(A(A(A(A(A(A(A(A(A(A(A(A([],bt,!0),oh,!0),bt,!0),Cn,!0),bt,!0),Cn,!0),bt,!0),bt,!0),Cn,!0),bt,!0),Cn,!0),bt,!0),bt.slice(0,7),!0),_d=A(A(A(A(A(A(A(A(A(A(A(A(A([],bt,!0),ih,!0),bt,!0),Cn,!0),bt,!0),Cn,!0),bt,!0),bt,!0),Cn,!0),bt,!0),Cn,!0),bt,!0),bt.slice(0,7),!0),Cd=[0,31,60,91,121,152,182,213,244,274,305,335,366],xd=[0,31,59,90,120,151,181,212,243,273,304,334,365],Gl=(function(){for(var r=[],e=0;e<55;e++)r=r.concat(nr(7));return r})();function wd(r,e){var t=wr(r,1,1),n=mi(r)?366:365,i=mi(r+1)?366:365,o=xo(t),s=Mr(t),a=nt(nt({yearlen:n,nextyearlen:i,yearordinal:o,yearweekday:s},sh(r)),{wnomask:null});if(Qt(e.byweekno))return a;a.wnomask=ee(0,n+7);var l,u,d=l=ht(7-s+e.wkst,7);d>=4?(d=0,u=a.yearlen+ht(s-e.wkst,7)):u=n-d;for(var p=Math.floor(u/7),f=ht(u,7),m=Math.floor(p+f/4),b=0;b<e.byweekno.length;b++){var g=e.byweekno[b];if(g<0&&(g+=m+1),g>0&&g<=m){var v=void 0;g>1?(v=d+(g-1)*7,d!==l&&(v-=7-l)):v=d;for(var I=0;I<7&&(a.wnomask[v]=1,v++,a.wdaymask[v]!==e.wkst);I++);}}if(re(e.byweekno,1)){var v=d+m*7;if(d!==l&&(v-=7-l),v<n)for(var b=0;b<7&&(a.wnomask[v]=1,v+=1,a.wdaymask[v]!==e.wkst);b++);}if(d){var w=void 0;if(re(e.byweekno,-1))w=-1;else{var x=Mr(wr(r-1,1,1)),X=ht(7-x.valueOf()+e.wkst,7),K=mi(r-1)?366:365,V=void 0;X>=4?(X=0,V=K+ht(x-e.wkst,7)):V=n-d,w=Math.floor(52+ht(V,7)/4)}if(re(e.byweekno,w))for(var v=0;v<d;v++)a.wnomask[v]=1}return a}function sh(r){var e=mi(r)?366:365,t=wr(r,1,1),n=Mr(t);return e===365?{mmask:gd,mdaymask:yd,nmdaymask:_d,wdaymask:Gl.slice(n),mrange:xd}:{mmask:bd,mdaymask:vd,nmdaymask:Id,wdaymask:Gl.slice(n),mrange:Cd}}function Ad(r,e,t,n,i,o){var s={lastyear:r,lastmonth:e,nwdaymask:[]},a=[];if(o.freq===F.YEARLY)if(Qt(o.bymonth))a=[[0,t]];else for(var l=0;l<o.bymonth.length;l++)e=o.bymonth[l],a.push(n.slice(e-1,e+1));else o.freq===F.MONTHLY&&(a=[n.slice(e-1,e+1)]);if(Qt(a))return s;s.nwdaymask=ee(0,t);for(var l=0;l<a.length;l++)for(var u=a[l],d=u[0],p=u[1]-1,f=0;f<o.bynweekday.length;f++){var m=void 0,b=o.bynweekday[f],g=b[0],v=b[1];v<0?(m=p+(v+1)*7,m-=ht(i[m]-g,7)):(m=d+(v-1)*7,m+=ht(7-i[m]+g,7)),d<=m&&m<=p&&(s.nwdaymask[m]=1)}return s}function Rd(r,e){e===void 0&&(e=0);var t=r%19,n=Math.floor(r/100),i=r%100,o=Math.floor(n/4),s=n%4,a=Math.floor((n+8)/25),l=Math.floor((n-a+1)/3),u=Math.floor(19*t+n-o-l+15)%30,d=Math.floor(i/4),p=i%4,f=Math.floor(32+2*s+2*d-u-p)%7,m=Math.floor((t+11*u+22*f)/451),b=Math.floor((u+f-7*m+114)/31),g=(u+f-7*m+114)%31+1,v=Date.UTC(r,b-1,g+e),I=Date.UTC(r,0,1);return[Math.ceil((v-I)/(1e3*60*60*24))]}var ah=(function(){function r(e){this.options=e}return r.prototype.rebuild=function(e,t){var n=this.options;if(e!==this.lastyear&&(this.yearinfo=wd(e,n)),Fe(n.bynweekday)&&(t!==this.lastmonth||e!==this.lastyear)){var i=this.yearinfo,o=i.yearlen,s=i.mrange,a=i.wdaymask;this.monthinfo=Ad(e,t,o,s,a,n)}be(n.byeaster)&&(this.eastermask=Rd(e,n.byeaster))},Object.defineProperty(r.prototype,"lastyear",{get:function(){return this.monthinfo?this.monthinfo.lastyear:null},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"lastmonth",{get:function(){return this.monthinfo?this.monthinfo.lastmonth:null},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"yearlen",{get:function(){return this.yearinfo.yearlen},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"yearordinal",{get:function(){return this.yearinfo.yearordinal},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"mrange",{get:function(){return this.yearinfo.mrange},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"wdaymask",{get:function(){return this.yearinfo.wdaymask},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"mmask",{get:function(){return this.yearinfo.mmask},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"wnomask",{get:function(){return this.yearinfo.wnomask},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"nwdaymask",{get:function(){return this.monthinfo?this.monthinfo.nwdaymask:[]},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"nextyearlen",{get:function(){return this.yearinfo.nextyearlen},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"mdaymask",{get:function(){return this.yearinfo.mdaymask},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"nmdaymask",{get:function(){return this.yearinfo.nmdaymask},enumerable:!1,configurable:!0}),r.prototype.ydayset=function(){return[nr(this.yearlen),0,this.yearlen]},r.prototype.mdayset=function(e,t){for(var n=this.mrange[t-1],i=this.mrange[t],o=ee(null,this.yearlen),s=n;s<i;s++)o[s]=s;return[o,n,i]},r.prototype.wdayset=function(e,t,n){for(var i=ee(null,this.yearlen+7),o=xo(wr(e,t,n))-this.yearordinal,s=o,a=0;a<7&&(i[o]=o,++o,this.wdaymask[o]!==this.options.wkst);a++);return[i,s,o]},r.prototype.ddayset=function(e,t,n){var i=ee(null,this.yearlen),o=xo(wr(e,t,n))-this.yearordinal;return i[o]=o,[i,o,o+1]},r.prototype.htimeset=function(e,t,n,i){var o=this,s=[];return this.options.byminute.forEach(function(a){s=s.concat(o.mtimeset(e,a,n,i))}),Or(s),s},r.prototype.mtimeset=function(e,t,n,i){var o=this.options.bysecond.map(function(s){return new bi(e,t,s,i)});return Or(o),o},r.prototype.stimeset=function(e,t,n,i){return[new bi(e,t,n,i)]},r.prototype.getdayset=function(e){switch(e){case j.YEARLY:return this.ydayset.bind(this);case j.MONTHLY:return this.mdayset.bind(this);case j.WEEKLY:return this.wdayset.bind(this);case j.DAILY:return this.ddayset.bind(this);default:return this.ddayset.bind(this)}},r.prototype.gettimeset=function(e){switch(e){case j.HOURLY:return this.htimeset.bind(this);case j.MINUTELY:return this.mtimeset.bind(this);case j.SECONDLY:return this.stimeset.bind(this)}},r})(),kd=ah;function Fd(r,e,t,n,i,o){for(var s=[],a=0;a<r.length;a++){var l=void 0,u=void 0,d=r[a];d<0?(l=Math.floor(d/e.length),u=ht(d,e.length)):(l=Math.floor((d-1)/e.length),u=ht(d-1,e.length));for(var p=[],f=t;f<n;f++){var m=o[f];be(m)&&p.push(m)}var b=void 0;l<0?b=p.slice(l)[0]:b=p[l];var g=e[u],v=Es(i.yearordinal+b),I=Ts(v,g);re(s,I)||s.push(I)}return Or(s),s}function Bs(r,e){var t=e.dtstart,n=e.freq,i=e.interval,o=e.until,s=e.bysetpos,a=e.count;if(a===0||i===0)return Pr(r);var l=cd.fromDate(t),u=new kd(e);u.rebuild(l.year,l.month);for(var d=uh(u,l,e);;){var p=u.getdayset(n)(l.year,l.month,l.day),f=p[0],m=p[1],b=p[2],g=ch(f,m,b,u,e);if(Fe(s))for(var v=Fd(s,d,m,b,u,f),I=0;I<v.length;I++){var w=v[I];if(o&&w>o)return Pr(r);if(w>=t){var x=Sd(w,e);if(!r.accept(x)||a&&(--a,!a))return Pr(r)}}else for(var I=m;I<b;I++){var X=f[I];if(be(X))for(var K=Es(u.yearordinal+X),V=0;V<d.length;V++){var le=d[V],w=Ts(K,le);if(o&&w>o)return Pr(r);if(w>=t){var x=Sd(w,e);if(!r.accept(x)||a&&(--a,!a))return Pr(r)}}}if(e.interval===0||(l.add(e,g),l.year>Ss))return Pr(r);Ro(n)||(d=u.gettimeset(n)(l.hour,l.minute,l.second,0)),u.rebuild(l.year,l.month)}}function lh(r,e,t){var n=t.bymonth,i=t.byweekno,o=t.byweekday,s=t.byeaster,a=t.bymonthday,l=t.bynmonthday,u=t.byyearday;return Fe(n)&&!re(n,r.mmask[e])||Fe(i)&&!r.wnomask[e]||Fe(o)&&!re(o,r.wdaymask[e])||Fe(r.nwdaymask)&&!r.nwdaymask[e]||s!==null&&!re(r.eastermask,e)||(Fe(a)||Fe(l))&&!re(a,r.mdaymask[e])&&!re(l,r.nmdaymask[e])||Fe(u)&&(e<r.yearlen&&!re(u,e+1)&&!re(u,-r.yearlen+e)||e>=r.yearlen&&!re(u,e+1-r.yearlen)&&!re(u,-r.nextyearlen+e-r.yearlen))}function Sd(r,e){return new Vn(r,e.tzid).rezonedDate()}function Pr(r){return r.getValue()}function ch(r,e,t,n,i){for(var o=!1,s=e;s<t;s++){var a=r[s];o=lh(n,a,i),o&&(r[a]=null)}return o}function uh(r,e,t){var n=t.freq,i=t.byhour,o=t.byminute,s=t.bysecond;return Ro(n)?dd(t):n>=F.HOURLY&&Fe(i)&&!re(i,e.hour)||n>=F.MINUTELY&&Fe(o)&&!re(o,e.minute)||n>=F.SECONDLY&&Fe(s)&&!re(s,e.second)?[]:r.gettimeset(n)(e.hour,e.minute,e.second,e.millisecond)}var ir={MO:new Ne(0),TU:new Ne(1),WE:new Ne(2),TH:new Ne(3),FR:new Ne(4),SA:new Ne(5),SU:new Ne(6)},ko={freq:j.YEARLY,dtstart:null,interval:1,wkst:ir.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},fd=Object.keys(ko),F=(function(){function r(e,t){e===void 0&&(e={}),t===void 0&&(t=!1),this._cache=t?null:new hd,this.origOptions=Tl(e);var n=ud(e).parsedOptions;this.options=n}return r.parseText=function(e,t){return Ao(e,t)},r.fromText=function(e,t){return sd(e,t)},r.fromString=function(e){return new r(r.parseString(e)||void 0)},r.prototype._iter=function(e){return Bs(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 El("all",{},e));var t=this._cacheGet("all");return t===!1&&(t=this._iter(new $r("all",{})),this._cacheAdd("all",t)),t},r.prototype.between=function(e,t,n,i){if(n===void 0&&(n=!1),!Qn(e)||!Qn(t))throw new Error("Invalid date passed in to RRule.between");var o={before:t,after:e,inc:n};if(i)return this._iter(new El("between",o,i));var s=this._cacheGet("between",o);return s===!1&&(s=this._iter(new $r("between",o)),this._cacheAdd("between",s,o)),s},r.prototype.before=function(e,t){if(t===void 0&&(t=!1),!Qn(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 $r("before",n)),this._cacheAdd("before",i,n)),i},r.prototype.after=function(e,t){if(t===void 0&&(t=!1),!Qn(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 $r("after",n)),this._cacheAdd("after",i,n)),i},r.prototype.count=function(){return this.all().length},r.prototype.toString=function(){return Eo(this.origOptions)},r.prototype.toText=function(e,t,n){return ad(this,e,t,n)},r.prototype.isFullyConvertibleToText=function(){return ld(this)},r.prototype.clone=function(){return new r(this.origOptions)},r.FREQUENCIES=["YEARLY","MONTHLY","WEEKLY","DAILY","HOURLY","MINUTELY","SECONDLY"],r.YEARLY=j.YEARLY,r.MONTHLY=j.MONTHLY,r.WEEKLY=j.WEEKLY,r.DAILY=j.DAILY,r.HOURLY=j.HOURLY,r.MINUTELY=j.MINUTELY,r.SECONDLY=j.SECONDLY,r.MO=ir.MO,r.TU=ir.TU,r.WE=ir.WE,r.TH=ir.TH,r.FR=ir.FR,r.SA=ir.SA,r.SU=ir.SU,r.parseString=So,r.optionsToString=Eo,r})();function Ed(r,e,t,n,i,o){var s={},a=r.accept;function l(f,m){t.forEach(function(b){b.between(f,m,!0).forEach(function(g){s[Number(g)]=!0})})}i.forEach(function(f){var m=new Vn(f,o).rezonedDate();s[Number(m)]=!0}),r.accept=function(f){var m=Number(f);return isNaN(m)?a.call(this,f):!s[m]&&(l(new Date(m-1),new Date(m+1)),!s[m])?(s[m]=!0,a.call(this,f)):!0},r.method==="between"&&(l(r.args.after,r.args.before),r.accept=function(f){var m=Number(f);return s[m]?!0:(s[m]=!0,a.call(this,f))});for(var u=0;u<n.length;u++){var d=new Vn(n[u],o).rezonedDate();if(!r.accept(new Date(d.getTime())))break}e.forEach(function(f){Bs(r,f.options)});var p=r._result;switch(Or(p),r.method){case"all":case"between":return p;case"before":return p.length&&p[p.length-1]||null;default:return p.length&&p[0]||null}}var Td={dtstart:null,cache:!1,unfold:!1,forceset:!1,compatible:!1,tzid:null};function dh(r,e){var t=[],n=[],i=[],o=[],s=Fo(r),a=s.dtstart,l=s.tzid,u=gh(r,e.unfold);return u.forEach(function(d){var p;if(d){var f=hh(d),m=f.name,b=f.parms,g=f.value;switch(m.toUpperCase()){case"RRULE":if(b.length)throw new Error("unsupported RRULE parm: ".concat(b.join(",")));t.push(So(d));break;case"RDATE":var v=(p=/RDATE(?:;TZID=([^:=]+))?/i.exec(d))!==null&&p!==void 0?p:[],I=v[1];I&&!l&&(l=I),n=n.concat(Gd(g,b));break;case"EXRULE":if(b.length)throw new Error("unsupported EXRULE parm: ".concat(b.join(",")));i.push(So(g));break;case"EXDATE":o=o.concat(Gd(g,b));break;case"DTSTART":break;default:throw new Error("unsupported property: "+m)}}}),{dtstart:a,tzid:l,rrulevals:t,rdatevals:n,exrulevals:i,exdatevals:o}}function fh(r,e){var t=dh(r,e),n=t.rrulevals,i=t.rdatevals,o=t.exrulevals,s=t.exdatevals,a=t.dtstart,l=t.tzid,u=e.cache===!1;if(e.compatible&&(e.forceset=!0,e.unfold=!0),e.forceset||n.length>1||i.length||o.length||s.length){var d=new Dl(u);return d.dtstart(a),d.tzid(l||void 0),n.forEach(function(f){d.rrule(new F(Bl(f,a,l),u))}),i.forEach(function(f){d.rdate(f)}),o.forEach(function(f){d.exrule(new F(Bl(f,a,l),u))}),s.forEach(function(f){d.exdate(f)}),e.compatible&&e.dtstart&&d.rdate(a),d}var p=n[0]||{};return new F(Bl(p,p.dtstart||e.dtstart||a,p.tzid||e.tzid||l),u)}function Ds(r,e){return e===void 0&&(e={}),fh(r,mh(e))}function Bl(r,e,t){return nt(nt({},r),{dtstart:e,tzid:t})}function mh(r){var e=[],t=Object.keys(r),n=Object.keys(Td);if(t.forEach(function(i){re(n,i)||e.push(i)}),e.length)throw new Error("Invalid options: "+e.join(", "));return nt(nt({},Td),r)}function ph(r){if(r.indexOf(":")===-1)return{name:"RRULE",value:r};var e=ed(r,":",1),t=e[0],n=e[1];return{name:t,value:n}}function hh(r){var e=ph(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 gh(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;n<t.length;){var i=t[n]=t[n].replace(/\s+$/g,"");i?n>0&&i[0]===" "?(t[n-1]+=i.slice(1),t.splice(n,1)):n+=1:t.splice(n,1)}return t}function bh(r){r.forEach(function(e){if(!/(VALUE=DATE(-TIME)?)|(TZID=)/.test(e))throw new Error("unsupported RDATE/EXDATE parm: "+e)})}function Gd(r,e){return bh(e),r.split(",").map(function(t){return wo(t)})}function Bd(r){var e=this;return function(t){if(t!==void 0&&(e["_".concat(r)]=t),e["_".concat(r)]!==void 0)return e["_".concat(r)];for(var n=0;n<e._rrule.length;n++){var i=e._rrule[n].origOptions[r];if(i)return i}}}var Dl=(function(r){hi(e,r);function e(t){t===void 0&&(t=!1);var n=r.call(this,{},t)||this;return n.dtstart=Bd.apply(n,["dtstart"]),n.tzid=Bd.apply(n,["tzid"]),n._rrule=[],n._rdate=[],n._exrule=[],n._exdate=[],n}return e.prototype._iter=function(t){return Ed(t,this._rrule,this._exrule,this._rdate,this._exdate,this.tzid())},e.prototype.rrule=function(t){Dd(t,this._rrule)},e.prototype.exrule=function(t){Dd(t,this._exrule)},e.prototype.rdate=function(t){Nd(t,this._rdate)},e.prototype.exdate=function(t){Nd(t,this._exdate)},e.prototype.rrules=function(){return this._rrule.map(function(t){return Ds(t.toString())})},e.prototype.exrules=function(){return this._exrule.map(function(t){return Ds(t.toString())})},e.prototype.rdates=function(){return this._rdate.map(function(t){return new Date(t.getTime())})},e.prototype.exdates=function(){return this._exdate.map(function(t){return new Date(t.getTime())})},e.prototype.valueOf=function(){var t=[];return!this._rrule.length&&this._dtstart&&(t=t.concat(Eo({dtstart:this._dtstart}))),this._rrule.forEach(function(n){t=t.concat(n.toString().split(`
`))}),this._exrule.forEach(function(n){t=t.concat(n.toString().split(`
`).map(function(i){return i.replace(/^RRULE:/,"EXRULE:")}).filter(function(i){return!/^DTSTART/.test(i)}))}),this._rdate.length&&t.push(Zd("RDATE",this._rdate,this.tzid())),this._exdate.length&&t.push(Zd("EXDATE",this._exdate,this.tzid())),t},e.prototype.toString=function(){return this.valueOf().join(`
`)},e.prototype.clone=function(){var t=new e(!!this._cache);return this._rrule.forEach(function(n){return t.rrule(n.clone())}),this._exrule.forEach(function(n){return t.exrule(n.clone())}),this._rdate.forEach(function(n){return t.rdate(new Date(n.getTime()))}),this._exdate.forEach(function(n){return t.exdate(new Date(n.getTime()))}),t},e})(F);function Dd(r,e){if(!(r instanceof F))throw new TypeError(String(r)+" is not RRule instance");re(e.map(String),String(r))||e.push(r)}function Nd(r,e){if(!(r instanceof Date))throw new TypeError(String(r)+" is not Date instance");re(e.map(Number),Number(r))||(e.push(r),Or(e))}function Zd(r,e,t){var n=!t||t.toUpperCase()==="UTC",i=n?"".concat(r,":"):"".concat(r,";TZID=").concat(t,":"),o=e.map(function(s){return pi(s.valueOf(),n)}).join(",");return"".concat(i).concat(o)}function vi(r,e,t){let n;try{n=F.parseText(r)}catch(u){console.warn("Failed to parse recurrence text: recurrence=%s, error=%o",r,u);return}if(!n)return;e=e.clone();let i=t.moment().clone();i.set("hour",e.get("hour")),i.set("minute",e.get("minute")),i.set("second",e.get("second")),i.set("millisecond",e.get("millisecond")),i.isAfter(e)&&(e=i);let o=e.clone();n.dtstart=e.utc(!0).toDate();let a=new F(n).after(e.toDate(),!1);if(a==null)return;let l=a.getTime()-n.dtstart.getTime();return o.add(l,"millisecond"),o.toDate()}function Ns(r){return r.replace(/#[\p{L}\p{N}\p{M}_/-]+/gu,"").trim()}var yi=class extends In{modifyReminder(e,t,n,i){if(!super.modifyReminder(e,t,n,i))return!1;if(i.checked!==void 0)if(i.checked){let o=n.getRecurrence();if(o!==null){let s=t.clone(),a=n.clone(),l=n.getDueDate(),u=this.config.getParameter(_e.now);if(this.usesSeparateReminderDate(n)){let d=n.getTime();if(d==null)return!1;let p=vi(o,d.moment(),u);if(p==null)return!1;if(a.setTime(new G(P(p),d.hasTimePart)),l!=null){let f=vi(o,l.moment(),u);if(f==null)return!1;a.setDueDate(new G(P(f),l.hasTimePart))}}else{if(l==null)return!1;let d=vi(o,l.moment(),u);if(d==null)return!1;let p=new G(P(d),l.hasTimePart);a.setTime(p)}s.body=a.toMarkdown(),s.setChecked(!1),e.insertTodo(t.lineIndex,s)}n.setDoneDate(this.config.getParameter(_e.now))}else n.setDoneDate(void 0);return!0}};var vh=["YYYY-MM-DDTHH:mm","YYYY-MM-DD HH:mm"],Zl="YYYY-MM-DD";function Nl(r){for(let t of vh){let n=P(r,t,!0);if(n.isValid())return new G(n,!0)}let e=P(r,Zl,!0);return e.isValid()?new G(e,!1):null}function Xd(r){return r.hasTimePart?r.format("YYYY-MM-DDTHH:mm"):r.format(Zl)}var Yn="due",Zs="completion",Ud="repeat",yh="scheduled",Ih="start",_h=[Yn,Zs,Ud,yh,Ih],Xs=class r{constructor(e,t,n){c(this,"text",e);c(this,"reminderFieldName",t);c(this,"removeTags",n)}static parse(e,t,n){return new r(e,t.toLowerCase(),n!=null?n:!1)}fields(){return ju(this.text)}fieldsByKey(e){return this.fields().filter(t=>t.key.toLowerCase()===e)}firstField(e){var t;return(t=this.fieldsByKey(e)[0])!=null?t:null}hasReminderField(){return this.firstField(this.reminderFieldName)!=null}hasAnySourceField(){return this.hasReminderField()||this.firstField(Yn)!=null}reminderSourceField(){var e;return(e=this.firstField(this.reminderFieldName))!=null?e:this.firstField(Yn)}getTitle(){let e=new Set([..._h,this.reminderFieldName]),t=this.fields().filter(i=>e.has(i.key.toLowerCase())).sort((i,o)=>o.start-i.start),n=this.text;for(let i of t)n=wl(n,i);return n=n.trim(),this.removeTags&&(n=Ns(n)),n}getTime(){let e=this.reminderSourceField();return e==null?null:Nl(e.value)}setTime(e){var i;let t=this.reminderSourceField(),n=(i=t==null?void 0:t.key)!=null?i:Yn;this.setFieldValue(n,Xd(e))}setRawTime(e){var i;let t=this.reminderSourceField(),n=(i=t==null?void 0:t.key)!=null?i:Yn;return this.setFieldValue(n,e),!0}getDueDate(){let e=this.firstField(Yn);return e==null?null:Nl(e.value)}setDueDate(e){this.setFieldValue(Yn,Xd(e))}getRecurrence(){var t;let e=this.firstField(Ud);return(t=e==null?void 0:e.value)!=null?t:null}getDoneDate(){let e=this.firstField(Zs);return e==null?null:Nl(e.value)}setDoneDate(e){if(e==null){this.removeFieldByKey(Zs);return}let t=e instanceof G?e.format(Zl):e;this.setFieldValue(Zs,t)}getEndOfTimeTextIndex(){let e=this.reminderSourceField();return e!=null?e.end:this.toMarkdown().length}computeSpan(){let e=this.reminderSourceField();return e==null?{start:0,end:0}:{start:e.start,end:e.end}}toMarkdown(){return this.text}clone(){return r.parse(this.toMarkdown(),this.reminderFieldName,this.removeTags)}setFieldValue(e,t){let n=this.firstField(e);n!=null?this.text=zu(this.text,n,t):this.text=Ku(this.text,e,t,"bracket")}removeFieldByKey(e){let t=this.firstField(e);t!=null&&(this.text=wl(this.text,t))}},Qs=class Qs extends yi{parseReminder(e){let t=Xs.parse(e.body,this.reminderFieldName(),this.removeTagsEnabled());return t.hasAnySourceField()?t:null}reminderFieldName(){return this.config.getParameter(_e.dataviewReminderFieldName)}removeTagsEnabled(){return this.config.getParameter(_e.removeTagsForTasksPlugin)}usesSeparateReminderDate(e){return e.hasReminderField()}newReminder(e,t){let n=Xs.parse(e,this.reminderFieldName(),this.removeTagsEnabled());return n.setTime(t),n}};c(Qs,"instance",new Qs);var Us=Qs;var Rr=class Rr{constructor(e,t,n,i,o=null){c(this,"linkDatesToDailyNotes",e);c(this,"title1",t);c(this,"time",n);c(this,"title2",i);c(this,"recurrence",o)}static parse(e,t){t==null&&(t=!1);let n=Rr.regexp.exec(e);if(n==null)return null;let i=n.groups.title1,o=n.groups.time;if(o==null)return null;let s=n.groups.title2;t&&(o=o.replace("[[",""),o=o.replace("]]",""));let a=null,l=o.indexOf(Rr.recurrenceSymbol);if(l>=0){let u=o.substring(0,l).trim(),d=o.substring(l+Rr.recurrenceSymbol.length).trim();d!==""&&(o=u,a=d)}return new Rr(t,i,o,s,a)}getTitle(){return`${this.title1.trim()} ${this.title2.trim()}`.trim()}getTime(){return xr.parse(this.time)}setTime(e){this.time=xr.toString(e)}setRawTime(e){return this.time=e,!0}getEndOfTimeTextIndex(){return this.toMarkdown().length-this.title2.length}computeSpan(){let e=this.title1.length,t=this.computeGroupText();return{start:e,end:e+t.length}}toMarkdown(){return`${this.title1}${this.computeGroupText()}${this.title2}`}computeGroupText(){let e=this.recurrence!==null?`${this.time} ${Rr.recurrenceSymbol}${this.recurrence}`:this.time;return`(@${this.renderTimeText(e)})`}renderTimeText(e){if(!this.linkDatesToDailyNotes)return e;let t=xr.parse(this.time);if(!t)return e;let n=xr.toString(t.clone(!1));return e.replace(n,`[[${n}]]`)}clone(){return Rr.parse(this.toMarkdown(),this.linkDatesToDailyNotes)}};c(Rr,"regexp",/^(?<title1>.*?)\(@(?<time>.+?)\)(?<title2>.*)$/),c(Rr,"recurrenceSymbol","\u{1F501}");var Ws=Rr,Vs=class Vs extends In{parseReminder(e){return Ws.parse(e.body,this.linkDatesToDailyNotes())}modifyReminder(e,t,n,i){if(!super.modifyReminder(e,t,n,i))return!1;if(i.checked===!0){let o=n.recurrence;if(o!==null){let s=n.getTime();if(s!==null){let a=vi(o,s.moment(),this.config.getParameter(_e.now));if(a!==void 0){let l=n.clone();l.setTime(new G(P(a),s.hasTimePart));let u=t.clone();u.body=l.toMarkdown(),u.setChecked(!1),e.insertTodo(t.lineIndex,u)}}}}return!0}newReminder(e,t,n){let i,o;return n!=null?(i=e.substring(0,n),o=e.substring(n)):(i=e,o=""),new Ws(this.linkDatesToDailyNotes(),i,t.toString(),o)}linkDatesToDailyNotes(){return this.config.getParameter(_e.linkDatesToDailyNotes)}};c(Vs,"instance",new Vs);var Ii=Vs;function Ys(r){return r.replace(/[\\^$.*+?()[\]{}|]/g,"\\$&")}var Ch=new class{get dateTrigger(){return this.get("date-trigger","@")}get dateFormat(){return this.get("date-format","YYYY-MM-DD")}get timeTrigger(){return this.get("time-trigger","@@")}get timeFormat(){return this.get("time-format","HH:mm")}get linkDateToDailyNote(){return this.get("link-date-to-daily-note",!1)}get(e,t){var a,l;if(!window)return t;let n=(l=(a=window.app)==null?void 0:a.plugins)==null?void 0:l.plugins;if(!n)return t;let i=n["obsidian-kanban"];if(!i)return t;let o=i.settings;if(!o)return t;let s=o[e];return s==null?t:s}},Os=class Os{constructor(e){c(this,"setting",e)}get dateRegExp(){return this.setting.linkDateToDailyNote?new RegExp(`${Ys(this.setting.dateTrigger)}\\[\\[(?<date>.+?)\\]\\]`):new RegExp(`${Ys(this.setting.dateTrigger)}\\{(?<date>.+?)\\}`)}get timeRegExp(){return new RegExp(`${Ys(this.setting.timeTrigger)}\\{(?<time>.+?)\\}`)}format(e){let t;return this.setting.linkDateToDailyNote?t=`${this.setting.dateTrigger}[[${e.format(this.setting.dateFormat)}]]`:t=`${this.setting.dateTrigger}{${e.format(this.setting.dateFormat)}}`,e.hasTimePart?`${t} ${this.setting.timeTrigger}{${e.format(this.setting.timeFormat)}}`:t}split(e,t){let n=e,i,o,s=this.dateRegExp,a=s.exec(e);if(a)i=a.groups.date,e=e.replace(s,"");else return{title:n};let l=a.index,u=l+a[0].length,d={start:l,end:u},p=this.timeRegExp,f=p.exec(e);if(f){o=f.groups.time,e=e.replace(p,"");let v=f.index>=l?f.index+a[0].length:f.index,I=v+f[0].length;d={start:Math.min(l,v),end:Math.max(u,I)}}let m=e.trim();if(o){let v=[this.setting.timeFormat,...["h:mm A","hh:mm A","HH:mm"].filter(I=>I!==this.setting.timeFormat)];for(let I of v){let w=P(`${i} ${o}`,`${this.setting.dateFormat} ${I}`,!0);if(w.isValid())return{title:m,time:new G(w,!0),span:d}}return{title:n}}let b=t!=null?t:!0,g=new G(P(i,this.setting.dateFormat,b),!1);return g.isValid()?{title:m,time:g,span:d}:{title:n}}};c(Os,"instance",new Os(Ch));var To=Os,Ls=class r{constructor(e,t,n){c(this,"title",e);c(this,"time",t);c(this,"span",n)}static parse(e,t){let n=To.instance.split(e,t);return n.time==null?null:new r(n.title,n.time,n.span)}getTitle(){return this.title.trim()}getTime(){return this.time?this.time:null}setTime(e){this.time=e,this.span=void 0}setRawTime(){return!1}getEndOfTimeTextIndex(){return this.toMarkdown().length}computeSpan(){if(this.span)return this.span;let e=this.title.trim().length+1,t=e+To.instance.format(this.time).length;return{start:e,end:t}}toMarkdown(){return`${this.title.trim()} ${To.instance.format(this.time)}`}},$s=class $s extends In{parseReminder(e){return Ls.parse(e.body,this.isStrictDateFormat())}newReminder(e,t){let n=new Ls(e,t);return n.setTime(t),n}};c($s,"instance",new $s);var Ms=$s;var or=class r{constructor(e,t){c(this,"primary",e);c(this,"func",t)}static ofChar(e){return new r(e,t=>t===e)}static ofChars(e){if(e.length===0)throw new Error("empty symbol");if(e[0]==null)throw new Error("ch mustn't be null");return e.length===0?this.ofChar(e[0]):new r(e[0],t=>e.filter(n=>t===n).length>0)}isSymbol(e){return this.func(e)}},Ps=class{constructor(e){c(this,"tokens",e)}setTokenText(e,t,n=!1,i=!1,o=!1,s){let a=this.getToken(e);if(a===null){if(!i)return null;if(e instanceof or?a={symbol:e.primary,text:t}:a={symbol:e,text:t},o&&a.symbol!==""&&!a.text.startsWith(" ")&&(a.text=" "+a.text),this.tokens.length>0){let l=this.tokens[this.tokens.length-1];this.isTokenEndsWithSpace(l)||(l.text+=" ")}if(s==null)this.tokens.push(a);else{let l=0,u=-1,d=0;for(let p of this.tokens){let f=l+p.symbol.length+p.text.length;if(d>0&&f>s){u=d;break}l=f,d++}u==-1?this.tokens.push(a):(this.tokens.splice(u,0,a),u<this.tokens.length-1&&(a.text=a.text+" "))}return a}return this.replaceTokenText(a,t,n),a}length(){return this.tokens.length}replaceTokenText(e,t,n=!1){if(!n){e.text=t;return}e.text=e.text.replace(/^(\s*).*?(\s*)$/,`$1${t}$2`)}isTokenEndsWithSpace(e){return e.text.match(/^.*\s$/)}getToken(e){for(let t of this.tokens)if(e instanceof or){if(e.isSymbol(t.symbol))return t}else if(e===t.symbol)return t;return null}getTokenText(e,t=!1){let n=this.getToken(e);return n===null?null:t?n.text.replace(/^\s*(.*?)\s*$/,"$1"):n.text}removeToken(e){this.tokens=this.tokens.filter(t=>!e.isSymbol(t.symbol))}forEachTokens(e){this.tokens.forEach(e)}rangeOfSymbol(e){let t=0;for(let n of this.tokens){let i=t+n.symbol.length+n.text.length;if(e.isSymbol(n.symbol))return{start:t,end:i};t=i}}join(){return this.tokens.map(e=>e.symbol+e.text).join("")}};function Qd(r,e){let t=[...r],n="",i=null,o=[],s=()=>{i===null?o.push({symbol:"",text:n}):i.text=n};return t.forEach(a=>{e.filter(u=>u.isSymbol(a)).length>0?(s(),i={symbol:a,text:""},o.push(i),n=""):i!==null&&a==="#"&&(n.length===0||/\s$/.test(n))?(s(),i=null,n=a):n+=a}),n.length>0&&s(),o}var O=class O{constructor(e,t,n,i,o){c(this,"useCustomEmoji",e);c(this,"removeTags",t);c(this,"strictDateFormat",n);c(this,"useDueDateFallback",i);c(this,"tokens",o)}static parse(e,t,n,i,o){return new O(t!=null?t:!1,n!=null?n:!1,i!=null?i:!0,o!=null?o:!1,new Ps(Qd(e,this.allSymbols)))}getTitle(){let e=this.tokens.getTokenText("",!0);return e!=null&&this.removeTags&&(e=Ns(e)),e}getTime(){return this.getDate(this.resolveReminderSymbol())}setTime(e,t){this.useCustomEmoji?this.setDate(this.writeReminderSymbol(),e,1):this.setDate(this.writeReminderSymbol(),e,t)}getDueDate(){return this.getDate(O.symbolDueDate)}setDueDate(e){this.setDate(O.symbolDueDate,e)}setRawTime(e){return this.setDate(this.writeReminderSymbol(),e),!0}resolveReminderSymbol(){if(!this.useCustomEmoji)return O.symbolDueDate;if(!this.useDueDateFallback)return O.symbolReminder;let e=[O.symbolReminder,O.symbolDueDate,O.symbolScheduled,O.symbolStart];for(let t of e)if(this.tokens.getToken(t)!=null)return t;return O.symbolReminder}writeReminderSymbol(){return this.useCustomEmoji?O.symbolReminder:O.symbolDueDate}getEndOfTimeTextIndex(){let e=this.tokens.rangeOfSymbol(this.resolveReminderSymbol());return e!=null?e.end:this.toMarkdown().length}computeSpan(){let e=this.resolveReminderSymbol(),t=this.tokens.rangeOfSymbol(e),n=this.tokens.getToken(e);if(t==null||n==null)return{start:0,end:0};let i=n.text.replace(/\s+$/,"").length;return{start:t.start,end:t.start+n.symbol.length+i}}toMarkdown(){return this.tokens.join()}setTitle(e){this.tokens.setTokenText("",e,!0,!0)}getDoneDate(){return this.getDate(O.symbolDoneDate)}setDoneDate(e){this.setDate(O.symbolDoneDate,e)}getCancelledDate(){return this.getDate(O.symbolCancelledDate)}getRecurrence(){return this.tokens.getTokenText(O.symbolRecurrence,!0)}clone(){return O.parse(this.toMarkdown(),this.useCustomEmoji,this.removeTags,this.strictDateFormat,this.useDueDateFallback)}getDate(e){let t=this.tokens.getTokenText(e,!0);if(t===null)return null;if(e===O.symbolReminder)return xr.parse(t);if(e===O.symbolDueDate){let i=P(t,O.dueDateTimeFormat,!0);if(i.isValid())return new G(i,!0)}let n=P(t,O.dateFormat,this.strictDateFormat);return n.isValid()?new G(n,!1):null}setDate(e,t,n){if(t==null){this.tokens.removeToken(e);return}let i;t instanceof G?e===O.symbolReminder?i=xr.toString(t):e===O.symbolDueDate&&t.hasTimePart?i=t.format(O.dueDateTimeFormat):i=t.format(O.dateFormat):i=t,this.tokens.setTokenText(e,i,!0,!0,this.shouldSplitBetweenSymbolAndText(),n)}shouldSplitBetweenSymbolAndText(){let e=0,t=0;return this.tokens.forEachTokens(n=>{n.symbol!==""&&(n.text.match(/^\s.*$/)?e+=1:t++)}),e>t?!0:!(e<t)}};c(O,"dateFormat","YYYY-MM-DD"),c(O,"dueDateTimeFormat","YYYY-MM-DD HH:mm"),c(O,"symbolDueDate",or.ofChars([..."\u{1F4C5}\u{1F4C6}\u{1F5D3}"])),c(O,"symbolDoneDate",or.ofChar("\u2705")),c(O,"symbolCancelledDate",or.ofChar("\u274C")),c(O,"symbolRecurrence",or.ofChar("\u{1F501}")),c(O,"symbolReminder",or.ofChar("\u23F0")),c(O,"symbolScheduled",or.ofChar("\u23F3")),c(O,"symbolStart",or.ofChar("\u{1F6EB}")),c(O,"allSymbols",[O.symbolDueDate,O.symbolDoneDate,O.symbolCancelledDate,O.symbolRecurrence,O.symbolReminder,O.symbolStart,O.symbolScheduled]);var Hs=O,js=class js extends yi{parseReminder(e){let t=Hs.parse(e.body,this.useCustomEmoji(),this.removeTagsEnabled(),this.isStrictDateFormat(),this.useDueDateFallback());if(this.useCustomEmoji()){if(this.useDueDateFallback()){if(t.getTime()==null)return null}else if(t.getDueDate()==null)return null}return t}isDone(e,t){return super.isDone(e,t)||t.getDoneDate()!=null||t.getCancelledDate()!=null}removeTagsEnabled(){return this.config.getParameter(_e.removeTagsForTasksPlugin)}useCustomEmoji(){return this.config.getParameter(_e.useCustomEmojiForTasksPlugin)}useDueDateFallback(){return this.config.getParameter(_e.useReminderTimeFallbackForTasksPlugin)}usesSeparateReminderDate(){return this.useCustomEmoji()}newReminder(e,t,n){let i=Hs.parse(e,this.useCustomEmoji(),this.removeTagsEnabled(),this.isStrictDateFormat(),this.useDueDateFallback());return i.setTime(t,n),this.useCustomEmoji()&&i.getDueDate()==null&&i.setDueDate(t),i.setTitle(e),i}};c(js,"instance",new js);var Js=js;var _i=new ks;_i.resetFormat([Ii.instance]);var Ci=class{constructor(e,t,n,i,o){c(this,"name",e);c(this,"description",t);c(this,"example",n);c(this,"format",i);c(this,"defaultEnabled",o)}};function xi(r){return _i.parse(r)}async function zs(r,e,t){return _i.modify(r,e,t)}function Wd(r){r.length===0?_i.resetFormat([Ii.instance]):_i.resetFormat(r.map(e=>e.format))}function Vd(r){_i.setConfig(r)}var Xl=new Ci("ReminderPluginReminderFormat","Reminder plugin format","(@2021-09-08)",Ii.instance,!0),Ul=new Ci("TasksPluginReminderFormat","Tasks plugin format","\u{1F4C5} 2021-09-08",Js.instance,!1),Ql=new Ci("KanbanPluginReminderFormat","Kanban plugin format","@{2021-09-08}",Ms.instance,!1),Wl=new Ci("DataviewReminderFormat","Dataview format","[due:: 2021-09-08]",Us.instance,!1),wi=[Xl,Ul,Ql,Wl];var Hr=class{constructor(e,t){c(this,"doc");this.doc=new Lr(e,t)}getReminders(e=!0){let t=xi(this.doc).map(n=>n.reminder);return e?t.filter(n=>!n.done):t}getTodos(){return this.doc.getTodos()}async modifyReminderLines(e){for(let t of this.getReminders(!1)){let n=e(t);if(n===null)return;await this.modifyReminderLine(t,n)}}async updateReminder(e,t){await this.modifyReminderLine(e,t)}async modifyReminderLine(e,t){let n=await zs(this.doc,e,t);return n?console.debug("Reminder was updated: reminder=%o",e):console.warn("Cannot modify reminder because it's not a reminder todo: reminder=%o",e),n}getContent(){return this.doc.toMarkdown()}};var Yd=require("obsidian");var Ks=class extends Yd.FuzzySuggestModal{constructor(t,n,i){super(t);c(this,"suggestions",n);c(this,"onChooseSuggestionFunc",i)}getItems(){return this.suggestions}getItemText(t){return t}onChooseItem(t){this.onChooseSuggestionFunc(t)}};function Ld(r,e){new Ks(r,["YYYY-MM-DD","YYYY/MM/DD","DD-MM-YYYY","DD/MM/YYYY"],t=>{new Ks(r,["YYYY-MM-DD HH:mm","YYYY/MM/DD HH:mm","DD-MM-YYYY HH:mm","DD/MM/YYYY HH:mm","YYYY-MM-DDTHH:mm:ss:SSS"],n=>{e(t,n)}).open()}).open()}async function xh(r,e,t){let n=0,i=r.app.vault;for(let o of i.getMarkdownFiles()){let s=new Hr(o.path,await i.read(o)),a=0;await s.modifyReminderLines(l=>{let u;return l.time.hasTimePart?u=l.time.format(t):u=l.time.format(e),n++,a++,{rawTime:u}}),a>0&&await i.modify(o,s.getContent())}return r.settings.dateFormat.rawValue.value=e,r.settings.dateTimeFormat.rawValue.value=t,n>0&&await r.fileSystem.reloadRemindersInAllFiles(),n}function Md(r,e){return r||Ou("Convert reminder time format","This command rewrite reminder dates in all markdown files. You should make a backup of your vault before you execute this. May I continue to convert?").then(t=>{t===0&&Ld(e.app,(n,i)=>{xh(e,n,i).catch(()=>{})})}),!0}function Od(r,e,t){if(r)return!0;t.showAutoComplete(e)}async function wh(r,e,t){if(!r.fileSystem.isMarkdownFile(e))return;let n=r.app.vault,i=new Hr(e.path,await n.read(e)),o=i.getReminders(!1).find(s=>s.rowNumber===t);if(o)await i.updateReminder(o,{checked:!o.done});else{let s=i.getTodos().find(a=>a.lineIndex===t);if(!s)return;s.setChecked(!s.isChecked())}await n.modify(e,i.getContent())}function $d(r,e,t){if(r)return!0;e&&e.file&&wh(t,e.file,e.editor.getCursor().line)}var Pd=require("obsidian");var qs=class extends Pd.SuggestModal{constructor(t,n){super(t);c(this,"onSelect",n)}getSuggestions(t){return Pu.filter(n=>n.name.toLowerCase().includes(t.toLowerCase()))}renderSuggestion(t,n){let i=n.createDiv({cls:"reminder-preset-suggestion"});i.createDiv({text:t.name,cls:"reminder-preset-title"});let o=G.now(),s=i.createDiv({cls:"reminder-preset-previews"});s.createDiv({cls:"reminder-preset-preview-line",text:"Year/Month: "+o.format(t.format.yearMonthFormat)}),s.createDiv({cls:"reminder-preset-preview-line",text:"Month/Day: "+o.format(t.format.monthDayFormat)}),s.createDiv({cls:"reminder-preset-preview-line",text:"Short: "+o.format(t.format.shortDateWithWeekdayFormat)}),s.createDiv({cls:"reminder-preset-preview-line",text:"Time: "+o.format(t.format.timeFormat)})}onChooseSuggestion(t){this.onSelect(t)}};function Hd(r,e){return r||new qs(e.app,t=>{e.data.settings.monthDayDisplayFormat.rawValue.value=t.format.monthDayFormat,e.data.settings.yearMonthDisplayFormat.rawValue.value=t.format.yearMonthFormat,e.data.settings.shortDateWithWeekdayDisplayFormat.rawValue.value=t.format.shortDateWithWeekdayFormat,e.data.settings.timeDisplayFormat.rawValue.value=t.format.timeFormat,e.data.save(!0),e.ui.invalidate(),e.ui.reload(!0)}).open(),!0}function jd(r){r.addCommand({id:"scan-reminders",name:"Rescan all files",checkCallback:e=>Wu(e,r)}),r.addCommand({id:"show-reminders",name:"Open list view",checkCallback:e=>Vu(e,r.ui)}),r.addCommand({id:"convert-reminder-time-format",name:"Convert time format",checkCallback:e=>Md(e,r)}),r.addCommand({id:"show-date-chooser",name:"Show calendar popup",icon:"calendar-with-checkmark",editorCheckCallback:(e,t)=>Od(e,t,r.ui)}),r.addCommand({id:"toggle-checklist-status",name:"Toggle checklist status",editorCheckCallback:(e,t,n)=>n instanceof Jd.MarkdownView?$d(e,n,r):!1}),r.addCommand({id:"set-date-display-format",name:"Set date display format",checkCallback:e=>Hd(e,r)}),r.addCommand({id:"pause-notifications",name:"Pause notifications",checkCallback:e=>Uu(e,r)}),r.addCommand({id:"resume-notifications",name:"Resume notifications",checkCallback:e=>Qu(e,r)}),r.addCommand({id:"mute-all-reminders",name:"Mute all current notifications",checkCallback:e=>Zu(e,r)})}var zd=require("obsidian");function Kd(r){if(!zd.Platform.isMobile)return;let e=`${r.manifest.dir}/logs.txt`,t=[],n=i=>(...o)=>{t.push(`
[${i}]`);for(let s of o)t.push(String(s));r.app.vault.adapter.write(e,t.join(" "))};console.debug=n("debug"),console.error=n("error"),console.info=n("info"),console.log=n("log"),console.warn=n("warn")}var kr="reminder-list";var Ah=10*1e3,ea=class{constructor(e){c(this,"plugin",e);c(this,"el")}onload(){this.el=this.plugin.addStatusBarItem(),this.el.addClasses(["reminder-status-bar-item","reminder-dnd-status-bar","is-hidden"]),this.el.setAttribute("aria-label","Click to resume reminder notifications"),this.plugin.registerDomEvent(this.el,"click",()=>{Is(this.plugin)}),this.plugin.registerInterval(window.setInterval(()=>this.refresh(),Ah)),this.refresh()}refresh(){if(!this.el)return;let e=this.plugin.data.dndUntil.value;if(!ui(e,G.now())){this.el.addClass("is-hidden");return}this.el.setText(`\u{1F515} Until ${this.formatUntil(e)}`),this.el.removeClass("is-hidden")}formatUntil(e){let t=this.plugin.settings.timeDisplayFormat.value,n=e.format(t);if(e.toYYYYMMDD()===G.now().toYYYYMMDD())return n;let i=this.plugin.settings.monthDayDisplayFormat.value;return`${e.format(i)} ${n}`}};var Rh=10*1e3,ta=class{constructor(e){c(this,"plugin",e);c(this,"el")}onload(){this.el=this.plugin.addStatusBarItem(),this.el.addClasses(["reminder-status-bar-item","reminder-overdue-status-bar","is-hidden"]),this.el.setAttribute("aria-label","Overdue reminders \u2014 click to open the reminder list"),this.plugin.registerDomEvent(this.el,"click",()=>{this.plugin.ui.showReminderList()}),this.plugin.settings.showOverdueCountInStatusBar.rawValue.onChanged(()=>this.refresh()),this.plugin.registerInterval(window.setInterval(()=>this.refresh(),Rh)),this.refresh()}refresh(){if(!this.el)return;if(!this.plugin.settings.showOverdueCountInStatusBar.value){this.el.addClass("is-hidden");return}let e=this.plugin.reminders.getExpiredReminders(this.plugin.settings.reminderTime.value).length;if(e===0){this.el.addClass("is-hidden");return}this.el.setText(`\u23F0 ${e}`),this.el.removeClass("is-hidden")}};var La=require("obsidian");var it=Symbol("$state"),ra=Symbol("component"),Go=Symbol("legacy props"),ef=Symbol(""),na=Symbol("proxy path"),ia=Symbol("attributes"),Bo=Symbol("class"),Vl=Symbol("style"),Do=Symbol("text"),xn=Symbol("form reset"),Yl=Symbol("hmr anchor"),Jr=new class extends Error{constructor(){super(...arguments);c(this,"name","StaleReactionError");c(this,"message","The reaction that called `getAbortSignal()` was re-run or destroyed")}},qd,Ll=!!((qd=globalThis.document)!=null&&qd.contentType)&&globalThis.document.contentType.includes("xml");var Ai=3,sr=8;var rf,nf,tf=(nf=(rf=globalThis.process)==null?void 0:rf.env)==null?void 0:nf.NODE_ENV,_=tf&&!tf.toLowerCase().startsWith("prod");var Wt=Array.isArray,of=Array.prototype.indexOf,jr=Array.prototype.includes,Ri=Array.from,Ml=Object.keys,Ye=Object.defineProperty,Ct=Object.getOwnPropertyDescriptor,oa=Object.getOwnPropertyDescriptors,Ol=Object.prototype,sf=Array.prototype,Ln=Object.getPrototypeOf,$l=Object.isExtensible;var Fr=()=>{};function af(r){return r()}function ki(r){for(var e=0;e<r.length;e++)r[e]()}function sa(){var r,e,t=new Promise((n,i)=>{r=n,e=i});return{promise:t,resolve:r,reject:e}}function aa(r){return r===this.v}function Pl(r,e){return r!=r?e==e:r!==e||r!==null&&typeof r=="object"||typeof r=="function"}function la(r){return!Pl(r,this.v)}function lf(r){if(_){let e=new Error(`invariant_violation
An invariant violation occurred, meaning Svelte's internal assumptions were flawed. This is a bug in Svelte, not your app \u2014 please open an issue at https://github.com/sveltejs/svelte, citing the following message: "${r}"
https://svelte.dev/e/invariant_violation`);throw e.name="Svelte error",e}else throw new Error("https://svelte.dev/e/invariant_violation")}function Fi(r){if(_){let e=new Error(`lifecycle_outside_component
\`${r}(...)\` can only be used during component initialisation
https://svelte.dev/e/lifecycle_outside_component`);throw e.name="Svelte error",e}else throw new Error("https://svelte.dev/e/lifecycle_outside_component")}function uf(){if(_){let r=new Error("async_derived_orphan\nCannot create a `$derived(...)` with an `await` expression outside of an effect tree\nhttps://svelte.dev/e/async_derived_orphan");throw r.name="Svelte error",r}else throw new Error("https://svelte.dev/e/async_derived_orphan")}function Hl(){if(_){let r=new Error("bind_invalid_checkbox_value\nUsing `bind:value` together with a checkbox input is not allowed. Use `bind:checked` instead\nhttps://svelte.dev/e/bind_invalid_checkbox_value");throw r.name="Svelte error",r}else throw new Error("https://svelte.dev/e/bind_invalid_checkbox_value")}function df(){if(_){let r=new Error(`derived_references_self
A derived value cannot reference itself recursively
https://svelte.dev/e/derived_references_self`);throw r.name="Svelte error",r}else throw new Error("https://svelte.dev/e/derived_references_self")}function Jl(r,e,t){if(_){let n=new Error(`each_key_duplicate
${t?`Keyed each block has duplicate key \`${t}\` at indexes ${r} and ${e}`:`Keyed each block has duplicate key at indexes ${r} and ${e}`}
https://svelte.dev/e/each_key_duplicate`);throw n.name="Svelte error",n}else throw new Error("https://svelte.dev/e/each_key_duplicate")}function ff(r,e,t){if(_){let n=new Error(`each_key_volatile
Keyed each block has key that is not idempotent \u2014 the key for item at index ${r} was \`${e}\` but is now \`${t}\`. Keys must be the same each time for a given item
https://svelte.dev/e/each_key_volatile`);throw n.name="Svelte error",n}else throw new Error("https://svelte.dev/e/each_key_volatile")}function mf(r){if(_){let e=new Error(`effect_in_teardown
\`${r}\` cannot be used inside an effect cleanup function
https://svelte.dev/e/effect_in_teardown`);throw e.name="Svelte error",e}else throw new Error("https://svelte.dev/e/effect_in_teardown")}function pf(){if(_){let r=new Error("effect_in_unowned_derived\nEffect cannot be created inside a `$derived` value that was not itself created inside an effect\nhttps://svelte.dev/e/effect_in_unowned_derived");throw r.name="Svelte error",r}else throw new Error("https://svelte.dev/e/effect_in_unowned_derived")}function hf(r){if(_){let e=new Error(`effect_orphan
\`${r}\` can only be used inside an effect (e.g. during component initialisation)
https://svelte.dev/e/effect_orphan`);throw e.name="Svelte error",e}else throw new Error("https://svelte.dev/e/effect_orphan")}function gf(){if(_){let r=new Error(`effect_update_depth_exceeded
Maximum update depth exceeded. This typically indicates that an effect reads and writes the same piece of state
https://svelte.dev/e/effect_update_depth_exceeded`);throw r.name="Svelte error",r}else throw new Error("https://svelte.dev/e/effect_update_depth_exceeded")}function bf(){if(_){let r=new Error(`hydration_failed
Failed to hydrate the application
https://svelte.dev/e/hydration_failed`);throw r.name="Svelte error",r}else throw new Error("https://svelte.dev/e/hydration_failed")}function vf(r){if(_){let e=new Error(`lifecycle_legacy_only
\`${r}(...)\` cannot be used in runes mode
https://svelte.dev/e/lifecycle_legacy_only`);throw e.name="Svelte error",e}else throw new Error("https://svelte.dev/e/lifecycle_legacy_only")}function yf(r){if(_){let e=new Error(`props_invalid_value
Cannot do \`bind:${r}={undefined}\` when \`${r}\` has a fallback value
https://svelte.dev/e/props_invalid_value`);throw e.name="Svelte error",e}else throw new Error("https://svelte.dev/e/props_invalid_value")}function If(r){if(_){let e=new Error(`rune_outside_svelte
The \`${r}\` rune is only available inside \`.svelte\` and \`.svelte.js/ts\` files
https://svelte.dev/e/rune_outside_svelte`);throw e.name="Svelte error",e}else throw new Error("https://svelte.dev/e/rune_outside_svelte")}function _f(){if(_){let r=new Error("state_descriptors_fixed\nProperty descriptors defined on `$state` objects must contain `value` and always be `enumerable`, `configurable` and `writable`.\nhttps://svelte.dev/e/state_descriptors_fixed");throw r.name="Svelte error",r}else throw new Error("https://svelte.dev/e/state_descriptors_fixed")}function Cf(){if(_){let r=new Error("state_prototype_fixed\nCannot set prototype of `$state` object\nhttps://svelte.dev/e/state_prototype_fixed");throw r.name="Svelte error",r}else throw new Error("https://svelte.dev/e/state_prototype_fixed")}function xf(){if(_){let r=new Error("state_unsafe_mutation\nUpdating state inside `$derived(...)`, `$inspect(...)` or a template expression is forbidden. If the value should not be reactive, declare it without `$state`\nhttps://svelte.dev/e/state_unsafe_mutation");throw r.name="Svelte error",r}else throw new Error("https://svelte.dev/e/state_unsafe_mutation")}function wf(){if(_){let r=new Error("svelte_boundary_reset_onerror\nA `<svelte:boundary>` `reset` function cannot be called while an error is still being handled\nhttps://svelte.dev/e/svelte_boundary_reset_onerror");throw r.name="Svelte error",r}else throw new Error("https://svelte.dev/e/svelte_boundary_reset_onerror")}var Le=!1,Sr=!1,fr=!1;function Af(){Sr=!0}var Vt={};var he=Symbol("uninitialized"),ar=Symbol("filename");var ca="http://www.w3.org/1999/xhtml";var No=null;function vt(r,e){return r.label=e,da(r.v,e),r}function da(r,e){var t;return(t=r==null?void 0:r[na])==null||t.call(r,e),r}function mr(r){let e=new Error,t=Fh();return t.length===0?null:(t.unshift(`
`),Ye(e,"stack",{value:t.join(`
`)}),Ye(e,"name",{value:r}),e)}function Fh(){let r=Error.stackTraceLimit;Error.stackTraceLimit=1/0;let e=new Error().stack;if(Error.stackTraceLimit=r,!e)return[];let t=e.split(`
`),n=[];for(let i=0;i<t.length;i++){let o=t[i],s=o.replaceAll("\\","/");if(o.trim()!=="Error"){if(o.includes("validate_each_keys"))return[];s.includes("svelte/src/internal")||s.includes("node_modules/.vite")||n.push(o)}}return n}function kf(r,e){if(!_)throw new Error("invariant(...) was not guarded by if (DEV)");r||lf(e)}var Y=null;function zr(r){Y=r}var Er=null;function Si(r){Er=r}var pr=null;function fa(r){pr=r}function Se(r,e=!1,t){Y={p:Y,i:!1,c:null,e:null,s:r,x:null,r:k,l:Sr&&!e?{s:null,u:null,$:[]}:null},_&&(Y.function=t,pr=t)}function Ee(r){var i;var e=Y,t=e.e;if(t!==null){e.e=null;for(var n of t)jl(n)}return r!==void 0&&(e.x=r),e.i=!0,Y=e.p,_&&(pr=(i=Y==null?void 0:Y.function)!=null?i:null),Zo(r)}function Zo(r={}){return Ye(r,ra,{value:!0}),r}function Tr(){return!Sr||Y!==null&&Y.l===null}var Mn=[];function Ff(){var r=Mn;Mn=[],ki(r)}function Ze(r){if(Mn.length===0&&!On){var e=Mn;queueMicrotask(()=>{e===Mn&&Ff()})}Mn.push(r)}function Sf(){for(;Mn.length>0;)Ff()}var Kr="font-weight: bold",qr="font-weight: normal";function Ef(r){_?console.warn(`%c[svelte] await_reactivity_loss
%cDetected reactivity loss when reading \`${r}\`. This happens when state is read in an async function after an earlier \`await\`
https://svelte.dev/e/await_reactivity_loss`,Kr,qr):console.warn("https://svelte.dev/e/await_reactivity_loss")}function Tf(r,e){_?console.warn(`%c[svelte] await_waterfall
%cAn async derived, \`${r}\` (${e}) was not read immediately after it resolved. This often indicates an unnecessary waterfall, which can slow down your app
https://svelte.dev/e/await_waterfall`,Kr,qr):console.warn("https://svelte.dev/e/await_waterfall")}function Gf(){_?console.warn(`%c[svelte] derived_inert
%cReading a derived belonging to a now-destroyed effect may result in stale values
https://svelte.dev/e/derived_inert`,Kr,qr):console.warn("https://svelte.dev/e/derived_inert")}function Bf(r,e,t){_?console.warn(`%c[svelte] hydration_attribute_changed
%cThe \`${r}\` attribute on \`${e}\` changed its value between server and client renders. The client value, \`${t}\`, will be ignored in favour of the server value
https://svelte.dev/e/hydration_attribute_changed`,Kr,qr):console.warn("https://svelte.dev/e/hydration_attribute_changed")}function $n(r){_?console.warn(`%c[svelte] hydration_mismatch
%c${r?`Hydration failed because the initial UI does not match what was rendered on the server. The error occurred near ${r}`:"Hydration failed because the initial UI does not match what was rendered on the server"}
https://svelte.dev/e/hydration_mismatch`,Kr,qr):console.warn("https://svelte.dev/e/hydration_mismatch")}function Df(){_?console.warn(`%c[svelte] lifecycle_double_unmount
%cTried to unmount a component that was not mounted
https://svelte.dev/e/lifecycle_double_unmount`,Kr,qr):console.warn("https://svelte.dev/e/lifecycle_double_unmount")}function Nf(){_?console.warn("%c[svelte] select_multiple_invalid_value\n%cThe `value` property of a `<select multiple>` element should be an array, but it received a non-array value. The selection will be kept as is.\nhttps://svelte.dev/e/select_multiple_invalid_value",Kr,qr):console.warn("https://svelte.dev/e/select_multiple_invalid_value")}function ma(r){_?console.warn(`%c[svelte] state_proxy_equality_mismatch
%cReactive \`$state(...)\` proxies and the values they proxy have different identities. Because of this, comparisons with \`${r}\` will produce unexpected results
https://svelte.dev/e/state_proxy_equality_mismatch`,Kr,qr):console.warn("https://svelte.dev/e/state_proxy_equality_mismatch")}function Zf(){_?console.warn("%c[svelte] svelte_boundary_reset_noop\n%cA `<svelte:boundary>` `reset` function only resets the boundary the first time it is called\nhttps://svelte.dev/e/svelte_boundary_reset_noop",Kr,qr):console.warn("https://svelte.dev/e/svelte_boundary_reset_noop")}var S=!1;function Me(r){S=r}var $;function me(r){if(r===null)throw $n(),Vt;return $=r}function lt(){return me(ct($))}function Q(r){if(S){if(ct($)!==null)throw $n(),Vt;$=r}}function Gi(r=1){if(S){for(var e=r,t=$;e--;)t=ct(t);$=t}}function Gr(r=!0){for(var e=0,t=$;;){if(t.nodeType===sr){var n=t.data;if(n==="]"){if(e===0)return t;e-=1}else(n==="["||n==="[!"||n[0]==="["&&!isNaN(Number(n.slice(1))))&&(e+=1)}var i=ct(t);r&&t.remove(),t=i}}function Pn(r){if(!r||r.nodeType!==sr)throw $n(),Vt;return r.data}var Sh=/^[a-zA-Z_$][a-zA-Z_$0-9]*$/;function en(r){if(typeof r!="object"||r===null||it in r||ra in r)return r;let e=Ln(r);if(e!==Ol&&e!==sf)return r;var t=new Map,n=Wt(r),i=Br(0),o=_&&fr?mr("created at"):null,s=An,a=p=>{if(An===s)return p();var f=D,m=An;Oe(null),zl(s);var b=p();return Oe(f),zl(m),b};n&&(t.set("length",Br(r.length,o)),_&&(r=Th(r)));var l="";let u=!1;function d(p){if(!u){u=!0,l=p,vt(i,`${l} version`);for(let[f,m]of t)vt(m,Hn(l,f));u=!1}}return new Proxy(r,{defineProperty(p,f,m){(!("value"in m)||m.configurable===!1||m.enumerable===!1||m.writable===!1)&&_f();var b=t.get(f);return b===void 0?a(()=>{var g=Br(m.value,o);return t.set(f,g),_&&typeof f=="string"&&vt(g,Hn(l,f)),g}):W(b,m.value,!0),!0},deleteProperty(p,f){var m=t.get(f);if(m===void 0){if(f in p){let b=a(()=>Br(he,o));t.set(f,b),Jn(i),_&&vt(b,Hn(l,f))}}else W(m,he),Jn(i);return!0},get(p,f,m){var I;if(f===it)return r;if(_&&f===na)return d;var b=t.get(f),g=f in p;if(b===void 0&&(!g||(I=Ct(p,f))!=null&&I.writable)&&(b=a(()=>{var w=en(g?p[f]:he),x=Br(w,o);return _&&vt(x,Hn(l,f)),x}),t.set(f,b)),b!==void 0){var v=y(b);return v===he?void 0:v}return Reflect.get(p,f,m)},getOwnPropertyDescriptor(p,f){var v;(v=this.has)==null||v.call(this,p,f);var m=Reflect.getOwnPropertyDescriptor(p,f),b=t.get(f);if(b!==void 0){var g=y(b);if(g===he)return;if(m&&"value"in m)m.value=g;else return{enumerable:!0,configurable:!0,value:g,writable:!0}}return m},has(p,f){var v;if(f===it)return!0;var m=t.get(f),b=m!==void 0&&m.v!==he||Reflect.has(p,f);if(m!==void 0||k!==null&&(!b||(v=Ct(p,f))!=null&&v.writable)){m===void 0&&(m=a(()=>{var I=b?en(p[f]):he,w=Br(I,o);return _&&vt(w,Hn(l,f)),w}),t.set(f,m));var g=y(m);if(g===he)return!1}return b},set(p,f,m,b){var le;var g=t.get(f),v=f in p;if(n&&f==="length")for(var I=m;I<g.v;I+=1){var w=t.get(I+"");w!==void 0?W(w,he):I in p&&(w=a(()=>Br(he,o)),t.set(I+"",w),_&&vt(w,Hn(l,I)))}if(g===void 0)(!v||(le=Ct(p,f))!=null&&le.writable)&&(g=a(()=>Br(void 0,o)),_&&vt(g,Hn(l,f)),W(g,en(m)),t.set(f,g));else{v=g.v!==he;var x=a(()=>en(m));W(g,x)}var X=Reflect.getOwnPropertyDescriptor(p,f);if(X!=null&&X.set&&X.set.call(b,m),!v){if(n&&typeof f=="string"){var K=t.get("length"),V=Number(f);Number.isInteger(V)&&V>=K.v&&W(K,V+1)}Jn(i)}return!0},ownKeys(p){y(i);var f=Reflect.ownKeys(p).filter(g=>{var v=t.get(g);return v===void 0||v.v!==he});for(var[m,b]of t)b.v!==he&&!(m in p)&&f.push(m);return f},setPrototypeOf(){Cf()}})}function Hn(r,e){var t;return typeof e=="symbol"?`${r}[Symbol(${(t=e.description)!=null?t:""})]`:Sh.test(e)?`${r}.${e}`:/^\d+$/.test(e)?`${r}[${e}]`:`${r}['${e}']`}function Bi(r){try{if(r!==null&&typeof r=="object"&&it in r)return r[it]}catch(e){}return r}function pa(r,e){return Object.is(Bi(r),Bi(e))}var Eh=new Set(["copyWithin","fill","pop","push","reverse","shift","sort","splice","unshift"]);function Th(r){return new Proxy(r,{get(e,t,n){var i=Reflect.get(e,t,n);return Eh.has(t)?function(...o){Xf();var s=i.apply(this,o);return ha(),s}:i}})}function Uf(){let r=Array.prototype,e=Array.__svelte_cleanup;e&&e();let{indexOf:t,lastIndexOf:n,includes:i}=r;r.indexOf=function(o,s){let a=t.call(this,o,s);if(a===-1){for(let l=s!=null?s:0;l<this.length;l+=1)if(Bi(this[l])===o){ma("array.indexOf(...)");break}}return a},r.lastIndexOf=function(o,s){let a=n.call(this,o,s!=null?s:this.length-1);if(a===-1){for(let l=0;l<=(s!=null?s:this.length-1);l+=1)if(Bi(this[l])===o){ma("array.lastIndexOf(...)");break}}return a},r.includes=function(o,s){let a=i.call(this,o,s);if(!a){for(let l=0;l<this.length;l+=1)if(Bi(this[l])===o){ma("array.includes(...)");break}}return a},Array.__svelte_cleanup=()=>{r.indexOf=t,r.lastIndexOf=n,r.includes=i}}var Uo,Qf,Qo,Wf,Vf;function ga(){if(Uo===void 0){Uo=window,Qf=document,Qo=/Firefox/.test(navigator.userAgent);var r=Element.prototype,e=Node.prototype,t=Text.prototype;Wf=Ct(e,"firstChild").get,Vf=Ct(e,"nextSibling").get,$l(r)&&(r[Bo]=void 0,r[ia]=null,r[Vl]=void 0,r.__e=void 0),$l(t)&&(t[Do]=void 0),_&&(r.__svelte_meta=null,Uf())}}function Xe(r=""){return document.createTextNode(r)}function ut(r){return Wf.call(r)}function ct(r){return Vf.call(r)}function H(r,e){if(!S)return ut(r);var t=ut($);if(t===null)t=$.appendChild(Xe());else if(e&&t.nodeType!==Ai){var n=Xe();return t==null||t.before(n),me(n),n}return e&&va(t),me(t),t}function Di(r,e=!1){var i,o;if(!S){var t=ut(r);return t instanceof Comment&&t.data===""?ct(t):t}if(e){if(((i=$)==null?void 0:i.nodeType)!==Ai){var n=Xe();return(o=$)==null||o.before(n),me(n),n}va($)}return $}function Te(r,e=!1){if(!S)return ut(r);var t=H(r,e);return Q(r),t}function se(r,e=1,t=!1){let n=S?$:r;for(var i;e--;)i=n,n=ct(n);if(!S)return n;if(t){if((n==null?void 0:n.nodeType)!==Ai){var o=Xe();return n===null?i==null||i.after(o):n.before(o),me(o),o}va(n)}return me(n),n}function Wo(r){r.textContent=""}function ba(){if(!Le||Et!==null)return!1;var r=k.f;return(r&32768)!==0}function hr(r,e,t){return e==null||e===ca?t?document.createElement(r,{is:t}):document.createElement(r):t?document.createElementNS(e,r,{is:t}):document.createElementNS(e,r)}function va(r){if(r.nodeValue.length<65536)return;let e=r.nextSibling;for(;e!==null&&e.nodeType===Ai;)e.remove(),r.nodeValue+=e.nodeValue,e=r.nextSibling}var Kl=new WeakMap;function Yf(r){var e=k;if(e===null)return D.f|=8388608,r;if(_&&r instanceof Error&&!Kl.has(r)&&Kl.set(r,Gh(r,e)),(e.f&32768)===0&&(e.f&4)===0)throw _&&!e.parent&&r instanceof Error&&Lf(r),r;Tt(r,e)}function Tt(r,e){if(r===Vt)throw r;if(!(e!==null&&(e.f&16384)!==0)){for(;e!==null;){if((e.f&128)!==0&&(e.f&33570816)===0){if((e.f&32768)===0)throw r;try{e.b.error(r);return}catch(t){r=t}}e=e.parent}throw _&&r instanceof Error&&Lf(r),r}}function Gh(r,e){var s,a,l;let t=Ct(r,"message");if(!(t&&!t.configurable)){for(var n=Qo?" ":" ",i=`
${n}in ${((s=e.fn)==null?void 0:s.name)||"<unknown>"}`,o=e.ctx;o!==null;)i+=`
${n}in ${(a=o.function)==null?void 0:a[ar].split("/").pop()}`,o=o.p;return{message:r.message+`
${i}
`,stack:(l=r.stack)==null?void 0:l.split(`
`).filter(u=>!u.includes("svelte/src/internal")).join(`
`)}}}function Lf(r){let e=Kl.get(r);e&&(Ye(r,"message",{value:e.message}),Ye(r,"stack",{value:e.stack}))}var Bh=-7169;function de(r,e){r.f=r.f&Bh|e}function Ni(r){(r.f&512)!==0||r.deps===null?de(r,1024):de(r,4096)}function ya(r,e,t){(r.f&2048)!==0?e.add(r):(r.f&4096)!==0&&t.add(r),de(r,1024)}var Mf=!1;function Ia(){Mf||(Mf=!0,document.addEventListener("reset",r=>{Promise.resolve().then(()=>{var e;if(!r.defaultPrevented)for(let t of r.target.elements)(e=t[xn])==null||e.call(t)})},{capture:!0}))}function Lt(r){var e=D,t=k;Oe(null),Be(null);try{return r()}finally{Oe(e),Be(t)}}function _a(r,e,t,n=t){r.addEventListener(e,()=>Lt(t));let i=r[xn];i?r[xn]=()=>{i(),n(!0)}:r[xn]=()=>n(!0),Ia()}function Ca(r,e,t,n){let i=Tr()?kn:nn;var o=r.filter(m=>!m.settled),s=e.map(i);if(_&&s.forEach((m,b)=>{m.label=e[b].toString().replace("() => ","").replaceAll("$.eager(() => ","$state.eager(").replace(/\$\.get\((.+?)\)/g,(g,v)=>v)}),t.length===0&&o.length===0){n(s);return}var a=k,l=Of(),u=o.length===1?o[0].promise:o.length>1?Promise.all(o.map(m=>m.promise)):null;function d(m){if((a.f&16384)===0){l();try{n([...s,...m])}catch(b){Tt(b,a)}Xi()}}var p=ql();if(t.length===0){u.then(()=>d([])).finally(p);return}function f(){Promise.all(t.map(m=>tc(m))).then(d).catch(m=>Tt(m,a)).finally(p)}u?u.then(()=>{if((a.f&16384)!==0){p();return}l(),f(),Xi()}):f()}function Of(){var r=k,e=D,t=Y,n=B;if(_)var i=Er;return function(s=!0){Be(r),Oe(e),zr(t),s&&(r.f&16384)===0&&(n==null||n.activate(),n==null||n.apply()),_&&(ec(null),Si(i))}}var Dh=!1;function Xi(r=!0){var e;Dh=!1,Be(null),Oe(null),zr(null),r&&((e=B)==null||e.deactivate()),_&&(ec(null),Si(null))}function ql(){var r=k,e=r.b,t=B,n=!!(e!=null&&e.is_rendered());return e==null||e.update_pending_count(1,t),t.increment(n,r),()=>{e==null||e.update_pending_count(-1,t),t.decrement(n,r)}}var Bt=null;function ec(r){Bt=r}var Yo=new Set;function kn(r){var e=2050;k!==null&&(k.f|=524288);let t={ctx:Y,deps:null,effects:null,equals:aa,f:e,fn:r,reactions:null,rv:0,v:he,wv:0,parent:k,ac:null};return _&&fr&&(t.created=mr("created at")),t}var Ui=Symbol("obsolete");function tc(r,e,t){let n=k;n===null&&uf();var i=void 0,o=It(he);_&&(o.label=e!=null?e:r.toString());var s=!D,a=new Set;return Hf(()=>{var m,b;var l=k;_&&(Bt={effect:l,effect_deps:new Set,warned:!1});var u=sa();i=u.promise;try{Promise.resolve(r()).then(u.resolve,g=>{g!==Jr&&u.reject(g)}).finally(Xi)}catch(g){u.reject(g),Xi()}if(_){if(Bt){if(l.deps!==null)for(let g=0;g<xt;g+=1)Bt.effect_deps.add(l.deps[g]);if(et!==null)for(let g=0;g<et.length;g+=1)Bt.effect_deps.add(et[g])}Bt=null}var d=B;if(s){if((l.f&32768)!==0)var p=ql();if((m=n.b)!=null&&m.is_rendered())(b=d.async_deriveds.get(l))==null||b.reject(Ui);else for(let g of a.values())g.reject(Ui);a.add(u),d.async_deriveds.set(l,u)}let f=(g,v=void 0)=>{_&&(Bt=null),p==null||p(),a.delete(u),v!==Ui&&(d.activate(),v?(o.f|=8388608,br(o,v)):((o.f&8388608)!==0&&(o.f^=8388608),_&&t!==void 0&&!o.equals(g)&&(Yo.add(o),setTimeout(()=>{Yo.has(o)&&(l.f&16384)===0&&(Tf(o.label,t),Yo.delete(o))})),br(o,g)),d.deactivate())};u.promise.then(f,g=>f(null,g||"unknown"))}),Pe(()=>{for(let l of a)l.reject(Ui)}),_&&(o.f|=4194304),new Promise(l=>{function u(d){function p(){d===i?l(o):u(i)}d.then(p,p)}u(i)})}function nn(r){let e=kn(r);return e.equals=la,e}function $f(r){var e=r.effects;if(e!==null){r.effects=null;for(var t=0;t<e.length;t+=1)we(e[t])}}var rc=[];function Lo(r){var e,t=k,n=r.parent;if(!Ot&&n!==null&&r.v!==he&&(n.f&24576)!==0)return Gf(),r.v;if(Be(n),_){let i=jn;xa(new Set);try{jr.call(rc,r)&&df(),rc.push(r),$f(r),e=wa(r)}finally{Be(t),xa(i),rc.pop()}}else try{$f(r),e=wa(r)}finally{Be(t)}return e}function nc(r){var t,n,i;var e=Lo(r);if(!r.equals(e)&&(r.wv=Qi(),(!((t=B)!=null&&t.is_fork)||r.deps===null)&&(B!==null?(B.capture(r,e,!0),(n=Mt)==null||n.capture(r,e,!0)):r.v=e,r.deps===null))){de(r,1024);return}Ot||(Ue!==null?(wn()||(i=B)!=null&&i.is_fork)&&Ue.set(r,e):Ni(r))}function Pf(r){var e;if(r.effects!==null)for(let t of r.effects)(t.teardown||t.ac)&&((e=t.teardown)==null||e.call(t),t.ac!==null&&Lt(()=>{t.ac.abort(Jr),t.ac=null}),t.fn!==null&&(t.teardown=Fr),zn(t,0),Mo(t))}function ic(r){if(r.effects!==null)for(let e of r.effects)e.teardown&&e.fn!==null&&vr(e)}var Aa=null,Wi=null,B=null,Mt=null,Ue=null,lc=null,On=!1,sc=!1,Yi=null,Po=null,Jf=0,ac=new Set,Xh=1,Li,sn,an,Mi,Oi,$i,ln,Pi,Dt,Ho,cn,yr,Dr,Hi,Fn,ae,cc,uc,Oo,dc,zf,Kf,Vi,qf,$o,Ra=class Ra{constructor(){L(this,ae);c(this,"id",Xh++);L(this,Li,!1);c(this,"linked",!0);L(this,sn,null);L(this,an,null);c(this,"async_deriveds",new Map);c(this,"current",new Map);c(this,"previous",new Map);L(this,Mi,new Set);L(this,Oi,new Set);L(this,$i,0);L(this,ln,new Map);L(this,Pi,null);L(this,Dt,[]);L(this,Ho,[]);L(this,cn,new Set);L(this,yr,new Set);L(this,Dr,new Map);L(this,Hi,new Set);c(this,"is_fork",!1);L(this,Fn,!1);Wi===null?Aa=Wi=this:(Z(Wi,an,this),Z(this,sn,Wi)),Wi=this}skip_effect(e){h(this,Dr).has(e)||h(this,Dr).set(e,{d:[],m:[]}),h(this,Hi).delete(e)}unskip_effect(e,t=n=>this.schedule(n)){var n=h(this,Dr).get(e);if(n){h(this,Dr).delete(e);for(var i of n.d)de(i,2048),t(i);for(i of n.m)de(i,4096),t(i)}h(this,Hi).add(e)}capture(e,t,n=!1){e.v!==he&&!this.previous.has(e)&&this.previous.set(e,e.v),(e.f&8388608)===0&&(this.current.set(e,[t,n]),Ue==null||Ue.set(e,t)),this.is_fork||(e.v=t)}activate(){B=this}deactivate(){B=null,Ue=null}flush(){try{_&&ac.clear(),sc=!0,B=this,U(this,ae,Oo).call(this)}finally{if(Jf=0,lc=null,Yi=null,Po=null,sc=!1,B=null,Ue=null,cr.clear(),_)for(let e of ac)e.updated=null}}discard(){var e;for(let t of h(this,Oi))t(this);h(this,Oi).clear();for(let t of this.async_deriveds.values())t.reject(Ui);U(this,ae,$o).call(this),(e=h(this,Pi))==null||e.resolve()}register_created_effect(e){h(this,Ho).push(e)}increment(e,t){var n;if(Z(this,$i,h(this,$i)+1),e){let i=(n=h(this,ln).get(t))!=null?n:0;h(this,ln).set(t,i+1)}}decrement(e,t){var n;if(Z(this,$i,h(this,$i)-1),e){let i=(n=h(this,ln).get(t))!=null?n:0;i===1?h(this,ln).delete(t):h(this,ln).set(t,i-1)}h(this,Fn)||(Z(this,Fn,!0),Ze(()=>{Z(this,Fn,!1),this.linked&&this.flush()}))}transfer_effects(e,t){for(let n of e)h(this,cn).add(n);for(let n of t)h(this,yr).add(n);e.clear(),t.clear()}oncommit(e){h(this,Mi).add(e)}ondiscard(e){h(this,Oi).add(e)}settled(){var e;return((e=h(this,Pi))!=null?e:Z(this,Pi,sa())).promise}static ensure(){if(B===null){let e=B=new Ra;!sc&&!On&&Ze(()=>{h(e,Li)||e.flush()})}return B}apply(){if(!Le||!this.is_fork&&h(this,sn)===null&&h(this,an)===null){Ue=null;return}Ue=new Map;for(let[t,[n]]of this.current)Ue.set(t,n);for(let t=Aa;t!==null;t=h(t,an))if(!(t===this||t.is_fork)){var e=!1;if(t.id<this.id){for(let[n,[,i]]of t.current)if(!i&&this.current.has(n)){e=!0;break}}if(!e)for(let[n,i]of t.previous)Ue.has(n)||Ue.set(n,i)}}schedule(e){var t;if(lc=e,(t=e.b)!=null&&t.is_pending&&(e.f&16777228)!==0&&(e.f&32768)===0){e.b.defer_effect(e);return}h(this,Dt).push(e)}};Li=new WeakMap,sn=new WeakMap,an=new WeakMap,Mi=new WeakMap,Oi=new WeakMap,$i=new WeakMap,ln=new WeakMap,Pi=new WeakMap,Dt=new WeakMap,Ho=new WeakMap,cn=new WeakMap,yr=new WeakMap,Dr=new WeakMap,Hi=new WeakMap,Fn=new WeakMap,ae=new WeakSet,cc=function(){if(this.is_fork)return!0;for(let n of h(this,ln).keys()){for(var e=n,t=!1;e.parent!==null;){if(h(this,Dr).has(e)){t=!0;break}e=e.parent}if(!t)return!0}return!1},uc=function(){var e=[];for(let o of h(this,Dt))if(!((o.f&16384)!==0||(o.f&6144)===0)){for(var t=o,n=!1;t.parent!==null;){t=t.parent;var i=t.f;if((i&96)!==0){if((i&1024)===0){n=!0;break}t.f^=1024}}n||e.push(t)}return Z(this,Dt,[]),e},Oo=function(){var a,l,u,d;if(Z(this,Li,!0),_)for(let p of this.current.keys())ac.add(p);for(let p of h(this,cn))h(this,yr).delete(p),de(p,2048),this.schedule(p);for(let p of h(this,yr))de(p,4096),this.schedule(p);this.apply();for(var e=Yi=[],t=[],n=Po=[];h(this,Dt).length>0;){Jf++>1e3&&(U(this,ae,$o).call(this),Uh());for(let p of U(this,ae,uc).call(this))try{U(this,ae,dc).call(this,p,e,t)}catch(f){throw rm(p),U(this,ae,cc).call(this)||this.discard(),f}}if(B=null,n.length>0){var i=Ra.ensure();for(let p of n)i.schedule(p)}if(Yi=null,Po=null,U(this,ae,cc).call(this)){U(this,ae,Vi).call(this,t),U(this,ae,Vi).call(this,e);for(let[p,f]of h(this,Dr))tm(p,f);n.length>0&&U(a=B,ae,Oo).call(a);return}let o=U(this,ae,zf).call(this);if(o){U(this,ae,Vi).call(this,t),U(this,ae,Vi).call(this,e),U(l=o,ae,Kf).call(l,this);return}h(this,cn).clear(),h(this,yr).clear();for(let p of h(this,Mi))p(this);h(this,Mi).clear(),Mt=this,jf(t),jf(e),Mt=null,(u=h(this,Pi))==null||u.resolve();var s=B;if(h(this,$i)===0&&(h(this,Dt).length===0||s!==null)&&(U(this,ae,$o).call(this),Le&&(U(this,ae,qf).call(this),B=s)),h(this,Dt).length>0)if(s!==null){for(let p of h(this,Dt))h(s,Dt).push(p);Z(this,Dt,[])}else s=this;s!==null&&(cr.clear(),U(d=s,ae,Oo).call(d))},dc=function(e,t,n){e.f^=1024;for(var i=e.first;i!==null;){var o=i.f,s=(o&96)!==0,a=s&&(o&1024)!==0,l=a||(o&8192)!==0||h(this,Dr).has(i);if(!l&&i.fn!==null){s?i.f^=1024:(o&4)!==0?t.push(i):Le&&(o&16777224)!==0?n.push(i):un(i)&&((o&16)!==0&&h(this,yr).add(i),vr(i));var u=i.first;if(u!==null){i=u;continue}}for(;i!==null;){var d=i.next;if(d!==null){i=d;break}i=i.parent}}},zf=function(){for(var e=h(this,sn);e!==null;){if(!e.is_fork){for(let[t,[,n]]of this.current)if(e.current.has(t)&&!n)return e}e=h(e,sn)}return null},Kf=function(e){var n;for(let[i,o]of e.current)!this.previous.has(i)&&e.previous.has(i)&&this.previous.set(i,e.previous.get(i)),this.current.set(i,o);for(let[i,o]of e.async_deriveds){let s=this.async_deriveds.get(i);s&&o.promise.then(s.resolve).catch(s.reject)}e.async_deriveds.clear(),this.transfer_effects(h(e,cn),h(e,yr));let t=i=>{var o=i.reactions;if(o!==null&&!((i.f&2)!==0&&(i.f&6144)===0))for(let l of o){var s=l.f;if((s&2)!==0)t(l);else{var a=l;s&4194320&&!this.async_deriveds.has(a)&&(h(this,yr).delete(a),de(a,2048),this.schedule(a))}}};for(let i of this.current.keys())t(i);this.oncommit(()=>e.discard()),U(n=e,ae,$o).call(n),B=this,U(this,ae,Oo).call(this)},Vi=function(e){for(var t=0;t<e.length;t+=1)ya(e[t],h(this,cn),h(this,yr))},qf=function(){var p,f;for(let m=Aa;m!==null;m=h(m,an)){var e=m.id<this.id,t=[];for(let[b,[g,v]]of this.current){if(m.current.has(b)){var n=m.current.get(b)[0];if(e&&g!==n)m.current.set(b,[g,v]);else continue}t.push(b)}if(e)for(let[b,g]of this.async_deriveds){let v=m.async_deriveds.get(b);v&&g.promise.then(v.resolve).catch(v.reject)}var i=[...m.current.keys()].filter(b=>!m.current.get(b)[1]);if(!(!h(m,Li)||i.length===0)){var o=i.filter(b=>!this.current.has(b));if(o.length===0)e&&m.discard();else if(t.length>0){if(_&&!h(m,Fn)&&kf(h(m,Dt).length===0,"Batch has scheduled effects"),e)for(let b of h(this,Hi))m.unskip_effect(b,g=>{var v;(g.f&4194320)!==0?m.schedule(g):U(v=m,ae,Vi).call(v,[g])});m.activate();var s=new Set,a=new Map;for(var l of t)em(l,o,s,a);a=new Map;var u=[...m.current].filter(([b,g])=>{let v=this.current.get(b);return v?v[0]!==g[0]||v[1]!==g[1]:!0}).map(([b])=>b);if(u.length>0)for(let b of h(this,Ho))(b.f&155648)===0&&fc(b,u,a)&&((b.f&4194320)!==0?(de(b,2048),m.schedule(b)):h(m,cn).add(b));if(h(m,Dt).length>0&&!h(m,Fn)){m.apply();for(var d of U(p=m,ae,uc).call(p))U(f=m,ae,dc).call(f,d,[],[])}m.deactivate()}}}},$o=function(){if(this.linked){var e=h(this,sn),t=h(this,an);e===null?Aa=t:Z(e,an,t),t===null?Wi=e:Z(t,sn,e),this.linked=!1}};var $t=Ra;function N(r){var e=On,t=Mt;Mt=null,On=!0;try{var n;for(r&&(N(),n=r());;){if(Sf(),B===null)return n;B.flush()}}finally{On=e,Mt=t}}function Uh(){var t;if(_){var r=new Map;for(let n of B.current.keys())for(let[i,o]of(t=n.updated)!=null?t:[]){var e=r.get(i);e||(e={error:o.error,count:0},r.set(i,e)),e.count+=o.count}for(let n of r.values())n.error&&console.error(n.error)}try{gf()}catch(n){_&&Ye(n,"stack",{value:""}),Tt(n,lc)}}var Et=null;function jf(r){var e=r.length;if(e!==0){for(var t=0;t<e;){var n=r[t++];if((n.f&24576)===0&&un(n)&&(Et=new Set,vr(n),n.deps===null&&n.first===null&&n.nodes===null&&n.teardown===null&&n.ac===null&&mc(n),(Et==null?void 0:Et.size)>0)){cr.clear();for(let i of Et){if((i.f&24576)!==0)continue;let o=[i],s=i.parent;for(;s!==null;)Et.has(s)&&(Et.delete(s),o.push(s)),s=s.parent;for(let a=o.length-1;a>=0;a--){let l=o[a];(l.f&24576)===0&&vr(l)}}Et.clear()}}Et=null}}function em(r,e,t,n){if(!t.has(r)&&(t.add(r),r.reactions!==null))for(let i of r.reactions){let o=i.f;(o&2)!==0?em(i,e,t,n):(o&4194320)!==0&&(o&2048)===0&&fc(i,e,n)&&(de(i,2048),Jo(i))}}function fc(r,e,t){let n=t.get(r);if(n!==void 0)return n;if(r.deps!==null)for(let i of r.deps){if(jr.call(e,i))return!0;if((i.f&2)!==0&&fc(i,e,t))return t.set(i,!0),!0}return t.set(r,!1),!1}function Jo(r){B.schedule(r)}function tm(r,e){if(!((r.f&32)!==0&&(r.f&1024)!==0)){(r.f&2048)!==0?e.d.push(r):(r.f&4096)!==0&&e.m.push(r),de(r,1024);for(var t=r.first;t!==null;)tm(t,e),t=t.next}}function rm(r){de(r,1024);for(var e=r.first;e!==null;)rm(e),e=e.next}var jn=new Set,cr=new Map;function xa(r){jn=r}var hc=!1;function Xf(){hc=!0}function It(r,e){var t={f:0,v:r,reactions:null,equals:aa,rv:0,wv:0};return _&&fr&&(t.created=e!=null?e:mr("created at"),t.updated=null,t.set_during_effect=!1,t.trace=null),t}function Br(r,e){let t=It(r,e);return oc(t),t}function ue(r,e=!1,t=!0){var i,o;let n=It(r);return e||(n.equals=la),Sr&&t&&Y!==null&&Y.l!==null&&((o=(i=Y.l).s)!=null?o:i.s=[]).push(n),n}function gc(r,e){return W(r,E(()=>y(r))),e}function W(r,e,t=!1){D!==null&&(!wt||(D.f&131072)!==0)&&Tr()&&(D.f&4325394)!==0&&(Nt===null||!Nt.has(r))&&xf();let n=t?en(e):e;return _&&da(n,r.label),br(r,n,Po)}var qn=null,pc=0;function br(r,e,t=null){var i,o,s;if(!r.equals(e)){Ot?cr.set(r,e):cr.has(r)||cr.set(r,r.v);var n=$t.ensure();if(n.capture(r,e),_){if(fr||k!==null){(i=r.updated)!=null||(r.updated=new Map);let a=((s=(o=r.updated.get(""))==null?void 0:o.count)!=null?s:0)+1;if(r.updated.set("",{error:null,count:a}),fr||a>5){let l=mr("updated at");if(l!==null){let u=r.updated.get(l.stack);u||(u={error:l,count:0},r.updated.set(l.stack,u)),u.count++}}}k!==null&&(r.set_during_effect=!0)}if((r.f&2)!==0){let a=r;(r.f&2048)!==0&&Lo(a),Ue===null&&Ni(a)}r.wv=Qi(),qn=null,pc=0,im(r,2048,t),qn=null,Tr()&&k!==null&&(k.f&1024)!==0&&(k.f&96)===0&&(Pt===null?om([r]):Pt.push(r)),!n.is_fork&&jn.size>0&&!hc&&ha()}return e}function ha(){hc=!1;for(let r of jn){(r.f&1024)!==0&&de(r,4096);let e;try{e=un(r)}catch(t){e=!0}e&&vr(r)}jn.clear()}function Jn(r){W(r,r.v+1)}function im(r,e,t){var f;var n=r.reactions;if(n!==null){var i=Tr(),o=n.length;if(pc+=o,pc>1e5&&qn===null&&(qn=new Set),qn!==null){if(qn.has(r))return;qn.add(r)}for(var s=0;s<o;s++){var a=n[s],l=a.f;if(!(!i&&a===k)){var u=(l&2048)===0;if(u&&de(a,e),(l&131072)!==0)jn.add(a);else if((l&2)!==0){var d=a;(f=Ue)==null||f.delete(d),im(d,4096,t)}else if(u){var p=a;(l&16)!==0&&Et!==null&&Et.add(p),t!==null?t.push(p):Jo(p)}}}}}var sm=null;var Ot=!1;function bc(r){Ot=r}var D=null,wt=!1;function Oe(r){D=r}var k=null;function Be(r){k=r}var Nt=null;function oc(r){D!==null&&(!Le&&(D.f&2097152)!==0||(D.f&2)!==0)&&(Nt!=null?Nt:Nt=new Set).add(r)}var et=null,xt=0,Pt=null;function om(r){Pt=r}var lm=1,ei=0,An=ei;function zl(r){An=r}function Qi(){return++lm}function un(r){var e=r.f;if((e&2048)!==0)return!0;if((e&4096)!==0){for(var t=r.deps,n=t.length,i=0;i<n;i++){var o=t[i];if(un(o)&&nc(o),o.wv>r.wv)return!0}(e&512)!==0&&Ue===null&&de(r,1024)}return!1}function cm(r,e,t=!0){var n=r.reactions;if(n!==null&&!(!Le&&Nt!==null&&Nt.has(r)))for(var i=0;i<n.length;i++){var o=n[i];(o.f&2)!==0?cm(o,e,!1):e===o&&(t?de(o,2048):(o.f&1024)!==0&&de(o,4096),Jo(o))}}function wa(r){var e=et,t=xt,n=Pt,i=D,o=Nt,s=Y,a=wt,l=An,u=r.f;et=null,xt=0,Pt=null,D=(u&96)===0?r:null,Nt=null,zr(r.ctx),wt=!1,An=++ei,r.ac!==null&&(Lt(()=>{r.ac.abort(Jr)}),r.ac=null);try{r.f|=2097152;var d=r.fn,p=d();r.f|=32768;var f=am(r);if(Tr()&&Pt!==null&&!wt&&f!==null&&(r.f&6146)===0)for(var m=0;m<Pt.length;m++)cm(Pt[m],r);if(i!==null&&i!==r){if(ei++,i.deps!==null)for(let b=0;b<t;b+=1)i.deps[b].rv=ei;if(e!==null)for(let b of e)b.rv=ei;Pt!==null&&(n===null?n=Pt:n.push(...Pt))}return(r.f&8388608)!==0&&(r.f^=8388608),p}catch(b){return am(r),Yf(b)}finally{r.f^=2097152,et=e,xt=t,Pt=n,D=i,Nt=o,zr(s),wt=a,An=l}}function am(r){var i,o,s;var e=r.deps,t=(i=B)==null?void 0:i.is_fork;if(et!==null){var n;if(t||zn(r,xt),e!==null&&xt>0)for(e.length=xt+et.length,n=0;n<et.length;n++)e[xt+n]=et[n];else r.deps=e=et;if(wn()&&(r.f&512)!==0)for(n=xt;n<e.length;n++)((s=(o=e[n]).reactions)!=null?s:o.reactions=[]).push(r)}else!t&&e!==null&&xt<e.length&&(zn(r,xt),e.length=xt);return e}function Wh(r,e){let t=e.reactions;if(t!==null){var n=of.call(t,r);if(n!==-1){var i=t.length-1;i===0?t=e.reactions=null:(t[n]=t[i],t.pop())}}if(t===null&&(e.f&2)!==0&&(et===null||!jr.call(et,e))){var o=e;(o.f&512)!==0&&(o.f^=512),o.v!==he&&Ni(o),o.ac!==null&&Lt(()=>{o.ac.abort(Jr),o.ac=null,de(o,2048)}),Pf(o),zn(o,0)}}function zn(r,e){var t=r.deps;if(t!==null)for(var n=e;n<t.length;n++)Wh(r,t[n])}function vr(r){var a;var e=r.f;if((e&16384)===0){de(r,1024);var t=k;if(k=r,_){var n=pr;fa(r.component_function);var i=Er;Si((a=r.dev_stack)!=null?a:Er)}try{(e&16777232)!==0?fm(r):Mo(r),vc(r);var o=wa(r);if(r.teardown=typeof o=="function"?o:null,r.wv=lm,_&&fr&&(r.f&2048)!==0&&r.deps!==null)for(var s of r.deps)s.set_during_effect&&(s.wv=Qi(),s.set_during_effect=!1)}finally{k=t,_&&(fa(n),Si(i))}}}async function dn(){if(Le)return new Promise(r=>{requestAnimationFrame(()=>r()),setTimeout(()=>r())});await Promise.resolve(),N()}function y(r){var m,b,g;var e=r.f,t=(e&2)!==0;if((m=sm)==null||m.add(r),D!==null&&!wt){var n=k!==null&&(k.f&16384)!==0;if(!n&&(Nt===null||!Nt.has(r))){var i=D.deps;if((D.f&2097152)!==0)r.rv<ei&&(r.rv=ei,et===null&&i!==null&&i[xt]===r?xt++:et===null?et=[r]:et.push(r));else{(b=D.deps)!=null||(D.deps=[]),jr.call(D.deps,r)||D.deps.push(r);var o=r.reactions;o===null?r.reactions=[D]:jr.call(o,D)||o.push(D)}}}if(_){if(!wt&&Bt&&B===null&&Mt===null&&!Bt.warned&&(Bt.effect.f&2097152)===0&&!Bt.effect_deps.has(r)){Bt.warned=!0,Ef(r.label);var s=mr("traced at");s&&console.warn(s)}if(Yo.delete(r),fr&&!wt&&No!==null&&D!==null&&No.reaction===D){if(r.trace)r.trace();else if(s=mr("traced at"),s){var a=No.entries.get(r);a===void 0&&(a={traces:[]},No.entries.set(r,a));var l=a.traces[a.traces.length-1];s.stack!==(l==null?void 0:l.stack)&&a.traces.push(s)}}}if(Ot&&cr.has(r))return cr.get(r);if(t){var u=r;if(Ot){var d=u.v;return((u.f&1024)===0&&u.reactions!==null||dm(u))&&(d=Lo(u)),cr.set(u,d),d}var p=(u.f&512)===0&&!wt&&D!==null&&(D.f&512)!==0,f=(u.f&32768)===0;un(u)&&(p&&(u.f|=512),nc(u)),p&&!f&&(ic(u),um(u))}if((g=Ue)!=null&&g.has(r))return Ue.get(r);if((r.f&8388608)!==0)throw r.v;return r.v}function um(r){if(r.f|=512,r.deps!==null)for(let t of r.deps){var e=t.reactions;e===null?t.reactions=[r]:jr.call(e,r)||e.push(r),(t.f&2)!==0&&(t.f&512)===0&&(ic(t),um(t))}}function dm(r){if(r.v===he)return!0;if(r.deps===null)return!1;for(let e of r.deps)if(cr.has(e)||(e.f&2)!==0&&dm(e))return!0;return!1}function E(r){var e=wt;try{return wt=!0,r()}finally{wt=e}}function Qe(r){if(!(typeof r!="object"||!r||r instanceof EventTarget)){if(it in r)ka(r);else if(!Array.isArray(r))for(let e in r){let t=r[e];typeof t=="object"&&t&&it in t&&ka(t)}}}function ka(r,e=new Set){if(typeof r=="object"&&r!==null&&!(r instanceof EventTarget)&&!e.has(r)){e.add(r),r instanceof Date&&r.getTime();for(let n in r)try{ka(r[n],e)}catch(i){}let t=Ln(r);if(t!==Object.prototype&&t!==Array.prototype&&t!==Map.prototype&&t!==Set.prototype&&t!==Date.prototype){let n=oa(t);for(let i in n){let o=n[i].get;if(o)try{o.call(r)}catch(s){}}}}}function Ic(r){k===null&&(D===null&&hf(r),pf()),Ot&&mf(r)}function Vh(r,e){var t=e.last;t===null?e.last=e.first=r:(t.next=r,r.prev=t,e.last=r)}function Ir(r,e){var s,a;var t=k;if(_)for(;t!==null&&(t.f&131072)!==0;)t=t.parent;t!==null&&(t.f&8192)!==0&&(r|=8192);var n={ctx:Y,deps:null,nodes:null,f:r|2048|512,first:null,fn:e,last:null,next:null,parent:t,b:t&&t.b,prev:null,teardown:null,wv:0,ac:null};_&&(n.component_function=pr),(s=B)==null||s.register_created_effect(n);var i=n;if((r&4)!==0)Yi!==null?Yi.push(n):$t.ensure().schedule(n);else if(e!==null){try{vr(n)}catch(l){throw we(n),l}i.deps===null&&i.teardown===null&&i.nodes===null&&i.first===i.last&&(i.f&524288)===0&&(i=i.first,(r&16)!==0&&(r&65536)!==0&&i!==null&&(i.f|=65536))}if(i!==null&&(i.parent=t,t!==null&&Vh(i,t),D!==null&&(D.f&2)!==0&&(r&64)===0)){var o=D;((a=o.effects)!=null?a:o.effects=[]).push(i)}return n}function wn(){return D!==null&&!wt}function Pe(r){let e=Ir(8,null);return de(e,1024),e.teardown=r,e}function Ji(r){var i;Ic("$effect"),_&&Ye(r,"name",{value:"$effect"});var e=k.f,t=!D&&(e&32)!==0&&Y!==null&&!Y.i;if(t){var n=Y;((i=n.e)!=null?i:n.e=[]).push(r)}else return jl(r)}function jl(r){return Ir(1048580,r)}function zo(r){return Ic("$effect.pre"),_&&Ye(r,"name",{value:"$effect.pre"}),Ir(1048584,r)}function _c(r){$t.ensure();let e=Ir(524352,r);return()=>{we(e)}}function hm(r){$t.ensure();let e=Ir(524352,r);return(t={})=>new Promise(n=>{t.outro?Nr(e,()=>{we(e),n(void 0)}):(we(e),n(void 0))})}function Jt(r){return Ir(4,r)}function Sn(r,e){var t=Y,n={effect:null,ran:!1,deps:r};t.l.$.push(n),n.effect=He(()=>{if(r(),!n.ran){n.ran=!0;var i=k;try{Be(i.parent),E(e)}finally{Be(i)}}})}function Ko(){var r=Y;He(()=>{for(var e of r.l.$){e.deps();var t=e.effect;(t.f&1024)!==0&&t.deps!==null&&de(t,4096),un(t)&&vr(t),e.ran=!1}})}function Hf(r){return Ir(4718592,r)}function He(r,e=0){return Ir(8|e,r)}function Ae(r,e=[],t=[],n=[]){Ca(n,e,t,i=>{Ir(8,()=>{r(...i.map(y))})})}function jt(r,e=0){var t=Ir(16|e,r);return _&&(t.dev_stack=Er),t}function Je(r){return Ir(524320,r)}function vc(r){var e=r.teardown;if(e!==null){let t=Ot,n=D;bc(!0),Oe(null);try{e.call(null)}catch(i){Tt(i,r.parent)}finally{bc(t),Oe(n)}}}function Mo(r,e=!1){var t=r.first;for(r.first=r.last=null;t!==null;){let i=t.ac;i!==null&&Lt(()=>{i.abort(Jr)});var n=t.next;(t.f&64)!==0?t.parent=null:we(t,e),t=n}}function fm(r){for(var e=r.first;e!==null;){var t=e.next;(e.f&32)===0&&we(e),e=t}}function we(r,e=!0){var t=!1;(e||(r.f&262144)!==0)&&r.nodes!==null&&r.nodes.end!==null&&(gm(r.nodes.start,r.nodes.end),t=!0),r.f|=33554432,Mo(r,e&&!t),zn(r,0);var n=r.nodes&&r.nodes.t;if(n!==null)for(let o of n)o.stop();vc(r),r.f^=33554432,r.f|=16384;var i=r.parent;i!==null&&i.first!==null&&mc(r),_&&(r.component_function=null),r.next=r.prev=r.teardown=r.ctx=r.deps=r.fn=r.nodes=r.ac=r.b=null}function gm(r,e){for(;r!==null;){var t=r===e?null:ct(r);r.remove(),r=t}}function mc(r){var e=r.parent,t=r.prev,n=r.next;t!==null&&(t.next=n),n!==null&&(n.prev=t),e!==null&&(e.first===r&&(e.first=n),e.last===r&&(e.last=t))}function Nr(r,e,t=!0){var n=[];r.f|=256,bm(r,n,!0);var i=()=>{t&&we(r),e&&e()},o=n.length;if(o>0){var s=()=>--o||i();for(var a of n)a.out(s)}else i()}function bm(r,e,t){if((r.f&8192)===0){r.f^=8192;var n=r.nodes&&r.nodes.t;if(n!==null)for(let a of n)(a.is_global||t)&&e.push(a);for(var i=r.first;i!==null;){var o=i.next;if((i.f&64)===0){var s=(i.f&65536)!==0||(i.f&32)!==0&&(r.f&16)!==0;bm(i,e,s?t:!1)}i=o}}}function ji(r){r.f&=-257,vm(r,!0)}function vm(r,e){if((r.f&256)===0&&(r.f&8192)!==0){r.f^=8192,(r.f&1024)===0&&(de(r,2048),$t.ensure().schedule(r));for(var t=r.first;t!==null;){var n=t.next,i=(t.f&65536)!==0||(t.f&32)!==0;vm(t,i?e:!1),t=n}var o=r.nodes&&r.nodes.t;if(o!==null)for(let s of o)(s.is_global||e)&&s.in()}}function zi(r,e){if(r.nodes)for(var t=r.nodes.start,n=r.nodes.end;t!==null;){var i=t===n?null:ct(t);e.append(t),t=i}}var Fa=Symbol("events"),ym=new Set,wc=new Set;function Im(r,e,t,n={}){function i(o){if(n.capture||Sa.call(e,o),!o.cancelBubble)return Lt(()=>t==null?void 0:t.call(this,o))}return r.startsWith("pointer")||r.startsWith("touch")||r==="wheel"?(i.__removed=!1,Ze(()=>{i.__removed||e.addEventListener(r,i,n)})):e.addEventListener(r,i,n),i}function z(r,e,t,n,i){var o={capture:n,passive:i},s=Im(r,e,t,o);(e===document.body||e===window||e===document||e instanceof HTMLMediaElement)&&Pe(()=>{s.__removed=!0,e.removeEventListener(r,s,o)})}var Cc=null,xc=!1;function Sa(r){var g,v;var e=this,t=e.ownerDocument,n=r.type,i=((g=r.composedPath)==null?void 0:g.call(r))||[],o=i[0]||r.target;Cc=r,xc||(xc=!0,setTimeout(()=>{xc=!1,Cc=null}));var s=0,a=Cc===r&&r[Fa];if(a){var l=i.indexOf(a);if(l!==-1&&(e===document||e===window)){r[Fa]=e;return}var u=i.indexOf(e);if(u===-1)return;l<=u&&(s=l)}if(o=i[s]||r.target,o!==e){Ye(r,"currentTarget",{configurable:!0,get(){return o||t}});var d=D,p=k;Oe(null),Be(null);try{for(var f,m=[];o!==null&&o!==e;){try{var b=(v=o[Fa])==null?void 0:v[n];b!=null&&(!o.disabled||r.target===o)&&b.call(o,r)}catch(I){f?m.push(I):f=I}if(r.cancelBubble)break;s++,o=s<i.length?i[s]:null}if(f){for(let I of m)queueMicrotask(()=>{throw I});throw f}}finally{r[Fa]=e,delete r.currentTarget,Oe(d),Be(p)}}}var _m,Ac=((_m=globalThis==null?void 0:globalThis.window)==null?void 0:_m.trustedTypes)&&globalThis.window.trustedTypes.createPolicy("svelte-trusted-html",{createHTML:r=>r});function Cm(r){var e;return(e=Ac==null?void 0:Ac.createHTML(r))!=null?e:r}function Rc(r){var e=hr("template");return e.innerHTML=Cm(r.replaceAll("<!>","<!---->")),e.content}function fn(r,e){var t=k;t.nodes===null&&(t.nodes={start:r,end:e,a:null,t:null})}function ne(r,e){var t=(e&1)!==0,n=(e&2)!==0,i,o=!r.startsWith("<!>");return()=>{if(S)return fn($,null),$;i===void 0&&(i=Rc(o?r:"<!>"+r),t||(i=ut(i)));var s=n||Qo?document.importNode(i,!0):i.cloneNode(!0);if(t){var a=ut(s),l=s.lastChild;fn(a,l)}else fn(s,s);return s}}function J(r,e){if(S){var t=k;((t.f&32768)===0||t.nodes.end===null)&&(t.nodes.end=$),lt();return}r!==null&&r.before(e)}var Ph=["allowfullscreen","async","autofocus","autoplay","checked","controls","default","disabled","formnovalidate","indeterminate","inert","ismap","loop","multiple","muted","nomodule","novalidate","open","playsinline","readonly","required","reversed","seamless","selected","webkitdirectory","defer","disablepictureinpicture","disableremoteplayback"];var G0=[...Ph,"formNoValidate","isMap","noModule","playsInline","readOnly","value","volume","defaultValue","defaultChecked","srcObject","noValidate","allowFullscreen","disablePictureInPicture","disableRemotePlayback"];var Hh=["touchstart","touchmove"];function xm(r){return Hh.includes(r)}var Jh=["$state","$state.raw","$derived","$derived.by"],B0=[...Jh,"$state.eager","$state.snapshot","$props","$props.id","$bindable","$effect","$effect.pre","$effect.tracking","$effect.root","$effect.pending","$inspect","$inspect().with","$inspect.trace","$host"];function wm(r){let e=0,t=It(0),n;return _&&vt(t,"createSubscriber version"),()=>{wn()&&(y(t),He(()=>(e===0&&(n=E(()=>r(()=>Jn(t)))),e+=1,()=>{Ze(()=>{e-=1,e===0&&(n==null||n(),n=void 0,Jn(t))})})))}}var jh=589824;function Bc(r,e,t,n){new Fc(r,e,t,n)}var zt,es,ur,ti,_t,Kt,At,qt,Zr,ri,Tn,Ki,ts,rs,Xr,Ta,q,Rm,km,Sc,En,Fm,Ec,qo,Ea,Tc,Gc,Fc=class{constructor(e,t,n,i){L(this,q);c(this,"parent");c(this,"is_pending",!1);c(this,"transform_error");L(this,zt);L(this,es,S?$:null);L(this,ur);L(this,ti);L(this,_t);L(this,Kt,null);L(this,At,null);L(this,qt,null);L(this,Zr,null);L(this,ri,0);L(this,Tn,0);L(this,Ki,!1);L(this,ts,new Set);L(this,rs,new Set);L(this,Xr,null);L(this,Ta,wm(()=>(Z(this,Xr,It(h(this,ri))),_&&vt(h(this,Xr),"$effect.pending()"),()=>{Z(this,Xr,null)})));var o,s;Z(this,zt,e),Z(this,ur,t),Z(this,ti,a=>{var l=k;l.b=this,l.f|=128,n(a)}),this.parent=k.b,this.transform_error=(s=i!=null?i:(o=this.parent)==null?void 0:o.transform_error)!=null?s:(a=>a),Z(this,_t,jt(()=>{if(S){let a=Pn(h(this,es));lt();let l=a==="[!";if(a.startsWith("[?")){let d=JSON.parse(a.slice("[?".length));U(this,q,km).call(this,d)}else l?U(this,q,Fm).call(this):U(this,q,Rm).call(this)}else U(this,q,Ec).call(this)},jh)),S&&Z(this,zt,$)}defer_effect(e){ya(e,h(this,ts),h(this,rs))}is_rendered(){return!this.is_pending&&(!this.parent||this.parent.is_rendered())}has_pending_snippet(){return!!h(this,ur).pending}update_pending_count(e,t){U(this,q,Tc).call(this,e,t),Z(this,ri,h(this,ri)+e),!(!h(this,Xr)||h(this,Ki))&&(Z(this,Ki,!0),Ze(()=>{Z(this,Ki,!1),h(this,Xr)&&br(h(this,Xr),h(this,ri))}))}get_effect_pending(){return h(this,Ta).call(this),y(h(this,Xr))}error(e){var t;if(e===Vt||!h(this,ur).onerror&&!h(this,ur).failed)throw e;(t=B)!=null&&t.is_fork?(h(this,Kt)&&B.skip_effect(h(this,Kt)),h(this,At)&&B.skip_effect(h(this,At)),h(this,qt)&&B.skip_effect(h(this,qt)),B.oncommit(()=>{U(this,q,En).call(this)||U(this,q,Gc).call(this,e)})):U(this,q,Gc).call(this,e)}};zt=new WeakMap,es=new WeakMap,ur=new WeakMap,ti=new WeakMap,_t=new WeakMap,Kt=new WeakMap,At=new WeakMap,qt=new WeakMap,Zr=new WeakMap,ri=new WeakMap,Tn=new WeakMap,Ki=new WeakMap,ts=new WeakMap,rs=new WeakMap,Xr=new WeakMap,Ta=new WeakMap,q=new WeakSet,Rm=function(){try{Z(this,Kt,Je(()=>h(this,ti).call(this,h(this,zt))))}catch(e){this.error(e)}},km=function(e){let t=h(this,ur).failed,{reset:n,invoke_onerror:i}=U(this,q,Sc).call(this,e);Ze(i),t&&Z(this,qt,Je(()=>{t(h(this,zt),()=>e,()=>n)}))},Sc=function(e){var t=!1,n=!1;let i=()=>{if(!U(this,q,En).call(this)){if(t){Zf();return}t=!0,n&&wf(),h(this,qt)!==null&&Nr(h(this,qt),()=>{Z(this,qt,null)}),U(this,q,Ea).call(this,()=>{U(this,q,Ec).call(this)})}};return{reset:i,invoke_onerror:()=>{var s,a;if(!U(this,q,En).call(this))try{n=!0,(a=(s=h(this,ur)).onerror)==null||a.call(s,e,i),n=!1}catch(l){Tt(l,h(this,_t)&&h(this,_t).parent)}}}},En=function(){return(h(this,_t).f&33570816)!==0},Fm=function(){let e=h(this,ur).pending;e&&(this.is_pending=!0,Z(this,At,Je(()=>e(h(this,zt)))),Ze(()=>{if(!U(this,q,En).call(this)){var t=Z(this,Zr,document.createDocumentFragment()),n=Xe(),i=!1;if(t.append(n),Z(this,Kt,U(this,q,Ea).call(this,()=>{try{return Je(()=>h(this,ti).call(this,n))}catch(o){try{this.error(o),i=!0}catch(s){Tt(s,h(this,_t).parent)}return null}})),h(this,Kt)===null){Z(this,Zr,null),i&&U(this,q,qo).call(this,B);return}h(this,Tn)===0&&(h(this,zt).before(t),Z(this,Zr,null),Nr(h(this,At),()=>{Z(this,At,null)}),U(this,q,qo).call(this,B))}}))},Ec=function(){try{if(this.is_pending=this.has_pending_snippet(),Z(this,Tn,0),Z(this,ri,0),Z(this,Kt,Je(()=>{h(this,ti).call(this,h(this,zt))})),h(this,Tn)>0){var e=Z(this,Zr,document.createDocumentFragment());zi(h(this,Kt),e);let t=h(this,ur).pending;Z(this,At,Je(()=>t(h(this,zt))))}else U(this,q,qo).call(this,B)}catch(t){this.error(t)}},qo=function(e){this.is_pending=!1,e.transfer_effects(h(this,ts),h(this,rs))},Ea=function(e){var t=k,n=D,i=Y;Be(h(this,_t)),Oe(h(this,_t)),zr(h(this,_t).ctx);try{return $t.ensure(),e()}finally{Be(t),Oe(n),zr(i)}},Tc=function(e,t){var n;if(!this.has_pending_snippet()){this.parent&&U(n=this.parent,q,Tc).call(n,e,t);return}Z(this,Tn,h(this,Tn)+e),h(this,Tn)===0&&(U(this,q,qo).call(this,t),h(this,At)&&Nr(h(this,At),()=>{Z(this,At,null)}),h(this,Zr)&&(h(this,zt).before(h(this,Zr)),Z(this,Zr,null)))},Gc=function(e){h(this,Kt)&&(we(h(this,Kt)),Z(this,Kt,null)),h(this,At)&&(we(h(this,At)),Z(this,At,null)),h(this,qt)&&(we(h(this,qt)),Z(this,qt,null)),S&&(me(h(this,es)),Gi(),me(Gr()));let t=h(this,ur).failed,n=i=>{if(U(this,q,En).call(this))return;let{reset:o,invoke_onerror:s}=U(this,q,Sc).call(this,i);s(),t&&!U(this,q,En).call(this)&&Z(this,qt,U(this,q,Ea).call(this,()=>{try{return Je(()=>{var a=k;a.b=this,a.f|=128,t(h(this,zt),()=>i,()=>o)})}catch(a){return Tt(a,h(this,_t).parent),null}}))};Ze(()=>{if(!U(this,q,En).call(this)){var i;try{i=this.transform_error(e)}catch(o){Tt(o,h(this,_t)&&h(this,_t).parent);return}i!==null&&typeof i=="object"&&typeof i.then=="function"?i.then(n,o=>Tt(o,h(this,_t)&&h(this,_t).parent)):n(i)}})};var Dc=!0;function Re(r,e){var n,i;var t=e==null?"":typeof e=="object"?`${e}`:e;t!==((i=r[n=Do])!=null?i:r[n]=r.nodeValue)&&(r[Do]=t,r.nodeValue=`${t}`)}function Ba(r,e){return Sm(r,e)}function Zc(r,e){var s;ga(),e.intro=(s=e.intro)!=null?s:!1;let t=e.target,n=S,i=$;try{for(var o=ut(t);o&&(o.nodeType!==sr||o.data!=="[");)o=ct(o);if(!o)throw Vt;Me(!0),me(o);let a=Sm(r,{...e,anchor:o});return Me(!1),a}catch(a){if(a instanceof Error&&a.message.split(`
`).some(l=>l.startsWith("https://svelte.dev/e/")))throw a;return a!==Vt&&console.warn("Failed to hydrate: ",a),e.recover===!1&&bf(),ga(),Wo(t),Me(!1),Ba(r,e)}finally{Me(n),me(i)}}var Ga=new Map;function Sm(r,{target:e,anchor:t,props:n={},events:i,context:o,intro:s=!0,transformError:a}){ga();var l=void 0,u=hm(()=>{var d=t!=null?t:e.appendChild(Xe());Bc(d,{pending:()=>{}},m=>{Se({});var b=Y;if(o&&(b.c=o),i&&(n.$$events=i),S&&fn(m,null),Dc=s,l=r(m,n)||Zo(),Dc=!0,S&&(k.nodes.end=$,$===null||$.nodeType!==sr||$.data!=="]"))throw $n(),Vt;Ee()},a);var p=new Set,f=m=>{for(var b=0;b<m.length;b++){var g=m[b];if(!p.has(g)){p.add(g);var v=xm(g);for(let x of[e,document]){var I=Ga.get(x);I===void 0&&(I=new Map,Ga.set(x,I));var w=I.get(g);w===void 0?(x.addEventListener(g,Sa,{passive:v}),I.set(g,1)):I.set(g,w+1)}}}};return f(Ri(ym)),wc.add(f),()=>{var v;for(var m of p)for(let I of[e,document]){var b=Ga.get(I),g=b.get(m);--g==0?(I.removeEventListener(m,Sa),b.delete(m),b.size===0&&Ga.delete(I)):b.set(m,g)}wc.delete(f),d!==t&&((v=d.parentNode)==null||v.removeChild(d))}});return Nc.set(l,u),l}var Nc=new WeakMap;function Xc(r,e){let t=Nc.get(r);return t?(Nc.delete(r),t(e)):(_&&Df(),Promise.resolve())}function Da(r){return function(...e){var t=e[0];return t.stopPropagation(),r==null?void 0:r.apply(this,e)}}function Na(r){return function(...e){var t=e[0];return t.preventDefault(),r==null?void 0:r.apply(this,e)}}function We(r){return new Uc(r)}var mn,dr,Uc=class{constructor(e){L(this,mn);L(this,dr);var o,s;var t=new Map,n=(a,l)=>{var u=ue(l,!1,!1);return t.set(a,u),u};let i=new Proxy({...e.props||{},$$events:{}},{get(a,l){var u;return y((u=t.get(l))!=null?u:n(l,Reflect.get(a,l)))},has(a,l){var u;return l===Go?!0:(y((u=t.get(l))!=null?u:n(l,Reflect.get(a,l))),Reflect.has(a,l))},set(a,l,u){var d;return W((d=t.get(l))!=null?d:n(l,u),u),Reflect.set(a,l,u)}});Z(this,dr,(e.hydrate?Zc:Ba)(e.component,{target:e.target,anchor:e.anchor,props:i,context:e.context,intro:(o=e.intro)!=null?o:!1,recover:e.recover,transformError:e.transformError})),!Le&&(!((s=e==null?void 0:e.props)!=null&&s.$$host)||e.sync===!1)&&N(),Z(this,mn,i.$$events);for(let a of Object.keys(h(this,dr)))a==="$set"||a==="$destroy"||a==="$on"||Ye(this,a,{get(){return h(this,dr)[a]},set(l){h(this,dr)[a]=l},enumerable:!0});h(this,dr).$set=a=>{Object.assign(i,a)},h(this,dr).$destroy=()=>{Xc(h(this,dr))}}$set(e){h(this,dr).$set(e)}$on(e,t){h(this,mn)[e]=h(this,mn)[e]||[];let n=(...i)=>t.call(this,...i);return h(this,mn)[e].push(n),()=>{h(this,mn)[e]=h(this,mn)[e].filter(i=>i!==n)}}$destroy(){h(this,dr).$destroy()}};mn=new WeakMap,dr=new WeakMap;var Em,Tm,Gm;typeof window!="undefined"&&((Gm=(Tm=(Em=window.__svelte)!=null?Em:window.__svelte={}).v)!=null?Gm:Tm.v=new Set).add("5");Af();var _r,Ur,er,ni,ns,is,Za,pn=class{constructor(e,t=!0){c(this,"anchor");L(this,_r,new Map);L(this,Ur,new Map);L(this,er,new Map);L(this,ni,new Set);L(this,ns,!0);L(this,is,e=>{if(h(this,_r).has(e)){var t=h(this,_r).get(e),n=h(this,Ur).get(t);if(n)ji(n),h(this,ni).delete(t);else{var i=h(this,er).get(t);i&&(ji(i.effect),h(this,Ur).set(t,i.effect),h(this,er).delete(t),_&&(i.fragment.lastChild[Yl]=this.anchor),i.fragment.lastChild.remove(),this.anchor.before(i.fragment),n=i.effect)}for(let[o,s]of h(this,_r)){if(h(this,_r).delete(o),o===e)break;let a=h(this,er).get(s);a&&(we(a.effect),h(this,er).delete(s))}for(let[o,s]of h(this,Ur)){if(o===t||h(this,ni).has(o))continue;let a=()=>{if(Array.from(h(this,_r).values()).includes(o)){var u=document.createDocumentFragment();zi(s,u),u.append(Xe()),h(this,er).set(o,{effect:s,fragment:u})}else we(s);h(this,ni).delete(o),h(this,Ur).delete(o)};h(this,ns)||!n?(h(this,ni).add(o),Nr(s,a,!1)):a()}}});L(this,Za,e=>{h(this,_r).delete(e);let t=Array.from(h(this,_r).values());for(let[n,i]of h(this,er))t.includes(n)||(we(i.effect),h(this,er).delete(n))});this.anchor=e,Z(this,ns,t)}ensure(e,t){var n=B,i=ba();if(t&&!h(this,Ur).has(e)&&!h(this,er).has(e))if(i){var o=document.createDocumentFragment(),s=Xe();o.append(s),h(this,er).set(e,{effect:Je(()=>t(s)),fragment:o})}else h(this,Ur).set(e,Je(()=>t(this.anchor)));if(h(this,_r).set(n,e),i){for(let[a,l]of h(this,Ur))a===e?n.unskip_effect(l):n.skip_effect(l);for(let[a,l]of h(this,er))a===e?n.unskip_effect(l.effect):n.skip_effect(l.effect);n.oncommit(h(this,is)),n.ondiscard(h(this,Za))}else S&&(this.anchor=$),h(this,is).call(this,n)}};_r=new WeakMap,Ur=new WeakMap,er=new WeakMap,ni=new WeakMap,ns=new WeakMap,is=new WeakMap,Za=new WeakMap;if(_){let r=function(e){if(!(e in globalThis)){let t;Object.defineProperty(globalThis,e,{configurable:!0,get:()=>{if(t!==void 0)return t;If(e)},set:n=>{t=n}})}};r("$state"),r("$effect"),r("$derived"),r("$inspect"),r("$props"),r("$bindable")}function qi(r){Y===null&&Fi("onMount"),Sr&&Y.l!==null?Nm(Y).m.push(r):Ji(()=>{let e=E(r);if(typeof e=="function")return e})}function ig(r,e,{bubbles:t=!1,cancelable:n=!1}={}){return new CustomEvent(r,{detail:e,bubbles:t,cancelable:n})}function eo(){let r=Y;return r===null&&Fi("createEventDispatcher"),(e,t,n)=>{var o;let i=(o=r.s.$$events)==null?void 0:o[e];if(i){let s=Wt(i)?i.slice():[i],a=ig(e,t,n);for(let l of s)l.call(r.x,a);return!a.defaultPrevented}return!0}}function Dm(r){Y===null&&Fi("afterUpdate"),Y.l===null&&vf("afterUpdate"),Nm(Y).a.push(r)}function Nm(r){var t;var e=r.l;return(t=e.u)!=null?t:e.u={a:[],b:[],m:[]}}function Qr(r,e,t=!1){var n;S&&(n=$,lt());var i=new pn(r),o=t?65536:0;function s(a,l){if(S){var u=Pn(n);if(a!==parseInt(u.substring(1))){var d=Gr();me(d),i.anchor=d,Me(!1),i.ensure(a,l),Me(!0);return}}i.ensure(a,l)}jt(()=>{var a=!1;e((l,u=0)=>{a=!0,s(u,l)}),a||s(-1,null)},o)}function Wc(r,e){return e}function fg(r,e,t){var p;for(var n=[],i=e.length,o,s=e.length,a=0;a<i;a++){let f=e[a];Nr(f,()=>{if(o){if(o.pending.delete(f),o.done.add(f),o.pending.size===0){var m=r.outrogroups;Qc(r,Ri(o.done)),m.delete(o),m.size===0&&(r.outrogroups=null)}}else s-=1},!1)}if(s===0){var l=n.length===0&&t!==null&&r.pending.size===0;if(l){var u=t,d=u.parentNode;Wo(d),d.append(u),r.items.clear()}Qc(r,e,!l)}else o={pending:new Set(e),done:new Set},((p=r.outrogroups)!=null?p:r.outrogroups=new Set).add(o)}function Qc(r,e,t=!0){var n;if(r.pending.size>0){n=new Set;for(let s of r.pending.values())for(let a of s)n.add(r.items.get(a).e)}for(var i=0;i<e.length;i++){var o=e[i];if(n!=null&&n.has(o)){o.f|=33554432;let s=document.createDocumentFragment();zi(o,s)}else we(e[i],t)}}var Gn;function Rt(r,e,t,n,i,o=null){var s=r,a=new Map,l=(e&4)!==0;if(l){var u=r;s=S?me(ut(u)):u.appendChild(Xe())}S&&lt();var d=null,p=nn(()=>{var w=t();return Wt(w)?w:w==null?[]:Ri(w)});_&&vt(p,"{#each ...}");var f=new Map,m=!0;function b(w){if((I.effect.f&16384)===0){I.pending.delete(w);var x=y(p);I.fallback=d,mg(I,x,s,e,n),d!==null&&(x.length===0?(d.f&33554432)===0?ji(d):(d.f^=33554432,ss(d,null,s)):Nr(d,()=>{d=null}))}}function g(w){I.pending.delete(w)}var v=jt(()=>{var w=y(p),x=w.length;let X=!1;if(S){var K=Pn(s)==="[!";K!==(x===0)&&(s=Gr(),me(s),Me(!1),X=!0)}for(var V=new Set,le=B,De=ba(),ye=0;ye<x;ye+=1){S&&$.nodeType===sr&&$.data==="]"&&(s=$,X=!0,Me(!1));var Ke=w[ye],Ie=n(Ke,ye);if(_){var Zt=n(Ke,ye);Ie!==Zt&&ff(String(ye),String(Ie),String(Zt))}var ke=m?null:a.get(Ie);ke?(ke.v&&br(ke.v,Ke),ke.i&&br(ke.i,ye),De&&le.unskip_effect(ke.e)):(ke=pg(a,m?s:Gn!=null?Gn:Gn=Xe(),Ke,Ie,ye,i,e,t),m||(ke.e.f|=33554432),a.set(Ie,ke)),V.add(Ie)}if(x===0&&o&&!d&&(m?d=Je(()=>o(s)):(d=Je(()=>o(Gn!=null?Gn:Gn=Xe())),d.f|=33554432)),x>V.size&&(_?hg(w,n):Jl("","","")),S&&x>0&&me(Gr()),!m)if(f.set(le,V),De){for(let[ft,Xt]of a)V.has(ft)||le.skip_effect(Xt.e);le.oncommit(b),le.ondiscard(g)}else b(le);X&&Me(!0),y(p)}),I={effect:v,flags:e,items:a,pending:f,outrogroups:null,fallback:d};m=!1,S&&(s=$)}function os(r){for(;r!==null&&(r.f&32)===0;)r=r.next;return r}function mg(r,e,t,n,i){var Ke,Ie,Zt,ke,ft,Xt,rr,T,ce;var o=(n&8)!==0,s=e.length,a=r.items,l=os(r.effect.first),u,d=null,p,f=[],m=[],b,g,v,I;if(o)for(I=0;I<s;I+=1)b=e[I],g=i(b,I),v=a.get(g).e,(v.f&33554432)===0&&((Ie=(Ke=v.nodes)==null?void 0:Ke.a)==null||Ie.measure(),(p!=null?p:p=new Set).add(v));for(I=0;I<s;I+=1){if(b=e[I],g=i(b,I),v=a.get(g).e,r.outrogroups!==null)for(let R of r.outrogroups)R.pending.delete(v),R.done.delete(v);if((v.f&8192)!==0&&(ji(v),o&&((ke=(Zt=v.nodes)==null?void 0:Zt.a)==null||ke.unfix(),(p!=null?p:p=new Set).delete(v))),(v.f&33554432)!==0)if(v.f^=33554432,v===l)ss(v,null,t);else{var w=d?d.next:l;v===r.effect.last&&(r.effect.last=v.prev),v.prev&&(v.prev.next=v.next),v.next&&(v.next.prev=v.prev),Bn(r,d,v),Bn(r,v,w),ss(v,w,t),d=v,f=[],m=[],l=os(d.next);continue}if(v!==l){if(u!==void 0&&u.has(v)){if(f.length<m.length){var x=m[0],X;d=x.prev;var K=f[0],V=f[f.length-1];for(X=0;X<f.length;X+=1)ss(f[X],x,t);for(X=0;X<m.length;X+=1)u.delete(m[X]);Bn(r,K.prev,V.next),Bn(r,d,K),Bn(r,V,x),l=x,d=V,I-=1,f=[],m=[]}else u.delete(v),ss(v,l,t),Bn(r,v.prev,v.next),Bn(r,v,d===null?r.effect.first:d.next),Bn(r,d,v),d=v;continue}for(f=[],m=[];l!==null&&l!==v;)(u!=null?u:u=new Set).add(l),m.push(l),l=os(l.next);if(l===null)continue}(v.f&33554432)===0&&f.push(v),d=v,l=os(v.next)}if(r.outrogroups!==null){for(let R of r.outrogroups)R.pending.size===0&&(Qc(r,Ri(R.done)),(ft=r.outrogroups)==null||ft.delete(R));r.outrogroups.size===0&&(r.outrogroups=null)}if(l!==null||u!==void 0){var le=[];if(u!==void 0)for(v of u)(v.f&8192)===0&&le.push(v);for(;l!==null;)(l.f&8192)===0&&l!==r.fallback&&le.push(l),l=os(l.next);var De=le.length;if(De>0){var ye=(n&4)!==0&&s===0?t:null;if(o){for(I=0;I<De;I+=1)(rr=(Xt=le[I].nodes)==null?void 0:Xt.a)==null||rr.measure();for(I=0;I<De;I+=1)(ce=(T=le[I].nodes)==null?void 0:T.a)==null||ce.fix()}fg(r,le,ye)}}o&&Ze(()=>{var R,ie;if(p!==void 0)for(v of p)(ie=(R=v.nodes)==null?void 0:R.a)==null||ie.apply()})}function pg(r,e,t,n,i,o,s,a){var l=(s&1)!==0?(s&16)===0?ue(t,!1,!1):It(t):null,u=(s&2)!==0?It(i):null;return _&&l&&(l.trace=()=>{var d;a()[(d=u==null?void 0:u.v)!=null?d:i]}),{v:l,i:u,e:Je(()=>(o(e,l!=null?l:t,u!=null?u:i,a),()=>{r.delete(n)}))}}function ss(r,e,t){if(r.nodes)for(var n=r.nodes.start,i=r.nodes.end,o=e&&(e.f&33554432)===0?e.nodes.start:t;n!==null;){var s=ct(n);if(o.before(n),n===i)return;n=s}}function Bn(r,e,t){e===null?r.effect.first=t:e.next=t,t===null?r.effect.last=e:t.prev=e}function hg(r,e){let t=new Map,n=r.length;for(let i=0;i<n;i++){let o=e(r[i],i);if(t.has(o)){let s=String(t.get(o)),a=String(i),l=String(o);l.startsWith("[object ")&&(l=null),Jl(s,a,l)}t.set(o,i)}}function Vc(r,e,t,n,i){var a,l;if(S&&lt(),(a=e.$$host)!=null&&a.$$shadowRoot){let u=hr("slot");if(t!=="default"&&(u.name=t),J(r,u),i!==null){let d=Xe();u.append(d),i(d)}return}var o=(l=e.$$slots)==null?void 0:l[t],s=!1;o===!0&&(o=e[t==="default"?"children":t],s=!0),o===void 0?i!==null&&i(r):o(r,s?()=>n:n)}var Um=[...`
\r\f\xA0\v\uFEFF`];function Qm(r,e,t){var n=r==null?"":""+r;if(e&&(n=n?n+" "+e:e),t){for(var i of Object.keys(t))if(t[i])n=n?n+" "+i:i;else if(n.length)for(var o=i.length,s=0;(s=n.indexOf(i,s))>=0;){var a=s+o;(s===0||Um.includes(n[s-1]))&&(a===n.length||Um.includes(n[a]))?n=(s===0?"":n.substring(0,s))+n.substring(a+1):s=a}}return n===""?null:n}function Vr(r,e,t,n,i,o){var s=r[Bo];if(S||s!==t||s===void 0){var a=Qm(t,n,o);(!S||a!==r.getAttribute("class"))&&(a==null?r.removeAttribute("class"):e?r.className=a:r.setAttribute("class",a)),r[Bo]=t}else if(o&&i!==o)for(var l in o){var u=!!o[l];(i==null||u!==!!i[l])&&r.classList.toggle(l,u)}return o}function as(r,e){e?r.hasAttribute("selected")||r.setAttribute("selected",""):r.removeAttribute("selected")}function yg(r,e){var t=r.__defaultValue,n=r.multiple,i=n?t!=null?t:[]:null;if(!(n&&!Wt(i))){var o=r.selectedIndex,s=e&&n?new Set(r.selectedOptions):null;for(var a of r.options){var l=to(a);as(a,n?i.includes(l):pa(l,t))}if(e)if(s!==null)for(a of r.options){var u=s.has(a);a.selected!==u&&(a.selected=u)}else r.selectedIndex!==o&&(r.selectedIndex=o)}}function Xa(r,e,t=!1){if(r.multiple){if(e==null)return;if(!Wt(e))return Nf();for(var n of r.options)n.selected=e.includes(to(n));return}for(n of r.options){var i=to(n);if(pa(i,e)){n.selected=!0;return}}(!t||e!==void 0)&&(r.selectedIndex=-1)}function ro(r){var e=new MutationObserver(t=>{t.every(Ig)||("__defaultValue"in r&&yg(r,!1),"__value"in r&&Xa(r,r.__value))});e.observe(r,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["value"]}),Pe(()=>{e.disconnect()})}function ls(r,e,t=e){var n=new WeakSet,i=!0;_a(r,"change",o=>{var u;var s=o?"[selected]":":checked",a;if(r.multiple)a=[].map.call(r.querySelectorAll(s),to);else{var l=(u=r.querySelector(s))!=null?u:r.querySelector("option:not([disabled])");a=l&&to(l)}t(a),r.__value=a,B!==null&&n.add(B)}),Jt(()=>{var o=e();if(r===document.activeElement){var s=Le?Mt:B;if(n.has(s))return}if(Xa(r,o,i),i&&o===void 0){var a=r.querySelector(":checked");a!==null&&(o=to(a),t(o))}r.__value=o,i=!1})}function to(r){return"__value"in r?r.__value:r.value}function Ig(r){if(r.target.closest("selectedcontent")!==null)return!0;if(r.type==="childList"){var e=[...r.addedNodes,...r.removedNodes];return e.length>0&&e.every(t=>t.nodeName==="SELECTEDCONTENT")}return!1}var kg=Symbol("is custom element"),Fg=Symbol("is html"),Sg=Ll?"link":"LINK";function Lc(r){if(S){var e=!1,t=()=>{if(!e){if(e=!0,r.hasAttribute("value")){var n=r.value;Cr(r,"value",null),r.value=n}if(r.hasAttribute("checked")){var i=r.checked;Cr(r,"checked",null),r.checked=i}}};r[xn]=t,Ze(t),Ia()}}function Cr(r,e,t,n){var i=Eg(r);if(S&&(i[e]=r.getAttribute(e),e==="src"||e==="srcset"||e==="href"&&r.nodeName===Sg)){n||Gg(r,e,t!=null?t:"");return}i[e]!==(i[e]=t)&&(e==="loading"&&(r[ef]=t),t==null?r.removeAttribute(e):typeof t!="string"&&Tg(r).has(e)?r[e]=t:r.setAttribute(e,t))}function Eg(r){var e,t;return(t=r[e=ia])!=null?t:r[e]={[kg]:r.nodeName.includes("-"),[Fg]:r.namespaceURI===ca}}var Wm=new Map;function Tg(r){var e=r.getAttribute("is")||r.nodeName,t=Wm.get(e);if(t)return t;Wm.set(e,t=new Set);for(var n,i=r,o=Element.prototype;o!==i;){n=oa(i);for(var s in n)n[s].set&&s!=="innerHTML"&&s!=="textContent"&&s!=="innerText"&&t.add(s);i=Ln(i)}return t}function Gg(r,e,t){var n;_&&(e==="srcset"&&Bg(r,t)||Yc((n=r.getAttribute(e))!=null?n:"",t)||Bf(e,r.outerHTML.replace(r.innerHTML,r.innerHTML&&"..."),String(t)))}function Yc(r,e){return r===e?!0:new URL(r,document.baseURI).href===new URL(e,document.baseURI).href}function Vm(r){return r.split(",").map(e=>e.trim().split(" ").filter(Boolean))}function Bg(r,e){var t=Vm(r.srcset),n=Vm(e);return n.length===t.length&&n.every(([i,o],s)=>o===t[s][1]&&(Yc(t[s][0],i)||Yc(i,t[s][0])))}function $c(r,e,t=e){var n=new WeakSet;_a(r,"input",async i=>{_&&r.type==="checkbox"&&Hl();var o=i?r.defaultValue:r.value;if(o=Mc(r)?Oc(o):o,t(o),B!==null&&n.add(B),await dn(),o!==(o=e())){var s=r.selectionStart,a=r.selectionEnd,l=r.value.length;if(r.value=o!=null?o:"",a!==null){var u=r.value.length;s===a&&a===l&&u>l?(r.selectionStart=u,r.selectionEnd=u):(r.selectionStart=s,r.selectionEnd=Math.min(a,u))}}}),(S&&r.defaultValue!==r.value||E(e)==null&&r.value)&&(t(Mc(r)?Oc(r.value):r.value),B!==null&&n.add(B)),He(()=>{_&&r.type==="checkbox"&&Hl();var i=e();if(r===document.activeElement){var o=Le?Mt:B;if(n.has(o))return}Mc(r)&&i===Oc(r.value)||r.type==="date"&&!i&&!r.value||i!==r.value&&(r.value=i!=null?i:"")})}function Mc(r){var e=r.type;return e==="number"||e==="range"}function Oc(r){return r===""?null:+r}function Pc(r,e,t){var n=Ct(r,e);n&&n.set&&(r[e]=t,Pe(()=>{r[e]=null}))}function Hc(r,e){return r===e||(r==null?void 0:r[it])===e}function tt(r=Zo(),e,t,n){var i=Y.r,o=k;return Jt(()=>{var s,a;return He(()=>{s=a,a=(n==null?void 0:n())||[],E(()=>{Hc(t(...a),r)||(e(r,...a),s&&Hc(t(...s),r)&&e(null,...s))})}),()=>{let l=o;for(;l!==i&&l.parent!==null&&l.parent.f&33554432;)l=l.parent;let u=()=>{a&&Hc(t(...a),r)&&e(null,...a)},d=l.teardown;l.teardown=()=>{u(),d==null||d()}}}),r}function dt(r=!1){let e=Y,t=e.l.u;if(!t)return;let n=()=>Qe(e.s);if(r){let i=0,o={},s=kn(()=>{let a=!1,l=e.s;for(let u in l)l[u]!==o[u]&&(o[u]=l[u],a=!0);return a&&i++,i});n=()=>y(s)}t.b.length&&zo(()=>{Lm(e,n),ki(t.b)}),Ji(()=>{let i=E(()=>t.m.map(af));return()=>{for(let o of i)typeof o=="function"&&o()}}),t.a.length&&Ji(()=>{Lm(e,n),ki(t.a)})}function Lm(r,e){if(r.l.s)for(let t of r.l.s)y(t);e()}function Jc(r,e){var o;var t=(o=r.$$events)==null?void 0:o[e.type],n=Wt(t)?t.slice():t==null?[]:[t];for(var i of n)i.call(this,e)}function je(r,e,t){var n;r.$$events||(r.$$events={}),(n=r.$$events)[e]||(n[e]=[]),r.$$events[e].push(t)}function ze(r){for(var e in r)e in this&&(this[e]=r[e])}var Qa=!1;function jc(r){var e=Qa;try{return Qa=!1,[r(),Qa]}finally{Qa=e}}function M(r,e,t,n){var X,K;var i=!Sr||(t&2)!==0,o=(t&8)!==0,s=(t&16)!==0,a=n,l=!0,u=void 0,d=()=>s&&i?(u!=null||(u=kn(n)),y(u)):(l&&(l=!1,a=s?E(n):n),a);let p;if(o){var f=it in r||Go in r;p=(K=(X=Ct(r,e))==null?void 0:X.set)!=null?K:f&&e in r?V=>r[e]=V:void 0}var m,b=!1;o?[m,b]=jc(()=>r[e]):m=r[e],m===void 0&&n!==void 0&&(m=d(),p&&(i&&yf(e),p(m)));var g;if(i?g=()=>{var V=r[e];return V===void 0?d():(l=!0,V)}:g=()=>{var V=r[e];return V!==void 0&&(a=void 0),V===void 0?a:V},i&&(t&4)===0)return g;if(p){var v=r.$$legacy;return(function(V,le){return arguments.length>0?((!i||!le||v||b)&&p(le?g():V),V):g()})}var I=!1,w=((t&1)!==0?kn:nn)(()=>(I=!1,g()));_&&(w.label=e),o&&y(w);var x=k;return(function(V,le){if(arguments.length>0){let De=le?y(w):i&&o?en(V):V;return W(w,De),I=!0,a!==void 0&&(a=De),V}return Ot&&I||(x.f&16384)!==0?w.v:y(w)})}var Vg;typeof HTMLElement=="function"&&(Vg=class extends HTMLElement{constructor(e,t,n){super();c(this,"$$ctor");c(this,"$$s");c(this,"$$c");c(this,"$$cn",!1);c(this,"$$d",{});c(this,"$$r",!1);c(this,"$$p_d",{});c(this,"$$l",{});c(this,"$$l_u",new Map);c(this,"$$me");c(this,"$$shadowRoot",null);this.$$ctor=e,this.$$s=t,n&&(this.$$shadowRoot=this.attachShadow(n))}addEventListener(e,t,n){if(this.$$l[e]=this.$$l[e]||[],this.$$l[e].push(t),this.$$c){let i=this.$$c.$on(e,t);this.$$l_u.set(t,i)}super.addEventListener(e,t,n)}removeEventListener(e,t,n){if(super.removeEventListener(e,t,n),this.$$c){let i=this.$$l_u.get(t);i&&(i(),this.$$l_u.delete(t))}}async connectedCallback(){if(this.$$cn=!0,!this.$$c){let e=function(i){return o=>{let s=hr("slot");i!=="default"&&(s.name=i),J(o,s)}};if(await Promise.resolve(),!this.$$cn||this.$$c)return;let t={},n=Yg(this);for(let i of this.$$s)i in n&&(i==="default"&&!this.$$d.children?(this.$$d.children=e(i),t.default=!0):t[i]=e(i));for(let i of this.attributes){let o=this.$$g_p(i.name);o in this.$$d||(this.$$d[o]=zc(o,i.value,this.$$p_d,"toProp"))}for(let i in this.$$p_d)!(i in this.$$d)&&this[i]!==void 0&&(this.$$d[i]=this[i],delete this[i]);this.$$c=We({component:this.$$ctor,target:this.$$shadowRoot||this,props:{...this.$$d,$$slots:t,$$host:this}}),this.$$me=_c(()=>{He(()=>{var i;this.$$r=!0;for(let o of Ml(this.$$c)){if(!((i=this.$$p_d[o])!=null&&i.reflect))continue;this.$$d[o]=this.$$c[o];let s=zc(o,this.$$d[o],this.$$p_d,"toAttribute");s==null?this.removeAttribute(this.$$p_d[o].attribute||o):this.setAttribute(this.$$p_d[o].attribute||o,s)}this.$$r=!1})});for(let i in this.$$l)for(let o of this.$$l[i]){let s=this.$$c.$on(i,o);this.$$l_u.set(o,s)}this.$$l={}}}attributeChangedCallback(e,t,n){var i;this.$$r||(e=this.$$g_p(e),this.$$d[e]=zc(e,n,this.$$p_d,"toProp"),(i=this.$$c)==null||i.$set({[e]:this.$$d[e]}))}disconnectedCallback(){this.$$cn=!1,Promise.resolve().then(()=>{!this.$$cn&&this.$$c&&(this.$$c.$destroy(),this.$$me(),this.$$c=void 0)})}$$g_p(e){return Ml(this.$$p_d).find(t=>this.$$p_d[t].attribute===e||!this.$$p_d[t].attribute&&t.toLowerCase()===e)||e}});function zc(r,e,t,n){var o;let i=(o=t[r])==null?void 0:o.type;if(e=i==="Boolean"&&typeof e!="boolean"?e!=null:e,!n||!t[r])return e;if(n==="toAttribute")switch(i){case"Object":case"Array":return e==null?null:JSON.stringify(e);case"Boolean":return e?"":null;case"Number":return e==null?null:e;default:return e}else switch(i){case"Object":case"Array":return e&&JSON.parse(e);case"Boolean":return e;case"Number":return e!=null?+e:e;default:return e}}function Yg(r){let e={};return r.childNodes.forEach(t=>{e[t.slot||"default"]=!0}),e}var Mm=require("obsidian");var Lg=ne('<span><span class="reminder-markdown"></span></span>');function no(r,e){if(new.target)return We({component:no,...r});Se(e,!1);let t=M(e,"sourcePath",12),n=M(e,"markdown",12),i=ue();Dm(()=>{y(i).empty(),Mm.MarkdownRenderer.renderMarkdown(n(),y(i),t(),window.app.plugins.plugins["obsidian-reminder-plugin"]),y(i).childNodes.forEach(l=>{l instanceof HTMLElement&&(l.style.display="inline")})});var o={get sourcePath(){return t()},set sourcePath(l){t(l),N()},get markdown(){return n()},set markdown(l){n(l),N()},$set:ze,$on:(l,u)=>je(e,l,u)};dt();var s=Lg(),a=H(s);return tt(a,l=>W(i,l),()=>y(i)),Q(s),J(r,s),Ee(o)}var Mg=ne('<div class="reminder-list-item no-reminders svelte-18c89ir">No reminders</div>'),Og=ne('<button class="reminder-list-item hover-highlight svelte-18c89ir" draggable="true"><span class="reminder-time svelte-18c89ir"> </span> <div class="reminder-title-container svelte-18c89ir"><span class="reminder-title svelte-18c89ir"><!></span> <span class="reminder-file svelte-18c89ir"> </span></div></button>'),$g=ne("<div></div>"),Pg=ne('<div class="reminder-group svelte-18c89ir"><!></div>');function io(r,e){if(new.target)return We({component:io,...r});Se(e,!1);let t=M(e,"reminders",12),n=M(e,"onOpenReminder",12,()=>{}),i=M(e,"timeToString",12,f=>f.format("HH:mm")),o=M(e,"generateLink",12,()=>"");function s(f){return`[${f.time.toString()}] ${f.title} - ${f.getFileName()}`}var a={get reminders(){return t()},set reminders(f){t(f),N()},get onOpenReminder(){return n()},set onOpenReminder(f){n(f),N()},get timeToString(){return i()},set timeToString(f){i(f),N()},get generateLink(){return o()},set generateLink(f){o(f),N()},$set:ze,$on:(f,m)=>je(e,f,m)};dt();var l=Pg(),u=H(l);{var d=f=>{var m=Mg();J(f,m)},p=f=>{var m=$g();Rt(m,5,t,b=>b.key(),(b,g)=>{var v=Og(),I=H(v),w=Te(I,!0),x=se(I,2),X=H(x),K=H(X);no(K,{get markdown(){return y(g),E(()=>y(g).title)},get sourcePath(){return y(g),E(()=>y(g).file)}}),Q(X);var V=se(X,2),le=Te(V,!0);Q(x),Q(v),Ae((De,ye,Ke,Ie)=>{Cr(v,"aria-label",De),Cr(v,"title",ye),Re(w,Ke),Re(le,Ie)},[()=>(y(g),E(()=>s(y(g)))),()=>(y(g),E(()=>s(y(g)))),()=>(Qe(i()),y(g),E(()=>i()(y(g).time))),()=>(y(g),E(()=>y(g).getFileName()))]),z("dragstart",v,De=>{var ye;(ye=De.dataTransfer)==null||ye.setData("text/plain",o()(y(g)))}),z("click",v,()=>{n()(y(g))}),J(b,v)}),Q(m),J(f,m)};Qr(u,f=>{Qe(t()),E(()=>t().length===0)?f(d):f(p,-1)})}return Q(l),J(r,l),Ee(a)}var Hg=ne('<span class="group-count svelte-6tg2e0"> </span>'),Jg=ne("<div> <!></div> <!>",1),jg=ne("<main><div></div></main>");function Wa(r,e){if(new.target)return We({component:Wa,...r});Se(e,!1);let t=M(e,"groups",12),n=M(e,"onOpenReminder",12),i=M(e,"generateLink",12);var o={get groups(){return t()},set groups(l){t(l),N()},get onOpenReminder(){return n()},set onOpenReminder(l){n(l),N()},get generateLink(){return i()},set generateLink(l){i(l),N()},$set:ze,$on:(l,u)=>je(e,l,u)},s=jg(),a=H(s);return Rt(a,5,t,l=>l.name,(l,u)=>{var d=Jg(),p=Di(d);let f;var m=H(p),b=se(m);{var g=I=>{var w=Hg(),x=Te(w,!0);Ae(()=>Re(x,(y(u),E(()=>y(u).reminders.length)))),J(I,w)};Qr(b,I=>{y(u),E(()=>y(u).reminders.length>0)&&I(g)})}Q(p);var v=se(p,2);io(v,{get reminders(){return y(u),E(()=>y(u).reminders)},get onOpenReminder(){return n()},timeToString:I=>y(u).timeToString(I),get generateLink(){return i()}}),Ae(()=>{var I;f=Vr(p,1,"group-name svelte-6tg2e0",null,f,{"group-name-overdue":y(u).isOverdue}),Re(m,`${(I=(y(u),E(()=>y(u).name)))!=null?I:""} `)}),J(l,d)}),Q(a),Q(s),J(r,s),Ee(o)}var Va=class extends La.ItemView{constructor(t,n,i){super(n);c(this,"plugin",t);c(this,"onOpenReminder",i);c(this,"view")}getViewType(){return kr}getDisplayText(){return"Reminders"}getIcon(){return"clock"}async onOpen(){this.view=new Wa({target:this.contentEl,props:{groups:this.remindersForView(),onOpenReminder:this.onOpenReminder,generateLink:t=>{let n=this.app.vault.getAbstractFileByPath(t.file),i=this.app.workspace.getActiveFile(),o;return!(n instanceof La.TFile)||i==null?o=`[[${t.getFileName()}]]`:o=this.app.fileManager.generateMarkdownLink(n,i.path),`${t.title} - ${o}`}}})}reload(){this.view!=null&&this.view.$set({groups:this.remindersForView(),onOpenReminder:this.onOpenReminder})}remindersForView(){return Hu(this.plugin.reminders.reminders,this.plugin.settings.reminderTime.value,{yearMonthFormat:this.plugin.settings.yearMonthDisplayFormat.value,monthDayFormat:this.plugin.settings.monthDayDisplayFormat.value,shortDateWithWeekdayFormat:this.plugin.settings.shortDateWithWeekdayDisplayFormat.value,timeFormat:this.plugin.settings.timeDisplayFormat.value})}onClose(){return this.view&&this.view.$destroy(),Promise.resolve()}},Ya=class{constructor(e,t){c(this,"plugin",e);c(this,"onOpenReminder",t);c(this,"valid",!1);[this.plugin.settings.yearMonthDisplayFormat,this.plugin.settings.monthDayDisplayFormat,this.plugin.settings.shortDateWithWeekdayDisplayFormat,this.plugin.settings.timeDisplayFormat].forEach(i=>{i.rawValue.onChanged(()=>{this.invalidate(),this.reload(!0)})})}createView(e){return new Va(this.plugin,e,this.onOpenReminder)}openView(){var e;this.plugin.app.workspace.getLeavesOfType(kr).length||(e=this.plugin.app.workspace.getRightLeaf(!1))==null||e.setViewState({type:kr})}reload(e=!1){if(e||!this.valid){let t=this.getViews();t.length>0?(t.forEach(n=>n==null?void 0:n.reload()),this.valid=!0):(this.valid=!1,console.debug("view is null. Skipping reminder list view reload"))}}getViews(){return this.plugin.app.workspace.getLeavesOfType(kr).map(e=>e&&e.view instanceof Va?e.view:null).filter(e=>e!=null)}invalidate(){this.valid=!1}};var $m=require("obsidian");var eu=require("obsidian");var Kc=class{constructor(e){c(this,"date",e)}isToday(e){return this.date===void 0?!1:this.date.date()===e.date()&&this.date.month()===e.month()&&this.date.year()===e.year()}isHoliday(){return[0,6].includes(this.date.day())}},qc=class{constructor(e){c(this,"weekStart",e);c(this,"days",[]);let t=e.clone();for(let n=0;n<7;n++)this.days.push(new Kc(t.clone())),t.add(1,"day")}get key(){return this.weekStart.valueOf()}},Ma=class{constructor(e,t){c(this,"monthStart",e);c(this,"weeks",[]);c(this,"weekStart");this.weekStart=t||0;let n=e.clone().add(-(e.day()-this.weekStart+7)%7,"day");for(let i=0;i<6&&!(i>0&&!this.isThisMonth(n));i++)this.weeks.push(new qc(n.clone())),n.add(1,"week")}isThisMonth(e){return this.monthStart.month()===e.month()&&this.monthStart.year()===e.year()}},cs=class r{constructor(e,t,n){c(this,"_current");c(this,"today");c(this,"weekStart");this.weekStart=n||0,e?this.today=e:this.today=P(),t?this._current=new Ma(t.clone().set("date",1),this.weekStart):this._current=new Ma(this.today.clone().set("date",1),this.weekStart)}nextMonth(){return new r(this.today,this._current.monthStart.clone().add(1,"month"),this.weekStart)}previousMonth(){return new r(this.today,this._current.monthStart.clone().add(-1,"month"),this.weekStart)}calendarString(){let e=Array.from({length:7},(n,i)=>P().day((this.weekStart+i)%7).format("ddd")).join(" "),t=`${this._current.monthStart.format("YYYY, MMM")}
${e}
`;return this._current.weeks.forEach(n=>{let i=" ";n.days.forEach(o=>{let s;o.date&&this._current.isThisMonth(o.date)?s=o.date.format("DD"):s=" ",i=i+s+" "}),t=t+i+`
`}),t}get current(){return this._current}};var oo=class{constructor(){c(this,"digits",[]);c(this,"lastInput",0)}handle(e){let t=new Date().getTime();return t-this.lastInput>1e3&&this.clear(),this.lastInput=t,this.digits.push(e),this.digits.join("")}clear(){this.digits=[]}};var zg=ne('<th class="svelte-1lru178"> </th>'),Kg=ne('<td><button tabindex="-1"> </button></td>'),qg=ne("<tr></tr>"),eb=ne('<div class="reminder-calendar svelte-1lru178" tabindex="0" role="grid"><div class="year-month svelte-1lru178"><button tabindex="-1" class="month-nav svelte-1lru178">&lt;</button> <span class="month svelte-1lru178"> </span> <span class="year svelte-1lru178"> </span> <button tabindex="-1" class="month-nav svelte-1lru178">&gt;</button></div> <table><thead><tr></tr></thead><tbody></tbody></table> <div class="footer"><!></div></div>');function Oa(r,e){if(new.target)return We({component:Oa,...r});Se(e,!1);let t=ue(),n=ue(),i=M(e,"value",28,P),o=M(e,"weekStart",12,0),s=eo(),a=ue(),l=ue(),u=ue();function d(){y(u).focus()}function p(T){i(T)}function f(T){i(T),g()}function m(){i(i().add(-1,"month"))}function b(){i(i().add(1,"month"))}function g(){s("select",i())}let v=new oo;function I(T){if(T.key>="0"&&T.key<="9"){T.preventDefault();let ce=v.handle(T.key);switch(ce.length){case 1:{let R=parseInt(ce);R>0&&i(i().set("date",R));break}case 2:ce.startsWith("0")&&(ce=ce.slice(1)),i(i().set("date",parseInt(ce)));break;case 4:{let R=ce.slice(0,2),ie=ce.slice(2,4);R.startsWith("0")&&(R=R.slice(1)),ie.startsWith("0")&&(ie=ie.slice(1)),i(i().set("month",parseInt(R)-1)),i(i().set("date",parseInt(ie)))}break}return}v.clear(),T.key==="ArrowLeft"||T.ctrlKey&&T.key==="B"?(i(i().add(-1,"day")),T.preventDefault()):T.key==="ArrowRight"||T.ctrlKey&&T.key==="F"?(i(i().add(1,"day")),T.preventDefault()):T.key==="ArrowUp"||T.ctrlKey&&T.key==="P"?i(i().add(-7,"day")):T.key==="ArrowDown"||T.ctrlKey&&T.key==="N"?(i(i().add(7,"day")),T.preventDefault()):T.key==="Enter"&&(g(),T.preventDefault())}qi(()=>{gc(l,y(l).style.width=y(a).clientWidth+"px")}),Sn(()=>(cs,P,Qe(i()),Qe(o())),()=>{W(t,new cs(P().startOf("day"),i().startOf("day"),o()))}),Sn(()=>(P,y(t)),()=>{W(n,Array.from({length:7},(T,ce)=>P().day((y(t).weekStart+ce)%7).format("ddd")))}),Ko();var w={focus:d,get value(){return i()},set value(T){i(T),N()},get weekStart(){return o()},set weekStart(T){o(T),N()},$set:ze,$on:(T,ce)=>je(e,T,ce)};dt();var x=eb(),X=H(x),K=H(X),V=se(K,2),le=Te(V,!0),De=se(V,2),ye=Te(De,!0),Ke=se(De,2);Q(X);var Ie=se(X,2),Zt=H(Ie),ke=H(Zt);Rt(ke,5,()=>y(n),T=>T,(T,ce)=>{var R=zg(),ie=Te(R,!0);Ae(()=>Re(ie,y(ce))),J(T,R)}),Q(ke),Q(Zt);var ft=se(Zt);Rt(ft,5,()=>(y(t),E(()=>y(t).current.weeks)),T=>T.key,(T,ce)=>{var R=qg();Rt(R,5,()=>(y(ce),E(()=>y(ce).days)),ie=>ie.date.valueOf(),(ie,Ce)=>{var C=Kg(),oe=H(C);let mt;var qe=Te(oe,!0);Q(C),Ae((kt,Ve,Nn,Ft,gn)=>{mt=Vr(oe,1,"calendar-date svelte-1lru178",null,mt,{"is-selected":kt,"other-month":Ve,"is-holiday":Nn,"is-past":Ft}),Re(qe,gn)},[()=>y(Ce).isToday(i()),()=>!y(t).current.isThisMonth(y(Ce).date),()=>y(Ce).isHoliday(),()=>y(Ce).date.isBefore(y(t).today),()=>(y(Ce),E(()=>y(Ce).date.format("D")))]),z("click",oe,()=>p(y(Ce).date)),z("dblclick",oe,()=>f(y(Ce).date)),J(ie,C)}),Q(R),J(T,R)}),Q(ft),Q(Ie),tt(Ie,T=>W(a,T),()=>y(a));var Xt=se(Ie,2),rr=H(Xt);return Vc(rr,e,"footer",{},null),Q(Xt),tt(Xt,T=>W(l,T),()=>y(l)),Q(x),tt(x,T=>W(u,T),()=>y(u)),Ae((T,ce)=>{Re(le,T),Re(ye,ce)},[()=>(y(t),E(()=>y(t).current.monthStart.format("MMM"))),()=>(y(t),E(()=>y(t).current.monthStart.format("YYYY")))]),z("click",K,()=>m()),z("click",Ke,()=>b()),z("focus",x,()=>{s("focus")}),z("blur",x,()=>{s("blur")}),z("keydown",x,I),J(r,x),Pc(e,"focus",d),Ee(w)}var tb=ne("<option> </option>"),rb=ne('<select class="time-picker svelte-16e079f"></select>');function $a(r,e){if(new.target)return We({component:$a,...r});Se(e,!1);let t=M(e,"value",12,"00:00"),n=M(e,"step",12,15),i=eo();function o(){i("select",t())}function s(){i("focus")}function a(){i("blur")}function l(){let b=[];for(let g=0;g<1440;g+=n()){let v=Math.floor(g/60),I=g%60;b.push(`${v.toString().padStart(2,"0")}:${I.toString().padStart(2,"0")}`)}return b}let u=l(),d=new oo;function p(b){if(b.key>="0"&&b.key<="9"){b.preventDefault();let g=d.handle(b.key);switch(g.length){case 1:{let v=g.padStart(2,"0"),I=u.filter(w=>w.startsWith(v));I.length>1&&t(I[0])}break;case 2:{let v=g+":",I=u.filter(w=>w.startsWith(v));I.length>1&&t(I[0]);break}case 4:{let v=g.slice(0,2)+":"+g.slice(2,4);u.includes(v)&&t(v)}break}return}if(d.clear(),b.key==="Enter"){o(),b.preventDefault();return}}var f={get value(){return t()},set value(b){t(b),N()},get step(){return n()},set step(b){n(b),N()},$set:ze,$on:(b,g)=>je(e,b,g)};dt();var m=rb();return Rt(m,5,()=>u,b=>b,(b,g)=>{var v=tb(),I=Te(v,!0),w={};Ae(()=>{var x;Re(I,y(g)),w!==(w=y(g))&&(v.value=(x=v.__value=w)!=null?x:"")}),J(b,v)}),Q(m),ro(m),ls(m,t),z("dblclick",m,o),z("focus",m,s),z("blur",m,a),z("keydown",m,p),J(r,m),Ee(f)}var nb=ne('<div slot="footer"><hr class="dtchooser-divider svelte-1twe6ts"/> <!></div>'),ib=ne('<div class="dtchooser-calendar-area svelte-1twe6ts"><button type="button" class="dtchooser-mode-toggle dtchooser-mode-toggle-overlay svelte-1twe6ts" aria-label="Show quick date picks" title="Show quick date picks"><span class="dtchooser-mode-toggle-icon svelte-1twe6ts"></span></button> <!></div> <div class="dtchooser-wrapper svelte-1twe6ts"><div class="dtchooser-time-picker svelte-1twe6ts"><span class="svelte-1twe6ts">Time:</span> <!></div> <button class="mod-cta">OK</button></div>',1),ob=ne('<button type="button"> </button>'),sb=ne('<div class="dtchooser-header svelte-1twe6ts"><input type="text" class="dtchooser-quick-pick-filter svelte-1twe6ts" placeholder="Filter..."/> <button type="button" class="dtchooser-mode-toggle svelte-1twe6ts" aria-label="Show calendar" title="Show calendar"><span class="dtchooser-mode-toggle-icon svelte-1twe6ts"></span></button></div> <div class="dtchooser-calendar-area svelte-1twe6ts"><div class="dtchooser-quick-picks svelte-1twe6ts"></div></div>',1),ab=ne('<div class="dtchooser svelte-1twe6ts"><!></div>');function so(r,e){var ft,Xt,rr,T,ce;if(new.target)return We({component:so,...r});Se(e,!1);let t=ue(),n=M(e,"reminders",12),i=M(e,"onSelect",12),o=M(e,"timeStep",12,15),s=M(e,"weekStart",12,0),a=M(e,"initialTime",12,void 0),l=M(e,"date",28,()=>{var R,ie;return(ie=(R=a())==null?void 0:R.moment().clone())!=null?ie:P()}),u=ue((ft=a())!=null&&ft.hasTimePart?a().format("HH:mm"):(rr=(Xt=n().reminderTime)==null?void 0:Xt.value.toString())!=null?rr:"10:00"),d=ue((ce=(T=a())==null?void 0:T.hasTimePart)!=null?ce:!1),p=ue("calendar"),f=ue(""),m=ue(0),b=ue(),g=ue(),v=ue();function I(){let[R,ie]=y(u).split(":"),Ce=l().clone();y(d)?(Ce.set({hour:parseInt(R),minute:parseInt(ie)}),i()(new G(Ce,!0))):i()(new G(Ce,!1))}function w(R){i()(R.later())}async function x(){var R;W(p,"quickpick"),W(f,""),W(m,0),await dn(),(R=y(b))==null||R.focus()}async function X(){var R;W(p,"calendar"),W(f,""),await dn(),(R=y(v))==null||R.focus()}function K(){y(p)==="calendar"?x():X()}let V=["INPUT","SELECT","TEXTAREA"];function le(R){if(y(p)!=="calendar"||R.key!=="+")return;let ie=R.target;ie&&V.includes(ie.tagName)||(x(),R.preventDefault())}function De(R){switch(R.key){case"ArrowDown":R.preventDefault(),y(t).length>0&&W(m,(y(m)+1)%y(t).length);break;case"ArrowUp":R.preventDefault(),y(t).length>0&&W(m,(y(m)-1+y(t).length)%y(t).length);break;case"Enter":{R.preventDefault();let ie=y(t)[y(m)];ie&&w(ie);break}case"Escape":R.preventDefault(),R.stopPropagation(),X();break}}Sn(()=>(y(g),eu.setIcon,y(p)),()=>{y(g)&&(0,eu.setIcon)(y(g),y(p)==="calendar"?"clock":"calendar")}),Sn(()=>(_l,y(f)),()=>{W(t,_l.filter(R=>R.label.toLowerCase().includes(y(f).toLowerCase())))}),Sn(()=>y(f),()=>{y(f)!==void 0&&W(m,0)}),Ko();var ye={get reminders(){return n()},set reminders(R){n(R),N()},get onSelect(){return i()},set onSelect(R){i(R),N()},get timeStep(){return o()},set timeStep(R){o(R),N()},get weekStart(){return s()},set weekStart(R){s(R),N()},get initialTime(){return a()},set initialTime(R){a(R),N()},get date(){return l()},set date(R){l(R),N()},$set:ze,$on:(R,ie)=>je(e,R,ie)};dt();var Ke=ab(),Ie=H(Ke);{var Zt=R=>{var ie=ib(),Ce=Di(ie),C=H(Ce),oe=H(C);tt(oe,Ft=>W(g,Ft),()=>y(g)),Q(C);var mt=se(C,2);tt(Oa(mt,{get weekStart(){return s()},get value(){return l()},set value(Ft){l(Ft)},$$events:{select:()=>I()},$$slots:{footer:(Ft,gn)=>{var si=nb(),dl=se(H(si),2);{let fp=nn(()=>(Qe(n()),Qe(G),Qe(l()),E(()=>n().byDate(new G(l(),!1)))));io(dl,{get reminders(){return y(fp)}})}Q(si),J(Ft,si)}},$$legacy:!0}),Ft=>W(v,Ft),()=>y(v)),Q(Ce);var qe=se(Ce,2),kt=H(qe),Ve=se(H(kt),2);$a(Ve,{get step(){return o()},get value(){return y(u)},set value(Ft){W(u,Ft)},$$events:{select:()=>{I()},focus:()=>{W(d,!0)}},$$legacy:!0}),Q(kt);var Nn=se(kt,2);Q(qe),z("click",C,K),z("click",Nn,I),J(R,ie)},ke=R=>{var ie=sb(),Ce=Di(ie),C=H(Ce);Lc(C),tt(C,Ve=>W(b,Ve),()=>y(b));var oe=se(C,2),mt=H(oe);tt(mt,Ve=>W(g,Ve),()=>y(g)),Q(oe),Q(Ce);var qe=se(Ce,2),kt=H(qe);Rt(kt,7,()=>y(t),Ve=>Ve.label,(Ve,Nn,Ft)=>{var gn=ob();let si;var dl=Te(gn,!0);Ae(()=>{si=Vr(gn,1,"dtchooser-quick-pick svelte-1twe6ts",null,si,{"is-selected":y(Ft)===y(m)}),Re(dl,(y(Nn),E(()=>y(Nn).label)))}),z("click",gn,()=>w(y(Nn))),z("mouseenter",gn,()=>W(m,y(Ft))),J(Ve,gn)}),Q(kt),Q(qe),$c(C,()=>y(f),Ve=>W(f,Ve)),z("keydown",C,De),z("click",oe,K),J(R,ie)};Qr(Ie,R=>{y(p)==="calendar"?R(Zt):R(ke,-1)})}return Q(Ke),z("keydown",Ke,le),J(r,Ke),Ee(ye)}var ii=8;function Om(r,e,t){return Math.min(Math.max(r,e),t)}var ao=class{constructor(e,t,n,i){c(this,"editorView",e);c(this,"reminders",t);c(this,"timeStep",n);c(this,"weekStart",i);c(this,"view");c(this,"dateTimeChooser");c(this,"resultResolve");c(this,"resultReject");c(this,"anchorPos",0);c(this,"onDocumentMouseDown",e=>{this.view.contains(e.target)||this.cancel()});c(this,"onKeyDown",e=>{e.key==="Escape"&&(e.preventDefault(),e.stopPropagation(),this.cancel())});c(this,"onReposition",()=>{this.position(this.anchorPos)});this.view=createDiv(),this.view.addClass("date-time-chooser-popup")}show(e){var t;return this.anchorPos=e,this.view.addClass("is-measuring"),document.body.appendChild(this.view),this.dateTimeChooser=new so({target:this.view,props:{onSelect:n=>{this.setResult(n),this.hide()},reminders:this.reminders,timeStep:this.timeStep,weekStart:this.weekStart,date:P()}}),this.position(e),this.view.removeClass("is-measuring"),document.addEventListener("mousedown",this.onDocumentMouseDown,!0),this.view.addEventListener("keydown",this.onKeyDown),this.editorView.scrollDOM.addEventListener("scroll",this.onReposition,{passive:!0}),window.addEventListener("resize",this.onReposition,{passive:!0}),(t=this.view.querySelector(".reminder-calendar"))==null||t.focus(),new Promise((n,i)=>{this.resultResolve=n,this.resultReject=i})}position(e){var p,f,m;let t=this.editorView.coordsAtPos(e),n=this.editorView.dom.getBoundingClientRect(),i=(p=t==null?void 0:t.top)!=null?p:n.top,o=(f=t==null?void 0:t.bottom)!=null?f:n.top,s=(m=t==null?void 0:t.left)!=null?m:n.left,{width:a,height:l}=this.view.getBoundingClientRect(),u=o;u+l>window.innerHeight-ii&&(u=i-l),u=Om(u,ii,Math.max(window.innerHeight-l-ii,ii));let d=Om(s,ii,Math.max(window.innerWidth-a-ii,ii));this.view.style.top=`${u}px`,this.view.style.left=`${d}px`}cancel(){this.setResult(null),this.hide()}setResult(e){this.resultReject==null||this.resultResolve==null||(e===null?this.resultReject():this.resultResolve(e),this.resultReject=void 0,this.resultResolve=void 0)}hide(){var e;document.removeEventListener("mousedown",this.onDocumentMouseDown,!0),this.view.removeEventListener("keydown",this.onKeyDown),this.editorView.scrollDOM.removeEventListener("scroll",this.onReposition),window.removeEventListener("resize",this.onReposition),(e=this.dateTimeChooser)==null||e.$destroy(),this.dateTimeChooser=void 0,this.view.parentNode&&this.view.parentNode.removeChild(this.view),this.editorView.focus()}};var Pa=require("obsidian");var tu=class extends Pa.Modal{constructor(t,n,i,o,s,a,l){super(t);c(this,"reminders",n);c(this,"onSelect",i);c(this,"onCancel",o);c(this,"timeStep",s);c(this,"weekStart",a);c(this,"initialTime",l);c(this,"selected")}onOpen(){let t;Pa.Platform.isDesktop?(this.modalEl.addClass("reminder-date-chooser-modal"),t=this.contentEl):t=this.containerEl,new so({target:t,props:{onSelect:n=>{this.select(n)},reminders:this.reminders,timeStep:this.timeStep,weekStart:this.weekStart,initialTime:this.initialTime}})}select(t){this.selected=t,this.close()}onClose(){this.selected!=null?this.onSelect(this.selected):this.onCancel()}};function oi(r,e,t=15,n=0,i){return new Promise((o,s)=>{new tu(r,e,o,s,t,n,i).open()})}var Ha=class{constructor(e,t,n,i,o){c(this,"trigger",e);c(this,"timeStep",t);c(this,"primaryFormat",n);c(this,"convertNonTaskLines",i);c(this,"weekStart",o)}isTrigger(e,t){let n=this.trigger.value;if(n.length===0)return!1;if(t.text.contains(n.charAt(n.length-1))){let i=e.getLine(t.from.line).substring(0,t.to.ch)+t.text.join(`
`);if(!i.match(/^\s*- \[.\]\s.*/))return!1;if(i.endsWith(n))return!0}return!1}show(e,t,n){let i;if($m.Platform.isDesktopApp){let o=t.cm;if(o==null)console.error("Cannot get CodeMirror 6 editor view."),i=oi(e,n,this.timeStep.value,Number(this.weekStart.value));else{let s=o.state.selection.main.head;i=new ao(o,n,this.timeStep.value,Number(this.weekStart.value)).show(s)}}else i=oi(e,n,this.timeStep.value,Number(this.weekStart.value));i.then(o=>{this.insert(t,o,!0)}).catch(()=>{})}insert(e,t,n=!1){var l;let i=e.getCursor(),o=e.getLine(i.line),s={line:i.line,ch:o.length};n||(o=o.substring(0,i.ch-this.trigger.value.length));let a=this.primaryFormat.value.format;try{let u=(l=As(a,o,t,void 0,this.convertNonTaskLines.value,ws(e.cm)))==null?void 0:l.insertedLine;if(u==null){xs(),console.error("Cannot append reminder time to the line: line=%s, date=%s",o,t);return}e.replaceRange(u,{line:i.line,ch:0},s)}catch(u){console.error(u)}}};var Pm=require("@codemirror/state"),Hm=require("@codemirror/view"),Jm=require("obsidian");function jm(r,e,t){return Hm.ViewPlugin.fromClass(class{constructor(){c(this,"activePopup");c(this,"destroyed",!1)}update(n){n.docChanged&&n.changes.iterChanges((i,o,s,a,l)=>{let u=n.state.doc,d=u.sliceString(a-2,a);if(l.length===0)return;let p=t.autoCompleteTrigger.value,f=t.reminderTimeStep.value,m=Number(t.weekStart.value);if(p===d){let b;Jm.Platform.isDesktopApp?b=new Promise((g,v)=>{n.view.dom.win.setTimeout(()=>{var w;if(this.destroyed){v(new Error("editor view was destroyed"));return}(w=this.activePopup)==null||w.cancel();let I=new ao(n.view,e,f,m);this.activePopup=I,I.show(a).finally(()=>{this.activePopup===I&&(this.activePopup=void 0)}).then(g,v)},0)}):b=oi(r,e,f,m),b.then(g=>{let v=t.primaryFormat.value.format;try{let I=u.lineAt(a),w=I.text.lastIndexOf(p),x=w+p.length;p.startsWith("(")&&I.text.charAt(x)===")"&&x++;let X=I.text.substring(0,w)+I.text.substring(x),K=As(v,X,g,w,t.convertNonTaskLines.value,ws(n.view));if(K==null){xs(),console.error("Cannot append reminder time to the line: line=%s, date=%s",I.text,g);return}let V=n.view.state.update({changes:{from:I.from,to:I.to,insert:K.insertedLine},selection:Pm.EditorSelection.cursor(I.from+K.caretPosition)});n.view.update([V])}catch(I){console.error(I)}}).catch(()=>{})}})}destroy(){var n;this.destroyed=!0,(n=this.activePopup)==null||n.cancel()}})}var lo=require("@codemirror/state"),co=require("@codemirror/view"),za=require("obsidian");function zm(r,e,t){return Math.min(Math.max(r,e),t)}function Km(r,e){let t=[];for(let{reminder:o,columnStart:s,columnEnd:a}of e){let l=o.rowNumber+1;if(l<1||l>r.lines)continue;let u=r.line(l),d=zm(u.from+s,u.from,u.to),p=zm(u.from+a,d,u.to);d>=p||t.push({from:d,to:p,reminder:o,text:r.sliceString(d,p)})}t.sort((o,s)=>o.from-s.from);let n=[],i=-1;for(let o of t)o.from<i||(n.push(o),i=o.to);return n}var qm=require("@codemirror/state"),us=qm.StateEffect.define();var tp=require("@codemirror/view"),rp=require("obsidian");var lb=ne('<span class="reminder-pill svelte-1r4kx8j" role="button" tabindex="0"> </span>');function Ja(r,e){if(new.target)return We({component:Ja,...r});Se(e,!1);let t=M(e,"label",12),n=M(e,"title",12),i=eo();function o(d){d.preventDefault(),d.stopPropagation(),i("activate")}function s(d){(d.key==="Enter"||d.key===" ")&&(d.preventDefault(),d.stopPropagation(),i("activate"))}var a={get label(){return t()},set label(d){t(d),N()},get title(){return n()},set title(d){n(d),N()},$set:ze,$on:(d,p)=>je(e,d,p)};dt();var l=lb(),u=Te(l,!0);return Ae(()=>{Cr(l,"title",n()),Re(u,t())}),z("click",l,o),z("keydown",l,s),z("mousedown",l,Na(Da(function(d){Jc.call(this,e,d)}))),J(r,l),Ee(a)}var ja=class extends tp.WidgetType{constructor(t,n){super();c(this,"span",t);c(this,"plugin",n);c(this,"component")}eq(t){return this.span.text===t.span.text&&this.span.reminder.title===t.span.reminder.title}toDOM(t){let n=createSpan();return this.component=new Ja({target:n,props:{label:`\u23F0 ${this.span.reminder.time.toString()}`,title:`Reminder: ${this.span.reminder.title}`}}),this.component.$on("activate",()=>{this.activate(t,n)}),n}destroy(){var t;(t=this.component)==null||t.$destroy(),this.component=void 0}ignoreEvent(){return!1}async activate(t,n){try{await cb(t,this.plugin,n)}catch(i){}}};function ep(r,e){var u,d,p;if(!r.dom.contains(e))return null;let t=r.posAtDOM(e),n=r.state.doc.lineAt(t),i=(p=(d=(u=r.state.field(rp.editorInfoField,!1))==null?void 0:u.file)==null?void 0:d.path)!=null?p:"",o=new Lr(i,r.state.doc.toString()),s=xi(o).filter(f=>f.reminder.rowNumber===n.number-1),a=null,l=Number.POSITIVE_INFINITY;for(let f of s){let m=n.from+f.columnStart,b=n.from+f.columnEnd,g=t>=m&&t<=b?0:Math.min(Math.abs(t-m),Math.abs(t-b));g<l&&(l=g,a=f)}return a==null?null:{md:o,span:a}}async function cb(r,e,t){var d;let n=ep(r,t);if(n==null)return;let i=await oi(e.app,e.reminders,e.settings.reminderTimeStep.value,Number(e.settings.weekStart.value),n.span.reminder.time),o=ep(r,t);if(o==null||!await zs(o.md,o.span.reminder,{time:i}))return;let a=o.span.reminder.rowNumber,l=(d=o.md.toMarkdown().split(`
`)[a])!=null?d:"",u=r.state.doc.line(a+1);r.dispatch({changes:{from:u.from,to:u.to,insert:l},effects:[us.of()]})}var ub=300,np=lo.Annotation.define();function nu(r,e){var t,n,i,o;try{if(!r.settings.editorReminderDisplay.value)return[];if(!((t=e.field(za.editorLivePreviewField,!1))!=null&&t))return[];let s=(o=(i=(n=e.field(za.editorInfoField,!1))==null?void 0:n.file)==null?void 0:i.path)!=null?o:"",a=new Lr(s,e.doc.toString());return Km(e.doc,xi(a))}catch(s){return console.error("Failed to parse reminders for editor pills.",s),[]}}function ru(r,e,t){let n=r.selection.main.head,i=new lo.RangeSetBuilder;for(let o of e)n>=o.from&&n<=o.to||i.add(o.from,o.to,co.Decoration.replace({widget:new ja(o,t)}));return i.finish()}function db(r,e){let t=[];for(let n of r){let i=e.mapPos(n.from),o=e.mapPos(n.to,1);i<o&&t.push({...n,from:i,to:o})}return t}function fb(r){return lo.StateField.define({create(e){let t=nu(r,e);return{decos:ru(e,t,r),cache:t}},update(e,t){let n=e.decos.map(t.changes),i=t.docChanged?db(e.cache,t.changes):e.cache,o=t.annotation(np);o!==void 0&&(i=o);let s=t.docChanged&&i.some(d=>t.changes.touchesRange(d.from,d.to)),a=t.effects.some(d=>d.is(us));if(s||t.reconfigured||a&&o===void 0)return i=nu(r,t.state),n=ru(t.state,i,r),{decos:n,cache:i};let u=!t.startState.selection.eq(t.state.selection);return(o!==void 0||u)&&(n=ru(t.state,i,r)),{decos:n,cache:i}},provide:e=>co.EditorView.decorations.from(e,t=>t.decos)})}function mb(r){return co.ViewPlugin.fromClass(class{constructor(e){c(this,"view",e);c(this,"debounceTimer")}update(e){e.docChanged&&(this.debounceTimer!==void 0&&window.clearTimeout(this.debounceTimer),this.debounceTimer=window.setTimeout(()=>{this.debounceTimer=void 0;let t=nu(r,this.view.state);this.view.dispatch({annotations:np.of(t),effects:[us.of()]})},ub))}destroy(){this.debounceTimer!==void 0&&(window.clearTimeout(this.debounceTimer),this.debounceTimer=void 0)}})}function iu(r){return[fb(r),mb(r)]}var Ka=require("@codemirror/state"),Dn=require("@codemirror/view"),ou=Ka.StateEffect.define();function pb(r){return r.from>=r.to?Dn.Decoration.none:Dn.Decoration.set([Dn.Decoration.mark({attributes:{style:"background-color: var(--text-highlight-bg);"}}).range(r.from,r.to)])}var hb=Ka.StateField.define({create(){return Dn.Decoration.none},update(r,e){let t=e.effects.find(n=>n.is(ou));return t!==void 0?pb(t.value):e.docChanged||!e.startState.selection.eq(e.state.selection)?Dn.Decoration.none:r.map(e.changes)},provide:r=>Dn.EditorView.decorations.from(r)});function ip(){return hb}var sp=require("obsidian");var op=require("obsidian");var gb=ne('<div class="icon-text svelte-1qeb5yo"><span class="icon svelte-1qeb5yo"></span> <span class="text svelte-1qeb5yo"> </span></div>');function uo(r,e){if(new.target)return We({component:uo,...r});Se(e,!1);let t=M(e,"icon",12,""),n=M(e,"text",12,""),i=ue();qi(()=>{(0,op.setIcon)(y(i),t())});var o={get icon(){return t()},set icon(d){t(d),N()},get text(){return n()},set text(d){n(d),N()},$set:ze,$on:(d,p)=>je(e,d,p)};dt();var s=gb(),a=H(s);tt(a,d=>W(i,d),()=>y(i));var l=se(a,2),u=Te(l,!0);return Q(s),Ae(()=>Re(u,n())),J(r,s),Ee(o)}var bb=ne('<button class="reminder-toast-close svelte-1u4loek" aria-label="Close">\xD7</button>'),vb=ne("<option> </option>"),yb=ne('<div class="reminder-secondary-actions svelte-1u4loek"><button class="reminder-footer-action svelte-1u4loek" title="Pause all notifications for a chosen duration. Reminders are not muted: anything still overdue notifies you again after the pause ends.">Pause all notifications\u2026</button> <button class="reminder-footer-action svelte-1u4loek" title="Mute every currently overdue reminder. Muted reminders stay silent (even across restarts) until you snooze them or change their date.">Mute all reminders\u2026</button></div>'),Ib=ne('<main tabindex="-1"><!> <h3 class="reminder-title svelte-1u4loek"><!></h3> <button class="reminder-file svelte-1u4loek" title="Alt+O / Ctrl+O" aria-keyshortcuts="Alt+O Control+O"><!></button> <div class="reminder-actions svelte-1u4loek"><button class="mod-cta svelte-1u4loek" title="Alt+D / Ctrl+D" aria-keyshortcuts="Alt+D Control+D"><!><span><span class="mnemonic svelte-1u4loek">D</span>one</span></button> <button title="Alt+M / Ctrl+M" aria-keyshortcuts="Alt+M Control+M" class="svelte-1u4loek"><!><span><span class="mnemonic svelte-1u4loek">M</span>ute</span></button> <select class="dropdown later-select svelte-1u4loek" title="Alt+S / Ctrl+S" aria-keyshortcuts="Alt+S Control+S"><option selected="" disabled="" hidden="">Snooze</option><!></select></div> <!></main>');function fo(r,e){if(new.target)return We({component:fo,...r});Se(e,!1);let t=M(e,"reminder",12),n=M(e,"onRemindMeLater",12),i=M(e,"onDone",12),o=M(e,"onOpenFile",12),s=M(e,"onMute",12),a=M(e,"onPauseAllNotifications",12),l=M(e,"onMuteAll",12),u=M(e,"variant",12,"modal"),d=M(e,"onClose",12,void 0),p=M(e,"focusDone",12,!1),f=M(e,"shortcutsEnabled",12,!0),m=ue(),b=M(e,"laters",28,()=>[]),g=ue(),v=ue(),I=ue();function w(){let C=b()[y(m)];C!=null&&n()(C.later())}function x(C){if(!f())return;let oe=C.altKey&&!C.ctrlKey,mt=C.ctrlKey&&!C.altKey;if(!(!oe&&!mt||C.metaKey||C.shiftKey))switch(C.code){case"KeyD":C.preventDefault(),C.stopPropagation(),i()();break;case"KeyM":C.preventDefault(),C.stopPropagation(),s()();break;case"KeyO":C.preventDefault(),C.stopPropagation(),o()();break;case"KeyS":C.preventDefault(),C.stopPropagation(),y(v).focus();break}}qi(async()=>{u()!=="toast"&&(await dn(),p()?y(g).focus():y(I).focus())});var X={get reminder(){return t()},set reminder(C){t(C),N()},get onRemindMeLater(){return n()},set onRemindMeLater(C){n(C),N()},get onDone(){return i()},set onDone(C){i(C),N()},get onOpenFile(){return o()},set onOpenFile(C){o(C),N()},get onMute(){return s()},set onMute(C){s(C),N()},get onPauseAllNotifications(){return a()},set onPauseAllNotifications(C){a(C),N()},get onMuteAll(){return l()},set onMuteAll(C){l(C),N()},get variant(){return u()},set variant(C){u(C),N()},get onClose(){return d()},set onClose(C){d(C),N()},get focusDone(){return p()},set focusDone(C){p(C),N()},get shortcutsEnabled(){return f()},set shortcutsEnabled(C){f(C),N()},get laters(){return b()},set laters(C){b(C),N()},$set:ze,$on:(C,oe)=>je(e,C,oe)};dt();var K=Ib();z("keydown",Uo,x,!0);let V;var le=H(K);{var De=C=>{var oe=bb();z("click",oe,function(...mt){var qe;(qe=d())==null||qe.apply(this,mt)}),J(C,oe)};Qr(le,C=>{u()==="toast"&&C(De)})}var ye=se(le,2),Ke=H(ye);no(Ke,{get markdown(){return Qe(t()),E(()=>t().title)},get sourcePath(){return Qe(t()),E(()=>t().file)}}),Q(ye);var Ie=se(ye,2),Zt=H(Ie);uo(Zt,{icon:"link",get text(){return Qe(t()),E(()=>t().file)}}),Q(Ie);var ke=se(Ie,2),ft=H(ke),Xt=H(ft);uo(Xt,{icon:"check-small"}),Gi(),Q(ft),tt(ft,C=>W(g,C),()=>y(g));var rr=se(ft,2),T=H(rr);uo(T,{icon:"minus-with-circle"}),Gi(),Q(rr);var ce=se(rr,2),R=se(H(ce));Rt(R,1,b,Wc,(C,oe,mt)=>{var qe=vb(),kt=Te(qe,!0);qe.value=qe.__value=mt,Ae(()=>{as(qe,y(m)===mt),Re(kt,(y(oe),E(()=>y(oe).label)))}),J(C,qe)}),Q(ce),tt(ce,C=>W(v,C),()=>y(v)),ro(ce),Q(ke);var ie=se(ke,2);{var Ce=C=>{var oe=yb(),mt=H(oe),qe=se(mt,2);Q(oe),z("click",mt,function(...kt){var Ve;(Ve=a())==null||Ve.apply(this,kt)}),z("click",qe,function(...kt){var Ve;(Ve=l())==null||Ve.apply(this,kt)}),J(C,oe)};Qr(ie,C=>{u()==="modal"&&C(Ce)})}return Q(K),tt(K,C=>W(I,C),()=>y(I)),Ae(()=>{V=Vr(K,1,"svelte-1u4loek",null,V,{toast:u()==="toast"}),Cr(ye,"aria-label",(Qe(t()),E(()=>t().title))),Cr(Ie,"aria-label",(Qe(t()),E(()=>t().file)))}),z("click",Ie,function(...C){var oe;(oe=o())==null||oe.apply(this,C)}),z("click",ft,function(...C){var oe;(oe=i())==null||oe.apply(this,C)}),z("click",rr,function(...C){var oe;(oe=s())==null||oe.apply(this,C)}),ls(ce,()=>y(m),C=>W(m,C)),z("change",ce,w),J(r,K),Ee(X)}var qa=class extends sp.Modal{constructor(t,n,i,o,s){super(t);c(this,"laters",n);c(this,"reminder",i);c(this,"actions",o);c(this,"focusDoneButtonOnPopup",s);c(this,"canceled",!0);c(this,"pausingAll",!1);c(this,"mutingAll",!1)}onOpen(){this.reminder.beingDisplayed=!0;let{contentEl:t}=this;new fo({target:t,props:{reminder:this.reminder,laters:this.laters,focusDone:this.focusDoneButtonOnPopup,onRemindMeLater:n=>{this.actions.remindMeLater(n),this.canceled=!1,this.close()},onDone:()=>{this.canceled=!1,this.actions.done(),this.close()},onOpenFile:()=>{this.canceled=!0,this.actions.openFile(),this.close()},onMute:()=>{this.canceled=!0,this.close()},onPauseAllNotifications:()=>{this.pausingAll=!0,this.actions.pauseAll(),this.close()},onMuteAll:()=>{this.mutingAll=!0,this.actions.muteAll(),this.close()}}})}onClose(){this.reminder.beingDisplayed=!1;let{contentEl:t}=this;t.empty(),this.pausingAll||this.mutingAll||this.canceled&&this.actions.mute()}};var el=class{constructor(){c(this,"containerEl");c(this,"toasts",new Map)}show(e,t,n){let i=e.key();this.remove(i);let o=this.getContainer().createDiv("reminder-toast-card"),s=new fo({target:o,props:{reminder:e,laters:t,variant:"toast",shortcutsEnabled:!0,onRemindMeLater:a=>{n.remindMeLater(a),this.remove(i)},onDone:()=>{n.done(),this.remove(i)},onOpenFile:()=>{n.openFile(),n.mute(),this.remove(i)},onMute:()=>{n.mute(),this.remove(i)},onClose:()=>{n.mute(),this.remove(i)},onPauseAllNotifications:()=>{n.pauseAll(),this.remove(i)},onMuteAll:()=>{n.muteAll(),this.remove(i)}}});this.toasts.set(i,{el:o,component:s}),this.updateShortcutTarget()}destroy(){var e;this.toasts.forEach(({component:t})=>t.$destroy()),this.toasts.clear(),(e=this.containerEl)==null||e.remove(),this.containerEl=void 0}sync(e){for(let t of Array.from(this.toasts.keys()))e.has(t)||this.remove(t)}remove(e){let t=this.toasts.get(e);t&&(t.component.$destroy(),t.el.remove(),this.toasts.delete(e),this.updateShortcutTarget())}updateShortcutTarget(){let e=Array.from(this.toasts.keys()),t=e[e.length-1];this.toasts.forEach(({component:n},i)=>{n.$set({shortcutsEnabled:i===t})})}getContainer(){if(!this.containerEl){let e=document.body.createDiv("reminder-toast-container");e.style.cssText="position: fixed; right: 16px; bottom: 40px; z-index: var(--layer-notice); display: flex; flex-direction: column; gap: 8px; max-height: 70vh; overflow-y: auto; width: 360px; max-width: calc(100vw - 32px);",this.containerEl=e}return this.containerEl}};var lp=require("obsidian");function ap(r,e,t){if(!e)return r;let n=t?2:1;return r.slice(0,5-n)}var tl=class{constructor(e,t,n,i){c(this,"laters",e);c(this,"openNoteOnReminderClick",t);c(this,"keepSystemNotificationOnScreen",n);c(this,"showBuiltinReminder",i);c(this,"systemNotifications",new Map)}isAvailable(){return Xn!==void 0}show(e,t,n){if(Xn===void 0)return;let i=e.key();this.close(i);let o=Xn.remote.Notification,s=new o({title:"Obsidian Reminder",body:e.title,timeoutType:this.keepSystemNotificationOnScreen.value?"never":"default"}),a={notification:s,closedByPlugin:!1};if(this.systemNotifications.set(i,a),s.on("click",()=>{if(this.close(i),this.openNoteOnReminderClick.value){t.openFile();return}n||this.showBuiltinReminder(e,t)}),s.on("close",()=>{this.systemNotifications.get(i)===a&&this.systemNotifications.delete(i),!(n||a.closedByPlugin)&&t.mute()}),!n){let l=ap(this.laters.value,lp.Platform.isWin,this.keepSystemNotificationOnScreen.value);s.on("action",(d,p)=>{if(p===0){t.done();return}let f=l[p-1];t.remindMeLater(f.later())});let u=[{type:"button",text:"Mark as Done"}];l.forEach(d=>{u.push({type:"button",text:d.label})}),s.actions=u}s.show()}destroy(){for(let e of Array.from(this.systemNotifications.keys()))this.close(e);this.systemNotifications.clear()}sync(e){for(let t of Array.from(this.systemNotifications.keys()))e.has(t)||this.close(t)}close(e){let t=this.systemNotifications.get(e);t&&(t.closedByPlugin=!0,this.systemNotifications.delete(e),t.notification.close())}};var rl=class{constructor(e,t,n,i,o,s,a,l){c(this,"app",e);c(this,"useSystemNotification",t);c(this,"laters",n);c(this,"showPopupWithSystemNotification",o);c(this,"focusDoneButtonOnPopup",a);c(this,"notificationPopupStyle",l);c(this,"toastManager",new el);c(this,"systemNotifier");this.systemNotifier=new tl(n,i,s,(u,d)=>this.showBuiltinReminder(u,d))}destroy(){this.toastManager.destroy(),this.systemNotifier.destroy()}sync(e){this.toastManager.sync(e),this.systemNotifier.sync(e)}show(e,t){if(!this.isSystemNotification()){this.showBuiltinReminder(e,t);return}let n=this.showPopupWithSystemNotification.value;n&&this.showBuiltinReminder(e,t),this.systemNotifier.show(e,t,n)}showBuiltinReminder(e,t){if(this.notificationPopupStyle.value==="toast"){this.toastManager.show(e,this.laters.value,t);return}new qa(this.app,this.laters.value,e,t,this.focusDoneButtonOnPopup.value).open()}isSystemNotification(){return this.systemNotifier.isAvailable()?this.useSystemNotification.value:!1}};var ds=class{constructor(e){c(this,"plugin",e);c(this,"autoComplete");c(this,"editDetector");c(this,"reminderNotifier");c(this,"viewProxy");c(this,"dndStatusBar");c(this,"overdueStatusBar");this.viewProxy=new Ya(this.plugin,t=>{if(!this.plugin.settings.openNoteOnReminderClick.value&&t.muteNotification){this.showReminder(t);return}this.openReminderFile(t)}),this.autoComplete=new Ha(e.settings.autoCompleteTrigger,e.settings.reminderTimeStep,e.settings.primaryFormat,e.settings.convertNonTaskLines,e.settings.weekStart),this.editDetector=new su(e.settings.editDetectionSec),this.reminderNotifier=new rl(e.app,e.settings.useSystemNotification,e.settings.laters,e.settings.openNoteOnReminderClick,e.settings.showPopupWithSystemNotification,e.settings.keepSystemNotificationOnScreen,e.settings.focusDoneButtonOnPopup,e.settings.notificationPopupStyle),this.dndStatusBar=new ea(e),this.overdueStatusBar=new ta(e)}onload(){this.dndStatusBar.onload(),this.overdueStatusBar.onload(),this.plugin.registerView(kr,e=>this.viewProxy.createView(e)),this.plugin.addSettingTab(new au(this.plugin.app,this.plugin)),this.plugin.registerDomEvent(document,"keydown",()=>{this.editDetector.fileChanged()}),Yr.Platform.isDesktopApp&&(this.plugin.registerEditorExtension(jm(this.plugin.app,this.plugin.reminders,this.plugin.settings)),this.plugin.registerEditorExtension(iu(this.plugin)),this.plugin.registerEditorExtension(ip()),this.plugin.settings.editorReminderDisplay.rawValue.onChanged(()=>{this.plugin.app.workspace.updateOptions()})),jd(this.plugin)}onLayoutReady(){this.plugin.data.debug.value&&Kd(this.plugin),this.viewProxy.openView()}onunload(){this.detachReminderList(),this.reminderNotifier.destroy()}isEditing(){return this.editDetector.isEditing()}invalidate(){this.viewProxy.invalidate(),this.overdueStatusBar.refresh(),this.reminderNotifier.sync(new Set(this.plugin.reminders.reminders.map(e=>e.key())))}reload(e=!1){this.viewProxy.reload(e),this.overdueStatusBar.refresh()}showAutoComplete(e){this.autoComplete.show(this.plugin.app,e,this.plugin.reminders)}refreshDndStatusBar(){this.dndStatusBar.refresh()}async showReminderList(){let e=this.plugin.app.workspace,t=e.getLeavesOfType(kr)[0];if(t==null){let n=e.getRightLeaf(!1);if(n==null)return;await n.setViewState({type:kr}),t=n}await e.revealLeaf(t)}detachReminderList(){this.plugin.app.workspace.getLeavesOfType(kr).forEach(e=>e.detach())}async openReminderFile(e){let t=this.plugin.app.workspace.getLeaf(!1);console.debug("Open reminder: ",e);let n=this.plugin.app.vault.getAbstractFileByPath(e.file);if(!(n instanceof Yr.TFile)){console.error("Cannot open file because it isn't a TFile: %o",n);return}if(await t.openFile(n),!(t.view instanceof Yr.MarkdownView))return;let i=t.view.editor,o=i.getLine(e.rowNumber);i.setCursor({line:e.rowNumber,ch:0}),i.scrollIntoView({from:{line:e.rowNumber,ch:0},to:{line:e.rowNumber,ch:o.length}},!0);let s=i.cm;if(s){let a=s.state.doc.line(e.rowNumber+1);s.dispatch({effects:ou.of({from:a.from,to:a.to})})}}showReminder(e){e.muteNotification=!0;let t={remindMeLater:n=>{console.debug("Remind me later: time=%o",n),e.time=n,e.muteNotification=!1,this.plugin.fileSystem.updateReminder(e,!1),this.plugin.data.save(!0)},done:()=>{console.debug("done"),e.muteNotification=!1,this.plugin.fileSystem.updateReminder(e,!0),this.plugin.reminders.removeReminder(e),this.plugin.data.save(!0)},mute:()=>{console.debug("Mute"),e.muteNotification=!0,this.reload(!0),this.plugin.data.save(!0)},openFile:()=>{console.debug("Open"),this.openReminderFile(e)},pauseAll:()=>{console.debug("Pause all notifications"),_s(this.plugin,()=>{e.muteNotification=!1})},muteAll:()=>{console.debug("Mute all reminders");let n=this.plugin.reminders.muteExpiredReminders(this.plugin.settings.reminderTime.value)+1;e.muteNotification=!0,this.reload(!0),this.plugin.data.save(!0),new Yr.Notice(`Muted ${n} reminder${n===1?"":"s"}`)}};this.reminderNotifier.show(e,t)}},su=class{constructor(e){c(this,"editDetectionSec",e);c(this,"lastModified")}fileChanged(){this.lastModified=new Date}isEditing(){return this.editDetectionSec.value<=0||this.lastModified==null?!1:(new Date().getTime()-this.lastModified.getTime())/1e3<this.editDetectionSec.value}},au=class extends Yr.PluginSettingTab{constructor(t,n){super(t,n);c(this,"plugin",n)}display(){let{containerEl:t}=this;this.plugin.settings.settings.displayOn(t)}};function cp(r){return r.trim().replace(/^\/+/,"").replace(/\/+$/,"")}function up(r,e){let t=cp(r);return e.some(n=>{let i=cp(n);return i.length===0?!1:t===i||t.startsWith(`${i}/`)})}var lu=require("obsidian");var fs=class{constructor(e,t,n,i,o){c(this,"vault",e);c(this,"reminders",t);c(this,"onRemindersChanged",n);c(this,"excludedPaths",i);c(this,"dataLoaded",o)}onload(e){[this.vault.on("modify",async t=>{await this.reloadRemindersInFile(t)&&this.onRemindersChanged()}),this.vault.on("delete",async t=>{await this.removeRemindersByFile(t.path)&&this.onRemindersChanged()}),this.vault.on("rename",async(t,n)=>{await this.removeRemindersByFile(n)&&(await this.reloadRemindersInFile(t),this.onRemindersChanged())})].forEach(t=>{e.registerEvent(t)})}async removeRemindersByFile(e){return console.debug("Remove file: path=%s",e),this.reminders.removeByFile(e)}async reloadRemindersInFile(e){if(console.debug("Reload file and collect reminders: file=%s",e.path),!(e instanceof lu.TFile))return console.debug("Cannot read file other than TFile: file=%o",e),!1;if(!this.isMarkdownFile(e))return console.debug("Not a markdown file: file=%o",e),!1;if(up(e.path,this.excludedPaths()))return console.debug("Excluded file: file=%o",e),this.reminders.removeByFile(e.path);let n=new Hr(e.path,await this.vault.cachedRead(e)).getReminders();if(n.length>0){if(!this.reminders.replaceFile(e.path,n))return!1}else if(!this.reminders.removeByFile(e.path))return!1;return!0}async reloadRemindersInAllFiles(){await this.dataLoaded(),console.debug("Reload all files and collect reminders"),this.reminders.clear();for(let e of this.vault.getMarkdownFiles())await this.reloadRemindersInFile(e);this.onRemindersChanged()}isMarkdownFile(e){return e.extension.toLowerCase()==="md"}async updateReminder(e,t){let n=this.vault.getAbstractFileByPath(e.file);if(!(n instanceof lu.TFile)){console.error("file is not instance of TFile: %o",n);return}let i=new Hr(n.path,await this.vault.read(n));await i.updateReminder(e,{checked:t,time:e.time}),await this.vault.modify(n,i.getContent())}};var dp=require("obsidian");var vu=require("obsidian");var cu=class{constructor(){c(this,"settingContexts",[])}register(e){this.settingContexts.push(e)}findByKey(e){return this.settingContexts.find(t=>t.key===e)}forEach(e){this.settingContexts.forEach(e)}},uu=class{constructor(e){c(this,"_settingRegistry",e);c(this,"validationEl");c(this,"infoEl");c(this,"_setting");c(this,"key");c(this,"name");c(this,"desc");c(this,"tags",[]);c(this,"settingModel");c(this,"buttons",[]);c(this,"anyValueChanged")}init(e,t){this.settingModel=e,this._setting=t,this.validationEl=t.descEl.createDiv("reminder-setting-validation",n=>{n.hidden=!0}),this.infoEl=t.descEl.createDiv("reminder-setting-info",n=>{n.hidden=!0})}setValidationError(e){this.setText(this.validationEl,e)}setInfo(e){this.setText(this.infoEl,e)}setText(e,t){if(!e){console.error("element not created");return}t===null?e.hidden=!0:(e.hidden=!1,e.textContent=t)}get setting(){return this._setting}get registry(){return this._settingRegistry}hasTag(e){return this.tags.filter(t=>t===e).length>0}update(){this.isInitialized()&&this.anyValueChanged&&this.anyValueChanged(this)}setEnabled(e){this.setting.setDisabled(!e),this.setting.settingEl.toggleClass("reminder-setting-disabled",!e)}findContextByKey(e){return this._settingRegistry.findByKey(e)}booleanValue(){return this.settingModel.value}isInitialized(){return this.settingModel&&this.validationEl&&this.setting}},du=class{constructor(e){c(this,"registry",e);c(this,"context");this.context=new uu(this.registry),this.registry.register(this.context)}key(e){return this.context.key=e,this}name(e){return this.context.name=e,this}desc(e){return this.context.desc=e,this}tag(e){return this.context.tags.push(e),this}enableWhen(e){return this.context.anyValueChanged=e,this}text(e){return new nl(this.context,!1,e)}textArea(e){return new nl(this.context,!0,e)}number(e){return new fu(this.context,e)}toggle(e){return new mu(this.context,e)}dropdown(e){return new hu(this.context,e)}},mo=class{constructor(e,t){c(this,"context",e);c(this,"initValue",t)}onAnyValueChanged(e){return this.context.anyValueChanged=e,this}button(e,t){return this.context.buttons.push({label:e,onClick:t}),this}onValueChange(){this.context.registry.forEach(e=>{e.update()})}buildSettingModel(e,t){return new ms(this.context,e,this.initValue,t)}wireTextComponent(e,t,n,i){e.setPlaceholder(t).setValue(n).onChange(async o=>{i(o)})}},nl=class extends mo{constructor(t,n,i){super(t,i);c(this,"longText",n);c(this,"_placeHolder");c(this,"_masked",!1)}placeHolder(t){return this._placeHolder=t,this}masked(){return this._masked=!0,this}build(t){return this.buildSettingModel(t,({setting:n,rawValue:i,context:o})=>{let s=a=>{var l;this.wireTextComponent(a,(l=this._placeHolder)!=null?l:"",i.value,u=>{try{t.unmarshal(u),i.value=u,o.setValidationError(null),this.onValueChange()}catch(d){d instanceof Error?o.setValidationError(d.message):typeof d=="string"&&o.setValidationError(d)}})};this.longText?n.addTextArea(a=>{s(a)}):n.addText(a=>{s(a),this._masked&&(a.inputEl.type="password")})})}},fu=class extends mo{constructor(t,n){super(t,n);c(this,"_placeHolder")}placeHolder(t){return this._placeHolder=t,this}build(t){return this.buildSettingModel(t,({setting:n,rawValue:i,context:o})=>{n.addText(s=>{var a;this.wireTextComponent(s,(a=this._placeHolder)!=null?a:"",i.value.toString(),l=>{let u=parseInt(l,10);if(Number.isNaN(u)){o.setValidationError("Please enter a valid number.");return}o.setValidationError(null),i.value=u,this.onValueChange()})})})}},mu=class extends mo{build(e){return new ms(this.context,e,this.initValue,({setting:t,rawValue:n})=>{t.addToggle(i=>i.setValue(n.value).onChange(async o=>{n.value=o,this.onValueChange()}))})}},pu=class{constructor(e,t){c(this,"label",e);c(this,"value",t)}},hu=class extends mo{constructor(){super(...arguments);c(this,"options",[])}addOption(t,n){return this.options.push(new pu(t,n)),this}build(t){return new ms(this.context,t,this.initValue,({setting:n,rawValue:i})=>{n.addDropdown(o=>{this.options.forEach(s=>{o.addOption(s.value,s.label)}),o.setValue(i.value),o.onChange(async s=>{i.value=s,this.onValueChange()})})})}},ms=class{constructor(e,t,n,i){c(this,"context",e);c(this,"serde",t);c(this,"settingInitializer",i);c(this,"rawValue");if(this.rawValue=new bn(n),e.key==null)throw new Error("key is required.")}createSetting(e){var n,i;let t=new vu.Setting(e).setName((n=this.context.name)!=null?n:"").setDesc((i=this.context.desc)!=null?i:"");return this.context.init(this,t),this.settingInitializer({setting:t,rawValue:this.rawValue,context:this.context}),this.context.buttons.forEach(o=>{t.addButton(s=>{s.setButtonText(o.label).onClick(async()=>{s.setDisabled(!0);try{await o.onClick(this.context)}finally{s.setDisabled(!1)}})})}),t}get value(){return this.serde.unmarshal(this.rawValue.value)}get key(){return this.context.key}load(e){if(e===void 0)return;let t=e[this.key];t!==void 0&&(this.rawValue.value=t)}store(e){e[this.key]=this.rawValue.value}hasTag(e){return this.context.hasTag(e)}},gu=class{constructor(e){c(this,"name",e);c(this,"settings",[])}addSettings(...e){this.settings.push(...e)}},bu=class{constructor(e){c(this,"name",e);c(this,"groups",[])}newGroup(e){let t=new gu(e);return this.groups.push(t),t}},il=class{constructor(){c(this,"pages",[]);c(this,"registry",new cu);c(this,"activeTabIndex",0)}newSettingBuilder(){return new du(this.registry)}newPage(e){let t=new bu(e);return this.pages.push(t),t}displayOn(e){e.empty();let t=e.createDiv("reminder-settings-tab-bar");t.setAttribute("role","tablist");let n=this.pages.map((o,s)=>{let a=t.createEl("button",{cls:"reminder-settings-tab",text:o.name});return a.setAttribute("role","tab"),a.setAttribute("type","button"),a.addEventListener("click",()=>{this.activeTabIndex=s,this.updateTabButtons(n),this.renderActivePage(i)}),a});this.updateTabButtons(n);let i=e.createDiv("reminder-settings-tab-content");this.renderActivePage(i)}updateTabButtons(e){e.forEach((t,n)=>{let i=n===this.activeTabIndex;t.toggleClass("is-active",i),t.setAttribute("aria-selected",i?"true":"false")})}renderActivePage(e){e.empty();let t=this.pages[this.activeTabIndex];t!==void 0&&(t.groups.forEach(n=>{n.name!==void 0&&new vu.Setting(e).setName(n.name).setHeading(),n.settings.forEach(i=>{i.createSetting(e)})}),this.registry.forEach(n=>n.update()))}forEach(e){this.pages.forEach(t=>{t.groups.forEach(n=>{n.settings.forEach(i=>{e(i)})})})}},ol=class{unmarshal(e){return gs.parse(e)}marshal(e){return e.toString()}},te=class{unmarshal(e){return e}marshal(e){return e}},sl=class{unmarshal(e){return Fu(e)}marshal(e){return e.map(t=>t.label).join(`
`)}},al=class{unmarshal(e){return e.split(`
`).map(t=>t.trim()).filter(t=>t.length>0)}marshal(e){return e.join(`
`)}},ll=class{unmarshal(e){let t=wi.find(n=>n.name===e);return t!==void 0?t:(console.warn(`Unknown reminder format: ${e}. Falling back to the default format.`),wi[0])}marshal(e){return e.name}};var tr="re-scan",cl=class{constructor(){c(this,"settings",new il);c(this,"reminderTime");c(this,"reminderTimeStep");c(this,"enableNotification");c(this,"reNotifyMutedOnStartup");c(this,"notificationPopupStyle");c(this,"openNoteOnReminderClick");c(this,"useSystemNotification");c(this,"showPopupWithSystemNotification");c(this,"keepSystemNotificationOnScreen");c(this,"focusDoneButtonOnPopup");c(this,"laters");c(this,"weekStart");c(this,"dateFormat");c(this,"dateTimeFormat");c(this,"strictDateFormat");c(this,"autoCompleteTrigger");c(this,"convertNonTaskLines");c(this,"editorReminderDisplay");c(this,"primaryFormat");c(this,"excludedPaths");c(this,"useCustomEmojiForTasksPlugin");c(this,"useReminderTimeFallbackForTasksPlugin");c(this,"removeTagsForTasksPlugin");c(this,"dataviewReminderFieldName");c(this,"linkDatesToDailyNotes");c(this,"yearMonthDisplayFormat");c(this,"monthDayDisplayFormat");c(this,"timeDisplayFormat");c(this,"shortDateWithWeekdayDisplayFormat");c(this,"editDetectionSec");c(this,"reminderCheckIntervalSec");c(this,"showOverdueCountInStatusBar");c(this,"ntfyEnabled");c(this,"ntfyServerUrl");c(this,"ntfyTopic");c(this,"ntfyAccessToken");let e=new yu(this.settings);this.reminderTime=this.settings.newSettingBuilder().key("reminderTime").name("Reminder time").desc("Time when a reminder with no time part will show").tag(tr).text("09:00").placeHolder("Time (hh:mm)").build(new ol),this.reminderTimeStep=this.settings.newSettingBuilder().key("reminderTimeStep").name("Reminder time step (minutes)").desc("Step of time for reminder time (minutes)").number(15).build(new te),this.enableNotification=this.settings.newSettingBuilder().key("enableNotification").name("Enable reminder notifications").desc("If disabled, reminder popups and system notifications are not shown. The reminder list view keeps working.").toggle(!0).build(new te),this.reNotifyMutedOnStartup=this.settings.newSettingBuilder().key("reNotifyMutedOnStartup").name("Re-notify muted reminders on startup").desc('When enabled, reminders you previously muted are notified again the next time Obsidian starts. Useful if you rely on startup notifications to review overdue reminders. If many reminders are overdue, they are shown one after another \u2014 use the "Mute all current notifications" command to silence them again.').toggle(!1).build(new te),this.notificationPopupStyle=this.settings.newSettingBuilder().key("notificationPopupStyle").name("Reminder popup style").desc("Toast: a card in the corner of the window that does not interrupt your work. Modal: a dialog in the center of the window that takes focus.").dropdown("toast").addOption("Toast (corner card)","toast").addOption("Modal (center dialog)","modal").build(new te),this.openNoteOnReminderClick=this.settings.newSettingBuilder().key("openNoteOnReminderClick").name("Open note on reminder click").desc("When clicking a reminder in the reminder list or a system notification, open the note directly instead of showing the reminder popup.").toggle(!1).build(new te),this.useSystemNotification=this.settings.newSettingBuilder().key("useSystemNotification").name("Use system notification").desc("Use system notification for reminder notifications").toggle(!1).build(new te),this.showPopupWithSystemNotification=this.settings.newSettingBuilder().key("showPopupWithSystemNotification").name("Show popup together with system notification").desc("When using system notification, also show the built-in reminder popup at the same time. The popup handles the reminder actions; the system notification acts as an alert only.").toggle(!1).onAnyValueChanged(o=>{o.setEnabled(this.useSystemNotification.value)}).build(new te),this.keepSystemNotificationOnScreen=this.settings.newSettingBuilder().key("keepSystemNotificationOnScreen").name("Keep system notification on screen").desc("Keep the system notification on screen until you interact with it, instead of it disappearing after a few seconds. Only effective on Windows and Linux; ignored on macOS. Enable this if you use the same vault on multiple devices (e.g. via Obsidian Sync): it allows the plugin to dismiss the notification when you complete or snooze the reminder on another device.").toggle(!1).onAnyValueChanged(o=>{o.setEnabled(this.useSystemNotification.value)}).build(new te),this.focusDoneButtonOnPopup=this.settings.newSettingBuilder().key("focusDoneButtonOnPopup").name("Focus Done button on popup").desc("Automatically focus the Done button when a reminder popup opens, so pressing Enter completes the task. Off by default to prevent accidentally completing a reminder you haven't read.").toggle(!1).build(new te),this.laters=this.settings.newSettingBuilder().key("laters").name("Remind me later").desc("Line-separated list of remind me later items").textArea(`In 30 minutes
In 1 hour
In 3 hours
Tomorrow
Next week`).placeHolder(`In 30 minutes
In 1 hour
In 3 hours
Tomorrow
Next week`).build(new sl);let t=this.settings.newSettingBuilder().key("weekStart").name("Week start").desc("Select the first day of the week").dropdown("0");Array.from({length:7},(o,s)=>{let a=P().day(s).format("dddd");t.addOption(a,s.toString())}),this.weekStart=t.build(new te),this.dateFormat=this.settings.newSettingBuilder().key("dateFormat").name("Date format").desc("moment style date format: https://momentjs.com/docs/#/displaying/format/").tag(tr).text("YYYY-MM-DD").placeHolder("YYYY-MM-DD").onAnyValueChanged(o=>{o.setEnabled(e.enableReminderPluginReminderFormat.value)}).build(new te),this.strictDateFormat=this.settings.newSettingBuilder().key("strictDateFormat").name("Strict date format").desc("Strictly parse the date and time").tag(tr).toggle(!1).onAnyValueChanged(o=>{o.setEnabled(e.enableReminderPluginReminderFormat.value)}).build(new te),this.dateTimeFormat=this.settings.newSettingBuilder().key("dateTimeFormat").name("Date and time format").desc("moment() style date time format: https://momentjs.com/docs/#/displaying/format/").tag(tr).text("YYYY-MM-DD HH:mm").placeHolder("YYYY-MM-DD HH:mm").onAnyValueChanged(o=>{o.setEnabled(e.enableReminderPluginReminderFormat.value)}).build(new te),this.linkDatesToDailyNotes=this.settings.newSettingBuilder().key("linkDatesToDailyNotes").name("Link dates to daily notes").desc("When toggled, Dates link to daily notes.").tag(tr).toggle(!1).onAnyValueChanged(o=>{o.setEnabled(e.enableReminderPluginReminderFormat.value)}).build(new te),this.autoCompleteTrigger=this.settings.newSettingBuilder().key("autoCompleteTrigger").name("Calendar popup trigger").desc("Trigger text to show calendar popup").text("(@").placeHolder("(@").onAnyValueChanged(o=>{let s=this.autoCompleteTrigger.value;o.setInfo(`Popup is ${s.length===0?"disabled":"enabled"}`)}).build(new te),this.convertNonTaskLines=this.settings.newSettingBuilder().key("convertNonTaskLines").name("Convert non-task lines when inserting a reminder").desc('When inserting a reminder from the calendar popup on a line that is not a task, convert the line into a task list item ("- [ ] ") automatically. When disabled, a notice is shown instead.').toggle(!0).build(new te),this.editorReminderDisplay=this.settings.newSettingBuilder().key("editorReminderDisplay").name("Show reminder pills in editor").desc("Render each reminder's time as a clickable pill (\u23F0) in Live Preview. Clicking a pill opens the date/time chooser to change it. Disable to show the raw reminder text instead.").toggle(!0).build(new te);let n=this.settings.newSettingBuilder().key("primaryReminderFormat").name("Primary reminder format").desc("Reminder format for generated reminder by calendar popup").dropdown(wi[0].name);wi.forEach(o=>n.addOption(`${o.description} - ${o.example}`,o.name)),this.primaryFormat=n.build(new ll),this.excludedPaths=this.settings.newSettingBuilder().key("excludedPaths").name("Excluded files/folders").desc("Reminders in these files/folders are ignored. One vault-relative path per line (e.g. Templates or Archive/2020).").tag(tr).textArea("").placeHolder(`Templates
Archive/2020`).build(new al),this.useCustomEmojiForTasksPlugin=this.settings.newSettingBuilder().key("useCustomEmojiForTasksPlugin").name("Distinguish between reminder date and due date").desc("Use custom emoji \u23F0 instead of \u{1F4C5} and distinguish between reminder date/time and Tasks Plugin's due date.").tag(tr).toggle(!1).onAnyValueChanged(o=>{o.setEnabled(e.enableTasksPluginReminderFormat.value)}).build(new te),this.useReminderTimeFallbackForTasksPlugin=this.settings.newSettingBuilder().key("useReminderTimeFallbackForTasksPlugin").name("Fall back to due, scheduled, or start date").desc("When the reminder date (\u23F0) is missing, use the due date (\u{1F4C5}), then the scheduled date (\u23F3), then the start date (\u{1F6EB}), in that order.").tag(tr).toggle(!1).onAnyValueChanged(o=>{o.setEnabled(e.enableTasksPluginReminderFormat.value&&this.useCustomEmojiForTasksPlugin.value)}).build(new te),this.removeTagsForTasksPlugin=this.settings.newSettingBuilder().key("removeTagsForTasksPlugin").name("Remove tags from reminder title").desc("If checked, tags(#xxx) are removed from the reminder list view and notification.").tag(tr).toggle(!1).onAnyValueChanged(o=>{o.setEnabled(e.enableTasksPluginReminderFormat.value)}).build(new te),this.dataviewReminderFieldName=this.settings.newSettingBuilder().key("dataviewReminderFieldName").name("Reminder field name").desc("The inline field (e.g. [reminder:: 2021-09-08]) read as the reminder date. On a line that also has a due field, this field takes precedence.").tag(tr).text("reminder").placeHolder("reminder").onAnyValueChanged(o=>{o.setEnabled(e.enableDataviewReminderFormat.value)}).build(new te),this.yearMonthDisplayFormat=this.settings.newSettingBuilder().key("yearMonthDisplayFormat").name("Year & month format").desc(`Moment style year and month format:
https://momentjs.com/docs/#/displaying/format/`).text("YYYY, MMMM").placeHolder("YYYY, MMMM").build(new te),this.monthDayDisplayFormat=this.settings.newSettingBuilder().key("monthDayDisplayFormat").name("Month & day format").desc(`Moment style month and day format:
https://momentjs.com/docs/#/displaying/format/`).text("MM/DD").placeHolder("MM/DD").build(new te),this.shortDateWithWeekdayDisplayFormat=this.settings.newSettingBuilder().key("shortDateWithWeekdayDisplayFormat").name("Short date with weekday format").desc(`Moment style short date with weekday format:
https://momentjs.com/docs/#/displaying/format/`).text("M/DD (ddd)").placeHolder("M/DD (ddd)").build(new te),this.timeDisplayFormat=this.settings.newSettingBuilder().key("timeDisplayFormat").name("Time format").desc(`Moment style time format:
https://momentjs.com/docs/#/displaying/format/`).text("HH:mm").placeHolder("HH:mm").build(new te),this.editDetectionSec=this.settings.newSettingBuilder().key("editDetectionSec").name("Edit detection time").desc("The minimum amount of time (in seconds) after a key is typed that it will be identified as notifiable. Only applies to the Modal popup style; Toast reminders are shown immediately even while typing.").number(10).build(new te),this.reminderCheckIntervalSec=this.settings.newSettingBuilder().key("reminderCheckIntervalSec").name("Reminder check interval").desc("Interval(in seconds) to periodically check whether or not you should be notified of reminders. You will need to restart Obsidian for this setting to take effect.").number(5).build(new te),this.showOverdueCountInStatusBar=this.settings.newSettingBuilder().key("showOverdueCountInStatusBar").name("Show overdue count in status bar").desc("Show the number of overdue reminders in the status bar. Click it to open the reminder list.").toggle(!0).build(new te),this.ntfyEnabled=this.settings.newSettingBuilder().key("ntfyEnabled").name("Enable ntfy scheduled notifications (experimental)").desc("Publish upcoming reminders to the ntfy server below as scheduled push notifications, so you're notified even when Obsidian isn't running (useful on mobile, where plugins can't run in the background). This sends reminder titles to that server, so only enable this if you trust it. Requires an ntfy server running v2.16.0 or later (needed for sequence-ID based scheduled message replacement/deletion). Only reminders due within the next 24 hours are registered \u2014 ntfy itself allows scheduling at most 3 days ahead, and this plugin periodically re-registers reminders to roll that 24-hour window forward.").toggle(!1).build(new te),this.ntfyServerUrl=this.settings.newSettingBuilder().key("ntfyServerUrl").name("ntfy server URL").desc("The ntfy server to publish scheduled notifications to.").text("https://ntfy.sh").placeHolder("https://ntfy.sh").build(new te),this.ntfyTopic=this.settings.newSettingBuilder().key("ntfyTopic").name("ntfy topic").desc("Topic to publish reminders to. Anyone who knows this topic name can subscribe to it and read your reminder titles, so use a long, hard-to-guess name rather than something predictable. May only contain letters, digits, dashes and underscores (1-64 characters).").text("").placeHolder("a-long-random-topic-name").onAnyValueChanged(o=>{let s=this.ntfyTopic.value.trim();o.setValidationError(s.length===0||ai(s)?null:"A topic may only contain letters, digits, dashes and underscores (1-64 characters).")}).build(new te),this.ntfyAccessToken=this.settings.newSettingBuilder().key("ntfyAccessToken").name("ntfy access token").desc("Only needed for a server that requires authentication (a self-hosted instance with access control, for example); leave it empty otherwise. Create one with `ntfy token add <user>` or from the ntfy web app under Account \u2192 Access tokens. The token needs read-write access to the topic above, because this plugin reads, publishes and deletes scheduled messages. It is stored in plain text in this plugin's data.json, which is synced along with your vault if you sync your Obsidian configuration folder.").text("").masked().placeHolder("tk_...").button("Test",async o=>{o.setValidationError(null),o.setInfo("Testing\u2026");let s=await Du(async a=>(0,dp.requestUrl)({...a,throw:!1}),{serverUrl:this.ntfyServerUrl.value,topic:this.ntfyTopic.value,accessToken:this.ntfyAccessToken.value});o.setInfo(s.ok?s.message:null),o.setValidationError(s.ok?null:s.message)}).onAnyValueChanged(o=>{o.setInfo(null)}).build(new te),this.settings.newPage("Notifications").newGroup().addSettings(this.reminderTime,this.reminderTimeStep,this.laters,this.enableNotification,this.reNotifyMutedOnStartup,this.notificationPopupStyle,this.openNoteOnReminderClick,this.useSystemNotification,this.showPopupWithSystemNotification,this.keepSystemNotificationOnScreen,this.focusDoneButtonOnPopup,this.showOverdueCountInStatusBar),this.settings.newPage("Editor").newGroup().addSettings(this.autoCompleteTrigger,this.convertNonTaskLines,this.primaryFormat,this.editorReminderDisplay);let i=this.settings.newPage("Reminder formats");i.newGroup("Reminder plugin format").addSettings(e.enableReminderPluginReminderFormat,this.dateFormat,this.dateTimeFormat,this.strictDateFormat,this.linkDatesToDailyNotes),i.newGroup("Tasks plugin format").addSettings(e.enableTasksPluginReminderFormat,this.useCustomEmojiForTasksPlugin,this.useReminderTimeFallbackForTasksPlugin,this.removeTagsForTasksPlugin),i.newGroup("Dataview format").addSettings(e.enableDataviewReminderFormat,this.dataviewReminderFieldName),i.newGroup("Kanban plugin format").addSettings(e.enableKanbanPluginReminderFormat),this.settings.newPage("Display").newGroup().addSettings(this.yearMonthDisplayFormat,this.monthDayDisplayFormat,this.shortDateWithWeekdayDisplayFormat,this.timeDisplayFormat,this.weekStart),this.settings.newPage("ntfy").newGroup().addSettings(this.ntfyEnabled,this.ntfyServerUrl,this.ntfyTopic,this.ntfyAccessToken),this.settings.newPage("Advanced").newGroup().addSettings(this.excludedPaths,this.editDetectionSec,this.reminderCheckIntervalSec)}wireReminderFormatConfig(){let e=new _o;e.setParameterFunc(_e.now,()=>G.now()),e.setParameter(_e.useCustomEmojiForTasksPlugin,this.useCustomEmojiForTasksPlugin),e.setParameter(_e.linkDatesToDailyNotes,this.linkDatesToDailyNotes),e.setParameter(_e.removeTagsForTasksPlugin,this.removeTagsForTasksPlugin),e.setParameter(_e.useReminderTimeFallbackForTasksPlugin,this.useReminderTimeFallbackForTasksPlugin),e.setParameter(_e.dataviewReminderFieldName,this.dataviewReminderFieldName),Vd(e)}forEach(e){this.settings.forEach(e)}},yu=class{constructor(e){c(this,"settings",e);c(this,"settingKeyToFormatName",new Map);c(this,"reminderFormatSettings",[]);c(this,"enableReminderPluginReminderFormat");c(this,"enableTasksPluginReminderFormat");c(this,"enableKanbanPluginReminderFormat");c(this,"enableDataviewReminderFormat");this.enableReminderPluginReminderFormat=this.createUseReminderFormatSetting(Xl),this.enableTasksPluginReminderFormat=this.createUseReminderFormatSetting(Ul),this.enableKanbanPluginReminderFormat=this.createUseReminderFormatSetting(Ql),this.enableDataviewReminderFormat=this.createUseReminderFormatSetting(Wl)}createUseReminderFormatSetting(e){let t=`enable${e.name}`,n=this.settings.newSettingBuilder().key(t).name(`Enable ${e.description}`).desc("Recognize reminders written in this format.").tag(tr).toggle(e.defaultEnabled).onAnyValueChanged(i=>{var o;i.setInfo(`Example: ${(o=e.format.appendReminder("- [ ] Task 1",G.now()))==null?void 0:o.insertedLine}`)}).build(new te);return this.settingKeyToFormatName.set(t,e),this.reminderFormatSettings.push(n),n.rawValue.onChanged(()=>{this.updateReminderFormat()}),n}updateReminderFormat(){let e=this.reminderFormatSettings.filter(t=>t.value).map(t=>this.settingKeyToFormatName.get(t.key)).filter(t=>t!==void 0);Wd(e)}};var ps=class{constructor(e,t){c(this,"store",e);c(this,"reminders",t);c(this,"restoring",!0);c(this,"resolveLoaded",()=>{});c(this,"loaded",new Promise(e=>{this.resolveLoaded=e}));c(this,"changed",!1);c(this,"scanned",new bn(!1));c(this,"debug",new bn(!1));c(this,"dndUntil",new bn(null));c(this,"_settings",new cl);this._settings.wireReminderFormatConfig(),this.settings.forEach(n=>{n.rawValue.onChanged(()=>{this.restoring||(n.hasTag(tr)&&(this.scanned.value=!1),this.changed=!0)})})}async load(){try{await this.doLoad()}finally{this.resolveLoaded()}}async doLoad(){console.debug("Load reminder plugin data");let e=await this.store.loadData();if(!e){this.scanned.value=!1;return}this.scanned.value=e.scanned,e.debug!=null&&(this.debug.value=e.debug),this.dndUntil.value=e.dndUntil!=null?G.ofEpochMillis(e.dndUntil):null,this.settings.forEach(i=>{i.load(e.settings)});let t=!this.settings.reNotifyMutedOnStartup.value,n=e.reminders;n&&Object.keys(n).forEach(i=>{let o=n[i];o&&this.reminders.replaceFile(i,o.map(s=>{var l;let a=new fi(i,s.title,G.parse(s.time),s.rowNumber,!1);return a.muteNotification=t&&((l=s.muted)!=null?l:!1),a}))}),this.changed=!1,this.restoring&&(this.restoring=!1)}async save(e=!1){var i,o;if(!e&&!this.changed)return;console.debug("Save reminder plugin data: force=%s, changed=%s",e,this.changed);let t={};this.reminders.fileToReminders.forEach((s,a)=>{t[a]=s.map(l=>({title:l.title,time:l.time.toString(),rowNumber:l.rowNumber,muted:l.muteNotification}))});let n={};this.settings.forEach(s=>{s.store(n)}),await this.store.saveData({scanned:this.scanned.value,reminders:t,debug:this.debug.value,dndUntil:(o=(i=this.dndUntil.value)==null?void 0:i.getTimeInMillis())!=null?o:null,settings:n}),this.changed=!1}get settings(){return this._settings}};var po=require("obsidian");var ul=class extends po.Plugin{constructor(t,n){super(t,n);c(this,"_data");c(this,"settings");c(this,"_ui");c(this,"_reminders");c(this,"_fileSystem");c(this,"_notificationWorker");c(this,"_ntfyController");this._reminders=new Rs(()=>{this.ui&&this.ui.invalidate(),this.data.changed=!0,this._ntfyController&&this._ntfyController.notifyRemindersChanged()}),this._data=new ps(this,this.reminders),this.settings=this.data.settings,this.reminders.reminderTime=this.settings.reminderTime,xr.setTimeFormat(this.settings.dateFormat,this.settings.dateTimeFormat,this.settings.strictDateFormat),this._ui=new ds(this),this._fileSystem=new fs(t.vault,this.reminders,()=>{this.ui.reload(!0)},()=>this.settings.excludedPaths.value,()=>this.data.loaded),this._notificationWorker=new ho({registerInterval:i=>this.registerInterval(i),isLayoutReady:()=>this.app.workspace.layoutReady,reloadUI:i=>this.ui.reload(i),isEditing:()=>this.ui.isEditing(),isPopupIntrusive:()=>this.settings.notificationPopupStyle.value!=="toast",showReminder:i=>this.ui.showReminder(i),isScanned:()=>this.data.scanned.value,markScanned:()=>{this.data.scanned.value=!0},saveData:i=>{this.data.save(i)},reloadRemindersInAllFiles:()=>this.fileSystem.reloadRemindersInAllFiles(),getExpiredReminders:()=>this.reminders.getExpiredReminders(this.settings.reminderTime.value),checkIntervalSec:()=>this.settings.reminderCheckIntervalSec.value,isNotificationEnabled:()=>this.settings.enableNotification.value,isNotificationPaused:()=>ui(this.data.dndUntil.value,G.now())}),this._ntfyController=new vo({isEnabled:()=>this.settings.ntfyEnabled.value,serverUrl:()=>this.settings.ntfyServerUrl.value,topic:()=>this.settings.ntfyTopic.value,accessToken:()=>this.settings.ntfyAccessToken.value,reminders:()=>this.reminders.reminders,defaultTime:()=>this.settings.reminderTime.value,vaultName:()=>this.app.vault.getName(),registerInterval:i=>this.registerInterval(i),request:i=>(0,po.requestUrl)({...i,throw:!1}),notify:i=>{new po.Notice(i)}});for(let i of[this.settings.ntfyEnabled,this.settings.ntfyServerUrl,this.settings.ntfyTopic,this.settings.ntfyAccessToken])i.rawValue.onChanged(()=>{this._ntfyController.notifySettingsChanged()})}async onload(){this.ui.onload(),this.app.workspace.onLayoutReady(async()=>{await this.data.load(),this.ui.onLayoutReady(),this.fileSystem.onload(this),this._notificationWorker.startPeriodicTask(),this._ntfyController.start()})}onunload(){this.ui.onunload(),this._ntfyController.stop()}get reminders(){return this._reminders}get ui(){return this._ui}get fileSystem(){return this._fileSystem}get data(){return this._data}};
/* nosourcemap */