424 lines
1.3 MiB
Plaintext
424 lines
1.3 MiB
Plaintext
/*
|
||
THIS IS A GENERATED/BUNDLED FILE BY ESBUILD
|
||
if you want to view the source, please visit the github repository of this plugin
|
||
*/
|
||
|
||
var U7=Object.create;var iv=Object.defineProperty;var V7=Object.getOwnPropertyDescriptor;var q7=Object.getOwnPropertyNames;var W7=Object.getPrototypeOf,z7=Object.prototype.hasOwnProperty;var WN=r=>{throw TypeError(r)};var H7=(r,e,t)=>e in r?iv(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t;var b=(r,e,t)=>()=>{if(t)throw t[0];try{return r&&(e=r(r=0)),e}catch(n){throw t=[n],n}};var j7=(r,e)=>()=>{try{return e||r((e={exports:{}}).exports,e),e.exports}catch(t){throw e=0,t}},Jr=(r,e)=>{for(var t in e)iv(r,t,{get:e[t],enumerable:!0})},zN=(r,e,t,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of q7(e))!z7.call(r,i)&&i!==t&&iv(r,i,{get:()=>e[i],enumerable:!(n=V7(e,i))||n.enumerable});return r};var HN=(r,e,t)=>(t=r!=null?U7(W7(r)):{},zN(e||!r||!r.__esModule?iv(t,"default",{value:r,enumerable:!0}):t,r)),G7=r=>zN(iv({},"__esModule",{value:!0}),r);var ae=(r,e,t)=>H7(r,typeof e!="symbol"?e+"":e,t),sI=(r,e,t)=>e.has(r)||WN("Cannot "+t);var z=(r,e,t)=>(sI(r,e,"read from private field"),t?t.call(r):e.get(r)),it=(r,e,t)=>e.has(r)?WN("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(r):e.set(r,t),et=(r,e,t,n)=>(sI(r,e,"write to private field"),n?n.call(r,t):e.set(r,t),t),xt=(r,e,t)=>(sI(r,e,"access private method"),t);var O2,N2,L2=b(()=>{O2=r=>{let e,t=new Set,n=(c,u)=>{let d=typeof c=="function"?c(e):c;if(!Object.is(d,e)){let f=e;e=u??(typeof d!="object"||d===null)?d:Object.assign({},e,d),t.forEach(p=>p(e,f))}},i=()=>e,a={setState:n,getState:i,getInitialState:()=>l,subscribe:c=>(t.add(c),()=>t.delete(c))},l=e=r(n,i,a);return a},N2=(r=>r?O2(r):O2)});function Nv(r){if(r.kind)return r.kind;let e=(r.name??"").toLowerCase(),t=pX(r.endpoint),n=i=>t===i||t.endsWith(`.${i}`);return e==="anthropic"||n("api.anthropic.com")?"anthropic":e==="gemini"||n("generativelanguage.googleapis.com")?"gemini":"openai"}function pX(r){let e=(r??"").trim();if(!e)return"";for(let t of[e,`https://${e}`])try{return new URL(t).hostname.toLowerCase()}catch{}return""}function fX(r){return r.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"")||"provider"}function yT(r,e){let t=fX(r),n=new Set(e.map(o=>o.id).filter(o=>!!o)),i=t;for(let o=2;n.has(i);o++)i=`${t}-${o}`;return i}function bT(r){let e=!1,t=new Set;for(let n of r){if(n.id&&!t.has(n.id)){t.add(n.id);continue}n.id=yT(n.id??n.name,r),t.add(n.id),e=!0}return e}function mu(r,e){return e&&e.name===r?e:void 0}function wT(r){return Lv[r].map(e=>({...e}))}var Lv,B2,mX,hX,CT,es=b(()=>{Lv={openai:[{name:"gpt-5.5",maxTokens:105e4,maxOutputTokens:128e3,supportsTemperature:!1},{name:"gpt-5.4",maxTokens:105e4,maxOutputTokens:128e3,supportsTemperature:!1},{name:"gpt-5.4-mini",maxTokens:4e5,maxOutputTokens:128e3,supportsTemperature:!1},{name:"gpt-5.4-nano",maxTokens:4e5,maxOutputTokens:128e3,supportsTemperature:!1},{name:"gpt-4.1",maxTokens:1047576,maxOutputTokens:32768,supportsTemperature:!0},{name:"gpt-4.1-mini",maxTokens:1047576,maxOutputTokens:32768,supportsTemperature:!0},{name:"gpt-4o",maxTokens:128e3,maxOutputTokens:16384,supportsTemperature:!0},{name:"gpt-4o-mini",maxTokens:128e3,maxOutputTokens:16384,supportsTemperature:!0},{name:"o3",maxTokens:2e5,maxOutputTokens:1e5,supportsTemperature:!1},{name:"o4-mini",maxTokens:2e5,maxOutputTokens:1e5,supportsTemperature:!1}],google:[{name:"gemini-3.5-flash",maxTokens:1048576,maxOutputTokens:65536,supportsTemperature:!0},{name:"gemini-3.1-pro-preview",maxTokens:1048576,maxOutputTokens:65536,supportsTemperature:!0},{name:"gemini-3.1-flash-lite",maxTokens:1048576,maxOutputTokens:65536,supportsTemperature:!0},{name:"gemini-3-pro-preview",maxTokens:1048576,maxOutputTokens:65536,supportsTemperature:!0},{name:"gemini-3-flash-preview",maxTokens:1048576,maxOutputTokens:65536,supportsTemperature:!0},{name:"gemini-2.5-pro",maxTokens:1048576,maxOutputTokens:65536,supportsTemperature:!0},{name:"gemini-2.5-flash",maxTokens:1048576,maxOutputTokens:65536,supportsTemperature:!0},{name:"gemini-2.5-flash-lite",maxTokens:1048576,maxOutputTokens:65536,supportsTemperature:!0}],anthropic:[{name:"claude-fable-5",maxTokens:1e6,maxOutputTokens:128e3,supportsTemperature:!1},{name:"claude-sonnet-5",maxTokens:1e6,maxOutputTokens:128e3,supportsTemperature:!1},{name:"claude-opus-4-8",maxTokens:1e6,maxOutputTokens:128e3,supportsTemperature:!1},{name:"claude-opus-4-5",maxTokens:2e5,maxOutputTokens:64e3,supportsTemperature:!0},{name:"claude-haiku-4-5",maxTokens:2e5,maxOutputTokens:64e3,supportsTemperature:!0}]},B2={openai:["gpt-4-32k","gpt-4-1106-preview"],google:["gemini-1.5-pro","gemini-1.5-flash","gemini-1.5-flash-8b"]};mX={id:"openai",name:"OpenAI",endpoint:"https://api.openai.com/v1",kind:"openai",apiKey:"",models:wT("openai"),autoSyncModels:!0,modelSource:"modelsDev"},hX={id:"gemini",name:"Gemini",endpoint:"https://generativelanguage.googleapis.com",kind:"gemini",apiKey:"",models:wT("google"),autoSyncModels:!0,modelSource:"modelsDev"},CT=[mX,hX]});function U2(r,e){return Object.prototype.hasOwnProperty.call(r,e)?r[e]:void 0}function Bv(r,e=Yf){let t=r.trim();if(!t)return r;let n=U2(e,t.toLowerCase());if(n)return n;let[i,...o]=t.split(/\s+/),s=U2(e,i.toLowerCase());return s?[s,...o].join(" "):r}function V2(r){let e={},t=r.split(/\r?\n/);for(let n of t){let i=n.trim();if(!i||i.startsWith("#"))continue;let o=i.indexOf("=");if(o===-1)continue;let s=i.slice(0,o).trim().toLowerCase(),a=i.slice(o+1).trim();!s||!a||Object.defineProperty(e,s,{value:a,enumerable:!0,writable:!0,configurable:!0})}return e}function c0(r){return Object.entries(r).filter(([e,t])=>e&&t).map(([e,t])=>`${e} = ${t}`).join(`
|
||
`)}function Uv(r){let e=Object.entries(r);if(e.length===0)return[];let n=["t","tm","yd"].map(s=>{let a=r[s];return a?[s,a]:null}).filter(s=>s!==null),i=new Set(n.map(([s])=>s)),o=e.filter(([s])=>!i.has(s)).sort((s,a)=>{let l=s[0].length-a[0].length;return l!==0?l:s[0].localeCompare(a[0])});return[...n,...o]}function xT(r){return Uv(r).map(([e,t])=>`${e}=${t}`).join(", ")}var Yf,Wd=b(()=>{Yf={t:"today",tm:"tomorrow",yd:"yesterday",nw:"next week",nm:"next month",ny:"next year",lw:"last week",lm:"last month",ly:"last year"}});var ET,u0=b(()=>{es();Wd();ET={choices:[],inputPrompt:"single-line",persistInputPromptDrafts:!0,useSelectionAsCaptureValue:!0,searchNestedChoices:!0,templateFolderLauncherRow:"bottom",devMode:!1,templateFolderPaths:[],announceUpdates:"major",version:"0.0.0",globalVariables:{},onePageInputEnabled:!1,disableOnlineFeatures:!0,enableUriCallbacks:!1,enableRibbonIcon:!1,showCaptureNotification:!0,showInputCancellationNotification:!1,enableTemplatePropertyTypes:!1,dateAliases:Yf,ai:{defaultModel:"Ask me",defaultSystemPrompt:'As an AI assistant within Obsidian, your primary goal is to help users manage their ideas and knowledge more effectively. Format your responses using Markdown syntax. Please use the [[Obsidian]] link format. You can write aliases for the links by writing [[Obsidian|the alias after the pipe symbol]]. To use mathematical notation, use LaTeX syntax. LaTeX syntax for larger equations should be on separate lines, surrounded with double dollar signs ($$). You can also inline math expressions by wrapping it in $ symbols. For example, use $$w_{ij}^{\\text{new}}:=w_{ij}^{\\text{current}}+\\eta\\cdot\\delta_j\\cdot x_{ij}$$ on a separate line, but you can write "($\\eta$ = learning rate, $\\delta_j$ = error term, $x_{ij}$ = input)" inline.',promptTemplatesFolderPath:"",showAssistant:!0,providers:CT,confirmToolCalls:"destructive"},migrations:{migrateToMacroIDFromEmbeddedMacro:!0,useQuickAddTemplateFolder:!1,incrementFileNameSettingMoveToDefaultBehavior:!1,consolidateFileExistsBehavior:!1,repairTemplateFileExistsBehavior:!1,mutualExclusionInsertAfterAndWriteToBottomOfFile:!1,setVersionAfterUpdateModalRelease:!1,addDefaultAIProviders:!1,removeMacroIndirection:!1,migrateFileOpeningSettings:!1,backfillFileOpeningDefaults:!1,setProviderModelDiscoveryMode:!1,migrateProviderApiKeysToSecretStorage:!1,migrateToMultipleTemplateFolders:!1,refreshStaleDefaultModelSeeds:!1,pinAiModelRefs:!1}}});function gt(r){if(typeof structuredClone=="function")try{return structuredClone(r)}catch{}return hu(r,new Map)}function hu(r,e){if(r===null||typeof r!="object")return r;if(e.has(r))return e.get(r);if(r instanceof Date){let i=new Date(r.getTime());return e.set(r,i),i}if(Array.isArray(r)){let i=[];e.set(r,i);for(let o of r)i.push(hu(o,e));return i}if(r instanceof Map){let i=new Map;e.set(r,i);for(let[o,s]of r.entries())i.set(hu(o,e),hu(s,e));return i}if(r instanceof Set){let i=new Set;e.set(r,i);for(let o of r.values())i.add(hu(o,e));return i}if(r instanceof RegExp){let i=new RegExp(r.source,r.flags);return i.lastIndex=r.lastIndex,e.set(r,i),i}if(r instanceof ArrayBuffer){let i=r.slice(0);return e.set(r,i),i}if(ArrayBuffer.isView(r)){if(r instanceof DataView){let a=new DataView(hu(r.buffer,e),r.byteOffset,r.byteLength);return e.set(r,a),a}let i=r,o=hu(i.buffer,e),s=new i.constructor(o,i.byteOffset,i.length);return e.set(r,s),s}let t=Object.getPrototypeOf(r),n=Object.create(t);e.set(r,n);for(let[i,o]of Object.entries(r))Object.defineProperty(n,i,{value:hu(o,e),writable:!0,enumerable:!0,configurable:!0});return n}var yi=b(()=>{});var le,It=b(()=>{L2();u0();yi();le=(()=>{let r=N2((i,o)=>({...gt(ET)})),{getState:e,setState:t,subscribe:n}=r;return{getState:e,replaceState:i=>t(i,!0),setState:t,subscribe:n}})()});var zd,Vv,F,Me=b(()=>{zd=class zd{register(e){return zd.loggers.push(e),this}logError(e){let t=e instanceof Error?e.message:e,n=e instanceof Error?e.stack:void 0,i=e instanceof Error?e:void 0;zd.loggers.forEach(o=>o.logError(t,n,i))}logWarning(e){let t=e instanceof Error?e.message:e,n=e instanceof Error?e.stack:void 0,i=e instanceof Error?e:void 0;zd.loggers.forEach(o=>o.logWarning(t,n,i))}logMessage(e){let t=e instanceof Error?e.message:e,n=e instanceof Error?e.stack:void 0,i=e instanceof Error?e:void 0;zd.loggers.forEach(o=>o.logMessage(t,n,i))}};zd.loggers=[];Vv=zd,F=new Vv});var Rs,q2,d0,po,ac,lc,Aa,TT,Kf,Qf,Xf,cc,Hd,d$e,jd,_T,AT,gu,p0,f0,p$e,f$e,m$e,ir,Wr,Vi,m0,vu,$s,fl,uc,kT,Os,h0,g0,v0,W2,z2,H2,j2,G2,Y2,K2,Q2,X2,Z2,J2,y0,eB,tB,rB,nB,iB,oB,sB,aB,lB,cB,uB,dB,pB,b0,Gd,fB,Tt=b(()=>{Rs="{{value}}",q2="{{name}}",d0=new RegExp(/^-?[0-9]*$/),po="top",ac="bottom",lc="cursor",Aa="ordered",TT=new RegExp(/{{DATE(\+-?[0-9]+)?(?:\|((?:startof|endof):[a-z]+))?}}/i),Kf=new RegExp(/{{DATE:((?:[^}\n\r+|]|\|(?!(?:startof|endof):[a-z]))*)(\+-?[0-9]+)?(?:\|((?:startof|endof):[a-z]+))?}}/i),Qf=new RegExp(/{{TIME}}/i),Xf=new RegExp(/{{TIME:([^}\n\r+]*)}}/i),cc=new RegExp(/{{(?:NAME|VALUE)(?!:)(?:\|[^\n\r}]*)?}}/i),Hd=new RegExp(/{{VALUE:([^\n\r}]*)}}/i),d$e=new RegExp(/{{FIELD:([^\n\r}]*)}}/i),jd="FIELD:",_T=new RegExp(/{{FIELD:([^\n\r}|{]*)(\|[^\n\r}{]*)?}}/i),AT=new RegExp(/{{FILE:([^\n\r{}]*)}}/i),gu=new RegExp(/{{VDATE:([^\n\r},|{]*)(?:,([^\n\r}|{]*))?(?:\|([^\n\r}{]*))?}}/i),p0=new RegExp(/{{LINKCURRENT}}/i),f0=new RegExp(/{{LINKSECTION}}/i),p$e=new RegExp(/{{FILENAMECURRENT}}/i),f$e=new RegExp(/{{FOLDERCURRENT(\|name)?}}/i),m$e=new RegExp(/{{FOLDER(\|name)?}}/i),ir=new RegExp(/\.md$/i),Wr=new RegExp(/\.canvas$/i),Vi=new RegExp(/\.base$/i),m0=new RegExp(/\.js$/),vu=new RegExp(/{{MACRO:([^\n\r}]*)}}/i),$s=new RegExp(/{{TEMPLATE:([^\n\r}]*\.(?:md|canvas|base))}}/i),fl=new RegExp(/{{GLOBAL_VAR:([^\n\r}]*)}}/i),uc=new RegExp(/`{3,}js quickadd([\s\S]*?)`{3,}/),kT=new RegExp(/{{MVALUE}}/i),Os=new RegExp(/{{TITLE}}/i),h0=new RegExp(/{{SELECTED}}/i),g0=new RegExp(/{{CLIPBOARD}}/i),v0=new RegExp(/{{RANDOM:(\d+)}}/i),W2=new RegExp(/\[\[([^\]]*)$/),z2=new RegExp(/#([^ ]*)$/),H2=new RegExp(/{{[D]?[A]?[T]?[E]?[}]?[}]?$/i),j2=new RegExp(/{{[D]?[A]?[T]?[E]?[:]?$|{{DATE:[^\n\r}]*}}$/i),G2=new RegExp(/{{[N]?[A]?[M]?[E]?[}]?[}]?$/i),Y2=new RegExp(/{{[V]?[A]?[L]?[U]?[E]?[}]?[}]?$/i),K2=new RegExp(/{{[V]?[A]?[L]?[U]?[E]?[:]?$|{{VALUE:[^\n\r}]*}}$/i),Q2=new RegExp(/{{[V]?[D]?[A]?[T]?[E]?[:]?$|{{VDATE:[^\n\r}]*}}$/i),X2=new RegExp(/{{[L]?[I]?[N]?[K]?[C]?[U]?[R]?[R]?[E]?[N]?[T]?[}]?[}]?$/i),Z2=new RegExp(/^\{\{(?:l(?:i(?:n(?:k(?:s(?:e(?:c(?:t(?:i(?:o(?:n(?:\}\}?)?)?)?)?)?)?)?)?)?)?)?)?$/i),J2=new RegExp(/{{[F]?[I]?[L]?[E]?[N]?[A]?[M]?[E]?[C]?[U]?[R]?[R]?[E]?[N]?[T]?[}]?[}]?$/i),y0=new RegExp(/{{[F]?[O]?[L]?[D]?[E]?[R]?[C]?[U]?[R]?[R]?[E]?[N]?[T]?[}]?[}]?$/i),eB=new RegExp(/{{[F]?[O]?[L]?[D]?[E]?[R]?[}]?[}]?$/i),tB=new RegExp(/{{[F]?[I]?[L]?[E]?[:]?$/i),rB=new RegExp(/{{[F]?[I]?[E]?[L]?[D]?[:]?$/i),nB=new RegExp(/{{[T]?[E]?[M]?[P]?[L]?[A]?[T]?[E]?[:]?$|{{TEMPLATE:[^\n\r}]*[}]?[}]?$/i),iB=new RegExp(/{{[M]?[A]?[C]?[R]?[O]?[:]?$|{{MACRO:[^\n\r}]*}}$/i),oB=new RegExp(/{{[M]?[V]?[A]?[L]?[U]?[E]?[}]?[}]?/i),sB=new RegExp(/{{[T]?[I]?[T]?[L]?[E]?[}]?[}]?/i),aB=new RegExp(/{{[S]?[E]?[L]?[E]?[C]?[T]?[E]?[D]?[}]?[}]?/i),lB=new RegExp(/{{[C]?[L]?[I]?[P]?[B]?[O]?[A]?[R]?[D]?[}]?[}]?$/i),cB=new RegExp(/{{[R]?[A]?[N]?[D]?[O]?[M]?[:]?$|{{RANDOM:[^\n\r}]*}}$/i),uB=new RegExp(/{{[G]?[L]?[O]?[B]?[A]?[L]?[_]?[V]?[A]?[R]?[:]?$|{{GLOBAL_VAR:[^\n\r}]*}}$/i),dB=new RegExp(/{{[T]?[I]?[M]?[E]?[}]?[}]?/i),pB=new RegExp(/{{[T]?[I]?[M]?[E]?[:]?$|{{TIME:[^\n\r}]*}}$/i),b0="__qa.",Gd=`${b0}captureTargetFilePath`,fB=new RegExp(/\[\[([^\]]*)\]\]/)});var ST=b(()=>{});var Nt,Ns=b(()=>{Nt=class extends Error{constructor(e){super(e||"Macro execution aborted"),this.name="MacroAbortError"}}});function rn(){return new St(yu)}var St,yu,zr=b(()=>{Ns();St=class extends Nt{},yu="Input cancelled by user"});function Yd(r,e){if(r instanceof Error){if(!e)return r;let n=new Error(`${e}: ${r.message}`);return n.name=r.name,n.stack=r.stack,n}if(typeof r=="string")return new Error(e?`${e}: ${r}`:r);let t=e?`${e}: ${String(r)}`:String(r);return new Error(t)}function Dt(r){return r instanceof St?!0:typeof r=="string"&&gX.has(r)}function gB(r){return typeof r=="object"&&r!==null||typeof r=="function"}function bX(r,e){let t=r;for(let n=0;n<yX&&gB(t);n++){let i=hB.get(t);if(i!==void 0&&e-i<vX)return!0;t=t.cause}return!1}function lt(r,e,t="ERROR"){let n=Date.now();if(bX(r,n))return!1;gB(r)&&hB.set(r,n);let i=Yd(r,e);switch(t){case"ERROR":F.logError(i);break;case"WARNING":F.logWarning(i);break;case"LOG":F.logMessage(i);break;default:F.logError(i)}return!0}function Zf(r,e,t="ERROR"){return Dt(r)?!1:lt(r,e,t)}function vB(r,e,t="ERROR"){try{return r()}catch(n){lt(n,e,t);return}}function Jf(r,e){let t=n=>{Zf(n,r)};return(...n)=>{try{let i=e(...n);typeof i?.then=="function"&&Promise.resolve(i).catch(t)}catch(i){t(i)}}}var w0,gX,hB,vX,yX,Cr=b(()=>{Me();ST();zr();w0=100;gX=new Set(["no input given.","No input given.","cancelled"]),hB=new WeakMap,vX=1e4,yX=8});function T0(r,e){try{let t=r.workspace.getActiveViewOfType(TB.MarkdownView);if(!t||t.file?.path!==e.path)return{cursor:null,value:null};let n=t.editor,i=n?.getCursor?.(),o=i&&typeof i.line=="number"&&typeof i.ch=="number"?{line:i.line,ch:i.ch}:null,s=typeof n?.getValue=="function"?n.getValue():null;return{cursor:o,value:s}}catch{return{cursor:null,value:null}}}function IX(r,e){return r!==null&&e!==null&&(r.line!==e.line||r.ch!==e.ch)}function xB(r){return typeof r!="string"?null:[...r.matchAll(DX)].length}function PX(r,e){let t=xB(r),n=xB(e);return t!==null&&n!==null&&t>n}function EB(r,e){return IX(r.cursor,e.cursor)||PX(r.value,e.value)}async function IT(r,e,t=500){try{let n=r.vault.adapter;if(!("stat"in n)||typeof n.stat!="function")return;let i=await n.stat(e.path);if(!i)return;let o=i.mtime,s=Date.now(),a=30;for(;Date.now()-s<t;){await zv(a);let l=await n.stat(e.path);if(!l||l.mtime===o)return;o=l.mtime,a=Math.min(a*2,200)}}catch(n){F.logWarning(`waitForFileSettle: fallback due to adapter/stat failure \u2013 ${n.message}`)}}function PT(r){return r.plugins.plugins["templater-obsidian"]}function Kd(r){let e=PT(r);return e||null}function Hv(r){return!!Kd(r)?.settings?.trigger_on_file_creation}function zv(r){return new Promise(e=>window.setTimeout(e,r))}async function k0(r,e,t={}){if(e.extension!=="md"||!Hv(r))return;let i=Kd(r)?.templater?.files_with_pending_templates;if(!(i instanceof Set)){await _B(r,e,{timeoutMs:t.timeoutMs??5e3,gracePeriodMs:t.appearTimeoutMs??2500,quietPeriodMs:200});return}let{timeoutMs:o=5e3,appearTimeoutMs:s=2500}=t,a=Date.now();for(;Date.now()-a<s&&!i.has(e.path);)await zv(50);for(;Date.now()-a<o&&i.has(e.path);)await zv(50);await IT(r,e,800)}async function MX(r,e,t){if(!(A0>0)&&t.size===0){if(Wv){await Wv;return}Wv=(async()=>{try{r.workspace.trigger("templater:all-templates-executed"),await e.templater?.functions_generator?.teardown?.()}catch(n){F.logWarning(`withTemplaterFileCreationSuppressed: teardown failed \u2013 ${n.message}`)}})();try{await Wv}finally{Wv=null}}}async function S0(r,e,t){let n=Kd(r),i=n?.templater?.files_with_pending_templates;if(!n||!Hv(r)||!(i instanceof Set))return await t();A0++;let o=_0.get(e);o||(o={count:0,hadPathInitially:i.has(e)},_0.set(e,o),o.hadPathInitially||i.add(e)),o.count++;let s=!1;try{let a=await t();return s=!0,a}finally{o.count--,A0--,o.count<=0&&(_0.delete(e),o.hadPathInitially||(s&&await zv(FX),i.delete(e),await MX(r,n,i)))}}async function _B(r,e,t={}){let{timeoutMs:n=2e3,quietPeriodMs:i=150,gracePeriodMs:o=800}=t;try{let s=r.vault.adapter;if(!("stat"in s)||typeof s.stat!="function")return;let a=await s.stat(e.path);if(!a)return;let l=a.mtime,c=Date.now(),u=!1,d=c,f=50;for(;Date.now()-d<n;){await zv(f);let p=await s.stat(e.path);if(!p)return;let m=Date.now();if(p.mtime!==l){u=!0,l=p.mtime,c=m,f=50;continue}if(u){if(m-c>=i)return}else if(m-d>=o)return;f=Math.min(Math.floor(f*1.5),200)}}catch(s){F.logWarning(`waitForFileToStopChanging: fallback due to adapter/stat failure \u2013 ${s.message}`)}}async function RX(r,e){let t=DT.get(r)??Promise.resolve(),n,i=new Promise(s=>{n=()=>s()}),o=t.catch(()=>{}).then(()=>i);DT.set(r,o),o.finally(()=>{DT.get(r)===o&&DT.delete(r)}).catch(()=>{}),await t.catch(()=>{});try{return await e()}finally{n()}}async function Qd(r,e,t={}){if(e.extension!=="md")return;let n=Kd(r),i=n?.templater,o=i?.overwrite_file_commands;if(!n||!i||typeof o!="function")return;let{skipIfNoTags:s=!0,postWait:a=!0}=t;await RX(e.path,async()=>{await IT(r,e);let l;try{l=await r.vault.read(e)}catch(c){lt(c,`overwriteTemplaterOnce: failed to read ${e.path} before render`);return}if(!(s&&!l.includes("<%")))try{await o.call(i,e),a&&await IT(r,e,800)}catch(c){try{await r.vault.modify(e,l)}catch(u){F.logWarning(`Failed to rollback ${e.path} after Templater error: ${u.message}`)}lt(c,`Templater failed on ${e.path}. Rolled back to pre-render state.`)}})}async function dc(r,e,t){if(t.extension!=="md")return e;let n=Kd(r),i=n?.templater,o=i?.parse_template;if(!n||!i||typeof o!="function")return e;let s=i.create_running_config,a=typeof s=="function"?s.call(i,void 0,t,4):{target_file:t,run_mode:4,frontmatter:{}};return await o.call(i,a,e)}async function wu(r,e){if(e.extension!=="md"||r.workspace.getActiveFile()?.path!==e.path)return!1;let t=Kd(r),n=!!t?.settings?.auto_jump_to_cursor,i=t?.editor_handler,o=i?.jump_to_next_cursor_location;if(!n)return!1;let s=T0(r,e);if(typeof o=="function")try{return await o.call(i,e,!0),EB(s,T0(r,e))}catch(a){F.logWarning(`jumpToNextTemplaterCursorIfPossible: API failed \u2013 ${a.message}`)}try{return!r.commands.executeCommandById?.("templater-obsidian:jump-to-next-cursor-location")?!1:EB(s,T0(r,e))}catch{}return!1}var TB,DX,_0,A0,Wv,FX,DT,AB=b(()=>{TB=require("obsidian");Me();Cr();DX=/<%\s*tp\.file\.cursor\([0-9]*\)\s*%>/g;_0=new Map,A0=0,Wv=null,FX=350;DT=new Map});function Nn(r){let e=r.workspace.getActiveViewOfType(kB.MarkdownView);return e?.editor?e:null}var kB,Cu=b(()=>{kB=require("obsidian")});function tm(r){return $X.has(r)}function Zd(r){return r==="inFrontmatter"}function FT(r){return OX.has(r)}function NX(r,e,t){return r==="embed"&&t.type==="activeFile"&&tm(e)?"embed":"link"}function LX(r,e,t,n){return r==="selection"&&t.type==="activeFile"&&FT(e)&&n==="link"?"selection":"none"}function BX(r){return r?.type==="specifiedFile"?{type:"specifiedFile",path:typeof r.path=="string"?r.path.trim():""}:{type:"activeFile"}}function UX(r){return typeof r=="object"&&r!==null&&"enabled"in r&&"placement"in r}function xu(r){if(UX(r)){let e=r.placement??"replaceSelection",t=BX(r.destination),n=NX(r.linkType,e,t);return{enabled:r.enabled,placement:e,requireActiveFile:r.requireActiveFile??!0,linkType:n,displayText:LX(r.displayText,e,t,n),destination:t,frontmatterProperty:r.frontmatterProperty,frontmatterHandling:Zd(e)?r.frontmatterHandling??Xd:r.frontmatterHandling}}return{enabled:r,placement:"replaceSelection",requireActiveFile:!!r,linkType:"link",displayText:"none",destination:{type:"activeFile"}}}var Xd,$X,OX,Jd=b(()=>{Xd="alwaysAppend",$X=new Set(["replaceSelection","afterSelection","endOfLine","newLine"]);OX=new Set(["replaceSelection","afterSelection"])});function VX(r){return r.vault.getConfig?.("useMarkdownLinks")===!0}function qX(r,e){let t=e.replace(/\s+/g,n=>/[\r\n]/.test(n)?" ":n).trim();if(t){if(VX(r))return t.replace(/\\/g,"\\\\").replace(/\[/g,"\\[").replace(/\]/g,"\\]");if(!(t.includes("]]")||t.includes("[[")||t.endsWith("]")))return t}}function WX(r){return`[[${r.path.replace(/\.md$/i,"")}]]`}function MT(r,e,t={}){let n=t.sourcePath??"";if(t.linkType==="embed"&&(!t.placement||tm(t.placement)))return`![[${r.metadataCache.fileToLinktext(e,n)}]]`;let o=t.alias===void 0?void 0:qX(r,t.alias);return o===void 0?r.fileManager.generateMarkdownLink(e,n):r.fileManager.generateMarkdownLink(e,n,void 0,o)}function D0(r){let e=r.trim().replace(/^\/+/,"");return e?/\.md$/i.test(e)?e:`${e}.md`:""}function Gv(r,e){if(e.type!=="specifiedFile")return null;let t=D0(e.path);if(!t)return null;let n=r.vault.getAbstractFileByPath(t);return!(n instanceof jv.TFile)||n.extension!=="md"?null:n}function zX(r,e){return r.length===0?e:r.endsWith(`
|
||
`)?`${r}${e}`:`${r}
|
||
${e}`}async function RT(r,e,t){let n=t.destination;if(n?.type!=="specifiedFile")return!1;let i=Gv(r,n);if(!i)throw new Error(`Append link target file not found or is not a Markdown file: ${n.path}`);let o=MT(r,e,{sourcePath:i.path,linkType:"link"});return await r.vault.process(i,s=>zX(s,o)),!0}async function HX(r){let e=window.navigator?.clipboard;if(!e?.writeText)return F.logMessage("QuickAdd: Clipboard API is unavailable."),!1;try{return await e.writeText(r),!0}catch(t){return F.logMessage(`QuickAdd: Could not copy link to clipboard: ${t instanceof Error?t.message:String(t)}`),!1}}async function $T(r){let e=WX(r);return await HX(e)?(new jv.Notice(`Copied link to '${r.basename}' to clipboard.`,SB),!0):(new jv.Notice(`Created '${r.basename}', but QuickAdd could not copy its link to the clipboard.`,SB),!1)}var jv,SB,Yv=b(()=>{jv=require("obsidian");Me();Jd();SB=4e3});function ts(r){if(r.nodeType===Node.DOCUMENT_NODE)return r;let e=r.ownerDocument;if(!e)throw new Error("Unable to resolve owner document for DOM node.");return e}function ep(r){let e=ts(r).defaultView;if(!e)throw new Error("Unable to resolve owner window for DOM node.");return e}function Hr(r,e){return ts(r).createElement(e)}function Kv(r,e){return ts(r).createTextNode(e)}var pc=b(()=>{});function OT(r){for(let e of r.workspace.getLeavesOfType("markdown")){let t=e.view;if(!(!t.containerEl||!t.file||t.file.extension!=="md"))try{let n=ts(t.containerEl).activeElement;if(!n||!t.containerEl.contains(n)||!n.closest(".metadata-property-value")||n.matches(jX))continue;let o=n.closest(".metadata-property")?.getAttribute("data-property-key");if(!o)continue;return{file:t.file,key:o}}catch{continue}}return null}function GX(r,e,t){let n=e.trim();if(!n)throw new Error("Cannot append link to an empty frontmatter property key.");let i=FB(r,n),o=r[i];if(Array.isArray(o)){o.push(t);return}if(o==null||o===""){r[i]=t;return}if(typeof o=="string"){r[i]=`${o} ${t}`;return}throw new Error(`Cannot append link to frontmatter property '${i}' because it contains a ${typeof o} value.`)}function PB(r,e,t,n=Xd){let i=e.trim();if(!i)throw new Error("Cannot append link to an empty frontmatter property key.");let o=FB(r,i),s=r[o];if(Array.isArray(s)){s.push(t);return}if(s===null||s===""){r[o]=[t];return}if(s===void 0){if(n==="error")throw new Error(`Cannot append link to frontmatter property '${o}' because it does not exist.`);r[o]=[t];return}if(typeof s=="object")throw new Error(`Cannot append link to frontmatter property '${o}' because it contains an object value.`);if(n!=="alwaysAppend")throw new Error(`Cannot append link to frontmatter property '${o}' because it is not a list and the link-handling mode is '${DB[n]}'. Choose '${DB.alwaysAppend}' to convert it into a list and append.`);r[o]=[s,t]}function FB(r,e){let t=IB(e),n=Object.keys(r).filter(i=>IB(i)===t);if(n.length>1)throw new Error(`Cannot append link to frontmatter property '${e}' because the note has multiple properties that normalize to that key.`);return n[0]??e}function IB(r){return r.trim().toLowerCase()}async function NT(r,e,t){let n=r.fileManager.generateMarkdownLink(t,e.file.path);try{return await r.fileManager.processFrontMatter(e.file,i=>{GX(i,e.key,n)}),!0}catch(i){return F.logError(`QuickAdd: created the file but could not append the link to frontmatter property '${e.key}' in '${e.file.path}': ${i instanceof Error?i.message:String(i)}`),!1}}var DB,jX,rm=b(()=>{Me();Jd();pc();DB={alwaysAppend:"Create or convert",createProperty:"Create if missing",error:"Require list"},jX=['input[type="number"]','input[type="date"]','input[type="datetime-local"]','input[type="time"]','input[type="month"]','input[type="checkbox"]'].join(", ")});function Qv(r,e){let t=Nn(r);return t?.file?.path===e.path?t:null}function I0(r,e){try{let t=Nn(e);return t?(t.editor.replaceSelection(r),!0):(F.logError(`unable to append '${r}' to current line.`),!1)}catch{return F.logError(`unable to append '${r}' to current line.`),!1}}function P0(r,e,t){try{let n=Nn(t);if(!n)return F.logError(`unable to insert '${r}' on new line ${e}.`),!1;let i=n.editor,s=i.getCursor().line,a=r.split(`
|
||
`),l=a.length,c=a[l-1]?.length??0;if(e==="above")i.replaceRange(r+`
|
||
`,{line:s,ch:0}),i.setCursor({line:s+l-1,ch:c});else{let u=i.getLine(s);i.replaceRange(`
|
||
`+r,{line:s,ch:u.length}),i.setCursor({line:s+l,ch:c})}return!0}catch{return F.logError(`unable to insert '${r}' on new line ${e}.`),!1}}function F0(r,e){return P0(r,"above",e)}function M0(r,e){return P0(r,"below",e)}function YX(r,e,t,n){let i=l=>r.posToOffset(l),o=e.map(l=>{let[c,u]=i(l.anchor)<=i(l.head)?[l.anchor,l.head]:[l.head,l.anchor];return{from:c,to:u,text:n(r.getRange(c,u))}}).sort((l,c)=>i(l.from)-i(c.from)),s=o.map(({from:l,to:c,text:u})=>t==="replaceSelection"?{from:l,to:c,text:u}:{from:c,text:u}),a=[];if(t==="replaceSelection"){let l=0;for(let{from:c,to:u,text:d}of o)a.push(i(c)+l+d.length),l+=d.length-(i(u)-i(c))}r.transaction({changes:s}),t==="replaceSelection"&&r.setSelections(a.map(l=>({anchor:r.offsetToPos(l)})))}async function MB(r,e,t="replaceSelection",n={}){let{requireActiveView:i=!0,frontmatterProperty:o,frontmatterHandling:s=Xd,textForSelection:a}=n,l=r.workspace.getActiveViewOfType(LT.MarkdownView);if(!l){let p="Cannot append link because no active Markdown view is available.";if(i)throw new Error(p);F.logMessage(p);return}if(t==="inFrontmatter"){let p=l.file;if(!p)throw new Error("Cannot append link because the active Markdown view has no file.");await r.fileManager.processFrontMatter(p,m=>{PB(m,o??"",e,s)});return}let c=l.editor;if(!c){let p="Cannot append link because the active Markdown view has no editor.";if(i)throw new Error(p);F.logMessage(p);return}let u=c.listSelections().map(p=>({anchor:{...p.anchor},head:{...p.head}}));if(a&&u.length>0&&(t==="replaceSelection"||t==="afterSelection")){YX(c,u,t,a);return}if(t==="replaceSelection"){c.replaceSelection(e);return}let d=({line:p,ch:m})=>c.posToOffset({line:p,ch:m}),f=u.sort((p,m)=>d(m.head)-d(p.head));for(let p of f){let m=d(p.anchor)>d(p.head)?p.anchor:p.head;switch(t){case"afterSelection":{c.replaceRange(e,m);break}case"endOfLine":{let v=c.getLine(m.line),g={line:m.line,ch:v.length};c.replaceRange(e,g);break}case"newLine":{let v=c.getLine(m.line),g={line:m.line,ch:v.length},w=v.length===0?"":`
|
||
`;c.replaceRange(w+e,g);break}}}}async function tp(r,e,t){if(!t?.enabled)return!1;let n=xu(t),i=r.workspace.getActiveViewOfType(LT.MarkdownView),o=n.placement!=="inFrontmatter";if(!i||!i.file||o&&!i.editor){if(t.requireActiveFile)throw new Error("Cannot append link because no active Markdown view is available.");return!1}let s=i.file.path,a=MT(r,e,{sourcePath:s,linkType:n.linkType,placement:n.placement}),l=n.displayText==="selection"?c=>MT(r,e,{sourcePath:s,linkType:n.linkType,placement:n.placement,alias:c}):void 0;return await MB(r,a,n.placement,{requireActiveView:!1,frontmatterProperty:n.frontmatterProperty,frontmatterHandling:n.frontmatterHandling,textForSelection:l}),!0}function R0(r,e,t,n){try{if(e.extension!=="md"||!Number.isSafeInteger(t)||t<0||t>n.length)return!1;let i=r.workspace.getActiveViewOfType(LT.MarkdownView);if(!i||i.file?.path!==e.path||i.getMode()==="preview")return!1;let o=i.editor;return!o||o.getValue()!==n?!1:(o.setCursor(o.offsetToPos(t)),!0)}catch{return F.logMessage(`Unable to place cursor after capture in '${e.path}'.`),!1}}var LT,RB=b(()=>{LT=require("obsidian");Cu();Me();Jd();Yv();rm()});function BT(r){return ir.test(r)||Wr.test(r)||Vi.test(r)}function fo(r,e){let t=e.trim().replace(/^\/+/,"");if(!t)return null;let n=BT(t)?t:`${t}.md`,i=r.vault.getAbstractFileByPath(n);return i instanceof $B.TFile?i:null}function Wi(r){if(!Array.isArray(r))return[];let e=new Set,t=[];for(let n of r){if(typeof n!="string")continue;let i=n.trim().replace(/^\/+/,"").replace(/\/+$/,"");!i||e.has(i)||(e.add(i),t.push(i))}return t}function $0(r,e){return e.length===0?!0:e.some(t=>r===t||r.startsWith(`${t}/`))}var $B,UT=b(()=>{$B=require("obsidian");Tt()});function NB(r){if(!r)return!1;let e=r,t=e.getViewState?.();return!!e.pinned||!!t?.pinned||!!t?.state?.pinned}function Xv(r){let e=r.workspace;return(e.rootSplit?e.getMostRecentLeaf?.(e.rootSplit):null)??e.getMostRecentLeaf?.()??null}function KX(r){let e=[];return r.workspace.iterateRootLeaves(t=>{e.includes(t)||e.push(t)}),e}function OB(r){return r.parent?.id??r.parent??null}function QX(r,e){let t=OB(e),n=r.filter(s=>s===e||NB(s)?!1:t===null||OB(s)!==t);if(n.length===0)return null;let i=r.indexOf(e);return(i===-1?r:[...r.slice(i+1),...r.slice(0,i)]).find(s=>n.includes(s))??n[0]}function XX(r){return r instanceof nm.TFile?!0:typeof r=="object"&&r!==null&&"path"in r&&typeof r.path=="string"&&"extension"in r&&typeof r.extension=="string"}function ZX(r,e,t,n){if(n&&(e==="tab"||e==="reuse")&&NB(n))return QX(KX(r),n)??r.workspace.getLeaf("tab");switch(e){case"reuse":return r.workspace.getLeaf(!1);case"tab":return r.workspace.getLeaf("tab");case"split":return r.workspace.getLeaf("split",t);case"window":return r.workspace.getLeaf("window");case"left-sidebar":return r.workspace.getLeftLeaf(!0);case"right-sidebar":return r.workspace.getRightLeaf(!0);default:return r.workspace.getLeaf("tab")}}async function fc(r,e,t={}){let{location:n="tab",direction:i="vertical",mode:o,focus:s=!0,eState:a,originLeaf:l}=t,c=typeof e=="string"?r.vault.getAbstractFileByPath(e):e;if(!XX(c)){let f=typeof e=="string"?e:e.path;throw new Error(`File not found: ${f}`)}let u=l??Xv(r),d=ZX(r,n,i,u);if(!d)throw new Error("Could not obtain a workspace leaf.");if(await d.openFile(c),o&&o!=="default"&&!(typeof o=="object"&&o.mode==="default")){let f=d.getViewState(),p={...f.state??{}};o==="preview"||typeof o=="object"&&o.mode==="preview"?(p.mode="preview",delete p.source):o==="source"?(p.mode="source",p.source=!0):o==="live"||o==="live-preview"?(p.mode="source",p.source=!1):typeof o=="object"&&o.mode==="source"&&(p.mode="source",p.source=o.source),await d.setViewState({...f,state:{...p,...a}})}return s&&r.workspace.setActiveLeaf(d,{focus:!0}),d}function O0(r){return(0,nm.normalizePath)(r).replace(/\/{2,}/g,"/").replace(/^\/+/,"")}function LB(r,e){return O0(r)===O0(e)}function rp(r,e,t=!0){let n;return r.workspace.iterateRootLeaves(i=>{let o=i.view;if(o instanceof nm.FileView&&o.file&&(o.file===e||LB(e.path,o.file.path))){n=i;return}}),n!==void 0?(t&&r.workspace.setActiveLeaf(n,{focus:!0}),n):null}var nm,BB=b(()=>{nm=require("obsidian")});function mc(r){let e=0,t=0,n=!1,i=0,o=0,s=0;for(;e<=r.length;){let a=r.indexOf(`
|
||
`,e),l=a===-1?r.length:a,c=r.slice(e,l).replace(/\r$/,""),u=a===-1?r.length+1:a+1,d=JX.exec(c);if(n){if(d&&d[1].length>=i&&d[2].trim().length===0)return UB(r.slice(o,e),s)}else if(d){let f=d[2].trim().split(/\s+/)[0]?.toLowerCase();(f==="js"||f==="javascript")&&(n=!0,i=d[1].length,o=u,s=t+1)}if(e=u,t++,a===-1)break}return n?UB(r.slice(o),s):{code:null,error:eZ}}function UB(r,e){return r.trim().length===0?{code:"",error:tZ}:{code:`
|
||
`.repeat(e)+r}}var JX,eZ,tZ,Zv=b(()=>{JX=/^ {0,3}(`{3,})(.*)$/,eZ="No ```js (or ```javascript) code block found in the note.",tZ="The ```js code block is empty."});function VB(r){return r instanceof VT}function nZ(r){return r.charCodeAt(0)===65279?r.slice(1):r}function iZ(r){return nZ(r).trimStart().slice(0,rZ).toLowerCase()}function oZ(r){return/^<(?:!doctype\s+html|html\b|head\b|body\b|script\b|meta\b|title\b|div\b)/.test(iZ(r))}function N0(r,e){let t=new VT(r);throw e.reportLoadErrors!==!1&<(t),t}function sZ(r){return`QuickAdd could not load ${r}. This file looks like a saved webpage, not a JavaScript file. Open the script on GitHub, use the Raw button, then download the .js file and select that file in QuickAdd.`}function aZ(r){return`QuickAdd loaded ${r}, but its default export is not a function. Change it to module.exports = async (params) => { ... } or exports.default = async (params) => { ... }. If you meant to export several functions, use module.exports = { run } and select Script::run.`}function lZ(r,e){let t=e?`the required module "${e}"`:"a required module";return`QuickAdd could not load ${r} because it could not find ${t}. Check that the required file or package exists, and that the capitalization in require(...) matches the file name exactly.`}function cZ(r){return qB(r)?(r instanceof Error?r.message:String(r)).match(/Cannot find module ['"]([^'"]+)['"]/)?.[1]:void 0}function qB(r){return!r||typeof r!="object"?!1:r.code==="MODULE_NOT_FOUND"?!0:(r instanceof Error?r.message:String(r)).includes("Cannot find module")}function uZ(r){return r!==null&&typeof r=="object"}function dZ(r){return typeof r.entry=="function"?!0:Object.entries(r).some(([e,t])=>e!=="settings"&&e!=="quickadd"&&typeof t=="function")}function pZ(r){return typeof r=="function"?!0:uZ(r)?dZ(r):!1}function np(r){let e=r.split("::").map(t=>t.trim()).filter(Boolean);return{basename:e[0],memberAccess:e.slice(1)}}function WT(r){let e=r.path??r.id;if(e===void 0)return;let{memberAccess:t}=np(r.name??"");return t&&t.length>0?`${e}::${t.join("::")}`:e}async function ka(r,e,t={}){let n=e.vault.getAbstractFileByPath(r.path);if(!n){F.logError(`failed to load file ${r.path}.`);return}if(n instanceof qT.TFile){let i=m=>window.require&&window.require(m),o={},s={exports:o},a=await e.vault.read(n),l=a;if(ir.test(n.path)){let{code:m,error:v}=mc(a);if(m===null||m.length===0){t.reportLoadErrors!==!1&&new qT.Notice(`QuickAdd: ${v} (${r.path})`);return}l=m}oZ(l)&&N0(sZ(r.path),t);try{new Function("require","module","exports",l)(i,s,o)}catch(m){throw qB(m)&&N0(lZ(r.path,cZ(m)),t),m}let c=o.default||s.exports;if(!c)return;let u=c,d=!!o.default,{memberAccess:f}=np(r.name),p=!!(f&&f.length>0);if(f&&f.length>0){let m;for(;m=f.shift();)u=u[m]}return d&&!p&&!pZ(u)&&N0(aZ(r.path),t),u}}var qT,rZ,VT,zT=b(()=>{qT=require("obsidian");Tt();Me();Zv();Cr();rZ=1024,VT=class extends Error{constructor(e){super(e),this.name="UserScriptLoadError"}}});function hc(r){if(r==null||typeof r!="string"&&typeof r!="number"&&typeof r!="boolean")return"";let e=String(r).trim();return e.startsWith("#")?e.substring(1).trim():e}function Eu(r){return r==null?[]:(Array.isArray(r)?r:typeof r=="string"?r.split(/,|\s+/):[r]).map(hc).filter(Boolean)}var HT=b(()=>{});var zi,ip=b(()=>{HT();zi=class{static filterFiles(e,t,n){let i=e;return i=this.applyInclusionFilters(i,t,n),i=this.applyExclusionFilters(i,t,n),i}static applyInclusionFilters(e,t,n){let i=!1,o=e,s=this.getIncludeFolders(t);return s.length>0&&(i=!0,o=o.filter(a=>s.some(l=>this.matchesFolder(a,l)))),t.tags&&t.tags.length>0&&(i=!0,o=o.filter(a=>this.matchesAllTags(a,t.tags??[],n))),i?o:e}static applyExclusionFilters(e,t,n){return e.filter(i=>!(t.excludeFolders&&t.excludeFolders.length>0&&t.excludeFolders.some(o=>this.matchesFolder(i,o))||t.excludeTags&&t.excludeTags.length>0&&this.matchesAnyTag(i,t.excludeTags,n)||t.excludeFiles&&t.excludeFiles.length>0&&t.excludeFiles.some(o=>this.matchesFile(i,o))))}static getIncludeFolders(e){let t=e.folders?.length?e.folders:e.folder?[e.folder]:[];return[...new Set(t.map(n=>this.normalizePath(n)).filter(Boolean))]}static matchesFolder(e,t){let n=this.normalizePath(t),i=this.normalizePath(e.path);return i.startsWith(n+"/")||i.substring(0,i.lastIndexOf("/"))===n}static matchesAllTags(e,t,n){return this.matchesTags(e,t,n,"all")}static matchesAnyTag(e,t,n){return this.matchesTags(e,t,n,"any")}static matchesTags(e,t,n,i){let o=n(e);if(!o)return!1;let s=this.getAllTags(o),a=t.map(c=>this.normalizeTag(c)).filter(Boolean),l=c=>s.some(u=>u===c||u.startsWith(c+"/"));return i==="all"?a.every(l):a.some(l)}static matchesFile(e,t){return e.name===t||e.path===t}static getAllTags(e){let t=[];return e.frontmatter?.tags&&t.push(...Eu(e.frontmatter.tags)),e.frontmatter?.tag&&t.push(...Eu(e.frontmatter.tag)),e.tags&&t.push(...e.tags.map(n=>hc(n.tag))),t.filter(Boolean)}static normalizeTag(e){return hc(e)}static normalizePath(e){return e.replace(/^\/+|\/+$/g,"")}}});function Ls(r){return r.vault.getAllLoadedFiles().filter(e=>e instanceof L0.TFolder).map(e=>e.path)}function im(r,e){let t=r.vault.getAbstractFileByPath(e);return!!t&&t instanceof L0.TFolder}function rs(r,e){let t=e.replace(/\/+$/,"");if(t==="")return r.vault.getMarkdownFiles();let n=`${t}/`;return r.vault.getMarkdownFiles().filter(i=>i.path===t||i.path.startsWith(n))}function fZ(r){let e=r.frontmatter;if(!e)return[];let t=Object.entries(e);if(!t.length)return[];let n=t.filter(([o,s])=>{let a=o.toLowerCase();return a==="tags"||a==="tag"});return n?n.flatMap(([,o])=>Eu(o)).filter(o=>!!o):[]}function mZ(r,e){let t=r.metadataCache.getFileCache(e);if(!t)return[];let n=[];return t.frontmatter&&n.push(...fZ(t)),t.tags&&Array.isArray(t.tags)&&n.push(...t.tags.map(i=>hc(i.tag))),n}function Jv(r,e){let t=e.replace(/^#/,"");return r.vault.getMarkdownFiles().filter(n=>mZ(r,n).includes(t))}function om(r,e){return zi.filterFiles(r.vault.getMarkdownFiles(),e,t=>r.metadataCache.getFileCache(t))}function hZ(r,e){let t=e.trim().toLowerCase();return r==null?!1:Array.isArray(r)?r.some(n=>n!=null&&typeof n!="object"&&String(n).trim().toLowerCase()===t):typeof r=="object"?!1:String(r).trim().toLowerCase()===t}function sm(r,e,t,n){let i=e.trim().toLowerCase();if(!i)return[];let o=r.vault.getMarkdownFiles().filter(a=>{let l=r.metadataCache.getFileCache(a)?.frontmatter;if(!l)return!1;let c=Object.entries(l).find(([u])=>u.toLowerCase()===i);return c?t===void 0?!0:hZ(c[1],t):!1});return n&&(n.folder||n.tags?.length||n.excludeFolders?.length||n.excludeTags?.length||n.excludeFiles?.length)&&(o=zi.filterFiles(o,n,a=>r.metadataCache.getFileCache(a))),o}var L0,WB=b(()=>{L0=require("obsidian");ip();HT()});function zB(r,e){return r.commands.findCommand(e)}function B0(r,e){zB(r,e)&&(delete r.commands.commands[e],delete r.commands.editorCommands[e])}var HB=b(()=>{});function Bs(r){return r.split("|")}function jB(r){return r.startsWith("|")?r.slice(1):r}function mo(r){let e=r.indexOf(":");if(e===-1)return null;let t=r.slice(0,e).trim().toLowerCase();if(!t)return null;let n=r.slice(e+1).trim();return{key:t,value:n}}function Tu(r){if(!r)return!0;let e=r.trim().toLowerCase();return!["false","no","0","off"].includes(e)}function Sa(r,e){let t=!1;return{remaining:r.filter(i=>i.trim().toLowerCase()===e?(t=!0,!1):!0),found:t}}var op=b(()=>{});function jT(r){let e=r.trim().toLowerCase(),t=gZ[e];if(!t)throw new Error(`Unknown date unit "${r.trim()}". Valid units: ${vZ}.`);return t}function U0(r){let e=mo(r);return e?e.key==="startof"?{boundary:"start",unit:jT(e.value)}:e.key==="endof"?{boundary:"end",unit:jT(e.value)}:null:null}function am(r,e){return e?e.boundary==="start"?r.startOf(e.unit):r.endOf(e.unit):r}var gZ,vZ,ey=b(()=>{op();gZ={year:"year",years:"year",y:"year",quarter:"quarter",quarters:"quarter",q:"quarter",month:"month",months:"month",week:"week",weeks:"week",w:"week",isoweek:"isoWeek",isoweeks:"isoWeek",day:"day",days:"day",d:"day"},vZ="year, quarter, month, week, isoweek, day"});function Us(r){let e;return r?.offset!==null&&r?.offset!==void 0&&typeof r.offset=="number"&&(e=window.moment.duration(r.offset,"days")),am(window.moment().add(e),r?.snap).format(r?.format??"YYYY-MM-DD")}var GB=b(()=>{ey()});var qt=b(()=>{AB();RB();UT();BB();zT();WB();HB();GB()});var jr,Ln,fn,nn,GT,Au,gc,sp,YB,YT,lm,KB,V0,KT,yZ,bZ,wZ,CZ,xZ,EZ,TZ,_Z,AZ,QB,ns=b(()=>{jr="top",Ln="bottom",fn="right",nn="left",GT="auto",Au=[jr,Ln,fn,nn],gc="start",sp="end",YB="clippingParents",YT="viewport",lm="popper",KB="reference",V0=Au.reduce(function(r,e){return r.concat([e+"-"+gc,e+"-"+sp])},[]),KT=[].concat(Au,[GT]).reduce(function(r,e){return r.concat([e,e+"-"+gc,e+"-"+sp])},[]),yZ="beforeRead",bZ="read",wZ="afterRead",CZ="beforeMain",xZ="main",EZ="afterMain",TZ="beforeWrite",_Z="write",AZ="afterWrite",QB=[yZ,bZ,wZ,CZ,xZ,EZ,TZ,_Z,AZ]});function ti(r){return r?(r.nodeName||"").toLowerCase():null}var ku=b(()=>{});function Mr(r){if(r==null)return window;if(r.toString()!=="[object Window]"){var e=r.ownerDocument;return e&&e.defaultView||window}return r}var Da=b(()=>{});function Vs(r){var e=Mr(r).Element;return r instanceof e||r instanceof Element}function Bn(r){var e=Mr(r).HTMLElement;return r instanceof e||r instanceof HTMLElement}function cm(r){if(typeof ShadowRoot>"u")return!1;var e=Mr(r).ShadowRoot;return r instanceof e||r instanceof ShadowRoot}var is=b(()=>{Da()});function kZ(r){var e=r.state;Object.keys(e.elements).forEach(function(t){var n=e.styles[t]||{},i=e.attributes[t]||{},o=e.elements[t];!Bn(o)||!ti(o)||(Object.assign(o.style,n),Object.keys(i).forEach(function(s){var a=i[s];a===!1?o.removeAttribute(s):o.setAttribute(s,a===!0?"":a)}))})}function SZ(r){var e=r.state,t={popper:{position:e.options.strategy,left:"0",top:"0",margin:"0"},arrow:{position:"absolute"},reference:{}};return Object.assign(e.elements.popper.style,t.popper),e.styles=t,e.elements.arrow&&Object.assign(e.elements.arrow.style,t.arrow),function(){Object.keys(e.elements).forEach(function(n){var i=e.elements[n],o=e.attributes[n]||{},s=Object.keys(e.styles.hasOwnProperty(n)?e.styles[n]:t[n]),a=s.reduce(function(l,c){return l[c]="",l},{});!Bn(i)||!ti(i)||(Object.assign(i.style,a),Object.keys(o).forEach(function(l){i.removeAttribute(l)}))})}}var XB,ZB=b(()=>{ku();is();XB={name:"applyStyles",enabled:!0,phase:"write",fn:kZ,effect:SZ,requires:["computeStyles"]}});function ri(r){return r.split("-")[0]}var Su=b(()=>{});var Ia,ap,vc,Du=b(()=>{Ia=Math.max,ap=Math.min,vc=Math.round});function um(){var r=navigator.userAgentData;return r!=null&&r.brands&&Array.isArray(r.brands)?r.brands.map(function(e){return e.brand+"/"+e.version}).join(" "):navigator.userAgent}var q0=b(()=>{});function ty(){return!/^((?!chrome|android).)*safari/i.test(um())}var W0=b(()=>{q0()});function qs(r,e,t){e===void 0&&(e=!1),t===void 0&&(t=!1);var n=r.getBoundingClientRect(),i=1,o=1;e&&Bn(r)&&(i=r.offsetWidth>0&&vc(n.width)/r.offsetWidth||1,o=r.offsetHeight>0&&vc(n.height)/r.offsetHeight||1);var s=Vs(r)?Mr(r):window,a=s.visualViewport,l=!ty()&&t,c=(n.left+(l&&a?a.offsetLeft:0))/i,u=(n.top+(l&&a?a.offsetTop:0))/o,d=n.width/i,f=n.height/o;return{width:d,height:f,top:u,right:c+d,bottom:u+f,left:c,x:c,y:u}}var dm=b(()=>{is();Du();Da();W0()});function lp(r){var e=qs(r),t=r.offsetWidth,n=r.offsetHeight;return Math.abs(e.width-t)<=1&&(t=e.width),Math.abs(e.height-n)<=1&&(n=e.height),{x:r.offsetLeft,y:r.offsetTop,width:t,height:n}}var QT=b(()=>{dm()});function ry(r,e){var t=e.getRootNode&&e.getRootNode();if(r.contains(e))return!0;if(t&&cm(t)){var n=e;do{if(n&&r.isSameNode(n))return!0;n=n.parentNode||n.host}while(n)}return!1}var z0=b(()=>{is()});function ho(r){return Mr(r).getComputedStyle(r)}var pm=b(()=>{Da()});function H0(r){return["table","td","th"].indexOf(ti(r))>=0}var JB=b(()=>{ku()});function bi(r){return((Vs(r)?r.ownerDocument:r.document)||window.document).documentElement}var yc=b(()=>{is()});function bc(r){return ti(r)==="html"?r:r.assignedSlot||r.parentNode||(cm(r)?r.host:null)||bi(r)}var ny=b(()=>{ku();yc();is()});function eU(r){return!Bn(r)||ho(r).position==="fixed"?null:r.offsetParent}function DZ(r){var e=/firefox/i.test(um()),t=/Trident/i.test(um());if(t&&Bn(r)){var n=ho(r);if(n.position==="fixed")return null}var i=bc(r);for(cm(i)&&(i=i.host);Bn(i)&&["html","body"].indexOf(ti(i))<0;){var o=ho(i);if(o.transform!=="none"||o.perspective!=="none"||o.contain==="paint"||["transform","perspective"].indexOf(o.willChange)!==-1||e&&o.willChange==="filter"||e&&o.filter&&o.filter!=="none")return i;i=i.parentNode}return null}function Pa(r){for(var e=Mr(r),t=eU(r);t&&H0(t)&&ho(t).position==="static";)t=eU(t);return t&&(ti(t)==="html"||ti(t)==="body"&&ho(t).position==="static")?e:t||DZ(r)||e}var fm=b(()=>{Da();ku();pm();is();JB();ny();q0()});function cp(r){return["top","bottom"].indexOf(r)>=0?"x":"y"}var XT=b(()=>{});function up(r,e,t){return Ia(r,ap(e,t))}function tU(r,e,t){var n=up(r,e,t);return n>t?t:n}var j0=b(()=>{Du()});function iy(){return{top:0,right:0,bottom:0,left:0}}var G0=b(()=>{});function oy(r){return Object.assign({},iy(),r)}var Y0=b(()=>{G0()});function sy(r,e){return e.reduce(function(t,n){return t[n]=r,t},{})}var K0=b(()=>{});function PZ(r){var e,t=r.state,n=r.name,i=r.options,o=t.elements.arrow,s=t.modifiersData.popperOffsets,a=ri(t.placement),l=cp(a),c=[nn,fn].indexOf(a)>=0,u=c?"height":"width";if(!(!o||!s)){var d=IZ(i.padding,t),f=lp(o),p=l==="y"?jr:nn,m=l==="y"?Ln:fn,v=t.rects.reference[u]+t.rects.reference[l]-s[l]-t.rects.popper[u],g=s[l]-t.rects.reference[l],y=Pa(o),w=y?l==="y"?y.clientHeight||0:y.clientWidth||0:0,x=v/2-g/2,C=d[p],_=w-f[u]-d[m],E=w/2-f[u]/2+x,D=up(C,E,_),P=l;t.modifiersData[n]=(e={},e[P]=D,e.centerOffset=D-E,e)}}function FZ(r){var e=r.state,t=r.options,n=t.element,i=n===void 0?"[data-popper-arrow]":n;i!=null&&(typeof i=="string"&&(i=e.elements.popper.querySelector(i),!i)||ry(e.elements.popper,i)&&(e.elements.arrow=i))}var IZ,rU,nU=b(()=>{Su();QT();z0();fm();XT();j0();Y0();K0();ns();IZ=function(e,t){return e=typeof e=="function"?e(Object.assign({},t.rects,{placement:t.placement})):e,oy(typeof e!="number"?e:sy(e,Au))};rU={name:"arrow",enabled:!0,phase:"main",fn:PZ,effect:FZ,requires:["popperOffsets"],requiresIfExists:["preventOverflow"]}});function Ws(r){return r.split("-")[1]}var mm=b(()=>{});function RZ(r,e){var t=r.x,n=r.y,i=e.devicePixelRatio||1;return{x:vc(t*i)/i||0,y:vc(n*i)/i||0}}function iU(r){var e,t=r.popper,n=r.popperRect,i=r.placement,o=r.variation,s=r.offsets,a=r.position,l=r.gpuAcceleration,c=r.adaptive,u=r.roundOffsets,d=r.isFixed,f=s.x,p=f===void 0?0:f,m=s.y,v=m===void 0?0:m,g=typeof u=="function"?u({x:p,y:v}):{x:p,y:v};p=g.x,v=g.y;var y=s.hasOwnProperty("x"),w=s.hasOwnProperty("y"),x=nn,C=jr,_=window;if(c){var E=Pa(t),D="clientHeight",P="clientWidth";if(E===Mr(t)&&(E=bi(t),ho(E).position!=="static"&&a==="absolute"&&(D="scrollHeight",P="scrollWidth")),E=E,i===jr||(i===nn||i===fn)&&o===sp){C=Ln;var H=d&&E===_&&_.visualViewport?_.visualViewport.height:E[D];v-=H-n.height,v*=l?1:-1}if(i===nn||(i===jr||i===Ln)&&o===sp){x=fn;var V=d&&E===_&&_.visualViewport?_.visualViewport.width:E[P];p-=V-n.width,p*=l?1:-1}}var oe=Object.assign({position:a},c&&MZ),ce=u===!0?RZ({x:p,y:v},Mr(t)):{x:p,y:v};if(p=ce.x,v=ce.y,l){var R;return Object.assign({},oe,(R={},R[C]=w?"0":"",R[x]=y?"0":"",R.transform=(_.devicePixelRatio||1)<=1?"translate("+p+"px, "+v+"px)":"translate3d("+p+"px, "+v+"px, 0)",R))}return Object.assign({},oe,(e={},e[C]=w?v+"px":"",e[x]=y?p+"px":"",e.transform="",e))}function $Z(r){var e=r.state,t=r.options,n=t.gpuAcceleration,i=n===void 0?!0:n,o=t.adaptive,s=o===void 0?!0:o,a=t.roundOffsets,l=a===void 0?!0:a,c={placement:ri(e.placement),variation:Ws(e.placement),popper:e.elements.popper,popperRect:e.rects.popper,gpuAcceleration:i,isFixed:e.options.strategy==="fixed"};e.modifiersData.popperOffsets!=null&&(e.styles.popper=Object.assign({},e.styles.popper,iU(Object.assign({},c,{offsets:e.modifiersData.popperOffsets,position:e.options.strategy,adaptive:s,roundOffsets:l})))),e.modifiersData.arrow!=null&&(e.styles.arrow=Object.assign({},e.styles.arrow,iU(Object.assign({},c,{offsets:e.modifiersData.arrow,position:"absolute",adaptive:!1,roundOffsets:l})))),e.attributes.popper=Object.assign({},e.attributes.popper,{"data-popper-placement":e.placement})}var MZ,oU,sU=b(()=>{ns();fm();Da();yc();pm();Su();mm();Du();MZ={top:"auto",right:"auto",bottom:"auto",left:"auto"};oU={name:"computeStyles",enabled:!0,phase:"beforeWrite",fn:$Z,data:{}}});function OZ(r){var e=r.state,t=r.instance,n=r.options,i=n.scroll,o=i===void 0?!0:i,s=n.resize,a=s===void 0?!0:s,l=Mr(e.elements.popper),c=[].concat(e.scrollParents.reference,e.scrollParents.popper);return o&&c.forEach(function(u){u.addEventListener("scroll",t.update,ZT)}),a&&l.addEventListener("resize",t.update,ZT),function(){o&&c.forEach(function(u){u.removeEventListener("scroll",t.update,ZT)}),a&&l.removeEventListener("resize",t.update,ZT)}}var ZT,aU,lU=b(()=>{Da();ZT={passive:!0};aU={name:"eventListeners",enabled:!0,phase:"write",fn:function(){},effect:OZ,data:{}}});function hm(r){return r.replace(/left|right|bottom|top/g,function(e){return NZ[e]})}var NZ,cU=b(()=>{NZ={left:"right",right:"left",bottom:"top",top:"bottom"}});function JT(r){return r.replace(/start|end/g,function(e){return LZ[e]})}var LZ,uU=b(()=>{LZ={start:"end",end:"start"}});function dp(r){var e=Mr(r),t=e.pageXOffset,n=e.pageYOffset;return{scrollLeft:t,scrollTop:n}}var e_=b(()=>{Da()});function pp(r){return qs(bi(r)).left+dp(r).scrollLeft}var t_=b(()=>{dm();yc();e_()});function Q0(r,e){var t=Mr(r),n=bi(r),i=t.visualViewport,o=n.clientWidth,s=n.clientHeight,a=0,l=0;if(i){o=i.width,s=i.height;var c=ty();(c||!c&&e==="fixed")&&(a=i.offsetLeft,l=i.offsetTop)}return{width:o,height:s,x:a+pp(r),y:l}}var dU=b(()=>{Da();yc();t_();W0()});function X0(r){var e,t=bi(r),n=dp(r),i=(e=r.ownerDocument)==null?void 0:e.body,o=Ia(t.scrollWidth,t.clientWidth,i?i.scrollWidth:0,i?i.clientWidth:0),s=Ia(t.scrollHeight,t.clientHeight,i?i.scrollHeight:0,i?i.clientHeight:0),a=-n.scrollLeft+pp(r),l=-n.scrollTop;return ho(i||t).direction==="rtl"&&(a+=Ia(t.clientWidth,i?i.clientWidth:0)-o),{width:o,height:s,x:a,y:l}}var pU=b(()=>{yc();pm();t_();e_();Du()});function fp(r){var e=ho(r),t=e.overflow,n=e.overflowX,i=e.overflowY;return/auto|scroll|overlay|hidden/.test(t+i+n)}var r_=b(()=>{pm()});function n_(r){return["html","body","#document"].indexOf(ti(r))>=0?r.ownerDocument.body:Bn(r)&&fp(r)?r:n_(bc(r))}var fU=b(()=>{ny();r_();ku();is()});function Iu(r,e){var t;e===void 0&&(e=[]);var n=n_(r),i=n===((t=r.ownerDocument)==null?void 0:t.body),o=Mr(n),s=i?[o].concat(o.visualViewport||[],fp(n)?n:[]):n,a=e.concat(s);return i?a:a.concat(Iu(bc(s)))}var Z0=b(()=>{fU();ny();Da();r_()});function gm(r){return Object.assign({},r,{left:r.x,top:r.y,right:r.x+r.width,bottom:r.y+r.height})}var J0=b(()=>{});function BZ(r,e){var t=qs(r,!1,e==="fixed");return t.top=t.top+r.clientTop,t.left=t.left+r.clientLeft,t.bottom=t.top+r.clientHeight,t.right=t.left+r.clientWidth,t.width=r.clientWidth,t.height=r.clientHeight,t.x=t.left,t.y=t.top,t}function mU(r,e,t){return e===YT?gm(Q0(r,t)):Vs(e)?BZ(e,t):gm(X0(bi(r)))}function UZ(r){var e=Iu(bc(r)),t=["absolute","fixed"].indexOf(ho(r).position)>=0,n=t&&Bn(r)?Pa(r):r;return Vs(n)?e.filter(function(i){return Vs(i)&&ry(i,n)&&ti(i)!=="body"}):[]}function eP(r,e,t,n){var i=e==="clippingParents"?UZ(r):[].concat(e),o=[].concat(i,[t]),s=o[0],a=o.reduce(function(l,c){var u=mU(r,c,n);return l.top=Ia(u.top,l.top),l.right=ap(u.right,l.right),l.bottom=ap(u.bottom,l.bottom),l.left=Ia(u.left,l.left),l},mU(r,s,n));return a.width=a.right-a.left,a.height=a.bottom-a.top,a.x=a.left,a.y=a.top,a}var hU=b(()=>{ns();dU();pU();Z0();fm();yc();pm();is();dm();ny();z0();ku();J0();Du()});function ay(r){var e=r.reference,t=r.element,n=r.placement,i=n?ri(n):null,o=n?Ws(n):null,s=e.x+e.width/2-t.width/2,a=e.y+e.height/2-t.height/2,l;switch(i){case jr:l={x:s,y:e.y-t.height};break;case Ln:l={x:s,y:e.y+e.height};break;case fn:l={x:e.x+e.width,y:a};break;case nn:l={x:e.x-t.width,y:a};break;default:l={x:e.x,y:e.y}}var c=i?cp(i):null;if(c!=null){var u=c==="y"?"height":"width";switch(o){case gc:l[c]=l[c]-(e[u]/2-t[u]/2);break;case sp:l[c]=l[c]+(e[u]/2-t[u]/2);break;default:}}return l}var tP=b(()=>{Su();mm();XT();ns()});function Fa(r,e){e===void 0&&(e={});var t=e,n=t.placement,i=n===void 0?r.placement:n,o=t.strategy,s=o===void 0?r.strategy:o,a=t.boundary,l=a===void 0?YB:a,c=t.rootBoundary,u=c===void 0?YT:c,d=t.elementContext,f=d===void 0?lm:d,p=t.altBoundary,m=p===void 0?!1:p,v=t.padding,g=v===void 0?0:v,y=oy(typeof g!="number"?g:sy(g,Au)),w=f===lm?KB:lm,x=r.rects.popper,C=r.elements[m?w:f],_=eP(Vs(C)?C:C.contextElement||bi(r.elements.popper),l,u,s),E=qs(r.elements.reference),D=ay({reference:E,element:x,strategy:"absolute",placement:i}),P=gm(Object.assign({},x,D)),H=f===lm?P:E,V={top:_.top-H.top+y.top,bottom:H.bottom-_.bottom+y.bottom,left:_.left-H.left+y.left,right:H.right-_.right+y.right},oe=r.modifiersData.offset;if(f===lm&&oe){var ce=oe[i];Object.keys(V).forEach(function(R){var O=[fn,Ln].indexOf(R)>=0?1:-1,q=[jr,Ln].indexOf(R)>=0?"y":"x";V[R]+=ce[q]*O})}return V}var ly=b(()=>{hU();yc();dm();tP();J0();ns();is();Y0();K0()});function rP(r,e){e===void 0&&(e={});var t=e,n=t.placement,i=t.boundary,o=t.rootBoundary,s=t.padding,a=t.flipVariations,l=t.allowedAutoPlacements,c=l===void 0?KT:l,u=Ws(n),d=u?a?V0:V0.filter(function(m){return Ws(m)===u}):Au,f=d.filter(function(m){return c.indexOf(m)>=0});f.length===0&&(f=d);var p=f.reduce(function(m,v){return m[v]=Fa(r,{placement:v,boundary:i,rootBoundary:o,padding:s})[ri(v)],m},{});return Object.keys(p).sort(function(m,v){return p[m]-p[v]})}var gU=b(()=>{mm();ns();ly();Su()});function VZ(r){if(ri(r)===GT)return[];var e=hm(r);return[JT(r),e,JT(e)]}function qZ(r){var e=r.state,t=r.options,n=r.name;if(!e.modifiersData[n]._skip){for(var i=t.mainAxis,o=i===void 0?!0:i,s=t.altAxis,a=s===void 0?!0:s,l=t.fallbackPlacements,c=t.padding,u=t.boundary,d=t.rootBoundary,f=t.altBoundary,p=t.flipVariations,m=p===void 0?!0:p,v=t.allowedAutoPlacements,g=e.options.placement,y=ri(g),w=y===g,x=l||(w||!m?[hm(g)]:VZ(g)),C=[g].concat(x).reduce(function(be,xe){return be.concat(ri(xe)===GT?rP(e,{placement:xe,boundary:u,rootBoundary:d,padding:c,flipVariations:m,allowedAutoPlacements:v}):xe)},[]),_=e.rects.reference,E=e.rects.popper,D=new Map,P=!0,H=C[0],V=0;V<C.length;V++){var oe=C[V],ce=ri(oe),R=Ws(oe)===gc,O=[jr,Ln].indexOf(ce)>=0,q=O?"width":"height",B=Fa(e,{placement:oe,boundary:u,rootBoundary:d,altBoundary:f,padding:c}),ie=O?R?fn:nn:R?Ln:jr;_[q]>E[q]&&(ie=hm(ie));var j=hm(ie),Y=[];if(o&&Y.push(B[ce]<=0),a&&Y.push(B[ie]<=0,B[j]<=0),Y.every(function(be){return be})){H=oe,P=!1;break}D.set(oe,Y)}if(P)for(var K=m?3:1,se=function(xe){var Ue=C.find(function($t){var Ne=D.get($t);if(Ne)return Ne.slice(0,xe).every(function(Ke){return Ke})});if(Ue)return H=Ue,"break"},pe=K;pe>0;pe--){var ge=se(pe);if(ge==="break")break}e.placement!==H&&(e.modifiersData[n]._skip=!0,e.placement=H,e.reset=!0)}}var vU,yU=b(()=>{cU();Su();uU();ly();gU();ns();mm();vU={name:"flip",enabled:!0,phase:"main",fn:qZ,requiresIfExists:["offset"],data:{_skip:!1}}});function bU(r,e,t){return t===void 0&&(t={x:0,y:0}),{top:r.top-e.height-t.y,right:r.right-e.width+t.x,bottom:r.bottom-e.height+t.y,left:r.left-e.width-t.x}}function wU(r){return[jr,fn,Ln,nn].some(function(e){return r[e]>=0})}function WZ(r){var e=r.state,t=r.name,n=e.rects.reference,i=e.rects.popper,o=e.modifiersData.preventOverflow,s=Fa(e,{elementContext:"reference"}),a=Fa(e,{altBoundary:!0}),l=bU(s,n),c=bU(a,i,o),u=wU(l),d=wU(c);e.modifiersData[t]={referenceClippingOffsets:l,popperEscapeOffsets:c,isReferenceHidden:u,hasPopperEscaped:d},e.attributes.popper=Object.assign({},e.attributes.popper,{"data-popper-reference-hidden":u,"data-popper-escaped":d})}var CU,xU=b(()=>{ns();ly();CU={name:"hide",enabled:!0,phase:"main",requiresIfExists:["preventOverflow"],fn:WZ}});function zZ(r,e,t){var n=ri(r),i=[nn,jr].indexOf(n)>=0?-1:1,o=typeof t=="function"?t(Object.assign({},e,{placement:r})):t,s=o[0],a=o[1];return s=s||0,a=(a||0)*i,[nn,fn].indexOf(n)>=0?{x:a,y:s}:{x:s,y:a}}function HZ(r){var e=r.state,t=r.options,n=r.name,i=t.offset,o=i===void 0?[0,0]:i,s=KT.reduce(function(u,d){return u[d]=zZ(d,e.rects,o),u},{}),a=s[e.placement],l=a.x,c=a.y;e.modifiersData.popperOffsets!=null&&(e.modifiersData.popperOffsets.x+=l,e.modifiersData.popperOffsets.y+=c),e.modifiersData[n]=s}var EU,TU=b(()=>{Su();ns();EU={name:"offset",enabled:!0,phase:"main",requires:["popperOffsets"],fn:HZ}});function jZ(r){var e=r.state,t=r.name;e.modifiersData[t]=ay({reference:e.rects.reference,element:e.rects.popper,strategy:"absolute",placement:e.placement})}var _U,AU=b(()=>{tP();_U={name:"popperOffsets",enabled:!0,phase:"read",fn:jZ,data:{}}});function nP(r){return r==="x"?"y":"x"}var kU=b(()=>{});function GZ(r){var e=r.state,t=r.options,n=r.name,i=t.mainAxis,o=i===void 0?!0:i,s=t.altAxis,a=s===void 0?!1:s,l=t.boundary,c=t.rootBoundary,u=t.altBoundary,d=t.padding,f=t.tether,p=f===void 0?!0:f,m=t.tetherOffset,v=m===void 0?0:m,g=Fa(e,{boundary:l,rootBoundary:c,padding:d,altBoundary:u}),y=ri(e.placement),w=Ws(e.placement),x=!w,C=cp(y),_=nP(C),E=e.modifiersData.popperOffsets,D=e.rects.reference,P=e.rects.popper,H=typeof v=="function"?v(Object.assign({},e.rects,{placement:e.placement})):v,V=typeof H=="number"?{mainAxis:H,altAxis:H}:Object.assign({mainAxis:0,altAxis:0},H),oe=e.modifiersData.offset?e.modifiersData.offset[e.placement]:null,ce={x:0,y:0};if(E){if(o){var R,O=C==="y"?jr:nn,q=C==="y"?Ln:fn,B=C==="y"?"height":"width",ie=E[C],j=ie+g[O],Y=ie-g[q],K=p?-P[B]/2:0,se=w===gc?D[B]:P[B],pe=w===gc?-P[B]:-D[B],ge=e.elements.arrow,be=p&&ge?lp(ge):{width:0,height:0},xe=e.modifiersData["arrow#persistent"]?e.modifiersData["arrow#persistent"].padding:iy(),Ue=xe[O],$t=xe[q],Ne=up(0,D[B],be[B]),Ke=x?D[B]/2-K-Ne-Ue-V.mainAxis:se-Ne-Ue-V.mainAxis,Xe=x?-D[B]/2+K+Ne+$t+V.mainAxis:pe+Ne+$t+V.mainAxis,ye=e.elements.arrow&&Pa(e.elements.arrow),We=ye?C==="y"?ye.clientTop||0:ye.clientLeft||0:0,ht=(R=oe?.[C])!=null?R:0,He=ie+Ke-ht-We,_e=ie+Xe-ht,Be=up(p?ap(j,He):j,ie,p?Ia(Y,_e):Y);E[C]=Be,ce[C]=Be-ie}if(a){var ut,or=C==="x"?jr:nn,yr=C==="x"?Ln:fn,Pt=E[_],Ar=_==="y"?"height":"width",ur=Pt+g[or],dt=Pt-g[yr],Ft=[jr,nn].indexOf(y)!==-1,jn=(ut=oe?.[_])!=null?ut:0,xo=Ft?ur:Pt-D[Ar]-P[Ar]-jn+V.altAxis,Es=Ft?Pt+D[Ar]+P[Ar]-jn-V.altAxis:dt,Gn=p&&Ft?tU(xo,Pt,Es):up(p?xo:ur,Pt,p?Es:dt);E[_]=Gn,ce[_]=Gn-Pt}e.modifiersData[n]=ce}}var SU,DU=b(()=>{ns();Su();XT();kU();j0();QT();fm();ly();mm();G0();Du();SU={name:"preventOverflow",enabled:!0,phase:"main",fn:GZ,requiresIfExists:["offset"]}});var iP=b(()=>{});function oP(r){return{scrollLeft:r.scrollLeft,scrollTop:r.scrollTop}}var IU=b(()=>{});function sP(r){return r===Mr(r)||!Bn(r)?dp(r):oP(r)}var PU=b(()=>{e_();Da();is();IU()});function YZ(r){var e=r.getBoundingClientRect(),t=vc(e.width)/r.offsetWidth||1,n=vc(e.height)/r.offsetHeight||1;return t!==1||n!==1}function aP(r,e,t){t===void 0&&(t=!1);var n=Bn(e),i=Bn(e)&&YZ(e),o=bi(e),s=qs(r,i,t),a={scrollLeft:0,scrollTop:0},l={x:0,y:0};return(n||!n&&!t)&&((ti(e)!=="body"||fp(o))&&(a=sP(e)),Bn(e)?(l=qs(e,!0),l.x+=e.clientLeft,l.y+=e.clientTop):o&&(l.x=pp(o))),{x:s.left+a.scrollLeft-l.x,y:s.top+a.scrollTop-l.y,width:s.width,height:s.height}}var FU=b(()=>{dm();PU();ku();is();t_();yc();r_();Du()});function KZ(r){var e=new Map,t=new Set,n=[];r.forEach(function(o){e.set(o.name,o)});function i(o){t.add(o.name);var s=[].concat(o.requires||[],o.requiresIfExists||[]);s.forEach(function(a){if(!t.has(a)){var l=e.get(a);l&&i(l)}}),n.push(o)}return r.forEach(function(o){t.has(o.name)||i(o)}),n}function lP(r){var e=KZ(r);return QB.reduce(function(t,n){return t.concat(e.filter(function(i){return i.phase===n}))},[])}var MU=b(()=>{ns()});function cP(r){var e;return function(){return e||(e=new Promise(function(t){Promise.resolve().then(function(){e=void 0,t(r())})})),e}}var RU=b(()=>{});function uP(r){var e=r.reduce(function(t,n){var i=t[n.name];return t[n.name]=i?Object.assign({},i,n,{options:Object.assign({},i.options,n.options),data:Object.assign({},i.data,n.data)}):n,t},{});return Object.keys(e).map(function(t){return e[t]})}var $U=b(()=>{});function NU(){for(var r=arguments.length,e=new Array(r),t=0;t<r;t++)e[t]=arguments[t];return!e.some(function(n){return!(n&&typeof n.getBoundingClientRect=="function")})}function LU(r){r===void 0&&(r={});var e=r,t=e.defaultModifiers,n=t===void 0?[]:t,i=e.defaultOptions,o=i===void 0?OU:i;return function(a,l,c){c===void 0&&(c=o);var u={placement:"bottom",orderedModifiers:[],options:Object.assign({},OU,o),modifiersData:{},elements:{reference:a,popper:l},attributes:{},styles:{}},d=[],f=!1,p={state:u,setOptions:function(y){var w=typeof y=="function"?y(u.options):y;v(),u.options=Object.assign({},o,u.options,w),u.scrollParents={reference:Vs(a)?Iu(a):a.contextElement?Iu(a.contextElement):[],popper:Iu(l)};var x=lP(uP([].concat(n,u.options.modifiers)));return u.orderedModifiers=x.filter(function(C){return C.enabled}),m(),p.update()},forceUpdate:function(){if(!f){var y=u.elements,w=y.reference,x=y.popper;if(NU(w,x)){u.rects={reference:aP(w,Pa(x),u.options.strategy==="fixed"),popper:lp(x)},u.reset=!1,u.placement=u.options.placement,u.orderedModifiers.forEach(function(V){return u.modifiersData[V.name]=Object.assign({},V.data)});for(var C=0;C<u.orderedModifiers.length;C++){if(u.reset===!0){u.reset=!1,C=-1;continue}var _=u.orderedModifiers[C],E=_.fn,D=_.options,P=D===void 0?{}:D,H=_.name;typeof E=="function"&&(u=E({state:u,options:P,name:H,instance:p})||u)}}}},update:cP(function(){return new Promise(function(g){p.forceUpdate(),g(u)})}),destroy:function(){v(),f=!0}};if(!NU(a,l))return p;p.setOptions(c).then(function(g){!f&&c.onFirstUpdate&&c.onFirstUpdate(g)});function m(){u.orderedModifiers.forEach(function(g){var y=g.name,w=g.options,x=w===void 0?{}:w,C=g.effect;if(typeof C=="function"){var _=C({state:u,name:y,instance:p,options:x}),E=function(){};d.push(_||E)}})}function v(){d.forEach(function(g){return g()}),d=[]}return p}}var OU,BU=b(()=>{FU();QT();Z0();fm();MU();RU();$U();is();OU={placement:"bottom",modifiers:[],strategy:"absolute"}});var QZ,dP,UU=b(()=>{BU();lU();AU();sU();ZB();TU();yU();DU();nU();xU();iP();QZ=[aU,_U,oU,XB,EU,vU,SU,rU,CU],dP=LU({defaultModifiers:QZ})});var VU=b(()=>{ns();iP();UU()});function qU(r,e){return XZ.test(r[e])}function ZZ(r){if(!r.includes("![["))return r;let e="",t=0,n=0,i=0;for(;n<r.length;){if(r.charCodeAt(n)===33&&r.charCodeAt(n+1)===91&&r.charCodeAt(n+2)===91){for(i<n+3&&(i=n+3);i<r.length&&r.charCodeAt(i)!==93;)i++;if(i<r.length&&r.charCodeAt(i+1)===93){e+=r.slice(t,n),n=i+2,t=n;continue}}n++}return e+r.slice(t)}function JZ(r){if(!r.includes("[["))return r;let e="",t=0,n=0,i=0,o=0;for(;n<r.length;){if(r.charCodeAt(n)===91&&r.charCodeAt(n+1)===91){for(i<n+2&&(i=n+2);i<r.length;){let s=r.charCodeAt(i);if(s===93||s===124)break;i++}if(i<r.length&&r.charCodeAt(i)===93){if(r.charCodeAt(i+1)===93){e+=r.slice(t,n)+r.slice(n+2,i),n=i+2,t=n;continue}}else if(i<r.length){for(o<i+1&&(o=i+1);o<r.length&&r.charCodeAt(o)!==93;)o++;if(o<r.length&&r.charCodeAt(o+1)===93){e+=r.slice(t,n)+r.slice(i+1,o),n=o+2,t=n;continue}}}n++}return e+r.slice(t)}function eJ(r){let e=0;if(r.charCodeAt(0)===35){for(;r.charCodeAt(e)===35;)e++;for(;e<r.length&&qU(r,e);)e++}let t=r.length;if(t>e&&r.charCodeAt(t-1)===35){for(;t>e&&r.charCodeAt(t-1)===35;)t--;for(;t>e&&qU(r,t-1);)t--}return r.slice(e,t)}function tJ(r){if(!r.includes("[[")&&!r.includes("]]"))return r;let e="",t=0,n=0;for(;n<r.length;){let i=r.charCodeAt(n);if(i===91&&r.charCodeAt(n+1)===91||i===93&&r.charCodeAt(n+1)===93){e+=r.slice(t,n),n+=2,t=n;continue}n++}return e+r.slice(t)}function pP(r){return tJ(eJ(JZ(ZZ(r)).replace(rJ,""))).trim()}var XZ,rJ,WU=b(()=>{XZ=/^\s$/;rJ=/[*_`~]/g});function mn(r){return typeof r=="string"?r:r==null?"":String(r)}function i_(r,e){r.scope?.register(["Mod","Shift"],"Enter",()=>(e(),!1)),typeof r.setInstructions=="function"&&r.setInstructions([{command:"\u2191\u2193",purpose:"to navigate"},{command:"\u21B5",purpose:"to choose"},{command:"ctrl/cmd+shift+\u21B5",purpose:"to skip (leave empty)"},{command:"esc",purpose:"to cancel"}]);let t=r.modalEl;if(t&&typeof t.createDiv=="function"){let i=t.createDiv({cls:"qa-suggester-skip-bar"}).createEl("button",{text:"Skip (leave empty)",cls:"qa-suggester-skip-button"});i.type="button",i.setAttribute("aria-label","Skip and leave empty"),i.addEventListener("click",o=>{o.preventDefault(),e()})}}function mp(r){let e=!1;return t=>{e||(e=!0,F.logWarning(Yd(t,r)))}}function wc(r){return mn(r)}function Rr(r){return r.normalize("NFC").toLowerCase()}function cy(r){return r.toLowerCase().endsWith(".md")?r.slice(0,-3):r}function o_(r,e,t,n,i={}){let o=r.value;r.value=o.slice(0,e)+n+o.slice(t),r.setSelectionRange(e+n.length,e+n.length);let s=new Event("input",{bubbles:!0});i.fromCompletion&&(s.fromCompletion=!0),r.dispatchEvent(s)}function zU(r,e,t){if(r.replaceChildren(),!t){r.textContent=e;return}let n="",i=[],o=[],s=0;for(let d of e){let f=d.toLowerCase(),p=s,m=s+d.length;for(let v=0;v<f.length;v++)i.push(p),o.push(m);n+=f,s=m}let a="";for(let d of t)a+=d.toLowerCase();let l=0,c=0,u=n.indexOf(a,c);for(;u!==-1;){let d=Math.max(l,i[u]),f=o[u+a.length-1];if(f>d){d>l&&r.append(Kv(r,e.slice(l,d)));let p=Hr(r,"mark");p.className="qa-highlight",p.textContent=e.slice(d,f),r.append(p),l=f}c=u+a.length,u=n.indexOf(a,c)}l<e.length&&r.append(Kv(r,e.slice(l)))}var Fo=b(()=>{Me();pc();Cr();WU()});var s_,nJ,fP,uy,hn,ml=b(()=>{VU();s_=require("obsidian");Me();pc();Fo();nJ=(r,e)=>(r%e+e)%e,fP=class{constructor(e,t,n){this.isOpen=!1;this.owner=e,this.containerEl=t,this.clickListener=i=>{let o=this.findSuggestionItem(i.target);o&&this.onSuggestionClick(i,o)},this.mousemoveListener=i=>{let o=this.findSuggestionItem(i.target);o&&this.onSuggestionMouseover(i,o)},t.addEventListener("click",this.clickListener),t.addEventListener("mousemove",this.mousemoveListener),n.register([],"ArrowUp",i=>{if(!i.isComposing&&this.isOpen)return this.setSelectedItem(this.selectedItem-1,!0),!1}),n.register([],"ArrowDown",i=>{if(!i.isComposing&&this.isOpen)return this.setSelectedItem(this.selectedItem+1,!0),!1}),n.register([],"Enter",i=>{if(!i.isComposing&&this.isOpen)return this.useSelectedItem(i),!1}),n.register([],"PageUp",i=>{if(!i.isComposing&&this.isOpen)return this.setSelectedItem(Math.max(0,this.selectedItem-5),!0),!1}),n.register([],"PageDown",i=>{if(!i.isComposing&&this.isOpen)return this.setSelectedItem(Math.min(this.suggestions.length-1,this.selectedItem+5),!0),!1})}findSuggestionItem(e){let t=this.containerEl.ownerDocument.defaultView;if(!t||!(e instanceof t.Element))return null;let n=e.closest(".suggestion-item");return n&&this.containerEl.contains(n)?n:null}onSuggestionClick(e,t){e.preventDefault();let n=this.suggestions.indexOf(t);this.setSelectedItem(n,!1),this.useSelectedItem(e)}onSuggestionMouseover(e,t){let n=this.suggestions.indexOf(t);this.setSelectedItem(n,!1)}setSuggestions(e){this.containerEl.replaceChildren();let t=[];e.forEach((n,i)=>{let o=this.containerEl.ownerDocument.createElement("div");o.classList.add("suggestion-item"),this.containerEl.appendChild(o),o.setAttribute("role","option"),o.setAttribute("aria-selected","false"),o.setAttribute("id",`suggestion-${i}`),this.owner.renderSuggestion(n,o),t.push(o)}),this.values=e,this.suggestions=t,this.setSelectedItem(0,!1),this.isOpen=e.length>0}useSelectedItem(e){let t=this.values[this.selectedItem];t&&this.owner.selectSuggestion(t,e)}setSelectedItem(e,t){if(!this.suggestions?.length)return;let n=nJ(e,this.suggestions.length),i=this.suggestions[this.selectedItem],o=this.suggestions[n];i?.classList.remove("is-selected"),o?.classList.add("is-selected"),i?.setAttribute("aria-selected","false"),o?.setAttribute("aria-selected","true"),this.selectedItem=n,t&&o.scrollIntoView(!1)}close(){this.isOpen=!1}getIsOpen(){return this.isOpen}},uy=new WeakMap,hn=class{constructor(e,t){this.popper=null;this.currentRequestId=0;this.isOpen=!1;this.destroyed=!1;this.noResultsTimeout=null;this.currentQuery="";this.renderMatch=zU;let n=this.constructor.name,i=uy.get(t);i||(i=new Map,uy.set(t,i));let o=i.get(n);o&&o.destroy(),uy.set(t,i),i.set(n,this),this.app=e,this.inputEl=t,this.scope=new s_.Scope,this.suggestEl=this.inputEl.ownerDocument.createElement("div"),this.suggestEl.classList.add("suggestion-container");let s=this.inputEl.ownerDocument.createElement("div");s.classList.add("suggestion"),this.suggestEl.appendChild(s),s.setAttribute("role","listbox"),s.setAttribute("aria-label","Suggestions"),this.suggest=new fP(this,s,this.scope),this.scope.register([],"Escape",this.close.bind(this)),this.debouncedOnInputChanged=(0,s_.debounce)(this.onInputChanged.bind(this),50),this.inputEventListener=a=>this.debouncedOnInputChanged(a),this.focusEventListener=()=>this.debouncedOnInputChanged(),this.inputBlurListener=this.close.bind(this),this.inputEl.addEventListener("input",this.inputEventListener),this.inputEl.addEventListener("focus",this.focusEventListener),this.inputEl.addEventListener("blur",this.inputBlurListener),this.inputEl.setAttribute("aria-autocomplete","list"),this.inputEl.setAttribute("aria-expanded","false"),this.suggestEl.addEventListener("mousedown",a=>{a.preventDefault()}),this.globalClickListener=this.onGlobalClick.bind(this),this.globalWheelListener=this.onGlobalWheel.bind(this),this.globalResizeListener=this.close.bind(this),this.globalBlurListener=this.close.bind(this)}onGlobalClick(e){if(!this.isOpen)return;let t=e.target;!this.suggestEl.contains(t)&&!this.inputEl.contains(t)&&this.close()}onGlobalWheel(e){if(!this.isOpen)return;let t=e.target;this.suggestEl.contains(t)||this.close()}async onInputChanged(e){if(this.destroyed)return;let t=e;if(t?.fromCompletion&&t.keepOpen){let o=this.inputEl.value,s=++this.currentRequestId;this.currentQuery=o;try{let a=await this.getSuggestions(o);s===this.currentRequestId&&(a?.length?(this.suggest.setSuggestions(a),this.isOpen||this.open(this.app.dom.appContainerEl,this.inputEl)):this.close())}catch(a){F.logError(a)}return}if(t?.fromCompletion)return;let n=this.inputEl.value,i=++this.currentRequestId;this.currentQuery=n;try{let o=await this.getSuggestions(n);if(i!==this.currentRequestId)return;if(!o||o.length===0){this.isOpen&&this.showNoResultsAndClose();return}this.suggest.setSuggestions(o),this.open(this.app.dom.appContainerEl,this.inputEl)}catch(o){F.logError(o),this.close()}}showNoResultsAndClose(){this.noResultsTimeout&&ep(this.inputEl).clearTimeout(this.noResultsTimeout),this.close()}open(e,t){if(this.destroyed)return;this.isOpen||this.app.keymap.pushScope(this.scope),this.isOpen=!0,this.inputEl.setAttribute("aria-expanded","true");let n=ts(t);if((ts(e)===n?e:n.body).appendChild(this.suggestEl),this.popper){this.popper.update();return}this.popper=dP(t,this.suggestEl,{placement:"bottom-start",modifiers:[{name:"sameWidth",enabled:!0,fn:({state:l,instance:c})=>{let u=`${l.rects.reference.width}px`;l.styles.popper.width!==u&&(l.styles.popper.width=u,c.update())},phase:"beforeWrite",requires:["computeStyles"]},{name:"flip",enabled:!0},{name:"preventOverflow",enabled:!0},{name:"offset",enabled:!0,options:{offset:[0,4]}}]});let s=n,a=ep(t);s.addEventListener("pointerdown",this.globalClickListener,!0),s.addEventListener("wheel",this.globalWheelListener,!0),a.addEventListener("resize",this.globalResizeListener),a.addEventListener("blur",this.globalBlurListener)}close(){if(!this.isOpen)return;this.app.keymap.popScope(this.scope),this.isOpen=!1,this.inputEl.setAttribute("aria-expanded","false"),this.suggest.close(),this.suggest.setSuggestions([]),this.popper&&(this.popper.destroy(),this.popper=null),this.suggestEl.remove(),this.noResultsTimeout&&(ep(this.inputEl).clearTimeout(this.noResultsTimeout),this.noResultsTimeout=null);let e=ts(this.inputEl),t=ep(this.inputEl);e.removeEventListener("pointerdown",this.globalClickListener,!0),e.removeEventListener("wheel",this.globalWheelListener,!0),t.removeEventListener("resize",this.globalResizeListener),t.removeEventListener("blur",this.globalBlurListener)}destroy(){this.destroyed=!0,this.close(),this.inputEl.removeEventListener("input",this.inputEventListener),this.inputEl.removeEventListener("focus",this.focusEventListener),this.inputEl.removeEventListener("blur",this.inputBlurListener);let e=this.constructor.name,t=uy.get(this.inputEl);t&&(t.delete(e),t.size===0&&uy.delete(this.inputEl))}getCurrentQuery(){return this.currentQuery}}});function HU(r,e=0){return(wi[r[e+0]]+wi[r[e+1]]+wi[r[e+2]]+wi[r[e+3]]+"-"+wi[r[e+4]]+wi[r[e+5]]+"-"+wi[r[e+6]]+wi[r[e+7]]+"-"+wi[r[e+8]]+wi[r[e+9]]+"-"+wi[r[e+10]]+wi[r[e+11]]+wi[r[e+12]]+wi[r[e+13]]+wi[r[e+14]]+wi[r[e+15]]).toLowerCase()}var wi,jU=b(()=>{wi=[];for(let r=0;r<256;++r)wi.push((r+256).toString(16).slice(1))});function mP(){return crypto.getRandomValues(iJ)}var iJ,GU=b(()=>{iJ=new Uint8Array(16)});function oJ(r,e,t){return!e&&!r&&crypto.randomUUID?crypto.randomUUID():sJ(r,e,t)}function sJ(r,e,t){r=r||{};let n=r.random??r.rng?.()??mP();if(n.length<16)throw new Error("Random bytes length must be >= 16");if(n[6]=n[6]&15|64,n[8]=n[8]&63|128,e){if(t=t||0,t<0||t+16>e.length)throw new RangeError(`UUID byte range ${t}:${t+15} is out of buffer bounds`);for(let i=0;i<16;++i)e[t+i]=n[i];return e}return HU(n)}var xr,YU=b(()=>{GU();jU();xr=oJ});var hl=b(()=>{YU()});function a_(r){return Ye(r)&&r.type==="Multi"}function Ye(r){return typeof r=="object"&&r!==null}function st(r){return a_(r)?Array.isArray(r.choices)?r.choices:[]:[]}function Cc(r){return a_(r)&&Array.isArray(r.choices)}function vm(r){if(!Array.isArray(r))return!0;let e=t=>t.some(n=>{if(Array.isArray(n))return!0;if(!Ye(n)||n.type!=="Multi")return!1;let i=n.choices;return Array.isArray(i)?e(i):l_(i)});return e(r)}function gn(r){return Array.isArray(r)?r:[]}function l_(r){return Array.isArray(r)||r==null?!1:typeof r=="object"?Object.keys(r).length>0:!!r}function zs(r){return a_(r)?l_(r.choices):!1}function ym(r){switch(r){case"Template":return"file-text";case"Capture":return"pencil";case"Macro":return"terminal";case"Multi":return"folder";default:return"file-plus"}}function bm(r){return(typeof r.icon=="string"?r.icon.trim():"")||ym(r.type)}function Un(r){let e=[],t=n=>{Ye(n)&&(e.push(n),st(n).forEach(t))};return gn(r).forEach(t),e}function KU(r){let e=new Map,t=n=>{let i=[];for(let o of n){if(!Ye(o)){i.push(o);continue}let s=o,a=e.get(s.id);if(a){if(JSON.stringify(s)===JSON.stringify(a))continue;s={...s,id:xr()}}e.set(s.id,s),a_(s)&&Array.isArray(s.choices)&&(s={...s,choices:t(s.choices)}),i.push(s)}return i};return t(r)}function QU(r){if(!Array.isArray(r))return{choices:[],changed:!1,repaired:[]};let e=new Set,t=[],n=o=>{let s=!1,a=[];for(let l of o){if(Array.isArray(l)){s=!0,a.push(...n(l));continue}if(!Ye(l)){s=!0;continue}let c=l;if(Cc(c)){let f=c.choices,p=n(f);p!==f&&(c={...c,choices:p},s=!0)}let u=c.id;if(typeof u=="string"&&u!==""&&!e.has(u)){e.add(u),a.push(c);continue}let d={...c,id:xr()};e.add(d.id),t.push({previousId:u,choice:d}),a.push(d),s=!0}return s?a:o},i=n(r);return{choices:i,changed:i!==r,repaired:t}}function dy(r,e=[],t=0,n=null){let i=[];for(let o of gn(r)){if(!Ye(o))continue;let s=[...e,o.name];i.push({choice:o,id:o.id,path:s,depth:t,parentId:n}),i.push(...dy(st(o),s,t+1,o.id))}return i}var Wt=b(()=>{hl()});function Pu(r){return Array.isArray?Array.isArray(r):lV(r)==="[object Array]"}function wJ(r){if(typeof r=="string")return r;if(typeof r=="bigint")return r.toString();let e=r+"";return e=="0"&&1/r==-1/0?"-0":e}function gP(r){return r==null?"":wJ(r)}function ji(r){return typeof r=="string"}function u_(r){return typeof r=="number"}function CJ(r){return r===!0||r===!1||xJ(r)&&lV(r)=="[object Boolean]"}function aV(r){return typeof r=="object"}function xJ(r){return aV(r)&&r!==null}function os(r){return r!=null}function c_(r){return!r.trim().length}function lV(r){return r==null?r===void 0?"[object Undefined]":"[object Null]":Object.prototype.toString.call(r)}function cV(r){let e=null,t=null,n=null,i=1,o=null;if(ji(r)||Pu(r))n=r,e=tV(r),t=d_(r);else{if(!eV.call(r,"name"))throw new Error(AJ("name"));let s=r.name;if(n=s,eV.call(r,"weight")&&r.weight!==void 0&&(i=r.weight,i<=0))throw new Error(kJ(d_(s)));e=tV(s),t=d_(s),o=r.getFn??null}return{path:e,id:t,weight:i,src:n,getFn:o}}function tV(r){return Pu(r)?r:r.split(".")}function d_(r){return Pu(r)?r.join("."):r}function IJ(r,e){let t=[],n=!1,i=(o,s,a,l)=>{if(os(o))if(!s[a])t.push(l!==void 0?{v:o,i:l}:o);else{let c=o[s[a]];if(!os(c))return;if(a===s.length-1&&(ji(c)||u_(c)||CJ(c)||typeof c=="bigint"))t.push(l!==void 0?{v:gP(c),i:l}:gP(c));else if(Pu(c)){n=!0;for(let u=0,d=c.length;u<d;u+=1)i(c[u],s,a+1,u)}else s.length&&i(c,s,a+1,l)}};return i(r,ji(e)?e.split("."):e,0),n?t:t[0]}function $J(r){return r>=9&&r<=13||r===32||r===160}function OJ(r=1,e=3){let t=new Map,n=Math.pow(10,e);return{get(i){let o=0,s=!1;for(let l=0;l<i.length;l++)$J(i.charCodeAt(l))?s=!1:s||(o++,s=!0);if(o===0&&(o=1),t.has(o))return t.get(o);let a=Math.round(n/Math.pow(o,.5*r))/n;return t.set(o,a),a},clear(){t.clear()}}}function uV(r,e,{getFn:t=rt.getFn,fieldNormWeight:n=rt.fieldNormWeight}={}){let i=new TP({getFn:t,fieldNormWeight:n});return i.setKeys(r.map(cV)),i.setSources(e),i.create(),i}function NJ(r,{getFn:e=rt.getFn,fieldNormWeight:t=rt.fieldNormWeight}={}){let{keys:n,records:i}=r,o=new TP({getFn:e,fieldNormWeight:t});return o.setKeys(n),o.setIndexRecords(i),o}function LJ(r=[],e=rt.minMatchCharLength){let t=[],n=-1,i=-1,o=0;for(let s=r.length;o<s;o+=1){let a=r[o];a&&n===-1?n=o:!a&&n!==-1&&(i=o-1,i-n+1>=e&&t.push([n,i]),n=-1)}return r[o-1]&&o-n>=e&&t.push([n,o-1]),t}function BJ(r,e,t,{location:n=rt.location,distance:i=rt.distance,threshold:o=rt.threshold,findAllMatches:s=rt.findAllMatches,minMatchCharLength:a=rt.minMatchCharLength,includeMatches:l=rt.includeMatches,ignoreLocation:c=rt.ignoreLocation}={}){if(e.length>32)throw new Error(_J(32));let u=e.length,d=r.length,f=Math.max(0,Math.min(n,d)),p=o,m=f,v=(H,V)=>{let oe=H/u;if(c)return oe;let ce=Math.abs(f-V);return i?oe+ce/i:ce?1:oe},g=a>1||l,y=g?Array(d):[],w;for(;(w=r.indexOf(e,m))>-1;){let H=v(0,w);if(p=Math.min(H,p),m=w+u,g){let V=0;for(;V<u;)y[w+V]=1,V+=1}}m=-1;let x=[],C=1,_=0,E=u+d,D=1<<u-1;for(let H=0;H<u;H+=1){let V=0,oe=E;for(;V<oe;)v(H,f+oe)<=p?V=oe:E=oe,oe=Math.floor((E-V)/2+V);E=oe;let ce=Math.max(1,f-oe+1),R=s?d:Math.min(f+oe,d)+u,O=Array(R+2);O[R+1]=(1<<H)-1;for(let q=R;q>=ce;q-=1){let B=q-1,ie=t[r[B]];if(O[q]=(O[q+1]<<1|1)&ie,H&&(O[q]|=(x[q+1]|x[q])<<1|1|x[q+1]),O[q]&D&&(C=v(H,B),C<=p)){if(p=C,m=B,_=H,m<=f)break;ce=Math.max(1,2*f-m)}}if(v(H+1,f)>p)break;x=O}if(g&&m>=0){let H=Math.min(d-1,m+u-1+_);for(let V=m;V<=H;V+=1)t[r[V]]&&(y[V]=1)}let P={isMatch:m>=0,score:Math.max(.001,C)};if(g){let H=LJ(y,a);H.length?l&&(P.indices=H):P.isMatch=!1}return P}function UJ(r){let e={};for(let t=0,n=r.length;t<n;t+=1){let i=r.charAt(t);e[i]=(e[i]||0)|1<<n-t-1}return e}function _P(r){if(r.length<=1)return r;r.sort((t,n)=>t[0]-n[0]||t[1]-n[1]);let e=[r[0]];for(let t=1,n=r.length;t<n;t+=1){let i=e[e.length-1],o=r[t];o[0]<=i[1]+1?i[1]=Math.max(i[1],o[1]):e.push(o)}return e}function WJ(r){return r.startsWith("inverse")}function jJ(r){let e=[],t=r.length,n=0;for(;n<t;){for(;n<t&&r[n]===" ";)n++;if(n>=t)break;let i=n;for(;i<t&&r[i]!==" "&&r[i]!=='"';)i++;if(i<t&&r[i]==='"'){for(i++;i<t;){if(r[i]==='"'){let o=i+1;if(o>=t||r[o]===" "){i++;break}if(r[o]==="$"&&(o+1>=t||r[o+1]===" ")){i+=2;break}}i++}e.push(r.substring(n,i)),n=i}else{for(;i<t&&r[i]!==" ";)i++;e.push(r.substring(n,i)),n=i}}return e}function nV(r,e){let t=r.match(e);return t?t[1]:null}function GJ(r,e={}){return r.replace(/\\\|/g,zJ).split(HJ).map(t=>{let n=jJ(t.replace(/\u0000/g,"|").trim()).filter(o=>o&&!!o.trim()),i=[];for(let o=0,s=n.length;o<s;o+=1){let a=n[o],l=!1,c=-1;for(;!l&&++c<rV;){let u=yP[c],d=nV(a,u.multiRegex);d&&(i.push(u.create(d,e)),l=!0)}if(!l)for(c=-1;++c<rV;){let u=yP[c],d=nV(a,u.singleRegex);if(d){i.push(u.create(d,e));break}}}return i})}function kP(...r){bP.push(...r)}function p_(r,e){for(let t=0,n=bP.length;t<n;t+=1){let i=bP[t];if(i.condition(r,e))return new i(r,e)}return new AP(r,e)}function pV(r,e,{auto:t=!0}={}){let n=i=>{if(ji(i)){let l={keyId:null,pattern:i};return t&&(l.searcher=p_(i,e)),l}let o=Object.keys(i),s=KJ(i);if(!s&&o.length>1&&!CP(i))return n(iV(i));if(QJ(i)){let l=s?i[wP.PATH]:o[0],c=s?i[wP.PATTERN]:i[l];if(!ji(c))throw new Error(TJ(l));let u={keyId:d_(l),pattern:c};return t&&(u.searcher=p_(c,e)),u}let a={children:[],operator:o[0]};return o.forEach(l=>{let c=i[l];Pu(c)&&c.forEach(u=>{a.children.push(n(u))})}),a};return CP(r)||(r=iV(r)),n(r)}function xP(r,{ignoreFieldNorm:e=rt.ignoreFieldNorm}){let t=1;return r.forEach(({key:n,norm:i,score:o})=>{let s=n?n.weight:null;t*=Math.pow(o===0&&s?Number.EPSILON:o,(s||1)*(e?1:i))}),t}function XJ(r,{ignoreFieldNorm:e=rt.ignoreFieldNorm}){r.forEach(t=>{t.score=xP(t.matches,{ignoreFieldNorm:e})})}function JJ(r){let e=[];return r.matches.forEach(t=>{if(!os(t.indices)||!t.indices.length)return;let n={indices:t.indices,value:t.value};t.key&&(n.key=t.key.id),t.idx>-1&&(n.refIndex=t.idx),e.push(n)}),e}function eee(r,e,{includeMatches:t=rt.includeMatches,includeScore:n=rt.includeScore}={}){return r.map(i=>{let{idx:o}=i,s={item:e[o],refIndex:o};return t&&(s.matches=JJ(i)),n&&(s.score=i.score),s})}function ree(r){oV.has(r)||(oV.add(r),console.warn(`[Fuse] tokenize regex ${r} lacks the global flag; only the first match per text will be returned. Add the 'g' flag.`))}function nee(r){if(typeof r=="function"){let e=!1;return t=>{let n=r(t);if(!e&&(e=!0,!Array.isArray(n)||n.some(i=>typeof i!="string")))throw new Error(`[Fuse] tokenize function must return string[]; received ${Array.isArray(n)?"array containing non-strings":typeof n}.`);return n}}return r instanceof RegExp?(r.global||ree(r),e=>e.match(r)||[]):e=>e.match(tee)||[]}function EP({isCaseSensitive:r=!1,ignoreDiacritics:e=!1,tokenize:t}={}){let n=nee(t);return{tokenize(i){return r||(i=i.toLowerCase()),e&&(i=py(i)),n(i)}}}function hP(r,e,t,n){let i=n.tokenize(e);if(!i.length)return;r.fieldCount++,r.docFieldCount.set(t,(r.docFieldCount.get(t)||0)+1);let o=new Set(i),s=r.docTermFieldHits.get(t);s||(s=new Map,r.docTermFieldHits.set(t,s));for(let a of o)s.set(a,(s.get(a)||0)+1),r.df.set(a,(r.df.get(a)||0)+1)}function fV(r,e,t,n){let{i,v:o,$:s}=e;if(o!==void 0){hP(r,o,i,n);return}if(s)for(let a=0;a<t;a++){let l=s[a];if(l)if(Array.isArray(l))for(let c of l)hP(r,c.v,i,n);else hP(r,l.v,i,n)}}function oee(r,e,t){let n={fieldCount:0,df:new Map,docFieldCount:new Map,docTermFieldHits:new Map};for(let i of r)fV(n,i,e,t);return n}function see(r,e,t,n){fV(r,e,t,n)}function aee(r,e){let t=r.docFieldCount.get(e);if(t===void 0)return;r.fieldCount-=t,r.docFieldCount.delete(e);let n=r.docTermFieldHits.get(e);if(n){for(let[i,o]of n){let s=(r.df.get(i)||0)-o;s<=0?r.df.delete(i):r.df.set(i,s)}r.docTermFieldHits.delete(e)}}function sV(r,e){if(e.length===0)return;let t=Array.from(new Set(e)).sort((a,l)=>a-l);for(let a of t)aee(r,a);let n=a=>{let l=0,c=t.length;for(;l<c;){let u=l+c>>>1;t[u]<a?l=u+1:c=u}return a-l},i=t[0],o=new Map;for(let[a,l]of r.docFieldCount)o.set(a>i?n(a):a,l);r.docFieldCount=o;let s=new Map;for(let[a,l]of r.docTermFieldHits)s.set(a>i?n(a):a,l);r.docTermFieldHits=s}var EJ,vP,TJ,_J,AJ,kJ,SJ,eV,DJ,PJ,FJ,MJ,RJ,rt,TP,dV,VJ,py,AP,qJ,yP,rV,zJ,HJ,YJ,bP,f_,wP,CP,KJ,QJ,iV,ZJ,tee,oV,iee,Fu,Mu,m_=b(()=>{EJ="Incorrect 'index' type",vP="Invalid doc index: must be a non-negative integer within the bounds of the docs array",TJ=r=>`Invalid value for key ${r}`,_J=r=>`Pattern length exceeds max of ${r}.`,AJ=r=>`Missing ${r} property in key`,kJ=r=>`Property 'weight' in key '${r}' must be a positive integer`,SJ="Fuse.match does not support useTokenSearch: token search requires corpus-level statistics (df, fieldCount) that a one-off string comparison does not have. Use new Fuse(...).search(...) instead.",eV=Object.prototype.hasOwnProperty,DJ=class{constructor(r){this._keys=[],this._keyMap={};let e=0;r.forEach(t=>{let n=cV(t);this._keys.push(n),this._keyMap[n.id]=n,e+=n.weight}),this._keys.forEach(t=>{t.weight/=e})}get(r){return this._keyMap[r]}keys(){return this._keys}toJSON(){return JSON.stringify(this._keys)}};PJ={includeMatches:!1,findAllMatches:!1,minMatchCharLength:1},FJ={isCaseSensitive:!1,ignoreDiacritics:!1,includeScore:!1,keys:[],shouldSort:!0,sortFn:(r,e)=>r.score===e.score?r.idx<e.idx?-1:1:r.score<e.score?-1:1},MJ={location:0,threshold:.6,distance:100},RJ={useExtendedSearch:!1,useTokenSearch:!1,tokenize:void 0,tokenMatch:"any",getFn:IJ,ignoreLocation:!1,ignoreFieldNorm:!1,fieldNormWeight:1},rt=Object.freeze({...FJ,...PJ,...MJ,...RJ});TP=class{constructor({getFn:r=rt.getFn,fieldNormWeight:e=rt.fieldNormWeight}={}){this.norm=OJ(e,3),this.getFn=r,this.isCreated=!1,this.docs=[],this.keys=[],this._keysMap={},this.setIndexRecords()}setSources(r=[]){this.docs=r}setIndexRecords(r=[]){this.records=r}setKeys(r=[]){this.keys=r,this._keysMap={},r.forEach((e,t)=>{this._keysMap[e.id]=t})}create(){if(this.isCreated||!this.docs.length)return;this.isCreated=!0;let r=this.docs.length;this.records=new Array(r);let e=0;if(ji(this.docs[0]))for(let t=0;t<r;t++){let n=this._createStringRecord(this.docs[t],t);n&&(this.records[e++]=n)}else for(let t=0;t<r;t++)this.records[e++]=this._createObjectRecord(this.docs[t],t);this.records.length=e,this.norm.clear()}add(r,e){if(!Number.isInteger(e)||e<0)throw new Error(vP);if(ji(r)){let n=this._createStringRecord(r,e);return n&&this.records.push(n),n}let t=this._createObjectRecord(r,e);return this.records.push(t),t}removeAt(r){if(!Number.isInteger(r)||r<0)throw new Error(vP);for(let e=0,t=this.records.length;e<t;e+=1)if(this.records[e].i===r){this.records.splice(e,1);break}for(let e=0,t=this.records.length;e<t;e+=1)this.records[e].i>r&&(this.records[e].i-=1)}removeAll(r){let e=new Set;for(let n of r)Number.isInteger(n)&&n>=0&&e.add(n);if(e.size===0)return;this.records=this.records.filter(n=>!e.has(n.i));let t=Array.from(e).sort((n,i)=>n-i);for(let n of this.records){let i=0,o=t.length;for(;i<o;){let s=i+o>>>1;t[s]<n.i?i=s+1:o=s}n.i-=i}}getValueForItemAtKeyId(r,e){return r[this._keysMap[e]]}size(){return this.records.length}_createStringRecord(r,e){return!os(r)||c_(r)?null:{v:r,i:e,n:this.norm.get(r)}}_createObjectRecord(r,e){let t={i:e,$:{}};for(let n=0,i=this.keys.length;n<i;n++){let o=this.keys[n],s=o.getFn?o.getFn(r):this.getFn(r,o.path);if(os(s)){if(Pu(s)){let a=[];for(let l=0,c=s.length;l<c;l+=1){let u=s[l];if(os(u)){if(ji(u)){if(!c_(u)){let d={v:u,i:l,n:this.norm.get(u)};a.push(d)}}else if(os(u.v)){let d=ji(u.v)?u.v:gP(u.v);if(!c_(d)){let f={v:d,i:u.i,n:this.norm.get(d)};a.push(f)}}}}t.$[n]=a}else if(ji(s)&&!c_(s)){let a={v:s,n:this.norm.get(s)};t.$[n]=a}}}return t}toJSON(){return{keys:this.keys.map(({getFn:r,...e})=>e),records:this.records}}};dV={\u0142:"l",\u0141:"L",\u0111:"d",\u0110:"D",\u00F8:"o",\u00D8:"O",\u0127:"h",\u0126:"H",\u0167:"t",\u0166:"T",\u0131:"i",\u00DF:"ss"},VJ=new RegExp("["+Object.keys(dV).join("")+"]","g"),py=typeof String.prototype.normalize=="function"?r=>r.normalize("NFD").replace(/[\u0300-\u036F\u0483-\u0489\u0591-\u05BD\u05BF\u05C1\u05C2\u05C4\u05C5\u05C7\u0610-\u061A\u064B-\u065F\u0670\u06D6-\u06DC\u06DF-\u06E4\u06E7\u06E8\u06EA-\u06ED\u0711\u0730-\u074A\u07A6-\u07B0\u07EB-\u07F3\u07FD\u0816-\u0819\u081B-\u0823\u0825-\u0827\u0829-\u082D\u0859-\u085B\u08D3-\u08E1\u08E3-\u0903\u093A-\u093C\u093E-\u094F\u0951-\u0957\u0962\u0963\u0981-\u0983\u09BC\u09BE-\u09C4\u09C7\u09C8\u09CB-\u09CD\u09D7\u09E2\u09E3\u09FE\u0A01-\u0A03\u0A3C\u0A3E-\u0A42\u0A47\u0A48\u0A4B-\u0A4D\u0A51\u0A70\u0A71\u0A75\u0A81-\u0A83\u0ABC\u0ABE-\u0AC5\u0AC7-\u0AC9\u0ACB-\u0ACD\u0AE2\u0AE3\u0AFA-\u0AFF\u0B01-\u0B03\u0B3C\u0B3E-\u0B44\u0B47\u0B48\u0B4B-\u0B4D\u0B56\u0B57\u0B62\u0B63\u0B82\u0BBE-\u0BC2\u0BC6-\u0BC8\u0BCA-\u0BCD\u0BD7\u0C00-\u0C04\u0C3E-\u0C44\u0C46-\u0C48\u0C4A-\u0C4D\u0C55\u0C56\u0C62\u0C63\u0C81-\u0C83\u0CBC\u0CBE-\u0CC4\u0CC6-\u0CC8\u0CCA-\u0CCD\u0CD5\u0CD6\u0CE2\u0CE3\u0D00-\u0D03\u0D3B\u0D3C\u0D3E-\u0D44\u0D46-\u0D48\u0D4A-\u0D4D\u0D57\u0D62\u0D63\u0D82\u0D83\u0DCA\u0DCF-\u0DD4\u0DD6\u0DD8-\u0DDF\u0DF2\u0DF3\u0E31\u0E34-\u0E3A\u0E47-\u0E4E\u0EB1\u0EB4-\u0EB9\u0EBB\u0EBC\u0EC8-\u0ECD\u0F18\u0F19\u0F35\u0F37\u0F39\u0F3E\u0F3F\u0F71-\u0F84\u0F86\u0F87\u0F8D-\u0F97\u0F99-\u0FBC\u0FC6\u102B-\u103E\u1056-\u1059\u105E-\u1060\u1062-\u1064\u1067-\u106D\u1071-\u1074\u1082-\u108D\u108F\u109A-\u109D\u135D-\u135F\u1712-\u1714\u1732-\u1734\u1752\u1753\u1772\u1773\u17B4-\u17D3\u17DD\u180B-\u180D\u1885\u1886\u18A9\u1920-\u192B\u1930-\u193B\u1A17-\u1A1B\u1A55-\u1A5E\u1A60-\u1A7C\u1A7F\u1AB0-\u1ABE\u1B00-\u1B04\u1B34-\u1B44\u1B6B-\u1B73\u1B80-\u1B82\u1BA1-\u1BAD\u1BE6-\u1BF3\u1C24-\u1C37\u1CD0-\u1CD2\u1CD4-\u1CE8\u1CED\u1CF2-\u1CF4\u1CF7-\u1CF9\u1DC0-\u1DF9\u1DFB-\u1DFF\u20D0-\u20F0\u2CEF-\u2CF1\u2D7F\u2DE0-\u2DFF\u302A-\u302F\u3099\u309A\uA66F-\uA672\uA674-\uA67D\uA69E\uA69F\uA6F0\uA6F1\uA802\uA806\uA80B\uA823-\uA827\uA880\uA881\uA8B4-\uA8C5\uA8E0-\uA8F1\uA8FF\uA926-\uA92D\uA947-\uA953\uA980-\uA983\uA9B3-\uA9C0\uA9E5\uAA29-\uAA36\uAA43\uAA4C\uAA4D\uAA7B-\uAA7D\uAAB0\uAAB2-\uAAB4\uAAB7\uAAB8\uAABE\uAABF\uAAC1\uAAEB-\uAAEF\uAAF5\uAAF6\uABE3-\uABEA\uABEC\uABED\uFB1E\uFE00-\uFE0F\uFE20-\uFE2F]/g,"").replace(VJ,e=>dV[e]):r=>r,AP=class{constructor(r,{location:e=rt.location,threshold:t=rt.threshold,distance:n=rt.distance,includeMatches:i=rt.includeMatches,findAllMatches:o=rt.findAllMatches,minMatchCharLength:s=rt.minMatchCharLength,isCaseSensitive:a=rt.isCaseSensitive,ignoreDiacritics:l=rt.ignoreDiacritics,ignoreLocation:c=rt.ignoreLocation}={}){if(this.options={location:e,threshold:t,distance:n,includeMatches:i,findAllMatches:o,minMatchCharLength:s,isCaseSensitive:a,ignoreDiacritics:l,ignoreLocation:c},r=a?r:r.toLowerCase(),r=l?py(r):r,this.pattern=r,this.chunks=[],!this.pattern.length)return;let u=(f,p)=>{this.chunks.push({pattern:f,alphabet:UJ(f),startIndex:p})},d=this.pattern.length;if(d>32){let f=0,p=d%32,m=d-p;for(;f<m;)u(this.pattern.substr(f,32),f),f+=32;if(p){let v=d-32;u(this.pattern.substr(v),v)}}else u(this.pattern,0)}searchIn(r){let{isCaseSensitive:e,ignoreDiacritics:t,includeMatches:n}=this.options;if(r=e?r:r.toLowerCase(),r=t?py(r):r,this.pattern===r){if(r.length<this.options.minMatchCharLength)return{isMatch:!1,score:1};let m={isMatch:!0,score:0};return n&&(m.indices=[[0,r.length-1]]),m}let{location:i,distance:o,threshold:s,findAllMatches:a,minMatchCharLength:l,ignoreLocation:c}=this.options,u=[],d=0,f=!1;this.chunks.forEach(({pattern:m,alphabet:v,startIndex:g})=>{let{isMatch:y,score:w,indices:x}=BJ(r,m,v,{location:i+g,distance:o,threshold:s,findAllMatches:a,minMatchCharLength:l,includeMatches:n,ignoreLocation:c});y&&(f=!0),d+=w,y&&x&&u.push(...x)});let p={isMatch:f,score:f?d/this.chunks.length:1};return f&&n&&(p.indices=_P(u)),p}},qJ=new Set(["fuzzy","include"]);yP=[{type:"exact",multiRegex:/^="(.*)"$/,singleRegex:/^=(.*)$/,create:r=>({type:"exact",search(e){let t=e===r;return{isMatch:t,score:t?0:1,indices:[0,r.length-1]}}})},{type:"include",multiRegex:/^'"(.*)"$/,singleRegex:/^'(.*)$/,create:r=>({type:"include",search(e){let t=0,n,i=[],o=r.length;for(;(n=e.indexOf(r,t))>-1;)t=n+o,i.push([n,t-1]);let s=!!i.length;return{isMatch:s,score:s?0:1,indices:i}}})},{type:"prefix-exact",multiRegex:/^\^"(.*)"$/,singleRegex:/^\^(.*)$/,create:r=>({type:"prefix-exact",search(e){let t=e.startsWith(r);return{isMatch:t,score:t?0:1,indices:[0,r.length-1]}}})},{type:"inverse-prefix-exact",multiRegex:/^!\^"(.*)"$/,singleRegex:/^!\^(.*)$/,create:r=>({type:"inverse-prefix-exact",search(e){let t=!e.startsWith(r);return{isMatch:t,score:t?0:1,indices:[0,e.length-1]}}})},{type:"inverse-suffix-exact",multiRegex:/^!"(.*)"\$$/,singleRegex:/^!(.*)\$$/,create:r=>({type:"inverse-suffix-exact",search(e){let t=!e.endsWith(r);return{isMatch:t,score:t?0:1,indices:[0,e.length-1]}}})},{type:"suffix-exact",multiRegex:/^"(.*)"\$$/,singleRegex:/^(.*)\$$/,create:r=>({type:"suffix-exact",search(e){let t=e.endsWith(r);return{isMatch:t,score:t?0:1,indices:[e.length-r.length,e.length-1]}}})},{type:"inverse-exact",multiRegex:/^!"(.*)"$/,singleRegex:/^!(.*)$/,create:r=>({type:"inverse-exact",search(e){let t=e.indexOf(r)===-1;return{isMatch:t,score:t?0:1,indices:[0,e.length-1]}}})},{type:"fuzzy",multiRegex:/^"(.*)"$/,singleRegex:/^(.*)$/,create:(r,e={})=>{let t=new AP(r,{location:e.location??rt.location,threshold:e.threshold??rt.threshold,distance:e.distance??rt.distance,includeMatches:e.includeMatches??rt.includeMatches,findAllMatches:e.findAllMatches??rt.findAllMatches,minMatchCharLength:e.minMatchCharLength??rt.minMatchCharLength,isCaseSensitive:e.isCaseSensitive??rt.isCaseSensitive,ignoreDiacritics:e.ignoreDiacritics??rt.ignoreDiacritics,ignoreLocation:e.ignoreLocation??rt.ignoreLocation});return{type:"fuzzy",search(n){return t.searchIn(n)}}}}],rV=yP.length,zJ="\0",HJ="|";YJ=class{constructor(r,{isCaseSensitive:e=rt.isCaseSensitive,ignoreDiacritics:t=rt.ignoreDiacritics,includeMatches:n=rt.includeMatches,minMatchCharLength:i=rt.minMatchCharLength,ignoreLocation:o=rt.ignoreLocation,findAllMatches:s=rt.findAllMatches,location:a=rt.location,threshold:l=rt.threshold,distance:c=rt.distance}={}){this.query=null,this.options={isCaseSensitive:e,ignoreDiacritics:t,includeMatches:n,minMatchCharLength:i,findAllMatches:s,ignoreLocation:o,location:a,threshold:l,distance:c},r=e?r:r.toLowerCase(),r=t?py(r):r,this.pattern=r,this.query=GJ(this.pattern,this.options)}static condition(r,e){return e.useExtendedSearch}searchIn(r){let e=this.query;if(!e)return{isMatch:!1,score:1};let{includeMatches:t,isCaseSensitive:n,ignoreDiacritics:i}=this.options;r=n?r:r.toLowerCase(),r=i?py(r):r;let o=0,s=[],a=0,l=!1;for(let c=0,u=e.length;c<u;c+=1){let d=e[c];s.length=0,o=0,l=!1;for(let f=0,p=d.length;f<p;f+=1){let m=d[f],{isMatch:v,indices:g,score:y}=m.search(r);if(v)o+=1,a+=y,WJ(m.type)&&(l=!0),t&&(qJ.has(m.type)?s.push(...g):s.push(g));else{a=0,o=0,s.length=0,l=!1;break}}if(o){let f={isMatch:!0,score:a/o};return l&&(f.hasInverse=!0),t&&(f.indices=_P(s)),f}}return{isMatch:!1,score:1}}},bP=[];f_={AND:"$and",OR:"$or"},wP={PATH:"$path",PATTERN:"$val"},CP=r=>!!(r[f_.AND]||r[f_.OR]),KJ=r=>!!r[wP.PATH],QJ=r=>!Pu(r)&&aV(r)&&!CP(r),iV=r=>({[f_.AND]:Object.keys(r).map(e=>({[e]:r[e]}))});ZJ=class{constructor(r,e){this.limit=r,this.heap=[],this.comparator=e}get size(){return this.heap.length}insert(r){this.size<this.limit?(this.heap.push(r),this._bubbleUp(this.size-1)):this.comparator(r,this.heap[0])<0&&(this.heap[0]=r,this._sinkDown(0))}extractSorted(){return this.heap.sort(this.comparator)}_bubbleUp(r){let e=this.heap;for(;r>0;){let t=r-1>>1;if(this.comparator(e[r],e[t])<=0)break;let n=e[r];e[r]=e[t],e[t]=n,r=t}}_sinkDown(r){let e=this.heap,t=e.length,n=r;do{r=n;let i=2*r+1,o=2*r+2;if(i<t&&this.comparator(e[i],e[n])>0&&(n=i),o<t&&this.comparator(e[o],e[n])>0&&(n=o),n!==r){let s=e[r];e[r]=e[n],e[n]=s}}while(n!==r)}};tee=/[\p{L}\p{M}\p{N}_]+/gu,oV=new WeakSet;iee=class{static condition(r,e){return e.useTokenSearch}constructor(r,e){this.options=e,this.analyzer=EP({isCaseSensitive:e.isCaseSensitive,ignoreDiacritics:e.ignoreDiacritics,tokenize:e.tokenize});let t=this.analyzer.tokenize(r),{df:n,fieldCount:i}=e._invertedIndex;this.termSearchers=[],this.idfWeights=[];for(let o of t){this.termSearchers.push(new AP(o,{location:e.location,threshold:e.threshold,distance:e.distance,includeMatches:e.includeMatches,findAllMatches:e.findAllMatches,minMatchCharLength:e.minMatchCharLength,isCaseSensitive:e.isCaseSensitive,ignoreDiacritics:e.ignoreDiacritics,ignoreLocation:!0}));let s=n.get(o)||0,a=Math.log(1+(i-s+.5)/(s+.5));this.idfWeights.push(a)}this.combineAll=e.tokenMatch==="all",this.numTerms=this.termSearchers.length,this.useMask=this.numTerms<=31}searchIn(r){if(!this.termSearchers.length)return{isMatch:!1,score:1};let e=[],t=0,n=0,i=0,o=0,s=this.combineAll&&!this.useMask?new Set:null;for(let c=0;c<this.termSearchers.length;c++){let u=this.termSearchers[c].searchIn(r),d=this.idfWeights[c];n+=d,u.isMatch&&(i++,t+=d*(1-u.score),u.indices&&e.push(...u.indices),this.combineAll&&(this.useMask?o|=1<<c:s.add(c)))}if(i===0)return{isMatch:!1,score:1};let a=n>0?1-t/n:0,l={isMatch:!0,score:Math.max(.001,a)};return this.options.includeMatches&&e.length&&(l.indices=_P(e)),this.combineAll&&(this.useMask?l.matchedMask=o:l.matchedTerms=s,l.termCount=this.numTerms),l}};Fu=class{constructor(r,e,t){this.options={...rt,...e},this.options.useExtendedSearch,this.options.useTokenSearch,this._keyStore=new DJ(this.options.keys),this._docs=r,this._myIndex=null,this._invertedIndex=null,this.setCollection(r,t),this._lastQuery=null,this._lastSearcher=null}_getSearcher(r){if(this._lastQuery===r)return this._lastSearcher;let e=p_(r,this._invertedIndex?{...this.options,_invertedIndex:this._invertedIndex}:this.options);return this._lastQuery=r,this._lastSearcher=e,e}setCollection(r,e){if(this._docs=r,e&&!(e instanceof TP))throw new Error(EJ);if(this._myIndex=e||uV(this.options.keys,this._docs,{getFn:this.options.getFn,fieldNormWeight:this.options.fieldNormWeight}),this.options.useTokenSearch){let t=EP({isCaseSensitive:this.options.isCaseSensitive,ignoreDiacritics:this.options.ignoreDiacritics,tokenize:this.options.tokenize});this._invertedIndex=oee(this._myIndex.records,this._myIndex.keys.length,t)}this._invalidateSearcherCache()}add(r){if(!os(r))return;this._docs.push(r);let e=this._myIndex.add(r,this._docs.length-1);if(this._invertedIndex&&e){let t=EP({isCaseSensitive:this.options.isCaseSensitive,ignoreDiacritics:this.options.ignoreDiacritics,tokenize:this.options.tokenize});see(this._invertedIndex,e,this._myIndex.keys.length,t)}this._invalidateSearcherCache()}remove(r=()=>!1){let e=[],t=[];for(let n=0,i=this._docs.length;n<i;n+=1)r(this._docs[n],n)&&(e.push(this._docs[n]),t.push(n));if(t.length){this._invertedIndex&&sV(this._invertedIndex,t);let n=new Set(t);this._docs=this._docs.filter((i,o)=>!n.has(o)),this._myIndex.removeAll(t),this._invalidateSearcherCache()}return e}removeAt(r){if(!Number.isInteger(r)||r<0||r>=this._docs.length)throw new Error(vP);this._invertedIndex&&sV(this._invertedIndex,[r]);let e=this._docs.splice(r,1)[0];return this._myIndex.removeAt(r),this._invalidateSearcherCache(),e}_invalidateSearcherCache(){this._lastQuery=null,this._lastSearcher=null}getIndex(){return this._myIndex}_normalizedKeys(){return this._myIndex.keys.map(r=>this._keyStore.get(r.id)||r)}search(r,e){let{limit:t=-1}=e||{},{includeMatches:n,includeScore:i,shouldSort:o,sortFn:s,ignoreFieldNorm:a}=this.options;if(ji(r)&&!r.trim()){let f=this._docs.map((p,m)=>({item:p,refIndex:m}));return u_(t)&&t>-1&&(f=f.slice(0,t)),f}let l=o&&u_(t)&&t>0&&ji(r),c=s,u=(f,p)=>c(f,p)||f.idx-p.idx,d;if(l){let f=new ZJ(t,u);ji(this._docs[0])?this._searchStringList(r,{heap:f,ignoreFieldNorm:a}):this._searchObjectList(r,{heap:f,ignoreFieldNorm:a}),d=f.extractSorted()}else d=ji(r)?ji(this._docs[0])?this._searchStringList(r):this._searchObjectList(r):this._searchLogical(r),XJ(d,{ignoreFieldNorm:a}),o&&d.sort(ji(r)?u:c),u_(t)&&t>-1&&(d=d.slice(0,t));return eee(d,this._docs,{includeMatches:n,includeScore:i})}_searchStringList(r,{heap:e,ignoreFieldNorm:t}={}){let n=this._getSearcher(r),i=this.options.useTokenSearch&&this.options.tokenMatch==="all",{records:o}=this._myIndex,s=e?null:[];return o.forEach(({v:a,i:l,n:c})=>{if(!os(a))return;let u=n.searchIn(a);if(u.isMatch){let d={score:u.score,value:a,norm:c,indices:u.indices};i&&(d.matchedMask=u.matchedMask,d.matchedTerms=u.matchedTerms,d.termCount=u.termCount);let f=[d];if(!i||this._coversAllTokens(f)){let p={item:a,idx:l,matches:f};e?(p.score=xP(p.matches,{ignoreFieldNorm:t}),e.insert(p)):s.push(p)}}}),s}_searchLogical(r){let e=pV(r,this.options),t=this._normalizedKeys(),n=(a,l,c)=>{if(!("children"in a)){let{keyId:p,searcher:m}=a,v;return p===null?(v=[],t.forEach((g,y)=>{v.push(...this._findMatches({key:g,value:l[y],searcher:m}))})):v=this._findMatches({key:this._keyStore.get(p),value:this._myIndex.getValueForItemAtKeyId(l,p),searcher:m}),v&&v.length?[{idx:c,item:l,matches:v}]:[]}let{children:u,operator:d}=a,f=[];for(let p=0,m=u.length;p<m;p+=1){let v=u[p],g=n(v,l,c);if(g.length)f.push(...g);else if(d===f_.AND)return[]}return f},i=this._myIndex.records,o=new Map,s=[];return i.forEach(({$:a,i:l})=>{if(os(a)){let c=n(e,a,l);c.length&&(o.has(l)||(o.set(l,{idx:l,item:a,matches:[]}),s.push(o.get(l))),c.forEach(({matches:u})=>{o.get(l).matches.push(...u)}))}}),s}_searchObjectList(r,{heap:e,ignoreFieldNorm:t}={}){let n=this._getSearcher(r),i=this.options.useTokenSearch&&this.options.tokenMatch==="all",{records:o}=this._myIndex,s=this._normalizedKeys(),a=e?null:[];return o.forEach(({$:l,i:c})=>{if(!os(l))return;let u=[],d=!1,f=!1;if(s.forEach((p,m)=>{let v=this._findMatches({key:p,value:l[m],searcher:n});v.length?(u.push(...v),v[0].hasInverse&&(f=!0)):d=!0}),!(f&&d)&&u.length&&(!i||this._coversAllTokens(u))){let p={idx:c,item:l,matches:u};e?(p.score=xP(p.matches,{ignoreFieldNorm:t}),e.insert(p)):a.push(p)}}),a}_findMatches({key:r,value:e,searcher:t}){if(!os(e))return[];let n=[];if(Pu(e))e.forEach(({v:i,i:o,n:s})=>{if(!os(i))return;let a=t.searchIn(i);if(a.isMatch){let l={score:a.score,key:r,value:i,idx:o,norm:s,indices:a.indices,hasInverse:a.hasInverse};a.termCount!==void 0&&(l.matchedMask=a.matchedMask,l.matchedTerms=a.matchedTerms,l.termCount=a.termCount),n.push(l)}});else{let{v:i,n:o}=e,s=t.searchIn(i);if(s.isMatch){let a={score:s.score,key:r,value:i,norm:o,indices:s.indices,hasInverse:s.hasInverse};s.termCount!==void 0&&(a.matchedMask=s.matchedMask,a.matchedTerms=s.matchedTerms,a.termCount=s.termCount),n.push(a)}}return n}_coversAllTokens(r){let e=r.length?r[0].termCount:void 0;if(e===void 0)return!0;if(e<=31){let n=0;for(let i=0;i<r.length;i++)n|=r[i].matchedMask||0;return n===2**e-1}let t=new Set;for(let n=0;n<r.length;n++){let i=r[n].matchedTerms;if(i)for(let o of i)t.add(o)}return t.size===e}};Fu.version="7.5.0";Fu.createIndex=uV;Fu.parseIndex=NJ;Fu.config=rt;Fu.match=function(r,e,t){if(t&&t.useTokenSearch)throw new Error(SJ);return p_(r,{...rt,...t}).searchIn(e)};Fu.parseQuery=pV;kP(YJ);kP(iee);Fu.use=function(...r){r.forEach(e=>kP(e))};Mu=Fu});var fy,SP,lee,cee,mV,hV,wm,DP=b(()=>{fy=require("obsidian");m_();Fo();SP=class{constructor(e=100){this.cache=new Map;this.maxSize=e}peek(e){return this.cache.get(e)}set(e,t){if(this.cache.has(e))this.cache.delete(e);else if(this.cache.size>=this.maxSize){let n=this.cache.keys().next().value;this.cache.delete(n)}this.cache.set(e,t)}clear(){this.cache.clear()}},lee=20,cee=100,mV=/\w/,hV={base:{basenameExact:-1e3,aliasExact:-900,basenamePrefix:-500,aliasPrefix:-500,substringBasename:-300,fuzzyMatch:0,unresolvedLink:1e3},boosts:{sameFolder:-.15,recency:-.1,tagOverlap:-.05,tagOverlapMax:-.2},penalties:{titleLengthThreshold:15,titleLengthMultiplier:.02,aliasMinPenalty:.05,aliasMaxPenalty:.6,aliasLengthMultiplier:.04,positionMultiplier:.05},thresholds:{recencyDays:1,fuzzyRelaxCount:5}},wm=class r{constructor(e,t){this.fileMap=new Map;this.recentFiles=new SP;this.unresolvedLinks=new Set;this.unresolvedLinksDirty=!0;this.isIndexing=!1;this.indexPromise=null;this.reindexTimeout=null;this.fuseUpdateTimeout=null;this.pendingFuseUpdates=new Map;this.reindexBuffer=null;this.effectiveWeights=hV;this.app=e,this.plugin=t;let n={keys:[{name:"basenameNormalized",weight:.8},{name:"aliasesNormalized",weight:.6},{name:"pathNormalized",weight:.2}],ignoreLocation:!0,findAllMatches:!0,shouldSort:!1,includeMatches:!0};this.fuseStrict=new Mu([],{...n,threshold:.2}),this.fuseRelaxed=new Mu([],{...n,threshold:.4}),this.setupEventListeners(),this.effectiveWeights=hV}static getInstance(e,t){return r.instance||(r.instance=new r(e,t)),r.instance}static getInstanceIfExists(){return r.instance??void 0}getLastOpenedAt(e){return this.recentFiles.peek(e)}setupEventListeners(){this.plugin.registerEvent(this.app.workspace.on("file-open",e=>{if(e){this.recentFiles.set(e.path,Date.now());let t=this.fileMap.get(e.path);t&&(t.openedAt=Date.now())}})),this.plugin.registerEvent(this.app.metadataCache.on("changed",e=>{e instanceof fy.TFile&&e.extension==="md"&&this.updateFile(e)})),this.plugin.registerEvent(this.app.metadataCache.on("resolved",()=>{this.unresolvedLinksDirty=!0,this.fileMap.size===0&&this.scheduleReindex()})),this.plugin.registerEvent(this.app.vault.on("create",e=>{e instanceof fy.TFile&&e.extension==="md"&&this.addFile(e)})),this.plugin.registerEvent(this.app.vault.on("delete",e=>{e instanceof fy.TFile&&this.removeFile(e)})),this.plugin.registerEvent(this.app.vault.on("rename",(e,t)=>{e instanceof fy.TFile&&e.extension==="md"&&(this.removeFileByPath(t),this.addFile(e))}))}async ensureIndexed(){if(this.isIndexing&&this.indexPromise)return this.indexPromise;if(this.fileMap.size===0)return this.reindex()}scheduleReindex(){this.reindexTimeout!==null&&window.clearTimeout(this.reindexTimeout),this.reindexTimeout=window.setTimeout(()=>{this.reindex()},500)}async reindex(){if(this.isIndexing&&this.indexPromise)return this.indexPromise;this.isIndexing=!0,this.indexPromise=this.performReindex();try{await this.indexPromise}finally{this.isIndexing=!1,this.indexPromise=null}}async performReindex(){let e=new Map;this.reindexBuffer=e;try{let t=this.app.vault.getMarkdownFiles(),n=new Map;await(async(o,s=50)=>{for(let a=0;a<o.length;a+=s){let l=o.slice(a,a+s);for(let c of l){let u=this.createIndexedFile(c);n.set(c.path,u)}await new Promise(c=>window.setTimeout(c,0))}})(t),this.fileMap=n;for(let[o,s]of e)s.op==="remove"?this.fileMap.delete(o):s.file&&this.fileMap.set(o,this.createIndexedFile(s.file));this.updateFuseIndex(),this.updateUnresolvedLinks()}catch(t){try{this.updateFuseIndex()}catch{}throw t}finally{this.reindexBuffer=null}}extractAliases(e){if(!e)return[];let t=[];for(let[n,i]of Object.entries(e)){let o=n.toLowerCase();if(!(o!=="alias"&&o!=="aliases"))if(typeof i=="string"){let s=i.split(",").map(a=>a.trim()).filter(a=>a.length>0);t.push(...s)}else Array.isArray(i)&&t.push(...i.filter(s=>typeof s=="string").map(s=>s.trim()).filter(s=>s.length>0))}return t}createIndexedFile(e){let t=this.app.metadataCache.getFileCache(e),n=t?.frontmatter,i=this.extractAliases(n),o=i.map(c=>Rr(c)),s=(t?.headings??[]).map(c=>pP(c.heading)),a=[];if(t?.blocks)for(let c of Object.values(t.blocks))c.id&&a.push(c.id);let l=t?.tags?.map(c=>c.tag)??[];if(n?.tags){let c=Array.isArray(n.tags)?n.tags:[n.tags];l.push(...c.filter(u=>typeof u=="string"))}return{path:e.path,pathNormalized:Rr(e.path),basename:e.basename,basenameNormalized:Rr(e.basename),aliases:i,aliasesNormalized:o,headings:s,blockIds:a,tags:l,modified:e.stat.mtime,openedAt:this.recentFiles.peek(e.path),folder:e.parent?.path??""}}addFile(e){let t=this.createIndexedFile(e);this.fileMap.set(e.path,t),this.scheduleFuseUpdate(e.path,"add"),this.reindexBuffer?.set(e.path,{op:"upsert",file:e})}updateFile(e){let t=this.createIndexedFile(e);this.fileMap.set(e.path,t),this.scheduleFuseUpdate(e.path,"update"),this.unresolvedLinksDirty=!0,this.reindexBuffer?.set(e.path,{op:"upsert",file:e})}removeFile(e){this.removeFileByPath(e.path)}removeFileByPath(e){this.fileMap.delete(e),this.scheduleFuseUpdate(e,"remove"),this.reindexBuffer?.set(e,{op:"remove"})}updateFuseIndex(){let e=Array.from(this.fileMap.values());this.fuseStrict.setCollection(e),this.fuseRelaxed.setCollection(e)}scheduleFuseUpdate(e,t){if(this.isIndexing)return;let n=this.pendingFuseUpdates.get(e);if(n)if(n==="add"&&t==="remove"){this.pendingFuseUpdates.delete(e);return}else n==="remove"&&t==="add"?this.pendingFuseUpdates.set(e,"update"):this.pendingFuseUpdates.set(e,t);else this.pendingFuseUpdates.set(e,t);this.fuseUpdateTimeout!==null&&window.clearTimeout(this.fuseUpdateTimeout),this.fuseUpdateTimeout=window.setTimeout(()=>{this.processPendingFuseUpdates()},cee)}processPendingFuseUpdates(){if(this.pendingFuseUpdates.size!==0){if(this.isIndexing){this.pendingFuseUpdates.clear();return}if(this.pendingFuseUpdates.size>lee){this.updateFuseIndex(),this.pendingFuseUpdates.clear();return}for(let[e,t]of this.pendingFuseUpdates)switch(t){case"add":{this.fuseStrict.remove(i=>i.path===e),this.fuseRelaxed.remove(i=>i.path===e);let n=this.fileMap.get(e);n&&(this.fuseStrict.add(n),this.fuseRelaxed.add(n));break}case"update":{this.fuseStrict.remove(i=>i.path===e),this.fuseRelaxed.remove(i=>i.path===e);let n=this.fileMap.get(e);n&&(this.fuseStrict.add(n),this.fuseRelaxed.add(n));break}case"remove":{this.fuseStrict.remove(n=>n.path===e),this.fuseRelaxed.remove(n=>n.path===e);break}}this.pendingFuseUpdates.clear()}}updateUnresolvedLinks(){let e=this.app.metadataCache.unresolvedLinks;this.unresolvedLinks.clear();for(let t in e)for(let n in e[t])this.unresolvedLinks.add(n);this.unresolvedLinksDirty=!1}search(e,t={},n=50){this.unresolvedLinksDirty&&this.updateUnresolvedLinks();let i=[],o=Rr(e);if(e.includes("#"))return this.searchWithHeadings(e,t,n);let s=new Set,a=Array.from(this.fileMap.values());for(let c of a)c.basenameNormalized===o&&(i.push({file:c,score:this.calculateScore(c,e,t,this.effectiveWeights.base.basenameExact,"exact"),matchType:"exact",displayText:c.basename}),s.add(c.path));for(let c of a){if(s.has(c.path))continue;let u=c.aliasesNormalized.indexOf(o);u!==-1&&(i.push({file:c,score:this.calculateScore(c,e,t,this.effectiveWeights.base.aliasExact,"alias"),matchType:"alias",displayText:c.aliases[u]}),s.add(c.path))}for(let c of a)c.basenameNormalized.startsWith(o)&&c.basenameNormalized!==o&&!s.has(c.path)&&(i.push({file:c,score:this.calculateScore(c,e,t,this.effectiveWeights.base.basenamePrefix,"fuzzy"),matchType:"fuzzy",displayText:c.basename}),s.add(c.path));for(let c of a)for(let[u,d]of c.aliasesNormalized.entries())d.startsWith(o)&&d!==o&&!s.has(c.path)&&(i.push({file:c,score:this.calculateScore(c,e,t,this.effectiveWeights.base.aliasPrefix,"alias"),matchType:"alias",displayText:c.aliases[u]}),s.add(c.path));for(let c of a){if(s.has(c.path))continue;let u=c.basenameNormalized.indexOf(o);if(u>0){let d=c.basenameNormalized[u-1];mV.test(d)||(i.push({file:c,score:this.calculateScore(c,e,t,this.effectiveWeights.base.substringBasename,"fuzzy"),matchType:"fuzzy",displayText:c.basename}),s.add(c.path))}}let l=this.fuseStrict.search(o,{limit:n*2});l.length<this.effectiveWeights.thresholds.fuzzyRelaxCount&&(l=this.fuseRelaxed.search(o,{limit:n*2}));for(let c of l){if(!c||!c.item||!c.item.path||s.has(c.item.path))continue;let u=(c.matches??[]).find(m=>m.key==="aliasesNormalized"),d=!!u,f=d?"alias":"fuzzy",p=c.item.basename;if(d){let m=typeof u?.value=="string"?u.value:void 0,v=m?c.item.aliasesNormalized.findIndex(g=>g===m):c.item.aliasesNormalized.findIndex(g=>g.includes(o));v>=0&&(p=c.item.aliases[v])}i.push({file:c.item,score:this.calculateScore(c.item,e,t,(c.score??.5)+this.effectiveWeights.base.fuzzyMatch,f),matchType:f,displayText:p}),s.add(c.item.path)}if(e.length>=2){let c=0,u=e.length<3?10:20;for(let d of this.unresolvedLinks){if(c>=u)break;Rr(d).includes(o)&&(i.push({file:{path:d,pathNormalized:Rr(d),basename:d,basenameNormalized:Rr(d),aliases:[],aliasesNormalized:[],headings:[],blockIds:[],tags:[],modified:0,folder:""},score:this.effectiveWeights.base.unresolvedLink,matchType:"unresolved",displayText:d}),c++)}}return i.sort((c,u)=>c.score-u.score).slice(0,n)}calculateScore(e,t,n,i,o){let s=i;if(n.currentFolder&&e.folder===n.currentFolder&&(s+=this.effectiveWeights.boosts.sameFolder),e.openedAt&&(Date.now()-e.openedAt)/864e5<this.effectiveWeights.thresholds.recencyDays&&(s+=this.effectiveWeights.boosts.recency),n.currentFile){let d=this.fileMap.get(n.currentFile.path);if(d){let f=e.tags.filter(p=>d.tags.includes(p));f.length>0&&(s+=this.effectiveWeights.boosts.tagOverlap*Math.min(f.length,Math.abs(this.effectiveWeights.boosts.tagOverlapMax/this.effectiveWeights.boosts.tagOverlap)))}}let a=Rr(t),l=e.basename.length;if(o==="alias"&&e.aliases.length>0){let d=e.aliasesNormalized.findIndex(f=>f.includes(a));d>=0&&(l=e.aliases[d].length)}if(o==="alias"){let d=Math.max(0,(l-this.effectiveWeights.penalties.titleLengthThreshold)*this.effectiveWeights.penalties.aliasLengthMultiplier),f=Math.min(this.effectiveWeights.penalties.aliasMaxPenalty,this.effectiveWeights.penalties.aliasMinPenalty+d);s+=f}l>this.effectiveWeights.penalties.titleLengthThreshold&&(s+=(l-this.effectiveWeights.penalties.titleLengthThreshold)*this.effectiveWeights.penalties.titleLengthMultiplier);let c=e.basenameNormalized;if(o==="alias"&&e.aliases.length>0){let d=e.aliasesNormalized.findIndex(f=>f.includes(a));d>=0&&(c=e.aliasesNormalized[d])}let u=c.indexOf(a);return u>=0&&(s+=u*this.effectiveWeights.penalties.positionMultiplier),s}searchWithHeadings(e,t,n){let[i,o]=e.split("#"),s=Rr(o??""),a=[];if(i===""){let l=0,c=200,u=Array.from(this.fileMap.values());for(let d of u){if(l>=c)break;for(let f of d.headings){if(l>=c)break;Rr(f).includes(s)&&(a.push({file:d,score:this.calculateScore(d,e,t,.1),matchType:"heading",displayText:`${d.basename}#${f}`}),l++)}}}else{let l=this.searchFiles(i,t,n);if(l.length===0)return[];for(let c of l)for(let u of c.file.headings)Rr(u).includes(s)&&a.push({file:c.file,score:c.score+.05,matchType:"heading",displayText:`${c.file.basename}#${u}`})}return a.sort((l,c)=>l.score-c.score).slice(0,n)}searchFiles(e,t,n){let i=[],o=Rr(e),s=new Set,a=Array.from(this.fileMap.values());for(let c of a)c.basenameNormalized===o&&(i.push({file:c,score:this.calculateScore(c,e,t,-1e3,"exact"),matchType:"exact",displayText:c.basename}),s.add(c.path));for(let c of a){if(s.has(c.path))continue;let u=c.aliasesNormalized.indexOf(o);u!==-1&&(i.push({file:c,score:this.calculateScore(c,e,t,this.effectiveWeights.base.aliasExact,"alias"),matchType:"alias",displayText:c.aliases[u]}),s.add(c.path))}for(let c of a)c.basenameNormalized.startsWith(o)&&c.basenameNormalized!==o&&!s.has(c.path)&&(i.push({file:c,score:this.calculateScore(c,e,t,-500,"fuzzy"),matchType:"fuzzy",displayText:c.basename}),s.add(c.path));for(let c of a)for(let[u,d]of c.aliasesNormalized.entries())d.startsWith(o)&&d!==o&&!s.has(c.path)&&(i.push({file:c,score:this.calculateScore(c,e,t,-500,"alias"),matchType:"alias",displayText:c.aliases[u]}),s.add(c.path));for(let c of a){if(s.has(c.path))continue;let u=c.basenameNormalized.indexOf(o);if(u>0){let d=c.basenameNormalized[u-1];mV.test(d)||(i.push({file:c,score:this.calculateScore(c,e,t,-300,"fuzzy"),matchType:"fuzzy",displayText:c.basename}),s.add(c.path))}}let l=this.fuseStrict.search(o,{limit:n*2});l.length<this.effectiveWeights.thresholds.fuzzyRelaxCount&&(l=this.fuseRelaxed.search(o,{limit:n*2}));for(let c of l){if(!c||!c.item||!c.item.path||s.has(c.item.path))continue;let u=(c.matches??[]).find(m=>m.key==="aliasesNormalized"),d=!!u,f=d?"alias":"fuzzy",p=c.item.basename;if(d){let m=typeof u?.value=="string"?u.value:void 0,v=m?c.item.aliasesNormalized.findIndex(g=>g===m):c.item.aliasesNormalized.findIndex(g=>g.includes(o));v>=0&&(p=c.item.aliases[v])}i.push({file:c.item,score:this.calculateScore(c.item,e,t,(c.score??.5)+this.effectiveWeights.base.fuzzyMatch,f),matchType:f,displayText:p}),s.add(c.item.path)}return i.sort((c,u)=>c.score-u.score).slice(0,n)}getFile(e){return this.fileMap.get(e)}getHeadings(e){return e.headings}getBlockIds(e){return e.blockIds}getIndexedFileCount(){return this.fileMap.size}}});function gV(r){IP=r}function ni(){if(!IP)throw new Error("QuickAdd plugin instance accessed before it was initialised.");return IP}var IP,gl=b(()=>{});function uee(r,e){let t=Hr(r,"span");switch(t.classList.add("qa-suggestion-pill"),e){case"alias":return t.classList.add("qa-alias-pill"),t.textContent="alias",t;case"heading":return t.classList.add("qa-heading-pill"),t.textContent="H",t;case"block":return t.classList.add("qa-block-pill"),t.textContent="^",t;case"unresolved":return t.classList.add("qa-unresolved-pill"),t.textContent="unresolved",t;default:return null}}var h_,Cm,PP=b(()=>{ml();h_=require("obsidian");Tt();DP();Fo();gl();pc();Cm=class extends hn{constructor(t,n,i){super(t,n);this.app=t;this.inputEl=n;this.lastInput="";this.sourcePathOverride=i?.sourcePath,this.fileIndex=wm.getInstance(t,ni()),this.fileIndex.ensureIndexed()}normalizeFolderPath(t){return!t||t==="/"?"":t.replace(/\/+$/,"")}getSourcePath(){return this.sourcePathOverride??this.app.workspace.getActiveFile()?.path??""}getSourceFolder(){let t=this.getSourcePath();if(!t)return"";let n=this.app.fileManager.getNewFileParent(t);return this.normalizeFolderPath(n?.path)}resolveRelative(t,n){let i=this.normalizeFolderPath(t),o=n;for(o.startsWith("./")&&(o=o.slice(2));o.startsWith("../");){let s=i.split("/");if(!i||s.length===0||s.length===1&&s[0]==="")break;s.pop(),i=s.join("/"),o=o.slice(3)}return{folder:this.normalizeFolderPath(i),query:o}}getSuggestions(t){if(this.inputEl.selectionStart===null)return[];let n=this.inputEl.selectionStart,i=t.slice(0,n),o=W2.exec(i);if(!o)return[];let s=o[1];if(this.lastInput=s,s.includes("#^"))return this.getBlockSuggestions(s);if(s.indexOf("#")>0)return this.getHeadingSuggestions(s);if(s.startsWith("./")||s.startsWith("../"))return this.getRelativePathSuggestions(s);if(i.includes("![["))return this.getAttachmentSuggestions(s);let c=this.getSourceFolder(),u=this.app.workspace.getActiveFile(),d={currentFile:this.sourcePathOverride?void 0:u??void 0,currentFolder:c};return this.fileIndex.search(s,d,50)}getHeadingSuggestions(t){let[n,i]=t.split("#"),o=n.trim()==="",s=Rr(i??""),a=[];if(o){let c=this.app.workspace.getActiveFile();if(c){let u=this.fileIndex.getFile(c.path);u&&(a=[u])}}else a=this.fileIndex.search(n,{},1).map(c=>c.file);if(a.length===0)return[];let l=[];for(let c of a){let d=this.fileIndex.getHeadings(c).filter(f=>i===""||Rr(f).includes(s)).slice(0,20);for(let f of d)l.push({file:c,score:0,matchType:"heading",displayText:o?`#${f}`:`${c.basename}#${f}`})}return l}getBlockSuggestions(t){let[n,i]=t.split("#^"),o=Rr(i??""),s=this.fileIndex.search(n,{},1);if(s.length===0)return[];let a=s[0].file;return this.fileIndex.getBlockIds(a).filter(c=>i===""||Rr(c).includes(o)).slice(0,20).map(c=>({file:a,score:0,matchType:"block",displayText:`${a.basename}#^${c}`}))}getRelativePathSuggestions(t){let n=this.getSourceFolder(),{folder:i,query:o}=this.resolveRelative(n,t);if(o)return this.fileIndex.search(o,{currentFolder:i},20);let s=this.fileIndex.search("",{currentFolder:i},50),a=l=>this.normalizeFolderPath(l||"");return s.filter(l=>a(l.file.folder)===a(i))}getAttachmentSuggestions(t){let n=this.app.vault.getFiles(),i=["png","jpg","jpeg","gif","svg","pdf","mp4","webm","mov","canvas"],o=Rr(t);return n.filter(a=>i.includes(a.extension.toLowerCase())&&(t===""||Rr(a.basename).includes(o))).slice(0,20).map(a=>({file:{path:a.path,pathNormalized:Rr(a.path),basename:a.basename,basenameNormalized:Rr(a.basename),aliases:[],aliasesNormalized:[],headings:[],blockIds:[],tags:[],modified:a.stat.mtime,folder:this.normalizeFolderPath(a.parent?.path||"")},score:0,matchType:"exact",displayText:a.name}))}renderSuggestion(t,n){let{file:i,matchType:o,displayText:s}=t;n.classList.add("qaFileSuggestionItem"),n.classList.add(`qa-suggest-${o}`);let a=s,l="",c=!1,u="";switch(o){case"exact":a=i.basename,l=i.path;break;case"alias":a=s,l=i.path;break;case"fuzzy":a=i.basename,l=i.path;break;case"heading":{let[v,g]=s.split("#"),y=this.lastInput.includes("#")?this.lastInput.split("#")[1]:"",w=Rr(y??"");y&&Rr(g).includes(w)?(a=g,c=!0,u=y):a=g,l=v;break}case"block":{let[v,g]=s.split("#^");a=g,l=v;break}case"unresolved":a=s,l="Unresolved link";break}let d=Hr(n,"div");d.className="qa-suggestion-content";let f=Hr(n,"span");f.className="suggestion-main-text",c?this.renderMatch(f,a,u):f.textContent=a,d.appendChild(f);let p=uee(n,o);p&&d.appendChild(p);let m=Hr(n,"span");m.className="suggestion-sub-text",m.textContent=l,n.replaceChildren(d,m),this.addHoverTooltip(n,i)}open(t,n){if(super.open(t,n),!this.scrollListener){let i=ts(this.inputEl),o=()=>this.hideTooltip();i.addEventListener("scroll",o,{passive:!0}),this.scrollListener=o,this.scrollListenerDocument=i}}hideTooltip(){let t=ts(this.inputEl);this.tooltipTimeout!==void 0&&(window.clearTimeout(this.tooltipTimeout),this.tooltipTimeout=void 0),t.querySelector(".qa-file-tooltip")?.remove()}addHoverTooltip(t,n){let i=ts(t);t.addEventListener("mouseenter",()=>{this.hideTooltip(),this.tooltipTimeout=window.setTimeout(()=>{let o=this.createTooltip(n);o&&(i.body.appendChild(o),this.positionTooltip(o,t))},200)}),t.addEventListener("mouseleave",()=>this.hideTooltip()),t.addEventListener("blur",()=>this.hideTooltip())}createTooltip(t){let n=this.app.vault.getAbstractFileByPath(t.path);if(!n||!(n instanceof h_.TFile))return null;let i=this.inputEl,o=Hr(i,"div");o.className="qa-file-tooltip";let s=Hr(i,"div");s.className="qa-tooltip-header",s.textContent=n.basename;let a=Hr(i,"div");a.className="qa-tooltip-content";let l=Hr(i,"div");l.textContent=`Path: ${n.path}`;let c=Hr(i,"div");return c.textContent=`Modified: ${new Date(n.stat.mtime).toLocaleDateString()}`,a.append(l,c),o.append(s,a),o}positionTooltip(t,n){let i=n.getBoundingClientRect();t.style.left=`${i.right+10}px`,t.style.top=`${i.top}px`}close(){this.hideTooltip(),this.scrollListener&&this.scrollListenerDocument&&(this.scrollListenerDocument.removeEventListener("scroll",this.scrollListener),this.scrollListener=void 0,this.scrollListenerDocument=void 0),super.close()}selectSuggestion(t){if(this.inputEl.selectionStart===null)return;let n=this.inputEl.selectionStart,i=this.lastInput.length,o=this.inputEl.value,s=0,a=this.inputEl.value.slice(n-this.lastInput.length-3,n-this.lastInput.length)==="![[";if(t.matchType==="unresolved")s=this.makeLinkManually(o,t.displayText.replace(/.md$/,""),n,i);else if(t.matchType==="heading"||t.matchType==="block"){let l=t.displayText;s=this.makeLinkManually(o,l,n,i)}else if(a)s=this.makeLinkManually(o,t.displayText,n,i);else{let l=this.app.vault.getAbstractFileByPath(t.file.path);if(l instanceof h_.TFile){let c=t.matchType==="alias"?t.displayText:void 0;s=this.makeLinkObsidianMethod(l,o,n,i,c)}else s=this.makeLinkManually(o,t.displayText,n,i)}this.inputEl.trigger("input"),this.close(),this.inputEl.setSelectionRange(s,s)}makeLinkObsidianMethod(t,n,i,o,s){let a=this.app.vault.getAbstractFileByPath(t.path);if(!(a instanceof h_.TFile))return this.makeLinkManually(n,t.path,i,o);let l=this.app.fileManager.generateMarkdownLink(a,this.getSourcePath(),"",s??"");return this.inputEl.value=this.getNewInputValueForFileLink(n,l,i,o),i-o+l.length+2}makeLinkManually(t,n,i,o){return this.inputEl.value=this.getNewInputValueForFileName(t,n,i,o),i-o+n.length+2}getNewInputValueForFileLink(t,n,i,o){return`${t.slice(0,i-o-2)}${n}${t.slice(i)}`}getNewInputValueForFileName(t,n,i,o){return`${t.slice(0,i-o)}${n}]]${t.slice(i)}`}}});var vV,g_,yV=b(()=>{m_();vV={threshold:.4,includeScore:!0,keys:[""]},g_=class r{constructor(e,t){this.sortedTags=[];this.fuse=new Mu([],vV);this.app=e,this.refresh(),t.registerEvent(this.app.metadataCache.on("resolved",()=>this.refresh()))}static getInstance(e,t){return r.instance||(r.instance=new r(e,t)),r.instance}refresh(){let e=this.app.metadataCache.getTags(),t=Object.keys(e);this.sortedTags=t.sort((n,i)=>n.length!==i.length?n.length-i.length:n.localeCompare(i)),this.fuse=new Mu(this.sortedTags,vV)}getSortedTags(){return this.sortedTags}search(e){return this.fuse.search(e)}}});var xm,FP=b(()=>{Tt();ml();Fo();gl();yV();xm=class extends hn{constructor(t,n){super(t,n);this.app=t;this.inputEl=n;this.lastInput="";this.lastInputStart=0;this.lastInputLength=0;this.tagIndex=g_.getInstance(t,ni()),this.tagIndex.refresh()}getSuggestions(t){if(this.inputEl.selectionStart===null)return[];let n=this.inputEl.selectionStart,i=t.slice(0,n),o=z2.exec(i);if(!o)return[];let s=i.lastIndexOf("[[");if(o.index===void 0)return[];if(s!==-1&&s<o.index)return[];let a=o[1];this.lastInput=a,this.lastInputStart=o.index,this.lastInputLength=o[0].length;let l=this.tagIndex.getSortedTags(),c=a.toLowerCase(),u=l.filter(m=>m.replace(/^#/,"").toLowerCase().startsWith(c)).slice(0,5),d=this.tagIndex.search(a).filter(m=>m.score!==void 0&&m.score<.8).map(m=>m.item).slice(0,10),f=new Set(u),p=[...u];for(let m of d)!f.has(m)&&p.length<15&&(p.push(m),f.add(m));return p}renderSuggestion(t,n){this.renderMatch(n,t,this.lastInput)}selectSuggestion(t){let n=this.inputEl;if(n.selectionStart===null)return;let i=this.lastInputStart,o=i+this.lastInputLength,s=t.startsWith("#")?t:`#${t}`;o_(n,i,o,s,{fromCompletion:!0}),this.close()}}});var Gi,Em=b(()=>{Gi=class r{constructor(){this.drafts=new Map;this.pendingSubmittedDraftKeys=new Set;this.executionScopeDepth=0;this.executionScopeFailed=!1;this.MAX_ENTRIES=100}static getInstance(){return r.instance||(r.instance=new r),r.instance}makeKey(e){return JSON.stringify({v:1,kind:e.kind,header:e.header,placeholder:e.placeholder??"",linkSourcePath:e.linkSourcePath??"",scopeId:e.scopeId??""})}get(e){let t=this.drafts.get(e);if(t)return t.timestamp=Date.now(),t.value}set(e,t){this.drafts.size>=this.MAX_ENTRIES&&!this.drafts.has(e)&&this.evictOldest(1),this.drafts.set(e,{value:t,timestamp:Date.now()})}handleSubmittedDraft(e,t){if(!this.hasActiveExecutionScope()){this.clear(e);return}this.set(e,t),this.pendingSubmittedDraftKeys.add(e)}beginExecutionScope(){this.executionScopeDepth+=1}commitExecutionScope(){if(this.hasActiveExecutionScope()&&(this.executionScopeDepth-=1,!(this.executionScopeDepth>0))){if(!this.executionScopeFailed)for(let e of this.pendingSubmittedDraftKeys)this.clear(e);this.resetExecutionScope()}}rollbackExecutionScope(){this.hasActiveExecutionScope()&&(this.executionScopeFailed=!0,this.executionScopeDepth-=1,this.executionScopeDepth===0&&this.resetExecutionScope())}markExecutionScopeFailed(){this.hasActiveExecutionScope()&&(this.executionScopeFailed=!0)}hasActiveExecutionScope(){return this.executionScopeDepth>0}clear(e){this.drafts.delete(e),this.pendingSubmittedDraftKeys.delete(e)}clearAll(){this.drafts.clear(),this.resetExecutionScope()}evictOldest(e){let t=Array.from(this.drafts.entries()).sort(([,n],[,i])=>n.timestamp-i.timestamp).slice(0,e);for(let[n]of t)this.drafts.delete(n),this.pendingSubmittedDraftKeys.delete(n)}resetExecutionScope(){this.pendingSubmittedDraftKeys.clear(),this.executionScopeDepth=0,this.executionScopeFailed=!1}}});var Tm,MP=b(()=>{It();Em();Tm=class{constructor(e,t){this.store=Gi.getInstance();this.initialValue="";this.didChange=!1;this.draftKey=this.store.makeKey(e),this.shouldPersist=t??(()=>le.getState().persistInputPromptDrafts)}hydrate(e){return this.initialValue=e,this.shouldPersist()?this.store.get(this.draftKey)??e:e}markChanged(){this.didChange=!0}persist(e,t){if(this.shouldPersist()){if(t){this.store.handleSubmittedDraft(this.draftKey,e);return}if(!(!this.didChange||e===this.initialValue)){if(!e.trim()){this.store.clear(this.draftKey);return}this.store.set(this.draftKey,e)}}}}});function v_(r,e){if(r.focus(),e?.cursorAtEnd){let t=r.value.length;r.setSelectionRange(t,t);return}r.select()}var RP=b(()=>{});function y_(r,e,t){let n=e?.trim();if(!n)return;let i=r.createDiv({text:n,cls:"qa-prompt-context"});return i.setAttr("title",t?.trim()||n),i}var $P=b(()=>{});function dee(r){return(r??"").trim().replace(/\\/g,"/")}function pee(r){return r.startsWith("/")||/^[a-zA-Z]:/.test(r)}function fee(r){return r.split("/").some(e=>/^\.\.[. ]*$/u.test(e))}function Vn(r){let e=dee(r);return e?pee(e)||fee(e):!1}var xc=b(()=>{});function mee(r){let e=t=>String(t).padStart(2,"0");return`${r.getFullYear()}-${e(r.getMonth()+1)}-${e(r.getDate())} ${e(r.getHours())}.${e(r.getMinutes())}.${e(r.getSeconds())}`}async function b_(r,e,t,n){let i=my[t];if(!i)throw new Error(`Unsupported clipboard image type: ${t}`);let o=`Clipboard image ${mee(new Date)}.${i}`,s=await r.fileManager.getAvailablePathForAttachment(o,n||void 0);if(Vn(s))throw new Error(`Refusing to save clipboard image outside the vault: '${s}'`);return r.vault.createBinary(s,e)}function w_(r,e,t){let n=r.fileManager.generateMarkdownLink(e,t);return n.startsWith("!")?n:`!${n}`}var my,OP=b(()=>{xc();my=Object.assign(Object.create(null),{"image/png":"png","image/jpeg":"jpg","image/jpg":"jpg","image/gif":"gif","image/webp":"webp","image/svg+xml":"svg"})});function _m(r,e,t={}){let n=t.sourcePath??"",i=null,o=!1,s=!1,a=()=>{s=!0},l=()=>{s=!1},c=d=>{let f=d.clipboardData;if(!f||s||f.getData("text/plain").length>0)return;let p=gee(f);if(p.length!==0){if(d.preventDefault(),i){new C_.Notice("QuickAdd: an image is still being saved \u2014 paste again in a moment.");return}i=u(p).finally(()=>{i=null})}};async function u(d){let f=e.readOnly;e.readOnly=!0,e.setAttribute("aria-busy","true"),e.classList.add("qa-image-paste-busy");let p=[];try{for(let m of d){let v=await m.file.arrayBuffer(),g=await hee(()=>b_(r,v,m.mimeType,n));p.push(w_(r,g,n))}}catch(m){F.logError(`Failed to save pasted image: ${m instanceof Error?m.message:String(m)}`),new C_.Notice("QuickAdd: failed to save pasted image.")}finally{e.readOnly=f,e.removeAttribute("aria-busy"),e.classList.remove("qa-image-paste-busy")}if(!(p.length===0||o))try{vee(e,p.join(e.tagName==="TEXTAREA"?`
|
||
`:" "))}catch(m){F.logError(`Failed to insert pasted image link: ${m instanceof Error?m.message:String(m)}`),new C_.Notice("QuickAdd: saved the pasted image but could not insert its link.")}}return e.addEventListener("paste",c),e.addEventListener("compositionstart",a),e.addEventListener("compositionend",l),{isBusy:()=>i!==null,whenIdle:()=>i??Promise.resolve(),detach:()=>{o=!0,e.removeEventListener("paste",c),e.removeEventListener("compositionstart",a),e.removeEventListener("compositionend",l)}}}function hee(r){let e=bV.then(r,r);return bV=e.catch(()=>{}),e}function wV(r){return Object.hasOwn(my,r)}function gee(r){let e=[];for(let t of Array.from(r.items??[])){if(t.kind!=="file"||!wV(t.type))continue;let n=t.getAsFile();n&&e.push({file:n,mimeType:t.type})}if(e.length>0)return e;for(let t of Array.from(r.files??[]))wV(t.type)&&e.push({file:t,mimeType:t.type});return e}function vee(r,e){r.focus();let t=!1;try{t=r.ownerDocument.execCommand("insertText",!1,e)}catch{t=!1}if(t)return;let n=r.selectionStart??r.value.length,i=r.selectionEnd??n;r.setRangeText(e,n,i,"end"),r.dispatchEvent(new Event("input",{bubbles:!0}))}var C_,bV,x_=b(()=>{C_=require("obsidian");Me();OP();bV=Promise.resolve()});function NP(r){return!r.isComposing&&r.key==="Enter"&&r.shiftKey&&(r.ctrlKey||r.metaKey)}var Am,Sr,Hs=b(()=>{Am=require("obsidian");PP();FP();MP();RP();$P();x_();zr();Sr=class r extends Am.Modal{constructor(t,n,i,o,s,a,l){super(t);this.header=n;this.linkSourcePath=s;this.options=l;this.didSubmit=!1;this.didClose=!1;this.submitClickCallback=t=>this.submit();this.cancelClickCallback=t=>this.cancel();this.skipClickCallback=t=>this.skip();this.submitEnterCallback=t=>{if(this.isOptionalPrompt&&NP(t)){t.preventDefault(),this.skip();return}!t.isComposing&&t.key==="Enter"&&(t.preventDefault(),this.submit())};this.placeholder=i??"",this.description=a?.trim()||void 0,this.draftHandler=new Tm({kind:"single",header:this.header,placeholder:this.placeholder,linkSourcePath:this.linkSourcePath,scopeId:l?.draftScopeId}),this.input=this.draftHandler.hydrate(o??""),this.waitForClose=new Promise((c,u)=>{this.resolvePromise=c,this.rejectPromise=u}),this.display(),this.open(),this.fileSuggester=new Cm(t,this.inputComponent.inputEl,{sourcePath:this.linkSourcePath}),this.tagSuggester=new xm(t,this.inputComponent.inputEl)}static Prompt(t,n,i,o,s,a){return new r(t,n,i,o,void 0,s,a).waitForClose}static PromptWithContext(t,n,i,o,s,a,l){return new r(t,n,i,o,s,a,l).waitForClose}display(){this.containerEl.addClass("quickAddModal","qaInputPrompt"),this.contentEl.empty(),this.titleEl.textContent=this.header,y_(this.contentEl,this.options?.contextLine,this.options?.contextLineFull),this.description&&this.contentEl.createDiv({text:this.description,cls:"setting-item-description"}).setCssStyles({marginBottom:"0.75rem"}),this.isOptionalPrompt&&this.contentEl.createDiv({text:"Optional \u2014 leave empty, press Skip, or ctrl/cmd+shift+\u21B5.",cls:"setting-item-description"}).setCssStyles({marginBottom:"0.75rem"});let t=this.contentEl.createDiv();this.inputComponent=this.createInputField(t,this.placeholder,this.input),this.createButtonBar(t)}get isOptionalPrompt(){return this.options?.optional===!0}createInputField(t,n,i){let o=new Am.TextComponent(t);return o.inputEl.setCssStyles({width:"100%"}),o.setPlaceholder(n??"").setValue(i??"").onChange(s=>this.onInputChanged(s)).inputEl.addEventListener("keydown",this.submitEnterCallback),this.options?.imagePaste&&(this.imagePasteHandle=_m(this.app,o.inputEl,this.options.imagePaste)),o}createButton(t,n,i){let o=new Am.ButtonComponent(t);return o.setButtonText(n).onClick(i),o}createButtonBar(t){let n=t.createDiv();if(this.createButton(n,"Ok",this.submitClickCallback).setCta().buttonEl.setCssStyles({marginRight:"0"}),this.createButton(n,"Cancel",this.cancelClickCallback),this.isOptionalPrompt){let i=this.createButton(n,"Skip",this.skipClickCallback);i.setTooltip("Leave this field empty"),i.buttonEl.setAttribute("aria-label","Skip and leave empty")}n.setCssStyles({display:"flex",flexDirection:"row-reverse",justifyContent:"flex-start",marginTop:"1rem",gap:"0.5rem"})}transformInputOnSubmit(t){return t}submit(){if(this.didSubmit||this.didClose)return;if(this.imagePasteHandle?.isBusy()){this.imagePasteHandle.whenIdle().then(()=>this.submit());return}let t=this.inputComponent?.inputEl?.value??this.input;this.input=this.transformInputOnSubmit(t),this.didSubmit=!0,this.close()}skip(){this.input="",this.didSubmit=!0,this.close()}cancel(){this.close()}resolveInput(){this.didSubmit?this.resolvePromise(this.input):this.rejectPromise(rn())}onInputChanged(t){this.draftHandler.markChanged(),this.input=t}syncInputFromEl(){this.inputComponent?.inputEl&&(this.input=this.inputComponent.inputEl.value)}persistDraft(){this.draftHandler.persist(this.input,this.didSubmit)}removeInputListener(){this.inputComponent.inputEl.removeEventListener("keydown",this.submitEnterCallback),this.imagePasteHandle?.detach()}onOpen(){super.onOpen(),v_(this.inputComponent.inputEl,this.options)}onClose(){this.didClose=!0,this.didSubmit||this.syncInputFromEl(),this.persistDraft(),this.resolveInput(),this.removeInputListener(),this.fileSuggester?.destroy(),this.tagSuggester?.destroy(),super.onClose()}}});var Sm,gy,T_=b(()=>{Me();Sm=r=>{F.logWarning(r)},gy=()=>{}});function Aee(r,e){let t=Math.min(r.length,e.length),n=0;for(;n<t&&r[n]===e[n];)n++;return n}function xV(r,e,t){if(r===e)return 0;if(Math.abs(r.length-e.length)>t||r.length>64||e.length>64)return t+1;let n=[],i=Array.from({length:e.length+1},(s,a)=>a),o=[];for(let s=1;s<=r.length;s++){o=new Array(e.length+1),o[0]=s;let a=o[0];for(let l=1;l<=e.length;l++){let c=r[s-1]===e[l-1]?0:1,u=Math.min(i[l]+1,o[l-1]+1,i[l-1]+c);s>1&&l>1&&r[s-1]===e[l-2]&&r[s-2]===e[l-1]&&(u=Math.min(u,n[l-2]+1)),o[l]=u,u<a&&(a=u)}if(a>t)return t+1;n=i,i=o}return i[e.length]}function EV(r,e,t=3){let n=r.trim().toLowerCase();if(!n)return[];let i=e.map((a,l)=>({candidate:a,index:l})).filter(a=>a.candidate!==n),o=i.map(a=>({...a,distance:xV(n,a.candidate,2)})).filter(a=>a.distance<=1).sort((a,l)=>a.distance-l.distance||a.index-l.index);if(o.length>0)return o.slice(0,t).map(a=>a.candidate);if(n.length>=2){let a=i.map(l=>({...l,shared:Aee(n,l.candidate)})).filter(l=>l.shared>=2).sort((l,c)=>c.shared-l.shared||l.index-c.index);if(a.length>0)return a.slice(0,t).map(l=>l.candidate)}return i.map(a=>({...a,distance:xV(n,a.candidate,2)})).filter(a=>a.distance<=2&&a.candidate.length>=10).sort((a,l)=>a.distance-l.distance||a.index-l.index).slice(0,t).map(a=>a.candidate)}var TV=b(()=>{});function vy(r){let t=/^(\s*---\r?\n)([\s\S]*?)(\r?\n(?:---|\.\.\.)\s*(?:\r?\n|$))/.exec(r);return t?[0,t[0].length]:null}function yy(r,e,t,n){let[i,o]=n??[Number.NaN,Number.NaN];if(!(n!==null&&e>=i&&e<=o))return{isInYaml:!1,isQuoted:!1,lineStart:0,lineEnd:0,baseIndent:"",isKeyValuePosition:!1,isListItemPosition:!1};let a=r.lastIndexOf(`
|
||
`,e-1)+1,l=r.indexOf(`
|
||
`,Math.max(e,t)),c=l===-1?r.length:l,u=r.slice(a,e),d=r.slice(t,c),f=(u.match(/^\s*/)||[""])[0],p=r[e-1]==='"'&&r[t]==='"'||r[e-1]==="'"&&r[t]==="'",m=u.replace(/["']$/,""),g=d.replace(/^["']/,"").replace(/\s+#.*$/,"").trim().length===0,y=/:\s*$/.test(m)&&g,w=/^\s*-\s*$/.test(m)&&g;return{isInYaml:!0,isQuoted:p,lineStart:a,lineEnd:c,baseIndent:f,isKeyValuePosition:y,isListItemPosition:w}}var LP=b(()=>{});function _V(r){return r.replace(/\\/g,"\\\\").replace(/"/g,'\\"').replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/\t/g,"\\t").replace(kee,e=>`\\x${e.charCodeAt(0).toString(16).padStart(2,"0")}`)}function by(r){return`"${_V(r)}"`}function BP(r,e,t){let n=yy(r,e,t,vy(r));return!n.isInYaml||!n.isQuoted?!1:n.isKeyValuePosition||n.isListItemPosition}function Dm(r,e,t,n){return BP(r,e,t)?r[e-1]==='"'?_V(n):n.replace(/'/g,"''"):n}function UP(r,e,t){let n=yy(r,e,t,vy(r));return!n.isInYaml||n.isQuoted?!1:n.isKeyValuePosition||n.isListItemPosition}var kee,VP=b(()=>{LP();kee=new RegExp("[\0-\x7F]","g")});function __(r,e,t){let n=r.trim().toLowerCase();if(See.has(n))return n;t?.(`QuickAdd: Unsupported multi-select format "${r}" in "${e}". Supported formats: auto, inline, yaml, markdown.`)}function Dee(r,e){let t=r.lastIndexOf(`
|
||
`,e-1)+1;return r.slice(t,e).match(/^\s*/)?.[0]??""}function Iee(r){return`- ${r.replace(/\r\n?|\n/g,`
|
||
`)}`}function AV(r){let{input:e,matchStart:t,values:n,format:i}=r;if(i==="auto")return;let o=n.map(a=>String(a));if(i==="inline")return o.join(",");if(i==="yaml")return`[${o.map(by).join(", ")}]`;if(o.length===0)return"";let s=Dee(e,t);return o.map(Iee).join(`
|
||
${s}`)}var See,A_=b(()=>{VP();See=new Set(["auto","inline","yaml","markdown"])});function S_(r,e){return r.length<=e?r:`${r.slice(0,e)}\u2026`}function Fee(r){let e=r.map(t=>`"${t}"`);return e.length<=1?e.join(""):`${e.slice(0,-1).join(", ")} or ${e[e.length-1]}`}function kV(r,e){let t=S_(r,32),n=`{{FIELD:${S_(e,48)}}}`,i=Pee.get(r);if(i)return`Unknown FIELD filter "${t}" - ${i}. Ignored in ${n}.`;let o=EV(r,k_);return o.length>0?`Unknown FIELD filter "${t}" - did you mean ${Fee(o)}? Ignored in ${n}.`:`Unknown FIELD filter "${t}" in ${n} was ignored. Supported filters: ${k_.join(", ")}.`}function Mee(r,e){let t=S_(r,32);return`FIELD filter "${t}" needs a value - write "${t}:value". Ignored in {{FIELD:${S_(e,48)}}}.`}function Ree(r,e,t){(t.warn??Sm)(kV(r,e))}var k_,Pee,Yi,Ru=b(()=>{T_();op();TV();A_();k_=["folder","tag","inline","inline-code-blocks","exclude-folder","exclude-tag","exclude-file","default","default-from","default-empty","default-always","case-sensitive","multi","format"],Pee=new Map([["case-insensitive",'matching is already case-insensitive; use "case-sensitive:true" to match exactly']]);Yi=class{static parse(e,t){let n=Bs(e).map(c=>c.trim()),i=n[0],o={},s=!1,a="auto",l=!1;for(let c=1;c<n.length;c++){let u=n[c];if(u.toLowerCase()==="multi"){s=!0;continue}let d=mo(u);if(!d){let m=u.toLowerCase();t?.warnUnknown&&m&&(t.warn??Sm)(k_.includes(m)?Mee(m,e):kV(m,e));continue}let f=d.key,p=d.value;if(!k_.includes(f)){t?.warnUnknown&&Ree(f,e,t);continue}switch(f){case"multi":s=Tu(p);break;case"format":l=!0,a=__(p,`{{FIELD:${e}}}`,t?.warn)??"auto";break;case"folder":o.folders||(o.folders=[]),o.folders.push(p),o.folder||(o.folder=p);break;case"tag":{o.tags||(o.tags=[]);let m=p.startsWith("#")?p.substring(1):p;o.tags.push(m);break}case"inline":o.inline=p.toLowerCase()==="true";break;case"inline-code-blocks":o.inlineCodeBlocks||(o.inlineCodeBlocks=[]),o.inlineCodeBlocks.push(...p.split(",").map(m=>m.trim().toLowerCase()).filter(m=>m.length>0));break;case"default":o.defaultValue=p;break;case"default-from":o.defaultFrom=p.toLowerCase();break;case"default-empty":o.defaultEmpty=p.toLowerCase()==="true";break;case"default-always":o.defaultAlways=p.toLowerCase()==="true";break;case"case-sensitive":o.caseSensitive=p.toLowerCase()==="true";break;case"exclude-folder":o.excludeFolders||(o.excludeFolders=[]),o.excludeFolders.push(p);break;case"exclude-tag":{o.excludeTags||(o.excludeTags=[]);let m=p.startsWith("#")?p.substring(1):p;o.excludeTags.push(m);break}case"exclude-file":o.excludeFiles||(o.excludeFiles=[]),o.excludeFiles.push(p);break}}return!s&&l&&(t?.warn?.(`QuickAdd: |format: needs |multi in "{{FIELD:${e}}}"; ignoring.`),a="auto"),{fieldName:i,filters:o,...s?{multiSelect:s}:{},...a!=="auto"?{multiFormat:a}:{}}}}});function qP(r){return r.replace(/^\/+|\/+$/g,"")}function wy(r,e=t=>t){return JSON.stringify([...r].map(e).sort())}function SV(r,e){let t=[`folder=${qP(r)}`];return e.folders?.length&&t.push(`folders=${wy(e.folders,qP)}`),e.tags?.length&&t.push(`tags=${wy(e.tags)}`),e.excludeFolders?.length&&t.push(`xfolder=${wy(e.excludeFolders,qP)}`),e.excludeTags?.length&&t.push(`xtag=${wy(e.excludeTags)}`),e.excludeFiles?.length&&t.push(`xfile=${wy(e.excludeFiles)}`),t.join("|")}function Oee(r){let{folderPath:e,mode:t,label:n,optional:i,allowCustomInput:o,multiSelect:s,filter:a}=r,l=[SV(e,a),`mode=${t}`];return n&&l.push(`label=${n}`),i&&l.push("optional"),o&&l.push("custom"),s&&l.push("multi"),l.join("|")}function D_(r,e){if(!r)return null;let t=Bs(r),n=(t.shift()??"").trim();if(!n)return null;let i=t,o=Sa(i,"optional");i=o.remaining;let s=o.found,a=Sa(i,"custom");i=a.remaining;let l=a.found,c=Sa(i,"multi");i=c.remaining;let u=c.found,d="name",f=[];for(let C of i){let _=C.trim().toLowerCase();if($ee.has(_)){d=_;continue}f.push(C)}let p,m;for(let C of f){let _=mo(C);_&&(_.key==="label"&&_.value?p=_.value:_.key==="name"&&_.value&&(m=_.value))}let v=Yi.parse(r,{warn:e?.warn}),g=u||(v.multiSelect??!1),y=v.multiFormat??"auto",w={folder:n,tags:v.filters.tags,excludeFolders:v.filters.excludeFolders,excludeTags:v.filters.excludeTags,excludeFiles:v.filters.excludeFiles},x=m?`${Cy}name=${m}|${SV(n,w)}${g?"|multi":""}`:`${Cy}${Oee({folderPath:n,mode:d,label:p,optional:s,allowCustomInput:l,multiSelect:g,filter:w})}`;return{raw:r,folderPath:n,mode:d,label:p,aliasName:m,optional:s,allowCustomInput:l,filter:w,multiSelect:g,multiFormat:y,variableKey:x}}function DV(r,e){if(!r)return r;for(let t of e)if(r===t)return r;return`${as}${r}`}function gp(r){return typeof r!="string"||r===""?{kind:"empty"}:r.startsWith(as)?{kind:"custom",text:r.slice(as.length)}:r.startsWith(vl)?{kind:"file",path:r.slice(vl.length)}:{kind:"raw",value:r}}function Im(r){return(r.split("/").pop()??r).replace(/\.(md|canvas|base)$/i,"")}function IV(r){return typeof r=="string"&&r.trim().length>0?r.trim():void 0}function Nee(r){if(!r)return;let e=Object.entries(r).find(([t])=>t.toLowerCase()==="title");return e?IV(e[1]):void 0}function Lee(r){let e=r?.headings?.find(t=>t.level===1);return IV(e?.heading)}function Bee(r){let e=r.parent?.path;return e&&e!=="/"?e:r.path.includes("/")?r.path.slice(0,r.path.lastIndexOf("/")):"vault root"}function Uee(r){return r.basename?r.basename:Im(r.path)}function WP(r,e){let t=r.map(i=>{let o=e?.(i)??null,s=Uee(i),a=Nee(o?.frontmatter)??Lee(o)??s,l=a===s?s:`${a} (${s})`;return{file:i,primary:a,label:l}}),n=new Map;for(let{label:i}of t)n.set(i,(n.get(i)??0)+1);return t.map(({file:i,primary:o,label:s})=>{let a=(n.get(s)??0)<=1?s:`${s} - ${Bee(i)}`;return{primary:o,secondary:i.path,label:a}})}function Ec(r,e){return WP(r,e).map(t=>t.label)}var Cy,vl,as,$ee,js=b(()=>{Ru();op();Cy="FILE:",vl="@file:",as="@filecustom:",$ee=new Set(["name","link","path"])});function FV(r,e,t){return Array.isArray(r)?r.map(n=>PV(n,e,t)):PV(r,e,t)}function PV(r,e,t){if(e==="link")return t(r);let n=gp(r);switch(n.kind){case"empty":return"";case"file":return e==="path"?n.path:Im(n.path);case"custom":case"raw":return n.kind==="custom"?n.text:n.value}}var MV=b(()=>{js()});function jee(r){return Wee.test(r.trim())}function Gee(r){let e=r.replace(zee,"");return e===r?!1:!Hee.test(e)}function I_(r,e){return Vee.has(r)?Gee(e):jee(e)}function P_(r){return r==="noteTitle"||r==="captureTarget"||r==="folder"||r==="templatePath"||r==="lineTarget"||r==="filePath"}function zP(r){return r!=="templatePath"&&r!=="generic"}function F_(r,e){if(r==="generic")return{};let t=qee[r];return e?{title:t.ask,placeholder:t.hint}:{placeholder:t.partOf}}function Yee(r,e=44){if(r.length<=e)return r;let t=r.split("/");if(t.length===1)return r;let n=t[t.length-1];if(t.length===2){let s=`${RV}/${n}`;return s.length<r.length?s:r}let o=`${t[0]}/${RV}/${n}`;return o.length<r.length?o:r}function xy(r,e,t){if(!r)return;let n=[],i=r.choiceName?.trim();i&&i!==e?.trim()&&n.push(i);let o=t?.showDestination===!1?void 0:r.destination?.trim();if(o){let s=t?.elide===!1?o:Yee(o);n.push(`\u2192 ${r.destinationKind==="folder"?`${s}/`:s}`)}return n.length?n.join(" "):void 0}var Vee,qee,Wee,zee,Hee,RV,Ey=b(()=>{Tt();Vee=new Set(["captureText"]),qee={noteTitle:{ask:"Note title",hint:"Title for the new note",partOf:"Part of the new note's title"},captureTarget:{ask:"Capture target",hint:"Where to capture to",partOf:"Part of the capture destination"},captureText:{ask:"Text to capture",hint:"Text to add to the note",partOf:"Part of the text added to the note"},noteBody:{ask:"Note content",hint:"Text inserted into the note",partOf:"Part of the text inserted into the note"},folder:{ask:"Folder",hint:"Folder for the new note",partOf:"Part of the folder path"},templatePath:{ask:"Template",hint:"Path to the template file",partOf:"Part of the template path"},lineTarget:{ask:"Line to find",hint:"Existing line to anchor the capture to",partOf:"Part of the line to find"},filePath:{ask:"File to open",hint:"Path to the file to open",partOf:"Part of the file path"}},Wee=new RegExp(`^(?:${cc.source})$`,"i"),zee=new RegExp(cc.source,"gi"),Hee=/\{\{[^}\n\r]*\}\}/;RV="\u2026"});function Ty(r,e){if(!r||!e)return null;let t=r,n=t.metadataTypeManager??t.metadataCache?.app?.metadataTypeManager;if(!n||typeof n.getTypeInfo!="function")return null;let i=n.getTypeInfo(e),o=i?.expected?.type??i?.inferred?.type;return typeof o=="string"?o:null}function Xee(r){return r!==null&&Kee.has(r.toLowerCase())}function $V(r,e){return Qee.has(e.toLowerCase())||Xee(Ty(r,e))}var Kee,Qee,M_=b(()=>{Kee=new Set(["aliases","list","multitext","tags"]),Qee=new Set(["aliases","cssclasses","tags"])});function Zee(r,e=","){let t=[],n="",i=[],o=null;for(let a=0;a<r.length;a++){let l=r[a];if(o){if(n+=l,l===o){let c=0;for(let u=a-1;u>=0&&r[u]==="\\";u--)c++;c%2===0&&(o=null)}continue}if(l==='"'){o=l,n+=l;continue}if(l in OV){i.push(OV[l]),n+=l;continue}if(i.length>0){let c=i[i.length-1];l===c&&i.pop(),n+=l;continue}if(l===e){let c=n.trim();c.length>0&&t.push(c),n="";continue}n+=l}let s=n.trim();return s.length>0&&t.push(s),t}function Jee(r){return r.includes(`
|
||
`)?r.replace(/\r?\n/g,`
|
||
`):r.includes("\\n")?r.replace(/\\n/g,`
|
||
`):r}function ete(r){if(!r)return!1;let e=r.toLowerCase();return e==="list"||e==="tags"||e==="multitext"}function NV(r,e){let t=r.trim();if(!t)return;let n=Jee(t),i=e?.propertyType??Ty(e?.app,e?.propertyKey),o=ete(i),a=o||i===null,c=n.split(/\n/).map(u=>u.trim()).filter(u=>u.length>0);if(a&&c.length>0&&c.every(u=>/^-\s+/.test(u)))return c.map(u=>u.replace(/^-[\s]*/,"").trim());if(n.startsWith("[")&&n.endsWith("]")||n.startsWith("{")&&n.endsWith("}")){if(i&&!o&&i!=="list")return;try{return JSON.parse(n)}catch{}}if(n.includes(",")&&a){let u=Zee(n);if(u.length>1)return u}}var OV,LV=b(()=>{M_();OV={"[":"]","(":")","{":"}","<":">"}});function R_(r){if(typeof r=="string"&&r.startsWith("@date:")){let e=r.substring(6),t=new Date(e);if(!Number.isNaN(t.getTime()))return t}return r}function HP(r){return typeof r!="string"&&(Array.isArray(r)||typeof r=="object"&&r!==null||typeof r=="number"||typeof r=="boolean"||r===null)}function BV(r){return Array.isArray(r)||typeof r=="object"&&r!==null}function UV(r){if(HP(r))return Array.isArray(r)?"[]":r===null?"null":typeof r=="object"?"{}":String(r)}var _y=b(()=>{});var VV,Ma,$_=b(()=>{LP();LV();_y();M_();VV="\0",Ma=class{constructor(e){this.app=e;this.map=new Map;this.propertyTypeCache=new Map}maybeCollect(e){let{input:t,matchStart:n,matchEnd:i,rawValue:o,fallbackKey:s,collectionActive:a,heuristicEnabled:l}=e;if(!a)return;let c=vy(t),u=yy(t,n,i,c);if(!u.isInYaml)return;let d=t.slice(u.lineStart,u.lineEnd),f=d.trim(),p=d.match(/^\s*([^:]+):/),m=p?p[1].trim():s,v=/^-\s*['"]?\{\{(?:VALUE|FIELD|FILE):[^}]+\}\}['"]?\s*$/i,g=null;if(u.isKeyValuePosition?g=[m]:v.test(f)&&(g=this.findListParentPath(t,u.lineStart,u.baseIndent??"")),!g||g.length===0)return;let y=g[g.length-1],w=o;if(l&&typeof o=="string"){let C=NV(o,this.buildParseOptions(y));C!==void 0&&(w=C)}if(!HP(w)||Array.isArray(w)&&w.length===0||!l&&!BV(w))return;let x=g.join(VV);return this.map.set(x,w),w}drain(){let e=new Map(this.map);return this.map.clear(),e}merge(e){for(let[t,n]of e)this.map.set(t,n)}buildParseOptions(e){return{propertyKey:e,propertyType:this.resolvePropertyType(e),app:this.app}}findListParentPath(e,t,n){let i=t-1,o=[],s=n.length;for(;i>=0;){let a=e.lastIndexOf(`
|
||
`,i),l=a===-1?0:a+1,c=e.slice(l,i+1),u=c.trim();if(u.length===0){i=l-2;continue}if(u==="---"||u==="...")break;if(u.startsWith("-")){i=l-2;continue}let d=c.match(/^(\s*)([^:\n]+):/);if(d){let p=(d[1]??"").length;if(p<s&&(o.unshift(d[2].trim()),s=p,s===0))break}i=l-2}return o.length>0?o:null}resolvePropertyType(e){if(!this.app)return null;if(this.propertyTypeCache.has(e))return this.propertyTypeCache.get(e)??null;let t=Ty(this.app,e);return this.propertyTypeCache.set(e,t),t}};Ma.PATH_SEPARATOR=VV});function Pm(r){return tte.has(r.toUpperCase())}var O_,N_,L_,tte,B_=b(()=>{O_=new RegExp("[\0-]","u"),N_=/[\\/:*?"<>|]/u,L_=/[. ]$/u,tte=new Set(["CON","PRN","AUX","NUL","COM1","COM2","COM3","COM4","COM5","COM6","COM7","COM8","COM9","LPT1","LPT2","LPT3","LPT4","LPT5","LPT6","LPT7","LPT8","LPT9"])});function qV(r){if(!r)return null;let e=r.trim().toLowerCase();switch(e){case"kebab":case"snake":case"camel":case"pascal":case"title":case"lower":case"upper":case"slug":return e;default:return null}}function KP(r){return qV(r)!==null}function jP(r){if(!r)return r;let e=r.toLowerCase();return e.slice(0,1).toUpperCase()+e.slice(1)}function GP(r){return/\p{L}/u.test(r)?/\p{Lu}/u.test(r)&&!/\p{Ll}/u.test(r):!1}function U_(r){return/\p{Lu}/u.test(r)&&/\p{Ll}/u.test(r)}function rte(r){return/^\p{Ll}/u.test(r)&&U_(r)}function nte(r){if(!r)return[];{let t=r.match(/^([\p{Ll}][\p{Lu}]{2,})([\p{N}]+)?$/u);if(t){let n=[t[1]];return t[2]&&n.push(t[2]),n}}if(/^[\p{Ll}][\p{Lu}][\p{Ll}]+(?:[\p{Lu}][\p{Ll}]+)*$/u.test(r))return[r];let e=r;return e=e.replace(/([\p{Lu}])([\p{Lu}][\p{Ll}])/gu,"$1 $2"),e=e.replace(/([\p{Ll}\p{N}])([\p{Lu}])/gu,"$1 $2"),e=e.replace(/([\p{L}])([\p{N}])/gu,"$1 $2"),e=e.replace(/([\p{N}])([\p{L}])/gu,"$1 $2"),e.trim().split(/\s+/u).map(t=>t.trim()).filter(Boolean)}function ite(r){return r.split(/[^\p{L}\p{N}\p{M}]+/gu).filter(Boolean).flatMap(nte).filter(Boolean)}function V_(r,e){let t=qV(e);if(!t)return r;if(t==="lower")return r.toLowerCase();if(t==="upper")return r.toUpperCase();let n=ite(r);if(n.length===0)return"";switch(t){case"kebab":return n.map(i=>i.toLowerCase()).join("-");case"snake":return n.map(i=>i.toLowerCase()).join("_");case"camel":{let[i,...o]=n,s=i?rte(i)?i:i.toLowerCase():"",a=o.map(l=>GP(l)||U_(l)?l:jP(l));return[s,...a].join("")}case"pascal":return n.map(i=>GP(i)||U_(i)?i:jP(i)).join("");case"title":return n.map(i=>GP(i)||U_(i)?i:jP(i)).join(" ");case"slug":{let i=n.map(o=>o.toLowerCase()).join("-");return Pm(i)?`${i}-`:i}default:return r}}var YP,q_=b(()=>{B_();YP=["kebab","snake","camel","pascal","title","lower","upper","slug"]});function W_(r){let e=r.trim();return e&&(/^\[\[.*\]\]$/.test(e)?e:`[[${e}]]`)}var QP=b(()=>{});function ate(r,e,t){return t&&e?`${r}${XP}${e}`:r}function ky(r){let e=r.indexOf(XP);return e===-1?r:r.slice(0,e)}function lte(r,e){let t=e.toLowerCase(),n=null;for(let i of r.keys())if(i.toLowerCase()===t&&r.get(i)!==void 0){if(n)return null;n=i}return n}function j_(r,e){if(!e)return null;let t=[e],n=ky(e);n!==e&&t.push(n);for(let i of t){if(r.has(i)&&r.get(i)!==void 0)return i;let o=lte(r,i);if(o)return o}return null}function cte(r){let{remaining:e,found:t}=Sa(r,"optional");return{remaining:e,optional:t}}function jV(r){let{remaining:e,optional:t}=cte(r),{remaining:n,found:i}=Sa(e,"trim");return{remaining:n,optional:t,trim:i}}function ute(r,e){let t=r.trim();if(!t)return!1;let n=mo(t);return n?(e?ZP:H_).has(n.key):!1}function dte(r,e){let t=e?ZP:H_;return r.some(n=>{let i=mo(n.trim());if(!i||i.key!=="type"||!t.has("type"))return!1;let o=i.value.trim().toLowerCase();return o==="number"||o==="slider"})}function GV(r,e,t,n,i){if(r.length===0)return{defaultValue:"",allowCustomInput:!1,usesOptions:!1};let o=t?ZP:H_,s=dte(r,t),a=r.some(V=>ute(V,t)||s&&WV.has(mo(V.trim())?.key??"")),l=e&&r.some(V=>V.trim().toLowerCase()==="custom"),c=e&&r.some(V=>V.trim().toLowerCase()==="multi");if(!(a||l||c))return{defaultValue:r.join("|").trim(),allowCustomInput:!1,usesOptions:!1};let d,f,p="",m=!1,v,g,y,w,x,C,_,E,D=!1,P,H;for(let V of r){let oe=V.trim();if(!oe)continue;if(e&&oe.toLowerCase()==="custom"){m=!0;continue}if(e&&oe.toLowerCase()==="multi"){D=!0;continue}let ce=mo(oe);if(!ce)continue;let{key:R,value:O}=ce;if(!(!o.has(R)&&!(s&&WV.has(R))))switch(R){case"label":O&&(d=O);break;case"case":O&&(f=O);break;case"default":p=O;break;case"custom":m=Tu(O);break;case"type":O&&(v=O);break;case"min":g=O;break;case"max":y=O;break;case"step":w=O;break;case"text":x=O;break;case"optional":C=Tu(O);break;case"trim":_=Tu(O);break;case"multi":D=!0,P=O.trim().toLowerCase()==="linklist"?"linklist":"text";break;case"format":H=__(O,n,i);break;case"name":O?E=O:i(`QuickAdd: empty |name: ignored in "${n}"; provide a variable name, e.g. {{VALUE:a,b|name:category}}.`);break;default:break}}return{label:d,caseStyle:f,defaultValue:p,allowCustomInput:m,name:E,usesOptions:!0,inputTypeOverride:v,minRaw:g,maxRaw:y,stepRaw:w,displayValuesRaw:x,optionalExplicit:C,trimExplicit:_,multiSelect:D,multiEmit:P,multiFormat:H}}function YV(r,{tokenDisplay:e,hasOptions:t,allowCustomInput:n},i){if(!r)return;let o=r.trim().toLowerCase(),s=o==="boolean"?"checkbox":o;if(!ote.has(s)){i(`QuickAdd: Unsupported VALUE type "${r}" in token "${e}". Supported types: multiline, number, slider, checkbox, text.`);return}if(t||n){i(`QuickAdd: Ignoring type:${s} for option-list VALUE token "${e}".`);return}return s}function Fm(r){if(r===void 0)return;let e=r.trim();if(!e)return;let t=Number(e);return Number.isFinite(t)?t:void 0}function pte(r){return r.minRaw!==void 0||r.maxRaw!==void 0||r.stepRaw!==void 0}function zV(r,e,t){let n=Fm(r.minRaw),i=Fm(r.maxRaw),o=Fm(r.stepRaw),s={};return r.minRaw!==void 0&&(n===void 0?t(`QuickAdd: Ignoring invalid min in VALUE token "${e}".`):s.min=n),r.maxRaw!==void 0&&(i===void 0?t(`QuickAdd: Ignoring invalid max in VALUE token "${e}".`):s.max=i),s.min!==void 0&&s.max!==void 0&&s.max<s.min&&(t(`QuickAdd: Ignoring invalid numeric range in VALUE token "${e}"; max must be greater than or equal to min.`),delete s.min,delete s.max),r.stepRaw!==void 0&&(o===void 0||o<=0?t(`QuickAdd: Ignoring invalid step in VALUE token "${e}"; step must be greater than 0.`):s.step=o),Object.keys(s).length>0?s:void 0}function KV(r,e,t,n){if(t!=="number"&&t!=="slider")return pte(r)&&n(`QuickAdd: Ignoring numeric range options in "${e}" because type is not number or slider.`),{inputTypeOverride:t};if(t!=="slider"){let c=zV(r,e,n);return{inputTypeOverride:t,numericConfig:c}}let i=Fm(r.minRaw),o=Fm(r.maxRaw),s=r.stepRaw===void 0?1:Fm(r.stepRaw),a=i===void 0||o===void 0?"slider requires finite min and max values":o<=i?"max must be greater than min":s===void 0||s<=0?"step must be greater than 0":void 0;if(a)return n(`QuickAdd: Invalid slider configuration in "${e}" (${a}); falling back to type:number.`),{inputTypeOverride:"number",numericConfig:zV(r,e,gy)};let l={min:i,max:o,step:s};return{inputTypeOverride:t,numericConfig:l,sliderConfig:l}}function HV(r){let e=String(r),t=/e-(\d+)$/i.exec(e);if(t)return Number(t[1]);let n=e.indexOf(".");return n===-1?0:e.length-n-1}function fte(r,e){return String(Number(r.toFixed(e)))}function Ra(r,e){let t=r?.trim()??"";if(!t)return"";let n=Number(t);if(!Number.isFinite(n))return"";let i=e?.min,o=e?.max,s=n;if(i!==void 0&&(s=Math.max(i,s)),o!==void 0&&(s=Math.min(o,s)),e?.step!==void 0&&e.step>0){let a=i??0,l=Math.round((s-a)/e.step);s=a+l*e.step,i!==void 0&&(s=Math.max(i,s)),o!==void 0&&(s=Math.min(o,s));let c=Math.max(HV(a),HV(e.step));return fte(s,c)}return String(s)}function Sy(r,e){return Ra(r,e)||String(e.min)}function z_(r){return r!==void 0&&mte.has(r)}function Ay(r){let e=[],t="",n=!1;for(let i=0;i<r.length;i++){let o=r[i];if(n){if(z_(o)){if(z_(r[i+1])){t+='"',i++;continue}let s=i+1;for(;s<r.length&&hte.test(r[s]);)s++;if(s>=r.length||r[s]===","){n=!1,i=s-1;continue}return r.split(",")}t+=o;continue}if(o===","){e.push(t),t="";continue}if(z_(o)&&t.trim()===""){n=!0,t="";continue}t+=o}return n?r.split(","):(e.push(t),e)}function JP(r){let e=r.trim();if(!z_(e[0]))return r;let t=Ay(e);return t.length===1&&t[0]!==e?t[0].trim():r}function Dy(r,e){if(!r)return null;let t=e?.warn??Sm,n=Bs(r),i=(n.shift()??"").trim();if(!i)return null;let o=Ay(i).map(V=>V.trim()).filter(Boolean),s=o.length>1,{remaining:a,optional:l,trim:c}=jV(n),u=`{{VALUE:${r}}}`,d=GV(a,s,!0,u,t),{label:f,caseStyle:p,defaultValue:m,allowCustomInput:v}=d,g=d.multiSelect??!1,y=d.multiEmit??"text",w=d.multiFormat??"auto",x=d.optionalExplicit??l,C=d.trimExplicit??c;if(!d.usesOptions){let V=m;v=s&&V.toLowerCase()==="custom",m=v?"":V}s&&m&&(m=JP(m));let _=YV(d.inputTypeOverride,{tokenDisplay:u,hasOptions:s,allowCustomInput:v},t),E=KV(d,u,_,t),D;if(d.displayValuesRaw!==void 0){if(!s)throw new Error(`QuickAdd: VALUE option "text" is only supported for option-list tokens in "${u}".`);if(D=Ay(d.displayValuesRaw).map(V=>V.trim()).filter(Boolean),D.length!==o.length)throw new Error(`QuickAdd: VALUE token "${u}" must define the same number of text entries and item entries. To include a comma inside one entry, wrap it in double quotes, e.g. "a, b".`);if(new Set(D).size!==D.length)throw new Error(`QuickAdd: VALUE token "${u}" has duplicate text entries. Text entries must be unique.`)}let P=d.name?.trim()||void 0;P&&P.includes(XP)&&(t(`QuickAdd: |name in "${u}" contains a reserved control character and was ignored.`),P=void 0),P&&ste.has(P.toLowerCase())&&(t(`QuickAdd: |name:${P} is reserved and was ignored in "${u}". Choose a different name.`),P=void 0),P&&!s&&t(`QuickAdd: |name on a single value in "${u}" is redundant \u2014 use {{VALUE:${P}}} directly.`),p&&!KP(p)&&(t(`QuickAdd: Unsupported |case style "${p}" in token "${u}". Supported styles: ${YP.join(", ")}.`),p=void 0),g&&!s&&(t(`QuickAdd: |multi needs an option list (2+ comma-separated values) in "${u}"; ignoring.`),g=!1),g&&p&&(t(`QuickAdd: |case is ignored with |multi in "${u}" \u2014 a list is not case-transformed.`),p=void 0),!g&&d.multiFormat!==void 0&&(t(`QuickAdd: |format: needs |multi in "${u}"; ignoring.`),w="auto"),!s&&!d.usesOptions&&a.some(V=>V.trim().toLowerCase()==="custom")&&(t(`QuickAdd: |custom needs an option list (2+ comma-separated values) in "${u}"; ignoring.`),m.toLowerCase()==="custom"&&(m=""));let H=P||ate(i,f,s);return{raw:r,variableName:i,aliasName:P,variableKey:H,label:f,caseStyle:p,defaultValue:m,allowCustomInput:v,suggestedValues:o,displayValues:D,hasOptions:s,inputTypeOverride:E.inputTypeOverride,numericConfig:E.numericConfig,sliderConfig:E.sliderConfig,optional:x,trim:C,multiSelect:g,multiEmit:y,multiFormat:w}}function eF(r,e){let t=e?.warn??Sm,n=jB(r),i=Bs(n).map(v=>v.trim()).filter(Boolean),{remaining:o,optional:s,trim:a}=jV(i);if(o.length===0)return{defaultValue:"",optional:s,trim:a};let l=`{{VALUE${r}}}`,c=GV(o,!1,!1,l,t);if(c.displayValuesRaw!==void 0)throw new Error(`QuickAdd: VALUE option "text" is only supported for option-list tokens in "${l}".`);let{label:u,caseStyle:d,defaultValue:f}=c;c.usesOptions||(f=f.trim()),d&&!KP(d)&&(t(`QuickAdd: Unsupported |case style "${d}" in token "${l}". Supported styles: ${YP.join(", ")}.`),d=void 0);let p=YV(c.inputTypeOverride,{tokenDisplay:l,hasOptions:!1,allowCustomInput:c.allowCustomInput},t),m=KV(c,l,p,t);return{label:u,caseStyle:d,defaultValue:f,inputTypeOverride:m.inputTypeOverride,numericConfig:m.numericConfig,sliderConfig:m.sliderConfig,optional:c.optionalExplicit??s,trim:c.trimExplicit??a}}var XP,ote,WV,H_,ZP,ste,mte,hte,yl=b(()=>{op();q_();A_();T_();XP="",ote=new Set(["multiline","number","slider","checkbox","text"]),WV=new Set(["min","max","step"]),H_=new Set(["label","default","custom","type","case","text","optional","trim","multi","format"]),ZP=new Set([...H_,"name"]),ste=new Set(["value","title"]);mte=new Set(['"',"\u201C","\u201D"]);hte=/[^\S\r\n]/});function Iy(r){if(!r)return{optional:!1,withTime:!1};let{remaining:e,found:t}=Sa(Bs(r),"optional"),{remaining:n,found:i}=Sa(e,"time"),{remaining:o,found:s}=Sa(n,"datetime"),a,l=!1,c,u=[];for(let f of o){let p=mo(f.trim());if(p?.key==="optional"){a=Tu(p.value);continue}if(p?.key==="type"){p.value.trim().toLowerCase()==="datetime"&&(l=!0);continue}if(p?.key==="startof"||p?.key==="endof"){c||(c={boundary:p.key==="startof"?"start":"end",unit:jT(p.value)});continue}u.push(f)}return{defaultValue:u.join("|").trim()||void 0,optional:a??t,withTime:i||s||l,snap:c}}function G_(r){try{return{options:Iy(r)}}catch(e){return{options:{optional:!1,withTime:!1},error:e instanceof Error?e.message:String(e)}}}var Py=b(()=>{op();ey()});function QV(r){if(!r)return null;let e=r.indexOf("|");if(e===-1){let o=r.trim();return o?{macroName:o}:null}let t=r.slice(0,e).trim();if(!t)return null;let n=r.slice(e+1).trim();if(!n)return{macroName:t};if(!n.toLowerCase().startsWith("label:"))return null;let i=n.slice(6).trim();return{macroName:t,label:i||void 0}}var XV=b(()=>{});function $u(r){if(r==null)return"";if(typeof r=="string")return r;if(typeof r=="number"||typeof r=="boolean")return String(r);if(typeof r=="bigint"||typeof r=="symbol")return r.toString();if(r instanceof Error)return r.message;try{return JSON.stringify(r)??Object.prototype.toString.call(r)}catch{return Object.prototype.toString.call(r)}}function Ou(r){return gte.includes(r)}function eq(r){switch(r){case"lessThan":case"lessThanOrEqual":case"greaterThan":case"greaterThanOrEqual":return"number";case"equals":case"notEquals":return"string";case"contains":case"notContains":return"string";default:return"boolean"}}function tq(r){if(!Ou(r.operator)||r.expectedValue===void 0||r.expectedValue===null)return;let e=r.expectedValue.trim();switch(r.valueType){case"number":{let t=Number(e);return Number.isNaN(t)?NaN:t}case"boolean":{let t=e.toLowerCase();return ZV.has(t)?!0:JV.has(t)?!1:!!e}default:return e}}function tF(r,e){switch(e){case"number":return typeof r=="number"?r:typeof r=="boolean"?r?1:0:Number(r);case"boolean":if(typeof r=="boolean")return r;if(typeof r=="string"){let t=r.trim().toLowerCase();if(ZV.has(t))return!0;if(JV.has(t))return!1}return!!r;default:return r==null?"":$u(r)}}function vte(r){if(!Ou(r.operator))return"";let e=r.expectedValue??"";return e.length===0?"(empty)":r.valueType==="string"?`"${e}"`:e}function yte(r){let e=r.variableName?`$${r.variableName}`:"(missing variable)",t=wte(r.operator),n=Ou(r.operator)?` ${vte(r)}`:"";return`${e} ${t}${n}`.trim()}function bte(r){let e=r.exportName?`::${r.exportName}`:"";return`script ${r.scriptPath}${e}`}function Mm(r){return r.mode==="variable"?yte(r):bte(r)}function wte(r){switch(r){case"equals":return"equals";case"notEquals":return"does not equal";case"lessThan":return"is less than";case"lessThanOrEqual":return"is less than or equal to";case"greaterThan":return"is greater than";case"greaterThanOrEqual":return"is greater than or equal to";case"contains":return"contains";case"notContains":return"does not contain";case"isTruthy":return"is truthy";case"isFalsy":return"is falsy";default:return r}}var gte,ZV,JV,Rm=b(()=>{gte=["equals","notEquals","lessThan","lessThanOrEqual","greaterThan","greaterThanOrEqual","contains","notContains"],ZV=new Set(["true","1","yes","on"]),JV=new Set(["false","0","no","off"])});function Fy(r){let e=[],t=r.length,n=0;for(;n<t;){let i=r.indexOf("`",n);if(i===-1)break;let o=i;for(;o<t&&r[o]==="`";)o++;if(o-i<3||!r.startsWith(rF,o)){n=o;continue}let s=o+rF.length,a=-1;for(;s<t;){let l=r.indexOf("`",s);if(l===-1)break;let c=l;for(;c<t&&r[c]==="`";)c++;if(c-l>=3){a=c;break}s=c}if(a===-1)break;e.push({start:i,end:a}),n=a}return e}function nq(r){let e=Fy(r),t=r.length,n=e.length>0?e[e.length-1].end:0;for(;n<t;){let i=r.indexOf("`",n);if(i===-1)return!1;let o=i;for(;o<t&&r[o]==="`";)o++;if(o-i>=3&&r.startsWith(rF,o))return!0;n=o}return!1}function My(r){return r?"YYYY-MM-DD HH:mm":"YYYY-MM-DD"}function Ry(r,e,t,n){if(r===void 0)return null;let i=r,o;if(typeof i=="string"&&i&&!i.startsWith("@date:")){if(n){let s=le.getState().dateAliases,a=n.parseDate(Bv(i,s));a&&(o=`@date:${a.moment.toISOString()}`,i=o)}}else i instanceof Date&&(Number.isNaN(i.getTime())||(o=`@date:${i.toISOString()}`,i=o));if(typeof i=="string"&&i.startsWith("@date:")){let s=i.substring(6);if(n&&window.moment){let a=window.moment(s);if(a?.isValid())return{text:am(a,t).format(e),...o!==void 0?{normalized:o}:{}}}return{text:"",...o!==void 0?{normalized:o}:{}}}return typeof i=="string"&&i?{text:i}:i!=null?{text:$u(i)}:{text:""}}var rq,Cte,Y_,rF,bl,$m=b(()=>{rq=require("obsidian");Tt();js();MV();Ey();qt();Me();$_();It();Wd();q_();_y();VP();A_();QP();Ru();yl();T_();Py();ey();XV();Rm();Cte=new Set(["number","slider","checkbox"]),Y_=10,rF="js quickadd";bl=class{constructor(e){this.app=e;this.variables=new Map;this.linkToCurrentFileBehavior="required";this.targetFolderPath=null;this.promptScope="generic";this.promptScopeSoleValue=!1;this.templatePropertyCollectionDepth=0;this.namedSuggesterOptionSigs=new Map;this.namedSuggesterConflictsWarned=new Set;this.warnSink=e=>this.warn(e);this.propertyCollector=new Ma(e)}warn(e){F.logWarning(e)}reportProblem(e){F.logError(e)}setTemplateInclusionState(e){this.templateInclusion=e}setPromptRunContext(e){this.promptRunContext={...this.promptRunContext,...e}}getPromptRunContext(){return this.promptRunContext}async withPromptScope(e,t,n){let i=this.promptScope,o=this.promptScopeSoleValue;this.promptScope=e,this.promptScopeSoleValue=I_(e,t);try{return await n()}finally{this.promptScope=i,this.promptScopeSoleValue=o}}hasConcreteVariable(e){return this.variables.has(e)?this.variables.get(e)!==void 0:!1}setTitle(e){this.hasConcreteVariable("title")||this.variables.set("title",e)}getAnonymousValue(){return this.value}replacer(e,t,n){return e.replace(t,function(){return n})}replaceDateInString(e){let t=e;for(;TT.test(t);){let n=TT.exec(t),i;if(n&&n[1]){let s=n[1].replace("+","").trim();d0.test(s)&&(i=parseInt(s))}let o=n?.[2]?U0(n[2])??void 0:void 0;t=this.replacer(t,TT,Us({offset:i,snap:o}))}for(;Kf.test(t);){let n=Kf.exec(t);if(!n)throw new Error(`Unable to parse date format. Invalid syntax in: "${t.substring(Math.max(0,t.search(Kf)-10),Math.min(t.length,t.search(Kf)+30))}..."`);let i=n[1],o;if(n[2]){let a=n[2].replace("+","").trim();d0.test(a)&&(o=parseInt(a))}let s=n[3]?U0(n[3])??void 0:void 0;t=this.replacer(t,Kf,Us({format:i,offset:o,snap:s}))}return t}replaceTimeInString(e){let t=e;for(;Qf.test(t);){if(!Qf.exec(t))throw new Error(`Unable to parse time format. Invalid syntax in: "${t.substring(Math.max(0,t.search(Qf)-10),Math.min(t.length,t.search(Qf)+30))}..."`);t=this.replacer(t,Qf,Us({format:"HH:mm"}))}for(;Xf.test(t);){let n=Xf.exec(t);if(!n)throw new Error(`Unable to parse formatted time. Invalid syntax in: "${t.substring(Math.max(0,t.search(Xf)-10),Math.min(t.length,t.search(Xf)+30))}..."`);let i=n[1];t=this.replacer(t,Xf,Us({format:i}))}return t}async replaceValueInString(e){let t=e;if(!cc.test(t))return t;if(this.valuePromptContext=this.getValuePromptContext(t),this.hasConcreteVariable("value")){let i=this.variables.get("value");this.value=$u(i)}this.value===void 0&&(this.value=await this.promptForValue());let n=new RegExp(cc.source,"gi");return t=t.replace(n,(...i)=>{let o=i[0],s=i[i.length-2],a=i[i.length-1],l=o.slice(2,-2),c=l.indexOf("|");if(c===-1)return Dm(a,s,s+o.length,this.value);let u=l.slice(c),d=eF(u,{warn:this.warnSink}),f=this.value===""&&d.defaultValue&&!d.optional?d.defaultValue:this.value,p=this.applyValueTextOptions(f,d);return d.inputTypeOverride==="text"&&p!==""&&UP(a,s,s+o.length)?by(p):Dm(a,s,s+o.length,p)}),t}applyValueTextOptions(e,t){let n=String(e??""),i=t.trim?n.trim():n;return V_(i,t.caseStyle)}applyValueTokenOptions(e,t){return Array.isArray(e)?t.trim?e.map(n=>typeof n=="string"?n.trim():n):e:typeof e=="string"?this.applyValueTextOptions(e,t):e}getValuePromptContext(e){let t=new RegExp(cc.source,"gi"),n,i;for(;(n=t.exec(e))!==null;){let s=n[0].slice(2,-2),a=s.indexOf("|");if(a===-1)continue;let l=s.slice(a),c=eF(l,{warn:gy});i||(i={}),!i.description&&c.label&&(i.description=c.label),!i.defaultValue&&c.defaultValue&&(i.defaultValue=c.defaultValue),c.inputTypeOverride&&!i.inputTypeOverride&&(i.inputTypeOverride=c.inputTypeOverride),c.numericConfig&&!i.numericConfig&&(i.numericConfig=c.numericConfig),c.sliderConfig&&!i.sliderConfig&&(i.sliderConfig=c.sliderConfig),c.optional&&(i.optional=!0)}return i}async replaceSelectedInString(e){if(!h0.test(e))return e;let t=await this.getSelectedText(),n=new RegExp(h0.source,"gi");return e.replace(n,()=>t)}async replaceClipboardInString(e){if(!g0.test(e))return e;let t=await this.getClipboardContent(),n=new RegExp(g0.source,"gi");return e.replace(n,()=>t)}async replaceLinkToCurrentFileInString(e){if(!p0.test(e))return e;let t=this.getCurrentFileLink();if(!t){if(this.linkToCurrentFileBehavior==="required")throw new Error("Unable to get current file path. Make sure you have a file open in the editor.");F.logMessage("Skipping {{LINKCURRENT}} replacement because no active file is available.")}let n=new RegExp(p0.source,"gi");return e.replace(n,()=>t??"")}replaceLinkToCurrentSectionInString(e){if(!f0.test(e))return e;let t=this.getCurrentFileLinkToSection();if(!t){if(this.linkToCurrentFileBehavior==="required")throw new Error("Unable to get current file path. Make sure you have a file open in the editor.");F.logMessage("Skipping {{LINKSECTION}} replacement because no active file is available.")}let n=new RegExp(f0.source,"gi");return e.replace(n,()=>t??"")}replaceCurrentFileLinksInString(e){return this.replaceCurrentFileTokensInString(e,{links:!0})}replaceCurrentFileTokensInString(e,t){let n=/{{(?:(LINKCURRENT|LINKSECTION|FILENAMECURRENT|TITLE)|(FOLDERCURRENT|FOLDER)(\|name)?)}}/gi,i,o,s,a,l,c,u,d,f=!1,p=!1,m=!1,v=e.replace(n,(y,w,x,C)=>{if(x!==void 0&&x.toUpperCase()==="FOLDERCURRENT"){if(!t.activeFolder)return y;if(c===void 0)if(c=this.getCurrentFolderPath(),c===null)u=null;else{let _=c.lastIndexOf("/");u=_===-1?c:c.slice(_+1)}return c===null&&(m=!0),(C?u:c)??""}if(x!==void 0){if(!t.folder)return y;if(a===void 0){a=this.targetFolderPath??"";let _=a.lastIndexOf("/");l=_===-1?a:a.slice(_+1)}return C?l:a}switch((w??"").toUpperCase()){case"LINKCURRENT":return t.links?(i===void 0&&(i=this.getCurrentFileLink()??null),i||(f=!0),i??""):y;case"LINKSECTION":return t.links?(o===void 0&&(o=this.getCurrentFileLinkToSection()??null),o||(f=!0),o??""):y;case"FILENAMECURRENT":return t.fileName?(s===void 0&&(s=this.getCurrentFileName()??null),s||(p=!0),s??""):y;case"TITLE":return t.title?(d===void 0&&(d=this.getVariableValue("title")),d):y}return y}),g="Unable to get the active file's folder. Make sure you have a file open in the editor.";if(m&&t.activeFolder==="path")throw new Error(g);if(f||p||m){if(this.linkToCurrentFileBehavior==="required")throw new Error(f?"Unable to get current file path. Make sure you have a file open in the editor.":p?"Unable to get current file name. Make sure you have a file open in the editor.":g);F.logMessage("Skipping current-file token replacement because no active file is available.")}return v}async replaceCurrentFileNameInString(e){return this.replaceCurrentFileTokensInString(e,{fileName:!0})}setLinkToCurrentFileBehavior(e){this.linkToCurrentFileBehavior=e}setTargetFolderPath(e){if(e==null){this.targetFolderPath=null;return}let t=e.trim();this.targetFolderPath=t==="/"?"":t.replace(/^\/+/,"").replace(/\/+$/,"")}replaceTargetFolderInString(e){return this.replaceCurrentFileTokensInString(e,{folder:!0})}getAndClearTemplatePropertyVars(){return this.propertyCollector.drain()}mergeTemplatePropertyVars(e){this.propertyCollector.merge(e)}renderCollectedOrArrayValue(e){if(Array.isArray(e.rawValue)&&e.multiFormat){let i=AV({input:e.input,matchStart:e.matchStart,values:e.rawValue,format:e.multiFormat});if(i!==void 0)return i}let t=this.propertyCollector.maybeCollect({...e,collectionActive:this.templatePropertyCollectionDepth>0}),n=UV(t);if(n!==void 0)return n;if(Array.isArray(e.rawValue))return Dm(e.input,e.matchStart,e.matchEnd,e.rawValue.join(","))}async withTemplatePropertyCollection(e){this.templatePropertyCollectionDepth+=1;try{return await e()}finally{this.templatePropertyCollectionDepth-=1}}getCurrentFileLinkToSection(){return null}getCurrentFolderPath(){return null}warnOnNamedOptionConflict(e){if(!e.aliasName||!e.hasOptions)return;let t=e.variableKey.toLowerCase(),n=JSON.stringify([e.suggestedValues,e.allowCustomInput,e.displayValues??null,e.multiSelect,e.multiEmit]),i=this.namedSuggesterOptionSigs.get(t);if(i===void 0){this.namedSuggesterOptionSigs.set(t,n);return}i!==n&&!this.namedSuggesterConflictsWarned.has(t)&&(this.namedSuggesterConflictsWarned.add(t),this.warn(`QuickAdd: named value "${e.variableKey}" is defined with different option lists; the first definition's value is reused.`))}async ensureValueVariableResolved(e){let{variableName:t,variableKey:n,label:i,defaultValue:o,allowCustomInput:s,suggestedValues:a,displayValues:l,hasOptions:c}=e;this.warnOnNamedOptionConflict(e);let u=j_(this.variables,n);if(u)return u;let d=!c&&i?i:void 0,f=c&&i?i:void 0;if(c&&e.multiSelect){let m=await this.suggestForValueMulti(a,s,{placeholder:f,variableKey:n,displayValues:l,optional:e.optional});return this.variables.set(n,e.multiEmit==="linklist"?m.map(W_):m),n}let p="";return c?p=await this.suggestForValue(a,s,{placeholder:f,variableKey:n,displayValues:l,optional:e.optional}):p=await this.promptForVariable(t,{defaultValue:o,description:d,inputTypeOverride:e.inputTypeOverride,numericConfig:e.numericConfig,sliderConfig:e.sliderConfig,variableKey:n,optional:e.optional}),!p&&o&&!e.optional&&(p=o),this.variables.set(n,p),n}async resolveNamedSuggesterDefinitions(e){if(!/\|\s*name\s*:/i.test(e))return;let t=new RegExp(Hd.source,"gi"),n=[],i;for(;(i=t.exec(e))!==null;){if(!i[1])continue;let a;try{a=Dy(i[1],{warn:gy})}catch{return}a&&n.push({parsed:a,index:i.index})}let o=new Map;for(let{parsed:a,index:l}of n){if(a.hasOptions&&a.aliasName)continue;let c=a.variableKey.toLowerCase();o.has(c)||o.set(c,l)}let s=new Set;for(let{parsed:a,index:l}of n){if(!a.hasOptions||!a.aliasName)continue;let c=a.variableKey.toLowerCase();(o.get(c)??l)>=l||s.has(c)||(s.add(c),await this.ensureValueVariableResolved(a))}}async replaceVariableInString(e){let t=e;await this.resolveNamedSuggesterDefinitions(t);let n=new RegExp(Hd.source,"gi"),i=this.isTemplatePropertyTypesEnabled(),o;for(;(o=n.exec(t))!==null;){if(!o[1])throw new Error(`Unable to parse variable. Invalid syntax in: "${t.substring(Math.max(0,o.index-10),Math.min(t.length,o.index+30))}..."`);let s=Dy(o[1],{warn:this.warnSink});if(!s)throw new Error(`Unable to parse variable. Invalid syntax in: "${t.substring(Math.max(0,o.index-10),Math.min(t.length,o.index+30))}..."`);let{variableName:a}=s,l=await this.ensureValueVariableResolved(s),c=this.variables.get(l),u=this.applyValueTokenOptions(c,s),d=this.renderCollectedOrArrayValue({input:t,matchStart:o.index,matchEnd:o.index+o[0].length,rawValue:u,fallbackKey:a,heuristicEnabled:i&&this.templatePropertyCollectionDepth>0&&s.inputTypeOverride!=="text",multiFormat:s.multiFormat}),f,p=!1;if(d!==void 0)f=d;else{let g=String(this.applyValueTextOptions(this.getVariableValue(l),s)??"");s.inputTypeOverride==="text"&&g!==""&&UP(t,o.index,o.index+o[0].length)?f=by(g):Cte.has(s.inputTypeOverride??"")&&BP(t,o.index,o.index+o[0].length)?(p=!0,f=g):f=Dm(t,o.index,o.index+o[0].length,g)}let m=p?o.index-1:o.index,v=o.index+o[0].length+(p?1:0);t=t.slice(0,m)+f+t.slice(v),n.lastIndex=m+f.length}return t}async replaceFieldVarInString(e){let t=new RegExp(_T.source,"gi"),n="",i=0,o;for(;(o=t.exec(e))!==null;){n+=e.slice(i,o.index);let s=o[1]+(o[2]||"");if(s){let a=this.getFieldVariableKey(s),l=Yi.parse(s,{warnUnknown:!0,warn:this.warnSink});this.hasConcreteVariable(a)||this.variables.set(a,await this.suggestForField(s,l));let c=this.hasConcreteVariable(a)?this.variables.get(a):this.getVariableValue(a),u;Array.isArray(c)?u=this.renderCollectedOrArrayValue({input:e,matchStart:o.index,matchEnd:o.index+o[0].length,rawValue:c,fallbackKey:l.fieldName,heuristicEnabled:!1,multiFormat:l.multiFormat??"auto"})??c.join(","):u=Dm(e,o.index,o.index+o[0].length,String(c??"")),n+=u}else n+=o[0];i=t.lastIndex}return n+e.slice(i)}getFieldVariableKey(e){return`${jd}${e}`}async replaceFileInString(e){let t=new RegExp(AT.source,"gi"),n="",i=0,o;for(;(o=t.exec(e))!==null;){n+=e.slice(i,o.index);let s=D_(o[1]??"",{warn:this.warnSink});if(!s){n+=o[0],i=t.lastIndex;continue}let a=s.variableKey;this.hasConcreteVariable(a)||this.variables.set(a,await this.suggestForFile(s));let l=FV(this.variables.get(a),s.mode,c=>this.getFileLinkForStoredValue(c));if(Array.isArray(l)){let c=this.renderCollectedOrArrayValue({input:e,matchStart:o.index,matchEnd:o.index+o[0].length,rawValue:l,fallbackKey:s.aliasName??s.folderPath,heuristicEnabled:!1,multiFormat:s.multiFormat});n+=c??l.join(",")}else n+=l;i=t.lastIndex}return n+e.slice(i)}getFileLinkForStoredValue(e){let t=gp(e);if(t.kind==="empty")return"";if(t.kind!=="file"){let o=t.kind==="custom"?t.text:t.value;return o?`[[${o}]]`:""}let n=t.path;if(!n)return"";let i=this.app?.vault.getAbstractFileByPath(n);return i instanceof rq.TFile?this.app?.fileManager.generateMarkdownLink(i,this.getLinkSourcePath()??"")??`[[${Im(n)}]]`:`[[${Im(n)}]]`}getLinkSourcePath(){return null}async replaceMathValueInString(e){let t=new RegExp(kT.source,"gi"),n=this.variables.get("mvalue"),i=typeof n=="string"&&n.trim()?n:null,o="",s=0,a;for(;(a=t.exec(e))!==null;)o+=e.slice(s,a.index),o+=i??await this.promptForMathValue(),s=a.index+a[0].length;return o+=e.slice(s),o}async replaceMacrosInString(e){let t=e;for(;vu.test(t);){let n=vu.exec(t);if(!n)continue;if(!n[1]){t=this.replacer(t,vu,"");continue}let i=QV(n[1]);if(!i){t=this.replacer(t,vu,"");continue}let{macroName:o,label:s}=i,a=await this.getMacroValue(o,s?{label:s}:void 0);t=this.replacer(t,vu,a?a.toString():"")}return t}suggestForValueMulti(e,t,n){return[]}async replaceDateVariableInString(e){let t=new RegExp(gu.source,"gi"),n="",i=0,o;for(;(o=t.exec(e))!==null;){n+=e.slice(i,o.index),i=o.index+o[0].length;let s=o[1]?.trim();if(!s){n+=o[0];continue}let{defaultValue:a,optional:l,withTime:c,snap:u}=Iy(o[3]),d=o[2]?.trim()||My(c);if(this.variables.get(s)===void 0){let m=await this.promptForVariable(s,{type:"VDATE",dateFormat:d,defaultValue:a,optional:l,withTime:c});if(l&&!m?.trim())this.variables.set(s,"");else if(m?.startsWith("@date:"))this.variables.set(s,m);else{if(!this.dateParser)throw new Error("Date parser is not available");let v=le.getState().dateAliases,g=Bv(m,v),y=this.dateParser.parseDate(g);if(y)this.variables.set(s,`@date:${y.moment.toISOString()}`);else throw new Error(`unable to parse date variable ${m}${l?"":". Tip: add |optional inside the {{VDATE}} token to allow leaving this date empty"}`)}}let p=Ry(this.variables.get(s),d,u,this.dateParser);p?.normalized!==void 0&&this.variables.set(s,p.normalized),n+=p?.text??""}return n+e.slice(i)}async replaceTemplateInString(e){let t=e;for(;$s.test(t);){let n=$s.exec(t);if(!n||!n[1])continue;let i=n[1];if(this.templateInclusion??(this.templateInclusion={visited:new Set,depth:0}),this.templateInclusion.visited.has(i)){let s=`[QuickAdd: template inclusion cycle detected at "${i}"]`;this.reportProblem(s),t=this.replacer(t,$s,s);continue}if(this.templateInclusion.depth>=Y_){let s=`[QuickAdd: max template inclusion depth (${Y_}) exceeded at "${i}"]`;this.reportProblem(s),t=this.replacer(t,$s,s);continue}this.templateInclusion.visited.add(i);let o;try{o=await this.getTemplateContent(i)}finally{this.templateInclusion.visited.delete(i)}t=this.replacer(t,$s,o)}return t}replaceLinebreakInString(e){let t="";for(let n=0;n<e.length;n++){let i=e[n],o=e[n+1];i=="\\"?o=="n"?(t+=`
|
||
`,n++):o=="\\"?(t+="\\",n++):t+="\\":t+=i}return t}expandLinebreakEscapesOutsideTokens(e){let t=Fy(e),n="",i=0,o=0;for(;i<e.length;){for(;o<t.length&&t[o].end<=i;)o++;let s=t[o];if(s&&s.start===i){n+=e.slice(s.start,s.end),i=s.end;continue}if(e[i]==="{"&&e[i+1]==="{"){let c=e.indexOf("}}",i+2),u=!1;if(c!==-1){let d=c+2;for(let f=o;f<t.length;f++){let p=t[f];if(p.start>=d)break;if(d<p.end&&d>p.start){u=!0;break}}}if(c!==-1&&!u){n+=e.slice(i,c+2),i=c+2;continue}}let a=e[i],l=e[i+1];a==="\\"?l==="n"?(n+=`
|
||
`,i+=2):l==="\\"?(n+="\\",i+=2):(n+="\\",i+=1):(n+=a,i+=1)}return n}replaceRandomInString(e){let t=e;for(;v0.test(t);){let n=v0.exec(t);if(!n||!n[1])continue;let i=parseInt(n[1]);if(i<=0||i>100)throw new Error(`Random string length must be between 1 and 100. Got: ${i}`);let o="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",s="";for(let a=0;a<i;a++)s+=o.charAt(Math.floor(Math.random()*o.length));t=t.replace(n[0],s)}return t}replaceTitleInString(e){return this.replaceCurrentFileTokensInString(e,{title:!0})}}});var G,Oe,ls,pt=b(()=>{(function(r){r[r.AM=0]="AM",r[r.PM=1]="PM"})(G||(G={}));(function(r){r[r.SUNDAY=0]="SUNDAY",r[r.MONDAY=1]="MONDAY",r[r.TUESDAY=2]="TUESDAY",r[r.WEDNESDAY=3]="WEDNESDAY",r[r.THURSDAY=4]="THURSDAY",r[r.FRIDAY=5]="FRIDAY",r[r.SATURDAY=6]="SATURDAY"})(Oe||(Oe={}));(function(r){r[r.JANUARY=1]="JANUARY",r[r.FEBRUARY=2]="FEBRUARY",r[r.MARCH=3]="MARCH",r[r.APRIL=4]="APRIL",r[r.MAY=5]="MAY",r[r.JUNE=6]="JUNE",r[r.JULY=7]="JULY",r[r.AUGUST=8]="AUGUST",r[r.SEPTEMBER=9]="SEPTEMBER",r[r.OCTOBER=10]="OCTOBER",r[r.NOVEMBER=11]="NOVEMBER",r[r.DECEMBER=12]="DECEMBER"})(ls||(ls={}))});function nt(r,e){r.assign("day",e.getDate()),r.assign("month",e.getMonth()+1),r.assign("year",e.getFullYear())}function K_(r,e){r.assign("hour",e.getHours()),r.assign("minute",e.getMinutes()),r.assign("second",e.getSeconds()),r.assign("millisecond",e.getMilliseconds()),r.assign("meridiem",e.getHours()<12?G.AM:G.PM)}function Tc(r,e){r.imply("day",e.getDate()),r.imply("month",e.getMonth()+1),r.imply("year",e.getFullYear())}function Lt(r,e){r.imply("hour",e.getHours()),r.imply("minute",e.getMinutes()),r.imply("second",e.getSeconds()),r.imply("millisecond",e.getMilliseconds()),r.imply("meridiem",e.getHours()<12?G.AM:G.PM)}var on=b(()=>{pt()});function Lu(r,e,t,n,i=0){let o=0,s=0;for(;s<n;)o++,new Date(r,e-1,o).getDay()===t&&s++;return new Date(r,e-1,o,i)}function oq(r,e,t,n=0){let i=t===0?7:t,o=new Date(r,e-1+1,1,12),s=o.getDay()===0?7:o.getDay(),a;return s===i?a=7:s<i?a=7+s-i:a=s-i,o.setDate(o.getDate()-a),new Date(r,e-1,o.getDate(),n)}function Q_(r,e,t={}){if(r==null)return null;if(typeof r=="number")return r;let n=t[r]??Tte[r];return n==null?null:typeof n=="number"?n:e==null?null:e>n.dstStart(e.getFullYear())&&!(e>n.dstEnd(e.getFullYear()))?n.timezoneOffsetDuringDst:n.timezoneOffsetNonDst}var Tte,nF=b(()=>{pt();Tte={ACDT:630,ACST:570,ADT:-180,AEDT:660,AEST:600,AFT:270,AKDT:-480,AKST:-540,ALMT:360,AMST:-180,AMT:-240,ANAST:720,ANAT:720,AQTT:300,ART:-180,AST:-240,AWDT:540,AWST:480,AZOST:0,AZOT:-60,AZST:300,AZT:240,BNT:480,BOT:-240,BRST:-120,BRT:-180,BST:60,BTT:360,CAST:480,CAT:120,CCT:390,CDT:-300,CEST:120,CET:{timezoneOffsetDuringDst:120,timezoneOffsetNonDst:60,dstStart:r=>oq(r,ls.MARCH,Oe.SUNDAY,2),dstEnd:r=>oq(r,ls.OCTOBER,Oe.SUNDAY,3)},CHADT:825,CHAST:765,CKT:-600,CLST:-180,CLT:-240,COT:-300,CST:-360,CT:{timezoneOffsetDuringDst:-300,timezoneOffsetNonDst:-360,dstStart:r=>Lu(r,ls.MARCH,Oe.SUNDAY,2,2),dstEnd:r=>Lu(r,ls.NOVEMBER,Oe.SUNDAY,1,2)},CVT:-60,CXT:420,ChST:600,DAVT:420,EASST:-300,EAST:-360,EAT:180,ECT:-300,EDT:-240,EEST:180,EET:120,EGST:0,EGT:-60,EST:-300,ET:{timezoneOffsetDuringDst:-240,timezoneOffsetNonDst:-300,dstStart:r=>Lu(r,ls.MARCH,Oe.SUNDAY,2,2),dstEnd:r=>Lu(r,ls.NOVEMBER,Oe.SUNDAY,1,2)},FJST:780,FJT:720,FKST:-180,FKT:-240,FNT:-120,GALT:-360,GAMT:-540,GET:240,GFT:-180,GILT:720,GMT:0,GST:240,GYT:-240,HAA:-180,HAC:-300,HADT:-540,HAE:-240,HAP:-420,HAR:-360,HAST:-600,HAT:-90,HAY:-480,HKT:480,HLV:-210,HNA:-240,HNC:-360,HNE:-300,HNP:-480,HNR:-420,HNT:-150,HNY:-540,HOVT:420,ICT:420,IDT:180,IOT:360,IRDT:270,IRKST:540,IRKT:540,IRST:210,IST:330,JST:540,KGT:360,KRAST:480,KRAT:480,KST:540,KUYT:240,LHDT:660,LHST:630,LINT:840,MAGST:720,MAGT:720,MART:-510,MAWT:300,MDT:-360,MESZ:120,MEZ:60,MHT:720,MMT:390,MSD:240,MSK:180,MST:-420,MT:{timezoneOffsetDuringDst:-360,timezoneOffsetNonDst:-420,dstStart:r=>Lu(r,ls.MARCH,Oe.SUNDAY,2,2),dstEnd:r=>Lu(r,ls.NOVEMBER,Oe.SUNDAY,1,2)},MUT:240,MVT:300,MYT:480,NCT:660,NDT:-90,NFT:690,NOVST:420,NOVT:360,NPT:345,NST:-150,NUT:-660,NZDT:780,NZST:720,OMSST:420,OMST:420,PDT:-420,PET:-300,PETST:720,PETT:720,PGT:600,PHOT:780,PHT:480,PKT:300,PMDT:-120,PMST:-180,PONT:660,PST:-480,PT:{timezoneOffsetDuringDst:-420,timezoneOffsetNonDst:-480,dstStart:r=>Lu(r,ls.MARCH,Oe.SUNDAY,2,2),dstEnd:r=>Lu(r,ls.NOVEMBER,Oe.SUNDAY,1,2)},PWT:540,PYST:-180,PYT:-240,RET:240,SAMT:240,SAST:120,SBT:660,SCT:240,SGT:480,SRT:-180,SST:-660,TAHT:-600,TFT:300,TJT:300,TKT:780,TLT:540,TMT:300,TVT:720,ULAT:480,UTC:0,UYST:-120,UYT:-180,UZT:300,VET:-210,VLAST:660,VLAT:660,VUT:660,WAST:120,WAT:60,WEST:60,WESZ:60,WET:0,WEZ:0,WFT:720,WGST:-120,WGT:-180,WIB:420,WIT:540,WITA:480,WST:780,WT:0,YAKST:600,YAKT:600,YAPT:600,YEKST:360,YEKT:360}});function vt(r,e){let t=new Date(r);if(e.y&&(e.year=e.y,delete e.y),e.mo&&(e.month=e.mo,delete e.mo),e.M&&(e.month=e.M,delete e.M),e.w&&(e.week=e.w,delete e.w),e.d&&(e.day=e.d,delete e.d),e.h&&(e.hour=e.h,delete e.h),e.m&&(e.minute=e.m,delete e.m),e.s&&(e.second=e.s,delete e.s),e.ms&&(e.millisecond=e.ms,delete e.ms),"year"in e){let n=Math.floor(e.year);t.setFullYear(t.getFullYear()+n);let i=e.year-n;i>0&&(e.month=e?.month??0,e.month+=i*12)}if("quarter"in e){let n=Math.floor(e.quarter);t.setMonth(t.getMonth()+n*3)}if("month"in e){let n=Math.floor(e.month);t.setMonth(t.getMonth()+n);let i=e.month-n;i>0&&(e.week=e?.week??0,e.week+=i*4)}if("week"in e){let n=Math.floor(e.week);t.setDate(t.getDate()+n*7);let i=e.week-n;i>0&&(e.day=e?.day??0,e.day+=Math.round(i*7))}if("day"in e){let n=Math.floor(e.day);t.setDate(t.getDate()+n);let i=e.day-n;i>0&&(e.hour=e?.hour??0,e.hour+=Math.round(i*24))}if("hour"in e){let n=Math.floor(e.hour);t.setHours(t.getHours()+n);let i=e.hour-n;i>0&&(e.minute=e?.minute??0,e.minute+=Math.round(i*60))}if("minute"in e){let n=Math.floor(e.minute);t.setMinutes(t.getMinutes()+n);let i=e.minute-n;i>0&&(e.second=e?.second??0,e.second+=Math.round(i*60))}if("second"in e){let n=Math.floor(e.second);t.setSeconds(t.getSeconds()+n);let i=e.second-n;i>0&&(e.millisecond=e?.millisecond??0,e.millisecond+=Math.round(i*1e3))}if("millisecond"in e){let n=Math.floor(e.millisecond);t.setMilliseconds(t.getMilliseconds()+n)}return t}function tt(r){let e={};for(let t in r)e[t]=-r[t];return e}var sq,Bt=b(()=>{sq={day:0,second:0,millisecond:0}});var ct,X,at,Le=b(()=>{on();nF();Bt();ct=class r{constructor(e,t){ae(this,"instant");ae(this,"timezoneOffset");this.instant=e??new Date,this.timezoneOffset=t??null}static fromDate(e){return new r(e)}static fromInput(e,t){if(e instanceof Date)return r.fromDate(e);let n=e?.instant??new Date,i=Q_(e?.timezone,n,t);return new r(n,i)}getDateWithAdjustedTimezone(){let e=new Date(this.instant);return this.timezoneOffset!==null&&e.setMinutes(e.getMinutes()-this.getSystemTimezoneAdjustmentMinute(this.instant)),e}getSystemTimezoneAdjustmentMinute(e,t){e||(e=new Date);let n=-e.getTimezoneOffset(),i=t??this.timezoneOffset??n;return n-i}getTimezoneOffset(){return this.timezoneOffset??-this.instant.getTimezoneOffset()}},X=class r{constructor(e,t){ae(this,"knownValues");ae(this,"impliedValues");ae(this,"reference");ae(this,"_tags",new Set);if(this.reference=e,this.knownValues={},this.impliedValues={},t)for(let i in t)this.knownValues[i]=t[i];let n=e.getDateWithAdjustedTimezone();this.imply("day",n.getDate()),this.imply("month",n.getMonth()+1),this.imply("year",n.getFullYear()),this.imply("hour",12),this.imply("minute",0),this.imply("second",0),this.imply("millisecond",0)}static createRelativeFromReference(e,t=sq){let n=vt(e.getDateWithAdjustedTimezone(),t),i=new r(e);return i.addTag("result/relativeDate"),"hour"in t||"minute"in t||"second"in t||"millisecond"in t?(i.addTag("result/relativeDateAndTime"),K_(i,n),nt(i,n),i.assign("timezoneOffset",e.getTimezoneOffset())):(Lt(i,n),i.imply("timezoneOffset",e.getTimezoneOffset()),"day"in t?(i.assign("day",n.getDate()),i.assign("month",n.getMonth()+1),i.assign("year",n.getFullYear()),i.assign("weekday",n.getDay())):"week"in t?(i.assign("day",n.getDate()),i.assign("month",n.getMonth()+1),i.assign("year",n.getFullYear()),i.imply("weekday",n.getDay())):(i.imply("day",n.getDate()),"month"in t?(i.assign("month",n.getMonth()+1),i.assign("year",n.getFullYear())):(i.imply("month",n.getMonth()+1),"year"in t?i.assign("year",n.getFullYear()):i.imply("year",n.getFullYear())))),i}get(e){return e in this.knownValues?this.knownValues[e]:e in this.impliedValues?this.impliedValues[e]:null}isCertain(e){return e in this.knownValues}getCertainComponents(){return Object.keys(this.knownValues)}imply(e,t){return e in this.knownValues?this:(this.impliedValues[e]=t,this)}assign(e,t){return this.knownValues[e]=t,delete this.impliedValues[e],this}addDurationAsImplied(e){let t=this.dateWithoutTimezoneAdjustment(),n=vt(t,e);return("day"in e||"week"in e||"month"in e||"year"in e)&&(this.delete(["day","weekday","month","year"]),this.imply("day",n.getDate()),this.imply("weekday",n.getDay()),this.imply("month",n.getMonth()+1),this.imply("year",n.getFullYear())),("second"in e||"minute"in e||"hour"in e)&&(this.delete(["second","minute","hour"]),this.imply("second",n.getSeconds()),this.imply("minute",n.getMinutes()),this.imply("hour",n.getHours())),this}delete(e){typeof e=="string"&&(e=[e]);for(let t of e)delete this.knownValues[t],delete this.impliedValues[t]}clone(){let e=new r(this.reference);e.knownValues={},e.impliedValues={};for(let t in this.knownValues)e.knownValues[t]=this.knownValues[t];for(let t in this.impliedValues)e.impliedValues[t]=this.impliedValues[t];return e}isOnlyDate(){return!this.isCertain("hour")&&!this.isCertain("minute")&&!this.isCertain("second")}isOnlyTime(){return!this.isCertain("weekday")&&!this.isCertain("day")&&!this.isCertain("month")&&!this.isCertain("year")}isOnlyWeekdayComponent(){return this.isCertain("weekday")&&!this.isCertain("day")&&!this.isCertain("month")}isDateWithUnknownYear(){return this.isCertain("month")&&!this.isCertain("year")}isValidDate(){let e=new Date(Date.UTC(this.get("year"),this.get("month")-1,this.get("day"),this.get("hour"),this.get("minute"),this.get("second"),this.get("millisecond")));return e.setUTCFullYear(this.get("year")),!(e.getUTCFullYear()!==this.get("year")||e.getUTCMonth()!==this.get("month")-1||e.getUTCDate()!==this.get("day")||this.get("hour")!=null&&e.getUTCHours()!=this.get("hour")||this.get("minute")!=null&&e.getUTCMinutes()!=this.get("minute"))}toString(){return`[ParsingComponents {
|
||
tags: ${JSON.stringify(Array.from(this._tags).sort())},
|
||
knownValues: ${JSON.stringify(this.knownValues)},
|
||
impliedValues: ${JSON.stringify(this.impliedValues)}},
|
||
reference: ${JSON.stringify(this.reference)}]`}date(){let e=this.get("timezoneOffset")??this.reference.timezoneOffset;if(e==null)return this.dateWithoutTimezoneAdjustment();let t=new Date(Date.UTC(this.get("year"),this.get("month")-1,this.get("day"),this.get("hour"),this.get("minute"),this.get("second"),this.get("millisecond")));return t.setUTCFullYear(this.get("year")),new Date(t.getTime()-e*6e4)}addTag(e){return this._tags.add(e),this}addTags(e){for(let t of e)this._tags.add(t);return this}tags(){return new Set(this._tags)}dateWithoutTimezoneAdjustment(){let e=new Date(this.get("year"),this.get("month")-1,this.get("day"),this.get("hour"),this.get("minute"),this.get("second"),this.get("millisecond"));return e.setFullYear(this.get("year")),e}},at=class r{constructor(e,t,n,i,o){ae(this,"refDate");ae(this,"index");ae(this,"text");ae(this,"reference");ae(this,"start");ae(this,"end");this.reference=e,this.refDate=e.instant,this.index=t,this.text=n,this.start=i||new X(e),this.end=o}clone(){let e=new r(this.reference,this.index,this.text);return e.start=this.start?this.start.clone():null,e.end=this.end?this.end.clone():null,e}date(){return this.start.date()}addTag(e){return this.start.addTag(e),this.end&&this.end.addTag(e),this}addTags(e){return this.start.addTags(e),this.end&&this.end.addTags(e),this}tags(){let e=new Set(this.start.tags());if(this.end)for(let t of this.end.tags())e.add(t);return e}toString(){let e=Array.from(this.tags()).sort();return`[ParsingResult {index: ${this.index}, text: '${this.text}', tags: ${JSON.stringify(e)} ...}]`}}});function Er(r,e,t="\\s{0,5},?\\s{0,5}"){let n=e.replace(/\((?!\?)/g,"(?:");return`${r}${n}(?:${t}${n}){0,10}`}function _te(r){let e;return r instanceof Array?e=[...r]:r instanceof Map?e=Array.from(r.keys()):e=Object.keys(r),e}function ee(r){return`(?:${_te(r).sort((t,n)=>n.length-t.length).join("|").replace(/\./g,"\\.")})`}var ze=b(()=>{});function Gr(r){return r<100&&(r>50?r=r+1900:r=r+2e3),r}function ft(r,e,t){let n=new Date(r);n.setMonth(t-1),n.setDate(e);let i=vt(n,{year:1}),o=vt(n,{year:-1});return Math.abs(i.getTime()-r.getTime())<Math.abs(n.getTime()-r.getTime())?n=i:Math.abs(o.getTime()-r.getTime())<Math.abs(n.getTime()-r.getTime())&&(n=o),n.getFullYear()}var zt=b(()=>{Bt()});function Ate(r){let e=r.toLowerCase();return iF[e]!==void 0?iF[e]:e==="a"||e==="an"||e=="the"?1:e.match(/few/)?3:e.match(/half/)?.5:e.match(/couple/)?2:e.match(/several/)?7:parseFloat(e)}function Lm(r){let e=r.toLowerCase();return oF[e]!==void 0?oF[e]:(e=e.replace(/(?:st|nd|rd|th)$/i,""),parseInt(e))}function wl(r){if(/BE/i.test(r))return r=r.replace(/BE/i,""),parseInt(r)-543;if(/BCE?/i.test(r))return r=r.replace(/BCE?/i,""),-parseInt(r);if(/(AD|CE)/i.test(r))return r=r.replace(/(AD|CE)/i,""),parseInt(r);let e=parseInt(r);return Gr(e)}function Gs(r){let e={},t=r,n=aq.exec(t);for(;n;)Ste(e,n),t=t.substring(n[0].length).trim(),n=aq.exec(t);return Object.keys(e).length==0?null:e}function Ste(r,e){if(e[0].match(/^[a-zA-Z]+$/))return;let t=Ate(e[1]),n=$y[e[2].toLowerCase()];r[n]=t}var X_,sF,go,iF,oF,lq,$y,cq,Nm,Bu,uq,aq,kte,dq,_c,Uu,sn=b(()=>{ze();zt();X_={sunday:0,sun:0,"sun.":0,monday:1,mon:1,"mon.":1,tuesday:2,tue:2,"tue.":2,wednesday:3,wed:3,"wed.":3,thursday:4,thurs:4,"thurs.":4,thur:4,"thur.":4,thu:4,"thu.":4,friday:5,fri:5,"fri.":5,saturday:6,sat:6,"sat.":6},sF={january:1,february:2,march:3,april:4,may:5,june:6,july:7,august:8,september:9,october:10,november:11,december:12},go={...sF,jan:1,"jan.":1,feb:2,"feb.":2,mar:3,"mar.":3,apr:4,"apr.":4,jun:6,"jun.":6,jul:7,"jul.":7,aug:8,"aug.":8,sep:9,"sep.":9,sept:9,"sept.":9,oct:10,"oct.":10,nov:11,"nov.":11,dec:12,"dec.":12},iF={one:1,two:2,three:3,four:4,five:5,six:6,seven:7,eight:8,nine:9,ten:10,eleven:11,twelve:12},oF={first:1,second:2,third:3,fourth:4,fifth:5,sixth:6,seventh:7,eighth:8,ninth:9,tenth:10,eleventh:11,twelfth:12,thirteenth:13,fourteenth:14,fifteenth:15,sixteenth:16,seventeenth:17,eighteenth:18,nineteenth:19,twentieth:20,"twenty first":21,"twenty-first":21,"twenty second":22,"twenty-second":22,"twenty third":23,"twenty-third":23,"twenty fourth":24,"twenty-fourth":24,"twenty fifth":25,"twenty-fifth":25,"twenty sixth":26,"twenty-sixth":26,"twenty seventh":27,"twenty-seventh":27,"twenty eighth":28,"twenty-eighth":28,"twenty ninth":29,"twenty-ninth":29,thirtieth:30,"thirty first":31,"thirty-first":31},lq={second:"second",seconds:"second",minute:"minute",minutes:"minute",hour:"hour",hours:"hour",day:"day",days:"day",week:"week",weeks:"week",month:"month",months:"month",quarter:"quarter",quarters:"quarter",year:"year",years:"year"},$y={s:"second",sec:"second",second:"second",seconds:"second",m:"minute",min:"minute",mins:"minute",minute:"minute",minutes:"minute",h:"hour",hr:"hour",hrs:"hour",hour:"hour",hours:"hour",d:"day",day:"day",days:"day",w:"week",week:"week",weeks:"week",mo:"month",mon:"month",mos:"month",month:"month",months:"month",qtr:"quarter",quarter:"quarter",quarters:"quarter",y:"year",yr:"year",year:"year",years:"year",...lq},cq=`(?:${ee(iF)}|[0-9]+|[0-9]+\\.[0-9]+|half(?:\\s{0,2}an?)?|an?\\b(?:\\s{0,2}few)?|few|several|the|a?\\s{0,2}couple\\s{0,2}(?:of)?)`;Nm=`(?:${ee(oF)}|[0-9]{1,2}(?:st|nd|rd|th)?)`;Bu="(?:[1-9][0-9]{0,3}\\s{0,2}(?:BE|AD|BC|BCE|CE)|[1-9][0-9]{3}|[0-9]{2}(?!\\w|:\\d|\\s+(?:am|pm|o\\s*clock|jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)))";uq=`(${cq})\\s{0,3}(${ee($y)})`,aq=new RegExp(uq,"i"),kte=`(${cq})\\s{0,3}(${ee(lq)})`,dq="\\s{0,5},?(?:\\s*and)?\\s{0,5}",_c=Er("(?:(?:about|around)\\s{0,3})?",uq,dq),Uu=Er("(?:(?:about|around)\\s{0,3})?",kte,dq)});var U,fe=b(()=>{U=class{constructor(){ae(this,"cachedInnerPattern",null);ae(this,"cachedPattern",null)}innerPatternHasChange(e,t){return this.innerPattern(e)!==t}patternLeftBoundary(){return"(\\W|^)"}pattern(e){return this.cachedInnerPattern&&!this.innerPatternHasChange(e,this.cachedInnerPattern)?this.cachedPattern:(this.cachedInnerPattern=this.innerPattern(e),this.cachedPattern=new RegExp(`${this.patternLeftBoundary()}${this.cachedInnerPattern.source}`,this.cachedInnerPattern.flags),this.cachedPattern)}extract(e,t){let n=t[1]??"";t.index=t.index+n.length,t[0]=t[0].substring(n.length);for(let i=2;i<t.length;i++)t[i-1]=t[i];return this.innerExtract(e,t)}}});var Dte,Ite,Pte,Oy,pq=b(()=>{sn();Le();fe();Dte=new RegExp(`(?:(?:within|in|for)\\s*)?(?:(?:about|around|roughly|approximately|just)\\s*(?:~\\s*)?)?(${_c})(?=\\W|$)`,"i"),Ite=new RegExp(`(?:within|in|for)\\s*(?:(?:about|around|roughly|approximately|just)\\s*(?:~\\s*)?)?(${_c})(?=\\W|$)`,"i"),Pte=new RegExp(`(?:within|in|for)\\s*(?:(?:about|around|roughly|approximately|just)\\s*(?:~\\s*)?)?(${Uu})(?=\\W|$)`,"i"),Oy=class extends U{constructor(t){super();ae(this,"strictMode");this.strictMode=t}innerPattern(t){return this.strictMode?Pte:t.option.forwardDate?Dte:Ite}innerExtract(t,n){if(n[0].match(/^for\s*the\s*\w+/))return null;let i=Gs(n[1]);return i?X.createRelativeFromReference(t.reference,i):null}}});var Fte,fq,mq,Mte,hq,Ny,gq=b(()=>{zt();sn();sn();sn();ze();fe();Fte=new RegExp(`(?:on\\s{0,3})?(${Nm})(?:\\s{0,3}(?:to|\\-|\\\u2013|until|through|till)\\s{0,3}(${Nm}))?(?:-|/|\\s{0,3}(?:of)?\\s{0,3})(${ee(go)})(?:(?:-|/|,?\\s{0,3})(${Bu}(?!\\w)))?(?=\\W|$)`,"i"),fq=1,mq=2,Mte=3,hq=4,Ny=class extends U{innerPattern(){return Fte}innerExtract(e,t){let n=e.createParsingResult(t.index,t[0]),i=go[t[Mte].toLowerCase()],o=Lm(t[fq]);if(o>31)return t.index=t.index+t[fq].length,null;if(n.start.assign("month",i),n.start.assign("day",o),t[hq]){let s=wl(t[hq]);n.start.assign("year",s)}else{let s=ft(e.refDate,o,i);n.start.imply("year",s)}if(t[mq]){let s=Lm(t[mq]);n.end=n.start.clone(),n.end.assign("day",s)}return n}}});var Rte,$te,vq,aF,lF,Ly,yq=b(()=>{zt();sn();sn();sn();ze();fe();Rte=new RegExp(`(${ee(go)})(?:-|/|\\s*,?\\s*)(${Nm})(?!\\s*(?:am|pm))\\s*(?:(?:to|\\-)\\s*(${Nm})\\s*)?(?:(?:-|/|\\s*,\\s*|\\s+)(${Bu}))?(?=\\W|$)(?!\\:\\d)`,"i"),$te=1,vq=2,aF=3,lF=4,Ly=class extends U{constructor(t){super();ae(this,"shouldSkipYearLikeDate");this.shouldSkipYearLikeDate=t}innerPattern(){return Rte}innerExtract(t,n){let i=go[n[$te].toLowerCase()],o=Lm(n[vq]);if(o>31||this.shouldSkipYearLikeDate&&!n[aF]&&!n[lF]&&n[vq].match(/^\d{2}$/))return null;let s=t.createParsingComponents({day:o,month:i}).addTag("parser/ENMonthNameMiddleEndianParser");if(n[lF]){let c=wl(n[lF]);s.assign("year",c)}else{let c=ft(t.refDate,o,i);s.imply("year",c)}if(!n[aF])return s;let a=Lm(n[aF]),l=t.createParsingResult(n.index,n[0]);return l.start=s,l.end=s.clone(),l.end.assign("day",a),l}}});var Ote,Nte,Lte,bq,By,wq=b(()=>{sn();zt();ze();sn();fe();Ote=new RegExp(`((?:in)\\s*)?(${ee(go)})\\s*(?:(?:,|-|of)?\\s*(${Bu})?)?(?=[^\\s\\w]|\\s+[^0-9]|\\s+$|$)`,"i"),Nte=1,Lte=2,bq=3,By=class extends U{innerPattern(){return Ote}innerExtract(e,t){let n=t[Lte].toLowerCase();if(t[0].length<=3&&!sF[n])return null;let i=e.createParsingResult(t.index+(t[Nte]||"").length,t.index+t[0].length);i.start.imply("day",1),i.start.addTag("parser/ENMonthNameParser");let o=go[n];if(i.start.assign("month",o),t[bq]){let s=wl(t[bq]);i.start.assign("year",s)}else{let s=ft(e.refDate,1,o);i.start.imply("year",s)}return i}}});var Bte,Ute,Vte,Cq,qte,Uy,xq=b(()=>{sn();ze();fe();Bte=new RegExp(`([0-9]{4})[-\\.\\/\\s](?:(${ee(go)})|([0-9]{1,2}))[-\\.\\/\\s]([0-9]{1,2})(?=\\W|$)`,"i"),Ute=1,Vte=2,Cq=3,qte=4,Uy=class extends U{constructor(t){super();ae(this,"strictMonthDateOrder");this.strictMonthDateOrder=t}innerPattern(){return Bte}innerExtract(t,n){let i=parseInt(n[Ute]),o=parseInt(n[qte]),s=n[Cq]?parseInt(n[Cq]):go[n[Vte].toLowerCase()];if(s<1||s>12){if(this.strictMonthDateOrder)return null;o>=1&&o<=12&&([s,o]=[o,s])}return o<1||o>31?null:{day:o,month:s,year:i}}}});var Wte,zte,Hte,jte,Vy,Eq=b(()=>{sn();ze();sn();fe();Wte="(?:[1-9][0-9]{0,3}\\s{0,2}(?:BE|AD|BC|BCE|CE)|[1-9][0-9]{3})",zte=new RegExp(`(${Wte})(?:\\s*[-.\\/,]?\\s*|\\s+of\\s+)(${ee(go)})(?=[^\\s\\w]|\\s+[^0-9]|\\s+$|$)`,"i"),Hte=1,jte=2,Vy=class extends U{innerPattern(){return zte}innerExtract(e,t){let n=wl(t[Hte]),i=t[jte].toLowerCase(),o=go[i],s=e.createParsingResult(t.index,t[0]);return s.start.imply("day",1),s.start.assign("month",o),s.start.assign("year",n),s.start.addTag("parser/ENYearMonthNameParser"),s}}});var Gte,Yte,Kte,qy,Tq=b(()=>{fe();Gte=new RegExp("([0-9]|0[1-9]|1[012])/([0-9]{4})","i"),Yte=1,Kte=2,qy=class extends U{innerPattern(){return Gte}innerExtract(e,t){let n=parseInt(t[Kte]),i=parseInt(t[Yte]);return e.createParsingComponents().imply("day",1).assign("month",i).assign("year",n)}}});function Qte(r,e,t,n){return new RegExp(`${r}${e}(\\d{1,4})(?:(?:\\.|:|\uFF1A)(\\d{1,2})(?:(?::|\uFF1A)(\\d{2})(?:\\.(\\d{1,6}))?)?)?(?:\\s*(a\\.m\\.|p\\.m\\.|am?|pm?))?${t}`,n)}function Xte(r,e){return new RegExp(`^(${r})(\\d{1,4})(?:(?:\\.|\\:|\\\uFF1A)(\\d{1,2})(?:(?:\\.|\\:|\\\uFF1A)(\\d{1,2})(?:\\.(\\d{1,6}))?)?)?(?:\\s*(a\\.m\\.|p\\.m\\.|am?|pm?))?${e}`,"i")}var cF,vp,Z_,J_,Bm,Yr,$a=b(()=>{pt();cF=2,vp=3,Z_=4,J_=5,Bm=6,Yr=class{constructor(e=!1){ae(this,"strictMode");ae(this,"cachedPrimaryPrefix",null);ae(this,"cachedPrimarySuffix",null);ae(this,"cachedPrimaryTimePattern",null);ae(this,"cachedFollowingPhase",null);ae(this,"cachedFollowingSuffix",null);ae(this,"cachedFollowingTimePatten",null);this.strictMode=e}patternFlags(){return"i"}primaryPatternLeftBoundary(){return"(^|\\s|T|\\b)"}primarySuffix(){return"(?!/)(?=\\W|$)"}followingSuffix(){return"(?!/)(?=\\W|$)"}pattern(e){return this.getPrimaryTimePatternThroughCache()}extract(e,t){let n=this.extractPrimaryTimeComponents(e,t);if(!n)return t[0].match(/^\d{4}/)?(t.index+=4,null):(t.index+=t[0].length,null);let i=t.index+t[1].length,o=t[0].substring(t[1].length),s=e.createParsingResult(i,o,n);t.index+=t[0].length;let a=e.text.substring(t.index),c=this.getFollowingTimePatternThroughCache().exec(a);return o.match(/^\d{3,4}/)&&c&&(c[0].match(/^\s*([+-])\s*\d{2,4}$/)||c[0].match(/^\s*([+-])\s*\d{2}\W\d{2}/))?null:!c||c[0].match(/^\s*([+-])\s*\d{3,4}$/)?this.checkAndReturnWithoutFollowingPattern(s):(s.end=this.extractFollowingTimeComponents(e,c,s),s.end&&(s.text+=c[0]),this.checkAndReturnWithFollowingPattern(s))}extractPrimaryTimeComponents(e,t,n=!1){let i=e.createParsingComponents(),o=0,s=null,a=parseInt(t[cF]);if(a>100){if(t[cF].length==4&&t[vp]==null&&!t[Bm]||this.strictMode||t[vp]!=null)return null;o=a%100,a=Math.floor(a/100)}if(a>24)return null;if(t[vp]!=null){if(t[vp].length==1&&!t[Bm])return null;o=parseInt(t[vp])}if(o>=60)return null;if(a>12&&(s=G.PM),t[Bm]!=null){if(a>12)return null;let l=t[Bm][0].toLowerCase();l=="a"&&(s=G.AM,a==12&&(a=0)),l=="p"&&(s=G.PM,a!=12&&(a+=12))}if(i.assign("hour",a),i.assign("minute",o),s!==null?i.assign("meridiem",s):a<12?i.imply("meridiem",G.AM):i.imply("meridiem",G.PM),t[J_]!=null){let l=parseInt(t[J_].substring(0,3));if(l>=1e3)return null;i.assign("millisecond",l)}if(t[Z_]!=null){let l=parseInt(t[Z_]);if(l>=60)return null;i.assign("second",l)}return i}extractFollowingTimeComponents(e,t,n){let i=e.createParsingComponents();if(t[J_]!=null){let l=parseInt(t[J_].substring(0,3));if(l>=1e3)return null;i.assign("millisecond",l)}if(t[Z_]!=null){let l=parseInt(t[Z_]);if(l>=60)return null;i.assign("second",l)}let o=parseInt(t[cF]),s=0,a=-1;if(t[vp]!=null?s=parseInt(t[vp]):o>100&&(s=o%100,o=Math.floor(o/100)),s>=60||o>24)return null;if(o>=12&&(a=G.PM),t[Bm]!=null){if(o>12)return null;let l=t[Bm][0].toLowerCase();l=="a"&&(a=G.AM,o==12&&(o=0,i.isCertain("day")||i.imply("day",i.get("day")+1))),l=="p"&&(a=G.PM,o!=12&&(o+=12)),n.start.isCertain("meridiem")||(a==G.AM?(n.start.imply("meridiem",G.AM),n.start.get("hour")==12&&n.start.assign("hour",0)):(n.start.imply("meridiem",G.PM),n.start.get("hour")!=12&&n.start.assign("hour",n.start.get("hour")+12)))}return i.assign("hour",o),i.assign("minute",s),a>=0?i.assign("meridiem",a):n.start.isCertain("meridiem")&&n.start.get("hour")>12?n.start.get("hour")-12>o?i.imply("meridiem",G.AM):o<=12&&(i.assign("hour",o+12),i.assign("meridiem",G.PM)):o>12?i.imply("meridiem",G.PM):o<=12&&i.imply("meridiem",G.AM),i.date().getTime()<n.start.date().getTime()&&i.imply("day",i.get("day")+1),i}checkAndReturnWithoutFollowingPattern(e){if(e.text.match(/^\d$/)||e.text.match(/^\d\d\d+$/)||e.text.match(/\d[apAP]$/))return null;let t=e.text.match(/[^\d:.](\d[\d.]+)$/);if(t){let n=t[1];if(this.strictMode||n.includes(".")&&!n.match(/\d(\.\d{2})+$/)||parseInt(n)>24)return null}return e}checkAndReturnWithFollowingPattern(e){if(e.text.match(/^\d+-\d+$/))return null;let t=e.text.match(/[^\d:.](\d[\d.]+)\s*-\s*(\d[\d.]+)$/);if(t){if(this.strictMode)return null;let n=t[1],i=t[2];if(i.includes(".")&&!i.match(/\d(\.\d{2})+$/))return null;let o=parseInt(i),s=parseInt(n);if(o>24||s>24)return null}return e}getPrimaryTimePatternThroughCache(){let e=this.primaryPrefix(),t=this.primarySuffix();return this.cachedPrimaryPrefix===e&&this.cachedPrimarySuffix===t?this.cachedPrimaryTimePattern:(this.cachedPrimaryTimePattern=Qte(this.primaryPatternLeftBoundary(),e,t,this.patternFlags()),this.cachedPrimaryPrefix=e,this.cachedPrimarySuffix=t,this.cachedPrimaryTimePattern)}getFollowingTimePatternThroughCache(){let e=this.followingPhase(),t=this.followingSuffix();return this.cachedFollowingPhase===e&&this.cachedFollowingSuffix===t?this.cachedFollowingTimePatten:(this.cachedFollowingTimePatten=Xte(e,t),this.cachedFollowingPhase=e,this.cachedFollowingSuffix=t,this.cachedFollowingTimePatten)}}});var Wy,_q=b(()=>{pt();$a();Wy=class extends Yr{constructor(e){super(e)}followingPhase(){return"\\s*(?:\\-|\\\u2013|\\~|\\\u301C|to|until|through|till|\\?)\\s*"}primaryPrefix(){return"(?:(?:at|from)\\s*)??"}primarySuffix(){return"(?:\\s*(?:o\\W*clock|at\\s*night|in\\s*the\\s*(?:morning|afternoon)))?(?!/)(?=\\W|$)"}extractPrimaryTimeComponents(e,t){let n=super.extractPrimaryTimeComponents(e,t);if(!n)return n;if(t[0].endsWith("night")){let i=n.get("hour");i>=6&&i<12?(n.assign("hour",n.get("hour")+12),n.assign("meridiem",G.PM)):i<6&&n.assign("meridiem",G.AM)}if(t[0].endsWith("afternoon")){n.assign("meridiem",G.PM);let i=n.get("hour");i>=0&&i<=6&&n.assign("hour",n.get("hour")+12)}return t[0].endsWith("morning")&&(n.assign("meridiem",G.AM),n.get("hour")<12&&n.assign("hour",n.get("hour"))),n.addTag("parser/ENTimeExpressionParser")}extractFollowingTimeComponents(e,t,n){let i=super.extractFollowingTimeComponents(e,t,n);return i&&i.addTag("parser/ENTimeExpressionParser"),i}}});var Zte,Jte,zy,Aq=b(()=>{sn();Le();fe();Bt();Zte=new RegExp(`(${_c})\\s{0,5}(?:ago|before|earlier)(?=\\W|$)`,"i"),Jte=new RegExp(`(${Uu})\\s{0,5}(?:ago|before|earlier)(?=\\W|$)`,"i"),zy=class extends U{constructor(t){super();ae(this,"strictMode");this.strictMode=t}innerPattern(){return this.strictMode?Jte:Zte}innerExtract(t,n){let i=Gs(n[1]);return i?X.createRelativeFromReference(t.reference,tt(i)):null}}});var ere,tre,rre,Hy,kq=b(()=>{sn();Le();fe();ere=new RegExp(`(${_c})\\s{0,5}(?:later|after|from now|henceforth|forward|out)(?=(?:\\W|$))`,"i"),tre=new RegExp(`(${Uu})\\s{0,5}(later|after|from now)(?=\\W|$)`,"i"),rre=1,Hy=class extends U{constructor(t){super();ae(this,"strictMode");this.strictMode=t}innerPattern(){return this.strictMode?tre:ere}innerExtract(t,n){let i=Gs(n[rre]);return i?X.createRelativeFromReference(t.reference,i):null}}});var Vu,oi,Ys=b(()=>{Vu=class{refine(e,t){return t.filter(n=>this.isValid(e,n))}},oi=class{refine(e,t){if(t.length<2)return t;let n=[],i=t[0],o=null;for(let s=1;s<t.length;s++){o=t[s];let a=e.text.substring(i.index+i.text.length,o.index);if(!this.shouldMergeResults(a,i,o,e))n.push(i),i=o;else{let l=i,c=o,u=this.mergeResults(a,l,c,e);e.debug(()=>{console.log(`${this.constructor.name} merged ${l} and ${c} into ${u}`)}),i=u}}return i!=null&&n.push(i),n}}});var Yt,vo=b(()=>{Ys();Bt();Yt=class extends oi{shouldMergeResults(e,t,n){return!t.end&&!n.end&&e.match(this.patternBetween())!=null}mergeResults(e,t,n){if(!t.start.isOnlyWeekdayComponent()&&!n.start.isOnlyWeekdayComponent()&&(n.start.getCertainComponents().forEach(o=>{t.start.isCertain(o)||t.start.imply(o,n.start.get(o))}),t.start.getCertainComponents().forEach(o=>{n.start.isCertain(o)||n.start.imply(o,t.start.get(o))})),t.start.date()>n.start.date()){let o=t.start.date(),s=n.start.date();n.start.isOnlyWeekdayComponent()&&vt(s,{day:7})>o?(s=vt(s,{day:7}),n.start.imply("day",s.getDate()),n.start.imply("month",s.getMonth()+1),n.start.imply("year",s.getFullYear())):t.start.isOnlyWeekdayComponent()&&vt(o,{day:-7})<s?(o=vt(o,{day:-7}),t.start.imply("day",o.getDate()),t.start.imply("month",o.getMonth()+1),t.start.imply("year",o.getFullYear())):n.start.isDateWithUnknownYear()&&vt(s,{year:1})>o?(s=vt(s,{year:1}),n.start.imply("year",s.getFullYear())):t.start.isDateWithUnknownYear()&&vt(o,{year:-1})<s?(o=vt(o,{year:-1}),t.start.imply("year",o.getFullYear())):[n,t]=[t,n]}let i=t.clone();return i.start=t.start,i.end=n.start,i.index=Math.min(t.index,n.index),t.index<n.index?i.text=t.text+e+n.text:i.text=n.text+e+t.text,i}}});var jy,Sq=b(()=>{vo();jy=class extends Yt{patternBetween(){return/^\s*(to|-|–|until|through|till)\s*$/i}}});function uF(r,e){let t=r.clone(),n=r.start,i=e.start;if(t.start=Dq(n,i),r.end!=null||e.end!=null){let o=r.end==null?r.start:r.end,s=e.end==null?e.start:e.end,a=Dq(o,s);if(r.end==null&&a.date().getTime()<t.start.date().getTime()){let l=new Date(a.date().getTime());l.setDate(l.getDate()+1),a.isCertain("day")?nt(a,l):Tc(a,l)}t.end=a}return t}function Dq(r,e){let t=r.clone();e.isCertain("hour")?(t.assign("hour",e.get("hour")),t.assign("minute",e.get("minute")),e.isCertain("second")?(t.assign("second",e.get("second")),e.isCertain("millisecond")?t.assign("millisecond",e.get("millisecond")):t.imply("millisecond",e.get("millisecond"))):(t.imply("second",e.get("second")),t.imply("millisecond",e.get("millisecond")))):(t.imply("hour",e.get("hour")),t.imply("minute",e.get("minute")),t.imply("second",e.get("second")),t.imply("millisecond",e.get("millisecond"))),e.isCertain("timezoneOffset")&&t.assign("timezoneOffset",e.get("timezoneOffset"));let n=r.get("meridiem")!=null&&(r.isCertain("meridiem")||Array.from(r.tags()).some(i=>i.startsWith("casualReference/")));return e.isCertain("meridiem")?t.assign("meridiem",e.get("meridiem")):e.get("meridiem")!=null&&!n&&t.imply("meridiem",e.get("meridiem")),t.get("meridiem")==G.PM&&t.get("hour")<12&&(e.isCertain("hour")?t.assign("hour",t.get("hour")+12):t.imply("hour",t.get("hour")+12)),t.addTags(r.tags()),t.addTags(e.tags()),t}var Iq=b(()=>{pt();on()});var Kt,yo=b(()=>{Ys();Iq();Kt=class extends oi{shouldMergeResults(e,t,n){return(t.start.isOnlyDate()&&n.start.isOnlyTime()||n.start.isOnlyDate()&&t.start.isOnlyTime())&&e.match(this.patternBetween())!=null}mergeResults(e,t,n){let i=t.start.isOnlyDate()?uF(t,n):uF(n,t);return i.index=t.index,i.text=t.text+e+n.text,i}}});var Um,Pq=b(()=>{yo();Um=class extends Kt{patternBetween(){return new RegExp("^\\s*(T|at|after|before|on|of|,|-|\\.|\u2219|:)?\\s*$")}}});var nre,Gy,Fq=b(()=>{nF();nre=new RegExp("^\\s*,?\\s*\\(?([A-Z]{2,4})\\)?(?=\\W|$)","i"),Gy=class{constructor(e){ae(this,"timezoneOverrides");this.timezoneOverrides=e}refine(e,t){let n=e.option.timezones??{};return t.forEach(i=>{let o=e.text.substring(i.index+i.text.length),s=nre.exec(o);if(!s)return;let a=s[1].toUpperCase(),l=i.start.date()??i.refDate??new Date,c={...this.timezoneOverrides,...n},u=Q_(a,l,c);if(u==null)return;e.debug(()=>{console.log(`Extracting timezone: '${a}' into: ${u} for: ${i.start}`)});let d=i.start.get("timezoneOffset");d!==null&&u!=d&&(i.start.isCertain("timezoneOffset")||a!=s[1])||i.start.isOnlyDate()&&a!=s[1]||(i.text+=s[0],i.start.isCertain("timezoneOffset")||i.start.assign("timezoneOffset",u),i.end!=null&&!i.end.isCertain("timezoneOffset")&&i.end.assign("timezoneOffset",u))}),t}}});var ire,ore,sre,are,Oa,Yy=b(()=>{ire=new RegExp("^\\s*(?:\\(?(?:GMT|UTC)\\s?)?([+-])(\\d{1,2})(?::?(\\d{2}))?\\)?","i"),ore=1,sre=2,are=3,Oa=class{refine(e,t){return t.forEach(function(n){if(n.start.isCertain("timezoneOffset"))return;let i=e.text.substring(n.index+n.text.length),o=ire.exec(i);if(!o)return;e.debug(()=>{console.log(`Extracting timezone: '${o[0]}' into : ${n}`)});let s=parseInt(o[sre]),a=parseInt(o[are]||"0"),l=s*60+a;l>840||(o[ore]==="-"&&(l=-l),n.end!=null&&n.end.assign("timezoneOffset",l),n.start.assign("timezoneOffset",l),n.text+=o[0])}),t}}});var Cl,eA=b(()=>{Cl=class{refine(e,t){if(t.length<2)return t;let n=[],i=t[0];for(let o=1;o<t.length;o++){let s=t[o];if(s.index>=i.index+i.text.length){n.push(i),i=s;continue}let a=null,l=null;s.text.length>i.text.length?(a=s,l=i):(a=i,l=s),e.debug(()=>{console.log(`${this.constructor.name} remove ${l} by ${a}`)}),i=a}return i!=null&&n.push(i),n}}});function cr(r,e,t){let n=r.getDateWithAdjustedTimezone(),i=lre(n,e,t),o=new X(r);return o=o.addDurationAsImplied({day:i}),o.assign("weekday",e),o}function lre(r,e,t){let n=r.getDay();switch(t){case"this":return yp(r,e);case"last":return Mq(r,e);case"next":return n==Oe.SUNDAY?e==Oe.SUNDAY?7:e:n==Oe.SATURDAY?e==Oe.SATURDAY?7:e==Oe.SUNDAY?8:1+e:e<n&&e!=Oe.SUNDAY?yp(r,e):yp(r,e)+7}return cre(r,e)}function cre(r,e){let t=Mq(r,e),n=yp(r,e);return n<-t?n:t}function yp(r,e){let t=r.getDay(),n=e-t;return n<0&&(n+=7),n}function Mq(r,e){let t=r.getDay(),n=e-t;return n>=0&&(n-=7),n}var Ki=b(()=>{pt();Le()});var Ky,Rq=b(()=>{on();on();Bt();Ki();Ky=class{refine(e,t){return e.option.forwardDate&&t.forEach(n=>{let i=e.reference.getDateWithAdjustedTimezone();if(n.start.isOnlyTime()&&e.reference.instant>n.start.date()){let o=e.reference.getDateWithAdjustedTimezone(),s=new Date(o);s.setDate(s.getDate()+1),Tc(n.start,s),e.debug(()=>{console.log(`${this.constructor.name} adjusted ${n} time from the ref date (${o}) to the following day (${s})`)}),n.end&&n.end.isOnlyTime()&&(Tc(n.end,s),n.start.date()>n.end.date()&&(s.setDate(s.getDate()+1),Tc(n.end,s)))}if(n.start.isOnlyWeekdayComponent()&&i>n.start.date()){let o=yp(i,n.start.get("weekday"))||7,s=vt(i,{day:o});if(Tc(n.start,s),e.debug(()=>{console.log(`${this.constructor.name} adjusted ${n} weekday (${n.start})`)}),n.end&&n.start.date()>n.end.date()){let a=yp(i,n.start.get("weekday"))||7,l=vt(i,{day:a});Tc(n.end,l),e.debug(()=>{console.log(`${this.constructor.name} adjusted ${n} weekday (${n.end})`)})}}if(n.start.isDateWithUnknownYear()&&i>n.start.date())for(let o=0;o<3&&i>n.start.date();o++)n.start.imply("year",n.start.get("year")+1),e.debug(()=>{console.log(`${this.constructor.name} adjusted ${n} year (${n.start})`)}),n.end&&!n.end.isCertain("year")&&(n.end.imply("year",n.end.get("year")+1),e.debug(()=>{console.log(`${this.constructor.name} adjusted ${n} month (${n.start})`)}))}),t}}});var Qy,$q=b(()=>{Ys();Qy=class extends Vu{constructor(t){super();ae(this,"strictMode");this.strictMode=t}isValid(t,n){return n.text.replace(" ","").match(/^\d*(\.\d*)?$/)?(t.debug(()=>{console.log(`Removing unlikely result '${n.text}'`)}),!1):n.start.isValidDate()?n.end&&!n.end.isValidDate()?(t.debug(()=>{console.log(`Removing invalid result: ${n} (${n.end})`)}),!1):this.strictMode?this.isStrictModeValid(t,n):!0:(t.debug(()=>{console.log(`Removing invalid result: ${n} (${n.start})`)}),!1)}isStrictModeValid(t,n){return n.start.isOnlyWeekdayComponent()?(t.debug(()=>{console.log(`(Strict) Removing weekday only component: ${n} (${n.end})`)}),!1):!0}}});var ure,dre,pre,fre,Oq,mre,Nq,Lq,hre,Bq,Uq,bo,bp=b(()=>{fe();ure=new RegExp("([0-9]{4})\\-([0-9]{1,2})\\-([0-9]{1,2})(?:T([0-9]{1,2}):([0-9]{1,2})(?::([0-9]{1,2})(?:\\.(\\d{1,4}))?)?(Z|([+-]\\d{2}):?(\\d{2})?)?)?(?=\\W|$)","i"),dre=1,pre=2,fre=3,Oq=4,mre=5,Nq=6,Lq=7,hre=8,Bq=9,Uq=10,bo=class extends U{innerPattern(){return ure}innerExtract(e,t){let n=e.createParsingComponents({year:parseInt(t[dre]),month:parseInt(t[pre]),day:parseInt(t[fre])});if(t[Oq]!=null&&(n.assign("hour",parseInt(t[Oq])),n.assign("minute",parseInt(t[mre])),t[Nq]!=null&&n.assign("second",parseInt(t[Nq])),t[Lq]!=null&&n.assign("millisecond",parseInt(t[Lq])),t[hre]!=null)){let i=0;if(t[Bq]){let o=parseInt(t[Bq]),s=0;t[Uq]!=null&&(s=parseInt(t[Uq])),i=o*60,i<0?i-=s:i+=s}n.assign("timezoneOffset",i)}return n.addTag("parser/ISOFormatParser")}}});var Ac,tA=b(()=>{Ys();Ac=class extends oi{mergeResults(e,t,n){let i=n.clone();return i.index=t.index,i.text=t.text+e+i.text,i.start.assign("weekday",t.start.get("weekday")),i.end&&i.end.assign("weekday",t.start.get("weekday")),i}shouldMergeResults(e,t,n){return t.start.isOnlyWeekdayComponent()&&!t.start.isCertain("hour")&&n.start.isCertain("day")&&e.match(/^,?\s*$/)!=null}}});function Ht(r,e=!1){return r.parsers.unshift(new bo),r.refiners.unshift(new Ac),r.refiners.unshift(new Oa),r.refiners.unshift(new Cl),r.refiners.push(new Gy),r.refiners.push(new Cl),r.refiners.push(new Ky),r.refiners.push(new Qy(e)),r}var Ei=b(()=>{Fq();Yy();eA();Rq();$q();bp();tA()});function $r(r){let e=r.getDateWithAdjustedTimezone(),t=new X(r,{});return nt(t,e),K_(t,e),t.assign("timezoneOffset",r.getTimezoneOffset()),t.addTag("casualReference/now"),t}function Tr(r){let e=r.getDateWithAdjustedTimezone(),t=new X(r,{});return nt(t,e),Lt(t,e),t.delete("meridiem"),t.addTag("casualReference/today"),t}function vn(r){return kc(r,1).addTag("casualReference/yesterday")}function yn(r){return Mo(r,1).addTag("casualReference/tomorrow")}function kc(r,e){return Mo(r,-e)}function Mo(r,e){let t=r.getDateWithAdjustedTimezone(),n=new X(r,{}),i=new Date(t.getTime());return i.setDate(i.getDate()+e),nt(n,i),Lt(n,i),n.delete("meridiem"),n}function rA(r,e=22){let t=r.getDateWithAdjustedTimezone(),n=new X(r,{});return nt(n,t),n.imply("hour",e),n.imply("meridiem",G.PM),n.addTag("casualReference/tonight"),n}function nA(r,e=0){let t=r.getDateWithAdjustedTimezone(),n=new X(r,{});return t.getHours()<6&&(t=new Date(t.getTime()-1440*60*1e3)),nt(n,t),n.imply("hour",e),n}function Sc(r,e=20){let t=new X(r,{});return t.imply("meridiem",G.PM),t.imply("hour",e),t.addTag("casualReference/evening"),t}function iA(r,e=20){let t=r.getDateWithAdjustedTimezone(),n=new X(r,{});return t=new Date(t.getTime()-1440*60*1e3),nt(n,t),n.imply("hour",e),n.imply("meridiem",G.PM),n.addTag("casualReference/yesterday"),n.addTag("casualReference/evening"),n}function Dc(r){let e=new X(r,{});return r.getDateWithAdjustedTimezone().getHours()>2&&e.addDurationAsImplied({day:1}),e.assign("hour",0),e.imply("minute",0),e.imply("second",0),e.imply("millisecond",0),e.addTag("casualReference/midnight"),e}function Ic(r,e=6){let t=new X(r,{});return t.imply("meridiem",G.AM),t.imply("hour",e),t.imply("minute",0),t.imply("second",0),t.imply("millisecond",0),t.addTag("casualReference/morning"),t}function oA(r,e=15){let t=new X(r,{});return t.imply("meridiem",G.PM),t.imply("hour",e),t.imply("minute",0),t.imply("second",0),t.imply("millisecond",0),t.addTag("casualReference/afternoon"),t}function qu(r){let e=new X(r,{});return e.imply("meridiem",G.AM),e.assign("hour",12),e.imply("minute",0),e.imply("second",0),e.imply("millisecond",0),e.addTag("casualReference/noon"),e}var si=b(()=>{Le();on();pt()});var gre,Xy,Vq=b(()=>{fe();on();si();gre=/(now|today|tonight|tomorrow|overmorrow|tmr|tmrw|yesterday|last\s*night)(?=\W|$)/i,Xy=class extends U{innerPattern(e){return gre}innerExtract(e,t){let n=e.refDate,i=t[0].toLowerCase(),o=e.createParsingComponents();switch(i){case"now":o=$r(e.reference);break;case"today":o=Tr(e.reference);break;case"yesterday":o=vn(e.reference);break;case"tomorrow":case"tmr":case"tmrw":o=yn(e.reference);break;case"tonight":o=rA(e.reference);break;case"overmorrow":o=Mo(e.reference,2);break;default:if(i.match(/last\s*night/)){if(n.getHours()>6){let s=new Date(n.getTime());s.setDate(s.getDate()-1),n=s}nt(o,n),o.imply("hour",0)}break}return o.addTag("parser/ENCasualDateParser"),o}}});var vre,Zy,qq=b(()=>{fe();si();vre=/(?:this)?\s{0,3}(morning|afternoon|evening|night|midnight|midday|noon)(?=\W|$)/i,Zy=class extends U{innerPattern(){return vre}innerExtract(e,t){let n=null;switch(t[1].toLowerCase()){case"afternoon":n=oA(e.reference);break;case"evening":case"night":n=Sc(e.reference);break;case"midnight":n=Dc(e.reference);break;case"morning":n=Ic(e.reference);break;case"noon":case"midday":n=qu(e.reference);break}return n&&n.addTag("parser/ENCasualTimeParser"),n}}});var yre,bre,wre,Cre,Jy,Wq=b(()=>{sn();ze();fe();Ki();pt();yre=new RegExp(`(?:(?:\\,|\\(|\\\uFF08)\\s*)?(?:on\\s*?)?(?:(this|last|past|next)\\s*)?(${ee(X_)}|weekend|weekday)(?:\\s*(?:\\,|\\)|\\\uFF09))?(?:\\s*(?:of\\s*)?(this|last|past|next)\\s*week)?(?=\\W|$)`,"i"),bre=1,wre=2,Cre=3,Jy=class extends U{innerPattern(){return yre}innerExtract(e,t){let n=t[bre],i=t[Cre],o=n||i;o=o||"",o=o.toLowerCase();let s=null;o=="last"||o=="past"?s="last":o=="next"?s="next":o=="this"&&(s="this");let a=t[wre].toLowerCase(),l;if(X_[a]!==void 0)l=X_[a];else if(a=="weekend")l=s=="last"?Oe.SUNDAY:Oe.SATURDAY;else if(a=="weekday"){let c=e.reference.getDateWithAdjustedTimezone().getDay();c==Oe.SUNDAY||c==Oe.SATURDAY?l=s=="last"?Oe.FRIDAY:Oe.MONDAY:(l=c-1,l=s=="last"?l-1:l+1,l=l%5+1)}else return null;return cr(e.reference,l,s)}}});var xre,Ere,Tre,eb,zq=b(()=>{sn();Le();fe();ze();xre=new RegExp(`(this|last|past|next|after\\s*this)\\s*(${ee($y)})(?=\\s*)(?=\\W|$)`,"i"),Ere=1,Tre=2,eb=class extends U{innerPattern(){return xre}innerExtract(e,t){let n=t[Ere].toLowerCase(),i=t[Tre].toLowerCase(),o=$y[i];if(n=="next"||n.startsWith("after")){let l={};return l[o]=1,X.createRelativeFromReference(e.reference,l)}if(n=="last"||n=="past"){let l={};return l[o]=-1,X.createRelativeFromReference(e.reference,l)}let s=e.createParsingComponents(),a=new Date(e.reference.instant.getTime());return i.match(/week/i)?(a.setDate(a.getDate()-a.getDay()),s.imply("day",a.getDate()),s.imply("month",a.getMonth()+1),s.imply("year",a.getFullYear())):i.match(/month/i)?(a.setDate(1),s.imply("day",a.getDate()),s.assign("year",a.getFullYear()),s.assign("month",a.getMonth()+1)):i.match(/year/i)&&(a.setDate(1),a.setMonth(0),s.imply("day",a.getDate()),s.imply("month",a.getMonth()+1),s.assign("year",a.getFullYear())),s}}});var _re,Are,kre,Hq,jq,dF,vr,cs=b(()=>{zt();_re=new RegExp("([^\\d]|^)([0-3]{0,1}[0-9]{1})[\\/\\.\\-]([0-3]{0,1}[0-9]{1})(?:[\\/\\.\\-]([0-9]{4}|[0-9]{2}))?(\\W|$)","i"),Are=1,kre=5,Hq=2,jq=3,dF=4,vr=class{constructor(e){ae(this,"groupNumberMonth");ae(this,"groupNumberDay");this.groupNumberMonth=e?jq:Hq,this.groupNumberDay=e?Hq:jq}pattern(){return _re}extract(e,t){let n=t.index+t[Are].length,i=t.index+t[0].length-t[kre].length;if(n>0&&e.text.substring(0,n).match("\\d/?$")||i<e.text.length&&e.text.substring(i).match("^/?\\d"))return;let o=e.text.substring(n,i);if(o.match(/^\d\.\d$/)||o.match(/^\d\.\d{1,2}\.\d{1,2}\s*$/)||!t[dF]&&o.indexOf("/")<0)return;let s=e.createParsingResult(n,o),a=parseInt(t[this.groupNumberMonth]),l=parseInt(t[this.groupNumberDay]);if((a<1||a>12)&&a>12)if(l>=1&&l<=12&&a<=31)[l,a]=[a,l];else return null;if(l<1||l>31)return null;if(s.start.assign("day",l),s.start.assign("month",a),t[dF]){let c=parseInt(t[dF]),u=Gr(c);s.start.assign("year",u)}else{let c=ft(e.refDate,l,a);s.start.imply("year",c)}return s.addTag("parser/SlashDateFormatParser")}}});var Sre,Dre,tb,Gq=b(()=>{sn();Le();fe();Bt();Sre=new RegExp(`(this|last|past|next|after|\\+|-)\\s*(${_c})(?=\\W|$)`,"i"),Dre=new RegExp(`(this|last|past|next|after|\\+|-)\\s*(${Uu})(?=\\W|$)`,"i"),tb=class extends U{constructor(t=!0){super();ae(this,"allowAbbreviations");this.allowAbbreviations=t}innerPattern(){return this.allowAbbreviations?Sre:Dre}innerExtract(t,n){let i=n[1].toLowerCase(),o=Gs(n[2]);if(!o)return null;switch(i){case"last":case"past":case"-":o=tt(o);break}return X.createRelativeFromReference(t.reference,o)}}});function Ire(r){return r.text.match(/^[+-]/i)!=null}function Yq(r){return r.text.match(/^-/i)!=null}var rb,Kq=b(()=>{Ys();Le();sn();Bt();rb=class extends oi{shouldMergeResults(e,t,n){return e.match(/^\s*$/i)?Ire(n)||Yq(n):!1}mergeResults(e,t,n,i){let o=Gs(n.text);Yq(n)&&(o=tt(o));let s=X.createRelativeFromReference(ct.fromDate(t.start.date()),o);return new at(t.reference,t.index,`${t.text}${e}${n.text}`,s)}}});function Qq(r){return r.text.match(/\s+(before|from)$/i)!=null}function Pre(r){return r.text.match(/\s+(after|since)$/i)!=null}var nb,Xq=b(()=>{Ys();Le();sn();Bt();nb=class extends oi{patternBetween(){return/^\s*$/i}shouldMergeResults(e,t,n){return!e.match(this.patternBetween())||!Qq(t)&&!Pre(t)?!1:!!n.start.get("day")&&!!n.start.get("month")&&!!n.start.get("year")}mergeResults(e,t,n){let i=Gs(t.text);Qq(t)&&(i=tt(i));let o=X.createRelativeFromReference(ct.fromDate(n.start.date()),i);return new at(n.reference,t.index,`${t.text}${e}${n.text}`,o)}}});var Fre,Mre,ib,Zq=b(()=>{sn();Fre=new RegExp(`^\\s*(${Bu})`,"i"),Mre=1,ib=class{refine(e,t){return t.forEach(function(n){if(!n.start.isDateWithUnknownYear())return;let i=e.text.substring(n.index+n.text.length),o=Fre.exec(i);if(!o||o[0].trim().length<=3)return;e.debug(()=>{console.log(`Extracting year: '${o[0]}' into : ${n}`)});let s=wl(o[Mre]);n.end!=null&&n.end.assign("year",s),n.start.assign("year",s),n.text+=o[0]}),t}}});var ob,Jq=b(()=>{Ys();ob=class extends Vu{constructor(){super()}isValid(e,t){let n=t.text.trim();return n===e.text.trim()?!0:n.toLowerCase()==="may"&&!e.text.substring(0,t.index).trim().match(/\b(in)$/i)?(e.debug(()=>{console.log(`Removing unlikely result: ${t}`)}),!1):n.toLowerCase().endsWith("the second")?(e.text.substring(t.index+t.text.length).trim().length>0&&e.debug(()=>{console.log(`Removing unlikely result: ${t}`)}),!1):!0}}});var wp,pF=b(()=>{pq();gq();yq();wq();xq();Eq();Tq();_q();Aq();kq();Sq();Pq();Ei();Vq();qq();Wq();zq();cs();Gq();Kq();Xq();eA();Zq();Jq();wp=class{createCasualConfiguration(e=!1){let t=this.createConfiguration(!1,e);return t.parsers.push(new Xy),t.parsers.push(new Zy),t.parsers.push(new By),t.parsers.push(new eb),t.parsers.push(new tb),t.refiners.push(new ob),t}createConfiguration(e=!0,t=!1){let n=Ht({parsers:[new vr(t),new Oy(e),new Ny,new Ly(t),new Jy,new qy,new Wy(e),new zy(e),new Hy(e),new Vy],refiners:[new Um]},e);return n.parsers.unshift(new Uy(e)),n.refiners.unshift(new nb),n.refiners.unshift(new rb),n.refiners.unshift(new Cl),n.refiners.push(new Um),n.refiners.push(new ib),n.refiners.push(new jy),n}}});var Se,sb,ai=b(()=>{Le();pF();Se=class r{constructor(e){ae(this,"parsers");ae(this,"refiners");ae(this,"defaultConfig",new wp);e=e||this.defaultConfig.createCasualConfiguration(),this.parsers=[...e.parsers],this.refiners=[...e.refiners]}clone(){return new r({parsers:[...this.parsers],refiners:[...this.refiners]})}parseDate(e,t,n){let i=this.parse(e,t,n);return i.length>0?i[0].start.date():null}parse(e,t,n){let i=new sb(e,t,n),o=[];return this.parsers.forEach(s=>{let a=r.executeParser(i,s);o=o.concat(a)}),o.sort((s,a)=>s.index-a.index),this.refiners.forEach(function(s){o=s.refine(i,o)}),o}static executeParser(e,t){let n=[],i=t.pattern(e),o=e.text,s=e.text,a=i.exec(s);for(;a;){let l=a.index+o.length-s.length;a.index=l;let c=t.extract(e,a);if(!c){s=o.substring(a.index+1),a=i.exec(s);continue}let u=null;c instanceof at?u=c:c instanceof X?(u=e.createParsingResult(a.index,a[0]),u.start=c):u=e.createParsingResult(a.index,a[0],c);let d=u.index,f=u.text;e.debug(()=>console.log(`${t.constructor.name} extracted (at index=${d}) '${f}'`)),n.push(u),s=o.substring(d+f.length),a=i.exec(s)}return n}},sb=class{constructor(e,t,n){ae(this,"text");ae(this,"option");ae(this,"reference");ae(this,"refDate");this.text=e,this.option=n??{},this.reference=ct.fromInput(t,this.option.timezones),this.refDate=this.reference.instant}createParsingComponents(e){return e instanceof X?e:new X(this.reference,e)}createParsingResult(e,t,n,i){let o=typeof t=="string"?t:this.text.substring(e,t),s=n?this.createParsingComponents(n):null,a=i?this.createParsingComponents(i):null;return new at(this.reference,e,o,s,a)}debug(e){this.option.debug&&(this.option.debug instanceof Function?this.option.debug(e):this.option.debug.debug(e))}}});var mF={};Jr(mF,{Chrono:()=>Se,GB:()=>Rre,Meridiem:()=>G,ParsingComponents:()=>X,ParsingResult:()=>at,ReferenceWithTimezone:()=>ct,Weekday:()=>Oe,casual:()=>ab,configuration:()=>sA,parse:()=>$re,parseDate:()=>Ore,strict:()=>fF});function $re(r,e,t){return ab.parse(r,e,t)}function Ore(r,e,t){return ab.parseDate(r,e,t)}var sA,ab,fF,Rre,eW=b(()=>{ai();Le();pt();pF();sA=new wp,ab=new Se(sA.createCasualConfiguration(!1)),fF=new Se(sA.createConfiguration(!0,!1)),Rre=new Se(sA.createCasualConfiguration(!0))});var lb,tW=b(()=>{$a();lb=class extends Yr{primaryPrefix(){return"(?:(?:um|von)\\s*)?"}followingPhase(){return"\\s*(?:\\-|\\\u2013|\\~|\\\u301C|bis)\\s*"}extractPrimaryTimeComponents(e,t){return t[0].match(/^\s*\d{4}\s*$/)?null:super.extractPrimaryTimeComponents(e,t)}}});function bF(r){let e=r.toLowerCase();return hF[e]!==void 0?hF[e]:e==="ein"||e==="einer"||e==="einem"||e==="einen"||e==="eine"?1:e.match(/wenigen/)?2:e.match(/halb/)||e.match(/halben/)?.5:e.match(/einigen/)?3:e.match(/mehreren/)?7:parseFloat(e)}function iW(r){if(/v/i.test(r))return-parseInt(r.replace(/[^0-9]+/gi,""));if(/n/i.test(r))return parseInt(r.replace(/[^0-9]+/gi,""));if(/z/i.test(r))return parseInt(r.replace(/[^0-9]+/gi,""));let e=parseInt(r);return Gr(e)}function aW(r){let e={},t=r,n=rW.exec(t);for(;n;)Nre(e,n),t=t.substring(n[0].length),n=rW.exec(t);return e}function Nre(r,e){let t=bF(e[1]),n=cb[e[2].toLowerCase()];r[n]=t}var gF,vF,hF,cb,yF,nW,oW,rW,sW,Vm=b(()=>{ze();zt();gF={sonntag:0,so:0,montag:1,mo:1,dienstag:2,di:2,mittwoch:3,mi:3,donnerstag:4,do:4,freitag:5,fr:5,samstag:6,sa:6},vF={januar:1,j\u00E4nner:1,janner:1,jan:1,"jan.":1,februar:2,feber:2,feb:2,"feb.":2,m\u00E4rz:3,maerz:3,m\u00E4r:3,"m\xE4r.":3,mrz:3,"mrz.":3,april:4,apr:4,"apr.":4,mai:5,juni:6,jun:6,"jun.":6,juli:7,jul:7,"jul.":7,august:8,aug:8,"aug.":8,september:9,sep:9,"sep.":9,sept:9,"sept.":9,oktober:10,okt:10,"okt.":10,november:11,nov:11,"nov.":11,dezember:12,dez:12,"dez.":12},hF={eins:1,eine:1,einem:1,einen:1,einer:1,zwei:2,drei:3,vier:4,f\u00FCnf:5,fuenf:5,sechs:6,sieben:7,acht:8,neun:9,zehn:10,elf:11,zw\u00F6lf:12,zwoelf:12},cb={sek:"second",sekunde:"second",sekunden:"second",min:"minute",minute:"minute",minuten:"minute",h:"hour",std:"hour",stunde:"hour",stunden:"hour",tag:"day",tage:"day",tagen:"day",woche:"week",wochen:"week",monat:"month",monate:"month",monaten:"month",monats:"month",quartal:"quarter",quartals:"quarter",quartale:"quarter",quartalen:"quarter",a:"year",j:"year",jr:"year",jahr:"year",jahre:"year",jahren:"year",jahres:"year"},yF=`(?:${ee(hF)}|[0-9]+|[0-9]+\\.[0-9]+|halb?|halbe?|einigen?|wenigen?|mehreren?)`;nW="(?:[0-9]{1,4}(?:\\s*[vn]\\.?\\s*(?:C(?:hr)?|(?:u\\.?|d\\.?(?:\\s*g\\.?)?)?\\s*Z)\\.?|\\s*(?:u\\.?|d\\.?(?:\\s*g\\.)?)\\s*Z\\.?)?)";oW=`(${yF})\\s{0,5}(${ee(cb)})\\s{0,5}`,rW=new RegExp(oW,"i"),sW=Er("",oW)});var Lre,Bre,Ure,Vre,ub,lW=b(()=>{Vm();ze();fe();Ki();Lre=new RegExp(`(?:(?:\\,|\\(|\\\uFF08)\\s*)?(?:a[mn]\\s*?)?(?:(diese[mn]|letzte[mn]|n(?:\xE4|ae)chste[mn])\\s*)?(${ee(gF)})(?:\\s*(?:\\,|\\)|\\\uFF09))?(?:\\s*(diese|letzte|n(?:\xE4|ae)chste)\\s*woche)?(?=\\W|$)`,"i"),Bre=1,Ure=3,Vre=2,ub=class extends U{innerPattern(){return Lre}innerExtract(e,t){let n=t[Vre].toLowerCase(),i=gF[n],o=t[Bre],s=t[Ure],a=o||s;a=a||"",a=a.toLowerCase();let l=null;return a.match(/letzte/)?l="last":a.match(/chste/)?l="next":a.match(/diese/)&&(l="this"),cr(e.reference,i,l)}}});var qre,Wre,zre,cW,uW,dW,db,pW=b(()=>{pt();qre=new RegExp("(^|\\s|T)(?:(?:um|von)\\s*)?(\\d{1,2})(?:h|:)?(?:(\\d{1,2})(?:m|:)?)?(?:(\\d{1,2})(?:s)?)?(?:\\s*Uhr)?(?:\\s*(morgens|vormittags|nachmittags|abends|nachts|am\\s+(?:Morgen|Vormittag|Nachmittag|Abend)|in\\s+der\\s+Nacht))?(?=\\W|$)","i"),Wre=new RegExp("^\\s*(\\-|\\\u2013|\\~|\\\u301C|bis(?:\\s+um)?|\\?)\\s*(\\d{1,2})(?:h|:)?(?:(\\d{1,2})(?:m|:)?)?(?:(\\d{1,2})(?:s)?)?(?:\\s*Uhr)?(?:\\s*(morgens|vormittags|nachmittags|abends|nachts|am\\s+(?:Morgen|Vormittag|Nachmittag|Abend)|in\\s+der\\s+Nacht))?(?=\\W|$)","i"),zre=2,cW=3,uW=4,dW=5,db=class r{pattern(e){return qre}extract(e,t){let n=e.createParsingResult(t.index+t[1].length,t[0].substring(t[1].length));if(n.text.match(/^\d{4}$/)||(n.start=r.extractTimeComponent(n.start.clone(),t),!n.start))return t.index+=t[0].length,null;let i=e.text.substring(t.index+t[0].length),o=Wre.exec(i);return o&&(n.end=r.extractTimeComponent(n.start.clone(),o),n.end&&(n.text+=o[0])),n}static extractTimeComponent(e,t){let n=0,i=0,o=null;if(n=parseInt(t[zre]),t[cW]!=null&&(i=parseInt(t[cW])),i>=60||n>24)return null;if(n>=12&&(o=G.PM),t[dW]!=null){if(n>12)return null;let s=t[dW].toLowerCase();s.match(/morgen|vormittag/)&&(o=G.AM,n==12&&(n=0)),s.match(/nachmittag|abend/)&&(o=G.PM,n!=12&&(n+=12)),s.match(/nacht/)&&(n==12?(o=G.AM,n=0):n<6?o=G.AM:(o=G.PM,n+=12))}if(e.assign("hour",n),e.assign("minute",i),o!==null?e.assign("meridiem",o):n<12?e.imply("meridiem",G.AM):e.imply("meridiem",G.PM),t[uW]!=null){let s=parseInt(t[uW]);if(s>=60)return null;e.assign("second",s)}return e}}});var pb,fW=b(()=>{vo();pb=class extends Yt{patternBetween(){return/^\s*(bis(?:\s*(?:am|zum))?|-)\s*$/i}}});var fb,mW=b(()=>{yo();fb=class extends Kt{patternBetween(){return new RegExp("^\\s*(T|um|am|,|-)?\\s*$")}}});var Cp,wF=b(()=>{pt();fe();on();Cp=class r extends U{innerPattern(e){return/(diesen)?\s*(morgen|vormittag|mittags?|nachmittag|abend|nacht|mitternacht)(?=\W|$)/i}innerExtract(e,t){let n=e.refDate,i=t[2].toLowerCase(),o=e.createParsingComponents();return Lt(o,n),r.extractTimeComponents(o,i)}static extractTimeComponents(e,t){switch(t){case"morgen":e.imply("hour",6),e.imply("minute",0),e.imply("second",0),e.imply("meridiem",G.AM),e.addTag("casualReference/morning");break;case"vormittag":e.imply("hour",9),e.imply("minute",0),e.imply("second",0),e.imply("meridiem",G.AM),e.addTag("casualReference/morning");break;case"mittag":case"mittags":e.imply("hour",12),e.imply("minute",0),e.imply("second",0),e.imply("meridiem",G.AM),e.addTag("casualReference/noon");break;case"nachmittag":e.imply("hour",15),e.imply("minute",0),e.imply("second",0),e.imply("meridiem",G.PM),e.addTag("casualReference/afternoon");break;case"abend":e.imply("hour",18),e.imply("minute",0),e.imply("second",0),e.imply("meridiem",G.PM),e.addTag("casualReference/evening");break;case"nacht":e.imply("hour",22),e.imply("minute",0),e.imply("second",0),e.imply("meridiem",G.PM),e.addTag("casualReference/evening");break;case"mitternacht":e.get("hour")>1&&e.addDurationAsImplied({day:1}),e.imply("hour",0),e.imply("minute",0),e.imply("second",0),e.imply("meridiem",G.AM),e.addTag("casualReference/midnight");break}return e}}});var Hre,jre,Gre,mb,hW=b(()=>{fe();on();wF();si();Bt();Hre=new RegExp("(jetzt|heute|morgen|\xFCbermorgen|uebermorgen|gestern|vorgestern|letzte\\s*nacht)(?:\\s*(morgen|vormittag|mittags?|nachmittag|abend|nacht|mitternacht))?(?=\\W|$)","i"),jre=1,Gre=2,mb=class extends U{innerPattern(e){return Hre}innerExtract(e,t){let n=e.reference.getDateWithAdjustedTimezone(),i=(t[jre]||"").toLowerCase(),o=(t[Gre]||"").toLowerCase(),s=e.createParsingComponents();switch(i){case"jetzt":s=$r(e.reference);break;case"heute":s=Tr(e.reference);break;case"morgen":n=vt(n,{day:1}),nt(s,n),Lt(s,n);break;case"\xFCbermorgen":case"uebermorgen":n=vt(n,{day:2}),nt(s,n),Lt(s,n);break;case"gestern":n=vt(n,{day:-1}),nt(s,n),Lt(s,n);break;case"vorgestern":n=vt(n,{day:-2}),nt(s,n),Lt(s,n);break;default:i.match(/letzte\s*nacht/)&&(n.getHours()>6&&(n=vt(n,{day:-1})),nt(s,n),s.imply("hour",0));break}return o&&(s=Cp.extractTimeComponents(s,o)),s}}});var Yre,gW,vW,Kre,yW,hb,bW=b(()=>{zt();Vm();Vm();ze();fe();Yre=new RegExp(`(?:am\\s*?)?(?:den\\s*?)?([0-9]{1,2})\\.(?:\\s*(?:bis(?:\\s*(?:am|zum))?|\\-|\\\u2013|\\s)\\s*([0-9]{1,2})\\.?)?\\s*(${ee(vF)})(?:(?:-|/|,?\\s*)(${nW}(?![^\\s]\\d)))?(?=\\W|$)`,"i"),gW=1,vW=2,Kre=3,yW=4,hb=class extends U{innerPattern(){return Yre}innerExtract(e,t){let n=e.createParsingResult(t.index,t[0]),i=vF[t[Kre].toLowerCase()],o=parseInt(t[gW]);if(o>31)return t.index=t.index+t[gW].length,null;if(n.start.assign("month",i),n.start.assign("day",o),t[yW]){let s=iW(t[yW]);n.start.assign("year",s)}else{let s=ft(e.refDate,o,i);n.start.imply("year",s)}if(t[vW]){let s=parseInt(t[vW]);n.end=n.start.clone(),n.end.assign("day",s)}return n}}});var gb,wW=b(()=>{Vm();Le();fe();ze();Bt();gb=class extends U{constructor(){super()}innerPattern(){return new RegExp(`(?:\\s*((?:n\xE4chste|kommende|folgende|letzte|vergangene|vorige|vor(?:her|an)gegangene)(?:s|n|m|r)?|vor|in)\\s*)?(${yF})?(?:\\s*(n\xE4chste|kommende|folgende|letzte|vergangene|vorige|vor(?:her|an)gegangene)(?:s|n|m|r)?)?\\s*(${ee(cb)})(?=\\W|$)`,"i")}innerExtract(e,t){let n=t[2]?bF(t[2]):1,i=cb[t[4].toLowerCase()],o={};o[i]=n;let s=t[1]||t[3]||"";if(s=s.toLowerCase(),!!s)return(/vor/.test(s)||/letzte/.test(s)||/vergangen/.test(s))&&(o=tt(o)),X.createRelativeFromReference(e.reference,o)}}});var vb,CW=b(()=>{Vm();Le();fe();vb=class extends U{innerPattern(){return new RegExp(`(?:in|f\xFCr|w\xE4hrend)\\s*(${sW})(?=\\W|$)`,"i")}innerExtract(e,t){let n=aW(t[1]);return X.createRelativeFromReference(e.reference,n)}}});var EF={};Jr(EF,{Chrono:()=>Se,Meridiem:()=>G,ParsingComponents:()=>X,ParsingResult:()=>at,ReferenceWithTimezone:()=>ct,Weekday:()=>Oe,casual:()=>CF,createCasualConfiguration:()=>xW,createConfiguration:()=>xF,parse:()=>Xre,parseDate:()=>Zre,strict:()=>Qre});function Xre(r,e,t){return CF.parse(r,e,t)}function Zre(r,e,t){return CF.parseDate(r,e,t)}function xW(r=!0){let e=xF(!1,r);return e.parsers.unshift(new Cp),e.parsers.unshift(new mb),e.parsers.unshift(new gb),e}function xF(r=!0,e=!0){return Ht({parsers:[new bo,new vr(e),new lb,new db,new hb,new ub,new vb],refiners:[new pb,new fb]},r)}var CF,Qre,EW=b(()=>{Ei();ai();Le();pt();cs();bp();tW();lW();pW();fW();mW();hW();wF();bW();wW();CW();CF=new Se(xW()),Qre=new Se(xF(!0))});var yb,TW=b(()=>{pt();fe();on();si();yb=class extends U{innerPattern(e){return/(maintenant|aujourd'hui|demain|hier|cette\s*nuit|la\s*veille)(?=\W|$)/i}innerExtract(e,t){let n=e.refDate,i=t[0].toLowerCase(),o=e.createParsingComponents();switch(i){case"maintenant":return $r(e.reference);case"aujourd'hui":return Tr(e.reference);case"hier":return vn(e.reference);case"demain":return yn(e.reference);default:if(i.match(/cette\s*nuit/))nt(o,n),o.imply("hour",22),o.imply("meridiem",G.PM);else if(i.match(/la\s*veille/)){let s=new Date(n.getTime());s.setDate(s.getDate()-1),nt(o,s),o.imply("hour",0)}}return o}}});var bb,_W=b(()=>{pt();fe();bb=class extends U{innerPattern(e){return/(cet?)?\s*(matin|soir|après-midi|aprem|a midi|à minuit)(?=\W|$)/i}innerExtract(e,t){let n=t[2].toLowerCase(),i=e.createParsingComponents();switch(n){case"apr\xE8s-midi":case"aprem":i.imply("hour",14),i.imply("minute",0),i.imply("meridiem",G.PM),i.addTag("casualReference/afternoon");break;case"soir":i.imply("hour",18),i.imply("minute",0),i.imply("meridiem",G.PM),i.addTag("casualReference/evening");break;case"matin":i.imply("hour",8),i.imply("minute",0),i.imply("meridiem",G.AM),i.addTag("casualReference/morning");break;case"a midi":i.imply("hour",12),i.imply("minute",0),i.imply("meridiem",G.AM),i.addTag("casualReference/noon");break;case"\xE0 minuit":i.imply("hour",0),i.imply("meridiem",G.AM),i.addTag("casualReference/midnight");break}return i}}});var wb,AW=b(()=>{$a();wb=class extends Yr{primaryPrefix(){return"(?:(?:[\xE0a])\\s*)?"}followingPhase(){return"\\s*(?:\\-|\\\u2013|\\~|\\\u301C|[\xE0a]|\\?)\\s*"}extractPrimaryTimeComponents(e,t){return t[0].match(/^\s*\d{4}\s*$/)?null:super.extractPrimaryTimeComponents(e,t)}}});var Cb,kW=b(()=>{yo();Cb=class extends Kt{patternBetween(){return new RegExp("^\\s*(T|\xE0|a|au|vers|de|,|-)?\\s*$")}}});var xb,SW=b(()=>{vo();xb=class extends Yt{patternBetween(){return/^\s*(à|a|au|-)\s*$/i}}});function SF(r){let e=r.toLowerCase();return TF[e]!==void 0?TF[e]:e==="une"||e==="un"?1:e.match(/quelques?/)?3:e.match(/demi-?/)?.5:parseFloat(e)}function IF(r){let e=r.toLowerCase();return e=e.replace(/(?:er)$/i,""),parseInt(e)}function PW(r){if(/AC/i.test(r))return r=r.replace(/BC/i,""),-parseInt(r);if(/AD/i.test(r)||/C/i.test(r))return r=r.replace(/[^\d]+/i,""),parseInt(r);let e=parseInt(r);return e<100&&(e>50?e=e+1900:e=e+2e3),e}function lA(r){let e={},t=r,n=DW.exec(t);for(;n;)Jre(e,n),t=t.substring(n[0].length),n=DW.exec(t);return e}function Jre(r,e){let t=SF(e[1]),n=Eb[e[2].toLowerCase()];r[n]=t}var _F,AF,TF,Eb,kF,DF,IW,FW,DW,aA,Wu=b(()=>{ze();_F={dimanche:0,dim:0,lundi:1,lun:1,mardi:2,mar:2,mercredi:3,mer:3,jeudi:4,jeu:4,vendredi:5,ven:5,samedi:6,sam:6},AF={janvier:1,jan:1,"jan.":1,janv:1,"janv.":1,f\u00E9vrier:2,f\u00E9v:2,"f\xE9v.":2,f\u00E9vr:2,"f\xE9vr.":2,fevrier:2,fev:2,"fev.":2,fevr:2,"fevr.":2,mars:3,mar:3,"mar.":3,avril:4,avr:4,"avr.":4,mai:5,juin:6,"juin.":6,jun:6,"jun.":6,juillet:7,juil:7,"juil.":7,jul:7,"jul.":7,ao\u00FBt:8,"ao\xFBt.":8,aout:8,"aout.":8,septembre:9,sep:9,"sep.":9,sept:9,"sept.":9,octobre:10,oct:10,"oct.":10,novembre:11,nov:11,"nov.":11,d\u00E9cembre:12,decembre:12,dec:12,"dec.":12,d\u00E9c:12,"d\xE9c.":12},TF={un:1,deux:2,trois:3,quatre:4,cinq:5,six:6,sept:7,huit:8,neuf:9,dix:10,onze:11,douze:12,treize:13},Eb={sec:"second",seconde:"second",secondes:"second",min:"minute",mins:"minute",minute:"minute",minutes:"minute",h:"hour",hr:"hour",hrs:"hour",heure:"hour",heures:"hour",jour:"day",jours:"day",semaine:"week",semaines:"week",mois:"month",trimestre:"quarter",trimestres:"quarter",ans:"year",ann\u00E9e:"year",ann\u00E9es:"year"},kF=`(?:${ee(TF)}|[0-9]+|[0-9]+\\.[0-9]+|une?\\b|quelques?|demi-?)`;DF="(?:[0-9]{1,2}(?:er)?)";IW="(?:[1-9][0-9]{0,3}\\s*(?:AC|AD|p\\.\\s*C(?:hr?)?\\.\\s*n\\.)|[1-2][0-9]{3}|[5-9][0-9])";FW=`(${kF})\\s{0,5}(${ee(Eb)})\\s{0,5}`,DW=new RegExp(FW,"i"),aA=Er("",FW)});var ene,tne,rne,Tb,MW=b(()=>{Wu();ze();fe();Ki();ene=new RegExp(`(?:(?:\\,|\\(|\\\uFF08)\\s*)?(?:(?:ce)\\s*)?(${ee(_F)})(?:\\s*(?:\\,|\\)|\\\uFF09))?(?:\\s*(dernier|prochain)\\s*)?(?=\\W|\\d|$)`,"i"),tne=1,rne=2,Tb=class extends U{innerPattern(){return ene}innerExtract(e,t){let n=t[tne].toLowerCase(),i=_F[n];if(i===void 0)return null;let o=t[rne];o=o||"",o=o.toLowerCase();let s=null;return o=="dernier"?s="last":o=="prochain"&&(s="next"),cr(e.reference,i,s)}}});var nne,ine,one,RW,$W,OW,_b,NW=b(()=>{pt();nne=new RegExp("(^|\\s|T)(?:(?:[\xE0a])\\s*)?(\\d{1,2})(?:h|:)?(?:(\\d{1,2})(?:m|:)?)?(?:(\\d{1,2})(?:s|:)?)?(?:\\s*(A\\.M\\.|P\\.M\\.|AM?|PM?))?(?=\\W|$)","i"),ine=new RegExp("^\\s*(\\-|\\\u2013|\\~|\\\u301C|[\xE0a]|\\?)\\s*(\\d{1,2})(?:h|:)?(?:(\\d{1,2})(?:m|:)?)?(?:(\\d{1,2})(?:s|:)?)?(?:\\s*(A\\.M\\.|P\\.M\\.|AM?|PM?))?(?=\\W|$)","i"),one=2,RW=3,$W=4,OW=5,_b=class r{pattern(e){return nne}extract(e,t){let n=e.createParsingResult(t.index+t[1].length,t[0].substring(t[1].length));if(n.text.match(/^\d{4}$/)||(n.start=r.extractTimeComponent(n.start.clone(),t),!n.start))return t.index+=t[0].length,null;let i=e.text.substring(t.index+t[0].length),o=ine.exec(i);return o&&(n.end=r.extractTimeComponent(n.start.clone(),o),n.end&&(n.text+=o[0])),n}static extractTimeComponent(e,t){let n=0,i=0,o=null;if(n=parseInt(t[one]),t[RW]!=null&&(i=parseInt(t[RW])),i>=60||n>24)return null;if(n>=12&&(o=G.PM),t[OW]!=null){if(n>12)return null;let s=t[OW][0].toLowerCase();s=="a"&&(o=G.AM,n==12&&(n=0)),s=="p"&&(o=G.PM,n!=12&&(n+=12))}if(e.assign("hour",n),e.assign("minute",i),o!==null?e.assign("meridiem",o):n<12?e.imply("meridiem",G.AM):e.imply("meridiem",G.PM),t[$W]!=null){let s=parseInt(t[$W]);if(s>=60)return null;e.assign("second",s)}return e}}});var sne,LW,BW,ane,UW,Ab,VW=b(()=>{zt();Wu();Wu();Wu();ze();fe();sne=new RegExp(`(?:on\\s*?)?(${DF})(?:\\s*(?:au|\\-|\\\u2013|jusqu'au?|\\s)\\s*(${DF}))?(?:-|/|\\s*(?:de)?\\s*)(${ee(AF)})(?:(?:-|/|,?\\s*)(${IW}(?![^\\s]\\d)))?(?=\\W|$)`,"i"),LW=1,BW=2,ane=3,UW=4,Ab=class extends U{innerPattern(){return sne}innerExtract(e,t){let n=e.createParsingResult(t.index,t[0]),i=AF[t[ane].toLowerCase()],o=IF(t[LW]);if(o>31)return t.index=t.index+t[LW].length,null;if(n.start.assign("month",i),n.start.assign("day",o),t[UW]){let s=PW(t[UW]);n.start.assign("year",s)}else{let s=ft(e.refDate,o,i);n.start.imply("year",s)}if(t[BW]){let s=IF(t[BW]);n.end=n.start.clone(),n.end.assign("day",s)}return n}}});var kb,qW=b(()=>{Wu();Le();fe();Bt();kb=class extends U{constructor(){super()}innerPattern(){return new RegExp(`il y a\\s*(${aA})(?=(?:\\W|$))`,"i")}innerExtract(e,t){let n=lA(t[1]),i=tt(n);return X.createRelativeFromReference(e.reference,i)}}});var Sb,WW=b(()=>{Wu();Le();fe();Sb=class extends U{innerPattern(){return new RegExp(`(?:dans|en|pour|pendant|de)\\s*(${aA})(?=\\W|$)`,"i")}innerExtract(e,t){let n=lA(t[1]);return X.createRelativeFromReference(e.reference,n)}}});var Db,zW=b(()=>{Wu();Le();fe();ze();Bt();Db=class extends U{constructor(){super()}innerPattern(){return new RegExp(`(?:les?|la|l'|du|des?)\\s*(${kF})?(?:\\s*(prochaine?s?|derni[e\xE8]re?s?|pass[\xE9e]e?s?|pr[\xE9e]c[\xE9e]dents?|suivante?s?))?\\s*(${ee(Eb)})(?:\\s*(prochaine?s?|derni[e\xE8]re?s?|pass[\xE9e]e?s?|pr[\xE9e]c[\xE9e]dents?|suivante?s?))?(?=\\W|$)`,"i")}innerExtract(e,t){let n=t[1]?SF(t[1]):1,i=Eb[t[3].toLowerCase()],o={};o[i]=n;let s=t[2]||t[4]||"";if(s=s.toLowerCase(),!!s)return(/derni[eè]re?s?/.test(s)||/pass[ée]e?s?/.test(s)||/pr[ée]c[ée]dents?/.test(s))&&(o=tt(o)),X.createRelativeFromReference(e.reference,o)}}});var MF={};Jr(MF,{Chrono:()=>Se,Meridiem:()=>G,ParsingComponents:()=>X,ParsingResult:()=>at,ReferenceWithTimezone:()=>ct,Weekday:()=>Oe,casual:()=>PF,createCasualConfiguration:()=>HW,createConfiguration:()=>FF,parse:()=>cne,parseDate:()=>une,strict:()=>lne});function cne(r,e,t){return PF.parse(r,e,t)}function une(r,e,t){return PF.parseDate(r,e,t)}function HW(r=!0){let e=FF(!1,r);return e.parsers.unshift(new yb),e.parsers.unshift(new bb),e.parsers.unshift(new Db),e}function FF(r=!0,e=!0){return Ht({parsers:[new vr(e),new Ab,new wb,new _b,new kb,new Sb,new Tb],refiners:[new Cb,new xb]},r)}var PF,lne,jW=b(()=>{Ei();ai();Le();pt();TW();_W();cs();AW();kW();SW();MW();NW();VW();qW();WW();zW();PF=new Se(HW()),lne=new Se(FF(!0))});function Ks(r){return String(r).replace(/\u2019/g,"'").replace(/\u201D/g,'"').replace(/\u3000/g," ").replace(/\uFFE5/g,"\xA5").replace(/[\uFF01\uFF03-\uFF06\uFF08\uFF09\uFF0C-\uFF19\uFF1C-\uFF1F\uFF21-\uFF3B\uFF3D\uFF3F\uFF41-\uFF5B\uFF5D\uFF5E]/g,dne)}function dne(r){return String.fromCharCode(r.charCodeAt(0)-65248)}function cA(r){let e=0;for(let t=0;t<r.length;t++){let n=r[t];n==="\u5341"?e=e===0?xl[n]:e*xl[n]:e+=xl[n]}return e}var xl,qm,Wm=b(()=>{xl={\u96F6:0,"\u3007":0,\u4E00:1,\u4E8C:2,\u4E09:3,\u56DB:4,\u4E94:5,\u516D:6,\u4E03:7,\u516B:8,\u4E5D:9,\u5341:10},qm={\u65E5:0,\u6708:1,\u706B:2,\u6C34:3,\u6728:4,\u91D1:5,\u571F:6}});var pne,GW,fne,RF,mne,hne,gne,Ib,YW=b(()=>{Wm();zt();pne=/(?:(?:([同今本])|((昭和|平成|令和)?([0-90-9]{1,4}|元)))年\s*)?([0-90-9]{1,2})月\s*([0-90-9]{1,2})日/i,GW=1,fne=2,RF=3,mne=4,hne=5,gne=6,Ib=class{pattern(){return pne}extract(e,t){let n=parseInt(Ks(t[hne])),i=parseInt(Ks(t[gne])),o=e.createParsingComponents({day:i,month:n});if(t[GW]&&t[GW].match("\u540C|\u4ECA|\u672C")&&o.assign("year",e.reference.getDateWithAdjustedTimezone().getFullYear()),t[fne]){let s=t[mne],a=s=="\u5143"?1:parseInt(Ks(s));t[RF]=="\u4EE4\u548C"?a+=2018:t[RF]=="\u5E73\u6210"?a+=1988:t[RF]=="\u662D\u548C"&&(a+=1925),o.assign("year",a)}else{let s=ft(e.refDate,i,n);o.imply("year",s)}return o}}});var Pb,KW=b(()=>{vo();Pb=class extends Yt{patternBetween(){return/^\s*(から|-|ー|-|~|~)\s*$/i}}});function yne(r){switch(r){case"\u304D\u3087\u3046":return"\u4ECA\u65E5";case"\u307B\u3093\u3058\u3064":return"\u672C\u65E5";case"\u304D\u306E\u3046":return"\u6628\u65E5";case"\u3042\u3057\u305F":return"\u660E\u65E5";case"\u3053\u3093\u3084":return"\u4ECA\u591C";case"\u3053\u3093\u3086\u3046":return"\u4ECA\u5915";case"\u3053\u3093\u3070\u3093":return"\u4ECA\u6669";case"\u3051\u3055":return"\u4ECA\u671D";default:return r}}var vne,Fb,QW=b(()=>{pt();si();vne=/今日|きょう|本日|ほんじつ|昨日|きのう|明日|あした|今夜|こんや|今夕|こんゆう|今晩|こんばん|今朝|けさ/i;Fb=class{pattern(){return vne}extract(e,t){let n=yne(t[0]),i=e.createParsingComponents();switch(n){case"\u6628\u65E5":return vn(e.reference);case"\u660E\u65E5":return yn(e.reference);case"\u672C\u65E5":case"\u4ECA\u65E5":return Tr(e.reference)}n=="\u4ECA\u591C"||n=="\u4ECA\u5915"||n=="\u4ECA\u6669"?(i.imply("hour",22),i.assign("meridiem",G.PM)):n.match("\u4ECA\u671D")&&(i.imply("hour",6),i.assign("meridiem",G.AM));let o=e.refDate;return i.assign("day",o.getDate()),i.assign("month",o.getMonth()+1),i.assign("year",o.getFullYear()),i}}});var bne,Mb,XW=b(()=>{Wm();Ki();bne=new RegExp("((?<prefix>\u524D\u306E|\u6B21\u306E|\u4ECA\u9031))?(?<weekday>"+Object.keys(qm).join("|")+")(?:\u66DC\u65E5|\u66DC)","i"),Mb=class{pattern(){return bne}extract(e,t){let n=t.groups.weekday,i=qm[n];if(i===void 0)return null;let o=t.groups.prefix||"",s=null;return o.match(/前の/)?s="last":o.match(/次の/)?s="next":o.match(/今週/)&&(s="this"),cr(e.reference,i,s)}}});var wne,ZW,Cne,xne,Rb,JW=b(()=>{zt();Wm();wne=new RegExp("([0-9\uFF10-\uFF19]{4}[\\/|\\\uFF0F])?([0-1\uFF10-\uFF11]{0,1}[0-9\uFF10-\uFF19]{1})(?:[\\/|\\\uFF0F]([0-3\uFF10-\uFF13]{0,1}[0-9\uFF10-\uFF19]{1}))","i"),ZW=1,Cne=2,xne=3,Rb=class{pattern(){return wne}extract(e,t){let n=e.createParsingComponents(),i=parseInt(Ks(t[Cne])),o=parseInt(Ks(t[xne]));if(i<1||i>12||o<1||o>31)return null;if(n.assign("day",o),n.assign("month",i),t[ZW]){let s=parseInt(Ks(t[ZW])),a=Gr(s);n.assign("year",a)}else{let s=ft(e.reference.instant,o,i);n.imply("year",s)}return n}}});function oz(r,e,t,n,i){let o=0,s=-1,a=r.createParsingComponents();if(o=parseInt(Ks(e)),isNaN(o)&&(o=cA(e)),o>24)return null;if(t){let l;if(t==="\u534A"?l=30:(l=parseInt(Ks(t)),isNaN(l)&&(l=cA(t))),l>=60)return null;a.assign("minute",l)}if(n){let l=parseInt(Ks(n));if(isNaN(l)&&(l=cA(n)),l>=60)return null;a.assign("second",l)}if(i){if(o>12)return null;let l=i;l==="\u5348\u524D"||l[0].toLowerCase()==="a"?(s=G.AM,o===12&&(o=0)):(l==="\u5348\u5F8C"||l[0].toLowerCase()==="p")&&(s=G.PM,o!=12&&(o+=12))}return a.assign("hour",o),s>=0?a.assign("meridiem",s):o<12?a.imply("meridiem",G.AM):a.imply("meridiem",G.PM),a}var Ene,Tne,ez,tz,rz,nz,iz,$b,sz=b(()=>{fe();pt();Wm();Ene=new RegExp("(?:(\u5348\u524D|\u5348\u5F8C|A.M.|P.M.|AM|PM))?(?:[\\s,\uFF0C\u3001]*)(?:([0-9\uFF10-\uFF19]+|["+Object.keys(xl).join("")+"]+)(?:\\s*)(?:\u6642(?!\u9593)|:|\uFF1A)(?:\\s*)([0-9\uFF10-\uFF19]+|\u534A|["+Object.keys(xl).join("")+"]+)?(?:\\s*)(?:\u5206|:|\uFF1A)?(?:\\s*)([0-9\uFF10-\uFF19]+|["+Object.keys(xl).join("")+"]+)?(?:\\s*)(?:\u79D2)?)(?:\\s*(A.M.|P.M.|AM?|PM?))?","i"),Tne=new RegExp("(?:^\\s*(?:\u304B\u3089|\\-|\\\u2013|\\\uFF0D|\\~|\\\u301C)\\s*)(?:(\u5348\u524D|\u5348\u5F8C|A.M.|P.M.|AM|PM))?(?:[\\s,\uFF0C\u3001]*)(?:([0-9\uFF10-\uFF19]+|["+Object.keys(xl).join("")+"]+)(?:\\s*)(?:\u6642|:|\uFF1A)(?:\\s*)([0-9\uFF10-\uFF19]+|\u534A|["+Object.keys(xl).join("")+"]+)?(?:\\s*)(?:\u5206|:|\uFF1A)?(?:\\s*)([0-9\uFF10-\uFF19]+|["+Object.keys(xl).join("")+"]+)?(?:\\s*)(?:\u79D2)?)(?:\\s*(A.M.|P.M.|AM?|PM?))?","i"),ez=1,tz=2,rz=3,nz=4,iz=5,$b=class extends U{innerPattern(){return Ene}innerExtract(e,t){if(t.index>0&&e.text[t.index-1].match(/\w/))return null;let n=e.createParsingResult(t.index,t[0]);return n.start=oz(e,t[tz],t[rz],t[nz],t[ez]??t[iz]),n.start?(t=Tne.exec(e.text.substring(n.index+n.text.length)),t?(n.text=n.text+t[0],n.end=oz(e,t[tz],t[rz],t[nz],t[ez]??t[iz]),n.end?(!n.end.isCertain("meridiem")&&n.start.isCertain("meridiem")&&(n.end.imply("meridiem",n.start.get("meridiem")),n.start.get("meridiem")===G.PM&&(n.start.get("hour")-12>n.end.get("hour")?n.end.imply("meridiem",G.AM):n.end.get("hour")<12&&n.end.assign("hour",n.end.get("hour")+12))),n.end.date().getTime()<n.start.date().getTime()&&n.end.imply("day",n.end.get("day")+1),n):null):n):(t.index+=t[0].length,null)}}});var Ob,az=b(()=>{yo();Ob=class extends Kt{patternBetween(){return/^\s*(の)?\s*$/i}}});var Nb,lz=b(()=>{Ys();Nb=class extends oi{mergeResults(e,t,n){let i=t.clone();return i.text=t.text+e+n.text,i.start.assign("weekday",n.start.get("weekday")),i.end&&i.end.assign("weekday",n.start.get("weekday")),i}shouldMergeResults(e,t,n){return t.start.isCertain("day")&&n.start.isOnlyWeekdayComponent()&&!n.start.isCertain("hour")&&e.match(/^[,、の]?\s*$/)!==null}}});var _ne,Lb,cz=b(()=>{Wm();Ki();_ne=new RegExp("(?:\\(|\\\uFF08)(?<weekday>"+Object.keys(qm).join("|")+")(?:\\)|\\\uFF09)","i"),Lb=class{pattern(){return _ne}extract(e,t){let n=t.groups.weekday,i=qm[n];return i===void 0?null:cr(e.reference,i)}}});var NF={};Jr(NF,{Chrono:()=>Se,Meridiem:()=>G,ParsingComponents:()=>X,ParsingResult:()=>at,ReferenceWithTimezone:()=>ct,Weekday:()=>Oe,casual:()=>$F,createCasualConfiguration:()=>uz,createConfiguration:()=>OF,parse:()=>kne,parseDate:()=>Sne,strict:()=>Ane});function kne(r,e,t){return $F.parse(r,e,t)}function Sne(r,e,t){return $F.parseDate(r,e,t)}function uz(){let r=OF(!1);return r.parsers.unshift(new Fb),r}function OF(r=!0){let e=Ht({parsers:[new Ib,new Mb,new Lb,new Rb,new $b],refiners:[new Nb,new Ob,new Pb]},r);return e.refiners=e.refiners.filter(t=>!(t instanceof Ac)),e}var $F,Ane,dz=b(()=>{YW();KW();QW();XW();JW();sz();az();ai();Le();pt();lz();cz();Ei();tA();$F=new Se(uz()),Ane=new Se(OF(!0))});function fz(r){if(r.match(/^[0-9]{1,4}$/)){let e=parseInt(r);return e<100&&(e>50?e=e+1900:e=e+2e3),e}return r.match(/a\.?\s*c\.?/i)?(r=r.replace(/a\.?\s*c\.?/i,""),-parseInt(r)):parseInt(r)}var LF,BF,pz,uA=b(()=>{LF={domingo:0,dom:0,segunda:1,"segunda-feira":1,seg:1,ter\u00E7a:2,"ter\xE7a-feira":2,ter:2,quarta:3,"quarta-feira":3,qua:3,quinta:4,"quinta-feira":4,qui:4,sexta:5,"sexta-feira":5,sex:5,s\u00E1bado:6,sabado:6,sab:6},BF={janeiro:1,jan:1,"jan.":1,fevereiro:2,fev:2,"fev.":2,mar\u00E7o:3,mar:3,"mar.":3,abril:4,abr:4,"abr.":4,maio:5,mai:5,"mai.":5,junho:6,jun:6,"jun.":6,julho:7,jul:7,"jul.":7,agosto:8,ago:8,"ago.":8,setembro:9,set:9,"set.":9,outubro:10,out:10,"out.":10,novembro:11,nov:11,"nov.":11,dezembro:12,dez:12,"dez.":12},pz="[0-9]{1,4}(?![^\\s]\\d)(?:\\s*[a|d]\\.?\\s*c\\.?|\\s*a\\.?\\s*d\\.?)?"});var Dne,Ine,Pne,Fne,Bb,mz=b(()=>{uA();ze();fe();Ki();Dne=new RegExp(`(?:(?:\\,|\\(|\\\uFF08)\\s*)?(?:(este|esta|passado|pr[o\xF3]ximo)\\s*)?(${ee(LF)})(?:\\s*(?:\\,|\\)|\\\uFF09))?(?:\\s*(este|esta|passado|pr[\xF3o]ximo)\\s*semana)?(?=\\W|\\d|$)`,"i"),Ine=1,Pne=2,Fne=3,Bb=class extends U{innerPattern(){return Dne}innerExtract(e,t){let n=t[Pne].toLowerCase(),i=LF[n];if(i===void 0)return null;let o=t[Ine],s=t[Fne],a=o||s||"";a=a.toLowerCase();let l=null;return a=="passado"?l="this":a=="pr\xF3ximo"||a=="proximo"?l="next":a=="este"&&(l="this"),cr(e.reference,i,l)}}});var Ub,hz=b(()=>{$a();Ub=class extends Yr{primaryPrefix(){return"(?:(?:ao?|\xE0s?|das|da|de|do)\\s*)?"}followingPhase(){return"\\s*(?:\\-|\\\u2013|\\~|\\\u301C|a(?:o)?|\\?)\\s*"}}});var Vb,gz=b(()=>{yo();Vb=class extends Kt{patternBetween(){return new RegExp("^\\s*(?:,|\xE0)?\\s*$")}}});var qb,vz=b(()=>{vo();qb=class extends Yt{patternBetween(){return/^\s*(?:-)\s*$/i}}});var Mne,yz,bz,Rne,wz,Wb,Cz=b(()=>{zt();uA();uA();ze();fe();Mne=new RegExp(`([0-9]{1,2})(?:\xBA|\xAA|\xB0)?(?:\\s*(?:desde|de|\\-|\\\u2013|ao?|\\s)\\s*([0-9]{1,2})(?:\xBA|\xAA|\xB0)?)?\\s*(?:de)?\\s*(?:-|/|\\s*(?:de|,)?\\s*)(${ee(BF)})(?:\\s*(?:de|,)?\\s*(${pz}))?(?=\\W|$)`,"i"),yz=1,bz=2,Rne=3,wz=4,Wb=class extends U{innerPattern(){return Mne}innerExtract(e,t){let n=e.createParsingResult(t.index,t[0]),i=BF[t[Rne].toLowerCase()],o=parseInt(t[yz]);if(o>31)return t.index=t.index+t[yz].length,null;if(n.start.assign("month",i),n.start.assign("day",o),t[wz]){let s=fz(t[wz]);n.start.assign("year",s)}else{let s=ft(e.refDate,o,i);n.start.imply("year",s)}if(t[bz]){let s=parseInt(t[bz]);n.end=n.start.clone(),n.end.assign("day",s)}return n}}});var zb,xz=b(()=>{fe();si();zb=class extends U{innerPattern(e){return/(agora|hoje|amanha|amanhã|ontem)(?=\W|$)/i}innerExtract(e,t){let n=t[0].toLowerCase(),i=e.createParsingComponents();switch(n){case"agora":return $r(e.reference);case"hoje":return Tr(e.reference);case"amanha":case"amanh\xE3":return yn(e.reference);case"ontem":return vn(e.reference)}return i}}});var Hb,Ez=b(()=>{pt();fe();on();Hb=class extends U{innerPattern(){return/(?:esta\s*)?(manha|manhã|tarde|meia-noite|meio-dia|noite)(?=\W|$)/i}innerExtract(e,t){let n=e.refDate,i=e.createParsingComponents();switch(t[1].toLowerCase()){case"tarde":i.imply("meridiem",G.PM),i.imply("hour",15),i.addTag("casualReference/afternoon");break;case"noite":i.imply("meridiem",G.PM),i.imply("hour",22),i.addTag("casualReference/evening");break;case"manha":case"manh\xE3":i.imply("meridiem",G.AM),i.imply("hour",6),i.addTag("casualReference/morning");break;case"meia-noite":let o=new Date(n.getTime());o.setDate(o.getDate()+1),nt(i,o),Lt(i,o),i.imply("hour",0),i.imply("minute",0),i.imply("second",0),i.addTag("casualReference/midnight");break;case"meio-dia":i.imply("meridiem",G.AM),i.imply("hour",12),i.addTag("casualReference/noon");break}return i}}});var qF={};Jr(qF,{Chrono:()=>Se,Meridiem:()=>G,ParsingComponents:()=>X,ParsingResult:()=>at,ReferenceWithTimezone:()=>ct,Weekday:()=>Oe,casual:()=>UF,createCasualConfiguration:()=>Tz,createConfiguration:()=>VF,parse:()=>One,parseDate:()=>Nne,strict:()=>$ne});function One(r,e,t){return UF.parse(r,e,t)}function Nne(r,e,t){return UF.parseDate(r,e,t)}function Tz(r=!0){let e=VF(!1,r);return e.parsers.push(new zb),e.parsers.push(new Hb),e}function VF(r=!0,e=!0){return Ht({parsers:[new vr(e),new Bb,new Ub,new Wb],refiners:[new Vb,new qb]},r)}var UF,$ne,_z=b(()=>{Ei();ai();Le();pt();cs();mz();hz();gz();vz();Cz();xz();Ez();UF=new Se(Tz()),$ne=new Se(VF(!0))});var jb,Az=b(()=>{vo();jb=class extends Yt{patternBetween(){return/^\s*(tot|-)\s*$/i}}});var Gb,kz=b(()=>{yo();Gb=class extends Kt{patternBetween(){return new RegExp("^\\s*(om|na|voor|in de|,|-)?\\s*$")}}});var Yb,Sz=b(()=>{fe();si();Yb=class extends U{innerPattern(e){return/(nu|vandaag|morgen|morgend|gisteren)(?=\W|$)/i}innerExtract(e,t){let n=t[0].toLowerCase(),i=e.createParsingComponents();switch(n){case"nu":return $r(e.reference);case"vandaag":return Tr(e.reference);case"morgen":case"morgend":return yn(e.reference);case"gisteren":return vn(e.reference)}return i}}});var Lne,Bne,Kb,Dz=b(()=>{pt();fe();on();Lne=1,Bne=2,Kb=class extends U{innerPattern(){return/(deze)?\s*(namiddag|avond|middernacht|ochtend|middag|'s middags|'s avonds|'s ochtends)(?=\W|$)/i}innerExtract(e,t){let n=e.refDate,i=e.createParsingComponents();switch(t[Lne]==="deze"&&(i.assign("day",e.refDate.getDate()),i.assign("month",e.refDate.getMonth()+1),i.assign("year",e.refDate.getFullYear())),t[Bne].toLowerCase()){case"namiddag":case"'s namiddags":i.imply("meridiem",G.PM),i.imply("hour",15),i.addTag("casualReference/afternoon");break;case"avond":case"'s avonds'":i.imply("meridiem",G.PM),i.imply("hour",20),i.addTag("casualReference/evening");break;case"middernacht":let o=new Date(n.getTime());o.setDate(o.getDate()+1),nt(i,o),Lt(i,o),i.imply("hour",0),i.imply("minute",0),i.imply("second",0),i.addTag("casualReference/midnight");break;case"ochtend":case"'s ochtends":i.imply("meridiem",G.AM),i.imply("hour",6),i.addTag("casualReference/morning");break;case"middag":case"'s middags":i.imply("meridiem",G.AM),i.imply("hour",12),i.addTag("casualReference/noon");break}return i}}});function Vne(r){let e=r.toLowerCase();return WF[e]!==void 0?WF[e]:e==="paar"?2:e==="half"||e.match(/halve?/)?.5:parseFloat(e.replace(",","."))}function GF(r){let e=r.toLowerCase();return zF[e]!==void 0?zF[e]:(e=e.replace(/(?:ste|de)$/i,""),parseInt(e))}function pA(r){if(/voor Christus/i.test(r))return r=r.replace(/voor Christus/i,""),-parseInt(r);if(/na Christus/i.test(r))return r=r.replace(/na Christus/i,""),parseInt(r);let e=parseInt(r);return Gr(e)}function zu(r){let e={},t=r,n=Iz.exec(t);for(;n;)qne(e,n),t=t.substring(n[0].length),n=Iz.exec(t);return e}function qne(r,e){let t=Vne(e[1]),n=Qb[e[2].toLowerCase()];r[n]=t}var HF,Pc,WF,zF,Qb,Une,jF,dA,Pz,Iz,El,us=b(()=>{ze();zt();HF={zondag:0,zon:0,"zon.":0,zo:0,"zo.":0,maandag:1,ma:1,"ma.":1,dinsdag:2,din:2,"din.":2,di:2,"di.":2,woensdag:3,woe:3,"woe.":3,wo:3,"wo.":3,donderdag:4,dond:4,"dond.":4,do:4,"do.":4,vrijdag:5,vrij:5,"vrij.":5,vr:5,"vr.":5,zaterdag:6,zat:6,"zat.":6,za:6,"za.":6},Pc={januari:1,jan:1,"jan.":1,februari:2,feb:2,"feb.":2,maart:3,mar:3,"mar.":3,mrt:3,"mrt.":3,april:4,apr:4,"apr.":4,mei:5,juni:6,jun:6,"jun.":6,juli:7,jul:7,"jul.":7,augustus:8,aug:8,"aug.":8,september:9,sep:9,"sep.":9,sept:9,"sept.":9,oktober:10,okt:10,"okt.":10,november:11,nov:11,"nov.":11,december:12,dec:12,"dec.":12},WF={een:1,twee:2,drie:3,vier:4,vijf:5,zes:6,zeven:7,acht:8,negen:9,tien:10,elf:11,twaalf:12},zF={eerste:1,tweede:2,derde:3,vierde:4,vijfde:5,zesde:6,zevende:7,achtste:8,negende:9,tiende:10,elfde:11,twaalfde:12,dertiende:13,veertiende:14,vijftiende:15,zestiende:16,zeventiende:17,achttiende:18,negentiende:19,twintigste:20,eenentwintigste:21,twee\u00EBntwintigste:22,drieentwintigste:23,vierentwintigste:24,vijfentwintigste:25,zesentwintigste:26,zevenentwintigste:27,achtentwintig:28,negenentwintig:29,dertigste:30,eenendertigste:31},Qb={sec:"second",second:"second",seconden:"second",min:"minute",mins:"minute",minute:"minute",minuut:"minute",minuten:"minute",minuutje:"minute",h:"hour",hr:"hour",hrs:"hour",uur:"hour",u:"hour",uren:"hour",dag:"day",dagen:"day",week:"week",weken:"week",maand:"month",maanden:"month",jaar:"year",jr:"year",jaren:"year"},Une=`(?:${ee(WF)}|[0-9]+|[0-9]+[\\.,][0-9]+|halve?|half|paar)`;jF=`(?:${ee(zF)}|[0-9]{1,2}(?:ste|de)?)`;dA="(?:[1-9][0-9]{0,3}\\s*(?:voor Christus|na Christus)|[1-2][0-9]{3}|[5-9][0-9])";Pz=`(${Une})\\s{0,5}(${ee(Qb)})\\s{0,5}`,Iz=new RegExp(Pz,"i"),El=Er("(?:(?:binnen|in)\\s*)?",Pz)});var Xb,Fz=b(()=>{us();Le();fe();Xb=class extends U{innerPattern(){return new RegExp("(?:binnen|in|binnen de|voor)\\s*("+El+")(?=\\W|$)","i")}innerExtract(e,t){let n=zu(t[1]);return X.createRelativeFromReference(e.reference,n)}}});var Wne,zne,Hne,jne,Zb,Mz=b(()=>{us();ze();fe();Ki();Wne=new RegExp(`(?:(?:\\,|\\(|\\\uFF08)\\s*)?(?:op\\s*?)?(?:(deze|vorige|volgende)\\s*(?:week\\s*)?)?(${ee(HF)})(?=\\W|$)`,"i"),zne=1,Hne=2,jne=3,Zb=class extends U{innerPattern(){return Wne}innerExtract(e,t){let n=t[Hne].toLowerCase(),i=HF[n],o=t[zne],s=t[jne],a=o||s;a=a||"",a=a.toLowerCase();let l=null;return a=="vorige"?l="last":a=="volgende"?l="next":a=="deze"&&(l="this"),cr(e.reference,i,l)}}});var Gne,Yne,Rz,$z,Oz,Jb,Nz=b(()=>{zt();us();us();us();ze();fe();Gne=new RegExp(`(?:on\\s*?)?(${jF})(?:\\s*(?:tot|\\-|\\\u2013|until|through|till|\\s)\\s*(${jF}))?(?:-|/|\\s*(?:of)?\\s*)(`+ee(Pc)+`)(?:(?:-|/|,?\\s*)(${dA}(?![^\\s]\\d)))?(?=\\W|$)`,"i"),Yne=3,Rz=1,$z=2,Oz=4,Jb=class extends U{innerPattern(){return Gne}innerExtract(e,t){let n=Pc[t[Yne].toLowerCase()],i=GF(t[Rz]);if(i>31)return t.index=t.index+t[Rz].length,null;let o=e.createParsingComponents({day:i,month:n});if(t[Oz]){let l=pA(t[Oz]);o.assign("year",l)}else{let l=ft(e.refDate,i,n);o.imply("year",l)}if(!t[$z])return o;let s=GF(t[$z]),a=e.createParsingResult(t.index,t[0]);return a.start=o,a.end=o.clone(),a.end.assign("day",s),a}}});var Kne,Qne,Lz,zm,Bz=b(()=>{us();zt();ze();us();fe();Kne=new RegExp(`(${ee(Pc)})\\s*(?:[,-]?\\s*(${dA})?)?(?=[^\\s\\w]|\\s+[^0-9]|\\s+$|$)`,"i"),Qne=1,Lz=2,zm=class extends U{innerPattern(){return Kne}innerExtract(e,t){let n=e.createParsingComponents();n.imply("day",1);let i=t[Qne],o=Pc[i.toLowerCase()];if(n.assign("month",o),t[Lz]){let s=pA(t[Lz]);n.assign("year",s)}else{let s=ft(e.refDate,1,o);n.imply("year",s)}return n}}});var Xne,Zne,Jne,ew,Uz=b(()=>{fe();Xne=new RegExp("([0-9]|0[1-9]|1[012])/([0-9]{4})","i"),Zne=1,Jne=2,ew=class extends U{innerPattern(){return Xne}innerExtract(e,t){let n=parseInt(t[Jne]),i=parseInt(t[Zne]);return e.createParsingComponents().imply("day",1).assign("month",i).assign("year",n)}}});var tw,Vz=b(()=>{$a();tw=class extends Yr{primaryPrefix(){return"(?:(?:om)\\s*)?"}followingPhase(){return"\\s*(?:\\-|\\\u2013|\\~|\\\u301C|om|\\?)\\s*"}primarySuffix(){return"(?:\\s*(?:uur))?(?!/)(?=\\W|$)"}extractPrimaryTimeComponents(e,t){return t[0].match(/^\s*\d{4}\s*$/)?null:super.extractPrimaryTimeComponents(e,t)}}});var eie,tie,rie,qz,nie,rw,Wz=b(()=>{us();ze();fe();eie=new RegExp(`([0-9]{4})[\\.\\/\\s](?:(${ee(Pc)})|([0-9]{1,2}))[\\.\\/\\s]([0-9]{1,2})(?=\\W|$)`,"i"),tie=1,rie=2,qz=3,nie=4,rw=class extends U{innerPattern(){return eie}innerExtract(e,t){let n=t[qz]?parseInt(t[qz]):Pc[t[rie].toLowerCase()];if(n<1||n>12)return null;let i=parseInt(t[tie]);return{day:parseInt(t[nie]),month:n,year:i}}}});var iie,oie,nw,zz=b(()=>{fe();pt();on();iie=1,oie=2,nw=class extends U{innerPattern(e){return/(gisteren|morgen|van)(ochtend|middag|namiddag|avond|nacht)(?=\W|$)/i}innerExtract(e,t){let n=t[iie].toLowerCase(),i=t[oie].toLowerCase(),o=e.createParsingComponents(),s=e.refDate;switch(n){case"gisteren":let a=new Date(s.getTime());a.setDate(a.getDate()-1),nt(o,a);break;case"van":nt(o,s);break;case"morgen":let l=new Date(s.getTime());l.setDate(l.getDate()+1),nt(o,l),Lt(o,l);break}switch(i){case"ochtend":o.imply("meridiem",G.AM),o.imply("hour",6);break;case"middag":o.imply("meridiem",G.AM),o.imply("hour",12);break;case"namiddag":o.imply("meridiem",G.PM),o.imply("hour",15);break;case"avond":o.imply("meridiem",G.PM),o.imply("hour",20);break}return o}}});var sie,aie,lie,iw,Hz=b(()=>{us();Le();fe();Bt();sie=new RegExp(`(dit|deze|vorig|afgelopen|(?:aan)?komend|over|\\+|-)e?\\s*(${El})(?=\\W|$)`,"i"),aie=1,lie=2,iw=class extends U{innerPattern(){return sie}innerExtract(e,t){let n=t[aie].toLowerCase(),i=zu(t[lie]);switch(n){case"vorig":case"afgelopen":case"-":i=tt(i);break}return X.createRelativeFromReference(e.reference,i)}}});var cie,uie,die,ow,jz=b(()=>{us();Le();fe();ze();cie=new RegExp(`(dit|deze|(?:aan)?komend|volgend|afgelopen|vorig)e?\\s*(${ee(Qb)})(?=\\s*)(?=\\W|$)`,"i"),uie=1,die=2,ow=class extends U{innerPattern(){return cie}innerExtract(e,t){let n=t[uie].toLowerCase(),i=t[die].toLowerCase(),o=Qb[i];if(n=="volgend"||n=="komend"||n=="aankomend"){let l={};return l[o]=1,X.createRelativeFromReference(e.reference,l)}if(n=="afgelopen"||n=="vorig"){let l={};return l[o]=-1,X.createRelativeFromReference(e.reference,l)}let s=e.createParsingComponents(),a=new Date(e.reference.instant.getTime());return i.match(/week/i)?(a.setDate(a.getDate()-a.getDay()),s.imply("day",a.getDate()),s.imply("month",a.getMonth()+1),s.imply("year",a.getFullYear())):i.match(/maand/i)?(a.setDate(1),s.imply("day",a.getDate()),s.assign("year",a.getFullYear()),s.assign("month",a.getMonth()+1)):i.match(/jaar/i)&&(a.setDate(1),a.setMonth(0),s.imply("day",a.getDate()),s.imply("month",a.getMonth()+1),s.assign("year",a.getFullYear())),s}}});var pie,fie,sw,Gz=b(()=>{us();Le();fe();Bt();pie=new RegExp("("+El+")(?:geleden|voor|eerder)(?=(?:\\W|$))","i"),fie=new RegExp("("+El+")geleden(?=(?:\\W|$))","i"),sw=class extends U{constructor(t){super();ae(this,"strictMode");this.strictMode=t}innerPattern(){return this.strictMode?fie:pie}innerExtract(t,n){let i=zu(n[1]),o=tt(i);return X.createRelativeFromReference(t.reference,o)}}});var mie,hie,gie,aw,Yz=b(()=>{us();Le();fe();mie=new RegExp("("+El+")(later|na|vanaf nu|voortaan|vooruit|uit)(?=(?:\\W|$))","i"),hie=new RegExp("("+El+")(later|vanaf nu)(?=(?:\\W|$))","i"),gie=1,aw=class extends U{constructor(t){super();ae(this,"strictMode");this.strictMode=t}innerPattern(){return this.strictMode?hie:mie}innerExtract(t,n){let i=zu(n[gie]);return X.createRelativeFromReference(t.reference,i)}}});var QF={};Jr(QF,{Chrono:()=>Se,Meridiem:()=>G,ParsingComponents:()=>X,ParsingResult:()=>at,ReferenceWithTimezone:()=>ct,Weekday:()=>Oe,casual:()=>YF,createCasualConfiguration:()=>Kz,createConfiguration:()=>KF,parse:()=>yie,parseDate:()=>bie,strict:()=>vie});function yie(r,e,t){return YF.parse(r,e,t)}function bie(r,e,t){return YF.parseDate(r,e,t)}function Kz(r=!0){let e=KF(!1,r);return e.parsers.unshift(new Yb),e.parsers.unshift(new Kb),e.parsers.unshift(new nw),e.parsers.unshift(new zm),e.parsers.unshift(new ow),e.parsers.unshift(new iw),e}function KF(r=!0,e=!0){return Ht({parsers:[new vr(e),new Xb,new Jb,new zm,new Zb,new rw,new ew,new tw(r),new sw(r),new aw(r)],refiners:[new Gb,new jb]},r)}var YF,vie,Qz=b(()=>{Ei();ai();Le();pt();Az();kz();Sz();Dz();cs();Fz();Mz();Nz();Bz();Uz();Vz();Wz();zz();Hz();jz();Gz();Yz();YF=new Se(Kz()),vie=new Se(KF(!0))});function Ro(r){let e=0;for(let t=0;t<r.length;t++){let n=r[t];n==="\u5341"?e=e===0?bn[n]:e*bn[n]:e+=bn[n]}return e}function Xz(r){let e="";for(let t=0;t<r.length;t++){let n=r[t];e=e+bn[n]}return parseInt(e)}var bn,Hm,xp=b(()=>{bn={\u96F6:0,"\u3007":0,\u4E00:1,\u4E8C:2,\u4E24:2,\u4E09:3,\u56DB:4,\u4E94:5,\u516D:6,\u4E03:7,\u516B:8,\u4E5D:9,\u5341:10},Hm={\u5929:0,\u65E5:0,\u4E00:1,\u4E8C:2,\u4E09:3,\u56DB:4,\u4E94:5,\u516D:6}});var XF,Zz,ZF,Ep,JF=b(()=>{fe();xp();XF=1,Zz=2,ZF=3,Ep=class extends U{innerPattern(){return new RegExp("(\\d{2,4}|["+Object.keys(bn).join("")+"]{4}|["+Object.keys(bn).join("")+"]{2})?(?:\\s*)(?:\u5E74)?(?:[\\s|,|\uFF0C]*)(\\d{1,2}|["+Object.keys(bn).join("")+"]{1,3})(?:\\s*)(?:\u6708)(?:\\s*)(\\d{1,2}|["+Object.keys(bn).join("")+"]{1,3})?(?:\\s*)(?:\u65E5|\u53F7)?")}innerExtract(e,t){let n=e.createParsingResult(t.index,t[0]),i=parseInt(t[Zz]);if(isNaN(i)&&(i=Ro(t[Zz])),n.start.assign("month",i),t[ZF]){let o=parseInt(t[ZF]);isNaN(o)&&(o=Ro(t[ZF])),n.start.assign("day",o)}else n.start.imply("day",e.refDate.getDate());if(t[XF]){let o=parseInt(t[XF]);isNaN(o)&&(o=Xz(t[XF])),n.start.assign("year",o)}else n.start.imply("year",e.refDate.getFullYear());return n}}});var wie,eM,Cie,Tp,tM=b(()=>{fe();Bt();xp();wie=new RegExp("(\\d+|["+Object.keys(bn).join("")+"]+|\u534A|\u51E0)(?:\\s*)(?:\u4E2A)?(\u79D2(?:\u949F)?|\u5206\u949F|\u5C0F\u65F6|\u949F|\u65E5|\u5929|\u661F\u671F|\u793C\u62DC|\u6708|\u5E74)(?:(?:\u4E4B|\u8FC7)?\u540E|(?:\u4E4B)?\u5185)","i"),eM=1,Cie=2,Tp=class extends U{innerPattern(){return wie}innerExtract(e,t){let n=e.createParsingResult(t.index,t[0]),i=parseInt(t[eM]);if(isNaN(i)&&(i=Ro(t[eM])),isNaN(i)){let c=t[eM];if(c==="\u51E0")i=3;else if(c==="\u534A")i=.5;else return null}let o={},a=t[Cie][0];if(a.match(/[日天星礼月年]/)){a=="\u65E5"||a=="\u5929"?o.day=i:a=="\u661F"||a=="\u793C"?o.week=i:a=="\u6708"?o.month=i:a=="\u5E74"&&(o.year=i);let c=vt(e.refDate,o);return n.start.assign("year",c.getFullYear()),n.start.assign("month",c.getMonth()+1),n.start.assign("day",c.getDate()),n}a=="\u79D2"?o.second=i:a=="\u5206"?o.minute=i:(a=="\u5C0F"||a=="\u949F")&&(o.hour=i);let l=vt(e.refDate,o);return n.start.imply("year",l.getFullYear()),n.start.imply("month",l.getMonth()+1),n.start.imply("day",l.getDate()),n.start.assign("hour",l.getHours()),n.start.assign("minute",l.getMinutes()),n.start.assign("second",l.getSeconds()),n}}});var xie,_p,rM=b(()=>{fe();xp();xie=new RegExp("(?<prefix>\u4E0A|\u4E0B|\u8FD9)(?:\u4E2A)?(?:\u661F\u671F|\u793C\u62DC|\u5468)(?<weekday>"+Object.keys(Hm).join("|")+")"),_p=class extends U{innerPattern(){return xie}innerExtract(e,t){let n=e.createParsingResult(t.index,t[0]),i=t.groups.weekday,o=Hm[i];if(o===void 0)return null;let s=null,a=t.groups.prefix;a=="\u4E0A"?s="last":a=="\u4E0B"?s="next":a=="\u8FD9"&&(s="this");let l=new Date(e.refDate.getTime()),c=!1,u=l.getDay();if(s=="last"||s=="past")l.setDate(l.getDate()+(o-7-u)),c=!0;else if(s=="next")l.setDate(l.getDate()+(o+7-u)),c=!0;else if(s=="this")l.setDate(l.getDate()+(o-u));else{let d=o-u;Math.abs(d-7)<Math.abs(d)&&(d-=7),Math.abs(d+7)<Math.abs(d)&&(d+=7),l.setDate(l.getDate()+d)}return n.start.assign("weekday",o),c?(n.start.assign("day",l.getDate()),n.start.assign("month",l.getMonth()+1),n.start.assign("year",l.getFullYear())):(n.start.imply("day",l.getDate()),n.start.imply("month",l.getMonth()+1),n.start.imply("year",l.getFullYear())),n}}});var Eie,Tie,lw,fA,mA,cw,hA,gA,Qs,jm,vA,Ap,nM=b(()=>{fe();xp();Eie=new RegExp("(?:\u4ECE|\u81EA)?(?:(\u4ECA|\u660E|\u524D|\u5927\u524D|\u540E|\u5927\u540E|\u6628)(\u65E9|\u671D|\u665A)|(\u4E0A(?:\u5348)|\u65E9(?:\u4E0A)|\u4E0B(?:\u5348)|\u665A(?:\u4E0A)|\u591C(?:\u665A)?|\u4E2D(?:\u5348)|\u51CC(?:\u6668))|(\u4ECA|\u660E|\u524D|\u5927\u524D|\u540E|\u5927\u540E|\u6628)(?:\u65E5|\u5929)(?:[\\s,\uFF0C]*)(?:(\u4E0A(?:\u5348)|\u65E9(?:\u4E0A)|\u4E0B(?:\u5348)|\u665A(?:\u4E0A)|\u591C(?:\u665A)?|\u4E2D(?:\u5348)|\u51CC(?:\u6668)))?)?(?:[\\s,\uFF0C]*)(?:(\\d+|["+Object.keys(bn).join("")+"]+)(?:\\s*)(?:\u70B9|\u65F6|:|\uFF1A)(?:\\s*)(\\d+|\u534A|\u6B63|\u6574|["+Object.keys(bn).join("")+"]+)?(?:\\s*)(?:\u5206|:|\uFF1A)?(?:\\s*)(\\d+|["+Object.keys(bn).join("")+"]+)?(?:\\s*)(?:\u79D2)?)(?:\\s*(A.M.|P.M.|AM?|PM?))?","i"),Tie=new RegExp("(?:^\\s*(?:\u5230|\u81F3|\\-|\\\u2013|\\~|\\\u301C)\\s*)(?:(\u4ECA|\u660E|\u524D|\u5927\u524D|\u540E|\u5927\u540E|\u6628)(\u65E9|\u671D|\u665A)|(\u4E0A(?:\u5348)|\u65E9(?:\u4E0A)|\u4E0B(?:\u5348)|\u665A(?:\u4E0A)|\u591C(?:\u665A)?|\u4E2D(?:\u5348)|\u51CC(?:\u6668))|(\u4ECA|\u660E|\u524D|\u5927\u524D|\u540E|\u5927\u540E|\u6628)(?:\u65E5|\u5929)(?:[\\s,\uFF0C]*)(?:(\u4E0A(?:\u5348)|\u65E9(?:\u4E0A)|\u4E0B(?:\u5348)|\u665A(?:\u4E0A)|\u591C(?:\u665A)?|\u4E2D(?:\u5348)|\u51CC(?:\u6668)))?)?(?:[\\s,\uFF0C]*)(?:(\\d+|["+Object.keys(bn).join("")+"]+)(?:\\s*)(?:\u70B9|\u65F6|:|\uFF1A)(?:\\s*)(\\d+|\u534A|\u6B63|\u6574|["+Object.keys(bn).join("")+"]+)?(?:\\s*)(?:\u5206|:|\uFF1A)?(?:\\s*)(\\d+|["+Object.keys(bn).join("")+"]+)?(?:\\s*)(?:\u79D2)?)(?:\\s*(A.M.|P.M.|AM?|PM?))?","i"),lw=1,fA=2,mA=3,cw=4,hA=5,gA=6,Qs=7,jm=8,vA=9,Ap=class extends U{patternLeftBoundary(){return"()"}innerPattern(){return Eie}innerExtract(e,t){if(t.index>0&&e.text[t.index-1].match(/\w/))return null;let n=e.createParsingResult(t.index,t[0]),i=new Date(e.reference.instant.getTime());if(t[lw]){let u=t[lw];u=="\u660E"?e.reference.instant.getHours()>1&&i.setDate(i.getDate()+1):u=="\u6628"?i.setDate(i.getDate()-1):u=="\u524D"?i.setDate(i.getDate()-2):u=="\u5927\u524D"?i.setDate(i.getDate()-3):u=="\u540E"?i.setDate(i.getDate()+2):u=="\u5927\u540E"&&i.setDate(i.getDate()+3),n.start.assign("day",i.getDate()),n.start.assign("month",i.getMonth()+1),n.start.assign("year",i.getFullYear())}else if(t[cw]){let u=t[cw];u=="\u660E"?i.setDate(i.getDate()+1):u=="\u6628"?i.setDate(i.getDate()-1):u=="\u524D"?i.setDate(i.getDate()-2):u=="\u5927\u524D"?i.setDate(i.getDate()-3):u=="\u540E"?i.setDate(i.getDate()+2):u=="\u5927\u540E"&&i.setDate(i.getDate()+3),n.start.assign("day",i.getDate()),n.start.assign("month",i.getMonth()+1),n.start.assign("year",i.getFullYear())}else n.start.imply("day",i.getDate()),n.start.imply("month",i.getMonth()+1),n.start.imply("year",i.getFullYear());let o=0,s=0,a=-1;if(t[jm]){let u=parseInt(t[jm]);if(isNaN(u)&&(u=Ro(t[jm])),u>=60)return null;n.start.assign("second",u)}if(o=parseInt(t[gA]),isNaN(o)&&(o=Ro(t[gA])),t[Qs]?t[Qs]=="\u534A"?s=30:t[Qs]=="\u6B63"||t[Qs]=="\u6574"?s=0:(s=parseInt(t[Qs]),isNaN(s)&&(s=Ro(t[Qs]))):o>100&&(s=o%100,o=Math.floor(o/100)),s>=60||o>24)return null;if(o>=12&&(a=1),t[vA]){if(o>12)return null;let u=t[vA][0].toLowerCase();u=="a"&&(a=0,o==12&&(o=0)),u=="p"&&(a=1,o!=12&&(o+=12))}else if(t[fA]){let d=t[fA][0];d=="\u65E9"?(a=0,o==12&&(o=0)):d=="\u665A"&&(a=1,o!=12&&(o+=12))}else if(t[mA]){let d=t[mA][0];d=="\u4E0A"||d=="\u65E9"||d=="\u51CC"?(a=0,o==12&&(o=0)):(d=="\u4E0B"||d=="\u665A")&&(a=1,o!=12&&(o+=12))}else if(t[hA]){let d=t[hA][0];d=="\u4E0A"||d=="\u65E9"||d=="\u51CC"?(a=0,o==12&&(o=0)):(d=="\u4E0B"||d=="\u665A")&&(a=1,o!=12&&(o+=12))}n.start.assign("hour",o),n.start.assign("minute",s),a>=0?n.start.assign("meridiem",a):o<12?n.start.imply("meridiem",0):n.start.imply("meridiem",1);let l=Tie.exec(e.text.substring(n.index+n.text.length));if(!l)return n.text.match(/^\d+$/)?null:n;let c=new Date(i.getTime());if((l[lw]||l[cw])&&(c=new Date(e.reference.instant.getTime())),n.end=e.createParsingComponents(),l[lw]){let u=l[lw];u=="\u660E"?e.reference.instant.getHours()>1&&c.setDate(c.getDate()+1):u=="\u6628"?c.setDate(c.getDate()-1):u=="\u524D"?c.setDate(c.getDate()-2):u=="\u5927\u524D"?c.setDate(c.getDate()-3):u=="\u540E"?c.setDate(c.getDate()+2):u=="\u5927\u540E"&&c.setDate(c.getDate()+3),n.end.assign("day",c.getDate()),n.end.assign("month",c.getMonth()+1),n.end.assign("year",c.getFullYear())}else if(l[cw]){let u=l[cw];u=="\u660E"?c.setDate(c.getDate()+1):u=="\u6628"?c.setDate(c.getDate()-1):u=="\u524D"?c.setDate(c.getDate()-2):u=="\u5927\u524D"?c.setDate(c.getDate()-3):u=="\u540E"?c.setDate(c.getDate()+2):u=="\u5927\u540E"&&c.setDate(c.getDate()+3),n.end.assign("day",c.getDate()),n.end.assign("month",c.getMonth()+1),n.end.assign("year",c.getFullYear())}else n.end.imply("day",c.getDate()),n.end.imply("month",c.getMonth()+1),n.end.imply("year",c.getFullYear());if(o=0,s=0,a=-1,l[jm]){let u=parseInt(l[jm]);if(isNaN(u)&&(u=Ro(l[jm])),u>=60)return null;n.end.assign("second",u)}if(o=parseInt(l[gA]),isNaN(o)&&(o=Ro(l[gA])),l[Qs]?l[Qs]=="\u534A"?s=30:l[Qs]=="\u6B63"||l[Qs]=="\u6574"?s=0:(s=parseInt(l[Qs]),isNaN(s)&&(s=Ro(l[Qs]))):o>100&&(s=o%100,o=Math.floor(o/100)),s>=60||o>24)return null;if(o>=12&&(a=1),l[vA]){if(o>12)return null;let u=l[vA][0].toLowerCase();u=="a"&&(a=0,o==12&&(o=0)),u=="p"&&(a=1,o!=12&&(o+=12)),n.start.isCertain("meridiem")||(a==0?(n.start.imply("meridiem",0),n.start.get("hour")==12&&n.start.assign("hour",0)):(n.start.imply("meridiem",1),n.start.get("hour")!=12&&n.start.assign("hour",n.start.get("hour")+12)))}else if(l[fA]){let d=l[fA][0];d=="\u65E9"?(a=0,o==12&&(o=0)):d=="\u665A"&&(a=1,o!=12&&(o+=12))}else if(l[mA]){let d=l[mA][0];d=="\u4E0A"||d=="\u65E9"||d=="\u51CC"?(a=0,o==12&&(o=0)):(d=="\u4E0B"||d=="\u665A")&&(a=1,o!=12&&(o+=12))}else if(l[hA]){let d=l[hA][0];d=="\u4E0A"||d=="\u65E9"||d=="\u51CC"?(a=0,o==12&&(o=0)):(d=="\u4E0B"||d=="\u665A")&&(a=1,o!=12&&(o+=12))}return n.text=n.text+l[0],n.end.assign("hour",o),n.end.assign("minute",s),a>=0?n.end.assign("meridiem",a):n.start.isCertain("meridiem")&&n.start.get("meridiem")==1&&n.start.get("hour")>o?n.end.imply("meridiem",0):o>12&&n.end.imply("meridiem",1),n.end.date().getTime()<n.start.date().getTime()&&n.end.imply("day",n.end.get("day")+1),n}}});var _ie,kp,iM=b(()=>{fe();xp();_ie=new RegExp("(?:\u661F\u671F|\u793C\u62DC|\u5468)(?<weekday>"+Object.keys(Hm).join("|")+")"),kp=class extends U{innerPattern(){return _ie}innerExtract(e,t){let n=e.createParsingResult(t.index,t[0]),i=t.groups.weekday,o=Hm[i];if(o===void 0)return null;let s=new Date(e.refDate.getTime()),a=!1,l=s.getDay(),c=o-l;return Math.abs(c-7)<Math.abs(c)&&(c-=7),Math.abs(c+7)<Math.abs(c)&&(c+=7),s.setDate(s.getDate()+c),n.start.assign("weekday",o),a?(n.start.assign("day",s.getDate()),n.start.assign("month",s.getMonth()+1),n.start.assign("year",s.getFullYear())):(n.start.imply("day",s.getDate()),n.start.imply("month",s.getMonth()+1),n.start.imply("year",s.getFullYear())),n}}});var Aie,Jz,kie,e3,t3,Sie,Sp,oM=b(()=>{fe();Aie=1,Jz=2,kie=3,e3=4,t3=5,Sie=6,Sp=class extends U{innerPattern(e){return new RegExp("(\u800C\u5BB6|\u7ACB(?:\u523B|\u5373)|\u5373\u523B)|(\u4ECA|\u660E|\u524D|\u5927\u524D|\u5F8C|\u5927\u5F8C|\u807D|\u6628|\u5C0B|\u7434)(\u65E9|\u671D|\u665A)|(\u4E0A(?:\u5348|\u665D)|\u671D(?:\u65E9)|\u65E9(?:\u4E0A)|\u4E0B(?:\u5348|\u665D)|\u664F(?:\u665D)|\u665A(?:\u4E0A)|\u591C(?:\u665A)?|\u4E2D(?:\u5348)|\u51CC(?:\u6668))|(\u4ECA|\u660E|\u524D|\u5927\u524D|\u5F8C|\u5927\u5F8C|\u807D|\u6628|\u5C0B|\u7434)(?:\u65E5|\u5929)(?:[\\s|,|\uFF0C]*)(?:(\u4E0A(?:\u5348|\u665D)|\u671D(?:\u65E9)|\u65E9(?:\u4E0A)|\u4E0B(?:\u5348|\u665D)|\u664F(?:\u665D)|\u665A(?:\u4E0A)|\u591C(?:\u665A)?|\u4E2D(?:\u5348)|\u51CC(?:\u6668)))?","i")}innerExtract(e,t){let n=t.index,i=e.createParsingResult(n,t[0]),o=e.refDate,s=new Date(o.getTime());if(t[Aie])i.start.imply("hour",o.getHours()),i.start.imply("minute",o.getMinutes()),i.start.imply("second",o.getSeconds()),i.start.imply("millisecond",o.getMilliseconds());else if(t[Jz]){let a=t[Jz],l=t[kie];a=="\u660E"||a=="\u807D"?o.getHours()>1&&s.setDate(s.getDate()+1):a=="\u6628"||a=="\u5C0B"||a=="\u7434"?s.setDate(s.getDate()-1):a=="\u524D"?s.setDate(s.getDate()-2):a=="\u5927\u524D"?s.setDate(s.getDate()-3):a=="\u5F8C"?s.setDate(s.getDate()+2):a=="\u5927\u5F8C"&&s.setDate(s.getDate()+3),l=="\u65E9"||l=="\u671D"?i.start.imply("hour",6):l=="\u665A"&&(i.start.imply("hour",22),i.start.imply("meridiem",1))}else if(t[e3]){let l=t[e3][0];l=="\u65E9"||l=="\u671D"||l=="\u4E0A"?i.start.imply("hour",6):l=="\u4E0B"||l=="\u664F"?(i.start.imply("hour",15),i.start.imply("meridiem",1)):l=="\u4E2D"?(i.start.imply("hour",12),i.start.imply("meridiem",1)):l=="\u591C"||l=="\u665A"?(i.start.imply("hour",22),i.start.imply("meridiem",1)):l=="\u51CC"&&i.start.imply("hour",0)}else if(t[t3]){let a=t[t3];a=="\u660E"||a=="\u807D"?o.getHours()>1&&s.setDate(s.getDate()+1):a=="\u6628"||a=="\u5C0B"||a=="\u7434"?s.setDate(s.getDate()-1):a=="\u524D"?s.setDate(s.getDate()-2):a=="\u5927\u524D"?s.setDate(s.getDate()-3):a=="\u5F8C"?s.setDate(s.getDate()+2):a=="\u5927\u5F8C"&&s.setDate(s.getDate()+3);let l=t[Sie];if(l){let c=l[0];c=="\u65E9"||c=="\u671D"||c=="\u4E0A"?i.start.imply("hour",6):c=="\u4E0B"||c=="\u664F"?(i.start.imply("hour",15),i.start.imply("meridiem",1)):c=="\u4E2D"?(i.start.imply("hour",12),i.start.imply("meridiem",1)):c=="\u591C"||c=="\u665A"?(i.start.imply("hour",22),i.start.imply("meridiem",1)):c=="\u51CC"&&i.start.imply("hour",0)}}return i.start.assign("day",s.getDate()),i.start.assign("month",s.getMonth()+1),i.start.assign("year",s.getFullYear()),i}}});function $o(r){let e=0;for(let t=0;t<r.length;t++){let n=r[t];n==="\u5341"?e=e===0?wn[n]:e*wn[n]:e+=wn[n]}return e}function r3(r){let e="";for(let t=0;t<r.length;t++){let n=r[t];e=e+wn[n]}return parseInt(e)}var wn,Gm,Dp=b(()=>{wn={\u96F6:0,\u4E00:1,\u4E8C:2,\u5169:2,\u4E09:3,\u56DB:4,\u4E94:5,\u516D:6,\u4E03:7,\u516B:8,\u4E5D:9,\u5341:10,\u5EFF:20,\u5345:30},Gm={\u5929:0,\u65E5:0,\u4E00:1,\u4E8C:2,\u4E09:3,\u56DB:4,\u4E94:5,\u516D:6}});var sM,n3,aM,Ip,lM=b(()=>{fe();Dp();sM=1,n3=2,aM=3,Ip=class extends U{innerPattern(){return new RegExp("(\\d{2,4}|["+Object.keys(wn).join("")+"]{4}|["+Object.keys(wn).join("")+"]{2})?(?:\\s*)(?:\u5E74)?(?:[\\s|,|\uFF0C]*)(\\d{1,2}|["+Object.keys(wn).join("")+"]{1,2})(?:\\s*)(?:\u6708)(?:\\s*)(\\d{1,2}|["+Object.keys(wn).join("")+"]{1,2})?(?:\\s*)(?:\u65E5|\u865F)?")}innerExtract(e,t){let n=e.createParsingResult(t.index,t[0]),i=parseInt(t[n3]);if(isNaN(i)&&(i=$o(t[n3])),n.start.assign("month",i),t[aM]){let o=parseInt(t[aM]);isNaN(o)&&(o=$o(t[aM])),n.start.assign("day",o)}else n.start.imply("day",e.refDate.getDate());if(t[sM]){let o=parseInt(t[sM]);isNaN(o)&&(o=r3(t[sM])),n.start.assign("year",o)}else n.start.imply("year",e.refDate.getFullYear());return n}}});var Die,cM,Iie,Pp,uM=b(()=>{fe();Bt();Dp();Die=new RegExp("(\\d+|["+Object.keys(wn).join("")+"]+|\u534A|\u5E7E)(?:\\s*)(?:\u500B)?(\u79D2(?:\u9418)?|\u5206\u9418|\u5C0F\u6642|\u9418|\u65E5|\u5929|\u661F\u671F|\u79AE\u62DC|\u6708|\u5E74)(?:(?:\u4E4B|\u904E)?\u5F8C|(?:\u4E4B)?\u5167)","i"),cM=1,Iie=2,Pp=class extends U{innerPattern(){return Die}innerExtract(e,t){let n=e.createParsingResult(t.index,t[0]),i=parseInt(t[cM]);if(isNaN(i)&&(i=$o(t[cM])),isNaN(i)){let c=t[cM];if(c==="\u5E7E")i=3;else if(c==="\u534A")i=.5;else return null}let o={},a=t[Iie][0];if(a.match(/[日天星禮月年]/)){a=="\u65E5"||a=="\u5929"?o.day=i:a=="\u661F"||a=="\u79AE"?o.week=i:a=="\u6708"?o.month=i:a=="\u5E74"&&(o.year=i);let c=vt(e.refDate,o);return n.start.assign("year",c.getFullYear()),n.start.assign("month",c.getMonth()+1),n.start.assign("day",c.getDate()),n}a=="\u79D2"?o.second=i:a=="\u5206"?o.minute=i:(a=="\u5C0F"||a=="\u9418")&&(o.hour=i);let l=vt(e.refDate,o);return n.start.imply("year",l.getFullYear()),n.start.imply("month",l.getMonth()+1),n.start.imply("day",l.getDate()),n.start.assign("hour",l.getHours()),n.start.assign("minute",l.getMinutes()),n.start.assign("second",l.getSeconds()),n}}});var Pie,Fp,dM=b(()=>{fe();Dp();Pie=new RegExp("(?<prefix>\u4E0A|\u4ECA|\u4E0B|\u9019|\u5462)(?:\u500B)?(?:\u661F\u671F|\u79AE\u62DC|\u9031)(?<weekday>"+Object.keys(Gm).join("|")+")"),Fp=class extends U{innerPattern(){return Pie}innerExtract(e,t){let n=e.createParsingResult(t.index,t[0]),i=t.groups.weekday,o=Gm[i];if(o===void 0)return null;let s=null,a=t.groups.prefix;a=="\u4E0A"?s="last":a=="\u4E0B"?s="next":(a=="\u4ECA"||a=="\u9019"||a=="\u5462")&&(s="this");let l=new Date(e.refDate.getTime()),c=!1,u=l.getDay();if(s=="last"||s=="past")l.setDate(l.getDate()+(o-7-u)),c=!0;else if(s=="next")l.setDate(l.getDate()+(o+7-u)),c=!0;else if(s=="this")l.setDate(l.getDate()+(o-u));else{let d=o-u;Math.abs(d-7)<Math.abs(d)&&(d-=7),Math.abs(d+7)<Math.abs(d)&&(d+=7),l.setDate(l.getDate()+d)}return n.start.assign("weekday",o),c?(n.start.assign("day",l.getDate()),n.start.assign("month",l.getMonth()+1),n.start.assign("year",l.getFullYear())):(n.start.imply("day",l.getDate()),n.start.imply("month",l.getMonth()+1),n.start.imply("year",l.getFullYear())),n}}});var Fie,Mie,uw,yA,bA,dw,wA,CA,Xs,Ym,xA,Mp,pM=b(()=>{fe();Dp();Fie=new RegExp("(?:\u7531|\u5F9E|\u81EA)?(?:(\u4ECA|\u660E|\u524D|\u5927\u524D|\u5F8C|\u5927\u5F8C|\u807D|\u6628|\u5C0B|\u7434)(\u65E9|\u671D|\u665A)|(\u4E0A(?:\u5348|\u665D)|\u671D(?:\u65E9)|\u65E9(?:\u4E0A)|\u4E0B(?:\u5348|\u665D)|\u664F(?:\u665D)|\u665A(?:\u4E0A)|\u591C(?:\u665A)?|\u4E2D(?:\u5348)|\u51CC(?:\u6668))|(\u4ECA|\u660E|\u524D|\u5927\u524D|\u5F8C|\u5927\u5F8C|\u807D|\u6628|\u5C0B|\u7434)(?:\u65E5|\u5929)(?:[\\s,\uFF0C]*)(?:(\u4E0A(?:\u5348|\u665D)|\u671D(?:\u65E9)|\u65E9(?:\u4E0A)|\u4E0B(?:\u5348|\u665D)|\u664F(?:\u665D)|\u665A(?:\u4E0A)|\u591C(?:\u665A)?|\u4E2D(?:\u5348)|\u51CC(?:\u6668)))?)?(?:[\\s,\uFF0C]*)(?:(\\d+|["+Object.keys(wn).join("")+"]+)(?:\\s*)(?:\u9EDE|\u6642|:|\uFF1A)(?:\\s*)(\\d+|\u534A|\u6B63|\u6574|["+Object.keys(wn).join("")+"]+)?(?:\\s*)(?:\u5206|:|\uFF1A)?(?:\\s*)(\\d+|["+Object.keys(wn).join("")+"]+)?(?:\\s*)(?:\u79D2)?)(?:\\s*(A.M.|P.M.|AM?|PM?))?","i"),Mie=new RegExp("(?:^\\s*(?:\u5230|\u81F3|\\-|\\\u2013|\\~|\\\u301C)\\s*)(?:(\u4ECA|\u660E|\u524D|\u5927\u524D|\u5F8C|\u5927\u5F8C|\u807D|\u6628|\u5C0B|\u7434)(\u65E9|\u671D|\u665A)|(\u4E0A(?:\u5348|\u665D)|\u671D(?:\u65E9)|\u65E9(?:\u4E0A)|\u4E0B(?:\u5348|\u665D)|\u664F(?:\u665D)|\u665A(?:\u4E0A)|\u591C(?:\u665A)?|\u4E2D(?:\u5348)|\u51CC(?:\u6668))|(\u4ECA|\u660E|\u524D|\u5927\u524D|\u5F8C|\u5927\u5F8C|\u807D|\u6628|\u5C0B|\u7434)(?:\u65E5|\u5929)(?:[\\s,\uFF0C]*)(?:(\u4E0A(?:\u5348|\u665D)|\u671D(?:\u65E9)|\u65E9(?:\u4E0A)|\u4E0B(?:\u5348|\u665D)|\u664F(?:\u665D)|\u665A(?:\u4E0A)|\u591C(?:\u665A)?|\u4E2D(?:\u5348)|\u51CC(?:\u6668)))?)?(?:[\\s,\uFF0C]*)(?:(\\d+|["+Object.keys(wn).join("")+"]+)(?:\\s*)(?:\u9EDE|\u6642|:|\uFF1A)(?:\\s*)(\\d+|\u534A|\u6B63|\u6574|["+Object.keys(wn).join("")+"]+)?(?:\\s*)(?:\u5206|:|\uFF1A)?(?:\\s*)(\\d+|["+Object.keys(wn).join("")+"]+)?(?:\\s*)(?:\u79D2)?)(?:\\s*(A.M.|P.M.|AM?|PM?))?","i"),uw=1,yA=2,bA=3,dw=4,wA=5,CA=6,Xs=7,Ym=8,xA=9,Mp=class extends U{patternLeftBoundary(){return"()"}innerPattern(){return Fie}innerExtract(e,t){if(t.index>0&&e.text[t.index-1].match(/\w/))return null;let n=e.createParsingResult(t.index,t[0]),i=new Date(e.reference.instant.getTime());if(t[uw]){let w=t[uw];w=="\u660E"||w=="\u807D"?e.refDate.getHours()>1&&i.setDate(i.getDate()+1):w=="\u6628"||w=="\u5C0B"||w=="\u7434"?i.setDate(i.getDate()-1):w=="\u524D"?i.setDate(i.getDate()-2):w=="\u5927\u524D"?i.setDate(i.getDate()-3):w=="\u5F8C"?i.setDate(i.getDate()+2):w=="\u5927\u5F8C"&&i.setDate(i.getDate()+3),n.start.assign("day",i.getDate()),n.start.assign("month",i.getMonth()+1),n.start.assign("year",i.getFullYear())}else if(t[dw]){let w=t[dw];w=="\u660E"||w=="\u807D"?i.setDate(i.getDate()+1):w=="\u6628"||w=="\u5C0B"||w=="\u7434"?i.setDate(i.getDate()-1):w=="\u524D"?i.setDate(i.getDate()-2):w=="\u5927\u524D"?i.setDate(i.getDate()-3):w=="\u5F8C"?i.setDate(i.getDate()+2):w=="\u5927\u5F8C"&&i.setDate(i.getDate()+3),n.start.assign("day",i.getDate()),n.start.assign("month",i.getMonth()+1),n.start.assign("year",i.getFullYear())}else n.start.imply("day",i.getDate()),n.start.imply("month",i.getMonth()+1),n.start.imply("year",i.getFullYear());let o=0,s=0,a=-1;if(t[Ym]){var l=parseInt(t[Ym]);if(isNaN(l)&&(l=$o(t[Ym])),l>=60)return null;n.start.assign("second",l)}if(o=parseInt(t[CA]),isNaN(o)&&(o=$o(t[CA])),t[Xs]?t[Xs]=="\u534A"?s=30:t[Xs]=="\u6B63"||t[Xs]=="\u6574"?s=0:(s=parseInt(t[Xs]),isNaN(s)&&(s=$o(t[Xs]))):o>100&&(s=o%100,o=Math.floor(o/100)),s>=60||o>24)return null;if(o>=12&&(a=1),t[xA]){if(o>12)return null;var c=t[xA][0].toLowerCase();c=="a"&&(a=0,o==12&&(o=0)),c=="p"&&(a=1,o!=12&&(o+=12))}else if(t[yA]){var u=t[yA],d=u[0];d=="\u671D"||d=="\u65E9"?(a=0,o==12&&(o=0)):d=="\u665A"&&(a=1,o!=12&&(o+=12))}else if(t[bA]){var f=t[bA],p=f[0];p=="\u4E0A"||p=="\u671D"||p=="\u65E9"||p=="\u51CC"?(a=0,o==12&&(o=0)):(p=="\u4E0B"||p=="\u664F"||p=="\u665A")&&(a=1,o!=12&&(o+=12))}else if(t[wA]){var m=t[wA],v=m[0];v=="\u4E0A"||v=="\u671D"||v=="\u65E9"||v=="\u51CC"?(a=0,o==12&&(o=0)):(v=="\u4E0B"||v=="\u664F"||v=="\u665A")&&(a=1,o!=12&&(o+=12))}n.start.assign("hour",o),n.start.assign("minute",s),a>=0?n.start.assign("meridiem",a):o<12?n.start.imply("meridiem",0):n.start.imply("meridiem",1);let g=Mie.exec(e.text.substring(n.index+n.text.length));if(!g)return n.text.match(/^\d+$/)?null:n;let y=new Date(i.getTime());if((g[uw]||g[dw])&&(y=new Date(e.reference.instant.getTime())),n.end=e.createParsingComponents(),g[uw]){let w=g[uw];w=="\u660E"||w=="\u807D"?e.refDate.getHours()>1&&y.setDate(y.getDate()+1):w=="\u6628"||w=="\u5C0B"||w=="\u7434"?y.setDate(y.getDate()-1):w=="\u524D"?y.setDate(y.getDate()-2):w=="\u5927\u524D"?y.setDate(y.getDate()-3):w=="\u5F8C"?y.setDate(y.getDate()+2):w=="\u5927\u5F8C"&&y.setDate(y.getDate()+3),n.end.assign("day",y.getDate()),n.end.assign("month",y.getMonth()+1),n.end.assign("year",y.getFullYear())}else if(g[dw]){let w=g[dw];w=="\u660E"||w=="\u807D"?y.setDate(y.getDate()+1):w=="\u6628"||w=="\u5C0B"||w=="\u7434"?y.setDate(y.getDate()-1):w=="\u524D"?y.setDate(y.getDate()-2):w=="\u5927\u524D"?y.setDate(y.getDate()-3):w=="\u5F8C"?y.setDate(y.getDate()+2):w=="\u5927\u5F8C"&&y.setDate(y.getDate()+3),n.end.assign("day",y.getDate()),n.end.assign("month",y.getMonth()+1),n.end.assign("year",y.getFullYear())}else n.end.imply("day",y.getDate()),n.end.imply("month",y.getMonth()+1),n.end.imply("year",y.getFullYear());if(o=0,s=0,a=-1,g[Ym]){let w=parseInt(g[Ym]);if(isNaN(w)&&(w=$o(g[Ym])),w>=60)return null;n.end.assign("second",w)}if(o=parseInt(g[CA]),isNaN(o)&&(o=$o(g[CA])),g[Xs]?g[Xs]=="\u534A"?s=30:g[Xs]=="\u6B63"||g[Xs]=="\u6574"?s=0:(s=parseInt(g[Xs]),isNaN(s)&&(s=$o(g[Xs]))):o>100&&(s=o%100,o=Math.floor(o/100)),s>=60||o>24)return null;if(o>=12&&(a=1),g[xA]){if(o>12)return null;var c=g[xA][0].toLowerCase();c=="a"&&(a=0,o==12&&(o=0)),c=="p"&&(a=1,o!=12&&(o+=12)),n.start.isCertain("meridiem")||(a==0?(n.start.imply("meridiem",0),n.start.get("hour")==12&&n.start.assign("hour",0)):(n.start.imply("meridiem",1),n.start.get("hour")!=12&&n.start.assign("hour",n.start.get("hour")+12)))}else if(g[yA]){var d=g[yA][0];d=="\u671D"||d=="\u65E9"?(a=0,o==12&&(o=0)):d=="\u665A"&&(a=1,o!=12&&(o+=12))}else if(g[bA]){var p=g[bA][0];p=="\u4E0A"||p=="\u671D"||p=="\u65E9"||p=="\u51CC"?(a=0,o==12&&(o=0)):(p=="\u4E0B"||p=="\u664F"||p=="\u665A")&&(a=1,o!=12&&(o+=12))}else if(g[wA]){var v=g[wA][0];v=="\u4E0A"||v=="\u671D"||v=="\u65E9"||v=="\u51CC"?(a=0,o==12&&(o=0)):(v=="\u4E0B"||v=="\u664F"||v=="\u665A")&&(a=1,o!=12&&(o+=12))}return n.text=n.text+g[0],n.end.assign("hour",o),n.end.assign("minute",s),a>=0?n.end.assign("meridiem",a):n.start.isCertain("meridiem")&&n.start.get("meridiem")==1&&n.start.get("hour")>o?n.end.imply("meridiem",0):o>12&&n.end.imply("meridiem",1),n.end.date().getTime()<n.start.date().getTime()&&n.end.imply("day",n.end.get("day")+1),n}}});var Rie,Rp,fM=b(()=>{fe();Dp();Rie=new RegExp("(?:\u661F\u671F|\u79AE\u62DC|\u9031)(?<weekday>"+Object.keys(Gm).join("|")+")"),Rp=class extends U{innerPattern(){return Rie}innerExtract(e,t){let n=e.createParsingResult(t.index,t[0]),i=t.groups.weekday,o=Gm[i];if(o===void 0)return null;let s=new Date(e.refDate.getTime()),a=!1,l=s.getDay(),c=o-l;return Math.abs(c-7)<Math.abs(c)&&(c-=7),Math.abs(c+7)<Math.abs(c)&&(c+=7),s.setDate(s.getDate()+c),n.start.assign("weekday",o),a?(n.start.assign("day",s.getDate()),n.start.assign("month",s.getMonth()+1),n.start.assign("year",s.getFullYear())):(n.start.imply("day",s.getDate()),n.start.imply("month",s.getMonth()+1),n.start.imply("year",s.getFullYear())),n}}});var $p,mM=b(()=>{vo();$p=class extends Yt{patternBetween(){return/^\s*(至|到|\-|\~|~|-|ー)\s*$/i}}});var Op,hM=b(()=>{yo();Op=class extends Kt{patternBetween(){return/^\s*$/i}}});var $ie,gM,Oie,pw,i3=b(()=>{fe();Bt();Dp();$ie=new RegExp("(\\d+|["+Object.keys(wn).join("")+"]+|\u534A|\u5E7E)(?:\\s*)(?:\u500B)?(\u79D2(?:\u9418)?|\u5206\u9418|\u5C0F\u6642|\u9418|\u65E5|\u5929|\u661F\u671F|\u79AE\u62DC|\u6708|\u5E74)(?:\u4E4B)?\u524D","i"),gM=1,Oie=2,pw=class extends U{innerPattern(){return $ie}innerExtract(e,t){let n=e.createParsingResult(t.index,t[0]),i=parseInt(t[gM]);if(isNaN(i)&&(i=$o(t[gM])),isNaN(i)){let c=t[gM];if(c==="\u5E7E")i=3;else if(c==="\u534A")i=.5;else return null}let o={},a=t[Oie][0];if(a.match(/[日天星禮月年]/)){a=="\u65E5"||a=="\u5929"?o.day=i:a=="\u661F"||a=="\u79AE"?o.week=i:a=="\u6708"?o.month=i:a=="\u5E74"&&(o.year=i),o=tt(o);let c=vt(e.refDate,o);return n.start.assign("year",c.getFullYear()),n.start.assign("month",c.getMonth()+1),n.start.assign("day",c.getDate()),n}a=="\u79D2"?o.second=i:a=="\u5206"?o.minute=i:(a=="\u5C0F"||a=="\u9418")&&(o.hour=i),o=tt(o);let l=vt(e.refDate,o);return n.start.imply("year",l.getFullYear()),n.start.imply("month",l.getMonth()+1),n.start.imply("day",l.getDate()),n.start.assign("hour",l.getHours()),n.start.assign("minute",l.getMinutes()),n.start.assign("second",l.getSeconds()),n}}});var wM={};Jr(wM,{Chrono:()=>Se,Meridiem:()=>G,ParsingComponents:()=>X,ParsingResult:()=>at,ReferenceWithTimezone:()=>ct,Weekday:()=>Oe,casual:()=>vM,createCasualConfiguration:()=>yM,createConfiguration:()=>bM,hant:()=>Nie,parse:()=>Bie,parseDate:()=>Uie,strict:()=>Lie});function Bie(r,e,t){return vM.parse(r,e,t)}function Uie(r,e,t){return vM.parseDate(r,e,t)}function yM(){let r=bM();return r.parsers.unshift(new Sp),r}function bM(){let r=Ht({parsers:[new Ip,new Fp,new Rp,new Mp,new Pp,new pw],refiners:[new $p,new Op]});return r.refiners=r.refiners.filter(e=>!(e instanceof Oa)),r}var Nie,vM,Lie,o3=b(()=>{Yy();Ei();ai();Le();pt();oM();lM();uM();i3();dM();pM();fM();mM();hM();Nie=new Se(yM()),vM=new Se(yM()),Lie=new Se(bM())});var Vie,s3,qie,a3,l3,Wie,fw,c3=b(()=>{fe();Vie=1,s3=2,qie=3,a3=4,l3=5,Wie=6,fw=class extends U{innerPattern(e){return new RegExp("(\u73B0\u5728|\u7ACB(?:\u523B|\u5373)|\u5373\u523B)|(\u4ECA|\u660E|\u524D|\u5927\u524D|\u540E|\u5927\u540E|\u6628)(\u65E9|\u665A)|(\u4E0A(?:\u5348)|\u65E9(?:\u4E0A)|\u4E0B(?:\u5348)|\u665A(?:\u4E0A)|\u591C(?:\u665A)?|\u4E2D(?:\u5348)|\u51CC(?:\u6668))|(\u4ECA|\u660E|\u524D|\u5927\u524D|\u540E|\u5927\u540E|\u6628)(?:\u65E5|\u5929)(?:[\\s|,|\uFF0C]*)(?:(\u4E0A(?:\u5348)|\u65E9(?:\u4E0A)|\u4E0B(?:\u5348)|\u665A(?:\u4E0A)|\u591C(?:\u665A)?|\u4E2D(?:\u5348)|\u51CC(?:\u6668)))?","i")}innerExtract(e,t){let n=t.index,i=e.createParsingResult(n,t[0]),o=e.refDate,s=new Date(o.getTime());if(t[Vie])i.start.imply("hour",o.getHours()),i.start.imply("minute",o.getMinutes()),i.start.imply("second",o.getSeconds()),i.start.imply("millisecond",o.getMilliseconds());else if(t[s3]){let a=t[s3],l=t[qie];a=="\u660E"?o.getHours()>1&&s.setDate(s.getDate()+1):a=="\u6628"?s.setDate(s.getDate()-1):a=="\u524D"?s.setDate(s.getDate()-2):a=="\u5927\u524D"?s.setDate(s.getDate()-3):a=="\u540E"?s.setDate(s.getDate()+2):a=="\u5927\u540E"&&s.setDate(s.getDate()+3),l=="\u65E9"?i.start.imply("hour",6):l=="\u665A"&&(i.start.imply("hour",22),i.start.imply("meridiem",1))}else if(t[a3]){let l=t[a3][0];l=="\u65E9"||l=="\u4E0A"?i.start.imply("hour",6):l=="\u4E0B"?(i.start.imply("hour",15),i.start.imply("meridiem",1)):l=="\u4E2D"?(i.start.imply("hour",12),i.start.imply("meridiem",1)):l=="\u591C"||l=="\u665A"?(i.start.imply("hour",22),i.start.imply("meridiem",1)):l=="\u51CC"&&i.start.imply("hour",0)}else if(t[l3]){let a=t[l3];a=="\u660E"?o.getHours()>1&&s.setDate(s.getDate()+1):a=="\u6628"?s.setDate(s.getDate()-1):a=="\u524D"?s.setDate(s.getDate()-2):a=="\u5927\u524D"?s.setDate(s.getDate()-3):a=="\u540E"?s.setDate(s.getDate()+2):a=="\u5927\u540E"&&s.setDate(s.getDate()+3);let l=t[Wie];if(l){let c=l[0];c=="\u65E9"||c=="\u4E0A"?i.start.imply("hour",6):c=="\u4E0B"?(i.start.imply("hour",15),i.start.imply("meridiem",1)):c=="\u4E2D"?(i.start.imply("hour",12),i.start.imply("meridiem",1)):c=="\u591C"||c=="\u665A"?(i.start.imply("hour",22),i.start.imply("meridiem",1)):c=="\u51CC"&&i.start.imply("hour",0)}}return i.start.assign("day",s.getDate()),i.start.assign("month",s.getMonth()+1),i.start.assign("year",s.getFullYear()),i}}});var zie,CM,Hie,mw,u3=b(()=>{fe();Bt();xp();zie=new RegExp("(\\d+|["+Object.keys(bn).join("")+"]+|\u534A|\u51E0)(?:\\s*)(?:\u4E2A)?(\u79D2(?:\u949F)?|\u5206\u949F|\u5C0F\u65F6|\u949F|\u65E5|\u5929|\u661F\u671F|\u793C\u62DC|\u6708|\u5E74)(?:\u4E4B)?\u524D","i"),CM=1,Hie=2,mw=class extends U{innerPattern(){return zie}innerExtract(e,t){let n=e.createParsingResult(t.index,t[0]),i=parseInt(t[CM]);if(isNaN(i)&&(i=Ro(t[CM])),isNaN(i)){let c=t[CM];if(c==="\u51E0")i=3;else if(c==="\u534A")i=.5;else return null}let o={},a=t[Hie][0];if(a.match(/[日天星礼月年]/)){a=="\u65E5"||a=="\u5929"?o.day=i:a=="\u661F"||a=="\u793C"?o.week=i:a=="\u6708"?o.month=i:a=="\u5E74"&&(o.year=i),o=tt(o);let c=vt(e.refDate,o);return n.start.assign("year",c.getFullYear()),n.start.assign("month",c.getMonth()+1),n.start.assign("day",c.getDate()),n}a=="\u79D2"?o.second=i:a=="\u5206"?o.minute=i:(a=="\u5C0F"||a=="\u949F")&&(o.hour=i),o=tt(o);let l=vt(e.refDate,o);return n.start.imply("year",l.getFullYear()),n.start.imply("month",l.getMonth()+1),n.start.imply("day",l.getDate()),n.start.assign("hour",l.getHours()),n.start.assign("minute",l.getMinutes()),n.start.assign("second",l.getSeconds()),n}}});var hw,d3=b(()=>{vo();hw=class extends Yt{patternBetween(){return/^\s*(至|到|-|~|~|-|ー)\s*$/i}}});var gw,p3=b(()=>{yo();gw=class extends Kt{patternBetween(){return/^\s*$/i}}});var _M={};Jr(_M,{Chrono:()=>Se,Meridiem:()=>G,ParsingComponents:()=>X,ParsingResult:()=>at,ReferenceWithTimezone:()=>ct,Weekday:()=>Oe,casual:()=>xM,createCasualConfiguration:()=>EM,createConfiguration:()=>TM,hans:()=>jie,parse:()=>Yie,parseDate:()=>Kie,strict:()=>Gie});function Yie(r,e,t){return xM.parse(r,e,t)}function Kie(r,e,t){return xM.parseDate(r,e,t)}function EM(){let r=TM();return r.parsers.unshift(new fw),r}function TM(){let r=Ht({parsers:[new Ep,new _p,new kp,new Ap,new Tp,new mw],refiners:[new hw,new gw]});return r.refiners=r.refiners.filter(e=>!(e instanceof Oa)),r}var jie,xM,Gie,f3=b(()=>{Yy();Ei();ai();Le();pt();c3();JF();tM();u3();rM();nM();iM();d3();p3();jie=new Se(EM()),xM=new Se(EM()),Gie=new Se(TM())});var SM={};Jr(SM,{Chrono:()=>Se,Meridiem:()=>G,ParsingComponents:()=>X,ParsingResult:()=>at,ReferenceWithTimezone:()=>ct,Weekday:()=>Oe,casual:()=>AM,createCasualConfiguration:()=>m3,createConfiguration:()=>kM,hans:()=>_M,hant:()=>wM,parse:()=>Xie,parseDate:()=>Zie,strict:()=>Qie});function Xie(r,e,t){return AM.parse(r,e,t)}function Zie(r,e,t){return AM.parseDate(r,e,t)}function m3(){let r=kM();return r.parsers.unshift(new Sp),r}function kM(){let r=Ht({parsers:[new Ip,new Ep,new Fp,new _p,new Rp,new kp,new Mp,new Ap,new Pp,new Tp],refiners:[new $p,new Op]});return r.refiners=r.refiners.filter(e=>!(e instanceof Oa)),r}var AM,Qie,h3=b(()=>{Ei();ai();Le();pt();Yy();JF();tM();rM();nM();iM();oM();lM();uM();dM();pM();fM();mM();hM();o3();f3();AM=new Se(m3()),Qie=new Se(kM())});function eoe(r){let e=r.toLowerCase();return IM[e]!==void 0?IM[e]:e.match(/несколько/)?3:e.match(/пол/)?.5:e.match(/пар/)?2:e===""?1:parseFloat(e)}function $M(r){let e=r.toLowerCase();return PM[e]!==void 0?PM[e]:parseInt(e)}function TA(r){if(/(год|года|г|г.)/i.test(r)&&(r=r.replace(/(год|года|г|г.)/i,"")),/(до н.э.|до н. э.)/i.test(r))return r=r.replace(/(до н.э.|до н. э.)/i,""),-parseInt(r);if(/(н. э.|н.э.)/i.test(r))return r=r.replace(/(н. э.|н.э.)/i,""),parseInt(r);let e=parseInt(r);return Gr(e)}function Xm(r){let e={},t=r,n=g3.exec(t);for(;n;)toe(e,n),t=t.substring(n[0].length).trim(),n=g3.exec(t);return e}function toe(r,e){let t=eoe(e[1]),n=vw[e[2].toLowerCase()];r[n]=t}var ds,FM,MM,Km,IM,PM,vw,Jie,RM,DM,EA,v3,g3,Qm,ps=b(()=>{ze();zt();ds={leftBoundary:"([^\\p{L}\\p{N}_]|^)",rightBoundary:"(?=[^\\p{L}\\p{N}_]|$)",flags:"iu"},FM={\u0432\u043E\u0441\u043A\u0440\u0435\u0441\u0435\u043D\u044C\u0435:0,\u0432\u043E\u0441\u043A\u0440\u0435\u0441\u0435\u043D\u044C\u044F:0,\u0432\u0441\u043A:0,"\u0432\u0441\u043A.":0,\u043F\u043E\u043D\u0435\u0434\u0435\u043B\u044C\u043D\u0438\u043A:1,\u043F\u043E\u043D\u0435\u0434\u0435\u043B\u044C\u043D\u0438\u043A\u0430:1,\u043F\u043D:1,"\u043F\u043D.":1,\u0432\u0442\u043E\u0440\u043D\u0438\u043A:2,\u0432\u0442\u043E\u0440\u043D\u0438\u043A\u0430:2,\u0432\u0442:2,"\u0432\u0442.":2,\u0441\u0440\u0435\u0434\u0430:3,\u0441\u0440\u0435\u0434\u044B:3,\u0441\u0440\u0435\u0434\u0443:3,\u0441\u0440:3,"\u0441\u0440.":3,\u0447\u0435\u0442\u0432\u0435\u0440\u0433:4,\u0447\u0435\u0442\u0432\u0435\u0440\u0433\u0430:4,\u0447\u0442:4,"\u0447\u0442.":4,\u043F\u044F\u0442\u043D\u0438\u0446\u0430:5,\u043F\u044F\u0442\u043D\u0438\u0446\u0443:5,\u043F\u044F\u0442\u043D\u0438\u0446\u044B:5,\u043F\u0442:5,"\u043F\u0442.":5,\u0441\u0443\u0431\u0431\u043E\u0442\u0430:6,\u0441\u0443\u0431\u0431\u043E\u0442\u0443:6,\u0441\u0443\u0431\u0431\u043E\u0442\u044B:6,\u0441\u0431:6,"\u0441\u0431.":6},MM={\u044F\u043D\u0432\u0430\u0440\u044C:1,\u044F\u043D\u0432\u0430\u0440\u044F:1,\u044F\u043D\u0432\u0430\u0440\u0435:1,\u0444\u0435\u0432\u0440\u0430\u043B\u044C:2,\u0444\u0435\u0432\u0440\u0430\u043B\u044F:2,\u0444\u0435\u0432\u0440\u0430\u043B\u0435:2,\u043C\u0430\u0440\u0442:3,\u043C\u0430\u0440\u0442\u0430:3,\u043C\u0430\u0440\u0442\u0435:3,\u0430\u043F\u0440\u0435\u043B\u044C:4,\u0430\u043F\u0440\u0435\u043B\u044F:4,\u0430\u043F\u0440\u0435\u043B\u0435:4,\u043C\u0430\u0439:5,\u043C\u0430\u044F:5,\u043C\u0430\u0435:5,\u0438\u044E\u043D\u044C:6,\u0438\u044E\u043D\u044F:6,\u0438\u044E\u043D\u0435:6,\u0438\u044E\u043B\u044C:7,\u0438\u044E\u043B\u044F:7,\u0438\u044E\u043B\u0435:7,\u0430\u0432\u0433\u0443\u0441\u0442:8,\u0430\u0432\u0433\u0443\u0441\u0442\u0430:8,\u0430\u0432\u0433\u0443\u0441\u0442\u0435:8,\u0441\u0435\u043D\u0442\u044F\u0431\u0440\u044C:9,\u0441\u0435\u043D\u0442\u044F\u0431\u0440\u044F:9,\u0441\u0435\u043D\u0442\u044F\u0431\u0440\u0435:9,\u043E\u043A\u0442\u044F\u0431\u0440\u044C:10,\u043E\u043A\u0442\u044F\u0431\u0440\u044F:10,\u043E\u043A\u0442\u044F\u0431\u0440\u0435:10,\u043D\u043E\u044F\u0431\u0440\u044C:11,\u043D\u043E\u044F\u0431\u0440\u044F:11,\u043D\u043E\u044F\u0431\u0440\u0435:11,\u0434\u0435\u043A\u0430\u0431\u0440\u044C:12,\u0434\u0435\u043A\u0430\u0431\u0440\u044F:12,\u0434\u0435\u043A\u0430\u0431\u0440\u0435:12},Km={...MM,\u044F\u043D\u0432:1,"\u044F\u043D\u0432.":1,\u0444\u0435\u0432:2,"\u0444\u0435\u0432.":2,\u043C\u0430\u0440:3,"\u043C\u0430\u0440.":3,\u0430\u043F\u0440:4,"\u0430\u043F\u0440.":4,\u0430\u0432\u0433:8,"\u0430\u0432\u0433.":8,\u0441\u0435\u043D:9,"\u0441\u0435\u043D.":9,\u043E\u043A\u0442:10,"\u043E\u043A\u0442.":10,\u043D\u043E\u044F:11,"\u043D\u043E\u044F.":11,\u0434\u0435\u043A:12,"\u0434\u0435\u043A.":12},IM={\u043E\u0434\u0438\u043D:1,\u043E\u0434\u043D\u0430:1,\u043E\u0434\u043D\u043E\u0439:1,\u043E\u0434\u043D\u0443:1,\u0434\u0432\u0435:2,\u0434\u0432\u0430:2,\u0434\u0432\u0443\u0445:2,\u0442\u0440\u0438:3,\u0442\u0440\u0435\u0445:3,\u0442\u0440\u0451\u0445:3,\u0447\u0435\u0442\u044B\u0440\u0435:4,\u0447\u0435\u0442\u044B\u0440\u0435\u0445:4,\u0447\u0435\u0442\u044B\u0440\u0451\u0445:4,\u043F\u044F\u0442\u044C:5,\u043F\u044F\u0442\u0438:5,\u0448\u0435\u0441\u0442\u044C:6,\u0448\u0435\u0441\u0442\u0438:6,\u0441\u0435\u043C\u044C:7,\u0441\u0435\u043C\u0438:7,\u0432\u043E\u0441\u0435\u043C\u044C:8,\u0432\u043E\u0441\u044C\u043C\u0438:8,\u0434\u0435\u0432\u044F\u0442\u044C:9,\u0434\u0435\u0432\u044F\u0442\u0438:9,\u0434\u0435\u0441\u044F\u0442\u044C:10,\u0434\u0435\u0441\u044F\u0442\u0438:10,\u043E\u0434\u0438\u043D\u043D\u0430\u0434\u0446\u0430\u0442\u044C:11,\u043E\u0434\u0438\u043D\u043D\u0430\u0434\u0446\u0430\u0442\u0438:11,\u0434\u0432\u0435\u043D\u0430\u0434\u0446\u0430\u0442\u044C:12,\u0434\u0432\u0435\u043D\u0430\u0434\u0446\u0430\u0442\u0438:12},PM={\u043F\u0435\u0440\u0432\u043E\u0435:1,\u043F\u0435\u0440\u0432\u043E\u0433\u043E:1,\u0432\u0442\u043E\u0440\u043E\u0435:2,\u0432\u0442\u043E\u0440\u043E\u0433\u043E:2,\u0442\u0440\u0435\u0442\u044C\u0435:3,\u0442\u0440\u0435\u0442\u044C\u0435\u0433\u043E:3,\u0447\u0435\u0442\u0432\u0435\u0440\u0442\u043E\u0435:4,\u0447\u0435\u0442\u0432\u0435\u0440\u0442\u043E\u0433\u043E:4,\u043F\u044F\u0442\u043E\u0435:5,\u043F\u044F\u0442\u043E\u0433\u043E:5,\u0448\u0435\u0441\u0442\u043E\u0435:6,\u0448\u0435\u0441\u0442\u043E\u0433\u043E:6,\u0441\u0435\u0434\u044C\u043C\u043E\u0435:7,\u0441\u0435\u0434\u044C\u043C\u043E\u0433\u043E:7,\u0432\u043E\u0441\u044C\u043C\u043E\u0435:8,\u0432\u043E\u0441\u044C\u043C\u043E\u0433\u043E:8,\u0434\u0435\u0432\u044F\u0442\u043E\u0435:9,\u0434\u0435\u0432\u044F\u0442\u043E\u0433\u043E:9,\u0434\u0435\u0441\u044F\u0442\u043E\u0435:10,\u0434\u0435\u0441\u044F\u0442\u043E\u0433\u043E:10,\u043E\u0434\u0438\u043D\u043D\u0430\u0434\u0446\u0430\u0442\u043E\u0435:11,\u043E\u0434\u0438\u043D\u043D\u0430\u0434\u0446\u0430\u0442\u043E\u0433\u043E:11,\u0434\u0432\u0435\u043D\u0430\u0434\u0446\u0430\u0442\u043E\u0435:12,\u0434\u0432\u0435\u043D\u0430\u0434\u0446\u0430\u0442\u043E\u0433\u043E:12,\u0442\u0440\u0438\u043D\u0430\u0434\u0446\u0430\u0442\u043E\u0435:13,\u0442\u0440\u0438\u043D\u0430\u0434\u0446\u0430\u0442\u043E\u0433\u043E:13,\u0447\u0435\u0442\u044B\u0440\u043D\u0430\u0434\u0446\u0430\u0442\u043E\u0435:14,\u0447\u0435\u0442\u044B\u0440\u043D\u0430\u0434\u0446\u0430\u0442\u043E\u0433\u043E:14,\u043F\u044F\u0442\u043D\u0430\u0434\u0446\u0430\u0442\u043E\u0435:15,\u043F\u044F\u0442\u043D\u0430\u0434\u0446\u0430\u0442\u043E\u0433\u043E:15,\u0448\u0435\u0441\u0442\u043D\u0430\u0434\u0446\u0430\u0442\u043E\u0435:16,\u0448\u0435\u0441\u0442\u043D\u0430\u0434\u0446\u0430\u0442\u043E\u0433\u043E:16,\u0441\u0435\u043C\u043D\u0430\u0434\u0446\u0430\u0442\u043E\u0435:17,\u0441\u0435\u043C\u043D\u0430\u0434\u0446\u0430\u0442\u043E\u0433\u043E:17,\u0432\u043E\u0441\u0435\u043C\u043D\u0430\u0434\u0446\u0430\u0442\u043E\u0435:18,\u0432\u043E\u0441\u0435\u043C\u043D\u0430\u0434\u0446\u0430\u0442\u043E\u0433\u043E:18,\u0434\u0435\u0432\u044F\u0442\u043D\u0430\u0434\u0446\u0430\u0442\u043E\u0435:19,\u0434\u0435\u0432\u044F\u0442\u043D\u0430\u0434\u0446\u0430\u0442\u043E\u0433\u043E:19,\u0434\u0432\u0430\u0434\u0446\u0430\u0442\u043E\u0435:20,\u0434\u0432\u0430\u0434\u0446\u0430\u0442\u043E\u0433\u043E:20,"\u0434\u0432\u0430\u0434\u0446\u0430\u0442\u044C \u043F\u0435\u0440\u0432\u043E\u0435":21,"\u0434\u0432\u0430\u0434\u0446\u0430\u0442\u044C \u043F\u0435\u0440\u0432\u043E\u0433\u043E":21,"\u0434\u0432\u0430\u0434\u0446\u0430\u0442\u044C \u0432\u0442\u043E\u0440\u043E\u0435":22,"\u0434\u0432\u0430\u0434\u0446\u0430\u0442\u044C \u0432\u0442\u043E\u0440\u043E\u0433\u043E":22,"\u0434\u0432\u0430\u0434\u0446\u0430\u0442\u044C \u0442\u0440\u0435\u0442\u044C\u0435":23,"\u0434\u0432\u0430\u0434\u0446\u0430\u0442\u044C \u0442\u0440\u0435\u0442\u044C\u0435\u0433\u043E":23,"\u0434\u0432\u0430\u0434\u0446\u0430\u0442\u044C \u0447\u0435\u0442\u0432\u0435\u0440\u0442\u043E\u0435":24,"\u0434\u0432\u0430\u0434\u0446\u0430\u0442\u044C \u0447\u0435\u0442\u0432\u0435\u0440\u0442\u043E\u0433\u043E":24,"\u0434\u0432\u0430\u0434\u0446\u0430\u0442\u044C \u043F\u044F\u0442\u043E\u0435":25,"\u0434\u0432\u0430\u0434\u0446\u0430\u0442\u044C \u043F\u044F\u0442\u043E\u0433\u043E":25,"\u0434\u0432\u0430\u0434\u0446\u0430\u0442\u044C \u0448\u0435\u0441\u0442\u043E\u0435":26,"\u0434\u0432\u0430\u0434\u0446\u0430\u0442\u044C \u0448\u0435\u0441\u0442\u043E\u0433\u043E":26,"\u0434\u0432\u0430\u0434\u0446\u0430\u0442\u044C \u0441\u0435\u0434\u044C\u043C\u043E\u0435":27,"\u0434\u0432\u0430\u0434\u0446\u0430\u0442\u044C \u0441\u0435\u0434\u044C\u043C\u043E\u0433\u043E":27,"\u0434\u0432\u0430\u0434\u0446\u0430\u0442\u044C \u0432\u043E\u0441\u044C\u043C\u043E\u0435":28,"\u0434\u0432\u0430\u0434\u0446\u0430\u0442\u044C \u0432\u043E\u0441\u044C\u043C\u043E\u0433\u043E":28,"\u0434\u0432\u0430\u0434\u0446\u0430\u0442\u044C \u0434\u0435\u0432\u044F\u0442\u043E\u0435":29,"\u0434\u0432\u0430\u0434\u0446\u0430\u0442\u044C \u0434\u0435\u0432\u044F\u0442\u043E\u0433\u043E":29,\u0442\u0440\u0438\u0434\u0446\u0430\u0442\u043E\u0435:30,\u0442\u0440\u0438\u0434\u0446\u0430\u0442\u043E\u0433\u043E:30,"\u0442\u0440\u0438\u0434\u0446\u0430\u0442\u044C \u043F\u0435\u0440\u0432\u043E\u0435":31,"\u0442\u0440\u0438\u0434\u0446\u0430\u0442\u044C \u043F\u0435\u0440\u0432\u043E\u0433\u043E":31},vw={\u0441\u0435\u043A:"second",\u0441\u0435\u043A\u0443\u043D\u0434\u0430:"second",\u0441\u0435\u043A\u0443\u043D\u0434:"second",\u0441\u0435\u043A\u0443\u043D\u0434\u044B:"second",\u0441\u0435\u043A\u0443\u043D\u0434\u0443:"second",\u0441\u0435\u043A\u0443\u043D\u0434\u043E\u0447\u043A\u0430:"second",\u0441\u0435\u043A\u0443\u043D\u0434\u043E\u0447\u043A\u0438:"second",\u0441\u0435\u043A\u0443\u043D\u0434\u043E\u0447\u0435\u043A:"second",\u0441\u0435\u043A\u0443\u043D\u0434\u043E\u0447\u043A\u0443:"second",\u043C\u0438\u043D:"minute",\u043C\u0438\u043D\u0443\u0442\u0430:"minute",\u043C\u0438\u043D\u0443\u0442:"minute",\u043C\u0438\u043D\u0443\u0442\u044B:"minute",\u043C\u0438\u043D\u0443\u0442\u0443:"minute",\u043C\u0438\u043D\u0443\u0442\u043E\u043A:"minute",\u043C\u0438\u043D\u0443\u0442\u043A\u0438:"minute",\u043C\u0438\u043D\u0443\u0442\u043A\u0443:"minute",\u043C\u0438\u043D\u0443\u0442\u043E\u0447\u0435\u043A:"minute",\u043C\u0438\u043D\u0443\u0442\u043E\u0447\u043A\u0438:"minute",\u043C\u0438\u043D\u0443\u0442\u043E\u0447\u043A\u0443:"minute",\u0447\u0430\u0441:"hour",\u0447\u0430\u0441\u043E\u0432:"hour",\u0447\u0430\u0441\u0430:"hour",\u0447\u0430\u0441\u0443:"hour",\u0447\u0430\u0441\u0438\u043A\u043E\u0432:"hour",\u0447\u0430\u0441\u0438\u043A\u0430:"hour",\u0447\u0430\u0441\u0438\u043A\u0435:"hour",\u0447\u0430\u0441\u0438\u043A:"hour",\u0434\u0435\u043D\u044C:"day",\u0434\u043D\u044F:"day",\u0434\u043D\u0435\u0439:"day",\u0441\u0443\u0442\u043E\u043A:"day",\u0441\u0443\u0442\u043A\u0438:"day",\u043D\u0435\u0434\u0435\u043B\u044F:"week",\u043D\u0435\u0434\u0435\u043B\u0435:"week",\u043D\u0435\u0434\u0435\u043B\u0438:"week",\u043D\u0435\u0434\u0435\u043B\u044E:"week",\u043D\u0435\u0434\u0435\u043B\u044C:"week",\u043D\u0435\u0434\u0435\u043B\u044C\u043A\u0435:"week",\u043D\u0435\u0434\u0435\u043B\u044C\u043A\u0438:"week",\u043D\u0435\u0434\u0435\u043B\u0435\u043A:"week",\u043C\u0435\u0441\u044F\u0446:"month",\u043C\u0435\u0441\u044F\u0446\u0435:"month",\u043C\u0435\u0441\u044F\u0446\u0435\u0432:"month",\u043C\u0435\u0441\u044F\u0446\u0430:"month",\u043A\u0432\u0430\u0440\u0442\u0430\u043B:"quarter",\u043A\u0432\u0430\u0440\u0442\u0430\u043B\u0435:"quarter",\u043A\u0432\u0430\u0440\u0442\u0430\u043B\u043E\u0432:"quarter",\u0433\u043E\u0434:"year",\u0433\u043E\u0434\u0430:"year",\u0433\u043E\u0434\u0443:"year",\u0433\u043E\u0434\u043E\u0432:"year",\u043B\u0435\u0442:"year",\u0433\u043E\u0434\u0438\u043A:"year",\u0433\u043E\u0434\u0438\u043A\u0430:"year",\u0433\u043E\u0434\u0438\u043A\u043E\u0432:"year"},Jie=`(?:${ee(IM)}|[0-9]+|[0-9]+\\.[0-9]+|\u043F\u043E\u043B|\u043D\u0435\u0441\u043A\u043E\u043B\u044C\u043A\u043E|\u043F\u0430\u0440(?:\u044B|\u0443)|\\s{0,3})`;RM=`(?:${ee(PM)}|[0-9]{1,2}(?:\u0433\u043E|\u043E\u0433\u043E|\u0435|\u043E\u0435)?)`;DM="(?:\\s+(?:\u0433\u043E\u0434\u0443|\u0433\u043E\u0434\u0430|\u0433\u043E\u0434|\u0433|\u0433.))?",EA=`(?:[1-9][0-9]{0,3}${DM}\\s*(?:\u043D.\u044D.|\u0434\u043E \u043D.\u044D.|\u043D. \u044D.|\u0434\u043E \u043D. \u044D.)|[1-2][0-9]{3}${DM}|[5-9][0-9]${DM})`;v3=`(${Jie})\\s{0,3}(${ee(vw)})`,g3=new RegExp(v3,"i"),Qm=Er("(?:(?:\u043E\u043A\u043E\u043B\u043E|\u043F\u0440\u0438\u043C\u0435\u0440\u043D\u043E)\\s{0,3})?",v3)});var y3,yw,b3=b(()=>{ps();Le();fe();y3=`(?:(?:\u043E\u043A\u043E\u043B\u043E|\u043F\u0440\u0438\u043C\u0435\u0440\u043D\u043E)\\s*(?:~\\s*)?)?(${Qm})${ds.rightBoundary}`,yw=class extends U{patternLeftBoundary(){return ds.leftBoundary}innerPattern(e){return e.option.forwardDate?new RegExp(y3,ds.flags):new RegExp(`(?:\u0432 \u0442\u0435\u0447\u0435\u043D\u0438\u0435|\u0432 \u0442\u0435\u0447\u0435\u043D\u0438\u0438)\\s*${y3}`,ds.flags)}innerExtract(e,t){let n=Xm(t[1]);return X.createRelativeFromReference(e.reference,n)}}});var Np,Oo,Fc=b(()=>{fe();ps();Np=class extends U{patternLeftBoundary(){return ds.leftBoundary}innerPattern(e){return new RegExp(this.innerPatternString(e),ds.flags)}innerPatternHasChange(e,t){return!1}},Oo=class extends Np{innerPattern(e){return new RegExp(`${this.innerPatternString(e)}${ds.rightBoundary}`,ds.flags)}}});var w3,C3,roe,x3,bw,E3=b(()=>{zt();ps();ps();ps();ze();Fc();w3=1,C3=2,roe=3,x3=4,bw=class extends Oo{innerPatternString(e){return`(?:\u0441)?\\s*(${RM})(?:\\s{0,3}(?:\u043F\u043E|-|\u2013|\u0434\u043E)?\\s{0,3}(${RM}))?(?:-|\\/|\\s{0,3}(?:of)?\\s{0,3})(${ee(Km)})(?:(?:-|\\/|,?\\s{0,3})(${EA}(?![^\\s]\\d)))?`}innerExtract(e,t){let n=e.createParsingResult(t.index,t[0]),i=Km[t[roe].toLowerCase()],o=$M(t[w3]);if(o>31)return t.index=t.index+t[w3].length,null;if(n.start.assign("month",i),n.start.assign("day",o),t[x3]){let s=TA(t[x3]);n.start.assign("year",s)}else{let s=ft(e.refDate,o,i);n.start.imply("year",s)}if(t[C3]){let s=$M(t[C3]);n.end=n.start.clone(),n.end.assign("day",s)}return n}}});var noe,T3,ww,_3=b(()=>{ps();zt();ze();ps();Fc();noe=2,T3=3,ww=class extends Np{innerPatternString(e){return`((?:\u0432)\\s*)?(${ee(Km)})\\s*(?:[,-]?\\s*(${EA})?)?(?=[^\\s\\w]|\\s+[^0-9]|\\s+$|$)`}innerExtract(e,t){let n=t[noe].toLowerCase();if(t[0].length<=3&&!MM[n])return null;let i=e.createParsingResult(t.index,t.index+t[0].length);i.start.imply("day",1);let o=Km[n];if(i.start.assign("month",o),t[T3]){let s=TA(t[T3]);i.start.assign("year",s)}else{let s=ft(e.refDate,1,o);i.start.imply("year",s)}return i}}});var Cw,A3=b(()=>{pt();$a();ps();Cw=class extends Yr{constructor(e){super(e)}patternFlags(){return ds.flags}primaryPatternLeftBoundary(){return"(^|\\s|T|(?:[^\\p{L}\\p{N}_]))"}followingPhase(){return"\\s*(?:\\-|\\\u2013|\\~|\\\u301C|\u0434\u043E|\u0438|\u043F\u043E|\\?)\\s*"}primaryPrefix(){return"(?:(?:\u0432|\u0441)\\s*)??"}primarySuffix(){return`(?:\\s*(?:\u0443\u0442\u0440\u0430|\u0432\u0435\u0447\u0435\u0440\u0430|\u043F\u043E\u0441\u043B\u0435 \u043F\u043E\u043B\u0443\u0434\u043D\u044F))?(?!\\/)${ds.rightBoundary}`}extractPrimaryTimeComponents(e,t){let n=super.extractPrimaryTimeComponents(e,t);if(n){if(t[0].endsWith("\u0432\u0435\u0447\u0435\u0440\u0430")){let i=n.get("hour");i>=6&&i<12?(n.assign("hour",n.get("hour")+12),n.assign("meridiem",G.PM)):i<6&&n.assign("meridiem",G.AM)}if(t[0].endsWith("\u043F\u043E\u0441\u043B\u0435 \u043F\u043E\u043B\u0443\u0434\u043D\u044F")){n.assign("meridiem",G.PM);let i=n.get("hour");i>=0&&i<=6&&n.assign("hour",n.get("hour")+12)}t[0].endsWith("\u0443\u0442\u0440\u0430")&&(n.assign("meridiem",G.AM),n.get("hour")<12&&n.assign("hour",n.get("hour")))}return n}}});var xw,k3=b(()=>{ps();Le();Fc();Bt();xw=class extends Np{innerPatternString(e){return`(${Qm})\\s{0,5}\u043D\u0430\u0437\u0430\u0434(?=(?:\\W|$))`}innerExtract(e,t){let n=Xm(t[1]),i=tt(n);return X.createRelativeFromReference(e.reference,i)}}});var Ew,S3=b(()=>{vo();Ew=class extends Yt{patternBetween(){return/^\s*(и до|и по|до|по|-)\s*$/i}}});var Tw,D3=b(()=>{yo();Tw=class extends Kt{patternBetween(){return new RegExp("^\\s*(T|\u0432|,|-)?\\s*$")}}});var _w,I3=b(()=>{si();Fc();_w=class extends Oo{innerPatternString(e){return"(?:\u0441|\u0441\u043E)?\\s*(\u0441\u0435\u0433\u043E\u0434\u043D\u044F|\u0432\u0447\u0435\u0440\u0430|\u0437\u0430\u0432\u0442\u0440\u0430|\u043F\u043E\u0441\u043B\u0435\u0437\u0430\u0432\u0442\u0440\u0430|\u043F\u043E\u0441\u043B\u0435\u043F\u043E\u0441\u043B\u0435\u0437\u0430\u0432\u0442\u0440\u0430|\u043F\u043E\u0437\u0430\u043F\u043E\u0437\u0430\u0432\u0447\u0435\u0440\u0430|\u043F\u043E\u0437\u0430\u0432\u0447\u0435\u0440\u0430)"}innerExtract(e,t){let n=t[1].toLowerCase(),i=e.createParsingComponents();switch(n){case"\u0441\u0435\u0433\u043E\u0434\u043D\u044F":return Tr(e.reference);case"\u0432\u0447\u0435\u0440\u0430":return vn(e.reference);case"\u0437\u0430\u0432\u0442\u0440\u0430":return yn(e.reference);case"\u043F\u043E\u0441\u043B\u0435\u0437\u0430\u0432\u0442\u0440\u0430":return Mo(e.reference,2);case"\u043F\u043E\u0441\u043B\u0435\u043F\u043E\u0441\u043B\u0435\u0437\u0430\u0432\u0442\u0440\u0430":return Mo(e.reference,3);case"\u043F\u043E\u0437\u0430\u0432\u0447\u0435\u0440\u0430":return kc(e.reference,2);case"\u043F\u043E\u0437\u0430\u043F\u043E\u0437\u0430\u0432\u0447\u0435\u0440\u0430":return kc(e.reference,3)}return i}}});var Aw,P3=b(()=>{si();on();Fc();Aw=class extends Oo{innerPatternString(e){return"(\u0441\u0435\u0439\u0447\u0430\u0441|\u043F\u0440\u043E\u0448\u043B\u044B\u043C\\s*\u0432\u0435\u0447\u0435\u0440\u043E\u043C|\u043F\u0440\u043E\u0448\u043B\u043E\u0439\\s*\u043D\u043E\u0447\u044C\u044E|\u0441\u043B\u0435\u0434\u0443\u044E\u0449\u0435\u0439\\s*\u043D\u043E\u0447\u044C\u044E|\u0441\u0435\u0433\u043E\u0434\u043D\u044F\\s*\u043D\u043E\u0447\u044C\u044E|\u044D\u0442\u043E\u0439\\s*\u043D\u043E\u0447\u044C\u044E|\u043D\u043E\u0447\u044C\u044E|\u044D\u0442\u0438\u043C \u0443\u0442\u0440\u043E\u043C|\u0443\u0442\u0440\u043E\u043C|\u0443\u0442\u0440\u0430|\u0432\\s*\u043F\u043E\u043B\u0434\u0435\u043D\u044C|\u0432\u0435\u0447\u0435\u0440\u043E\u043C|\u0432\u0435\u0447\u0435\u0440\u0430|\u0432\\s*\u043F\u043E\u043B\u043D\u043E\u0447\u044C)"}innerExtract(e,t){let n=e.refDate,i=t[0].toLowerCase(),o=e.createParsingComponents();if(i==="\u0441\u0435\u0439\u0447\u0430\u0441")return $r(e.reference);if(i==="\u0432\u0435\u0447\u0435\u0440\u043E\u043C"||i==="\u0432\u0435\u0447\u0435\u0440\u0430")return Sc(e.reference);if(i.endsWith("\u0443\u0442\u0440\u043E\u043C")||i.endsWith("\u0443\u0442\u0440\u0430"))return Ic(e.reference);if(i.match(/в\s*полдень/))return qu(e.reference);if(i.match(/прошлой\s*ночью/))return nA(e.reference);if(i.match(/прошлым\s*вечером/))return iA(e.reference);if(i.match(/следующей\s*ночью/)){let s=n.getHours()<22?1:2,a=new Date(n.getTime());a.setDate(a.getDate()+s),nt(o,a),o.imply("hour",0)}return i.match(/в\s*полночь/)||i.endsWith("\u043D\u043E\u0447\u044C\u044E")?Dc(e.reference):o}}});var ioe,ooe,soe,kw,F3=b(()=>{ps();ze();Ki();Fc();ioe=1,ooe=2,soe=3,kw=class extends Oo{innerPatternString(e){return`(?:(?:,|\\(|\uFF08)\\s*)?(?:\u0432\\s*?)?(?:(\u044D\u0442\u0443|\u044D\u0442\u043E\u0442|\u043F\u0440\u043E\u0448\u043B\u044B\u0439|\u043F\u0440\u043E\u0448\u043B\u0443\u044E|\u0441\u043B\u0435\u0434\u0443\u044E\u0449\u0438\u0439|\u0441\u043B\u0435\u0434\u0443\u044E\u0449\u0443\u044E|\u0441\u043B\u0435\u0434\u0443\u044E\u0449\u0435\u0433\u043E)\\s*)?(${ee(FM)})(?:\\s*(?:,|\\)|\uFF09))?(?:\\s*\u043D\u0430\\s*(\u044D\u0442\u043E\u0439|\u043F\u0440\u043E\u0448\u043B\u043E\u0439|\u0441\u043B\u0435\u0434\u0443\u044E\u0449\u0435\u0439)\\s*\u043D\u0435\u0434\u0435\u043B\u0435)?`}innerExtract(e,t){let n=t[ooe].toLowerCase(),i=FM[n],o=t[ioe],s=t[soe],a=o||s;a=a||"",a=a.toLowerCase();let l=null;return a=="\u043F\u0440\u043E\u0448\u043B\u044B\u0439"||a=="\u043F\u0440\u043E\u0448\u043B\u0443\u044E"||a=="\u043F\u0440\u043E\u0448\u043B\u043E\u0439"?l="last":a=="\u0441\u043B\u0435\u0434\u0443\u044E\u0449\u0438\u0439"||a=="\u0441\u043B\u0435\u0434\u0443\u044E\u0449\u0443\u044E"||a=="\u0441\u043B\u0435\u0434\u0443\u044E\u0449\u0435\u0439"||a=="\u0441\u043B\u0435\u0434\u0443\u044E\u0449\u0435\u0433\u043E"?l="next":(a=="\u044D\u0442\u043E\u0442"||a=="\u044D\u0442\u0443"||a=="\u044D\u0442\u043E\u0439")&&(l="this"),cr(e.reference,i,l)}}});var aoe,loe,Sw,M3=b(()=>{ps();Le();ze();Fc();aoe=1,loe=2,Sw=class extends Oo{innerPatternString(e){return`(\u0432 \u043F\u0440\u043E\u0448\u043B\u043E\u043C|\u043D\u0430 \u043F\u0440\u043E\u0448\u043B\u043E\u0439|\u043D\u0430 \u0441\u043B\u0435\u0434\u0443\u044E\u0449\u0435\u0439|\u0432 \u0441\u043B\u0435\u0434\u0443\u044E\u0449\u0435\u043C|\u043D\u0430 \u044D\u0442\u043E\u0439|\u0432 \u044D\u0442\u043E\u043C)\\s*(${ee(vw)})`}innerExtract(e,t){let n=t[aoe].toLowerCase(),i=t[loe].toLowerCase(),o=vw[i];if(n=="\u043D\u0430 \u0441\u043B\u0435\u0434\u0443\u044E\u0449\u0435\u0439"||n=="\u0432 \u0441\u043B\u0435\u0434\u0443\u044E\u0449\u0435\u043C"){let l={};return l[o]=1,X.createRelativeFromReference(e.reference,l)}if(n=="\u0432 \u043F\u0440\u043E\u0448\u043B\u043E\u043C"||n=="\u043D\u0430 \u043F\u0440\u043E\u0448\u043B\u043E\u0439"){let l={};return l[o]=-1,X.createRelativeFromReference(e.reference,l)}let s=e.createParsingComponents(),a=new Date(e.reference.instant.getTime());return o.match(/week/i)?(a.setDate(a.getDate()-a.getDay()),s.imply("day",a.getDate()),s.imply("month",a.getMonth()+1),s.imply("year",a.getFullYear())):o.match(/month/i)?(a.setDate(1),s.imply("day",a.getDate()),s.assign("year",a.getFullYear()),s.assign("month",a.getMonth()+1)):o.match(/year/i)&&(a.setDate(1),a.setMonth(0),s.imply("day",a.getDate()),s.imply("month",a.getMonth()+1),s.assign("year",a.getFullYear())),s}}});var Dw,R3=b(()=>{ps();Le();Fc();Bt();Dw=class extends Oo{innerPatternString(e){return`(\u044D\u0442\u0438|\u043F\u043E\u0441\u043B\u0435\u0434\u043D\u0438\u0435|\u043F\u0440\u043E\u0448\u043B\u044B\u0435|\u0441\u043B\u0435\u0434\u0443\u044E\u0449\u0438\u0435|\u043F\u043E\u0441\u043B\u0435|\u0441\u043F\u0443\u0441\u0442\u044F|\u0447\u0435\u0440\u0435\u0437|\\+|-)\\s*(${Qm})`}innerExtract(e,t){let n=t[1].toLowerCase(),i=Xm(t[2]);switch(n){case"\u043F\u043E\u0441\u043B\u0435\u0434\u043D\u0438\u0435":case"\u043F\u0440\u043E\u0448\u043B\u044B\u0435":case"-":i=tt(i);break}return X.createRelativeFromReference(e.reference,i)}}});var LM={};Jr(LM,{Chrono:()=>Se,Meridiem:()=>G,ParsingComponents:()=>X,ParsingResult:()=>at,ReferenceWithTimezone:()=>ct,Weekday:()=>Oe,casual:()=>OM,createCasualConfiguration:()=>$3,createConfiguration:()=>NM,parse:()=>uoe,parseDate:()=>doe,strict:()=>coe});function uoe(r,e,t){return OM.parse(r,e,t)}function doe(r,e,t){return OM.parseDate(r,e,t)}function $3(){let r=NM(!1);return r.parsers.unshift(new _w),r.parsers.unshift(new Aw),r.parsers.unshift(new ww),r.parsers.unshift(new Sw),r.parsers.unshift(new Dw),r}function NM(r=!0){return Ht({parsers:[new vr(!0),new yw,new bw,new kw,new Cw(r),new xw],refiners:[new Tw,new Ew]},r)}var OM,coe,O3=b(()=>{b3();E3();_3();A3();k3();S3();D3();Ei();I3();P3();F3();M3();ai();Le();pt();cs();R3();OM=new Se($3()),coe=new Se(NM(!0))});function foe(r){let e=r.toLowerCase();return BM[e]!==void 0?BM[e]:e==="un"||e==="una"||e==="uno"?1:e.match(/algunos?/)||e.match(/unos?/)?3:e.match(/media?/)?.5:parseFloat(e)}function U3(r){if(r.match(/^[0-9]{1,4}$/)){let e=parseInt(r);return e<100&&(e>50?e=e+1900:e=e+2e3),e}return r.match(/a\.?\s*c\.?/i)?(r=r.replace(/a\.?\s*c\.?/i,""),-parseInt(r)):parseInt(r)}function W3(r){let e={},t=r,n=N3.exec(t);for(;n;)moe(e,n),t=t.substring(n[0].length),n=N3.exec(t);return e}function moe(r,e){let t=foe(e[1]),n=L3[e[2].toLowerCase()];r[n]=t}var UM,VM,BM,L3,poe,B3,V3,N3,q3,Iw=b(()=>{ze();UM={domingo:0,dom:0,lunes:1,lun:1,martes:2,mar:2,mi\u00E9rcoles:3,miercoles:3,mi\u00E9:3,mie:3,jueves:4,jue:4,viernes:5,vie:5,s\u00E1bado:6,sabado:6,s\u00E1b:6,sab:6},VM={enero:1,ene:1,"ene.":1,febrero:2,feb:2,"feb.":2,marzo:3,mar:3,"mar.":3,abril:4,abr:4,"abr.":4,mayo:5,may:5,"may.":5,junio:6,jun:6,"jun.":6,julio:7,jul:7,"jul.":7,agosto:8,ago:8,"ago.":8,septiembre:9,setiembre:9,sep:9,"sep.":9,octubre:10,oct:10,"oct.":10,noviembre:11,nov:11,"nov.":11,diciembre:12,dic:12,"dic.":12},BM={uno:1,dos:2,tres:3,cuatro:4,cinco:5,seis:6,siete:7,ocho:8,nueve:9,diez:10,once:11,doce:12,trece:13},L3={sec:"second",segundo:"second",segundos:"second",min:"minute",mins:"minute",minuto:"minute",minutos:"minute",h:"hour",hr:"hour",hrs:"hour",hora:"hour",horas:"hour",d\u00EDa:"day",d\u00EDas:"day",semana:"week",semanas:"week",mes:"month",meses:"month",cuarto:"quarter",cuartos:"quarter",a\u00F1o:"year",a\u00F1os:"year"},poe=`(?:${ee(BM)}|[0-9]+|[0-9]+\\.[0-9]+|un?|uno?|una?|algunos?|unos?|demi-?)`;B3="[0-9]{1,4}(?![^\\s]\\d)(?:\\s*[a|d]\\.?\\s*c\\.?|\\s*a\\.?\\s*d\\.?)?";V3=`(${poe})\\s{0,5}(${ee(L3)})\\s{0,5}`,N3=new RegExp(V3,"i"),q3=Er("",V3)});var hoe,goe,voe,yoe,Pw,z3=b(()=>{Iw();ze();fe();Ki();hoe=new RegExp(`(?:(?:\\,|\\(|\\\uFF08)\\s*)?(?:(este|esta|pasado|pr[o\xF3]ximo)\\s*)?(${ee(UM)})(?:\\s*(?:\\,|\\)|\\\uFF09))?(?:\\s*(este|esta|pasado|pr[\xF3o]ximo)\\s*semana)?(?=\\W|\\d|$)`,"i"),goe=1,voe=2,yoe=3,Pw=class extends U{innerPattern(){return hoe}innerExtract(e,t){let n=t[voe].toLowerCase(),i=UM[n];if(i===void 0)return null;let o=t[goe],s=t[yoe],a=o||s||"";a=a.toLowerCase();let l=null;return a=="pasado"?l="this":a=="pr\xF3ximo"||a=="proximo"?l="next":a=="este"&&(l="this"),cr(e.reference,i,l)}}});var Fw,H3=b(()=>{$a();Fw=class extends Yr{primaryPrefix(){return"(?:(?:aslas|deslas|las?|al?|de|del)\\s*)?"}followingPhase(){return"\\s*(?:\\-|\\\u2013|\\~|\\\u301C|a(?:l)?|\\?)\\s*"}}});var Mw,j3=b(()=>{yo();Mw=class extends Kt{patternBetween(){return new RegExp("^\\s*(?:,|de|aslas|a)?\\s*$")}}});var Rw,G3=b(()=>{vo();Rw=class extends Yt{patternBetween(){return/^\s*(?:-)\s*$/i}}});var boe,Y3,K3,woe,Q3,$w,X3=b(()=>{zt();Iw();Iw();ze();fe();boe=new RegExp(`([0-9]{1,2})(?:\xBA|\xAA|\xB0)?(?:\\s*(?:desde|de|\\-|\\\u2013|ao?|\\s)\\s*([0-9]{1,2})(?:\xBA|\xAA|\xB0)?)?\\s*(?:de)?\\s*(?:-|/|\\s*(?:de|,)?\\s*)(${ee(VM)})(?:\\s*(?:de|,)?\\s*(${B3}))?(?=\\W|$)`,"i"),Y3=1,K3=2,woe=3,Q3=4,$w=class extends U{innerPattern(){return boe}innerExtract(e,t){let n=e.createParsingResult(t.index,t[0]),i=VM[t[woe].toLowerCase()],o=parseInt(t[Y3]);if(o>31)return t.index=t.index+t[Y3].length,null;if(n.start.assign("month",i),n.start.assign("day",o),t[Q3]){let s=U3(t[Q3]);n.start.assign("year",s)}else{let s=ft(e.refDate,o,i);n.start.imply("year",s)}if(t[K3]){let s=parseInt(t[K3]);n.end=n.start.clone(),n.end.assign("day",s)}return n}}});var Ow,Z3=b(()=>{fe();si();Ow=class extends U{innerPattern(e){return/(ahora|hoy|mañana|ayer)(?=\W|$)/i}innerExtract(e,t){let n=t[0].toLowerCase(),i=e.createParsingComponents();switch(n){case"ahora":return $r(e.reference);case"hoy":return Tr(e.reference);case"ma\xF1ana":return yn(e.reference);case"ayer":return vn(e.reference)}return i}}});var Nw,J3=b(()=>{pt();fe();on();Nw=class extends U{innerPattern(){return/(?:esta\s*)?(mañana|tarde|medianoche|mediodia|mediodía|noche)(?=\W|$)/i}innerExtract(e,t){let n=e.refDate,i=e.createParsingComponents();switch(t[1].toLowerCase()){case"tarde":i.imply("meridiem",G.PM),i.imply("hour",15),i.addTag("casualReference/afternoon");break;case"noche":i.imply("meridiem",G.PM),i.imply("hour",22),i.addTag("casualReference/evening");break;case"ma\xF1ana":i.imply("meridiem",G.AM),i.imply("hour",6),i.addTag("casualReference/morning");break;case"medianoche":let o=new Date(n.getTime());o.setDate(o.getDate()+1),nt(i,o),Lt(i,o),i.imply("hour",0),i.imply("minute",0),i.imply("second",0),i.addTag("casualReference/midnight");break;case"mediodia":case"mediod\xEDa":i.imply("meridiem",G.AM),i.imply("hour",12),i.addTag("casualReference/noon");break}return i}}});var Lw,eH=b(()=>{Iw();Le();fe();Lw=class extends U{innerPattern(){return new RegExp(`(?:en|por|durante|de|dentro de)\\s*(${q3})(?=\\W|$)`,"i")}innerExtract(e,t){let n=W3(t[1]);return X.createRelativeFromReference(e.reference,n)}}});var zM={};Jr(zM,{Chrono:()=>Se,Meridiem:()=>G,ParsingComponents:()=>X,ParsingResult:()=>at,ReferenceWithTimezone:()=>ct,Weekday:()=>Oe,casual:()=>qM,createCasualConfiguration:()=>tH,createConfiguration:()=>WM,parse:()=>xoe,parseDate:()=>Eoe,strict:()=>Coe});function xoe(r,e,t){return qM.parse(r,e,t)}function Eoe(r,e,t){return qM.parseDate(r,e,t)}function tH(r=!0){let e=WM(!1,r);return e.parsers.push(new Ow),e.parsers.push(new Nw),e}function WM(r=!0,e=!0){return Ht({parsers:[new vr(e),new Pw,new Fw,new $w,new Lw],refiners:[new Mw,new Rw]},r)}var qM,Coe,rH=b(()=>{Ei();ai();Le();pt();cs();z3();H3();j3();G3();X3();Z3();J3();eH();qM=new Se(tH()),Coe=new Se(WM(!0))});function _oe(r){let e=r.toLowerCase();return jM[e]!==void 0?jM[e]:e.match(/декілька/)?2:e.match(/пів/)?.5:e.match(/пар/)?2:e===""?1:parseFloat(e)}function XM(r){let e=r.toLowerCase();return GM[e]!==void 0?GM[e]:parseInt(e)}function AA(r){if(/(рік|року|р|р.)/i.test(r)&&(r=r.replace(/(рік|року|р|р.)/i,"")),/(до н.е.|до н. е.)/i.test(r))return r=r.replace(/(до н.е.|до н. е.)/i,""),-parseInt(r);if(/(н. е.|н.е.)/i.test(r))return r=r.replace(/(н. е.|н.е.)/i,""),parseInt(r);let e=parseInt(r);return Gr(e)}function eh(r){let e={},t=r,n=nH.exec(t);for(;n;)Aoe(e,n),t=t.substring(n[0].length).trim(),n=nH.exec(t);return e}function Aoe(r,e){let t=_oe(e[1]),n=Bw[e[2].toLowerCase()];r[n]=t}var fs,YM,KM,Zm,jM,GM,Bw,Toe,QM,HM,_A,iH,nH,Jm,ms=b(()=>{ze();zt();fs={leftBoundary:"([^\\p{L}\\p{N}_]|^)",rightBoundary:"(?=[^\\p{L}\\p{N}_]|$)",flags:"iu"},YM={\u043D\u0435\u0434\u0456\u043B\u044F:0,\u043D\u0435\u0434\u0456\u043B\u0456:0,\u043D\u0435\u0434\u0456\u043B\u044E:0,\u043D\u0434:0,"\u043D\u0434.":0,\u043F\u043E\u043D\u0435\u0434\u0456\u043B\u043E\u043A:1,\u043F\u043E\u043D\u0435\u0434\u0456\u043B\u043A\u0430:1,\u043F\u043D:1,"\u043F\u043D.":1,\u0432\u0456\u0432\u0442\u043E\u0440\u043E\u043A:2,\u0432\u0456\u0432\u0442\u043E\u0440\u043A\u0430:2,\u0432\u0442:2,"\u0432\u0442.":2,\u0441\u0435\u0440\u0435\u0434\u0430:3,\u0441\u0435\u0440\u0435\u0434\u0438:3,\u0441\u0435\u0440\u0435\u0434\u0443:3,\u0441\u0440:3,"\u0441\u0440.":3,\u0447\u0435\u0442\u0432\u0435\u0440:4,\u0447\u0435\u0442\u0432\u0435\u0440\u0433\u0430:4,\u0447\u0435\u0442\u0432\u0435\u0440\u0433\u0443:4,\u0447\u0442:4,"\u0447\u0442.":4,"\u043F'\u044F\u0442\u043D\u0438\u0446\u044F":5,"\u043F'\u044F\u0442\u043D\u0438\u0446\u0456":5,"\u043F'\u044F\u0442\u043D\u0438\u0446\u044E":5,\u043F\u0442:5,"\u043F\u0442.":5,\u0441\u0443\u0431\u043E\u0442\u0430:6,\u0441\u0443\u0431\u043E\u0442\u0438:6,\u0441\u0443\u0431\u043E\u0442\u0443:6,\u0441\u0431:6,"\u0441\u0431.":6},KM={\u0441\u0456\u0447\u0435\u043D\u044C:1,\u0441\u0456\u0447\u043D\u044F:1,\u0441\u0456\u0447\u043D\u0456:1,\u043B\u044E\u0442\u0438\u0439:2,\u043B\u044E\u0442\u043E\u0433\u043E:2,\u043B\u044E\u0442\u043E\u043C\u0443:2,\u0431\u0435\u0440\u0435\u0437\u0435\u043D\u044C:3,\u0431\u0435\u0440\u0435\u0437\u043D\u044F:3,\u0431\u0435\u0440\u0435\u0437\u043D\u0456:3,\u043A\u0432\u0456\u0442\u0435\u043D\u044C:4,\u043A\u0432\u0456\u0442\u043D\u044F:4,\u043A\u0432\u0456\u0442\u043D\u0456:4,\u0442\u0440\u0430\u0432\u0435\u043D\u044C:5,\u0442\u0440\u0430\u0432\u043D\u044F:5,\u0442\u0440\u0430\u0432\u043D\u0456:5,\u0447\u0435\u0440\u0432\u0435\u043D\u044C:6,\u0447\u0435\u0440\u0432\u043D\u044F:6,\u0447\u0435\u0440\u0432\u043D\u0456:6,\u043B\u0438\u043F\u0435\u043D\u044C:7,\u043B\u0438\u043F\u043D\u044F:7,\u043B\u0438\u043F\u043D\u0456:7,\u0441\u0435\u0440\u043F\u0435\u043D\u044C:8,\u0441\u0435\u0440\u043F\u043D\u044F:8,\u0441\u0435\u0440\u043F\u043D\u0456:8,\u0432\u0435\u0440\u0435\u0441\u0435\u043D\u044C:9,\u0432\u0435\u0440\u0435\u0441\u043D\u044F:9,\u0432\u0435\u0440\u0435\u0441\u043D\u0456:9,\u0436\u043E\u0432\u0442\u0435\u043D\u044C:10,\u0436\u043E\u0432\u0442\u043D\u044F:10,\u0436\u043E\u0432\u0442\u043D\u0456:10,\u043B\u0438\u0441\u0442\u043E\u043F\u0430\u0434:11,\u043B\u0438\u0441\u0442\u043E\u043F\u0430\u0434\u0430:11,\u043B\u0438\u0441\u0442\u043E\u043F\u0430\u0434\u0443:11,\u0433\u0440\u0443\u0434\u0435\u043D\u044C:12,\u0433\u0440\u0443\u0434\u043D\u044F:12,\u0433\u0440\u0443\u0434\u043D\u0456:12},Zm={...KM,\u0441\u0456\u0447:1,"\u0441\u0456\u0447.":1,\u043B\u044E\u0442:2,"\u043B\u044E\u0442.":2,\u0431\u0435\u0440:3,"\u0431\u0435\u0440.":3,\u043A\u0432\u0456\u0442:4,"\u043A\u0432\u0456\u0442.":4,\u0442\u0440\u0430\u0432:5,"\u0442\u0440\u0430\u0432.":5,\u0447\u0435\u0440\u0432:6,"\u0447\u0435\u0440\u0432.":6,\u043B\u0438\u043F:7,"\u043B\u0438\u043F.":7,\u0441\u0435\u0440\u043F:8,"\u0441\u0435\u0440\u043F.":8,\u0441\u0435\u0440:8,"c\u0435\u0440.":8,\u0432\u0435\u0440:9,"\u0432\u0435\u0440.":9,\u0432\u0435\u0440\u0435\u0441:9,"\u0432\u0435\u0440\u0435\u0441.":9,\u0436\u043E\u0432\u0442:10,"\u0436\u043E\u0432\u0442.":10,\u043B\u0438\u0441\u0442\u043E\u043F:11,"\u043B\u0438\u0441\u0442\u043E\u043F.":11,\u0433\u0440\u0443\u0434:12,"\u0433\u0440\u0443\u0434.":12},jM={\u043E\u0434\u0438\u043D:1,\u043E\u0434\u043D\u0430:1,\u043E\u0434\u043D\u043E\u0457:1,\u043E\u0434\u043D\u0443:1,\u0434\u0432\u0456:2,\u0434\u0432\u0430:2,\u0434\u0432\u043E\u0445:2,\u0442\u0440\u0438:3,\u0442\u0440\u044C\u043E\u0445:3,\u0447\u043E\u0442\u0438\u0440\u0438:4,\u0447\u043E\u0442\u0438\u0440\u044C\u043E\u0445:4,"\u043F'\u044F\u0442\u044C":5,"\u043F'\u044F\u0442\u0438":5,\u0448\u0456\u0441\u0442\u044C:6,\u0448\u0435\u0441\u0442\u0438:6,\u0441\u0456\u043C:7,\u0441\u0435\u043C\u0438:7,\u0432\u0456\u0441\u0456\u043C:8,\u0432\u043E\u0441\u044C\u043C\u0438:8,"\u0434\u0435\u0432'\u044F\u0442\u044C":9,"\u0434\u0435\u0432'\u044F\u0442\u0438":9,\u0434\u0435\u0441\u044F\u0442\u044C:10,\u0434\u0435\u0441\u044F\u0442\u0438:10,\u043E\u0434\u0438\u043D\u0430\u0434\u0446\u044F\u0442\u044C:11,\u043E\u0434\u0438\u043D\u0430\u0434\u0446\u044F\u0442\u0438:11,\u0434\u0432\u0430\u043D\u0430\u0434\u0446\u044F\u0442\u044C:12,\u0434\u0432\u0430\u043D\u0430\u0434\u0446\u044F\u0442\u0438:12},GM={\u043F\u0435\u0440\u0448\u0435:1,\u043F\u0435\u0440\u0448\u043E\u0433\u043E:1,\u0434\u0440\u0443\u0433\u0435:2,\u0434\u0440\u0443\u0433\u043E\u0433\u043E:2,\u0442\u0440\u0435\u0442\u0454:3,\u0442\u0440\u0435\u0442\u044C\u043E\u0433\u043E:3,\u0447\u0435\u0442\u0432\u0435\u0440\u0442\u0435:4,\u0447\u0435\u0442\u0432\u0435\u0440\u0442\u043E\u0433\u043E:4,"\u043F'\u044F\u0442\u0435":5,"\u043F'\u044F\u0442\u043E\u0433\u043E":5,\u0448\u043E\u0441\u0442\u0435:6,\u0448\u043E\u0441\u0442\u043E\u0433\u043E:6,\u0441\u044C\u043E\u043C\u0435:7,\u0441\u044C\u043E\u043C\u043E\u0433\u043E:7,\u0432\u043E\u0441\u044C\u043C\u0435:8,\u0432\u043E\u0441\u044C\u043C\u043E\u0433\u043E:8,"\u0434\u0435\u0432'\u044F\u0442\u0435":9,"\u0434\u0435\u0432'\u044F\u0442\u043E\u0433\u043E":9,\u0434\u0435\u0441\u044F\u0442\u0435:10,\u0434\u0435\u0441\u044F\u0442\u043E\u0433\u043E:10,\u043E\u0434\u0438\u043D\u0430\u0434\u0446\u044F\u0442\u0435:11,\u043E\u0434\u0438\u043D\u0430\u0434\u0446\u044F\u0442\u043E\u0433\u043E:11,\u0434\u0432\u0430\u043D\u0430\u0434\u0446\u044F\u0442\u0435:12,\u0434\u0432\u0430\u043D\u0430\u0434\u0446\u044F\u0442\u043E\u0433\u043E:12,\u0442\u0440\u0438\u043D\u0430\u0434\u0446\u044F\u0442\u0435:13,\u0442\u0440\u0438\u043D\u0430\u0434\u0446\u044F\u0442\u043E\u0433\u043E:13,\u0447\u043E\u0442\u0438\u0440\u043D\u0430\u0434\u0446\u044F\u0442\u0435:14,\u0447\u043E\u0442\u0438\u043D\u0440\u043D\u0430\u0434\u0446\u044F\u0442\u043E\u0433\u043E:14,"\u043F'\u044F\u0442\u043D\u0430\u0434\u0446\u044F\u0442\u0435":15,"\u043F'\u044F\u0442\u043D\u0430\u0434\u0446\u044F\u0442\u043E\u0433\u043E":15,\u0448\u0456\u0441\u0442\u043D\u0430\u0434\u0446\u044F\u0442\u0435:16,\u0448\u0456\u0441\u0442\u043D\u0430\u0434\u0446\u044F\u0442\u043E\u0433\u043E:16,\u0441\u0456\u043C\u043D\u0430\u0434\u0446\u044F\u0442\u0435:17,\u0441\u0456\u043C\u043D\u0430\u0434\u0446\u044F\u0442\u043E\u0433\u043E:17,\u0432\u0456\u0441\u0456\u043C\u043D\u0430\u0434\u0446\u044F\u0442\u0435:18,\u0432\u0456\u0441\u0456\u043C\u043D\u0430\u0434\u0446\u044F\u0442\u043E\u0433\u043E:18,"\u0434\u0435\u0432'\u044F\u0442\u043D\u0430\u0434\u0446\u044F\u0442\u0435":19,"\u0434\u0435\u0432'\u044F\u0442\u043D\u0430\u0434\u0446\u044F\u0442\u043E\u0433\u043E":19,\u0434\u0432\u0430\u0434\u0446\u044F\u0442\u0435:20,\u0434\u0432\u0430\u0434\u0446\u044F\u0442\u043E\u0433\u043E:20,"\u0434\u0432\u0430\u0434\u0446\u044F\u0442\u044C \u043F\u0435\u0440\u0448\u0435":21,"\u0434\u0432\u0430\u0434\u0446\u044F\u0442\u044C \u043F\u0435\u0440\u0448\u043E\u0433\u043E":21,"\u0434\u0432\u0430\u0434\u0446\u044F\u0442\u044C \u0434\u0440\u0443\u0433\u0435":22,"\u0434\u0432\u0430\u0434\u0446\u044F\u0442\u044C \u0434\u0440\u0443\u0433\u043E\u0433\u043E":22,"\u0434\u0432\u0430\u0434\u0446\u044F\u0442\u044C \u0442\u0440\u0435\u0442\u0454":23,"\u0434\u0432\u0430\u0434\u0446\u044F\u0442\u044C \u0442\u0440\u0435\u0442\u044C\u043E\u0433\u043E":23,"\u0434\u0432\u0430\u0434\u0446\u044F\u0442\u044C \u0447\u0435\u0442\u0432\u0435\u0440\u0442\u0435":24,"\u0434\u0432\u0430\u0434\u0446\u044F\u0442\u044C \u0447\u0435\u0442\u0432\u0435\u0440\u0442\u043E\u0433\u043E":24,"\u0434\u0432\u0430\u0434\u0446\u044F\u0442\u044C \u043F'\u044F\u0442\u0435":25,"\u0434\u0432\u0430\u0434\u0446\u044F\u0442\u044C \u043F'\u044F\u0442\u043E\u0433\u043E":25,"\u0434\u0432\u0430\u0434\u0446\u044F\u0442\u044C \u0448\u043E\u0441\u0442\u0435":26,"\u0434\u0432\u0430\u0434\u0446\u044F\u0442\u044C \u0448\u043E\u0441\u0442\u043E\u0433\u043E":26,"\u0434\u0432\u0430\u0434\u0446\u044F\u0442\u044C \u0441\u044C\u043E\u043C\u0435":27,"\u0434\u0432\u0430\u0434\u0446\u044F\u0442\u044C \u0441\u044C\u043E\u043C\u043E\u0433\u043E":27,"\u0434\u0432\u0430\u0434\u0446\u044F\u0442\u044C \u0432\u043E\u0441\u044C\u043C\u0435":28,"\u0434\u0432\u0430\u0434\u0446\u044F\u0442\u044C \u0432\u043E\u0441\u044C\u043C\u043E\u0433\u043E":28,"\u0434\u0432\u0430\u0434\u0446\u044F\u0442\u044C \u0434\u0435\u0432'\u044F\u0442\u0435":29,"\u0434\u0432\u0430\u0434\u0446\u044F\u0442\u044C \u0434\u0435\u0432'\u044F\u0442\u043E\u0433\u043E":29,\u0442\u0440\u0438\u0434\u0446\u044F\u0442\u0435:30,\u0442\u0440\u0438\u0434\u0446\u044F\u0442\u043E\u0433\u043E:30,"\u0442\u0440\u0438\u0434\u0446\u044F\u0442\u044C \u043F\u0435\u0440\u0448\u0435":31,"\u0442\u0440\u0438\u0434\u0446\u044F\u0442\u044C \u043F\u0435\u0440\u0448\u043E\u0433\u043E":31},Bw={\u0441\u0435\u043A:"second",\u0441\u0435\u043A\u0443\u043D\u0434\u0430:"second",\u0441\u0435\u043A\u0443\u043D\u0434:"second",\u0441\u0435\u043A\u0443\u043D\u0434\u0438:"second",\u0441\u0435\u043A\u0443\u043D\u0434\u0443:"second",\u0441\u0435\u043A\u0443\u043D\u0434\u043E\u0447\u043E\u043A:"second",\u0441\u0435\u043A\u0443\u043D\u0434\u043E\u0447\u043A\u0438:"second",\u0441\u0435\u043A\u0443\u043D\u0434\u043E\u0447\u043A\u0443:"second",\u0445\u0432:"minute",\u0445\u0432\u0438\u043B\u0438\u043D\u0430:"minute",\u0445\u0432\u0438\u043B\u0438\u043D:"minute",\u0445\u0432\u0438\u043B\u0438\u043D\u0438:"minute",\u0445\u0432\u0438\u043B\u0438\u043D\u0443:"minute",\u0445\u0432\u0438\u043B\u0438\u043D\u043E\u043A:"minute",\u0445\u0432\u0438\u043B\u0438\u043D\u043A\u0438:"minute",\u0445\u0432\u0438\u043B\u0438\u043D\u043A\u0443:"minute",\u0445\u0432\u0438\u043B\u0438\u043D\u043E\u0447\u043E\u043A:"minute",\u0445\u0432\u0438\u043B\u0438\u043D\u043E\u0447\u043A\u0438:"minute",\u0445\u0432\u0438\u043B\u0438\u043D\u043E\u0447\u043A\u0443:"minute",\u0433\u043E\u0434:"hour",\u0433\u043E\u0434\u0438\u043D\u0430:"hour",\u0433\u043E\u0434\u0438\u043D:"hour",\u0433\u043E\u0434\u0438\u043D\u0438:"hour",\u0433\u043E\u0434\u0438\u043D\u0443:"hour",\u0433\u043E\u0434\u0438\u043D\u043A\u0430:"hour",\u0433\u043E\u0434\u0438\u043D\u043E\u043A:"hour",\u0433\u043E\u0434\u0438\u043D\u043A\u0438:"hour",\u0433\u043E\u0434\u0438\u043D\u043A\u0443:"hour",\u0434\u0435\u043D\u044C:"day",\u0434\u043D\u044F:"day",\u0434\u043D\u0456\u0432:"day",\u0434\u043D\u0456:"day",\u0434\u043E\u0431\u0430:"day",\u0434\u043E\u0431\u0443:"day",\u0442\u0438\u0436\u0434\u0435\u043D\u044C:"week",\u0442\u0438\u0436\u043D\u044E:"week",\u0442\u0438\u0436\u043D\u044F:"week",\u0442\u0438\u0436\u043D\u0456:"week",\u0442\u0438\u0436\u043D\u0456\u0432:"week",\u043C\u0456\u0441\u044F\u0446\u044C:"month",\u043C\u0456\u0441\u044F\u0446\u0456\u0432:"month",\u043C\u0456\u0441\u044F\u0446\u0456:"month",\u043C\u0456\u0441\u044F\u0446\u044F:"month",\u043A\u0432\u0430\u0440\u0442\u0430\u043B:"quarter",\u043A\u0432\u0430\u0440\u0442\u0430\u043B\u0443:"quarter",\u043A\u0432\u0430\u0440\u0442\u0430\u043B\u0430:"quarter",\u043A\u0432\u0430\u0440\u0442\u0430\u043B\u0456\u0432:"quarter",\u043A\u0432\u0430\u0440\u0442\u0430\u043B\u0456:"quarter",\u0440\u0456\u043A:"year",\u0440\u043E\u043A\u0443:"year",\u0440\u043E\u0446\u0456:"year",\u0440\u043E\u043A\u0456\u0432:"year",\u0440\u043E\u043A\u0438:"year"},Toe=`(?:${ee(jM)}|[0-9]+|[0-9]+\\.[0-9]+|\u043F\u0456\u0432|\u0434\u0435\u043A\u0456\u043B\u044C\u043A\u0430|\u043F\u0430\u0440(?:\u0443)|\\s{0,3})`;QM=`(?:${ee(GM)}|[0-9]{1,2}(?:\u0433\u043E|\u043E\u0433\u043E|\u0435)?)`;HM="(?:\\s+(?:\u0440\u043E\u043A\u0443|\u0440\u0456\u043A|\u0440|\u0440.))?",_A=`(?:[1-9][0-9]{0,3}${HM}\\s*(?:\u043D.\u0435.|\u0434\u043E \u043D.\u0435.|\u043D. \u0435.|\u0434\u043E \u043D. \u0435.)|[1-2][0-9]{3}${HM}|[5-9][0-9]${HM})`;iH=`(${Toe})\\s{0,3}(${ee(Bw)})`,nH=new RegExp(iH,"i"),Jm=Er("(?:(?:\u0431\u043B\u0438\u0437\u044C\u043A\u043E|\u043F\u0440\u0438\u0431\u043B\u0438\u0437\u043D\u043E)\\s{0,3})?",iH)});var oH,Uw,sH=b(()=>{ms();Le();fe();oH=`(?:(?:\u043F\u0440\u0438\u0431\u043B\u0438\u0437\u043D\u043E|\u043E\u0440\u0456\u0454\u043D\u0442\u043E\u0432\u043D\u043E)\\s*(?:~\\s*)?)?(${Jm})${fs.rightBoundary}`,Uw=class extends U{patternLeftBoundary(){return fs.leftBoundary}innerPattern(e){return e.option.forwardDate?new RegExp(oH,fs.flags):new RegExp(`(?:\u043F\u0440\u043E\u0442\u044F\u0433\u043E\u043C|\u043D\u0430 \u043F\u0440\u043E\u0442\u044F\u0437\u0456|\u043F\u0440\u043E\u0442\u044F\u0433\u043E\u043C|\u0443\u043F\u0440\u043E\u0434\u043E\u0432\u0436|\u0432\u043F\u0440\u043E\u0434\u043E\u0432\u0436)\\s*${oH}`,fs.flags)}innerExtract(e,t){let n=eh(t[1]);return X.createRelativeFromReference(e.reference,n)}}});var Lp,No,Mc=b(()=>{fe();ms();Lp=class extends U{patternLeftBoundary(){return fs.leftBoundary}innerPattern(e){return new RegExp(this.innerPatternString(e),fs.flags)}innerPatternHasChange(e,t){return!1}},No=class extends Lp{innerPattern(e){return new RegExp(`${this.innerPatternString(e)}${fs.rightBoundary}`,fs.flags)}}});var aH,lH,koe,cH,Vw,uH=b(()=>{zt();ms();ms();ms();ze();Mc();aH=1,lH=2,koe=3,cH=4,Vw=class extends No{innerPatternString(e){return`(?:\u0437|\u0456\u0437)?\\s*(${QM})(?:\\s{0,3}(?:\u043F\u043E|-|\u2013|\u0434\u043E)?\\s{0,3}(${QM}))?(?:-|\\/|\\s{0,3}(?:of)?\\s{0,3})(${ee(Zm)})(?:(?:-|\\/|,?\\s{0,3})(${_A}(?![^\\s]\\d)))?`}innerExtract(e,t){let n=e.createParsingResult(t.index,t[0]),i=Zm[t[koe].toLowerCase()],o=XM(t[aH]);if(o>31)return t.index=t.index+t[aH].length,null;if(n.start.assign("month",i),n.start.assign("day",o),t[cH]){let s=AA(t[cH]);n.start.assign("year",s)}else{let s=ft(e.reference.instant,o,i);n.start.imply("year",s)}if(t[lH]){let s=XM(t[lH]);n.end=n.start.clone(),n.end.assign("day",s)}return n}}});var Soe,dH,qw,pH=b(()=>{ms();zt();ze();ms();Mc();Soe=2,dH=3,qw=class extends Lp{innerPatternString(e){return`((?:\u0432|\u0443)\\s*)?(${ee(Zm)})\\s*(?:[,-]?\\s*(${_A})?)?(?=[^\\s\\w]|\\s+[^0-9]|\\s+$|$)`}innerExtract(e,t){let n=t[Soe].toLowerCase();if(t[0].length<=3&&!KM[n])return null;let i=e.createParsingResult(t.index,t.index+t[0].length);i.start.imply("day",1);let o=Zm[n];if(i.start.assign("month",o),t[dH]){let s=AA(t[dH]);i.start.assign("year",s)}else{let s=ft(e.reference.instant,1,o);i.start.imply("year",s)}return i}}});var Ww,fH=b(()=>{pt();$a();ms();Ww=class extends Yr{constructor(e){super(e)}patternFlags(){return fs.flags}primaryPatternLeftBoundary(){return"(^|\\s|T|(?:[^\\p{L}\\p{N}_]))"}followingPhase(){return"\\s*(?:\\-|\\\u2013|\\~|\\\u301C|\u0434\u043E|\u0456|\u043F\u043E|\\?)\\s*"}primaryPrefix(){return"(?:(?:\u0432|\u0443|\u043E|\u043E\u0431|\u0437|\u0456\u0437|\u0432\u0456\u0434)\\s*)??"}primarySuffix(){return`(?:\\s*(?:\u0440\u0430\u043D\u043A\u0443|\u0432\u0435\u0447\u043E\u0440\u0430|\u043F\u043E \u043E\u0431\u0456\u0434\u0456|\u043F\u0456\u0441\u043B\u044F \u043E\u0431\u0456\u0434\u0443))?(?!\\/)${fs.rightBoundary}`}extractPrimaryTimeComponents(e,t){let n=super.extractPrimaryTimeComponents(e,t);if(n){if(t[0].endsWith("\u0432\u0435\u0447\u043E\u0440\u0430")){let i=n.get("hour");i>=6&&i<12?(n.assign("hour",n.get("hour")+12),n.assign("meridiem",G.PM)):i<6&&n.assign("meridiem",G.AM)}if(t[0].endsWith("\u043F\u043E \u043E\u0431\u0456\u0434\u0456")||t[0].endsWith("\u043F\u0456\u0441\u043B\u044F \u043E\u0431\u0456\u0434\u0443")){n.assign("meridiem",G.PM);let i=n.get("hour");i>=0&&i<=6&&n.assign("hour",n.get("hour")+12)}t[0].endsWith("\u0440\u0430\u043D\u043A\u0443")&&(n.assign("meridiem",G.AM),n.get("hour")<12&&n.assign("hour",n.get("hour")))}return n}}});var zw,mH=b(()=>{ms();Le();Mc();Bt();zw=class extends Lp{innerPatternString(e){return`(${Jm})\\s{0,5}\u0442\u043E\u043C\u0443(?=(?:\\W|$))`}innerExtract(e,t){let n=eh(t[1]),i=tt(n);return X.createRelativeFromReference(e.reference,i)}}});var Hw,hH=b(()=>{vo();Hw=class extends Yt{patternBetween(){return/^\s*(і до|і по|до|по|-)\s*$/i}}});var jw,gH=b(()=>{yo();jw=class extends Kt{patternBetween(){return new RegExp("^\\s*(T|\u0432|\u0443|\u043E|,|-)?\\s*$")}}});var Gw,vH=b(()=>{si();Mc();Gw=class extends No{innerPatternString(e){return"(?:\u0437|\u0456\u0437|\u0432\u0456\u0434)?\\s*(\u0441\u044C\u043E\u0433\u043E\u0434\u043D\u0456|\u0432\u0447\u043E\u0440\u0430|\u0437\u0430\u0432\u0442\u0440\u0430|\u043F\u0456\u0441\u043B\u044F\u0437\u0430\u0432\u0442\u0440\u0430|\u043F\u0456\u0441\u043B\u044F\u043F\u0456\u0441\u043B\u044F\u0437\u0430\u0432\u0442\u0440\u0430|\u043F\u043E\u0437\u0430\u043F\u043E\u0437\u0430\u0432\u0447\u043E\u0440\u0430|\u043F\u043E\u0437\u0430\u0432\u0447\u043E\u0440\u0430)"}innerExtract(e,t){let n=t[1].toLowerCase(),i=e.createParsingComponents();switch(n){case"\u0441\u044C\u043E\u0433\u043E\u0434\u043D\u0456":return Tr(e.reference);case"\u0432\u0447\u043E\u0440\u0430":return vn(e.reference);case"\u0437\u0430\u0432\u0442\u0440\u0430":return yn(e.reference);case"\u043F\u0456\u0441\u043B\u044F\u0437\u0430\u0432\u0442\u0440\u0430":return Mo(e.reference,2);case"\u043F\u0456\u0441\u043B\u044F\u043F\u0456\u0441\u043B\u044F\u0437\u0430\u0432\u0442\u0440\u0430":return Mo(e.reference,3);case"\u043F\u043E\u0437\u0430\u0432\u0447\u043E\u0440\u0430":return kc(e.reference,2);case"\u043F\u043E\u0437\u0430\u043F\u043E\u0437\u0430\u0432\u0447\u043E\u0440\u0430":return kc(e.reference,3)}return i}}});var Yw,yH=b(()=>{si();on();Mc();Yw=class extends No{innerPatternString(e){return"(\u0437\u0430\u0440\u0430\u0437|\u043C\u0438\u043D\u0443\u043B\u043E\u0433\u043E\\s*\u0432\u0435\u0447\u043E\u0440\u0430|\u043C\u0438\u043D\u0443\u043B\u043E\u0457\\s*\u043D\u043E\u0447\u0456|\u043D\u0430\u0441\u0442\u0443\u043F\u043D\u043E\u0457\\s*\u043D\u043E\u0447\u0456|\u0441\u044C\u043E\u0433\u043E\u0434\u043D\u0456\\s*\u0432\u043D\u043E\u0447\u0456|\u0446\u0456\u0454\u0457\\s*\u043D\u043E\u0447\u0456|\u0446\u044C\u043E\u0433\u043E \u0440\u0430\u043D\u043A\u0443|\u0432\u0440\u0430\u043D\u0446\u0456|\u0440\u0430\u043D\u043A\u0443|\u0437\u0440\u0430\u043D\u043A\u0443|\u043E\u043F\u0456\u0432\u0434\u043D\u0456|\u0432\u0432\u0435\u0447\u0435\u0440\u0456|\u0432\u0435\u0447\u043E\u0440\u0430|\u043E\u043F\u0456\u0432\u043D\u043E\u0447\u0456|\u0432\u043D\u043E\u0447\u0456)"}innerExtract(e,t){let n=e.refDate,i=t[0].toLowerCase(),o=e.createParsingComponents();if(i==="\u0437\u0430\u0440\u0430\u0437")return $r(e.reference);if(i==="\u0432\u0432\u0435\u0447\u0435\u0440\u0456"||i==="\u0432\u0435\u0447\u043E\u0440\u0430")return Sc(e.reference);if(i.endsWith("\u0432\u0440\u0430\u043D\u0446\u0456")||i.endsWith("\u0440\u0430\u043D\u043A\u0443")||i.endsWith("\u0437\u0440\u0430\u043D\u043A\u0443"))return Ic(e.reference);if(i.endsWith("\u043E\u043F\u0456\u0432\u0434\u043D\u0456"))return qu(e.reference);if(i.match(/минулої\s*ночі/))return nA(e.reference);if(i.match(/минулого\s*вечора/))return iA(e.reference);if(i.match(/наступної\s*ночі/)){let s=n.getHours()<22?1:2,a=new Date(n.getTime());a.setDate(a.getDate()+s),nt(o,a),o.imply("hour",1)}return i.match(/цієї\s*ночі/)?Dc(e.reference):i.endsWith("\u043E\u043F\u0456\u0432\u043D\u043E\u0447\u0456")||i.endsWith("\u0432\u043D\u043E\u0447\u0456")?Dc(e.reference):o}}});var Doe,Ioe,Poe,Kw,bH=b(()=>{ms();ze();Ki();Mc();Doe=1,Ioe=2,Poe=3,Kw=class extends No{innerPatternString(e){return`(?:(?:,|\\(|\uFF08)\\s*)?(?:\u0432\\s*?)?(?:\u0443\\s*?)?(?:(\u0446\u0435\u0439|\u043C\u0438\u043D\u0443\u043B\u043E\u0433\u043E|\u043C\u0438\u043D\u0443\u043B\u0438\u0439|\u043F\u043E\u043F\u0435\u0440\u0435\u0434\u043D\u0456\u0439|\u043F\u043E\u043F\u0435\u0440\u0435\u0434\u043D\u044C\u043E\u0433\u043E|\u043D\u0430\u0441\u0442\u0443\u043F\u043D\u043E\u0433\u043E|\u043D\u0430\u0441\u0442\u0443\u043F\u043D\u0438\u0439|\u043D\u0430\u0441\u0442\u0443\u043F\u043D\u043E\u043C\u0443)\\s*)?(${ee(YM)})(?:\\s*(?:,|\\)|\uFF09))?(?:\\s*(\u043D\u0430|\u0443|\u0432)\\s*(\u0446\u044C\u043E\u043C\u0443|\u043C\u0438\u043D\u0443\u043B\u043E\u043C\u0443|\u043D\u0430\u0441\u0442\u0443\u043F\u043D\u043E\u043C\u0443)\\s*\u0442\u0438\u0436\u043D\u0456)?`}innerExtract(e,t){let n=t[Ioe].toLocaleLowerCase(),i=YM[n],o=t[Doe],s=t[Poe],a=o||s;a=a||"",a=a.toLocaleLowerCase();let l=null;return a=="\u043C\u0438\u043D\u0443\u043B\u043E\u0433\u043E"||a=="\u043C\u0438\u043D\u0443\u043B\u0438\u0439"||a=="\u043F\u043E\u043F\u0435\u0440\u0435\u0434\u043D\u0456\u0439"||a=="\u043F\u043E\u043F\u0435\u0440\u0435\u0434\u043D\u044C\u043E\u0433\u043E"?l="last":a=="\u043D\u0430\u0441\u0442\u0443\u043F\u043D\u043E\u0433\u043E"||a=="\u043D\u0430\u0441\u0442\u0443\u043F\u043D\u0438\u0439"?l="next":(a=="\u0446\u0435\u0439"||a=="\u0446\u044C\u043E\u0433\u043E"||a=="\u0446\u044C\u043E\u043C\u0443")&&(l="this"),cr(e.reference,i,l)}}});var Foe,Moe,Qw,wH=b(()=>{ms();Le();ze();Mc();Foe=1,Moe=2,Qw=class extends No{innerPatternString(e){return`(\u0432 \u043C\u0438\u043D\u0443\u043B\u043E\u043C\u0443|\u0443 \u043C\u0438\u043D\u0443\u043B\u043E\u043C\u0443|\u043D\u0430 \u043C\u0438\u043D\u0443\u043B\u043E\u043C\u0443|\u043C\u0438\u043D\u0443\u043B\u043E\u0433\u043E|\u043D\u0430 \u043D\u0430\u0441\u0442\u0443\u043F\u043D\u043E\u043C\u0443|\u0432 \u043D\u0430\u0441\u0442\u0443\u043F\u043D\u043E\u043C\u0443|\u0443 \u043D\u0430\u0441\u0442\u0443\u043F\u043D\u043E\u043C\u0443|\u043D\u0430\u0441\u0442\u0443\u043F\u043D\u043E\u0433\u043E|\u043D\u0430 \u0446\u044C\u043E\u043C\u0443|\u0432 \u0446\u044C\u043E\u043C\u0443|\u0443 \u0446\u044C\u043E\u043C\u0443|\u0446\u044C\u043E\u0433\u043E)\\s*(${ee(Bw)})(?=\\s*)`}innerExtract(e,t){let n=t[Foe].toLowerCase(),i=t[Moe].toLowerCase(),o=Bw[i];if(n=="\u043D\u0430 \u043D\u0430\u0441\u0442\u0443\u043F\u043D\u043E\u043C\u0443"||n=="\u0432 \u043D\u0430\u0441\u0442\u0443\u043F\u043D\u043E\u043C\u0443"||n=="\u0443 \u043D\u0430\u0441\u0442\u0443\u043F\u043D\u043E\u043C\u0443"||n=="\u043D\u0430\u0441\u0442\u0443\u043F\u043D\u043E\u0433\u043E"){let l={};return l[o]=1,X.createRelativeFromReference(e.reference,l)}if(n=="\u043D\u0430 \u043C\u0438\u043D\u0443\u043B\u043E\u043C\u0443"||n=="\u0432 \u043C\u0438\u043D\u0443\u043B\u043E\u043C\u0443"||n=="\u0443 \u043C\u0438\u043D\u0443\u043B\u043E\u043C\u0443"||n=="\u043C\u0438\u043D\u0443\u043B\u043E\u0433\u043E"){let l={};return l[o]=-1,X.createRelativeFromReference(e.reference,l)}let s=e.createParsingComponents(),a=new Date(e.reference.instant.getTime());return o.match(/week/i)?(a.setDate(a.getDate()-a.getDay()),s.imply("day",a.getDate()),s.imply("month",a.getMonth()+1),s.imply("year",a.getFullYear())):o.match(/month/i)?(a.setDate(1),s.imply("day",a.getDate()),s.assign("year",a.getFullYear()),s.assign("month",a.getMonth()+1)):o.match(/year/i)&&(a.setDate(1),a.setMonth(0),s.imply("day",a.getDate()),s.imply("month",a.getMonth()+1),s.assign("year",a.getFullYear())),s}}});var Xw,CH=b(()=>{ms();Le();Mc();Bt();Xw=class extends No{innerPatternString(e){return`(\u0446\u0456|\u043E\u0441\u0442\u0430\u043D\u043D\u0456|\u043C\u0438\u043D\u0443\u043B\u0456|\u043C\u0430\u0439\u0431\u0443\u0442\u043D\u0456|\u043D\u0430\u0441\u0442\u0443\u043F\u043D\u0456|\u043F\u0456\u0441\u043B\u044F|\u0447\u0435\u0440\u0435\u0437|\\+|-)\\s*(${Jm})`}innerExtract(e,t){let n=t[1].toLowerCase(),i=eh(t[3]);switch(n){case"\u043E\u0441\u0442\u0430\u043D\u043D\u0456":case"\u043C\u0438\u043D\u0443\u043B\u0456":case"-":i=tt(i);break}return X.createRelativeFromReference(e.reference,i)}}});var eR={};Jr(eR,{Chrono:()=>Se,Meridiem:()=>G,ParsingComponents:()=>X,ParsingResult:()=>at,ReferenceWithTimezone:()=>ct,Weekday:()=>Oe,casual:()=>ZM,createCasualConfiguration:()=>xH,createConfiguration:()=>JM,parse:()=>$oe,parseDate:()=>Ooe,strict:()=>Roe});function xH(){let r=JM(!1);return r.parsers.unshift(new Gw),r.parsers.unshift(new Yw),r.parsers.unshift(new qw),r.parsers.unshift(new Qw),r.parsers.unshift(new Xw),r}function JM(r){return Ht({parsers:[new bo,new vr(!0),new Uw,new Vw,new Kw,new Ww(r),new zw],refiners:[new jw,new Hw]},r)}function $oe(r,e,t){return ZM.parse(r,e,t)}function Ooe(r,e,t){return ZM.parseDate(r,e,t)}var ZM,Roe,EH=b(()=>{sH();uH();pH();fH();mH();hH();gH();Ei();vH();yH();bH();wH();ai();Le();pt();cs();CH();bp();ZM=new Se(xH()),Roe=new Se(JM(!0))});function Noe(r){let e=r.toLowerCase();return tR[e]!==void 0?tR[e]:e==="un"||e==="un'"||e==="una"||e==="uno"?1:e.match(/qualche/)?3:e.match(/mezz/)?.5:e.match(/paio/)?2:e.match(/alcuni/)?7:parseFloat(e)}function nh(r){let e=r.toLowerCase();return rR[e]!==void 0?rR[e]:(e=e.replace(/(?:°|ª|º)$/i,""),parseInt(e))}function ju(r){if(/BE/i.test(r))return r=r.replace(/BE/i,""),parseInt(r)-543;if(/BCE?/i.test(r))return r=r.replace(/BCE?/i,""),-parseInt(r);if(/(AD|CE)/i.test(r))return r=r.replace(/(AD|CE)/i,""),parseInt(r);let e=parseInt(r);return Gr(e)}function Js(r){let e={},t=r,n=TH.exec(t);for(;n;)Boe(e,n),t=t.substring(n[0].length).trim(),n=TH.exec(t);return Object.keys(e).length==0?null:e}function Boe(r,e){if(e[0].match(/^[a-zA-Z]+$/))return;let t=Noe(e[1]),n=th[e[2].toLowerCase()];r[n]=t}var kA,nR,Zs,tR,rR,_H,th,AH,rh,Hu,kH,TH,Loe,SH,Rc,Gu,qn=b(()=>{ze();zt();kA={domenica:0,dom:0,"dom.":0,luned\u00EC:1,lunedi:1,lun:1,"lun.":1,marted\u00EC:2,martedi:2,mar:2,"mar.":2,mercoled\u00EC:3,mercoledi:3,mer:3,"mer.":3,gioved\u00EC:4,giovedi:4,gio:4,"gio.":4,venerd\u00EC:5,venerdi:5,ven:5,"ven.":5,sabato:6,sab:6,"sab.":6},nR={gennaio:1,febbraio:2,marzo:3,aprile:4,maggio:5,giugno:6,luglio:7,agosto:8,settembre:9,ottobre:10,novembre:11,dicembre:12},Zs={...nR,gen:1,"gen.":1,feb:2,"feb.":2,mar:3,"mar.":3,apr:4,"apr.":4,mag:5,"mag.":5,giu:6,"giu.":6,lug:7,"lug.":7,ago:8,"ago.":8,set:9,"set.":9,sett:9,"sett.":9,ott:10,"ott.":10,nov:11,"nov.":11,dic:12,"dic.":12},tR={uno:1,una:1,un:1,due:2,tre:3,quattro:4,cinque:5,sei:6,sette:7,otto:8,nove:9,dieci:10,undici:11,dodici:12},rR={primo:1,prima:1,"1\xB0":1,"1\xAA":1,secondo:2,seconda:2,"2\xB0":2,"2\xAA":2,terzo:3,terza:3,"3\xB0":3,"3\xAA":3,quarto:4,quarta:4,"4\xB0":4,"4\xAA":4,quinto:5,quinta:5,"5\xB0":5,"5\xAA":5,sesto:6,sesta:6,"6\xB0":6,"6\xAA":6,settimo:7,settima:7,"7\xB0":7,"7\xAA":7,ottavo:8,ottava:8,"8\xB0":8,"8\xAA":8,nono:9,nona:9,"9\xB0":9,"9\xAA":9,decimo:10,decima:10,"10\xB0":10,"10\xAA":10,undicesimo:11,undicesima:11,"11\xB0":11,"11\xAA":11,dodicesimo:12,dodicesima:12,"12\xB0":12,"12\xAA":12,tredicesimo:13,tredicesima:13,"13\xB0":13,"13\xAA":13,quattordicesimo:14,quattordicesima:14,"14\xB0":14,"14\xAA":14,quindicesimo:15,quindicesima:15,"15\xB0":15,"15\xAA":15,sedicesimo:16,sedicesima:16,"16\xB0":16,"16\xAA":16,diciassettesimo:17,diciassettesima:17,"17\xB0":17,"17\xAA":17,diciottesimo:18,diciottesima:18,"18\xB0":18,"18\xAA":18,diciannovesimo:19,diciannovesima:19,"19\xB0":19,"19\xAA":19,ventesimo:20,ventesima:20,"20\xB0":20,"20\xAA":20,ventunesimo:21,ventunesima:21,"21\xB0":21,"21\xAA":21,ventiduesimo:22,ventiduesima:22,"22\xB0":22,"22\xAA":22,ventitreesimo:23,ventitreesima:23,"23\xB0":23,"23\xAA":23,ventiquattresimo:24,ventiquattresima:24,"24\xB0":24,"24\xAA":24,venticinquesimo:25,venticinquesima:25,"25\xB0":25,"25\xAA":25,ventiseiesimo:26,ventiseiesima:26,"26\xB0":26,"26\xAA":26,ventisettesimo:27,ventisettesima:27,"27\xB0":27,"27\xAA":27,ventottesimo:28,ventottesima:28,"28\xB0":28,"28\xAA":28,ventinovesimo:29,ventinovesima:29,"29\xB0":29,"29\xAA":29,trentesimo:30,trentesima:30,"30\xB0":30,"30\xAA":30,trentunesimo:31,trentunesima:31,"31\xB0":31,"31\xAA":31},_H={secondo:"second",secondi:"second",minuto:"minute",minuti:"minute",ora:"hour",ore:"hour",giorno:"day",giorni:"day",settimana:"week",settimane:"week",mese:"month",mesi:"month",trimestre:"quarter",trimestri:"quarter",anno:"year",anni:"year"},th={s:"second",sec:"second",secondo:"second",secondi:"second",m:"minute",min:"minute",minuto:"minute",minuti:"minute",h:"hour",ora:"hour",ore:"hour",g:"day",gg:"day",giorno:"day",giorni:"day",sett:"week",settimana:"week",settimane:"week",mese:"month",mesi:"month",trim:"quarter",trimestre:"quarter",trimestri:"quarter",anno:"year",anni:"year",..._H},AH=`(?:${ee(tR)}|[0-9]+|[0-9]+\\.[0-9]+|mezz[oa]?(?:\\s{0,2})?|un(?:'|\\s{0,2})?|qualche|alcuni|paio\\s{0,2}(?:di)?)`;rh=`(?:${ee(rR)}|[0-9]{1,2}(?:\xB0|\xAA|\xBA)?)`;Hu="(?:[1-9][0-9]{0,3}\\s{0,2}(?:BE|AD|BC|BCE|CE)|[1-2][0-9]{3}|[5-9][0-9]|2[0-5])";kH=`(${AH})\\s{0,3}(${ee(th)})`,TH=new RegExp(kH,"i"),Loe=`(${AH})\\s{0,3}(${ee(_H)})`,SH="\\s{0,5},?(?:\\s*e)?\\s{0,5}",Rc=Er("(?:(?:circa|approssimativamente)\\s{0,3})?",kH,SH),Gu=Er("(?:(?:circa|approssimativamente)\\s{0,3})?",Loe,SH)});var Uoe,Voe,qoe,Zw,DH=b(()=>{qn();Le();fe();Uoe=new RegExp(`(?:(?:entro|tra|fra|in|per)\\s*)?(?:(?:circa|approssimativamente)\\s*(?:~\\s*)?)?(${Rc})(?=\\W|$)`,"i"),Voe=new RegExp(`(?:entro|tra|fra|in|per)\\s*(?:(?:circa|approssimativamente)\\s*(?:~\\s*)?)?(${Rc})(?=\\W|$)`,"i"),qoe=new RegExp(`(?:entro|tra|fra|in|per)\\s*(?:(?:circa|approssimativamente)\\s*(?:~\\s*)?)?(${Gu})(?=\\W|$)`,"i"),Zw=class extends U{constructor(t){super();ae(this,"strictMode");this.strictMode=t}innerPattern(t){return this.strictMode?qoe:t.option.forwardDate?Uoe:Voe}innerExtract(t,n){if(n[0].match(/^per\s*(il|la|l')\s*\w+/))return null;let i=Js(n[1]);return i?X.createRelativeFromReference(t.reference,i):null}}});var Woe,IH,PH,zoe,FH,Jw,MH=b(()=>{zt();qn();qn();qn();ze();fe();Woe=new RegExp(`(?:il\\s{0,3})?(${rh})(?:\\s{0,3}(?:al|\\-|\\\u2013|fino\\s*al?)?\\s{0,3}(${rh}))?(?:-|/|\\s{0,3}(?:di)?\\s{0,3})(${ee(Zs)})(?:(?:-|/|,?\\s{0,3})(${Hu}(?!\\w)))?(?=\\W|$)`,"i"),IH=1,PH=2,zoe=3,FH=4,Jw=class extends U{innerPattern(){return Woe}innerExtract(e,t){let n=e.createParsingResult(t.index,t[0]),i=Zs[t[zoe].toLowerCase()],o=nh(t[IH]);if(o>31)return t.index=t.index+t[IH].length,null;if(n.start.assign("month",i),n.start.assign("day",o),t[FH]){let s=ju(t[FH]);n.start.assign("year",s)}else{let s=ft(e.refDate,o,i);n.start.imply("year",s)}if(t[PH]){let s=nh(t[PH]);n.end=n.start.clone(),n.end.assign("day",s)}return n}}});var Hoe,joe,RH,iR,oR,eC,$H=b(()=>{zt();qn();qn();qn();ze();fe();Hoe=new RegExp(`(${ee(Zs)})(?:-|/|\\s*,?\\s*)(${rh})(?!\\s*(?:am|pm))\\s*(?:(?:al|\\-)\\s*(${rh})\\s*)?(?:(?:-|/|\\s*,\\s*|\\s+)(${Hu}))?(?=\\W|$)(?!\\:\\d)`,"i"),joe=1,RH=2,iR=3,oR=4,eC=class extends U{constructor(t){super();ae(this,"shouldSkipYearLikeDate");this.shouldSkipYearLikeDate=t}innerPattern(){return Hoe}innerExtract(t,n){let i=Zs[n[joe].toLowerCase()],o=nh(n[RH]);if(o>31||this.shouldSkipYearLikeDate&&!n[iR]&&!n[oR]&&n[RH].match(/^2[0-5]$/))return null;let s=t.createParsingComponents({day:o,month:i}).addTag("parser/ITMonthNameMiddleEndianParser");if(n[oR]){let c=ju(n[oR]);s.assign("year",c)}else{let c=ft(t.refDate,o,i);s.imply("year",c)}if(!n[iR])return s;let a=nh(n[iR]),l=t.createParsingResult(n.index,n[0]);return l.start=s,l.end=s.clone(),l.end.assign("day",a),l}}});var Goe,Yoe,Koe,OH,tC,NH=b(()=>{qn();zt();ze();qn();fe();Goe=new RegExp(`((?:a|in|di|del)\\s*)?(${ee(Zs)})\\s*(?:(?:,|-|del)?\\s*(${Hu})?)?(?=[^\\s\\w]|\\s+[^0-9]|\\s+$|$)`,"i"),Yoe=1,Koe=2,OH=3,tC=class extends U{innerPattern(){return Goe}innerExtract(e,t){let n=t[Koe].toLowerCase();if(t[0].length<=3&&!nR[n])return null;let i=e.createParsingResult(t.index+(t[Yoe]||"").length,t.index+t[0].length);i.start.imply("day",1),i.start.addTag("parser/ITMonthNameParser");let o=Zs[n];if(i.start.assign("month",o),t[OH]){let s=ju(t[OH]);i.start.assign("year",s)}else{let s=ft(e.refDate,1,o);i.start.imply("year",s)}return i}}});var Qoe,Xoe,Zoe,LH,Joe,rC,BH=b(()=>{qn();ze();fe();Qoe=new RegExp(`([0-9]{4})[-\\.\\/\\s](?:(${ee(Zs)})|([0-9]{1,2}))[-\\.\\/\\s]([0-9]{1,2})(?=\\W|$)`,"i"),Xoe=1,Zoe=2,LH=3,Joe=4,rC=class extends U{constructor(t){super();ae(this,"strictMonthDateOrder");this.strictMonthDateOrder=t}innerPattern(){return Qoe}innerExtract(t,n){let i=parseInt(n[Xoe]),o=parseInt(n[Joe]),s=n[LH]?parseInt(n[LH]):Zs[n[Zoe].toLowerCase()];if(s<1||s>12){if(this.strictMonthDateOrder)return null;o>=1&&o<=12&&([s,o]=[o,s])}return o<1||o>31?null:{day:o,month:s,year:i}}}});var ese,tse,rse,nC,UH=b(()=>{fe();ese=new RegExp("([0-9]|0[1-9]|1[012])/([0-9]{4})","i"),tse=1,rse=2,nC=class extends U{innerPattern(){return ese}innerExtract(e,t){let n=parseInt(t[rse]),i=parseInt(t[tse]);return e.createParsingComponents().imply("day",1).assign("month",i).assign("year",n)}}});var iC,VH=b(()=>{pt();$a();iC=class extends Yr{constructor(e){super(e)}followingPhase(){return"\\s*(?:\\-|\\\u2013|\\~|\\\u301C|a|fino\\s*a|alle?|\\?)\\s*"}primaryPrefix(){return"(?:(?:alle?|dalle?)\\s*)??"}primarySuffix(){return"(?:\\s*(?:di\\s*(?:sera|notte|mattina|pomeriggio)))?(?!/)(?=\\W|$)"}extractPrimaryTimeComponents(e,t){let n=super.extractPrimaryTimeComponents(e,t);if(!n)return n;if(t[0].match(/di\s*(?:sera|notte)/i)){let i=n.get("hour");i>=6&&i<12?(n.assign("hour",n.get("hour")+12),n.assign("meridiem",G.PM)):i<6&&n.assign("meridiem",G.AM)}if(t[0].match(/di\s*pomeriggio/i)){n.assign("meridiem",G.PM);let i=n.get("hour");i>=0&&i<=6&&n.assign("hour",n.get("hour")+12)}return t[0].match(/di\s*mattina/i)&&(n.assign("meridiem",G.AM),n.get("hour")<12&&n.assign("hour",n.get("hour"))),n.addTag("parser/ITTimeExpressionParser")}extractFollowingTimeComponents(e,t,n){let i=super.extractFollowingTimeComponents(e,t,n);return i&&i.addTag("parser/ITTimeExpressionParser"),i}}});var nse,ise,oC,qH=b(()=>{qn();Le();fe();Bt();nse=new RegExp(`(${Rc})\\s{0,5}(?:fa|prima)(?=\\W|$)`,"i"),ise=new RegExp(`(${Gu})\\s{0,5}(?:fa|prima)(?=\\W|$)`,"i"),oC=class extends U{constructor(t){super();ae(this,"strictMode");this.strictMode=t}innerPattern(){return this.strictMode?ise:nse}innerExtract(t,n){let i=Js(n[1]);return i?X.createRelativeFromReference(t.reference,tt(i)):null}}});var ose,sse,ase,sC,WH=b(()=>{qn();Le();fe();ose=new RegExp(`(${Rc})\\s{0,5}(?:dopo|pi\xF9\\s*tardi|da\\s*adesso|da\\s*ora)(?=(?:\\W|$))`,"i"),sse=new RegExp(`(${Gu})\\s{0,5}(dopo|pi\xF9\\s*tardi|da\\s*adesso|da\\s*ora)(?=\\W|$)`,"i"),ase=1,sC=class extends U{constructor(t){super();ae(this,"strictMode");this.strictMode=t}innerPattern(){return this.strictMode?sse:ose}innerExtract(t,n){let i=Js(n[ase]);return i?X.createRelativeFromReference(t.reference,i):null}}});var aC,zH=b(()=>{vo();aC=class extends Yt{patternBetween(){return/^\s*(a|al|-|–|fino\s*a|fino\s*al)\s*$/i}}});var ih,HH=b(()=>{yo();ih=class extends Kt{patternBetween(){return new RegExp("^\\s*(T|alle?|dopo\\s*le|prima\\s*delle?|,|-|\\.|\u2219|:)?\\s*$")}}});var lse,lC,jH=b(()=>{fe();on();si();lse=/(adesso|ora|oggi|stasera|stanotte|domani|dopodomani|ieri|ieri\s*sera|ieri\s*notte)(?=\W|$)/i,lC=class extends U{innerPattern(e){return lse}innerExtract(e,t){let n=e.refDate,i=t[0].toLowerCase(),o=e.createParsingComponents();switch(i){case"adesso":case"ora":o=$r(e.reference);break;case"oggi":o=Tr(e.reference);break;case"ieri":o=vn(e.reference);break;case"domani":o=yn(e.reference);break;case"stasera":case"stanotte":o=rA(e.reference);break;case"dopodomani":o=Mo(e.reference,2);break;default:if(i.match(/ieri\s*sera/)||i.match(/ieri\s*notte/)){if(n.getHours()>6){let s=new Date(n.getTime());s.setDate(s.getDate()-1),n=s}nt(o,n),o.imply("hour",0)}break}return o.addTag("parser/ITCasualDateParser"),o}}});var cse,cC,GH=b(()=>{fe();si();cse=/(stamattina|stasera|stanotte|stamani)|(questa\s*)?(mattina|pomeriggio|sera|notte|mezzanotte|mezzogiorno)(?=\W|$)/i,cC=class extends U{innerPattern(){return cse}innerExtract(e,t){let n=null;if(t[1])switch(t[1].toLowerCase()){case"stamattina":case"stamani":n=Ic(e.reference);break;case"stasera":case"stanotte":n=Sc(e.reference);break}else if(t[3])switch(t[3].toLowerCase()){case"pomeriggio":n=oA(e.reference);break;case"sera":case"notte":n=Sc(e.reference);break;case"mezzanotte":n=Dc(e.reference);break;case"mattina":n=Ic(e.reference);break;case"mezzogiorno":n=qu(e.reference);break}return n&&n.addTag("parser/ITCasualTimeParser"),n}}});var use,dse,pse,fse,uC,YH=b(()=>{qn();ze();fe();Ki();pt();use=new RegExp(`(?:(?:\\,|\\(|\\\uFF08)\\s*)?(?:(questo|questa|quest'|scorso|scorsa|prossimo|prossima)\\s*)?(${ee(kA)}|weekend|fine\\s*settimana)(?:\\s*(?:\\,|\\)|\\\uFF09))?(?:\\s*(scorso|scorsa|prossimo|prossima)(?:\\s*settimana)?)?(?=\\W|$)`,"i"),dse=1,pse=2,fse=3,uC=class extends U{innerPattern(){return use}innerExtract(e,t){let n=t[dse],i=t[fse],o=n||i;o=o||"",o=o.toLowerCase();let s=null;o=="scorso"||o=="scorsa"?s="last":o=="prossimo"||o=="prossima"?s="next":(o=="questo"||o=="questa"||o=="quest'")&&(s="this");let a=t[pse].toLowerCase(),l;if(kA[a]!==void 0)l=kA[a];else if(a=="weekend"||a.match(/fine\s*settimana/))l=s=="last"?Oe.SUNDAY:Oe.SATURDAY;else return null;return cr(e.reference,l,s)}}});var mse,KH,hse,gse,vse,dC,QH=b(()=>{qn();Le();fe();ze();mse=new RegExp(`(?:(?:il\\s*|la\\s*|l'\\s*)?(questo|questa|quest'|scorso|scorsa|prossimo|prossima|dopo\\s*questo|dopo\\s*questa)\\s*(${ee(th)})|(?:il\\s*|la\\s*|l'\\s*)(${ee(th)})\\s*(scorso|scorsa|prossimo|prossima))(?=\\W|$)`,"i"),KH=1,hse=2,gse=3,vse=4,dC=class extends U{innerPattern(){return mse}innerExtract(e,t){let n,i;t[KH]?(n=t[KH].toLowerCase(),i=t[hse].toLowerCase()):(n=t[vse].toLowerCase(),i=t[gse].toLowerCase());let o=th[i];if(n=="prossimo"||n=="prossima"||n.startsWith("dopo")){let l={};return l[o]=1,X.createRelativeFromReference(e.reference,l)}if(n=="scorso"||n=="scorsa"){let l={};return l[o]=-1,X.createRelativeFromReference(e.reference,l)}let s=e.createParsingComponents(),a=new Date(e.reference.instant.getTime());return i.match(/settimana/i)?(a.setDate(a.getDate()-a.getDay()),s.imply("day",a.getDate()),s.imply("month",a.getMonth()+1),s.imply("year",a.getFullYear())):i.match(/mese/i)?(a.setDate(1),s.imply("day",a.getDate()),s.assign("year",a.getFullYear()),s.assign("month",a.getMonth()+1)):i.match(/anno/i)&&(a.setDate(1),a.setMonth(0),s.imply("day",a.getDate()),s.imply("month",a.getMonth()+1),s.assign("year",a.getFullYear())),s}}});var yse,bse,pC,XH=b(()=>{qn();Le();fe();Bt();yse=new RegExp(`(?:il\\s*|la\\s*|l'\\s*)?(questo|questa|quest'|scorso|scorsa|prossimo|prossima|dopo|\\+|-)\\s*(${Rc})(?=\\W|$)`,"i"),bse=new RegExp(`(?:il\\s*|la\\s*|l'\\s*)?(questo|questa|quest'|scorso|scorsa|prossimo|prossima|dopo|\\+|-)\\s*(${Gu})(?=\\W|$)`,"i"),pC=class extends U{constructor(t=!0){super();ae(this,"allowAbbreviations");this.allowAbbreviations=t}innerPattern(){return this.allowAbbreviations?yse:bse}innerExtract(t,n){let i=n[1].toLowerCase(),o=Js(n[2]);if(!o)return null;switch(i){case"scorso":case"scorsa":case"-":o=tt(o);break}return X.createRelativeFromReference(t.reference,o)}}});function wse(r){return r.text.match(/^[+-]/i)!=null}function ZH(r){return r.text.match(/^-/i)!=null}var fC,JH=b(()=>{Ys();Le();qn();Bt();fC=class extends oi{shouldMergeResults(e,t,n){return e.match(/^\s*$/i)?wse(n)||ZH(n):!1}mergeResults(e,t,n,i){let o=Js(n.text);ZH(n)&&(o=tt(o));let s=X.createRelativeFromReference(ct.fromDate(t.start.date()),o);return new at(t.reference,t.index,`${t.text}${e}${n.text}`,s)}}});function e6(r){return r.text.match(/\s+(prima|da)$/i)!=null}function Cse(r){return r.text.match(/\s+(dopo|dal?)$/i)!=null}var mC,t6=b(()=>{Ys();Le();qn();Bt();mC=class extends oi{patternBetween(){return/^\s*$/i}shouldMergeResults(e,t,n){return!e.match(this.patternBetween())||!e6(t)&&!Cse(t)?!1:!!n.start.get("day")&&!!n.start.get("month")&&!!n.start.get("year")}mergeResults(e,t,n){let i=Js(t.text);e6(t)&&(i=tt(i));let o=X.createRelativeFromReference(ct.fromDate(n.start.date()),i);return new at(n.reference,t.index,`${t.text}${e}${n.text}`,o)}}});var xse,Ese,hC,r6=b(()=>{qn();xse=new RegExp(`^\\s*(${Hu})`,"i"),Ese=1,hC=class{refine(e,t){return t.forEach(function(n){if(!n.start.isDateWithUnknownYear())return;let i=e.text.substring(n.index+n.text.length),o=xse.exec(i);if(!o||o[0].trim().length<=3)return;e.debug(()=>{console.log(`Extracting year: '${o[0]}' into : ${n}`)});let s=ju(o[Ese]);n.end!=null&&n.end.assign("year",s),n.start.assign("year",s),n.text+=o[0]}),t}}});var gC,n6=b(()=>{Ys();gC=class extends Vu{constructor(){super()}isValid(e,t){let n=t.text.trim();return n===e.text.trim()?!0:n.toLowerCase().endsWith("il secondo")||n.toLowerCase()==="secondo"?(e.text.substring(t.index+t.text.length).trim().length>0&&e.debug(()=>{console.log(`Removing unlikely result: ${t}`)}),!1):!0}}});var vC,i6=b(()=>{DH();MH();$H();NH();BH();UH();VH();qH();WH();zH();HH();Ei();jH();GH();YH();QH();cs();XH();JH();t6();eA();r6();n6();vC=class{createCasualConfiguration(){let e=this.createConfiguration(!1);return e.parsers.push(new lC),e.parsers.push(new cC),e.parsers.push(new tC),e.parsers.push(new dC),e.parsers.push(new pC),e.refiners.push(new gC),e}createConfiguration(e=!0){let t=Ht({parsers:[new vr(!0),new Zw(e),new Jw,new eC(!0),new uC,new nC,new iC(e),new oC(e),new sC(e)],refiners:[new ih]},e);return t.parsers.unshift(new rC(e)),t.refiners.unshift(new mC),t.refiners.unshift(new fC),t.refiners.unshift(new Cl),t.refiners.push(new ih),t.refiners.push(new hC),t.refiners.push(new aC),t}}});var lR={};Jr(lR,{Chrono:()=>Se,Meridiem:()=>G,ParsingComponents:()=>X,ParsingResult:()=>at,ReferenceWithTimezone:()=>ct,Weekday:()=>Oe,casual:()=>aR,configuration:()=>sR,parse:()=>_se,parseDate:()=>Ase,strict:()=>Tse});function _se(r,e,t){return aR.parse(r,e,t)}function Ase(r,e,t){return aR.parseDate(r,e,t)}var sR,aR,Tse,o6=b(()=>{ai();Le();pt();i6();sR=new vC,aR=new Se(sR.createCasualConfiguration()),Tse=new Se(sR.createConfiguration(!0))});function a6(r){let e={},t=r,n=s6.exec(t);for(;n;)Dse(e,n),t=t.substring(n[0].length),n=s6.exec(t);return e}function Dse(r,e){let t=Pse(e[1]),n=dR[e[2].toLowerCase()];r[n]=t}function Pse(r){let e=r.toLowerCase();return yC[e]!==void 0?yC[e]:parseInt(e)}function p6(r){if(/\d+/.test(r)){let t=parseInt(r);return t<100&&(t=Gr(t)),t}let e=r.toLowerCase();return yC[e]!==void 0?yC[e]:parseInt(r)}var cR,uR,kse,yC,dR,Sse,l6,GQe,YQe,c6,s6,Ise,u6,d6,bC=b(()=>{ze();zt();cR={s\u00F6ndag:0,s\u00F6n:0,so:0,m\u00E5ndag:1,m\u00E5n:1,m\u00E5:1,tisdag:2,tis:2,ti:2,onsdag:3,ons:3,on:3,torsdag:4,tors:4,to:4,fredag:5,fre:5,fr:5,l\u00F6rdag:6,l\u00F6r:6,l\u00F6:6},uR={januari:1,jan:1,"jan.":1,februari:2,feb:2,"feb.":2,mars:3,mar:3,"mar.":3,april:4,apr:4,"apr.":4,maj:5,juni:6,jun:6,"jun.":6,juli:7,jul:7,"jul.":7,augusti:8,aug:8,"aug.":8,september:9,sep:9,"sep.":9,sept:9,oktober:10,okt:10,"okt.":10,november:11,nov:11,"nov.":11,december:12,dec:12,"dec.":12},kse={f\u00F6rsta:1,andra:2,tredje:3,fj\u00E4rde:4,femte:5,sj\u00E4tte:6,sjunde:7,\u00E5ttonde:8,nionde:9,tionde:10,elfte:11,tolfte:12,trettonde:13,fjortonde:14,femtonde:15,sextonde:16,sjuttonde:17,artonde:18,nittonde:19,tjugonde:20,tjugof\u00F6rsta:21,tjugoandra:22,tjugotredje:23,tjugofj\u00E4rde:24,tjugofemte:25,tjugosj\u00E4tte:26,tjugosjunde:27,tjugo\u00E5ttonde:28,tjugonionde:29,trettionde:30,trettiof\u00F6rsta:31},yC={en:1,ett:1,tv\u00E5:2,tre:3,fyra:4,fem:5,sex:6,sju:7,\u00E5tta:8,nio:9,tio:10,elva:11,tolv:12,tretton:13,fjorton:14,femton:15,sexton:16,sjutton:17,arton:18,nitton:19,tjugo:20,tretti\u043E:30,fyrtio:40,femtio:50,sextio:60,sjuttio:70,\u00E5ttio:80,nittio:90,hundra:100,tusen:1e3},dR={sek:"second",sekund:"second",sekunder:"second",min:"minute",minut:"minute",minuter:"minute",tim:"hour",timme:"hour",timmar:"hour",dag:"day",dagar:"day",vecka:"week",veckor:"week",m\u00E5n:"month",m\u00E5nad:"month",m\u00E5nader:"month",\u00E5r:"year",kvart\u0430l:"quarter",kvartal:"quarter"},Sse={sekund:"second",sekunder:"second",minut:"minute",minuter:"minute",timme:"hour",timmar:"hour",dag:"day",dagar:"day",vecka:"week",veckor:"week",m\u00E5nad:"month",m\u00E5nader:"month",\u00E5r:"year",kvartal:"quarter"};l6=`(?:${ee(yC)}|\\d+)`,GQe=`(?:${ee(kse)}|\\d{1,2}(?:e|:e))`,YQe=`(?:${ee(dR)})`,c6=`(${l6})\\s{0,5}(${ee(dR)})\\s{0,5}`,s6=new RegExp(c6,"i"),Ise=`(${l6})\\s{0,5}(${ee(Sse)})\\s{0,5}`,u6=Er("",c6),d6=Er("",Ise)});var Fse,Mse,Rse,$se,wC,f6=b(()=>{bC();ze();fe();Ki();Fse=new RegExp(`(?:(?:\\,|\\(|\\\uFF08)\\s*)?(?:p\xE5\\s*?)?(?:(f\xF6rra|senaste|n\xE4sta|kommande)\\s*)?(${ee(cR)})(?:\\s*(?:\\,|\\)|\\\uFF09))?(?:\\s*(f\xF6rra|senaste|n\xE4sta|kommande)\\s*vecka)?(?=\\W|$)`,"i"),Mse=1,Rse=3,$se=2,wC=class extends U{innerPattern(){return Fse}innerExtract(e,t){let n=t[$se].toLowerCase(),i=cR[n],o=t[Mse],s=t[Rse],a=o||s;a=a||"",a=a.toLowerCase();let l=null;return a.match(/förra|senaste/)?l="last":a.match(/nästa|kommande/)&&(l="next"),cr(e.reference,i,l)}}});var Ose,m6,h6,Nse,g6,CC,v6=b(()=>{zt();bC();bC();ze();fe();Ose=new RegExp(`(?:den\\s*?)?([0-9]{1,2})(?:\\s*(?:till|\\-|\\\u2013|\\s)\\s*([0-9]{1,2}))?\\s*(${ee(uR)})(?:(?:-|/|,?\\s*)([0-9]{4}(?![^\\s]\\d)))?(?=\\W|$)`,"i"),m6=1,h6=2,Nse=3,g6=4,CC=class extends U{innerPattern(){return Ose}innerExtract(e,t){let n=e.createParsingResult(t.index,t[0]),i=uR[t[Nse].toLowerCase()],o=parseInt(t[m6]);if(o>31)return t.index=t.index+t[m6].length,null;if(n.start.assign("month",i),n.start.assign("day",o),t[g6]){let s=p6(t[g6]);n.start.assign("year",s)}else{let s=ft(e.refDate,o,i);n.start.imply("year",s)}if(t[h6]){let s=parseInt(t[h6]);n.end=n.start.clone(),n.end.assign("day",s)}return n}}});var Lse,Bse,xC,y6=b(()=>{bC();Le();fe();Bt();Lse=new RegExp(`(denna|den h\xE4r|f\xF6rra|passerade|n\xE4sta|kommande|efter|\\+|-)\\s*(${u6})(?=\\W|$)`,"i"),Bse=new RegExp(`(denna|den h\xE4r|f\xF6rra|passerade|n\xE4sta|kommande|efter|\\+|-)\\s*(${d6})(?=\\W|$)`,"i"),xC=class extends U{constructor(t=!0){super();ae(this,"allowAbbreviations");this.allowAbbreviations=t}innerPattern(){return this.allowAbbreviations?Lse:Bse}innerExtract(t,n){let i=n[1].toLowerCase(),o=a6(n[2]);if(!o)return null;switch(i){case"f\xF6rra":case"passerade":case"-":o=tt(o);break}return X.createRelativeFromReference(t.reference,o)}}});var Use,Vse,qse,EC,b6=b(()=>{fe();on();si();Use=new RegExp("(nu|idag|imorgon|\xF6vermorgon|ig\xE5r|f\xF6rrg\xE5r|i\\s*f\xF6rrg\xE5r)(?:\\s*(?:p\xE5\\s*)?(morgonen?|f\xF6rmiddagen?|middagen?|eftermiddagen?|kv\xE4llen?|natten?|midnatt))?(?=\\W|$)","i"),Vse=1,qse=2,EC=class extends U{innerPattern(e){return Use}innerExtract(e,t){let n=e.refDate,i=(t[Vse]||"").toLowerCase(),o=(t[qse]||"").toLowerCase(),s=e.createParsingComponents();switch(i){case"nu":s=$r(e.reference);break;case"idag":s=Tr(e.reference);break;case"imorgon":case"imorn":let a=new Date(n.getTime());a.setDate(a.getDate()+1),nt(s,a),Lt(s,a);break;case"ig\xE5r":let l=new Date(n.getTime());l.setDate(l.getDate()-1),nt(s,l),Lt(s,l);break;case"f\xF6rrg\xE5r":case"i f\xF6rrg\xE5r":let c=new Date(n.getTime());c.setDate(c.getDate()-2),nt(s,c),Lt(s,c);break}switch(o){case"morgon":case"morgonen":s.imply("hour",6),s.imply("minute",0),s.imply("second",0),s.imply("millisecond",0);break;case"f\xF6rmiddag":case"f\xF6rmiddagen":s.imply("hour",9),s.imply("minute",0),s.imply("second",0),s.imply("millisecond",0);break;case"middag":case"middagen":s.imply("hour",12),s.imply("minute",0),s.imply("second",0),s.imply("millisecond",0);break;case"eftermiddag":case"eftermiddagen":s.imply("hour",15),s.imply("minute",0),s.imply("second",0),s.imply("millisecond",0);break;case"kv\xE4ll":case"kv\xE4llen":s.imply("hour",20),s.imply("minute",0),s.imply("second",0),s.imply("millisecond",0);break;case"natt":case"natten":case"midnatt":o==="midnatt"?s.imply("hour",0):s.imply("hour",2),s.imply("minute",0),s.imply("second",0),s.imply("millisecond",0);break}return s}}});var mR={};Jr(mR,{Chrono:()=>Se,Meridiem:()=>G,ParsingComponents:()=>X,ParsingResult:()=>at,ReferenceWithTimezone:()=>ct,Weekday:()=>Oe,casual:()=>pR,createCasualConfiguration:()=>w6,createConfiguration:()=>fR,parse:()=>zse,parseDate:()=>Hse,strict:()=>Wse});function zse(r,e,t){return pR.parse(r,e,t)}function Hse(r,e,t){return pR.parseDate(r,e,t)}function w6(r=!0){let e=fR(!1,r);return e.parsers.unshift(new EC),e}function fR(r=!0,e=!0){return Ht({parsers:[new bo,new vr(e),new CC,new wC,new xC],refiners:[]},r)}var pR,Wse,C6=b(()=>{Ei();ai();Le();pt();cs();bp();f6();v6();y6();b6();pR=new Se(w6()),Wse=new Se(fR(!0))});var TC,x6=b(()=>{$a();TC=class extends Yr{primaryPrefix(){return"(?:(?:klo|kello)\\s*)?"}followingPhase(){return"\\s*(?:\\-|\\\u2013|\\~|\\\u301C)\\s*"}extractPrimaryTimeComponents(e,t){return t[0].match(/^\s*\d{4}\s*$/)?null:super.extractPrimaryTimeComponents(e,t)}}});function oh(r){let e={},t=r,n=E6.exec(t);for(;n;)Gse(e,n),t=t.substring(n[0].length),n=E6.exec(t);return e}function Gse(r,e){let t=Kse(e[1]),n=vR[e[2].toLowerCase()];r[n]=t}function Kse(r){let e=r.toLowerCase();return _C[e]!==void 0?_C[e]:parseInt(e)}function k6(r){if(/\d+/.test(r)){let t=parseInt(r);return t<100&&(t=Gr(t)),t}let e=r.toLowerCase();return _C[e]!==void 0?_C[e]:parseInt(r)}var hR,gR,_C,vR,jse,T6,IXe,_6,E6,Yse,sh,A6,Bp=b(()=>{ze();zt();hR={sunnuntai:0,sunnuntaina:0,su:0,maanantai:1,maanantaina:1,ma:1,tiistai:2,tiistaina:2,ti:2,keskiviikko:3,keskiviikkona:3,ke:3,torstai:4,torstaina:4,to:4,perjantai:5,perjantaina:5,pe:5,lauantai:6,lauantaina:6,la:6},gR={tammikuu:1,tammikuuta:1,tammikuun:1,tammi:1,helmikuu:2,helmikuuta:2,helmikuun:2,helmi:2,maaliskuu:3,maaliskuuta:3,maaliskuun:3,maalis:3,huhtikuu:4,huhtikuuta:4,huhtikuun:4,huhti:4,toukokuu:5,toukokuuta:5,toukokuun:5,touko:5,kes\u00E4kuu:6,kes\u00E4kuuta:6,kes\u00E4kuun:6,kes\u00E4:6,hein\u00E4kuu:7,hein\u00E4kuuta:7,hein\u00E4kuun:7,hein\u00E4:7,elokuu:8,elokuuta:8,elokuun:8,elo:8,syyskuu:9,syyskuuta:9,syyskuun:9,syys:9,lokakuu:10,lokakuuta:10,lokakuun:10,loka:10,marraskuu:11,marraskuuta:11,marraskuun:11,marras:11,joulukuu:12,joulukuuta:12,joulukuun:12,joulu:12},_C={yksi:1,yhden:1,kaksi:2,kahden:2,kolme:3,kolmen:3,nelj\u00E4:4,nelj\u00E4n:4,viisi:5,viiden:5,kuusi:6,kuuden:6,seitsem\u00E4n:7,kahdeksan:8,yhdeks\u00E4n:9,kymmenen:10},vR={s:"second",sek:"second",sekunti:"second",sekuntia:"second",sekunnin:"second",min:"minute",minuutti:"minute",minuuttia:"minute",minuutin:"minute",t:"hour",tunti:"hour",tuntia:"hour",tunnin:"hour",pv:"day",p\u00E4iv\u00E4:"day",p\u00E4iv\u00E4\u00E4:"day",p\u00E4iv\u00E4n:"day",vk:"week",viikko:"week",viikkoa:"week",viikon:"week",kk:"month",kuukausi:"month",kuukautta:"month",kuukauden:"month",vuosi:"year",vuotta:"year",vuoden:"year"},jse={sekunti:"second",sekuntia:"second",sekunnin:"second",minuutti:"minute",minuuttia:"minute",minuutin:"minute",tunti:"hour",tuntia:"hour",tunnin:"hour",p\u00E4iv\u00E4:"day",p\u00E4iv\u00E4\u00E4:"day",p\u00E4iv\u00E4n:"day",viikko:"week",viikkoa:"week",viikon:"week",kuukausi:"month",kuukautta:"month",kuukauden:"month",vuosi:"year",vuotta:"year",vuoden:"year"};T6=`(?:${ee(_C)}|\\d+)`,IXe=`(?:${ee(vR)})`,_6=`(${T6})\\s{0,5}(${ee(vR)})\\s{0,5}`,E6=new RegExp(_6,"i"),Yse=`(${T6})\\s{0,5}(${ee(jse)})\\s{0,5}`,sh=Er("",_6),A6=Er("",Yse)});var Qse,Xse,Zse,Jse,AC,S6=b(()=>{Bp();ze();fe();Ki();Qse=new RegExp(`(?:(?:\\,|\\(|\\\uFF08)\\s*)?(?:(viime|edellinen|edellisen\xE4|ensi|seuraava|seuraavana|t\xE4m\xE4|t\xE4n\xE4)\\s*)?(${ee(hR)})(?:\\s*(?:\\,|\\)|\\\uFF09))?(?:\\s*(viime|ensi|seuraava)\\s*viikolla)?(?=\\W|$)`,"i"),Xse=1,Zse=2,Jse=3,AC=class extends U{innerPattern(){return Qse}innerExtract(e,t){let n=t[Zse].toLowerCase(),i=hR[n],o=t[Xse],s=t[Jse],a=o||s;a=a||"",a=a.toLowerCase();let l=null;return a.match(/viime|edellinen|edellisenä/)?l="last":a.match(/ensi|seuraava|seuraavana/)&&(l="next"),cr(e.reference,i,l)}}});var eae,D6,I6,tae,P6,kC,F6=b(()=>{zt();Bp();Bp();ze();fe();eae=new RegExp(`([0-9]{1,2})\\.?(?:\\s*(?:\\-|\\\u2013|\\s)\\s*([0-9]{1,2})\\.?)?\\s*(${ee(gR)})(?:(?:-|/|,?\\s*)([0-9]{4}(?![^\\s]\\d)))?(?=\\W|$)`,"i"),D6=1,I6=2,tae=3,P6=4,kC=class extends U{innerPattern(){return eae}innerExtract(e,t){let n=e.createParsingResult(t.index,t[0]),i=gR[t[tae].toLowerCase()],o=parseInt(t[D6]);if(o>31)return t.index=t.index+t[D6].length,null;if(n.start.assign("month",i),n.start.assign("day",o),t[P6]){let s=k6(t[P6]);n.start.assign("year",s)}else{let s=ft(e.refDate,o,i);n.start.imply("year",s)}if(t[I6]){let s=parseInt(t[I6]);n.end=n.start.clone(),n.end.assign("day",s)}return n}}});var rae,nae,SC,M6=b(()=>{Bp();Le();fe();Bt();rae=new RegExp(`(seuraava|seuraavat|seuraavien|edellinen|edelliset|edellisten|viimeiset|viimeisten|kuluneet|kuluneiden|\\+|-)\\s*(${sh})(?=\\W|$)`,"i"),nae=new RegExp(`(seuraava|seuraavat|seuraavien|edellinen|edelliset|edellisten|viimeiset|viimeisten|kuluneet|kuluneiden|\\+|-)\\s*(${A6})(?=\\W|$)`,"i"),SC=class extends U{constructor(t=!0){super();ae(this,"allowAbbreviations");this.allowAbbreviations=t}innerPattern(){return this.allowAbbreviations?rae:nae}innerExtract(t,n){let i=n[1].toLowerCase(),o=oh(n[2]);if(!o)return null;switch(i){case"edellinen":case"edelliset":case"edellisten":case"viimeiset":case"viimeisten":case"kuluneet":case"kuluneiden":case"-":o=tt(o);break}return X.createRelativeFromReference(t.reference,o)}}});var DC,R6=b(()=>{Bp();Le();fe();Bt();DC=class extends U{innerPattern(){return new RegExp(`(${sh})\\s*sitten(?=\\W|$)`,"i")}innerExtract(e,t){let n=oh(t[1]),i=tt(n);return X.createRelativeFromReference(e.reference,i)}}});var IC,$6=b(()=>{Bp();Le();fe();IC=class extends U{innerPattern(){return new RegExp(`(${sh})\\s*(?:sis\xE4ll\xE4|kuluessa|p\xE4\xE4st\xE4)(?=\\W|$)`,"i")}innerExtract(e,t){let n=oh(t[1]);return X.createRelativeFromReference(e.reference,n)}}});var Up,yR=b(()=>{pt();fe();on();Up=class r extends U{innerPattern(e){return/(tänä\s*)?(aamulla|aamuna|aamupäivällä|päivällä|iltapäivällä|illalla|yöllä|keskiyöllä)(?=\W|$)/i}innerExtract(e,t){let n=e.refDate,i=t[2].toLowerCase(),o=e.createParsingComponents();return Lt(o,n),r.extractTimeComponents(o,i)}static extractTimeComponents(e,t){switch(t){case"aamulla":case"aamuna":e.imply("hour",6),e.imply("minute",0),e.imply("second",0),e.imply("meridiem",G.AM),e.addTag("casualReference/morning");break;case"aamup\xE4iv\xE4ll\xE4":e.imply("hour",9),e.imply("minute",0),e.imply("second",0),e.imply("meridiem",G.AM),e.addTag("casualReference/morning");break;case"p\xE4iv\xE4ll\xE4":e.imply("hour",12),e.imply("minute",0),e.imply("second",0),e.imply("meridiem",G.AM),e.addTag("casualReference/noon");break;case"iltap\xE4iv\xE4ll\xE4":e.imply("hour",15),e.imply("minute",0),e.imply("second",0),e.imply("meridiem",G.PM),e.addTag("casualReference/afternoon");break;case"illalla":e.imply("hour",18),e.imply("minute",0),e.imply("second",0),e.imply("meridiem",G.PM),e.addTag("casualReference/evening");break;case"y\xF6ll\xE4":e.imply("hour",22),e.imply("minute",0),e.imply("second",0),e.imply("meridiem",G.PM),e.addTag("casualReference/evening");break;case"keskiy\xF6ll\xE4":e.get("hour")>1&&e.addDurationAsImplied({day:1}),e.imply("hour",0),e.imply("minute",0),e.imply("second",0),e.imply("meridiem",G.AM),e.addTag("casualReference/midnight");break}return e}}});var iae,oae,sae,PC,O6=b(()=>{fe();on();yR();si();Bt();iae=new RegExp("(nyt|t\xE4n\xE4\xE4n|huomenna|ylihuomenna|eilen|toissap\xE4iv\xE4n\xE4|viime\\s*y\xF6n\xE4)(?:\\s*(aamulla|aamuna|aamup\xE4iv\xE4ll\xE4|p\xE4iv\xE4ll\xE4|iltap\xE4iv\xE4ll\xE4|illalla|y\xF6ll\xE4|keskiy\xF6ll\xE4))?(?=\\W|$)","i"),oae=1,sae=2,PC=class extends U{innerPattern(e){return iae}innerExtract(e,t){let n=e.reference.getDateWithAdjustedTimezone(),i=(t[oae]||"").toLowerCase(),o=(t[sae]||"").toLowerCase(),s=e.createParsingComponents();switch(i){case"nyt":s=$r(e.reference);break;case"t\xE4n\xE4\xE4n":s=Tr(e.reference);break;case"huomenna":n=vt(n,{day:1}),nt(s,n),Lt(s,n);break;case"ylihuomenna":n=vt(n,{day:2}),nt(s,n),Lt(s,n);break;case"eilen":n=vt(n,{day:-1}),nt(s,n),Lt(s,n);break;case"toissap\xE4iv\xE4n\xE4":n=vt(n,{day:-2}),nt(s,n),Lt(s,n);break;default:i.match(/viime\s*yönä/)&&(n.getHours()>6&&(n=vt(n,{day:-1})),nt(s,n),s.imply("hour",0));break}return o&&(s=Up.extractTimeComponents(s,o)),s}}});var FC,N6=b(()=>{vo();FC=class extends Yt{patternBetween(){return/^\s*(-|–)\s*$/i}}});var MC,L6=b(()=>{yo();MC=class extends Kt{patternBetween(){return new RegExp("^\\s*(T|klo|kello|,|-)?\\s*$")}}});var CR={};Jr(CR,{Chrono:()=>Se,Meridiem:()=>G,ParsingComponents:()=>X,ParsingResult:()=>at,ReferenceWithTimezone:()=>ct,Weekday:()=>Oe,casual:()=>bR,createCasualConfiguration:()=>B6,createConfiguration:()=>wR,parse:()=>lae,parseDate:()=>cae,strict:()=>aae});function lae(r,e,t){return bR.parse(r,e,t)}function cae(r,e,t){return bR.parseDate(r,e,t)}function B6(r=!0){let e=wR(!1,r);return e.parsers.unshift(new Up),e.parsers.unshift(new PC),e.parsers.unshift(new SC),e}function wR(r=!0,e=!0){return Ht({parsers:[new bo,new vr(e),new TC,new kC,new AC,new IC,new DC],refiners:[new FC,new MC]},r)}var bR,aae,U6=b(()=>{Ei();ai();Le();pt();cs();bp();x6();S6();F6();M6();R6();$6();O6();yR();N6();L6();bR=new Se(B6()),aae=new Se(wR(!0))});function uae(r){let e=r.toLowerCase();return xR[e]!==void 0?xR[e]:parseFloat(e)}function lh(r){let e=r.toUpperCase(),t=parseInt(r.replace(/[^0-9]+/g,""));return/TCN/.test(e)?-t:Gr(t)}function Yu(r){let e={},t=r,n=V6.exec(t);for(;n;){let i=uae(n[1]),o=RC[n[2].toLowerCase()];e[o]=i,t=t.substring(n[0].length),n=V6.exec(t)}return e}var ER,TR,xR,RC,_R,ah,q6,V6,ch,$c=b(()=>{ze();zt();ER={"ch\u1EE7 nh\u1EADt":0,cn:0,"th\u1EE9 hai":1,t2:1,"th\u1EE9 ba":2,t3:2,"th\u1EE9 t\u01B0":3,t4:3,"th\u1EE9 n\u0103m":4,t5:4,"th\u1EE9 s\xE1u":5,t6:5,"th\u1EE9 b\u1EA3y":6,t7:6},TR={"th\xE1ng 1":1,"th\xE1ng m\u1ED9t":1,"th\xE1ng gi\xEAng":1,"th\xE1ng 2":2,"th\xE1ng hai":2,"th\xE1ng 3":3,"th\xE1ng ba":3,"th\xE1ng 4":4,"th\xE1ng t\u01B0":4,"th\xE1ng 5":5,"th\xE1ng n\u0103m":5,"th\xE1ng 6":6,"th\xE1ng s\xE1u":6,"th\xE1ng 7":7,"th\xE1ng b\u1EA3y":7,"th\xE1ng 8":8,"th\xE1ng t\xE1m":8,"th\xE1ng 9":9,"th\xE1ng ch\xEDn":9,"th\xE1ng 10":10,"th\xE1ng m\u01B0\u1EDDi":10,"th\xE1ng 11":11,"th\xE1ng m\u01B0\u1EDDi m\u1ED9t":11,"th\xE1ng 12":12,"th\xE1ng m\u01B0\u1EDDi hai":12,"th\xE1ng ch\u1EA1p":12},xR={m\u1ED9t:1,hai:2,ba:3,b\u1ED1n:4,n\u0103m:5,s\u00E1u:6,b\u1EA3y:7,t\u00E1m:8,ch\u00EDn:9,m\u01B0\u1EDDi:10,"m\u01B0\u1EDDi m\u1ED9t":11,"m\u01B0\u1EDDi hai":12},RC={gi\u00E2y:"second",ph\u00FAt:"minute",gi\u1EDD:"hour",ng\u00E0y:"day",tu\u1EA7n:"week",th\u00E1ng:"month",n\u0103m:"year"},_R="(?:"+ee(xR)+"|[0-9]+|[0-9]+\\.[0-9]+)";ah="(?:[0-9]{1,4}(?:\\s*TCN)?)";q6="("+_R+")\\s{0,5}("+ee(RC)+")\\s{0,5}",V6=new RegExp(q6,"i"),ch=Er("",q6)});var dae,pae,fae,W6,$C,z6=b(()=>{zt();$c();fe();dae=new RegExp("(?:ng\xE0y\\s*)?([0-9]{1,2})\\s*th\xE1ng\\s*([0-9]{1,2})(?:\\s*n\u0103m\\s*("+ah+"))?(?=\\W|$)","i"),pae=1,fae=2,W6=3,$C=class extends U{innerPattern(){return dae}innerExtract(e,t){let n=parseInt(t[pae]),i=parseInt(t[fae]);if(n>31||i>12)return null;let o=e.createParsingResult(t.index,t[0]);return o.start.assign("day",n),o.start.assign("month",i),t[W6]?o.start.assign("year",lh(t[W6])):o.start.imply("year",ft(e.refDate,n,i)),o}}});var mae,hae,H6,OC,j6=b(()=>{$c();ze();fe();mae=new RegExp("("+ee(TR)+")(?:\\s*(?:n\u0103m|/)\\s*("+ah+"))?(?=\\W|$)","i"),hae=1,H6=2,OC=class extends U{innerPattern(){return mae}innerExtract(e,t){let n=TR[t[hae].toLowerCase()];if(!n)return null;let i=e.createParsingResult(t.index,t[0]);return i.start.assign("month",n),i.start.imply("day",1),t[H6]?i.start.assign("year",lh(t[H6])):i.start.imply("year",e.reference.getDateWithAdjustedTimezone().getFullYear()),i}}});var gae,G6,vae,yae,NC,Y6=b(()=>{$c();fe();gae=new RegExp("(?:\\bn\u0103m\\s*("+ah+")|\\b([0-9]{1,4})\\s*(TCN))(?=\\W|$)","i"),G6=1,vae=2,yae=3,NC=class extends U{innerPattern(){return gae}innerExtract(e,t){let n;t[G6]?n=t[G6]:n=t[vae]+" "+t[yae];let i=e.createParsingResult(t.index,t[0]);return i.start.assign("year",lh(n)),i.start.imply("month",1),i.start.imply("day",1),i}}});var bae,LC,K6=b(()=>{fe();si();bae=/\b(hôm nay|hôm qua|hôm kia|ngày mai|ngày kia|bây giờ|lúc này)(?=\W|$)/i,LC=class extends U{innerPattern(){return bae}innerExtract(e,t){switch(t[1].toLowerCase()){case"b\xE2y gi\u1EDD":case"l\xFAc n\xE0y":return $r(e.reference);case"h\xF4m nay":return Tr(e.reference);case"h\xF4m qua":return vn(e.reference);case"h\xF4m kia":return kc(e.reference,2);case"ng\xE0y mai":return yn(e.reference);case"ng\xE0y kia":return Mo(e.reference,2)}return e.createParsingComponents()}}});var wae,BC,Q6=b(()=>{pt();fe();on();wae=/(buổi\s*)?(sáng sớm|sáng|trưa|chiều|tối|đêm|nửa đêm|bình minh)(?=\W|$)/i,BC=class r extends U{innerPattern(){return wae}innerExtract(e,t){let n=e.createParsingComponents();return Lt(n,e.refDate),r.extractTimeComponents(n,t[2].toLowerCase())}static extractTimeComponents(e,t){switch(t){case"b\xECnh minh":case"s\xE1ng s\u1EDBm":e.imply("hour",6),e.imply("minute",0),e.imply("meridiem",G.AM);break;case"s\xE1ng":e.imply("hour",9),e.imply("minute",0),e.imply("meridiem",G.AM);break;case"tr\u01B0a":e.imply("hour",12),e.imply("minute",0),e.imply("meridiem",G.PM);break;case"chi\u1EC1u":e.imply("hour",15),e.imply("minute",0),e.imply("meridiem",G.PM);break;case"t\u1ED1i":e.imply("hour",19),e.imply("minute",0),e.imply("meridiem",G.PM);break;case"\u0111\xEAm":e.imply("hour",22),e.imply("minute",0),e.imply("meridiem",G.PM);break;case"n\u1EEDa \u0111\xEAm":e.imply("hour",0),e.imply("minute",0),e.imply("meridiem",G.AM);break}return e}}});var Cae,xae,Eae,UC,X6=b(()=>{$c();ze();fe();Ki();Cae=new RegExp("("+ee(ER)+")(?:\\s*(n\xE0y|t\u1EDBi|sau(?!\\s*khi)|qua))?(?=\\W|$)","i"),xae=1,Eae=2,UC=class extends U{innerPattern(){return Cae}innerExtract(e,t){let n=t[xae].toLowerCase(),i=ER[n];if(i===void 0)return null;let o=t[Eae],s=null;if(o){let a=o.toLowerCase();a.includes("t\u1EDBi")||a.includes("sau")?s="next":a.includes("qua")&&(s="last")}return cr(e.reference,i,s)}}});var Tae,_ae,Z6,Aae,J6,VC,ej=b(()=>{fe();pt();Tae=new RegExp("(?:l\xFAc\\s*|v\xE0o\\s*)?([0-9]{1,2})(?:\\s*gi\u1EDD\\s*([0-9]{1,2})?\\s*(?:ph\xFAt\\s*)?(s\xE1ng|tr\u01B0a|chi\u1EC1u|t\u1ED1i|\u0111\xEAm)?|:([0-9]{2}))(?=\\W|$)","i"),_ae=1,Z6=2,Aae=3,J6=4,VC=class extends U{innerPattern(){return Tae}innerExtract(e,t){let n=parseInt(t[_ae]);if(n>23)return null;let i=e.createParsingResult(t.index,t[0]);i.start.assign("hour",n);let o=t[J6]?parseInt(t[J6]):t[Z6]?parseInt(t[Z6]):0;if(o>=60)return null;i.start.assign("minute",o);let s=t[Aae]?.toLowerCase();return s==="s\xE1ng"?(i.start.assign("meridiem",G.AM),n===12&&i.start.assign("hour",0)):s==="tr\u01B0a"?n<10?(i.start.assign("meridiem",G.PM),i.start.assign("hour",n+12)):i.start.assign("meridiem",n>=12?G.PM:G.AM):(s==="chi\u1EC1u"||s==="t\u1ED1i"||s==="\u0111\xEAm")&&(i.start.assign("meridiem",G.PM),n<12&&i.start.assign("hour",n+12)),i.start.imply("second",0),i.start.imply("millisecond",0),i}}});var kae,qC,tj=b(()=>{$c();Le();fe();Bt();kae=new RegExp("("+ch+")\\s{0,5}(?:tr\u01B0\u1EDBc|qua)(?=\\W|$)","i"),qC=class extends U{constructor(t=!1){super();ae(this,"strictMode");this.strictMode=t}innerPattern(){return kae}innerExtract(t,n){let i=Yu(n[1]);return i?X.createRelativeFromReference(t.reference,tt(i)):null}}});var Sae,WC,rj=b(()=>{$c();Le();fe();Sae=new RegExp("("+ch+")\\s{0,5}(?:sau|n\u1EEFa|t\u1EDBi|ti\u1EBFp)(?=\\W|$)","i"),WC=class extends U{constructor(t=!1){super();ae(this,"strictMode");this.strictMode=t}innerPattern(){return Sae}innerExtract(t,n){let i=Yu(n[1]);return i?X.createRelativeFromReference(t.reference,i):null}}});var Dae,zC,nj=b(()=>{$c();Le();fe();Dae=new RegExp("(?:trong\\s*(?:v\xF2ng\\s*)?)("+ch+")(?=\\W|$)","i"),zC=class extends U{constructor(t=!1){super();ae(this,"strictMode");this.strictMode=t}innerPattern(){return Dae}innerExtract(t,n){let i=Yu(n[1]);return i?X.createRelativeFromReference(t.reference,i):null}}});var ij,Iae,HC,oj=b(()=>{$c();Le();fe();Bt();ze();ij="(?:"+_R+"\\s{0,5})?(?:"+ee(RC)+")",Iae=new RegExp("(n\xE0y|tr\u01B0\u1EDBc|qua|sau|t\u1EDBi|ti\u1EBFp)\\s*("+ij+")|("+ij+")\\s*(n\xE0y|tr\u01B0\u1EDBc|qua|sau|t\u1EDBi|ti\u1EBFp)(?=\\W|$)","i"),HC=class extends U{innerPattern(){return Iae}innerExtract(e,t){let n=(t[1]||t[4]||"").toLowerCase(),i=(t[2]||t[3]||"").toLowerCase(),o=Yu(i);if(Object.keys(o).length===0){let s=RC[i];if(!s)return null;o={[s]:1}}return(n==="tr\u01B0\u1EDBc"||n==="qua")&&(o=tt(o)),X.createRelativeFromReference(e.reference,o)}}});var jC,sj=b(()=>{vo();jC=class extends Yt{patternBetween(){return/^\s*(?:–|-|đến|tới|và)\s*$/}}});var GC,aj=b(()=>{yo();GC=class extends Kt{patternBetween(){return/^\s*(?:lúc|vào|,|T|-)?\s*$/}}});var YC,lj=b(()=>{tA();YC=class extends Ac{}});var SR={};Jr(SR,{Chrono:()=>Se,Meridiem:()=>G,ParsingComponents:()=>X,ParsingResult:()=>at,ReferenceWithTimezone:()=>ct,Weekday:()=>Oe,casual:()=>AR,createCasualConfiguration:()=>cj,createConfiguration:()=>kR,parse:()=>Fae,parseDate:()=>Mae,strict:()=>Pae});function Fae(r,e,t){return AR.parse(r,e,t)}function Mae(r,e,t){return AR.parseDate(r,e,t)}function cj(r=!0){let e=kR(!1,r);return e.parsers.unshift(new BC),e.parsers.unshift(new LC),e.parsers.unshift(new HC),e}function kR(r=!0,e=!0){return Ht({parsers:[new bo,new vr(e),new $C,new OC,new NC,new UC,new VC,new qC(r),new WC(r),new zC(r)],refiners:[new YC,new jC,new GC]},r)}var AR,Pae,uj=b(()=>{Ei();ai();Le();pt();bp();cs();z6();j6();Y6();K6();Q6();X6();ej();tj();rj();nj();oj();sj();aj();lj();AR=new Se(cj()),Pae=new Se(kR(!0))});var IR={};Jr(IR,{Chrono:()=>Se,Meridiem:()=>G,ParsingComponents:()=>X,ParsingContext:()=>sb,ParsingResult:()=>at,ReferenceWithTimezone:()=>ct,Weekday:()=>Oe,casual:()=>DR,de:()=>EF,en:()=>mF,es:()=>zM,fi:()=>CR,fr:()=>MF,it:()=>lR,ja:()=>NF,nl:()=>QF,parse:()=>$ae,parseDate:()=>Oae,pt:()=>qF,ru:()=>LM,strict:()=>Rae,sv:()=>mR,uk:()=>eR,vi:()=>SR,zh:()=>SM});function $ae(r,e,t){return DR.parse(r,e,t)}function Oae(r,e,t){return DR.parseDate(r,e,t)}var Rae,DR,dj=b(()=>{eW();ai();Le();pt();EW();jW();dz();_z();Qz();h3();O3();rH();EH();o6();C6();U6();uj();Rae=fF,DR=ab});function Nae(){return IR}var PR,Tl,uh=b(()=>{dj();PR=class{constructor(){this.chrono=Nae()}getParsedDate(e){return this.chrono.parseDate(e,new Date,{forwardDate:!0})}parseDate(e){if(!e||!e.trim())return null;try{let t=this.getParsedDate(e);return t?window.moment?{moment:window.moment(t)}:(console.warn("Moment.js is not available"),null):null}catch(t){return console.warn("Failed to parse date:",e,t),null}}},Tl=new PR});function pj(r){return r<=31||r===127||r===8232||r===8233}function Uae(r){let e="",t=0;for(;t<r.length;){let n=t;for(;n<r.length&&r.charCodeAt(n)===32;)n++;if(n<r.length&&pj(r.charCodeAt(n))){for(;n<r.length&&pj(r.charCodeAt(n));)n++;for(;n<r.length&&r.charCodeAt(n)===32;)n++;e+=" ",t=n;continue}e+=r.slice(t,Math.min(n+1,r.length)),t=n+1}return e}function fj(r,e){let t=r.length;for(;t>0&&e.includes(r[t-1]);)t--;return r.slice(0,t)}function Vp(r){return Vae.filter(e=>r.includes(e))}function hj(r){return`A file or folder name cannot contain ${yj(r)}, so this choice would fail at run time. ${vj}`}function gj(r,e){return`Cannot create "${e}": a file or folder name cannot contain ${yj(r)}. ${vj}`}function yj(r){return r.map(e=>`"${e}"`).join(", ")}function li(r,e="File path"){let{path:t,problems:n}=wj(r,e);if(n.length>0)throw new Error(n[0]);return t}function bj(r,e="File path"){return wj(r,e)}function wj(r,e){let t=[],n=r.replace(/\\/g,"/").split("/");return{path:n.map((o,s)=>o.length===0&&s!==0&&s!==n.length-1?(t.push(`${e} contains an empty path segment after formatting.`),o):qae(o,e,t)).join("/"),problems:t}}function qae(r,e,t){if(r.length===0)return r;let n=Lae.test(r),i=Bae.test(r),o=Uae(r);n&&(o=o.replace(/^ /u,"")),i&&(o=o.replace(/ $/u,""));let s=fj(o," ");return s==="."||s===".."?(t.push(`${e} cannot contain "." or ".." path segments.`),s):(o=fj(o,". "),o||t.push(`${e} contains an empty path segment after formatting.`),o)}var mj,Lae,Bae,Vae,vj,_l=b(()=>{mj="\0-\x7F\u2028\u2029",Lae=new RegExp(`^ *[${mj}]`,"u"),Bae=new RegExp(`[${mj}] *$`,"u");Vae=[":"];vj="Check your own text and tokens like {{TIME}}, which is HH:mm."});function Xj(r){let e=t=>{t.preventDefault(),t.stopPropagation()};r.addEventListener("pointerdown",e),r.addEventListener("mousedown",e)}function Wle(r){r.forEach(e=>{e.addEventListener("keydown",t=>{if(t.key==="ArrowRight"||t.key==="ArrowLeft"){let i=(r.indexOf(e)+(t.key==="ArrowRight"?1:-1)+r.length)%r.length;r[i].focus(),t.preventDefault()}})})}var ix,Qi,Wp=b(()=>{ix=require("obsidian"),Qi=class r extends ix.Modal{constructor(t,n,i){super(t);this.header=n;this.text=i;this.input=null;this.waitForClose=new Promise(o=>{this.resolvePromise=o}),this.open(),this.display()}static Ask(t,n,i){return new r(t,n,i).waitForClose}static async Prompt(t,n,i){return await r.Ask(t,n,i)===!0}display(){this.containerEl.addClass("quickAddModal","qaYesNoPrompt"),this.contentEl.empty(),this.titleEl.textContent=this.header,this.contentEl.createEl("p",{text:this.text});let t=this.contentEl.createDiv({cls:"yesNoPromptButtonContainer"}),n=new ix.ButtonComponent(t).setButtonText("No").onClick(()=>this.submit(!1));Xj(n.buttonEl);let i=new ix.ButtonComponent(t).setButtonText("Yes").onClick(()=>this.submit(!0)).setDestructive();Xj(i.buttonEl),i.buttonEl.focus(),Wle([n.buttonEl,i.buttonEl])}submit(t){this.input=t,this.close()}onClose(){super.onClose(),this.resolvePromise(this.input)}}});var Br,Kr=b(()=>{Br=(c=>(c.Obsidian="Obsidian",c.UserScript="UserScript",c.Choice="Choice",c.Wait="Wait",c.NestedChoice="NestedChoice",c.EditorCommand="EditorCommand",c.AIAssistant="AIAssistant",c.OpenFile="OpenFile",c.Conditional="Conditional",c))(Br||{})});function Si(r){return typeof r=="object"&&r!==null}function ed(r){return Si(r)&&!Array.isArray(r)}function hue(r){return ed(r)?!1:Array.isArray(r)?r.length>0:Di(r)}function zn(r){return ed(r)?r.commands:hue(r)?r:void 0}function Dr(r){return Array.isArray(r)?r:[]}function Fh(r){return Array.isArray(r)?r:[]}function hx(r){return Array.isArray(r)}function Di(r){return Array.isArray(r)||r==null?!1:typeof r=="object"?Object.keys(r).length>0:!!r}function m$(r){let e=Dr(r),t=new Set,n=!1,i=[];for(let o of e){if(Array.isArray(o)){let l=m$(o);for(let c of l.commands){let u=c.id;if(typeof u=="string"&&u!==""&&!t.has(u)){t.add(u),i.push(c);continue}let d={...c,id:xr()};t.add(d.id),i.push(d)}n=!0;continue}if(!Si(o)){n=!0;continue}let s=o.id;if(typeof s=="string"&&s!==""&&!t.has(s)){t.add(s),i.push(o);continue}let a={...o,id:xr()};t.add(a.id),i.push(a),n=!0}return n?{commands:i,changed:n}:{commands:e,changed:!1}}function OG(r){NG(r,new Set)}function NG(r,e){Si(r)&&(e.has(r)||(e.add(r),ed(r)&&(r.id=xr()),dk(zn(r),e)))}function dk(r,e){if(hx(r))for(let t of r){if(Array.isArray(t)){dk(t,e);continue}if(!Si(t)||e.has(t))continue;e.add(t),t.id=xr();let n=t;dk(n.thenCommands,e),dk(n.elseCommands,e),LG(n.choice,e)}}function LG(r,e){if(!Si(r)||e.has(r))return;e.add(r);let t=r;if(t.id=xr(),t.type==="Macro"&&NG(t.macro,e),t.type==="Multi"&&Array.isArray(t.choices))for(let n of t.choices)LG(n,e)}var Ii=b(()=>{hl()});function td(r){return r!==null&&typeof r=="object"}function vk(r){return r?.secretStorage}function fk(r){return r.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"")||"setting"}function yue(r){let e=5381;for(let t=0;t<r.length;t+=1)e=e*33^r.charCodeAt(t);return(e>>>0).toString(36).slice(0,vue)}function UG(r,e){return r.length<=e?r:r.slice(0,e).replace(/-+$/g,"")||"setting"}function WG(r,e){let t=e?.id;return typeof t=="string"&&t.trim().length>0?t:r}function h$(r,e,t){let i=(t?[pk,r,e,t]:[pk,r,e]).join("-");if(i.length<=BG)return i;let o=yue([r,e,t].filter(Boolean).join(":")),s=t?4:3,a=BG-pk.length-o.length-(t?.length??0)-s,l=Math.max(8,Math.floor(a*.6)),c=Math.max(8,a-l);return[pk,UG(r,l),UG(e,c),...t?[t]:[],o].join("-")}function g$(r){return r?.message??String(r)}function La(r,e){let t=e;for(;t<r.length;){let n=r[t],i=r[t+1];if(/\s/.test(n)){t+=1;continue}if(n==="/"&&i==="/"){let o=r.indexOf(`
|
||
`,t+2);t=o===-1?r.length:o+1;continue}if(n==="/"&&i==="*"){let o=r.indexOf("*/",t+2);t=o===-1?r.length:o+2;continue}return t}return t}function vx(r,e){let t=r[e];if(t!=='"'&&t!=="'"&&t!=="`")return null;let n="";for(let i=e+1;i<r.length;i++){let o=r[i];if(o==="\\"){let s=r[i+1];if(s===void 0)return null;n+=s,i+=1;continue}if(o===t)return{value:n,end:i+1};n+=o}return null}function VG(r,e){let t=/^[A-Za-z_$][\w$]*/.exec(r.slice(e));return t?{value:t[0],end:e+t[0].length}:null}function gx(r,e,t,n){let i=0;for(let o=e;o<r.length;o++){let s=r[o],a=r[o+1];if(s==='"'||s==="'"||s==="`"){let l=vx(r,o);if(!l)return-1;o=l.end-1;continue}if(s==="/"&&a==="/"){let l=r.indexOf(`
|
||
`,o+2);o=l===-1?r.length:l;continue}if(s==="/"&&a==="*"){let l=r.indexOf("*/",o+2);if(l===-1)return-1;o=l+1;continue}if(s===t){i+=1;continue}if(s===n&&(i-=1,i===0))return o}return-1}function zG(r){let e=new Map,t=/\b(?:const|let|var)\s+([A-Za-z_$][\w$]*)\s*=\s*(["'`])/g,n;for(;(n=t.exec(r))!==null;){let i=vx(r,t.lastIndex-1);i&&(e.set(n[1],i.value),t.lastIndex=i.end)}return e}function bue(r){let e=[],t=zG(r),n=0;for(;n<r.length;){n=La(r,n);let i=r[n],o=r[n+1];if(i==='"'||i==="'"||i==="`"){let l=vx(r,n);n=l?l.end:n+1;continue}if(i==="/"&&o==="/"){let l=r.indexOf(`
|
||
`,n+2);n=l===-1?r.length:l+1;continue}if(i==="/"&&o==="*"){let l=r.indexOf("*/",n+2);n=l===-1?r.length:l+2;continue}let s=v$(r,n,t);if(!s){n+=1;continue}if(n=La(r,s.end),r[n]!==":"){n=s.end;continue}if(n=La(r,n+1),s.name!=="options"||r[n]!=="{")continue;let a=gx(r,n,"{","}");if(a===-1)break;e.push({start:n+1,end:a}),n=a+1}return e}function v$(r,e,t){if(r[e]==='"'||r[e]==="'"||r[e]==="`"){let i=vx(r,e);return i?{name:i.value,end:i.end}:null}if(r[e]==="["){let i=La(r,e+1),o=VG(r,i),s=gx(r,e,"[","]");if(s===-1)return null;let a=o?La(r,o.end):i;return{name:o&&a===s?t.get(o.value)??null:null,end:s+1}}let n=VG(r,e);return n?{name:n.value,end:n.end}:null}function wue(r){let e=new Map,t=0;for(;t<r.length;){if(t=La(r,t),r[t]===","){t+=1;continue}if(t>=r.length)break;let n=v$(r,t,new Map);if(!n?.name){t+=1;continue}if(t=La(r,n.end),r[t]!==":"){t+=1;continue}if(t=La(r,t+1),r[t]==='"'||r[t]==="'"||r[t]==="`"){let i=vx(r,t);if(!i)break;e.set(n.name,i.value),t=i.end;continue}if(r.slice(t,t+4)==="true"){e.set(n.name,!0),t+=4;continue}if(r.slice(t,t+5)==="false"){e.set(n.name,!1),t+=5;continue}if(r[t]==="{"){let i=gx(r,t,"{","}");if(i===-1)break;t=i+1;continue}if(r[t]==="["){let i=gx(r,t,"[","]");if(i===-1)break;t=i+1;continue}for(;t<r.length&&r[t]!==",";)t+=1}return e}function Cue(r){let e=wue(r),t=e.get("type"),n=e.get("secret");return t==="secret"||(t==="text"||t==="input")&&n===!0}function Rh(r,e){let t=e&&gue.test(e)?mc(r).code??"":r,n=new Set,i=!1,o=zG(t);for(let{start:s,end:a}of bue(t)){let l=s;for(;l<a;){if(l=La(t,l),t[l]===","){l+=1;continue}if(l>=a)break;let c=v$(t,l,o);if(!c){l+=1;continue}if(l=La(t,c.end),t[l]!==":"){l+=1;continue}if(l=La(t,l+1),t[l]!=="{"){l+=1;continue}let u=gx(t,l,"{","}");if(u===-1||u>a)break;let d=t.slice(l+1,u);Cue(d)&&(i=!0,c.name&&n.add(c.name)),l=u+1}}return{names:n,foundSecretOptions:i}}function $h(r){return td(r)?r.type==="secret"||(r.type==="text"||r.type==="input")&&r.secret===!0:!1}function Mh(r){return td(r)&&r[qG]===!0&&typeof r.secretRef=="string"&&r.secretRef.trim().length>0}function mk(r){return{[qG]:!0,secretRef:r}}function xue(r,e,t){let n=r.id?.trim()||r.path||r.name||"script";return h$(fk(n),fk(WG(e,t)))}function Eue(r){let e=r?.options;return e?Object.entries(e).filter(([,t])=>$h(t)).map(([t])=>t):[]}function Tue(r){let e=r?.options;return e?Object.entries(e).filter(([,t])=>$h(t)):[]}function _ue(r){return typeof r.id=="string"&&r.id.trim().length>0}async function y$(r,e){let t=vk(r);if(!t?.getSecret)return null;try{return await Promise.resolve(t.getSecret(e))}catch(n){return F.logWarning(`Failed to read user script SecretStorage entry "${e}": ${g$(n)}`),null}}async function Aue(r,e,t){let n=vk(r);if(!n?.setSecret)return!1;try{return await Promise.resolve(n.setSecret(e,t)),!0}catch(i){return F.logWarning(`Failed to write user script SecretStorage entry "${e}": ${g$(i)}`),!1}}async function kue(r,e,t,n,i){let o=e.id?.trim()||e.path||e.name||"script",s=fk(o),a=fk(WG(t,i)),l=h$(s,a),c=1;for(;;){let u=await y$(r,l);if(!u||u===n)return l;c+=1,l=h$(s,a,String(c))}}async function b$(r,e,t,n,i,o){if(n.length===0)return null;let s=i?.trim()||await kue(r,e,t,n,o);return await Aue(r,s,n)?s:null}async function w$(r,e){let t=e?.trim();if(!t)return!0;let n=vk(r);if(!n)return!0;let i=n.deleteSecret??n.removeSecret??n.delete;try{if(i)return await Promise.resolve(i.call(n,t)),!0;if(n.setSecret)return await Promise.resolve(n.setSecret(t,"")),!0}catch(o){F.logWarning(`Failed to clear user script SecretStorage entry "${t}": ${g$(o)}`)}return!1}async function yk(r,e,t){let n=e.settings??{},i={...n},o=new Set(Eue(t));for(let[s,a]of Object.entries(n)){if(Mh(a)){let l=await y$(r,a.secretRef);if(l){i[s]=l;continue}throw new Error(`Secret setting "${s}" for user script "${e.name}" is unavailable. Re-enter it on this device.`)}o.has(s)&&(i[s]=typeof a=="string"?a:"")}return i}async function Oh(r,e,t){let n=Tue(t);if(n.length===0)return!1;let i=vk(r);if(!i?.getSecret||!i?.setSecret)return n.some(([a])=>{let l=e.settings?.[a];return typeof l=="string"&&l.length>0})&&F.logWarning(`SecretStorage unavailable; leaving plaintext user script secret settings for "${e.name}" unchanged.`),!1;let o=!1;for(let[s,a]of n){let l=e.settings?.[s];if(Mh(l))continue;if(typeof l!="string"||l.length===0){if(!_ue(a))continue;let u=xue(e,s,a);if(!await y$(r,u))continue;e.settings[s]=mk(u);for(let[f,p]of Object.entries(e.settings))f!==s&&Mh(p)&&p.secretRef===u&&delete e.settings[f];o=!0;continue}let c=await b$(r,e,s,l,void 0,a);c&&(e.settings[s]=mk(c),o=!0)}return o}function bk(r,e){let t=r.settings?.[e];return Mh(t)?t.secretRef:void 0}async function Sue(r,e){if(!td(e))return!0;let t=Object.values(e).filter(Mh).map(i=>i.secretRef);return(await Promise.all(t.map(i=>w$(r,i)))).every(Boolean)}async function HG(r,e){if(!td(e))return!0;let t=!0;if(e.type==="Macro"&&(t=await hk(r,zn(e.macro))&&t),e.type==="Multi"&&Array.isArray(e.choices))for(let n of e.choices)t=await HG(r,n)&&t;return t}async function yx(r,e){if(!td(e))return!0;let t=!0;return e.type==="UserScript"&&(t=await Sue(r,e.settings)&&t),Array.isArray(e.thenCommands)&&(t=await hk(r,e.thenCommands)&&t),Array.isArray(e.elseCommands)&&(t=await hk(r,e.elseCommands)&&t),t=await HG(r,e.choice)&&t,t}async function hk(r,e){if(!Array.isArray(e))return!0;let t=!0;for(let n of e){if(Array.isArray(n)){t=await hk(r,n)&&t;continue}t=await yx(r,n)&&t}return t}function Due(r,e){let t=r.path;if(typeof t=="string")return e?.secretOptionNamesByPath?.get(t)}function Iue(r,e,t){if(td(r))for(let[n,i]of Object.entries(r)){if(Mh(i)){delete r[n];continue}typeof i=="string"&&(e===null||e?.has(n)||e===void 0&&t?.stripUnknownStringSettings===!0)&&delete r[n]}}function C$(r,e){td(r)&&(r.type==="UserScript"&&Iue(r.settings,Due(r,e),e),Array.isArray(r.thenCommands)&&gk(r.thenCommands,e),Array.isArray(r.elseCommands)&&gk(r.elseCommands,e),Nh(r.choice,e))}function gk(r,e){if(Array.isArray(r))for(let t of r){if(Array.isArray(t)){gk(t,e);continue}C$(t,e)}}function Nh(r,e){if(td(r)&&(r.type==="Macro"&&gk(zn(r.macro),e),r.type==="Multi"&&Array.isArray(r.choices)))for(let t of r.choices)Nh(t,e)}var pk,qG,gue,BG,vue,Bc=b(()=>{Me();Zv();Ii();pk="quickadd-user-script",qG="__quickaddSecret",gue=/\.md$/i,BG=64,vue=8});function Lh(r,e){if(e.options)for(let t in e.options){let n=r[t]===void 0,i="defaultValue"in e.options[t]&&e.options[t].defaultValue!==void 0;n&&i&&!$h(e.options[t])&&(r[t]=e.options[t].defaultValue)}}var wk=b(()=>{Bc()});function Uo(r){if(r.length===0)return 0;let e=new TextEncoder().encode(r).length,t=!1;for(let i=0;i<r.length;i++)if(r.charCodeAt(i)>127){t=!0;break}return Math.max(1,Math.ceil(e/(t?3:4)))}function GG(r){return!Number.isFinite(r)||r<=0?1:Math.max(1,Math.floor(r*.45))}var bx=b(()=>{});function XG(){return le.getState().ai.providers.flatMap(e=>e.models).map(e=>e.name)}function T$(){return le.getState().ai.providers}function YG(r,e){for(let t of r){let n=t.models.find(i=>i.name===e);if(n)return{provider:t,model:n}}}function E$(r){let e=T$();return e.filter(t=>t.models.some(n=>n.name===r)).map(t=>{let n=`${t.id??t.name}/${r}`;return e.some(o=>o.models.some(s=>s.name===n))?`{ name: "${r}", provider: "${t.id??t.name}" } (the string "${n}" is itself a model id on another provider)`:n})}function QG(r,e){KG.has(r)||(KG.add(r),F.logWarning(e))}function Yp(r,e){let t=T$(),n=e?.silent===!0;if(r==null)return;if(typeof r!="string"){let s=t.find(c=>c.id===r.providerId),a=s?.models.find(c=>c.name===r.name);if(s&&a)return{provider:s,model:a};let l=YG(t,r.name);return l?(n||QG(`pin:${r.providerId}/${r.name}\u2192${l.provider.id??l.provider.name}`,`Model "${r.name}" is pinned to provider "${r.providerId}", which no longer serves it. Using "${l.provider.name}" instead \u2014 re-select the model in the command's settings to pin it again.`),l):void 0}let i=YG(t,r);if(i){let s=E$(r);return s.length>1&&!n&&QG(`ambiguous:${r}\u2192${i.provider.id??i.provider.name}`,`Model "${r}" is served by ${s.length} providers; using "${i.provider.name}". Qualify it to choose explicitly: ${s.join(", ")}.`),i}let o=r.indexOf("/");if(!(o<=0||o===r.length-1))return ZG(r.slice(0,o),r.slice(o+1))}function ZG(r,e){let t=T$(),n=r.trim().toLowerCase(),i=t.find(s=>s.id?.toLowerCase()===n)??t.find(s=>s.name.trim().toLowerCase()===n),o=i?.models.find(s=>s.name===e);if(i&&o)return{provider:i,model:o}}function Bh(r){let e=typeof r=="string"?r:r?.name;if(!e)throw new Error('Invalid model parameter. Expected a string (e.g., "gpt-4o" or "openai/gpt-4o") or an object with a name property (e.g., {name: "gpt-4o", provider: "openai"})');let t=typeof r!="string"&&r.provider?ZG(r.provider,e):Yp(e);if(!t){let n=e.includes("/")?e.slice(e.indexOf("/")+1):e,i=[...E$(e),...n!==e?E$(n):[]],o=i.length?` Did you mean ${i.join(" or ")}?`:" Add it under Edit providers in QuickAdd's AI Assistant settings (the sparkles button below the choice list), or enable auto-sync for that provider.";throw new Error(`Model '${typeof r=="string"?r:`${r.provider??""}/${e}`}' not found in configured providers.${o}`)}return t}var KG,Uh=b(()=>{Me();It();KG=new Set});var Ak=b(()=>{});var di,Uc=b(()=>{hl();di=class{constructor(e,t){this.name=e,this.type=t,this.id=xr()}}});var Mk,ln,nd=b(()=>{Mk=require("obsidian");Me();Fo();zr();ln=class r extends Mk.FuzzySuggestModal{constructor(t,n,i,o={}){super(t);this.warnedOnEmptyDisplay=!1;this.warnRenderItemFailure=mp("Custom renderItem threw an error; falling back to default rendering");this.warnCustomValueFailure=mp("Custom create-row rendering threw an error; falling back to default rendering");this.allowCustomValue=!0;this.items=i,this.displayItems=n.map(s=>mn(s)),this.searchItems=o.searchItems?.map(s=>mn(s))??[],this.promise=new Promise((s,a)=>{this.resolvePromise=s,this.rejectPromise=a}),this.renderItem=o.renderItem,this.allowCustomValue=o.allowCustomValue??!0,this.customValueLabel=o.customValueLabel,this.valueExists=o.valueExists,this.inputEl.addEventListener("keydown",s=>{if(s.code!=="Tab"||!("chooser"in this))return;let{values:a,selectedItem:l}=this.chooser,{value:c}=this.inputEl;this.inputEl.value=a[l]?.item??c}),o.placeholder&&this.setPlaceholder(o.placeholder),typeof o.limit=="number"&&(this.limit=o.limit),o.emptyStateText&&(this.emptyStateText=o.emptyStateText),this.displayItems.length!==this.items.length&&(this.displayItems=this.items.map((s,a)=>{let l=this.displayItems[a];return mn(l??s)})),this.searchItems.length!==this.items.length&&(this.searchItems=this.items.map((s,a)=>mn(this.searchItems[a]??this.displayItems[a]??s))),o.skippable&&i_(this,()=>this.skip()),this.warnIfEmptyDisplay(),this.open()}static Suggest(t,n,i,o={}){return new r(t,n,i,o).promise}getItemText(t){if(t===this.inputEl.value)return t;let n=this.items.indexOf(t),i=n>=0?this.searchItems[n]:void 0;return mn(i??t)}getItems(){return this.items}getSuggestions(t){let n=wc(t),i=super.getSuggestions(n);if(!this.allowCustomValue)return i;let o=wc(this.inputEl.value);return!o||this.items.includes(o)||this.valueExists?.(o)||i.some(a=>a.item===o)||i.push({item:o,match:{score:Number.NEGATIVE_INFINITY,matches:[]}}),i}selectSuggestion(t,n){this.resolved=!0,super.selectSuggestion(t,n)}renderSuggestion(t,n){if(this.customValueLabel&&t.match.score===Number.NEGATIVE_INFINITY){this.renderCustomValue(t.item,n);return}if(!this.renderItem){super.renderSuggestion(t,n);return}try{n.empty(),this.renderItem(t.item,n)}catch(i){this.warnRenderItemFailure(i),n.empty(),super.renderSuggestion(t,n)}}renderCustomValue(t,n){try{n.empty(),n.addClass("mod-complex"),n.createDiv({cls:"suggestion-content"}).createDiv({cls:"suggestion-title",text:this.customValueLabel?.(t)??t});let o=n.createDiv({cls:"suggestion-aux"});(0,Mk.setIcon)(o.createSpan({cls:"suggestion-flair"}),"file-plus")}catch(i){this.warnCustomValueFailure(i),n.empty(),super.renderSuggestion({item:t,match:{score:0,matches:[]}},n)}}onChooseItem(t,n){this.resolved=!0,this.resolvePromise(t)}skip(){this.resolved=!0,this.resolvePromise(""),this.close()}onClose(){super.onClose(),this.resolved||this.rejectPromise(rn())}warnIfEmptyDisplay(){if(this.warnedOnEmptyDisplay)return;this.displayItems.some(n=>n.length===0)&&(this.warnedOnEmptyDisplay=!0,F.logWarning("QuickAdd suggester received empty display values. Check your displayItems mapping."))}}});var vs=b(()=>{});var Ut,Ba=b(()=>{Kr();Uc();Cu();Me();Ut=class extends di{constructor(e){super(e,"EditorCommand"),this.editorCommandType=e}static getSelectedText(e){return this.getActiveMarkdownView(e).editor.getSelection()}static getActiveMarkdownView(e){let t=Nn(e);if(!t)throw F.logError("no active markdown editor."),new Error("no active markdown editor.");return t}}});var zh,D$=b(()=>{vs();Ba();zh=class extends Ut{constructor(){super("Copy")}static async run(e){let t=Ut.getSelectedText(e);await navigator.clipboard.writeText(t)}}});var Hh,I$=b(()=>{vs();Ba();Me();Hh=class extends Ut{constructor(){super("Cut")}static async run(e){let t=Ut.getSelectedText(e),n=Ut.getActiveMarkdownView(e);if(!t){F.logError("nothing selected.");return}await navigator.clipboard.writeText(t),n.editor.replaceSelection("")}}});var jh,P$=b(()=>{vs();Me();Ba();jh=class extends Ut{constructor(){super("Paste")}static async run(e){let t=await navigator.clipboard.readText(),n=Ut.getActiveMarkdownView(e);if(!n){F.logError("no active markdown view.");return}n.editor.replaceSelection(t)}}});var aY,Gh,F$=b(()=>{aY=require("obsidian");Me();Ba();vs();Gh=class extends Ut{constructor(){super("Paste with format")}static async run(e){let t=Ut.getActiveMarkdownView(e);if(!t){F.logError("no active markdown view.");return}let n="";try{if("read"in navigator.clipboard&&navigator.clipboard.read){let i=await navigator.clipboard.read(),o=!1;for(let s of i)if(s.types.includes("text/html")){let l=await(await s.getType("text/html")).text();n=(0,aY.htmlToMarkdown)(l),o=!0;break}o||(n=await navigator.clipboard.readText())}else n=await navigator.clipboard.readText();t.editor.replaceSelection(n)}catch(i){F.logWarning(`Formatted paste failed. Falling back to plain text: ${i}`);try{let o=await navigator.clipboard.readText();t.editor.replaceSelection(o)}catch(o){F.logError(`Failed to read clipboard text: ${o}`)}}}}});var Yh,M$=b(()=>{vs();Ba();Yh=class extends Ut{constructor(){super("Select active line")}static run(e){let t=Ut.getActiveMarkdownView(e),{line:n}=t.editor.getCursor(),o=t.editor.getLine(n).length;t.editor.setSelection({line:n,ch:0},{line:n,ch:o})}}});var Kh,R$=b(()=>{Ba();vs();Tt();Me();Kh=class extends Ut{constructor(){super("Select link on active line")}static run(e){let t=Ut.getActiveMarkdownView(e),{line:n}=t.editor.getCursor(),i=t.editor.getLine(n),o=fB.exec(i);if(!o){F.logError(`no internal link found on line ${n}.`);return}let s=o.index,a=o[0].length+s;t.editor.setSelection({line:n,ch:s},{line:n,ch:a})}}});var Qh,$$=b(()=>{Ba();vs();Qh=class extends Ut{constructor(){super("Move cursor to file start")}static run(e){Ut.getActiveMarkdownView(e).editor.setCursor({line:0,ch:0})}}});var Xh,O$=b(()=>{Ba();vs();Xh=class extends Ut{constructor(){super("Move cursor to file end")}static run(e){let t=Ut.getActiveMarkdownView(e),n=t.editor.lastLine(),i=t.editor.getLine(n).length;t.editor.setCursor({line:n,ch:i})}}});var Zh,N$=b(()=>{Ba();vs();Zh=class extends Ut{constructor(){super("Move cursor to line start")}static run(e){let t=Ut.getActiveMarkdownView(e),{line:n}=t.editor.getCursor();t.editor.setCursor({line:n,ch:0})}}});var Jh,L$=b(()=>{Ba();vs();Jh=class extends Ut{constructor(){super("Move cursor to line end")}static run(e){let t=Ut.getActiveMarkdownView(e),{line:n}=t.editor.getCursor(),i=t.editor.getLine(n).length;t.editor.setCursor({line:n,ch:i})}}});function _Y(r,e=new Set){if(r==null||e.has(r))return[];if(e.add(r),typeof r=="string")return[r];if(typeof r!="object")return[String(r)];let t=r,n=[];for(let i of hde){let o=t[i];o!==void 0&&n.push(..._Y(o,e))}return n}function Kk(r){return Number(r.replace(/,/g,""))}function gde(r){let e=r.match(/context (?:length|window)(?:\s+is)?(?:\s+of)?\s*(\d[\d,]*)/i);return e?Kk(e[1]):null}function vde(r){let e=r.match(/(\d[\d,]*)\s*(?:tokens?\s+)?in the completion\b/i);if(e){let n=Kk(e[1]),i=gde(r);return i===null?"input":n>=i?"output":"input"}let t=r.match(/input length and max_tokens exceed context limit:?\s*(\d[\d,]*)\s*\+\s*(\d[\d,]*)(?:\s*>\s*(\d[\d,]*))?/i);if(t){let n=Kk(t[2]),i=t[3]?Kk(t[3]):null;return i===null?"input":n>=i?"output":"input"}return null}function kx(r){let e=_Y(r).join(" "),t=vde(e);return t==="output"?"output_budget":t==="input"?"input_context":mde.some(n=>n.test(e))?"output_budget":fde.some(n=>n.test(e))?"input_context":"other"}function AY(r){return kx(r)==="input_context"}function Qk(r,e){let t="",n="",i;try{i=e.json}catch{i=void 0}if(i&&typeof i=="object"){let s=i,a=s.error??s;t=String(a.message??s.message??""),n=String(a.code??a.type??a.status??"")}t||(t=typeof e.text=="string"&&e.text.length>0?e.text:`HTTP ${e.status}`);let o=new Error(`${r} request failed (HTTP ${e.status})${n?` [${n}]`:""}: ${t}`);return o.status=e.status,n&&(o.providerCode=n),o}var fde,mde,hde,Sx=b(()=>{fde=[/context[_ -]?length[_ -]?exceeded/i,/context[_ -]?window[_ -]?exceeded/i,/maximum context length/i,/context window/i,/too many input tokens/i,/input(?: is)? too long/i,/prompt(?: is)? too long/i,/input token count/i,/reduce the length of (?:the |your )?(?:messages|prompt|input)/i,/exceed(?:s|ed|ing)? (?:the )?(?:maximum |allowed )?(?:input |prompt )?(?:token|context)/i],mde=[/max_tokens/i,/max_completion_tokens/i,/max(?:imum)? output tokens/i,/output token limit/i],hde=["message","code","type","status","statusText","providerCode","error","response","json","cause"]});function Sde(r){return r.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"")||"provider"}function Dde(r){let e=r.name?.trim()||"provider";return`${kde}-${Sde(e)}`}async function IY(r,e){if(!r?.secretStorage?.getSecret)return null;try{return await Promise.resolve(r.secretStorage.getSecret(e))}catch(t){return F.logWarning(`Failed to read SecretStorage entry "${e}": ${t.message??t}`),null}}async function Va(r,e){let t=e.apiKeyRef?.trim();if(t){let n=await IY(r,t);if(n)return n}return e.apiKey??""}async function PY(r,e,t){let n=t?.trim();if(!n||!r?.secretStorage?.getSecret||!r.secretStorage?.setSecret)return null;let i=Dde(e),o=i,s=1;for(;;){let a=await IY(r,o);if(!a)break;if(a===n)return o;s+=1,o=`${i}-${s}`}try{return await Promise.resolve(r.secretStorage.setSecret(o,n)),o}catch(a){return F.logWarning(`Failed to write SecretStorage entry "${o}": ${a.message??a}`),null}}var kde,Kp=b(()=>{Me();kde="quickadd-ai"});function o4(r){try{let e=window.require;return e?e(r):null}catch{return null}}async function dg(r,e){let t=r.vault.adapter;if(typeof lO.FileSystemAdapter!="function"||!(t instanceof lO.FileSystemAdapter))return;let n=o4("fs"),i=o4("path");if(!n?.promises||!i)return;let o=await n.promises.realpath(t.getBasePath()),a=t.getFullPath(e);for(;!$pe(n,a);){let f=i.dirname(a);if(f===a)break;a=f}let l;try{l=await n.promises.realpath(a)}catch{throw new Ix(`Refusing to write to "${e}": it resolves through an unresolvable (dangling) symlink.`)}let c=i.relative(o,l);if(c===".."||c.startsWith(`..${i.sep}`)||i.isAbsolute(c))throw new Ix(`Refusing to write to "${e}": it resolves (via a symlink) outside the vault.`);if(c.split(i.sep).some(f=>f.startsWith(".")))throw new Ix(`Refusing to write to "${e}": it resolves (via a symlink) into a config/hidden directory.`)}function $pe(r,e){try{return r.lstatSync(e),!0}catch{return!1}}var lO,Ix,cO=b(()=>{lO=require("obsidian"),Ix=class extends Error{constructor(e){super(e),this.name="VaultWriteEscapeError"}}});var Ee,Co=b(()=>{Ns();Ee=class extends Nt{}});var U4,Nr,qc=b(()=>{U4=require("obsidian");Me();Fo();zr();Nr=class r extends U4.FuzzySuggestModal{constructor(t,n,i,o,s){super(t);this.warnedOnEmptyDisplay=!1;this.warnRenderItemFailure=mp("Custom renderItem threw an error; falling back to default rendering");this.renderItem=o,this.items=i,this.displayItems=n.map(a=>mn(a)),this.promise=new Promise((a,l)=>{this.resolvePromise=a,this.rejectPromise=l}),s?.skippable&&i_(this,()=>this.skip()),this.inputEl.addEventListener("keydown",a=>{if(a.code!=="Tab"||!("chooser"in this))return;let{values:l,selectedItem:c}=this.chooser,{value:u}=this.inputEl;this.inputEl.value=l[c]?.item??u}),this.displayItems.length!==this.items.length&&(this.displayItems=this.items.map((a,l)=>{let c=this.displayItems[l];return mn(c??a)})),this.warnIfEmptyDisplay(),this.open()}static Suggest(t,n,i,o,s,a){let l=new r(t,n,i,s,a);return o&&l.setPlaceholder(o),l.promise}getItemText(t){let n=this.items.indexOf(t),i=n>=0?this.displayItems[n]:void 0;return mn(i??t)}getItems(){return this.items}getSuggestions(t){let n=wc(t);return super.getSuggestions(n)}selectSuggestion(t,n){this.resolved=!0,super.selectSuggestion(t,n)}renderSuggestion(t,n){if(!this.renderItem){super.renderSuggestion(t,n);return}try{n.empty(),this.renderItem(t.item,n)}catch(i){this.warnRenderItemFailure(i),n.empty(),super.renderSuggestion(t,n)}}onChooseItem(t,n){this.resolved=!0,this.resolvePromise(t)}skip(){this.resolved=!0,this.resolvePromise(""),this.close()}onClose(){super.onClose(),this.resolved||this.rejectPromise(rn())}warnIfEmptyDisplay(){if(this.warnedOnEmptyDisplay)return;this.displayItems.some(n=>n.length===0)&&(this.warnedOnEmptyDisplay=!0,F.logWarning("QuickAdd suggester received empty display values. Check your displayItems mapping."))}}});function Mi(r,e){if(!r)throw new Error(typeof e=="function"?e():e)}var $x=b(()=>{});function mg(r){return SO.filter(e=>typeof r[e]=="number")}function IS(r){let e={...r};for(let t of SO)delete e[t];return e}function DO(r,e){return r.supportsTemperature===!1&&mg(e).length>0?IS(e):e}function IO(r,e){return e.length===0?!1:lme.some(t=>t.test(r))}function PS(r){let e=r.map(t=>ame[t]);return e.length<=1?e.join(""):e.length===2?`${e[0]} and ${e[1]}`:`${e.slice(0,-1).join(", ")}, and ${e[e.length-1]}`}var SO,ame,DS,lme,V4=b(()=>{SO=["temperature","top_p","frequency_penalty","presence_penalty"],ame={temperature:"Temperature",top_p:"Top P",frequency_penalty:"Frequency penalty",presence_penalty:"Presence penalty"};DS=SO.join("|"),lme=[new RegExp(`unsupported (?:parameter|value)[^.]{0,40}['\`"]?(?:${DS})['\`"]?`,"i"),new RegExp(`['\`"]?(?:${DS})['\`"]?[^.]{0,40}(?:is deprecated|is not supported|not supported|does not support)`,"i"),new RegExp(`unrecognized request argument[^.]{0,40}(?:${DS})`,"i"),new RegExp(`(?:${DS})[^.]{0,40}extra inputs are not permitted`,"i")]});function FS(r){let e=r.workspace.activeEditor?.editor?.getCursor(),t=r.workspace.activeEditor?.editor?.listSelections();return()=>{e&&r.workspace.activeEditor?.editor?.setCursor(e),t&&r.workspace.activeEditor?.editor?.setSelections(t)}}var PO=b(()=>{});function Ox(r){let e=Array.isArray(r)?r:{...r},t=e.type==="object"||Array.isArray(e.type)&&e.type.includes("object")||e.properties!==void 0;if(e.properties){let n={};for(let[i,o]of Object.entries(e.properties))n[i]=Ox(o);e.properties=n}return e.items&&!Array.isArray(e.items)&&(e.items=Ox(e.items)),t&&(e.additionalProperties=!1,e.required=e.properties?Object.keys(e.properties):[]),e}function cme(r){let e=[];for(let t of r)if(t.role==="system")e.push({role:"system",content:t.content});else if(t.role==="user")e.push({role:"user",content:t.content});else if(t.role==="assistant"){let n={role:"assistant",content:t.content??""};t.toolCalls&&t.toolCalls.length>0&&(n.tool_calls=t.toolCalls.map(i=>({id:i.id,type:"function",function:{name:i.name,arguments:i.rawArgs??JSON.stringify(i.args??{})}}))),e.push(n)}else for(let n of t.results)e.push({role:"tool",tool_call_id:n.toolCallId,content:n.isError?`ERROR: ${n.content}`:n.content});return e}function ume(r){return r.map(e=>({type:"function",function:{name:e.name,description:e.description,parameters:e.strict?Ox(e.parameters):e.parameters,...e.strict?{strict:!0}:{}}}))}function dme(r){return typeof r=="string"?r:{type:"function",function:{name:r.name}}}function fme(r,e){let t={model:r,...e.modelParams??{},messages:cme(e.messages)};return e.tools&&e.tools.length>0&&(t.tools=ume(e.tools),e.toolChoice&&(t.tool_choice=dme(e.toolChoice)),e.disableParallel&&(t.parallel_tool_calls=!1)),e.maxOutputTokens!==void 0&&(pme.test(r)?t.max_completion_tokens=e.maxOutputTokens:t.max_tokens=e.maxOutputTokens),e.responseFormat&&(t.response_format=e.responseFormat.schema?{type:"json_schema",json_schema:{name:e.responseFormat.name??"response",strict:e.responseFormat.strict??!0,schema:e.responseFormat.strict??!0?Ox(e.responseFormat.schema):e.responseFormat.schema}}:{type:"json_object"}),t}function mme(r){let e=r.choices?.[0]??{},t=e.message??{},i=(t.tool_calls??[]).map(a=>hme(a)),o=String(e.finish_reason??""),s=r.usage??{};return{content:t.content??"",toolCalls:i,normalizedStopReason:i.length>0||o==="tool_calls"?"tool_calls":o==="length"?"length":o==="stop"?"stop":"other",rawStopReason:o,usage:{promptTokens:s.prompt_tokens??0,completionTokens:s.completion_tokens??0,totalTokens:s.total_tokens??0}}}function q4(r){return r!==null&&typeof r=="object"&&!Array.isArray(r)?r:null}function hme(r){let e=r.function.arguments;if(typeof e=="string")try{let n=q4(JSON.parse(e||"{}"));if(!n)throw new Error("tool arguments are not a JSON object");return{id:r.id,name:r.function.name,args:n,rawArgs:e}}catch{return{id:r.id,name:r.function.name,args:null,rawArgs:e,parseError:!0}}let t=q4(e);return t?{id:r.id,name:r.function.name,args:t}:{id:r.id,name:r.function.name,args:null,rawArgs:typeof e=="string"?e:JSON.stringify(e??{}),parseError:!0}}function gme(r,e,t){let n=[],i=[];for(let a of e.messages)if(a.role==="system")a.content&&n.push(a.content);else if(a.role==="user")i.push({role:"user",content:a.content});else if(a.role==="assistant"){let l=[];a.content&&l.push({type:"text",text:a.content});for(let c of a.toolCalls??[])l.push({type:"tool_use",id:c.id,name:c.name,input:c.args??{}});i.push({role:"assistant",content:l})}else i.push({role:"user",content:a.results.map(l=>({type:"tool_result",tool_use_id:l.toolCallId,content:l.content,...l.isError?{is_error:!0}:{}}))});let o={model:r,max_tokens:e.maxOutputTokens??t,messages:i};n.length>0&&(o.system=n.join(`
|
||
|
||
`));let s=e.modelParams??{};return typeof s.temperature=="number"&&(o.temperature=s.temperature),typeof s.top_p=="number"&&(o.top_p=s.top_p),e.tools&&e.tools.length>0&&(o.tools=e.tools.map(a=>({name:a.name,description:a.description,input_schema:a.parameters})),e.toolChoice?o.tool_choice=vme(e.toolChoice,e.disableParallel):e.disableParallel&&(o.tool_choice={type:"auto",disable_parallel_tool_use:!0})),e.responseFormat?.schema&&(o.output_config={format:{type:"json_schema",schema:Ox(e.responseFormat.schema)}}),o}function vme(r,e){let t=e?{disable_parallel_tool_use:!0}:{};return typeof r=="string"?r==="required"?{type:"any",...t}:r==="none"?{type:"none"}:{type:"auto",...t}:{type:"tool",name:r.name,...t}}function yme(r){let e=r.content??[],t=e.filter(a=>a.type==="tool_use").map(a=>({id:a.id??"",name:a.name??"",args:a.input??{}})),n=String(r.stop_reason??""),i=r.usage??{},o=i.input_tokens??0,s=i.output_tokens??0;return{content:e.filter(a=>a.type==="text").map(a=>a.text??"").join(""),toolCalls:t,normalizedStopReason:n==="tool_use"||t.length>0?"tool_calls":n==="max_tokens"?"length":n==="end_turn"||n==="stop_sequence"?"stop":"other",rawStopReason:n,usage:{promptTokens:o,completionTokens:s,totalTokens:o+s}}}function bme(r,e){let t=[],n=[];for(let a of e.messages)if(a.role==="system")a.content&&t.push(a.content);else if(a.role==="user")n.push({role:"user",parts:[{text:a.content}]});else if(a.role==="assistant")if(Array.isArray(a.providerRaw))n.push({role:"model",parts:a.providerRaw});else{let l=[];a.content&&l.push({text:a.content});for(let c of a.toolCalls??[])l.push({functionCall:{name:c.name,args:c.args??{}}});n.push({role:"model",parts:l})}else n.push({role:"user",parts:a.results.map(l=>({functionResponse:{name:l.name,response:l.isError?{error:l.content}:{result:l.content}}}))});let i={contents:n};t.length>0&&(i.systemInstruction={role:"system",parts:[{text:t.join(`
|
||
|
||
`)}]}),e.tools&&e.tools.length>0&&(i.tools=[{functionDeclarations:e.tools.map(a=>({name:a.name,description:a.description,parameters:a.parameters}))}],e.toolChoice&&(i.toolConfig=wme(e.toolChoice)));let o={},s=e.modelParams??{};return typeof s.temperature=="number"&&(o.temperature=s.temperature),typeof s.top_p=="number"&&(o.topP=s.top_p),e.maxOutputTokens!==void 0&&(o.maxOutputTokens=e.maxOutputTokens),e.responseFormat?.schema&&(o.responseMimeType="application/json",o.responseSchema=e.responseFormat.schema),Object.keys(o).length>0&&(i.generationConfig=o),i}function wme(r){return typeof r=="string"?{functionCallingConfig:{mode:r==="required"?"ANY":r==="none"?"NONE":"AUTO"}}:{functionCallingConfig:{mode:"ANY",allowedFunctionNames:[r.name]}}}function Cme(r){let e=r.candidates?.[0]??{},n=(e.content??{}).parts??[],i=n.filter(a=>a.functionCall).map((a,l)=>({id:a.functionCall?.id??`gemini-call-${l}`,name:a.functionCall?.name??"",args:a.functionCall?.args??{}})),o=String(e.finishReason??""),s=r.usageMetadata??{};return{content:n.filter(a=>typeof a.text=="string").map(a=>a.text??"").join(""),toolCalls:i,normalizedStopReason:i.length>0?"tool_calls":o==="MAX_TOKENS"?"length":o==="STOP"?"stop":"other",rawStopReason:o,usage:{promptTokens:s.promptTokenCount??0,completionTokens:s.candidatesTokenCount??0,totalTokens:s.totalTokenCount??0},providerRaw:n}}function FO(r,e,t,n=8192){switch(r){case"anthropic":return gme(e,t,n);case"gemini":return bme(e,t);default:return fme(e,t)}}function W4(r,e){switch(r){case"anthropic":return yme(e);case"gemini":return Cme(e);default:return mme(e)}}var pme,z4=b(()=>{pme=/^(?:o[1-9]|gpt-(?:[5-9]|\d\d))/i});async function hg(r,e,t){let n=(0,Lx.requestUrl)({...r,throw:!1});t&&t();let i=await n;if(i.status>=400)throw Qk(e,i);return i.json}function xme(r){return{id:r.id,model:r.model,content:r.choices[0].message.content,usage:{promptTokens:r.usage.prompt_tokens,completionTokens:r.usage.completion_tokens,totalTokens:r.usage.total_tokens},stopReason:r.choices[0].finish_reason,stopSequence:null,created:r.created}}function Eme(r){return{id:r.id,model:r.model,content:r.content.filter(e=>e.type==="text").map(e=>e.text??"").join(""),usage:{promptTokens:r.usage.input_tokens,completionTokens:r.usage.output_tokens,totalTokens:r.usage.input_tokens+r.usage.output_tokens},stopReason:r.stop_reason,stopSequence:r.stop_sequence,created:Date.now()}}async function Tme(r,e,t,n,i,o,s){return hg({url:`${t.endpoint}/chat/completions`,method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${r}`},body:JSON.stringify({model:e.name,...i,messages:[{role:"system",content:n},{role:"user",content:o}]})},t.name,s)}function MO(r){if(typeof r.maxOutputTokens=="number"&&Number.isFinite(r.maxOutputTokens)&&r.maxOutputTokens>0)return Math.floor(r.maxOutputTokens);let e=4096;return Number.isFinite(r.maxTokens)&&r.maxTokens>0?Math.min(e,r.maxTokens):e}async function _me(r,e,t,n,i,o,s){let a={model:e.name,max_tokens:MO(e),messages:[{role:"user",content:o}]};return n&&n.trim().length>0&&(a.system=n),typeof i.temperature=="number"&&(a.temperature=i.temperature),typeof i.top_p=="number"&&(a.top_p=i.top_p),hg({url:`${t.endpoint}/v1/messages`,method:"POST",headers:{"Content-Type":"application/json","x-api-key":r,"anthropic-version":"2023-06-01"},body:JSON.stringify(a)},t.name,s)}async function Ame(r,e,t,n,i,o,s){let a=`${t.endpoint}/v1beta/models/${encodeURIComponent(e.name)}:generateContent`,l={};typeof i.temperature=="number"&&(l.temperature=i.temperature),typeof i.top_p=="number"&&(l.topP=i.top_p);let c={contents:[{role:"user",parts:[{text:o}]}]};return n&&n.trim().length>0&&(c.systemInstruction={role:"system",parts:[{text:n}]}),Object.keys(l).length>0&&(c.generationConfig=l),hg({url:a,method:"POST",headers:{"Content-Type":"application/json","x-goog-api-key":r},body:JSON.stringify(c)},t.name,s)}function kme(r){let e=r.candidates?.[0],n=(e?.content?.parts??[]).map(i=>typeof i.text=="string"?i.text:"").join("");return{id:`${Date.now()}`,model:r.modelVersion??"gemini",content:n,usage:{promptTokens:r.usageMetadata?.promptTokenCount??0,completionTokens:r.usageMetadata?.candidatesTokenCount??0,totalTokens:r.usageMetadata?.totalTokenCount??0},stopReason:e?.finishReason??"",stopSequence:null,created:Date.now()}}function MS(r,e,t,n,i,o={}){return async function(a){if(le.getState().disableOnlineFeatures)throw new Error("Blocking request: Online features are disabled in settings.");let l=Uo(a)+Uo(i),c=Date.now(),u=OO({provider:n.name,endpoint:n.endpoint,model:t.name,systemPrompt:i,prompt:a,modelOptions:o});F.logMessage(`[AI Request ${u}] Started ${n.name}/${t.name}`),Number.isFinite(t.maxTokens)&&t.maxTokens>0&&l>t.maxTokens&&F.logMessage(`[AI Request ${u}] Estimated prompt size is ${l} tokens, above the configured ${t.maxTokens} token context. Sending anyway; the provider will enforce the exact limit.`);try{let d=FS(r),f=Nv(n),p=async w=>f==="anthropic"?Eme(await _me(e,t,n,i,w,a,d)):f==="gemini"?kme(await Ame(e,t,n,i,w,a,d)):xme(await Tme(e,t,n,i,w,a,d)),m=DO(t,o),v=mg(m);v.length===0&&mg(o).length>0&&F.logMessage(`[AI Request ${u}] ${t.name} uses fixed sampling; not sending ${PS(mg(o))}.`);let g;try{g=await p(m)}catch(w){let x=w.message??String(w);if(!IO(x,v))throw w;let C=PS(v);F.logMessage(`[AI Request ${u}] ${n.name} rejected ${C}; retrying without sampling parameters.`),new Lx.Notice(`${t.name} doesn't accept the ${C} setting${v.length>1?"s":""}, so QuickAdd retried without ${v.length>1?"them":"it"}. You can remove ${v.length>1?"them":"it"} from this command's advanced settings.`),g=await p(IS(m))}let y=Date.now()-c;return Nx(u,{status:"success",durationMs:y,usage:g.usage}),F.logMessage(`[AI Request ${u}] Success in ${y}ms`),g}catch(d){let f=d.message??String(d),p=Date.now()-c;Nx(u,{status:"error",durationMs:p,errorMessage:f}),F.logMessage(`[AI Request ${u}] Failed in ${p}ms: ${f}`);let m=kx(d)==="input_context"?" The prompt likely exceeds the model's context window \u2014 shorten it, choose a model with a larger context, or use the chunked AI prompt API.":"",v=new Error(`Error while making request to ${n.name}: ${f}${m}`,{cause:d});throw lt(v),v}}}async function H4(r,e,t,n,i,o){if(r==="anthropic")return hg({url:`${t.endpoint}/v1/messages`,method:"POST",headers:{"Content-Type":"application/json","x-api-key":e,"anthropic-version":"2023-06-01"},body:JSON.stringify(i)},t.name,o);if(r==="gemini"){let s=`${t.endpoint}/v1beta/models/${encodeURIComponent(n.name)}:generateContent`;return hg({url:s,method:"POST",headers:{"Content-Type":"application/json","x-goog-api-key":e},body:JSON.stringify(i)},t.name,o)}return hg({url:`${t.endpoint}/chat/completions`,method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${e}`},body:JSON.stringify(i)},t.name,o)}async function RO(r,e,t,n,i,o){if(le.getState().disableOnlineFeatures)throw new Error("Blocking request: Online features are disabled in settings.");let s=Nv(n),a={...i,modelParams:DO(t,i.modelParams??{})},l=mg(a.modelParams??{}),c=FO(s,t.name,a,MO(t)),u=i.messages.find(m=>m.role==="system"),d=[...i.messages].reverse().find(m=>m.role==="user"),f=Date.now(),p=OO({provider:n.name,endpoint:n.endpoint,model:t.name,systemPrompt:u&&u.role==="system"?u.content:"",prompt:d&&d.role==="user"?d.content:"[tool-calling turn]",modelOptions:i.modelParams??{}});try{let m;try{m=await H4(s,e,n,t,c,o)}catch(y){let w=y.message??String(y);if(!IO(w,l))throw y;let x=PS(l);F.logMessage(`[AI Chat ${p}] ${n.name} rejected ${x}; retrying without sampling parameters.`),new Lx.Notice(`${t.name} doesn't accept the ${x} setting${l.length>1?"s":""}, so QuickAdd retried without ${l.length>1?"them":"it"}.`);let C=FO(s,t.name,{...a,modelParams:IS(a.modelParams??{})},MO(t));m=await H4(s,e,n,t,C,o)}let v=W4(s,m),g=Date.now()-f;return Nx(p,{status:"success",durationMs:g,usage:v.usage}),F.logMessage(`[AI Chat ${p}] Success in ${g}ms`),{id:m.id??`${Date.now()}`,model:t.name,content:v.content,usage:v.usage,stopReason:v.rawStopReason,stopSequence:null,created:Date.now(),toolCalls:v.toolCalls,normalizedStopReason:v.normalizedStopReason,providerRaw:v.providerRaw}}catch(m){let v=m.message??String(m),g=Date.now()-f;Nx(p,{status:"error",durationMs:g,errorMessage:v});let y=new Error(`Error while making request to ${n.name}: ${v}`,{cause:m});throw lt(y),y}}var Lx,$O=b(()=>{Lx=require("obsidian");V4();It();RS();PO();Cr();es();z4();Me();bx();Sx()});function gg(r){if(r){let e=new G4.Notice(j4("starting",""),1e6);return{setMessage:(t,n)=>{e.setMessage(j4(t,n))},hide:()=>e.hide()}}return{setMessage:()=>{},hide:()=>{}}}var G4,j4,NO=b(()=>{G4=require("obsidian"),j4=(r,e)=>`${r==="dead"?"AI request failed.":`Assistant is ${r}.`}${e?`
|
||
|
||
${e}`:""}`});function UO(r){return{...r,modelOptions:{...r.modelOptions},usage:r.usage?{...r.usage}:void 0}}function OO(r){let e=`${Date.now()}-${Math.random().toString(36).slice(2,8)}`,t=Date.now();return ta.push({...r,modelOptions:{...r.modelOptions??{}},id:e,createdAt:t,status:"pending"}),X4(),e}function Nx(r,e){let t=ta.find(n=>n.id===r);t&&(t.status=e.status,t.durationMs=e.durationMs,t.usage=e.usage,t.errorMessage=e.errorMessage,X4())}function Q4(r=10){Number.isFinite(r)||(r=10);let e=Math.floor(r);return e<=0?[]:ta.slice(-e).map(UO).reverse()}function X4(){if(ta.length<=Y4)return;let r=ta.length-Y4;for(;r>0;){let e=ta.findIndex(t=>t.status!=="pending");if(e===-1)break;ta.splice(e,1),r-=1}}function Z4(r){let e=ta.find(t=>t.id===r);return e?UO(e):null}function J4(){let r=ta[ta.length-1];return r?UO(r):null}function e5(){ta.splice(0,ta.length)}async function Sme(r,e,t){if(typeof r!="function")throw new TypeError("Callback must be a function.");if(!(e instanceof Promise))throw new TypeError("Promise must be an instance of Promise.");if(typeof t!="number"||t<=0)throw new TypeError("Interval must be a positive number.");let n=!1;for(e.then(()=>{n=!0},()=>{n=!0});!n;)r(),await sleep(t)}function Dme(r){return r instanceof Error?r:new Error(String(r))}async function Ime(r,e,t,n=!0,i){let o;if(e.enable)o=t.find(c=>c.path.endsWith(e.name));else{let c=t.map(u=>u.basename);if(i)o=await i.suggester(c,t,"Select a prompt template");else if(n)o=await Nr.Suggest(r,c,t);else throw new Ee("This AI command asks which prompt template to use, but this run is non-interactive. Enable a specific prompt template in the command, or re-run with the ui flag.")}Mi(o,"Prompt template does not exist");let s=o.path,a=r.vault.getAbstractFileByPath(s);Mi(a instanceof K4.TFile,`${s} is not a file`);let l=await r.vault.cachedRead(a);return[o.basename,l]}async function t5(r,e,t){if(le.getState().disableOnlineFeatures)throw new Error("Online features are disabled in settings. Enable them to use the AI Assistant.");let n=gg(e.showAssistantMessages);try{let{apiKey:i,model:o,provider:s,outputVariableName:a,promptTemplate:l,systemPrompt:c,promptTemplateFolder:u}=e,d=rs(r,u),[f,p]=await Ime(r,l,d,e.interactive??!0,e.promptProvider);n.setMessage("waiting","QuickAdd is formatting the prompt template.");let m=await t(p),v=["prompting",`Using prompt template "${f}".`];n.setMessage(v[0],v[1]);let y=MS(r,i,o,s,c,e.modelOptions)(m),x=(await VO(y,100,E=>{n.setMessage(v[0],`${v[1]} (${(E/1e3).toFixed(2)}s)`)},E=>{n.setMessage("finished",`Took ${(E/1e3).toFixed(2)}s.`)})).content,C=("> "+x).replace(/\n/g,`
|
||
> `),_={[a]:x,[`${a}-quoted`]:C};return window.setTimeout(()=>n.hide(),5e3),_}catch(i){throw n.setMessage("dead",i.message),window.setTimeout(()=>n.hide(),5e3),Dt(i)?new St("Input cancelled by user"):i}}async function VO(r,e,t,n){let i=Date.now();return await Sme(()=>t(Date.now()-i),r,e),n(Date.now()-i),await r}async function r5(r,e,t){if(le.getState().disableOnlineFeatures)throw new Error("Online features are disabled in settings. Enable them to use the AI Assistant.");let n=gg(e.showAssistantMessages);try{let{apiKey:i,model:o,provider:s,outputVariableName:a,systemPrompt:l,prompt:c,modelOptions:u}=e;n.setMessage("waiting","QuickAdd is formatting the prompt template.");let d=await t(c),f=["prompting","Using custom prompt."];n.setMessage(f[0],f[1]);let m=MS(r,i,o,s,l,u)(d),g=(await VO(m,100,x=>{n.setMessage(f[0],`${f[1]} (${(x/1e3).toFixed(2)}s)`)},x=>{n.setMessage("finished",`Took ${(x/1e3).toFixed(2)}s.`)})).content,y=("> "+g).replace(/\n/g,`
|
||
> `),w={[a]:g,[`${a}-quoted`]:y};return window.setTimeout(()=>n.hide(),5e3),w}catch(i){throw n.setMessage("dead",i.message),window.setTimeout(()=>n.hide(),5e3),i}}function Fme(){return Array.from(new Set([BO,...["kebab","snake","camel","pascal","title","lower","upper","slug"].map(r=>V_(BO,r))])).filter(Boolean)}function i5(r){if(r.length<=1)return null;let e=Math.floor(r.length/2),t=[`
|
||
|
||
`,`
|
||
`,". "," "],n=-1,i=Number.POSITIVE_INFINITY;for(let a of t){let l=r.lastIndexOf(a,e),c=r.indexOf(a,e),u=[l,c].filter(d=>d>0);for(let d of u){let f=d+a.length;if(f<=0||f>=r.length)continue;let p=Math.abs(f-e);p<i&&(i=p,n=f)}}if(n>0&&n<r.length)return[r.slice(0,n),r.slice(n)];let o=e,s=r.charCodeAt(o);return s>=56320&&s<=57343&&(o+=1),o<=0||o>=r.length?null:[r.slice(0,o),r.slice(o)]}function Mme(r){let e=new RegExp(Hd.source,"gi"),t;for(;(t=e.exec(r))!==null;)if(t[1].split("|")[0].trim().toLowerCase()==="chunk")return!0;return!1}function Rme(r){return $s.test(r)||vu.test(r)||fl.test(r)||uc.test(r)}function $me(r){return n5.some(e=>r.includes(e))}function Ome(r){return n5.slice().sort((e,t)=>t.length-e.length).reduce((e,t)=>e.split(t).join(" "),r)}function o5(r){if(r>$S)throw new Error(`QuickAdd would split this chunked AI request into more than ${$S} prompts, which exceeds the safety limit. Increase the chunk size, use a larger chunk separator, or reduce the input text.`)}function Nme(r,e,t){let n=Math.max(1,Math.floor(e)),i=[r],o=0;for(;i.length>0;){let s=i.pop(),l=Uo(s)<=n?null:i5(s);if(!l){t.push(s),o+=1,o5(o);continue}i.push(l[1],l[0])}}function Lme(r){let e=r.flags.replace(/[gy]/g,"");return new RegExp(r.source+"|",e).exec("").length-1}function Ume(r,e){if(typeof e=="string"){let s=r.split(e);return{chunks:s,separators:new Array(Math.max(0,s.length-1)).fill(e)}}if(Lme(e)>0||Bme.test(e.source))return{chunks:r.split(e),separators:null};let t=new RegExp(`(${e.source})`,e.flags),n=r.split(t),i=[],o=[];for(let s=0;s<n.length;s++)s%2===0?i.push(n[s]):o.push(n[s]);return{chunks:i,separators:o}}function Vme(r,e,t,n){let i=[];if(r.forEach((l,c)=>{let u=[];Nme(l,t,u),u.forEach((d,f)=>{i.push({text:d,joiner:f===0&&c>0?e?.[c-1]??"":""})})}),!n)return i.map(l=>l.text);let o=[],s="",a=0;for(let l of i){let c=Uo(l.text)+Math.max(1,Uo(l.joiner));s!==""&&a+c>=t&&(o.push(s),s="",a=0),s+=s===""?l.text:l.joiner+l.text,a+=c}return s!==""&&o.push(s),o}function qme(r,e){let t=Math.max(1,Math.floor(r));if(e!==void 0&&Number.isFinite(e)&&e>0){let n=Math.floor(e);return{budget:Math.min(t,n),clamped:n>t}}return{budget:t,clamped:!1}}async function s5(r,e,t){if(le.getState().disableOnlineFeatures)throw new Error("Online features are disabled in settings. Enable them to use the AI Assistant.");let n=gg(e.showAssistantMessages);try{let{apiKey:i,model:o,provider:s,outputVariableName:a,systemPrompt:l,promptTemplate:c,text:u,modelOptions:d}=e;n.setMessage("chunking","Creating prompt chunks with text and prompt template");let f=e.chunkSeparator||/\n/g,{chunks:p,separators:m}=Ume(u,f),v=await t(c,{chunk:BO});if(!(Mme(c)||Rme(c)&&$me(v)))throw new Error("The chunked prompt template does not reference the chunk text. Add {{VALUE:chunk}} to your prompt template so each chunk is inserted.");let y=o.maxTokens,w=GG(y),x=Ome(v),C=Uo(l)+Uo(x);if(C>=y)throw new Error(`The estimated prompt overhead (${C} tokens) exceeds the model's entire context window (${y} tokens). Shorten the system prompt or prompt template, or use a model with a larger context window.`);let{budget:_,clamped:E}=qme(w-C,e.maxChunkTokens);E&&F.logMessage(`[ChunkedPrompt] Requested max chunk tokens (${e.maxChunkTokens}) exceeds this model's estimated input budget; using ${_} estimated tokens per chunk instead.`);let D=e.shouldMerge??!0,P=Vme(p,m,_,D);o5(P.length);let H=MS(r,i,o,s,l,d),V=["prompting",`${P.length} prompts being sent.`];n.setMessage(V[0],V[1]);let oe=new LO(5,1e3*30),ce=!1,R=0,O=Promise.resolve(),q=ge=>{let be=O.then(()=>{if(ce)throw new Error("Chunked prompt stopped after an earlier failure.");return t(c,{chunk:ge})});return O=be.then(()=>{},()=>{}),be},B=async(ge,be=0)=>{if(ce)throw new Error("Chunked prompt stopped after an earlier failure.");let xe;try{xe=await q(ge)}catch(Ue){throw ce=!0,Ue}try{return[(await oe.add(()=>{if(ce)throw new Error("Chunked prompt stopped after an earlier failure.");if(R+=1,R>$S)throw new Error(`Chunked AI request exceeded the safety limit of ${$S} provider requests.`);return H(xe)})).content]}catch(Ue){let $t=i5(ge);if(be>=Pme||!$t||!AY(Ue))throw ce=!0,Ue;n.setMessage("prompting","Provider rejected a prompt for context length. Retrying with smaller chunks.");let[Ne,Ke]=$t,Xe=await B(Ne,be+1),ye=await B(Ke,be+1);return[...Xe,...ye]}},ie=Promise.all(P.map(ge=>B(ge))),K=(await VO(ie,100,ge=>{n.setMessage(V[0],`${V[1]} (${(ge/1e3).toFixed(2)}s)`)},ge=>{n.setMessage("finished",`Took ${(ge/1e3).toFixed(2)}s.`)})).flat().join(e.resultJoiner),se=("> "+K).replace(/\n/g,`
|
||
> `),pe={[a]:K,[`${a}-quoted`]:se};return window.setTimeout(()=>n.hide(),5e3),pe}catch(i){throw n.setMessage("dead",i.message),window.setTimeout(()=>n.hide(),5e3),i}}var K4,Y4,ta,LO,Pme,$S,BO,n5,Bme,RS=b(()=>{K4=require("obsidian");zr();Co();qc();It();qt();$x();Cr();$O();Sx();NO();bx();Me();Tt();q_();Y4=25,ta=[];LO=class{constructor(e,t){this.maxRequests=e;this.intervalMs=t;this.queue=[];this.startTimes=[]}add(e){return new Promise((t,n)=>{this.queue.push(async()=>{try{t(await e())}catch(i){n(Dme(i))}}),this.schedule()})}schedule(){if(this.queue.length===0)return;let e=Date.now();if(this.startTimes=this.startTimes.filter(i=>e-i<this.intervalMs),this.startTimes.length>=this.maxRequests){let i=this.startTimes[0],o=Math.max(0,this.intervalMs-(e-i));window.setTimeout(()=>this.schedule(),o+1);return}let t=this.queue.shift();if(!t)return;this.startTimes.push(e);let n=t();window.setTimeout(()=>this.schedule(),this.intervalMs),this.schedule()}},Pme=12,$S=500,BO="quickadd_chunk_probe_123456789";n5=Fme();Bme=/(?:^|[^\\])(?:\\\\)*\\[1-9]/});function a5(r){return r.normalize("NFKD").toLowerCase()}var Wme,Qp,qO=b(()=>{Wme=0;Qp=class{constructor(e,t){this.options=t;this.instanceId=++Wme;this.indexedItems=[];this.renderedRows=[];this.query="";this.rootEl=document.createElement("div"),this.rootEl.className="qa-searchable-multi-select";let n=document.createElement("div");n.className="search-input-container qa-searchable-multi-select__search-container",this.searchInputEl=document.createElement("input"),this.searchInputEl.className="qa-searchable-multi-select__search",this.searchInputEl.type="search",this.searchInputEl.name=`qa-multi-select-search-${this.instanceId}`,this.searchInputEl.placeholder=t.searchPlaceholder??"Search options...",this.searchInputEl.setAttribute("aria-label",this.searchInputEl.placeholder),this.searchInputEl.setAttribute("autocomplete","off"),this.searchInputEl.setAttribute("spellcheck","false"),n.appendChild(this.searchInputEl),this.summaryEl=document.createElement("div"),this.summaryEl.className="qa-searchable-multi-select__summary",this.summaryEl.setAttribute("aria-live","polite"),this.listEl=document.createElement("div"),this.listEl.className="qa-searchable-multi-select__list",this.listEl.setAttribute("role","group"),this.listEl.setAttribute("aria-label","Options"),this.rootEl.append(n,this.summaryEl,this.listEl),e.appendChild(this.rootEl),this.searchInputEl.addEventListener("input",()=>{this.query=this.searchInputEl.value,this.renderList()}),this.searchInputEl.addEventListener("keydown",i=>{if(i.key==="ArrowDown"){i.preventDefault(),this.renderedRows[0]?.input.focus();return}if(i.key==="ArrowUp"){i.preventDefault(),this.renderedRows.at(-1)?.input.focus();return}i.key==="Escape"&&this.query&&(i.preventDefault(),i.stopPropagation(),this.query="",this.searchInputEl.value="",this.renderList())}),this.setItems(t.items)}setItems(e){this.indexedItems=e.map((t,n)=>({item:t,index:n,searchableText:a5(`${t.label} ${t.searchText??""}`)})),this.searchInputEl.disabled=e.length===0,this.renderList()}focusSearchOnOpen(){document.body.classList.contains("is-mobile")||this.searchInputEl.focus()}refreshSelection(){for(let{item:e,input:t}of this.renderedRows)t.checked=this.options.isSelected(e),t.closest("label")?.classList.toggle("is-selected",t.checked);this.updateSummary()}getMatchingItems(){let e=a5(this.query.trim()).split(/\s+/).filter(Boolean);return e.length===0?this.indexedItems:this.indexedItems.filter(({searchableText:t})=>e.every(n=>t.includes(n)))}getVisibleItems(e){if(e.length<=200)return e;let t=[],n=[];for(let i of e)(this.options.isSelected(i.item)?t:n).push(i);return[...t,...n].slice(0,200)}renderList(){this.listEl.replaceChildren(),this.renderedRows=[];let e=this.getMatchingItems(),t=this.getVisibleItems(e);if(t.length===0){let n=document.createElement("div");n.className="qa-searchable-multi-select__empty",n.setAttribute("role","status"),n.textContent=this.indexedItems.length?`No options match \u201C${this.query.trim()}\u201D`:this.options.emptyText??"No options available",this.listEl.appendChild(n)}for(let n of t)this.renderRow(n);if(e.length>t.length){let n=document.createElement("div");n.className="qa-searchable-multi-select__limit",n.setAttribute("role","status"),n.textContent=`Showing ${t.length} of ${e.length} options. Refine your search to see the rest.`,this.listEl.appendChild(n)}this.updateSummary(e.length)}renderRow(e){let{item:t,index:n}=e,i=document.createElement("label");i.className="qa-searchable-multi-select__option";let o=document.createElement("input");o.type="checkbox",o.name=`qa-multi-select-${this.instanceId}`,o.id=`qa-multi-select-${this.instanceId}-${n}`,o.checked=this.options.isSelected(t);let s=document.createElement("span");s.className="qa-searchable-multi-select__option-label",s.textContent=t.label,i.htmlFor=o.id,i.classList.toggle("is-selected",o.checked),i.append(s,o),o.addEventListener("change",()=>{this.options.onToggle(t,o.checked),this.refreshSelection()}),o.addEventListener("keydown",a=>{this.handleOptionKeydown(a,o)}),this.listEl.appendChild(i),this.renderedRows.push({item:t,input:o})}handleOptionKeydown(e,t){let n=this.renderedRows.findIndex(i=>i.input===t);if(e.key==="ArrowDown"){e.preventDefault(),this.renderedRows[n+1]?.input.focus();return}if(e.key==="ArrowUp"){e.preventDefault(),n===0?this.searchInputEl.focus():this.renderedRows[n-1]?.input.focus();return}if(e.key==="Home"){e.preventDefault(),this.renderedRows[0]?.input.focus();return}if(e.key==="End"){e.preventDefault(),this.renderedRows.at(-1)?.input.focus();return}if(e.key==="Enter"||e.key===" "){e.preventDefault(),t.checked=!t.checked,t.dispatchEvent(new Event("change",{bubbles:!0}));return}e.key==="/"&&!e.metaKey&&!e.ctrlKey&&!e.altKey&&(e.preventDefault(),this.searchInputEl.focus())}updateSummary(e=this.getMatchingItems().length){let n=`${this.options.getSelectedCount?.()??new Set(this.indexedItems.filter(({item:i})=>this.options.isSelected(i)).map(({item:i})=>i.key)).size} selected`;if(!this.query.trim()){this.summaryEl.textContent=`${n} \xB7 ${this.indexedItems.length} options`;return}this.summaryEl.textContent=`${n} \xB7 ${e} matches`}}});var sd,Xp,l5=b(()=>{sd=require("obsidian");Fo();zr();qO();Xp=class r extends sd.Modal{constructor(t,n,i,o={}){super(t);this.didSubmit=!1;this.skipped=!1;this.selected=new Set;this.customValues=[];this.draft="";this.items=i,this.displayItems=n.length===i.length?n:i,this.opts=o,this.seedPreselection(o.preselected),this.waitForClose=new Promise((s,a)=>{this.resolvePromise=s,this.rejectPromise=a}),this.render(),this.open(),this.picker.focusSearchOnOpen()}static Suggest(t,n,i,o={}){return new r(t,n,i,o).waitForClose}seedPreselection(t){if(t?.length)for(let n of t){let i=n?.trim();i&&(!this.items.includes(i)&&!this.customValues.includes(i)&&this.customValues.push(i),this.selected.add(i))}}render(){this.containerEl.addClass("quickAddModal","qaSearchableMultiSelectModal","qaMultiSuggester"),this.titleEl.setText(this.opts.placeholder??"Select one or more");let{contentEl:t}=this;t.empty();let n=t.createDiv({cls:"qa-multi-list"});this.picker=new Qp(n,{items:this.getSearchableItems(),isSelected:({value:o})=>this.selected.has(o),onToggle:({value:o},s)=>{s?this.selected.add(o):this.selected.delete(o)},getSelectedCount:()=>this.selected.size}),this.opts.allowCustomValue&&new sd.Setting(t).setName("Add a custom value").addText(s=>{s.setPlaceholder("Not in the list\u2026").setValue(this.draft).onChange(a=>this.draft=a),s.inputEl.addClass("qa-multi-custom-input"),s.inputEl.addEventListener("keydown",a=>{a.key==="Enter"&&(a.preventDefault(),this.commitDraft())})}).addButton(s=>s.setButtonText("Add").onClick(()=>this.commitDraft())).settingEl.addClass("qa-multi-custom");let i=new sd.Setting(t);i.settingEl.addClass("qa-multi-actions"),i.addButton(o=>o.setButtonText("Done").setCta().onClick(()=>this.submit())),i.addButton(o=>o.setButtonText("Cancel").onClick(()=>this.close())),this.opts.skippable&&i.addButton(o=>o.setButtonText("Skip").setTooltip("Leave empty").onClick(()=>{this.skipped=!0,this.didSubmit=!0,this.close()}))}getSearchableItems(){return[...this.items.map((t,n)=>({key:t,value:t,label:mn(this.displayItems[n]??t),searchText:t})),...this.customValues.map(t=>({key:t,value:t,label:t}))]}commitDraft(){let t=this.draft.trim();return t?(this.items.includes(t)||this.customValues.includes(t))&&this.selected.has(t)?(new sd.Notice(`"${t}" is already added.`),!1):(!this.items.includes(t)&&!this.customValues.includes(t)&&this.customValues.push(t),this.selected.add(t),this.draft="",this.render(),this.focusCustomInput(),!0):(new sd.Notice("Enter a value to add."),!1)}focusCustomInput(){this.contentEl.querySelector(".qa-multi-custom-input")?.focus()}submit(){if(this.opts.allowCustomValue&&this.draft.trim()){let t=this.draft.trim();!this.items.includes(t)&&!this.customValues.includes(t)&&this.customValues.push(t),this.selected.add(t),this.draft=""}this.didSubmit=!0,this.close()}collectResult(){let t=[];for(let n of this.items)this.selected.has(n)&&t.push(n);for(let n of this.customValues)this.selected.has(n)&&t.push(n);return t}onClose(){super.onClose(),this.didSubmit?this.resolvePromise(this.skipped?[]:this.collectResult()):this.rejectPromise(rn())}}});var ad,zme,Hme,jme,u5,WO,Bx,zO,c5,OS,HO=b(()=>{ad=r=>r.toString().padStart(2,"0"),zme=r=>{if(typeof r=="number"&&r>=0&&r<=6)return r;let t=window.moment?.localeData?.()?.firstDayOfWeek?.();return typeof t=="number"&&t>=0&&t<=6?t:0},Hme=r=>{let e=new Intl.DateTimeFormat(void 0,{weekday:"short"}),t=new Date(2021,7,1),n=Array.from({length:7},(i,o)=>{let s=new Date(t.getFullYear(),t.getMonth(),t.getDate()+o);return e.format(s)});return n.slice(r).concat(n.slice(0,r))},jme=(r,e)=>new Intl.DateTimeFormat(void 0,{month:"long",year:"numeric"}).format(new Date(r,e,1)),u5=(r,e,t)=>`${r}-${ad(e+1)}-${ad(t)}`,WO=r=>u5(r.getFullYear(),r.getMonth(),r.getDate()),Bx=r=>{if(!r)return null;let e=/^(\d{4})-(\d{2})-(\d{2})$/.exec(r);if(e){let[,n,i,o]=e;return new Date(Number.parseInt(n,10),Number.parseInt(i,10)-1,Number.parseInt(o,10))}let t=new Date(r);return Number.isNaN(t.getTime())?null:t},zO=(r,e,t,n)=>{let i=u5(r,e,t);return n?`${i}T${ad(n.hour)}:${ad(n.minute)}:00`:i},c5=r=>{if(!r)return null;let e=/[T ](\d{2}):(\d{2})/.exec(r);if(!e)return null;let t=Number.parseInt(e[1],10),n=Number.parseInt(e[2],10);return Number.isNaN(t)||Number.isNaN(n)||t<0||t>23||n<0||n>59?null:{hour:t,minute:n}},OS=r=>{let e=zme(r.weekStartsOn),t=Hme(e),n=Bx(r.initialIso)??new Date,i=n.getFullYear(),o=n.getMonth(),s=r.initialIso,a=r.withTime===!0,l=a?c5(r.initialIso)??{hour:0,minute:0}:null,c=r.container.createDiv({cls:"qa-date-picker"}),u=c.createDiv({cls:"qa-date-picker__header"}),d=u.createEl("button",{cls:"qa-date-picker__nav",text:"\u2039"});d.type="button",d.setAttr("aria-label","Previous month");let f=u.createDiv({cls:"qa-date-picker__label"}),p=u.createEl("button",{cls:"qa-date-picker__nav",text:"\u203A"});p.type="button",p.setAttr("aria-label","Next month");let m=c.createDiv({cls:"qa-date-picker__weekdays"});t.forEach(P=>{let H=m.createDiv({cls:"qa-date-picker__weekday"});H.textContent=P});let v=c.createDiv({cls:"qa-date-picker__grid"}),g=c.createDiv({cls:"qa-date-picker__actions"}),y=g.createEl("button",{cls:"qa-date-picker__action",text:"Today"});y.type="button";let w=g.createEl("button",{cls:"qa-date-picker__action",text:"Clear"});w.type="button";let x;if(a){let P=c.createDiv({cls:"qa-date-picker__time"});P.createEl("label",{cls:"qa-date-picker__time-label",text:"Time"}),x=P.createEl("input",{cls:"qa-date-picker__time-input"}),x.type="time",l&&(x.value=`${ad(l.hour)}:${ad(l.minute)}`)}let C=P=>{o+=P,o>11?(o=0,i+=1):o<0&&(o=11,i-=1),D()},_=(P,H)=>{s=P,r.onSelect(P,H),D()},E=P=>{s=void 0,r.onSelect(null,P),D()};d.addEventListener("click",()=>C(-1)),p.addEventListener("click",()=>C(1)),y.addEventListener("click",()=>{let P=new Date,H=zO(P.getFullYear(),P.getMonth(),P.getDate(),l);i=P.getFullYear(),o=P.getMonth(),_(H,"action")}),w.addEventListener("click",()=>E("action")),x&&x.addEventListener("change",()=>{if(x.value.trim()==="")l={hour:0,minute:0};else{let[P,H]=x.value.split(":").map(V=>Number.parseInt(V,10));if(Number.isNaN(P)||Number.isNaN(H))return;l={hour:P,minute:H}}if(s){let P=Bx(s);P&&_(zO(P.getFullYear(),P.getMonth(),P.getDate(),l),"picker")}});let D=()=>{f.textContent=jme(i,o),v.empty();let H=(new Date(i,o,1).getDay()-e+7)%7,V=new Date(i,o,1-H),oe=WO(new Date),ce=s?Bx(s):null,R=ce?WO(ce):void 0,O=new Intl.DateTimeFormat(void 0,{weekday:"long",year:"numeric",month:"long",day:"numeric"});for(let q=0;q<42;q+=1){let B=new Date(V);B.setDate(V.getDate()+q);let ie=WO(B),j=B.getMonth()!==o,Y=ie===oe,K=R&&ie===R,se=v.createEl("button",{cls:"qa-date-picker__day",text:String(B.getDate())});se.type="button",se.setAttr("aria-label",O.format(B)),j&&se.addClass("is-outside"),Y&&se.addClass("is-today"),K&&(se.addClass("is-selected"),se.setAttr("aria-pressed","true")),se.addEventListener("click",()=>{let pe=zO(B.getFullYear(),B.getMonth(),B.getDate(),l);_(pe,"picker")})}};return D(),{setSelectedIso:(P,{updateView:H}={})=>{if(s=P,P&&H!==!1){let V=Bx(P);V&&(i=V.getFullYear(),o=V.getMonth())}if(a&&P){let V=c5(P);V&&(l=V,x&&(x.value=`${ad(V.hour)}:${ad(V.minute)}`))}D()},setViewFromIso:P=>{let H=Bx(P);H&&(i=H.getFullYear(),o=H.getMonth(),D())},destroy:()=>{c.remove()}}}});function Zp(r,e,t=Tl,n){if(!r||!r.trim())return{isValid:!1,error:"Empty input"};try{let i=n??le.getState().dateAliases,o=Bv(r,i),s=t.parseDate(o);if(s?.moment?.isValid()){let a=s.moment.toISOString(),l=e?s.moment.format(e):s.moment.format("YYYY-MM-DD");return{isValid:!0,isoString:a,formatted:l}}else return{isValid:!1,error:"Unable to parse date"}}catch(i){return{isValid:!1,error:`Parse error: ${i instanceof Error?i.message:"Unknown error"}`}}}function Nl(r,e){if(!window.moment)return null;try{let t=window.moment(r);if(t.isValid())return t.format(e)}catch{}return null}var Ux=b(()=>{uh();It();Wd()});var yg,vg,Jp,jO=b(()=>{yg=require("obsidian");Hs();HO();Ux();It();Wd();vg=class vg extends Sr{constructor(t,n,i,o,s,a,l){super(t,n,i,o??"",void 0,void 0,a);this.isOpen=!0;this.containerEl.addClass("qaDatePrompt"),this.withTime=l===!0,this.dateFormat=s||(this.withTime?"YYYY-MM-DD HH:mm":"YYYY-MM-DD"),this.defaultValue=o,this.currentInput=this.inputComponent?.inputEl?.value??o??"",this.mountDatePicker(),this.updatePreviewDebounced=(0,yg.debounce)(this.updatePreview.bind(this),250,!0),this.updatePreview()}static Prompt(t,n,i,o,s,a,l){return new vg(t,n,i,o,s,a,l).waitForClose}createInputField(t,n,i){t.addClass("qa-date-input");let o=new yg.TextComponent(t);return o.inputEl.addClass("qa-vdate-input"),o.setPlaceholder(n??"").setValue(i??"").onChange(s=>{this.lastPickerDisplayValue=void 0,this.onInputChanged(s),this.currentInput=s,this.updatePreviewDebounced()}).inputEl.addEventListener("keydown",this.submitEnterCallback),this.currentInput=i??"",this.pickerHostEl=t.createDiv({cls:"qa-date-picker-container"}),this.createPreviewElement(t),o}mountDatePicker(){this.datePicker=OS({container:this.pickerHostEl,initialIso:this.selectedIso,withTime:this.withTime,onSelect:t=>{t?this.applyPickerSelection(t):this.clearPickerSelection()}})}createPreviewElement(t){let n=t.createDiv("vdate-preview-container");n.createEl("div",{text:"Preview:",cls:"vdate-preview-label"}),this.previewEl=n.createEl("div",{cls:"vdate-preview-text"}),this.previewEl.textContent=vg.PREVIEW_PLACEHOLDER;let i=Uv(le.getState().dateAliases);if(i.length>0){let o=n.createEl("details",{cls:"vdate-alias-details"});o.createEl("summary",{text:`Aliases (${i.length})`}).addClass("vdate-alias-summary");let a=o.createEl("div",{cls:"vdate-alias-list"});a.textContent=xT(le.getState().dateAliases)}}updatePreview(){if(!this.isOpen)return;let t=this.currentInput.trim();if(!t&&this.defaultValue&&!this.isOptionalPrompt){this.renderPreviewFromInput(this.defaultValue);return}if(!t){this.selectedIso=void 0,this.lastPickerDisplayValue=void 0,this.syncPickerSelection(),this.setPreviewText(this.isOptionalPrompt?"Will be left empty":vg.PREVIEW_PLACEHOLDER,!1);return}if(t.startsWith("@date:")){let n=t.slice(6).trim();if(n){this.selectedIso=n,this.lastPickerDisplayValue=void 0,this.syncPickerSelection(n),this.renderPreviewFromIso(n);return}}if(this.selectedIso&&this.lastPickerDisplayValue&&t===this.lastPickerDisplayValue){this.syncPickerSelection(this.selectedIso,!1),this.renderPreviewFromIso(this.selectedIso);return}this.renderPreviewFromInput(t)}formatIsoForInput(t){let n=Nl(t,this.dateFormat);return n||(t.length>=10?t.slice(0,10):t)}syncPickerSelection(t,n=!0){this.datePicker?.setSelectedIso(t,{updateView:n})}applyPickerSelection(t){let n=this.formatIsoForInput(t);this.selectedIso=t,this.lastPickerDisplayValue=n,this.inputComponent?.inputEl&&(this.inputComponent.inputEl.value=n),this.onInputChanged(n),this.currentInput=n,this.syncPickerSelection(t),this.renderPreviewFromIso(t)}clearPickerSelection(){this.inputComponent?.inputEl&&(this.inputComponent.inputEl.value=""),this.onInputChanged(""),this.currentInput="",this.selectedIso=void 0,this.lastPickerDisplayValue=void 0,this.syncPickerSelection(),this.updatePreview()}renderPreviewFromIso(t){this.setPreviewText(this.formatIsoForInput(t),!1)}renderPreviewFromInput(t){let n=Zp(t,this.dateFormat);if(n.isValid&&n.isoString){this.selectedIso=n.isoString,this.lastPickerDisplayValue=void 0,this.syncPickerSelection(n.isoString);let i=n.formatted??this.formatIsoForInput(n.isoString);this.setPreviewText(i,!1)}else{this.selectedIso=void 0,this.lastPickerDisplayValue=void 0,this.syncPickerSelection();let i=n.error||"Unable to parse date";this.setPreviewText(i,!0)}}setPreviewText(t,n){this.previewEl.textContent=t,this.previewEl.toggleClass("is-error",n)}onOpen(){super.onOpen()}transformInputOnSubmit(t){let n=t.trim();if(n.startsWith("@date:"))return n;if(this.selectedIso&&this.lastPickerDisplayValue&&n===this.lastPickerDisplayValue)return`@date:${this.selectedIso}`;if(!n&&this.defaultValue&&!this.isOptionalPrompt){let i=Zp(this.defaultValue,this.dateFormat);if(i.isValid&&i.isoString)return`@date:${i.isoString}`}if(n){let i=Zp(n,this.dateFormat);if(i.isValid&&i.isoString)return`@date:${i.isoString}`;new yg.Notice(`QuickAdd: "${n}" could not be parsed as a date; using it as-is.`)}return t}onClose(){this.isOpen=!1,this.updatePreviewDebounced.cancel(),!this.input.trim()&&this.defaultValue&&!this.isOptionalPrompt&&(this.input=this.defaultValue),super.onClose()}};vg.PREVIEW_PLACEHOLDER="Preview will appear here";Jp=vg});function Gme(r,e,t,n={}){let i=n.tab??" ";if(e===t){let d=e+i.length;return{regionStart:e,regionEnd:e,replacement:i,selectionStart:d,selectionEnd:d}}let o=e===0?0:r.lastIndexOf(`
|
||
`,e-1)+1,a=r.slice(o,t).split(`
|
||
`),l=a.length-1,c=0,u=a.map((d,f)=>f===l&&d===""?d:(c+=i.length,i+d));return{regionStart:o,regionEnd:t,replacement:u.join(`
|
||
`),selectionStart:e+i.length,selectionEnd:t+c}}function Yme(r,e){r.setSelectionRange(e.regionStart,e.regionEnd);let t=r.ownerDocument,n=!1;try{n=typeof t.execCommand=="function"&&t.execCommand("insertText",!1,e.replacement)}catch{n=!1}if(!n){let i=r.value;r.value=i.slice(0,e.regionStart)+e.replacement+i.slice(e.regionEnd),r.setSelectionRange(e.selectionStart,e.selectionEnd),r.dispatchEvent(new Event("input",{bubbles:!0}));return}r.setSelectionRange(e.selectionStart,e.selectionEnd)}function d5(r,e={}){let t=i=>{if(i.key!=="Tab"||i.shiftKey||i.ctrlKey||i.metaKey||i.altKey||i.isComposing||i.defaultPrevented)return;i.preventDefault();let o=r.selectionStart??r.value.length,s=r.selectionEnd??o;Yme(r,Gme(r.value,o,s,e))};r.addEventListener("keydown",t);let n=!1;return()=>{n||(n=!0,r.removeEventListener("keydown",t))}}var p5=b(()=>{});var bg,ld,GO=b(()=>{bg=require("obsidian");PP();FP();MP();RP();$P();p5();Hs();x_();zr();ld=class r extends bg.Modal{constructor(t,n,i,o,s,a,l){super(t);this.header=n;this.linkSourcePath=s;this.options=l;this.didSubmit=!1;this.didClose=!1;this.submitClickCallback=t=>this.submit();this.cancelClickCallback=t=>this.cancel();this.skipClickCallback=t=>this.skip();this.submitEnterCallback=t=>{if(this.isOptionalPrompt&&NP(t)){t.preventDefault(),this.skip();return}(t.ctrlKey||t.metaKey)&&t.key==="Enter"&&(t.preventDefault(),this.submit())};this.placeholder=i??"",this.description=a?.trim()||void 0,this.draftHandler=new Tm({kind:"multi",header:this.header,placeholder:this.placeholder,linkSourcePath:this.linkSourcePath,scopeId:l?.draftScopeId}),this.input=this.draftHandler.hydrate(o??""),this.waitForClose=new Promise((c,u)=>{this.resolvePromise=c,this.rejectPromise=u}),this.display(),this.open(),this.fileSuggester=new Cm(t,this.inputComponent.inputEl,{sourcePath:this.linkSourcePath}),this.tagSuggester=new xm(t,this.inputComponent.inputEl)}static Prompt(t,n,i,o,s,a){return new r(t,n,i,o,void 0,s,a).waitForClose}static PromptWithContext(t,n,i,o,s,a,l){return new r(t,n,i,o,s,a,l).waitForClose}display(){this.containerEl.addClass("quickAddModal","qaWideInputPrompt"),this.contentEl.empty(),this.titleEl.textContent=this.header,y_(this.contentEl,this.options?.contextLine,this.options?.contextLineFull),this.description&&this.contentEl.createDiv({text:this.description,cls:"setting-item-description"}).setCssStyles({marginBottom:"0.75rem"}),this.isOptionalPrompt&&this.contentEl.createDiv({text:"Optional \u2014 leave empty, press Skip, or ctrl/cmd+shift+\u21B5.",cls:"setting-item-description"}).setCssStyles({marginBottom:"0.75rem"});let t=this.contentEl.createDiv();this.inputComponent=this.createInputField(t,this.placeholder,this.input),this.createButtonBar(t)}createInputField(t,n,i){let o=new bg.TextAreaComponent(t);return o.inputEl.classList.add("wideInputPromptInputEl"),o.inputEl.setAttribute("dir","auto"),o.setPlaceholder(n??"").setValue(i??"").onChange(s=>this.onInputChanged(s)).inputEl.addEventListener("keydown",this.submitEnterCallback),this.disposeIndent=d5(o.inputEl),this.options?.imagePaste&&(this.imagePasteHandle=_m(this.app,o.inputEl,this.options.imagePaste)),o}createButton(t,n,i){let o=new bg.ButtonComponent(t);return o.setButtonText(n).onClick(i),o}get isOptionalPrompt(){return this.options?.optional===!0}createButtonBar(t){let n=t.createDiv();if(this.createButton(n,"Ok",this.submitClickCallback).setCta().buttonEl.setCssStyles({marginRight:"0"}),this.createButton(n,"Cancel",this.cancelClickCallback),this.isOptionalPrompt){let i=this.createButton(n,"Skip",this.skipClickCallback);i.setTooltip("Leave this field empty"),i.buttonEl.setAttribute("aria-label","Skip and leave empty")}n.setCssStyles({display:"flex",flexDirection:"row-reverse",justifyContent:"flex-start",marginTop:"1rem",gap:"0.5rem"})}submit(){if(!(this.didSubmit||this.didClose)){if(this.imagePasteHandle?.isBusy()){this.imagePasteHandle.whenIdle().then(()=>this.submit());return}this.input=this.inputComponent?.inputEl?.value??this.input,this.didSubmit=!0,this.close()}}skip(){this.didSubmit||(this.input="",this.didSubmit=!0,this.close())}cancel(){this.close()}resolveInput(){this.didSubmit?this.resolvePromise(this.input):this.rejectPromise(rn())}onInputChanged(t){this.draftHandler.markChanged(),this.input=t}syncInputFromEl(){this.inputComponent?.inputEl&&(this.input=this.inputComponent.inputEl.value)}persistDraft(){this.draftHandler.persist(this.input,this.didSubmit)}removeInputListener(){this.inputComponent.inputEl.removeEventListener("keydown",this.submitEnterCallback),this.disposeIndent?.(),this.imagePasteHandle?.detach()}onOpen(){super.onOpen(),v_(this.inputComponent.inputEl,this.options)}onClose(){this.didClose=!0,this.didSubmit||this.syncInputFromEl(),this.persistDraft(),this.resolveInput(),this.removeInputListener(),this.fileSuggester?.destroy(),this.tagSuggester?.destroy(),super.onClose()}}});var Vx,f5=b(()=>{Hs();yl();Vx=class r extends Sr{static Prompt(e,t,n,i,o,s){return new r(e,t,n,i,void 0,o,s).waitForClose}static PromptWithContext(e,t,n,i,o,s,a){return new r(e,t,n,i,o,s,a).waitForClose}createInputField(e,t,n){let i=super.createInputField(e,t,n);i.inputEl.type="number",i.inputEl.inputMode="decimal";let o=this.options?.numeric;return o?.min!==void 0&&(i.inputEl.min=String(o.min)),o?.max!==void 0&&(i.inputEl.max=String(o.max)),i.inputEl.setAttr("step",o?.step!==void 0?String(o.step):"any"),i}transformInputOnSubmit(e){return this.options?.numeric?e===""&&this.isOptionalPrompt?"":Ra(e,this.options.numeric):e}}});var YO,qx,m5=b(()=>{Hs();yl();YO={min:0,max:100,step:1},qx=class r extends Sr{static Prompt(e,t,n,i,o,s){return new r(e,t,n,i,void 0,o,s).waitForClose}static PromptWithContext(e,t,n,i,o,s,a){return new r(e,t,n,i,o,s,a).waitForClose}createInputField(e,t,n){let i=this.options?.slider??YO,o=this.isOptionalPrompt&&!n,s=Sy(n,i);this.sliderEl=e.createEl("input"),this.sliderEl.type="range",this.sliderEl.min=String(i.min),this.sliderEl.max=String(i.max),this.sliderEl.step=String(i.step),this.sliderEl.value=s,this.sliderEl.setCssStyles({width:"100%"});let a=super.createInputField(e,void 0,s);return this.numberEl=a.inputEl,this.numberEl.type="number",this.numberEl.inputMode="decimal",this.numberEl.min=String(i.min),this.numberEl.max=String(i.max),this.numberEl.step=String(i.step),o&&(this.numberEl.value=""),this.sliderEl.addEventListener("input",()=>this.syncFromSlider()),this.numberEl.addEventListener("input",()=>this.syncFromNumber()),a}syncFromSlider(){!this.sliderEl||!this.numberEl||(this.numberEl.value=this.sliderEl.value,this.onInputChanged(this.sliderEl.value))}syncFromNumber(){if(!this.sliderEl||!this.numberEl)return;let e=this.numberEl.value;if(e===""&&this.isOptionalPrompt){this.onInputChanged("");return}let t=Ra(e,this.options?.slider??YO);t!==""&&(this.sliderEl.value=t),this.onInputChanged(e)}transformInputOnSubmit(e){return e===""&&this.isOptionalPrompt?"":Sy(e,this.options?.slider??YO)}}});var wg,h5=b(()=>{GO();Hs();f5();m5();gl();wg=class{factory(e){return e==="multiline"?ld:e==="number"?Vx:e==="slider"?qx:ni().settings.inputPrompt==="multi-line"?ld:Sr}}});function Xme(r){return`\\begin{${r}}
|
||
\u261A
|
||
\\end{${r}}\u261A`}var Kme,Qme,g5,KO=b(()=>{Kme=["\\!","\\,","\\:","\\>","\\;","\\#","\\$","\\%","\\&","\\","_","{ }","|","^{\u261A}\u261A","[\u261A]\u261A","\\above","\\abovewithdelims","\\acute","\\aleph","\\alpha","\\amalg","\\And","\\angle","\\approx","\\approxeq","\\arccos","\\arcsin","\\arctan","\\arg","\\array","\\arrowvert","\\Arrowvert","\\ast","\\asymp","\\atop","\\atopwithdelims","\\backepsilon","\\backprime","\\backsim","\\backsimeq","\\backslash","\\bar","\\barwedge","\\Bbb","\\Bbbk","\\because","\\begin","\\beta","\\beth","\\between","\\bf","\\Bigg","\\bigg","\\Big","\\big","\\Biggl","\\Biggm","\\Biggr","\\biggl","\\biggm","\\biggr","\\Bigl","\\Bigm","\\Bigl","\\bigl","\\bigm","\\bigr","\\bigcap","\\bigcirc","\\bigcup","\\bigodot","\\bigoplus","\\bigotimes","\\bigsqcup","\\bigstar","\\bigtriangledown","\\bigtriangleup","\\biguplus","\\bigvee","\\bigwedge","\\binom","\\blacklozenge","\\blacksquare","\\blacktriangle","\\blacktriangledown","\\blacktriangleleft","\\blacktriangleright","\\bmod","\\boldsymbol","\\bot","\\bowtie","\\Box","\\boxdot","\\boxed","\\boxminus","\\boxplus","\\boxtimes","\\brace","\\bracevert","\\brack","\\breve","\\bullet","\\Bumpeq","\\bumpeq","\\cal","\\cancel","\\Cap","\\cap","\\cases","\\cdot","\\cdotp","\\cdots","\\centerdot","\\cfrac{\u261A}{\u261A}\u261A","\\check","\\checkmark","\\chi","\\choose","\\circ","\\circeq","\\circlearrowleft","\\circlearrowright","\\circledast","\\circledcirc","\\circleddash","\\circledR","\\circledS","\\class","\\clubsuit","\\colon","\\color","\\complement","\\cong","\\coprod","\\cos","\\cosh","\\cot","\\coth","\\cr","\\csc","\\cssId","\\Cup","\\cup","\\curlyeqprec","\\curlyeqsucc","\\curlyvee","\\curlywedge","\\curvearrowleft","\\curvearrowright","\\dagger","\\ddagger","\\daleth","\\dashleftarrow","\\dashrightarrow","\\dashv","\\dbinom","\\dot","\\ddot","\\dddot","\\ddddot","\\ddots","\\DeclareMathOperator","\\def","\\deg","\\Delta","\\delta","\\det","\\dfrac{\u261A}{\u261A}\u261A","\\diagdown","\\diagup","\\Diamond","\\diamond","\\diamondsuit","\\digamma","\\dim","\\displaylines","\\displaystyle","\\div","\\divideontimes","\\Doteq","\\doteq","\\dotplus","\\dots","\\dotsb","\\dotsc","\\dotsi","\\dotsm","\\dotso","\\doublebarwedge","\\doublecap","\\doublecup","\\downarrow","\\Downarrow","\\downdownarrows","\\downharpoonleft","\\downharpoonright","\\ell","\\emptyset","\\end","\\enspace","\\epsilon","\\eqalign","\\eqalignno","\\eqcirc","\\eqsim","\\eqslantgtr","\\eqslantless","\\equiv","\\eta","\\eth","\\exists","\\exp","\\fallingdotseq","\\fbox","\\Finv","\\flat","\\forall","\\frac{\u261A}{\u261A}\u261A","\\frak","\\frown","\\Game","\\Gamma","\\gamma","\\gcd","\\ge","\\geq","\\geqq","\\geqslant","\\genfrac","\\gets","\\gg","\\ggg","\\gggtr","\\gimel","\\gtrapprox","\\gnapprox","\\gneq","\\gneqq","\\gvertneqq","\\gtrsim","\\gnsim","\\grave","\\gt","\\gtrdot","\\gtreqless","\\gtreqqless","\\gtrless","\\hat","\\hbar","\\hbox","\\hdashline","\\hline","\\heartsuit","\\hfil","\\hfill","\\hom","\\hookleftarrow","\\hookrightarrow","\\hphantom","\\href","\\hskip","\\hslash","\\hspace","\\Huge","\\huge","\\iddots","\\idotsint","\\iff","\\iiiint","\\iiint","\\iint","\\int","\\intop","\\Im","\\imath","\\impliedby","\\implies","\\in","\\inf","\\infty","\\injlim","\\intercal","\\iota","\\it","\\jmath","\\Join","\\kappa","\\ker","\\kern","\\Lambda","\\lambda","\\land","\\langle","\\LARGE","\\Large","\\large","\\LaTeX","\\lbrace","\\lbrack","\\lceil","\\ldotp","\\ldots","\\le","\\leq","\\leqq","\\leqslant","\\leadsto","\\left","\\leftarrow","\\Leftarrow","\\leftarrowtail","\\leftharpoondown","\\leftharpoonup","\\leftleftarrows","\\leftrightarrow","\\Leftrightarrow","\\leftrightarrows","\\leftrightharpoons","\\leftrightsquigarrow","\\leftroot","\\leftthreetimes","\\leqalignno","\\lessapprox","\\lessdot","\\lesseqgtr","\\lesseqqgtr","\\lessgtr","\\lesssim","\\lfloor","\\lg","\\lgroup","\\lhd","\\lim","\\liminf","\\limits","\\limsup","\\ll","\\llap","\\llcorner","\\lrcorner","\\Lleftarrow","\\lll","\\llless","\\lmoustache","\\ln","\\lnapprox","\\lneq","\\lneqq","\\lnot","\\lnsim","\\log","\\longleftarrow","\\Longleftarrow","\\longrightarrow","\\Longrightarrow","\\longleftrightarrow","\\Longleftrightarrow","\\longmapsto","\\looparrowleft","\\looparrowright","\\lor","\\lower","\\lozenge","\\Lsh","\\lt","\\ltimes","\\lvert","\\lVert","\\lvertneqq","\\maltese","\\mapsto","\\mathbb","\\mathbf","\\mathbin","\\mathcal","\\mathchoice","\\mathclose","\\mathfrak","\\mathinner","\\mathit","\\mathop","\\mathopen","\\mathord","\\mathpunct","\\mathrel","\\mathring","\\mathrm","\\mathscr","\\mathsf","\\mathstrut","\\mathtt","\\matrix","\\max","\\mbox","\\measuredangle","\\mho","\\mid","\\min","\\mit","\\mod","\\models","\\moveleft","\\moveright","\\mp","\\mskip","\\mspace","\\mu","\\multimap","\\nabla","\\natural","\\ncong","\\ne","\\nearrow","\\neg","\\negthinspace","\\negmedspace","\\negthickspace","\\neq","\\newcommand","\\newenvironment","\\newline","\\nexists","\\ngeq","\\ngeqq","\\ngeqslant","\\ngtr","\\ni","\\nleftarrow","\\nLeftarrow","\\nleftrightarrow","\\nLeftrightarrow","\\nleq","\\nleqq","\\nleqslant","\\nless","\\nmid","\\nobreakspace","\\nolimits","\\normalsize","\\not","\\notag","\\notin","\\nparallel","\\nprec","\\npreceq","\\nrightarrow","\\nRightarrow","\\nshortmid","\\nshortparallel","\\nsim","\\nsubseteq","\\nsubseteqq","\\nsucc","\\nsucceq","\\nsupseteq","\\nsupseteqq","\\ntriangleleft","\\ntrianglelefteq","\\ntriangleright","\\ntrianglerighteq","\\nu","\\nVDash","\\nVdash","\\nvDash","\\nvdash","\\nwarrow","\\odot","\\ominus","\\oplus","\\oslash","\\otimes","\\oint","\\oldstyle","\\omega","\\Omega","\\omicron","\\operatorname","\\over","\\overbrace","\\overleftarrow","\\overrightarrow","\\overleftrightarrow","\\overline","\\overparen","\\overset","\\overwithdelims","\\owns","\\parallel","\\partial","\\perp","\\phantom","\\phi","\\Phi","\\pi","\\Pi","\\pitchfork","\\pm","\\pmatrix","\\pmb","\\pmod","\\pod","\\Pr","\\prec","\\precapprox","\\precnapprox","\\preccurlyeq","\\preceq","\\precneqq","\\precsim","\\precnsim","\\prime","\\prod","\\projlim","\\propto","\\psi","\\Psi","\\quad","\\qquad","\\raise","\\rangle","\\rbrace","\\rbrack","\\rceil","\\Re","\\renewcommand","\\require (non-standard)","\\restriction","\\rfloor","\\rgroup","\\rhd","\\rho","\\right","\\rightarrow","\\Rightarrow","\\rightarrowtail","\\rightharpoondown","\\rightharpoonup","\\rightleftarrows","\\rightleftharpoons","\\rightrightarrows","\\rightsquigarrow","\\rightthreetimes","\\risingdotseq","\\rlap","\\rm","\\rmoustache","\\Rrightarrow","\\Rsh","\\rtimes","\\Rule (non-standard)","\\rvert","\\rVert","\\S","\\scr","\\scriptscriptstyle","\\scriptsize","\\scriptstyle","\\searrow","\\sec","\\setminus","\\sf","\\sharp","\\shortmid","\\shortparallel","\\shoveleft","\\shoveright","\\sideset","\\sigma","\\Sigma","\\sim","\\simeq","\\sin","\\sinh","\\skew","\\small","\\smallfrown","\\smallint","\\smallsetminus","\\smallsmile","\\smash","\\smile","\\space","\\Space (non-standard)","\\spadesuit","\\sphericalangle","\\sqcap","\\sqcup","\\sqrt","\\sqsubset","\\sqsupset","\\sqsubseteq","\\sqsupseteq","\\square","\\stackrel","\\star","\\strut","\\style","\\subset","\\Subset","\\subseteq","\\subsetneq","\\subseteqq","\\subsetneqq","\\substack","\\succ","\\succapprox","\\succnapprox","\\succcurlyeq","\\succeq","\\succneqq","\\succsim","\\succnsim","\\sum","\\sup","\\supset","\\Supset","\\supseteq","\\supsetneq","\\supseteqq","\\supsetneqq","\\surd","\\swarrow","\\tag","\\tan","\\tanh","\\tau","\\tbinom","\\TeX","\\text{\u261A}\u261A","\\textbf{\u261A}\u261A","\\textit{\u261A}\u261A","\\textrm{\u261A}\u261A","\\textsf{\u261A}\u261A","\\texttt{\u261A}\u261A","\\textstyle","\\tfrac{\u261A}{\u261A}\u261A","\\therefore","\\theta","\\Theta","\\thickapprox","\\thicksim","\\thinspace","\\tilde","\\times","\\tiny","\\Tiny","\\to","\\top","\\triangle","\\triangledown","\\triangleleft","\\triangleright","\\trianglelefteq","\\trianglerighteq","\\triangleq","\\tt","\\twoheadleftarrow","\\twoheadrightarrow","\\ulcorner","\\urcorner","\\underbrace","\\underleftarrow","\\underrightarrow","\\underleftrightarrow","\\underline","\\underparen","\\underset","\\unicode","\\unlhd","\\unrhd","\\uparrow","\\Uparrow","\\updownarrow","\\Updownarrow","\\upharpoonleft","\\upharpoonright","\\uplus","\\uproot","\\upsilon","\\Upsilon","\\upuparrows","\\varDelta","\\varepsilon","\\varGamma","\\varinjlim","\\varkappa","\\varLambda","\\varlimsup","\\varliminf","\\varnothing","\\varOmega","\\varphi","\\varPhi","\\varpi","\\varPi","\\varprojlim","\\varpropto","\\varPsi","\\varrho","\\varsigma","\\varSigma","\\varsubsetneq","\\varsubsetneqq","\\varsupsetneq","\\varsupsetneqq","\\vartheta","\\varTheta","\\vartriangle","\\vartriangleleft","\\vartriangleright","\\varUpsilon","\\varXi","\\vcenter","\\vdash","\\Vdash","\\vDash","\\vdots","\\vec","\\vee","\\veebar","\\verb","\\vert","\\Vert","\\vphantom","\\Vvdash","\\wedge","\\widehat","\\widetilde","\\wp","\\wr","\\Xi","\\xi","\\xleftarrow","\\xrightarrow","\\yen","\\zeta","\\{%C\\}%C","\\langle %C \\rangle%C"],Qme=["align","align*","alignat","alignat*","array","Bmatrix","bmatrix","cases","eqnarray","eqnarray*","equation","equation*","gather","gather*","matrix","pmatrix","smallmatrix","subarray","Vmatrix","vmatrix"];g5=[...Kme,...Qme.map(Xme)]});function Jme(r){if(QO.has(r))return QO.get(r)??null;let e=null;try{e=(0,v5.renderMath)(r,!0)}catch{e=null}return QO.set(r,e),e}function ehe(r){return XO===null&&(XO=new Mu(r,{findAllMatches:!0,threshold:.8})),XO}var v5,Zme,QO,XO,NS,y5=b(()=>{ml();m_();v5=require("obsidian");KO();gl();Zme=new RegExp(/\\([a-z{}A-Z0-9]*)$/),QO=new Map,XO=null;NS=class extends hn{constructor(t){super(ni().app,t);this.inputEl=t;this.lastInput="";this.symbols=Object.assign([],g5)}getSuggestions(t){if(this.inputEl.selectionStart===null)return[];let n=this.inputEl.selectionStart,i=t.slice(0,n),o=i.lastIndexOf("\\"),s=i.slice(o),a=Zme.exec(s),l=[];a&&(this.lastInput=a[1],l=this.symbols.filter(d=>d.toLowerCase().contains(this.lastInput)));let c=new Set(l);return ehe(this.symbols).search(this.lastInput).map(d=>d.item).filter(d=>c.has(d))}renderSuggestion(t,n){if(t){n.setText(t);let i=Jme(t);i&&n.append(i.cloneNode(!0))}}selectSuggestion(t){if(this.inputEl.selectionStart===null)return;let n=this.inputEl.selectionStart,i=this.lastInput.length,o=this.inputEl.value,s=0,a=t.replace(/\\\\/g,"\\");if(this.inputEl.value=`${o.slice(0,n-i-1)}${a}${o.slice(n)}`,s=n-i+t.length-1,this.inputEl.trigger("input"),this.close(),t.contains("\u261A")){let l=this.inputEl.value.indexOf("\u261A");this.inputEl.value=this.inputEl.value.replace("\u261A",""),this.inputEl.setSelectionRange(l,l)}else this.inputEl.setSelectionRange(s,s)}}});var Vo,LS,b5=b(()=>{Vo=require("obsidian");gl();KO();y5();zr();LS=class r extends Vo.Modal{constructor(){super(ni().app);this.didSubmit=!1;this.keybindListener=t=>{(t.ctrlKey||t.metaKey)&&t.key==="Enter"&&this.submit(),t.key==="Tab"&&(t.preventDefault(),this.cursorToGoTo())};this.submitClickCallback=t=>this.submit();this.cancelClickCallback=t=>this.cancel();this.open(),this.display(),this.waitForClose=new Promise((t,n)=>{this.resolvePromise=t,this.rejectPromise=n}),new NS(this.inputEl),this.inputEl.focus(),this.inputEl.select()}static Prompt(){return new r().waitForClose}display(){this.containerEl.addClass("quickAddModal","qaMathModal"),this.contentEl.empty();let t=this.contentEl.createDiv();t.className="math math-block is-loaded";let n=new Vo.TextAreaComponent(this.contentEl);n.inputEl.setCssStyles({width:"100%",height:"10rem"}),this.inputEl=n.inputEl,n.onChange((0,Vo.debounce)(async o=>await this.mathjaxLoop(t,o),50)),n.inputEl.addEventListener("keydown",this.keybindListener),this.contentEl.createDiv({text:"Ctrl/Cmd+Enter to submit \xB7 Tab to jump to the cursor marker",cls:"setting-item-description"}).setCssStyles({marginTop:"0.5rem"}),this.createButtonBar(this.contentEl.createDiv())}async onOpen(){super.onOpen(),await(0,Vo.loadMathJax)()}async mathjaxLoop(t,n){let i=(0,Vo.renderMath)(n,!0);await(0,Vo.finishRenderMath)(),t.empty(),t.append(i)}cursorToGoTo(){if(this.inputEl.value.contains("\u261A")){let t=this.inputEl.value.indexOf("\u261A");this.inputEl.value=this.inputEl.value.replace("\u261A",""),this.inputEl.setSelectionRange(t,t)}}createButton(t,n,i){let o=new Vo.ButtonComponent(t);return o.setButtonText(n).onClick(i),o}createButtonBar(t){let n=t.createDiv();this.createButton(n,"Ok",this.submitClickCallback).setCta().buttonEl.setCssStyles({marginRight:"0"}),this.createButton(n,"Cancel",this.cancelClickCallback),n.setCssStyles({display:"flex",flexDirection:"row-reverse",justifyContent:"flex-start",marginTop:"1rem",gap:"0.5rem"})}removeInputListeners(){this.inputEl.removeEventListener("keydown",this.keybindListener)}resolveInput(){let t=this.inputEl.value.replace(/\\n/g,"\\\\n").replace(new RegExp("\u261A","g"),"");this.didSubmit?this.resolvePromise(t):this.rejectPromise(rn())}submit(){this.didSubmit=!0,this.close()}cancel(){this.close()}onClose(){super.onClose(),this.resolveInput(),this.removeInputListeners()}}});var X8=j7(Ul=>{"use strict";Object.defineProperty(Ul,"__esModule",{value:!0});require("obsidian");var zc=class extends Error{},s1=class extends zc{constructor(e){super(`Invalid DateTime: ${e.toMessage()}`)}},a1=class extends zc{constructor(e){super(`Invalid Interval: ${e.toMessage()}`)}},l1=class extends zc{constructor(e){super(`Invalid Duration: ${e.toMessage()}`)}},rf=class extends zc{},GS=class extends zc{constructor(e){super(`Invalid unit ${e}`)}},qo=class extends zc{},Ll=class extends zc{constructor(){super("Zone is an abstract class")}},Te="numeric",Ya="short",ws="long",YS={year:Te,month:Te,day:Te},X5={year:Te,month:Ya,day:Te},the={year:Te,month:Ya,day:Te,weekday:Ya},Z5={year:Te,month:ws,day:Te},J5={year:Te,month:ws,day:Te,weekday:ws},e8={hour:Te,minute:Te},t8={hour:Te,minute:Te,second:Te},r8={hour:Te,minute:Te,second:Te,timeZoneName:Ya},n8={hour:Te,minute:Te,second:Te,timeZoneName:ws},i8={hour:Te,minute:Te,hourCycle:"h23"},o8={hour:Te,minute:Te,second:Te,hourCycle:"h23"},s8={hour:Te,minute:Te,second:Te,hourCycle:"h23",timeZoneName:Ya},a8={hour:Te,minute:Te,second:Te,hourCycle:"h23",timeZoneName:ws},l8={year:Te,month:Te,day:Te,hour:Te,minute:Te},c8={year:Te,month:Te,day:Te,hour:Te,minute:Te,second:Te},u8={year:Te,month:Ya,day:Te,hour:Te,minute:Te},d8={year:Te,month:Ya,day:Te,hour:Te,minute:Te,second:Te},rhe={year:Te,month:Ya,day:Te,weekday:Ya,hour:Te,minute:Te},p8={year:Te,month:ws,day:Te,hour:Te,minute:Te,timeZoneName:Ya},f8={year:Te,month:ws,day:Te,hour:Te,minute:Te,second:Te,timeZoneName:Ya},m8={year:Te,month:ws,day:Te,weekday:ws,hour:Te,minute:Te,timeZoneName:ws},h8={year:Te,month:ws,day:Te,weekday:ws,hour:Te,minute:Te,second:Te,timeZoneName:ws},sf=class{get type(){throw new Ll}get name(){throw new Ll}get ianaName(){return this.name}get isUniversal(){throw new Ll}offsetName(e,t){throw new Ll}formatOffset(e,t){throw new Ll}offset(e){throw new Ll}equals(e){throw new Ll}get isValid(){throw new Ll}},ZO=null,KS=class r extends sf{static get instance(){return ZO===null&&(ZO=new r),ZO}get type(){return"system"}get name(){return new Intl.DateTimeFormat().resolvedOptions().timeZone}get isUniversal(){return!1}offsetName(e,{format:t,locale:n}){return v8(e,t,n)}formatOffset(e,t){return Yx(this.offset(e),t)}offset(e){return-new Date(e).getTimezoneOffset()}equals(e){return e.type==="system"}get isValid(){return!0}},HS={};function nhe(r){return HS[r]||(HS[r]=new Intl.DateTimeFormat("en-US",{hour12:!1,timeZone:r,year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit",era:"short"})),HS[r]}var ihe={year:0,month:1,day:2,era:3,hour:4,minute:5,second:6};function ohe(r,e){let t=r.format(e).replace(/\u200E/g,""),n=/(\d+)\/(\d+)\/(\d+) (AD|BC),? (\d+):(\d+):(\d+)/.exec(t),[,i,o,s,a,l,c,u]=n;return[s,i,o,a,l,c,u]}function she(r,e){let t=r.formatToParts(e),n=[];for(let i=0;i<t.length;i++){let{type:o,value:s}=t[i],a=ihe[o];o==="era"?n[a]=s:Mt(a)||(n[a]=parseInt(s,10))}return n}var BS={},fd=class r extends sf{static create(e){return BS[e]||(BS[e]=new r(e)),BS[e]}static resetCache(){BS={},HS={}}static isValidSpecifier(e){return this.isValidZone(e)}static isValidZone(e){if(!e)return!1;try{return new Intl.DateTimeFormat("en-US",{timeZone:e}).format(),!0}catch{return!1}}constructor(e){super(),this.zoneName=e,this.valid=r.isValidZone(e)}get type(){return"iana"}get name(){return this.zoneName}get isUniversal(){return!1}offsetName(e,{format:t,locale:n}){return v8(e,t,n,this.name)}formatOffset(e,t){return Yx(this.offset(e),t)}offset(e){let t=new Date(e);if(isNaN(t))return NaN;let n=nhe(this.name),[i,o,s,a,l,c,u]=n.formatToParts?she(n,t):ohe(n,t);a==="BC"&&(i=-Math.abs(i)+1);let f=iD({year:i,month:o,day:s,hour:l===24?0:l,minute:c,second:u,millisecond:0}),p=+t,m=p%1e3;return p-=m>=0?m:1e3+m,(f-p)/(60*1e3)}equals(e){return e.type==="iana"&&e.name===this.name}get isValid(){return this.valid}},w5={};function ahe(r,e={}){let t=JSON.stringify([r,e]),n=w5[t];return n||(n=new Intl.ListFormat(r,e),w5[t]=n),n}var c1={};function u1(r,e={}){let t=JSON.stringify([r,e]),n=c1[t];return n||(n=new Intl.DateTimeFormat(r,e),c1[t]=n),n}var d1={};function lhe(r,e={}){let t=JSON.stringify([r,e]),n=d1[t];return n||(n=new Intl.NumberFormat(r,e),d1[t]=n),n}var p1={};function che(r,e={}){let{base:t,...n}=e,i=JSON.stringify([r,n]),o=p1[i];return o||(o=new Intl.RelativeTimeFormat(r,e),p1[i]=o),o}var jx=null;function uhe(){return jx||(jx=new Intl.DateTimeFormat().resolvedOptions().locale,jx)}function dhe(r){let e=r.indexOf("-x-");e!==-1&&(r=r.substring(0,e));let t=r.indexOf("-u-");if(t===-1)return[r];{let n,i;try{n=u1(r).resolvedOptions(),i=r}catch{let l=r.substring(0,t);n=u1(l).resolvedOptions(),i=l}let{numberingSystem:o,calendar:s}=n;return[i,o,s]}}function phe(r,e,t){return(t||e)&&(r.includes("-u-")||(r+="-u"),t&&(r+=`-ca-${t}`),e&&(r+=`-nu-${e}`)),r}function fhe(r){let e=[];for(let t=1;t<=12;t++){let n=At.utc(2009,t,1);e.push(r(n))}return e}function mhe(r){let e=[];for(let t=1;t<=7;t++){let n=At.utc(2016,11,13+t);e.push(r(n))}return e}function US(r,e,t,n){let i=r.listingMode();return i==="error"?null:i==="en"?t(e):n(e)}function hhe(r){return r.numberingSystem&&r.numberingSystem!=="latn"?!1:r.numberingSystem==="latn"||!r.locale||r.locale.startsWith("en")||new Intl.DateTimeFormat(r.intl).resolvedOptions().numberingSystem==="latn"}var f1=class{constructor(e,t,n){this.padTo=n.padTo||0,this.floor=n.floor||!1;let{padTo:i,floor:o,...s}=n;if(!t||Object.keys(s).length>0){let a={useGrouping:!1,...n};n.padTo>0&&(a.minimumIntegerDigits=n.padTo),this.inf=lhe(e,a)}}format(e){if(this.inf){let t=this.floor?Math.floor(e):e;return this.inf.format(t)}else{let t=this.floor?Math.floor(e):k1(e,3);return En(t,this.padTo)}}},m1=class{constructor(e,t,n){this.opts=n,this.originalZone=void 0;let i;if(this.opts.timeZone)this.dt=e;else if(e.zone.type==="fixed"){let s=-1*(e.offset/60),a=s>=0?`Etc/GMT+${s}`:`Etc/GMT${s}`;e.offset!==0&&fd.create(a).valid?(i=a,this.dt=e):(i="UTC",this.dt=e.offset===0?e:e.setZone("UTC").plus({minutes:e.offset}),this.originalZone=e.zone)}else e.zone.type==="system"?this.dt=e:e.zone.type==="iana"?(this.dt=e,i=e.zone.name):(i="UTC",this.dt=e.setZone("UTC").plus({minutes:e.offset}),this.originalZone=e.zone);let o={...this.opts};o.timeZone=o.timeZone||i,this.dtf=u1(t,o)}format(){return this.originalZone?this.formatToParts().map(({value:e})=>e).join(""):this.dtf.format(this.dt.toJSDate())}formatToParts(){let e=this.dtf.formatToParts(this.dt.toJSDate());return this.originalZone?e.map(t=>{if(t.type==="timeZoneName"){let n=this.originalZone.offsetName(this.dt.ts,{locale:this.dt.locale,format:this.opts.timeZoneName});return{...t,value:n}}else return t}):e}resolvedOptions(){return this.dtf.resolvedOptions()}},h1=class{constructor(e,t,n){this.opts={style:"long",...n},!t&&g8()&&(this.rtf=che(e,n))}format(e,t){return this.rtf?this.rtf.format(e,t):Phe(t,e,this.opts.numeric,this.opts.style!=="long")}formatToParts(e,t){return this.rtf?this.rtf.formatToParts(e,t):[]}},Zr=class r{static fromOpts(e){return r.create(e.locale,e.numberingSystem,e.outputCalendar,e.defaultToEN)}static create(e,t,n,i=!1){let o=e||Xr.defaultLocale,s=o||(i?"en-US":uhe()),a=t||Xr.defaultNumberingSystem,l=n||Xr.defaultOutputCalendar;return new r(s,a,l,o)}static resetCache(){jx=null,c1={},d1={},p1={}}static fromObject({locale:e,numberingSystem:t,outputCalendar:n}={}){return r.create(e,t,n)}constructor(e,t,n,i){let[o,s,a]=dhe(e);this.locale=o,this.numberingSystem=t||s||null,this.outputCalendar=n||a||null,this.intl=phe(this.locale,this.numberingSystem,this.outputCalendar),this.weekdaysCache={format:{},standalone:{}},this.monthsCache={format:{},standalone:{}},this.meridiemCache=null,this.eraCache={},this.specifiedLocale=i,this.fastNumbersCached=null}get fastNumbers(){return this.fastNumbersCached==null&&(this.fastNumbersCached=hhe(this)),this.fastNumbersCached}listingMode(){let e=this.isEnglish(),t=(this.numberingSystem===null||this.numberingSystem==="latn")&&(this.outputCalendar===null||this.outputCalendar==="gregory");return e&&t?"en":"intl"}clone(e){return!e||Object.getOwnPropertyNames(e).length===0?this:r.create(e.locale||this.specifiedLocale,e.numberingSystem||this.numberingSystem,e.outputCalendar||this.outputCalendar,e.defaultToEN||!1)}redefaultToEN(e={}){return this.clone({...e,defaultToEN:!0})}redefaultToSystem(e={}){return this.clone({...e,defaultToEN:!1})}months(e,t=!1){return US(this,e,w8,()=>{let n=t?{month:e,day:"numeric"}:{month:e},i=t?"format":"standalone";return this.monthsCache[i][e]||(this.monthsCache[i][e]=fhe(o=>this.extract(o,n,"month"))),this.monthsCache[i][e]})}weekdays(e,t=!1){return US(this,e,E8,()=>{let n=t?{weekday:e,year:"numeric",month:"long",day:"numeric"}:{weekday:e},i=t?"format":"standalone";return this.weekdaysCache[i][e]||(this.weekdaysCache[i][e]=mhe(o=>this.extract(o,n,"weekday"))),this.weekdaysCache[i][e]})}meridiems(){return US(this,void 0,()=>T8,()=>{if(!this.meridiemCache){let e={hour:"numeric",hourCycle:"h12"};this.meridiemCache=[At.utc(2016,11,13,9),At.utc(2016,11,13,19)].map(t=>this.extract(t,e,"dayperiod"))}return this.meridiemCache})}eras(e){return US(this,e,_8,()=>{let t={era:e};return this.eraCache[e]||(this.eraCache[e]=[At.utc(-40,1,1),At.utc(2017,1,1)].map(n=>this.extract(n,t,"era"))),this.eraCache[e]})}extract(e,t,n){let i=this.dtFormatter(e,t),o=i.formatToParts(),s=o.find(a=>a.type.toLowerCase()===n);return s?s.value:null}numberFormatter(e={}){return new f1(this.intl,e.forceSimple||this.fastNumbers,e)}dtFormatter(e,t={}){return new m1(e,this.intl,t)}relFormatter(e={}){return new h1(this.intl,this.isEnglish(),e)}listFormatter(e={}){return ahe(this.intl,e)}isEnglish(){return this.locale==="en"||this.locale.toLowerCase()==="en-us"||new Intl.DateTimeFormat(this.intl).resolvedOptions().locale.startsWith("en-us")}equals(e){return this.locale===e.locale&&this.numberingSystem===e.numberingSystem&&this.outputCalendar===e.outputCalendar}},JO=null,ia=class r extends sf{static get utcInstance(){return JO===null&&(JO=new r(0)),JO}static instance(e){return e===0?r.utcInstance:new r(e)}static parseSpecifier(e){if(e){let t=e.match(/^utc(?:([+-]\d{1,2})(?::(\d{2}))?)?$/i);if(t)return new r(oD(t[1],t[2]))}return null}constructor(e){super(),this.fixed=e}get type(){return"fixed"}get name(){return this.fixed===0?"UTC":`UTC${Yx(this.fixed,"narrow")}`}get ianaName(){return this.fixed===0?"Etc/UTC":`Etc/GMT${Yx(-this.fixed,"narrow")}`}offsetName(){return this.name}formatOffset(e,t){return Yx(this.fixed,t)}get isUniversal(){return!0}offset(){return this.fixed}equals(e){return e.type==="fixed"&&e.fixed===this.fixed}get isValid(){return!0}},g1=class extends sf{constructor(e){super(),this.zoneName=e}get type(){return"invalid"}get name(){return this.zoneName}get isUniversal(){return!1}offsetName(){return null}formatOffset(){return""}offset(){return NaN}equals(){return!1}get isValid(){return!1}};function pd(r,e){if(Mt(r)||r===null)return e;if(r instanceof sf)return r;if(ghe(r)){let t=r.toLowerCase();return t==="default"?e:t==="local"||t==="system"?KS.instance:t==="utc"||t==="gmt"?ia.utcInstance:ia.parseSpecifier(t)||fd.create(r)}else return of(r)?ia.instance(r):typeof r=="object"&&"offset"in r&&typeof r.offset=="function"?r:new g1(r)}var C5=()=>Date.now(),x5="system",E5=null,T5=null,_5=null,A5=60,k5,Xr=class{static get now(){return C5}static set now(e){C5=e}static set defaultZone(e){x5=e}static get defaultZone(){return pd(x5,KS.instance)}static get defaultLocale(){return E5}static set defaultLocale(e){E5=e}static get defaultNumberingSystem(){return T5}static set defaultNumberingSystem(e){T5=e}static get defaultOutputCalendar(){return _5}static set defaultOutputCalendar(e){_5=e}static get twoDigitCutoffYear(){return A5}static set twoDigitCutoffYear(e){A5=e%100}static get throwOnInvalid(){return k5}static set throwOnInvalid(e){k5=e}static resetCaches(){Zr.resetCache(),fd.resetCache()}};function Mt(r){return typeof r>"u"}function of(r){return typeof r=="number"}function nD(r){return typeof r=="number"&&r%1===0}function ghe(r){return typeof r=="string"}function vhe(r){return Object.prototype.toString.call(r)==="[object Date]"}function g8(){try{return typeof Intl<"u"&&!!Intl.RelativeTimeFormat}catch{return!1}}function yhe(r){return Array.isArray(r)?r:[r]}function S5(r,e,t){if(r.length!==0)return r.reduce((n,i)=>{let o=[e(i),i];return n&&t(n[0],o[0])===n[0]?n:o},null)[1]}function bhe(r,e){return e.reduce((t,n)=>(t[n]=r[n],t),{})}function Ag(r,e){return Object.prototype.hasOwnProperty.call(r,e)}function Wc(r,e,t){return nD(r)&&r>=e&&r<=t}function whe(r,e){return r-e*Math.floor(r/e)}function En(r,e=2){let t=r<0,n;return t?n="-"+(""+-r).padStart(e,"0"):n=(""+r).padStart(e,"0"),n}function dd(r){if(!(Mt(r)||r===null||r===""))return parseInt(r,10)}function ef(r){if(!(Mt(r)||r===null||r===""))return parseFloat(r)}function A1(r){if(!(Mt(r)||r===null||r==="")){let e=parseFloat("0."+r)*1e3;return Math.floor(e)}}function k1(r,e,t=!1){let n=10**e;return(t?Math.trunc:Math.round)(r*n)/n}function Xx(r){return r%4===0&&(r%100!==0||r%400===0)}function Gx(r){return Xx(r)?366:365}function QS(r,e){let t=whe(e-1,12)+1,n=r+(e-t)/12;return t===2?Xx(n)?29:28:[31,null,31,30,31,30,31,31,30,31,30,31][t-1]}function iD(r){let e=Date.UTC(r.year,r.month-1,r.day,r.hour,r.minute,r.second,r.millisecond);return r.year<100&&r.year>=0&&(e=new Date(e),e.setUTCFullYear(r.year,r.month-1,r.day)),+e}function XS(r){let e=(r+Math.floor(r/4)-Math.floor(r/100)+Math.floor(r/400))%7,t=r-1,n=(t+Math.floor(t/4)-Math.floor(t/100)+Math.floor(t/400))%7;return e===4||n===3?53:52}function v1(r){return r>99?r:r>Xr.twoDigitCutoffYear?1900+r:2e3+r}function v8(r,e,t,n=null){let i=new Date(r),o={hourCycle:"h23",year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit"};n&&(o.timeZone=n);let s={timeZoneName:e,...o},a=new Intl.DateTimeFormat(t,s).formatToParts(i).find(l=>l.type.toLowerCase()==="timezonename");return a?a.value:null}function oD(r,e){let t=parseInt(r,10);Number.isNaN(t)&&(t=0);let n=parseInt(e,10)||0,i=t<0||Object.is(t,-0)?-n:n;return t*60+i}function y8(r){let e=Number(r);if(typeof r=="boolean"||r===""||Number.isNaN(e))throw new qo(`Invalid unit value ${r}`);return e}function ZS(r,e){let t={};for(let n in r)if(Ag(r,n)){let i=r[n];if(i==null)continue;t[e(n)]=y8(i)}return t}function Yx(r,e){let t=Math.trunc(Math.abs(r/60)),n=Math.trunc(Math.abs(r%60)),i=r>=0?"+":"-";switch(e){case"short":return`${i}${En(t,2)}:${En(n,2)}`;case"narrow":return`${i}${t}${n>0?`:${n}`:""}`;case"techie":return`${i}${En(t,2)}${En(n,2)}`;default:throw new RangeError(`Value format ${e} is out of range for property format`)}}function sD(r){return bhe(r,["hour","minute","second","millisecond"])}var Che=["January","February","March","April","May","June","July","August","September","October","November","December"],b8=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],xhe=["J","F","M","A","M","J","J","A","S","O","N","D"];function w8(r){switch(r){case"narrow":return[...xhe];case"short":return[...b8];case"long":return[...Che];case"numeric":return["1","2","3","4","5","6","7","8","9","10","11","12"];case"2-digit":return["01","02","03","04","05","06","07","08","09","10","11","12"];default:return null}}var C8=["Monday","Tuesday","Wednesday","Thursday","Friday","Saturday","Sunday"],x8=["Mon","Tue","Wed","Thu","Fri","Sat","Sun"],Ehe=["M","T","W","T","F","S","S"];function E8(r){switch(r){case"narrow":return[...Ehe];case"short":return[...x8];case"long":return[...C8];case"numeric":return["1","2","3","4","5","6","7"];default:return null}}var T8=["AM","PM"],The=["Before Christ","Anno Domini"],_he=["BC","AD"],Ahe=["B","A"];function _8(r){switch(r){case"narrow":return[...Ahe];case"short":return[..._he];case"long":return[...The];default:return null}}function khe(r){return T8[r.hour<12?0:1]}function She(r,e){return E8(e)[r.weekday-1]}function Dhe(r,e){return w8(e)[r.month-1]}function Ihe(r,e){return _8(e)[r.year<0?0:1]}function Phe(r,e,t="always",n=!1){let i={years:["year","yr."],quarters:["quarter","qtr."],months:["month","mo."],weeks:["week","wk."],days:["day","day","days"],hours:["hour","hr."],minutes:["minute","min."],seconds:["second","sec."]},o=["hours","minutes","seconds"].indexOf(r)===-1;if(t==="auto"&&o){let d=r==="days";switch(e){case 1:return d?"tomorrow":`next ${i[r][0]}`;case-1:return d?"yesterday":`last ${i[r][0]}`;case 0:return d?"today":`this ${i[r][0]}`}}let s=Object.is(e,-0)||e<0,a=Math.abs(e),l=a===1,c=i[r],u=n?l?c[1]:c[2]||c[1]:l?i[r][0]:r;return s?`${a} ${u} ago`:`in ${a} ${u}`}function D5(r,e){let t="";for(let n of r)n.literal?t+=n.val:t+=e(n.val);return t}var Fhe={D:YS,DD:X5,DDD:Z5,DDDD:J5,t:e8,tt:t8,ttt:r8,tttt:n8,T:i8,TT:o8,TTT:s8,TTTT:a8,f:l8,ff:u8,fff:p8,ffff:m8,F:c8,FF:d8,FFF:f8,FFFF:h8},ys=class r{static create(e,t={}){return new r(e,t)}static parseFormat(e){let t=null,n="",i=!1,o=[];for(let s=0;s<e.length;s++){let a=e.charAt(s);a==="'"?(n.length>0&&o.push({literal:i||/^\s+$/.test(n),val:n}),t=null,n="",i=!i):i||a===t?n+=a:(n.length>0&&o.push({literal:/^\s+$/.test(n),val:n}),n=a,t=a)}return n.length>0&&o.push({literal:i||/^\s+$/.test(n),val:n}),o}static macroTokenToFormatOpts(e){return Fhe[e]}constructor(e,t){this.opts=t,this.loc=e,this.systemLoc=null}formatWithSystemDefault(e,t){return this.systemLoc===null&&(this.systemLoc=this.loc.redefaultToSystem()),this.systemLoc.dtFormatter(e,{...this.opts,...t}).format()}dtFormatter(e,t={}){return this.loc.dtFormatter(e,{...this.opts,...t})}formatDateTime(e,t){return this.dtFormatter(e,t).format()}formatDateTimeParts(e,t){return this.dtFormatter(e,t).formatToParts()}formatInterval(e,t){return this.dtFormatter(e.start,t).dtf.formatRange(e.start.toJSDate(),e.end.toJSDate())}resolvedOptions(e,t){return this.dtFormatter(e,t).resolvedOptions()}num(e,t=0){if(this.opts.forceSimple)return En(e,t);let n={...this.opts};return t>0&&(n.padTo=t),this.loc.numberFormatter(n).format(e)}formatDateTimeFromString(e,t){let n=this.loc.listingMode()==="en",i=this.loc.outputCalendar&&this.loc.outputCalendar!=="gregory",o=(p,m)=>this.loc.extract(e,p,m),s=p=>e.isOffsetFixed&&e.offset===0&&p.allowZ?"Z":e.isValid?e.zone.formatOffset(e.ts,p.format):"",a=()=>n?khe(e):o({hour:"numeric",hourCycle:"h12"},"dayperiod"),l=(p,m)=>n?Dhe(e,p):o(m?{month:p}:{month:p,day:"numeric"},"month"),c=(p,m)=>n?She(e,p):o(m?{weekday:p}:{weekday:p,month:"long",day:"numeric"},"weekday"),u=p=>{let m=r.macroTokenToFormatOpts(p);return m?this.formatWithSystemDefault(e,m):p},d=p=>n?Ihe(e,p):o({era:p},"era"),f=p=>{switch(p){case"S":return this.num(e.millisecond);case"u":case"SSS":return this.num(e.millisecond,3);case"s":return this.num(e.second);case"ss":return this.num(e.second,2);case"uu":return this.num(Math.floor(e.millisecond/10),2);case"uuu":return this.num(Math.floor(e.millisecond/100));case"m":return this.num(e.minute);case"mm":return this.num(e.minute,2);case"h":return this.num(e.hour%12===0?12:e.hour%12);case"hh":return this.num(e.hour%12===0?12:e.hour%12,2);case"H":return this.num(e.hour);case"HH":return this.num(e.hour,2);case"Z":return s({format:"narrow",allowZ:this.opts.allowZ});case"ZZ":return s({format:"short",allowZ:this.opts.allowZ});case"ZZZ":return s({format:"techie",allowZ:this.opts.allowZ});case"ZZZZ":return e.zone.offsetName(e.ts,{format:"short",locale:this.loc.locale});case"ZZZZZ":return e.zone.offsetName(e.ts,{format:"long",locale:this.loc.locale});case"z":return e.zoneName;case"a":return a();case"d":return i?o({day:"numeric"},"day"):this.num(e.day);case"dd":return i?o({day:"2-digit"},"day"):this.num(e.day,2);case"c":return this.num(e.weekday);case"ccc":return c("short",!0);case"cccc":return c("long",!0);case"ccccc":return c("narrow",!0);case"E":return this.num(e.weekday);case"EEE":return c("short",!1);case"EEEE":return c("long",!1);case"EEEEE":return c("narrow",!1);case"L":return i?o({month:"numeric",day:"numeric"},"month"):this.num(e.month);case"LL":return i?o({month:"2-digit",day:"numeric"},"month"):this.num(e.month,2);case"LLL":return l("short",!0);case"LLLL":return l("long",!0);case"LLLLL":return l("narrow",!0);case"M":return i?o({month:"numeric"},"month"):this.num(e.month);case"MM":return i?o({month:"2-digit"},"month"):this.num(e.month,2);case"MMM":return l("short",!1);case"MMMM":return l("long",!1);case"MMMMM":return l("narrow",!1);case"y":return i?o({year:"numeric"},"year"):this.num(e.year);case"yy":return i?o({year:"2-digit"},"year"):this.num(e.year.toString().slice(-2),2);case"yyyy":return i?o({year:"numeric"},"year"):this.num(e.year,4);case"yyyyyy":return i?o({year:"numeric"},"year"):this.num(e.year,6);case"G":return d("short");case"GG":return d("long");case"GGGGG":return d("narrow");case"kk":return this.num(e.weekYear.toString().slice(-2),2);case"kkkk":return this.num(e.weekYear,4);case"W":return this.num(e.weekNumber);case"WW":return this.num(e.weekNumber,2);case"o":return this.num(e.ordinal);case"ooo":return this.num(e.ordinal,3);case"q":return this.num(e.quarter);case"qq":return this.num(e.quarter,2);case"X":return this.num(Math.floor(e.ts/1e3));case"x":return this.num(e.ts);default:return u(p)}};return D5(r.parseFormat(t),f)}formatDurationFromString(e,t){let n=l=>{switch(l[0]){case"S":return"millisecond";case"s":return"second";case"m":return"minute";case"h":return"hour";case"d":return"day";case"w":return"week";case"M":return"month";case"y":return"year";default:return null}},i=l=>c=>{let u=n(c);return u?this.num(l.get(u),c.length):c},o=r.parseFormat(t),s=o.reduce((l,{literal:c,val:u})=>c?l:l.concat(u),[]),a=e.shiftTo(...s.map(n).filter(l=>l));return D5(o,i(a))}},bs=class{constructor(e,t){this.reason=e,this.explanation=t}toMessage(){return this.explanation?`${this.reason}: ${this.explanation}`:this.reason}},A8=/[A-Za-z_+-]{1,256}(?::?\/[A-Za-z0-9_+-]{1,256}(?:\/[A-Za-z0-9_+-]{1,256})?)?/;function kg(...r){let e=r.reduce((t,n)=>t+n.source,"");return RegExp(`^${e}$`)}function Sg(...r){return e=>r.reduce(([t,n,i],o)=>{let[s,a,l]=o(e,i);return[{...t,...s},a||n,l]},[{},null,1]).slice(0,2)}function Dg(r,...e){if(r==null)return[null,null];for(let[t,n]of e){let i=t.exec(r);if(i)return n(i)}return[null,null]}function k8(...r){return(e,t)=>{let n={},i;for(i=0;i<r.length;i++)n[r[i]]=dd(e[t+i]);return[n,null,t+i]}}var S8=/(?:(Z)|([+-]\d\d)(?::?(\d\d))?)/,Mhe=`(?:${S8.source}?(?:\\[(${A8.source})\\])?)?`,S1=/(\d\d)(?::?(\d\d)(?::?(\d\d)(?:[.,](\d{1,30}))?)?)?/,D8=RegExp(`${S1.source}${Mhe}`),D1=RegExp(`(?:T${D8.source})?`),Rhe=/([+-]\d{6}|\d{4})(?:-?(\d\d)(?:-?(\d\d))?)?/,$he=/(\d{4})-?W(\d\d)(?:-?(\d))?/,Ohe=/(\d{4})-?(\d{3})/,Nhe=k8("weekYear","weekNumber","weekDay"),Lhe=k8("year","ordinal"),Bhe=/(\d{4})-(\d\d)-(\d\d)/,I8=RegExp(`${S1.source} ?(?:${S8.source}|(${A8.source}))?`),Uhe=RegExp(`(?: ${I8.source})?`);function Tg(r,e,t){let n=r[e];return Mt(n)?t:dd(n)}function Vhe(r,e){return[{year:Tg(r,e),month:Tg(r,e+1,1),day:Tg(r,e+2,1)},null,e+3]}function Ig(r,e){return[{hours:Tg(r,e,0),minutes:Tg(r,e+1,0),seconds:Tg(r,e+2,0),milliseconds:A1(r[e+3])},null,e+4]}function Zx(r,e){let t=!r[e]&&!r[e+1],n=oD(r[e+1],r[e+2]),i=t?null:ia.instance(n);return[{},i,e+3]}function Jx(r,e){let t=r[e]?fd.create(r[e]):null;return[{},t,e+1]}var qhe=RegExp(`^T?${S1.source}$`),Whe=/^-?P(?:(?:(-?\d{1,20}(?:\.\d{1,20})?)Y)?(?:(-?\d{1,20}(?:\.\d{1,20})?)M)?(?:(-?\d{1,20}(?:\.\d{1,20})?)W)?(?:(-?\d{1,20}(?:\.\d{1,20})?)D)?(?:T(?:(-?\d{1,20}(?:\.\d{1,20})?)H)?(?:(-?\d{1,20}(?:\.\d{1,20})?)M)?(?:(-?\d{1,20})(?:[.,](-?\d{1,20}))?S)?)?)$/;function zhe(r){let[e,t,n,i,o,s,a,l,c]=r,u=e[0]==="-",d=l&&l[0]==="-",f=(p,m=!1)=>p!==void 0&&(m||p&&u)?-p:p;return[{years:f(ef(t)),months:f(ef(n)),weeks:f(ef(i)),days:f(ef(o)),hours:f(ef(s)),minutes:f(ef(a)),seconds:f(ef(l),l==="-0"),milliseconds:f(A1(c),d)}]}var Hhe={GMT:0,EDT:-240,EST:-300,CDT:-300,CST:-360,MDT:-360,MST:-420,PDT:-420,PST:-480};function I1(r,e,t,n,i,o,s){let a={year:e.length===2?v1(dd(e)):dd(e),month:b8.indexOf(t)+1,day:dd(n),hour:dd(i),minute:dd(o)};return s&&(a.second=dd(s)),r&&(a.weekday=r.length>3?C8.indexOf(r)+1:x8.indexOf(r)+1),a}var jhe=/^(?:(Mon|Tue|Wed|Thu|Fri|Sat|Sun),\s)?(\d{1,2})\s(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)\s(\d{2,4})\s(\d\d):(\d\d)(?::(\d\d))?\s(?:(UT|GMT|[ECMP][SD]T)|([Zz])|(?:([+-]\d\d)(\d\d)))$/;function Ghe(r){let[,e,t,n,i,o,s,a,l,c,u,d]=r,f=I1(e,i,n,t,o,s,a),p;return l?p=Hhe[l]:c?p=0:p=oD(u,d),[f,new ia(p)]}function Yhe(r){return r.replace(/\([^()]*\)|[\n\t]/g," ").replace(/(\s\s+)/g," ").trim()}var Khe=/^(Mon|Tue|Wed|Thu|Fri|Sat|Sun), (\d\d) (Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec) (\d{4}) (\d\d):(\d\d):(\d\d) GMT$/,Qhe=/^(Monday|Tuesday|Wednesday|Thursday|Friday|Saturday|Sunday), (\d\d)-(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)-(\d\d) (\d\d):(\d\d):(\d\d) GMT$/,Xhe=/^(Mon|Tue|Wed|Thu|Fri|Sat|Sun) (Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec) ( \d|\d\d) (\d\d):(\d\d):(\d\d) (\d{4})$/;function I5(r){let[,e,t,n,i,o,s,a]=r;return[I1(e,i,n,t,o,s,a),ia.utcInstance]}function Zhe(r){let[,e,t,n,i,o,s,a]=r;return[I1(e,a,t,n,i,o,s),ia.utcInstance]}var Jhe=kg(Rhe,D1),ege=kg($he,D1),tge=kg(Ohe,D1),rge=kg(D8),P8=Sg(Vhe,Ig,Zx,Jx),nge=Sg(Nhe,Ig,Zx,Jx),ige=Sg(Lhe,Ig,Zx,Jx),oge=Sg(Ig,Zx,Jx);function sge(r){return Dg(r,[Jhe,P8],[ege,nge],[tge,ige],[rge,oge])}function age(r){return Dg(Yhe(r),[jhe,Ghe])}function lge(r){return Dg(r,[Khe,I5],[Qhe,I5],[Xhe,Zhe])}function cge(r){return Dg(r,[Whe,zhe])}var uge=Sg(Ig);function dge(r){return Dg(r,[qhe,uge])}var pge=kg(Bhe,Uhe),fge=kg(I8),mge=Sg(Ig,Zx,Jx);function hge(r){return Dg(r,[pge,P8],[fge,mge])}var P5="Invalid Duration",F8={weeks:{days:7,hours:168,minutes:10080,seconds:10080*60,milliseconds:10080*60*1e3},days:{hours:24,minutes:1440,seconds:1440*60,milliseconds:1440*60*1e3},hours:{minutes:60,seconds:3600,milliseconds:3600*1e3},minutes:{seconds:60,milliseconds:60*1e3},seconds:{milliseconds:1e3}},gge={years:{quarters:4,months:12,weeks:52,days:365,hours:365*24,minutes:365*24*60,seconds:365*24*60*60,milliseconds:365*24*60*60*1e3},quarters:{months:3,weeks:13,days:91,hours:2184,minutes:2184*60,seconds:2184*60*60,milliseconds:2184*60*60*1e3},months:{weeks:4,days:30,hours:720,minutes:720*60,seconds:720*60*60,milliseconds:720*60*60*1e3},...F8},ra=146097/400,Cg=146097/4800,vge={years:{quarters:4,months:12,weeks:ra/7,days:ra,hours:ra*24,minutes:ra*24*60,seconds:ra*24*60*60,milliseconds:ra*24*60*60*1e3},quarters:{months:3,weeks:ra/28,days:ra/4,hours:ra*24/4,minutes:ra*24*60/4,seconds:ra*24*60*60/4,milliseconds:ra*24*60*60*1e3/4},months:{weeks:Cg/7,days:Cg,hours:Cg*24,minutes:Cg*24*60,seconds:Cg*24*60*60,milliseconds:Cg*24*60*60*1e3},...F8},nf=["years","quarters","months","weeks","days","hours","minutes","seconds","milliseconds"],yge=nf.slice(0).reverse();function ud(r,e,t=!1){let n={values:t?e.values:{...r.values,...e.values||{}},loc:r.loc.clone(e.loc),conversionAccuracy:e.conversionAccuracy||r.conversionAccuracy,matrix:e.matrix||r.matrix};return new Qe(n)}function M8(r,e){let t=e.milliseconds??0;for(let n of yge.slice(1))e[n]&&(t+=e[n]*r[n].milliseconds);return t}function F5(r,e){let t=M8(r,e)<0?-1:1;nf.reduceRight((n,i)=>{if(Mt(e[i]))return n;if(n){let o=e[n]*t,s=r[i][n],a=Math.floor(o/s);e[i]+=a*t,e[n]-=a*s*t}return i},null),nf.reduce((n,i)=>{if(Mt(e[i]))return n;if(n){let o=e[n]%1;e[n]-=o,e[i]+=o*r[n][i]}return i},null)}function bge(r){let e={};for(let[t,n]of Object.entries(r))n!==0&&(e[t]=n);return e}var Qe=class r{constructor(e){let t=e.conversionAccuracy==="longterm"||!1,n=t?vge:gge;e.matrix&&(n=e.matrix),this.values=e.values,this.loc=e.loc||Zr.create(),this.conversionAccuracy=t?"longterm":"casual",this.invalid=e.invalid||null,this.matrix=n,this.isLuxonDuration=!0}static fromMillis(e,t){return r.fromObject({milliseconds:e},t)}static fromObject(e,t={}){if(e==null||typeof e!="object")throw new qo(`Duration.fromObject: argument expected to be an object, got ${e===null?"null":typeof e}`);return new r({values:ZS(e,r.normalizeUnit),loc:Zr.fromObject(t),conversionAccuracy:t.conversionAccuracy,matrix:t.matrix})}static fromDurationLike(e){if(of(e))return r.fromMillis(e);if(r.isDuration(e))return e;if(typeof e=="object")return r.fromObject(e);throw new qo(`Unknown duration argument ${e} of type ${typeof e}`)}static fromISO(e,t){let[n]=cge(e);return n?r.fromObject(n,t):r.invalid("unparsable",`the input "${e}" can't be parsed as ISO 8601`)}static fromISOTime(e,t){let[n]=dge(e);return n?r.fromObject(n,t):r.invalid("unparsable",`the input "${e}" can't be parsed as ISO 8601`)}static invalid(e,t=null){if(!e)throw new qo("need to specify a reason the Duration is invalid");let n=e instanceof bs?e:new bs(e,t);if(Xr.throwOnInvalid)throw new l1(n);return new r({invalid:n})}static normalizeUnit(e){let t={year:"years",years:"years",quarter:"quarters",quarters:"quarters",month:"months",months:"months",week:"weeks",weeks:"weeks",day:"days",days:"days",hour:"hours",hours:"hours",minute:"minutes",minutes:"minutes",second:"seconds",seconds:"seconds",millisecond:"milliseconds",milliseconds:"milliseconds"}[e&&e.toLowerCase()];if(!t)throw new GS(e);return t}static isDuration(e){return e&&e.isLuxonDuration||!1}get locale(){return this.isValid?this.loc.locale:null}get numberingSystem(){return this.isValid?this.loc.numberingSystem:null}toFormat(e,t={}){let n={...t,floor:t.round!==!1&&t.floor!==!1};return this.isValid?ys.create(this.loc,n).formatDurationFromString(this,e):P5}toHuman(e={}){if(!this.isValid)return P5;let t=nf.map(n=>{let i=this.values[n];return Mt(i)?null:this.loc.numberFormatter({style:"unit",unitDisplay:"long",...e,unit:n.slice(0,-1)}).format(i)}).filter(n=>n);return this.loc.listFormatter({type:"conjunction",style:e.listStyle||"narrow",...e}).format(t)}toObject(){return this.isValid?{...this.values}:{}}toISO(){if(!this.isValid)return null;let e="P";return this.years!==0&&(e+=this.years+"Y"),(this.months!==0||this.quarters!==0)&&(e+=this.months+this.quarters*3+"M"),this.weeks!==0&&(e+=this.weeks+"W"),this.days!==0&&(e+=this.days+"D"),(this.hours!==0||this.minutes!==0||this.seconds!==0||this.milliseconds!==0)&&(e+="T"),this.hours!==0&&(e+=this.hours+"H"),this.minutes!==0&&(e+=this.minutes+"M"),(this.seconds!==0||this.milliseconds!==0)&&(e+=k1(this.seconds+this.milliseconds/1e3,3)+"S"),e==="P"&&(e+="T0S"),e}toISOTime(e={}){if(!this.isValid)return null;let t=this.toMillis();return t<0||t>=864e5?null:(e={suppressMilliseconds:!1,suppressSeconds:!1,includePrefix:!1,format:"extended",...e,includeOffset:!1},At.fromMillis(t,{zone:"UTC"}).toISOTime(e))}toJSON(){return this.toISO()}toString(){return this.toISO()}toMillis(){return this.isValid?M8(this.matrix,this.values):NaN}valueOf(){return this.toMillis()}plus(e){if(!this.isValid)return this;let t=r.fromDurationLike(e),n={};for(let i of nf)(Ag(t.values,i)||Ag(this.values,i))&&(n[i]=t.get(i)+this.get(i));return ud(this,{values:n},!0)}minus(e){if(!this.isValid)return this;let t=r.fromDurationLike(e);return this.plus(t.negate())}mapUnits(e){if(!this.isValid)return this;let t={};for(let n of Object.keys(this.values))t[n]=y8(e(this.values[n],n));return ud(this,{values:t},!0)}get(e){return this[r.normalizeUnit(e)]}set(e){if(!this.isValid)return this;let t={...this.values,...ZS(e,r.normalizeUnit)};return ud(this,{values:t})}reconfigure({locale:e,numberingSystem:t,conversionAccuracy:n,matrix:i}={}){let s={loc:this.loc.clone({locale:e,numberingSystem:t}),matrix:i,conversionAccuracy:n};return ud(this,s)}as(e){return this.isValid?this.shiftTo(e).get(e):NaN}normalize(){if(!this.isValid)return this;let e=this.toObject();return F5(this.matrix,e),ud(this,{values:e},!0)}rescale(){if(!this.isValid)return this;let e=bge(this.normalize().shiftToAll().toObject());return ud(this,{values:e},!0)}shiftTo(...e){if(!this.isValid)return this;if(e.length===0)return this;e=e.map(s=>r.normalizeUnit(s));let t={},n={},i=this.toObject(),o;for(let s of nf)if(e.indexOf(s)>=0){o=s;let a=0;for(let c in n)a+=this.matrix[c][s]*n[c],n[c]=0;of(i[s])&&(a+=i[s]);let l=Math.trunc(a);t[s]=l,n[s]=(a*1e3-l*1e3)/1e3}else of(i[s])&&(n[s]=i[s]);for(let s in n)n[s]!==0&&(t[o]+=s===o?n[s]:n[s]/this.matrix[o][s]);return F5(this.matrix,t),ud(this,{values:t},!0)}shiftToAll(){return this.isValid?this.shiftTo("years","months","weeks","days","hours","minutes","seconds","milliseconds"):this}negate(){if(!this.isValid)return this;let e={};for(let t of Object.keys(this.values))e[t]=this.values[t]===0?0:-this.values[t];return ud(this,{values:e},!0)}get years(){return this.isValid?this.values.years||0:NaN}get quarters(){return this.isValid?this.values.quarters||0:NaN}get months(){return this.isValid?this.values.months||0:NaN}get weeks(){return this.isValid?this.values.weeks||0:NaN}get days(){return this.isValid?this.values.days||0:NaN}get hours(){return this.isValid?this.values.hours||0:NaN}get minutes(){return this.isValid?this.values.minutes||0:NaN}get seconds(){return this.isValid?this.values.seconds||0:NaN}get milliseconds(){return this.isValid?this.values.milliseconds||0:NaN}get isValid(){return this.invalid===null}get invalidReason(){return this.invalid?this.invalid.reason:null}get invalidExplanation(){return this.invalid?this.invalid.explanation:null}equals(e){if(!this.isValid||!e.isValid||!this.loc.equals(e.loc))return!1;function t(n,i){return n===void 0||n===0?i===void 0||i===0:n===i}for(let n of nf)if(!t(this.values[n],e.values[n]))return!1;return!0}},xg="Invalid Interval";function wge(r,e){return!r||!r.isValid?_g.invalid("missing or invalid start"):!e||!e.isValid?_g.invalid("missing or invalid end"):e<r?_g.invalid("end before start",`The end of an interval must be after its start, but you had start=${r.toISO()} and end=${e.toISO()}`):null}var _g=class r{constructor(e){this.s=e.start,this.e=e.end,this.invalid=e.invalid||null,this.isLuxonInterval=!0}static invalid(e,t=null){if(!e)throw new qo("need to specify a reason the Interval is invalid");let n=e instanceof bs?e:new bs(e,t);if(Xr.throwOnInvalid)throw new a1(n);return new r({invalid:n})}static fromDateTimes(e,t){let n=zx(e),i=zx(t),o=wge(n,i);return o??new r({start:n,end:i})}static after(e,t){let n=Qe.fromDurationLike(t),i=zx(e);return r.fromDateTimes(i,i.plus(n))}static before(e,t){let n=Qe.fromDurationLike(t),i=zx(e);return r.fromDateTimes(i.minus(n),i)}static fromISO(e,t){let[n,i]=(e||"").split("/",2);if(n&&i){let o,s;try{o=At.fromISO(n,t),s=o.isValid}catch{s=!1}let a,l;try{a=At.fromISO(i,t),l=a.isValid}catch{l=!1}if(s&&l)return r.fromDateTimes(o,a);if(s){let c=Qe.fromISO(i,t);if(c.isValid)return r.after(o,c)}else if(l){let c=Qe.fromISO(n,t);if(c.isValid)return r.before(a,c)}}return r.invalid("unparsable",`the input "${e}" can't be parsed as ISO 8601`)}static isInterval(e){return e&&e.isLuxonInterval||!1}get start(){return this.isValid?this.s:null}get end(){return this.isValid?this.e:null}get isValid(){return this.invalidReason===null}get invalidReason(){return this.invalid?this.invalid.reason:null}get invalidExplanation(){return this.invalid?this.invalid.explanation:null}length(e="milliseconds"){return this.isValid?this.toDuration(e).get(e):NaN}count(e="milliseconds"){if(!this.isValid)return NaN;let t=this.start.startOf(e),n=this.end.startOf(e);return Math.floor(n.diff(t,e).get(e))+(n.valueOf()!==this.end.valueOf())}hasSame(e){return this.isValid?this.isEmpty()||this.e.minus(1).hasSame(this.s,e):!1}isEmpty(){return this.s.valueOf()===this.e.valueOf()}isAfter(e){return this.isValid?this.s>e:!1}isBefore(e){return this.isValid?this.e<=e:!1}contains(e){return this.isValid?this.s<=e&&this.e>e:!1}set({start:e,end:t}={}){return this.isValid?r.fromDateTimes(e||this.s,t||this.e):this}splitAt(...e){if(!this.isValid)return[];let t=e.map(zx).filter(s=>this.contains(s)).sort(),n=[],{s:i}=this,o=0;for(;i<this.e;){let s=t[o]||this.e,a=+s>+this.e?this.e:s;n.push(r.fromDateTimes(i,a)),i=a,o+=1}return n}splitBy(e){let t=Qe.fromDurationLike(e);if(!this.isValid||!t.isValid||t.as("milliseconds")===0)return[];let{s:n}=this,i=1,o,s=[];for(;n<this.e;){let a=this.start.plus(t.mapUnits(l=>l*i));o=+a>+this.e?this.e:a,s.push(r.fromDateTimes(n,o)),n=o,i+=1}return s}divideEqually(e){return this.isValid?this.splitBy(this.length()/e).slice(0,e):[]}overlaps(e){return this.e>e.s&&this.s<e.e}abutsStart(e){return this.isValid?+this.e==+e.s:!1}abutsEnd(e){return this.isValid?+e.e==+this.s:!1}engulfs(e){return this.isValid?this.s<=e.s&&this.e>=e.e:!1}equals(e){return!this.isValid||!e.isValid?!1:this.s.equals(e.s)&&this.e.equals(e.e)}intersection(e){if(!this.isValid)return this;let t=this.s>e.s?this.s:e.s,n=this.e<e.e?this.e:e.e;return t>=n?null:r.fromDateTimes(t,n)}union(e){if(!this.isValid)return this;let t=this.s<e.s?this.s:e.s,n=this.e>e.e?this.e:e.e;return r.fromDateTimes(t,n)}static merge(e){let[t,n]=e.sort((i,o)=>i.s-o.s).reduce(([i,o],s)=>o?o.overlaps(s)||o.abutsStart(s)?[i,o.union(s)]:[i.concat([o]),s]:[i,s],[[],null]);return n&&t.push(n),t}static xor(e){let t=null,n=0,i=[],o=e.map(l=>[{time:l.s,type:"s"},{time:l.e,type:"e"}]),s=Array.prototype.concat(...o),a=s.sort((l,c)=>l.time-c.time);for(let l of a)n+=l.type==="s"?1:-1,n===1?t=l.time:(t&&+t!=+l.time&&i.push(r.fromDateTimes(t,l.time)),t=null);return r.merge(i)}difference(...e){return r.xor([this].concat(e)).map(t=>this.intersection(t)).filter(t=>t&&!t.isEmpty())}toString(){return this.isValid?`[${this.s.toISO()} \u2013 ${this.e.toISO()})`:xg}toLocaleString(e=YS,t={}){return this.isValid?ys.create(this.s.loc.clone(t),e).formatInterval(this):xg}toISO(e){return this.isValid?`${this.s.toISO(e)}/${this.e.toISO(e)}`:xg}toISODate(){return this.isValid?`${this.s.toISODate()}/${this.e.toISODate()}`:xg}toISOTime(e){return this.isValid?`${this.s.toISOTime(e)}/${this.e.toISOTime(e)}`:xg}toFormat(e,{separator:t=" \u2013 "}={}){return this.isValid?`${this.s.toFormat(e)}${t}${this.e.toFormat(e)}`:xg}toDuration(e,t){return this.isValid?this.e.diff(this.s,e,t):Qe.invalid(this.invalidReason)}mapEndpoints(e){return r.fromDateTimes(e(this.s),e(this.e))}},Eg=class{static hasDST(e=Xr.defaultZone){let t=At.now().setZone(e).set({month:12});return!e.isUniversal&&t.offset!==t.set({month:6}).offset}static isValidIANAZone(e){return fd.isValidZone(e)}static normalizeZone(e){return pd(e,Xr.defaultZone)}static months(e="long",{locale:t=null,numberingSystem:n=null,locObj:i=null,outputCalendar:o="gregory"}={}){return(i||Zr.create(t,n,o)).months(e)}static monthsFormat(e="long",{locale:t=null,numberingSystem:n=null,locObj:i=null,outputCalendar:o="gregory"}={}){return(i||Zr.create(t,n,o)).months(e,!0)}static weekdays(e="long",{locale:t=null,numberingSystem:n=null,locObj:i=null}={}){return(i||Zr.create(t,n,null)).weekdays(e)}static weekdaysFormat(e="long",{locale:t=null,numberingSystem:n=null,locObj:i=null}={}){return(i||Zr.create(t,n,null)).weekdays(e,!0)}static meridiems({locale:e=null}={}){return Zr.create(e).meridiems()}static eras(e="short",{locale:t=null}={}){return Zr.create(t,null,"gregory").eras(e)}static features(){return{relative:g8()}}};function M5(r,e){let t=i=>i.toUTC(0,{keepLocalTime:!0}).startOf("day").valueOf(),n=t(e)-t(r);return Math.floor(Qe.fromMillis(n).as("days"))}function Cge(r,e,t){let n=[["years",(l,c)=>c.year-l.year],["quarters",(l,c)=>c.quarter-l.quarter+(c.year-l.year)*4],["months",(l,c)=>c.month-l.month+(c.year-l.year)*12],["weeks",(l,c)=>{let u=M5(l,c);return(u-u%7)/7}],["days",M5]],i={},o=r,s,a;for(let[l,c]of n)t.indexOf(l)>=0&&(s=l,i[l]=c(r,e),a=o.plus(i),a>e?(i[l]--,r=o.plus(i),r>e&&(a=r,i[l]--,r=o.plus(i))):r=a);return[r,i,a,s]}function xge(r,e,t,n){let[i,o,s,a]=Cge(r,e,t),l=e-i,c=t.filter(d=>["hours","minutes","seconds","milliseconds"].indexOf(d)>=0);c.length===0&&(s<e&&(s=i.plus({[a]:1})),s!==i&&(o[a]=(o[a]||0)+l/(s-i)));let u=Qe.fromObject(o,n);return c.length>0?Qe.fromMillis(l,n).shiftTo(...c).plus(u):u}var P1={arab:"[\u0660-\u0669]",arabext:"[\u06F0-\u06F9]",bali:"[\u1B50-\u1B59]",beng:"[\u09E6-\u09EF]",deva:"[\u0966-\u096F]",fullwide:"[\uFF10-\uFF19]",gujr:"[\u0AE6-\u0AEF]",hanidec:"[\u3007|\u4E00|\u4E8C|\u4E09|\u56DB|\u4E94|\u516D|\u4E03|\u516B|\u4E5D]",khmr:"[\u17E0-\u17E9]",knda:"[\u0CE6-\u0CEF]",laoo:"[\u0ED0-\u0ED9]",limb:"[\u1946-\u194F]",mlym:"[\u0D66-\u0D6F]",mong:"[\u1810-\u1819]",mymr:"[\u1040-\u1049]",orya:"[\u0B66-\u0B6F]",tamldec:"[\u0BE6-\u0BEF]",telu:"[\u0C66-\u0C6F]",thai:"[\u0E50-\u0E59]",tibt:"[\u0F20-\u0F29]",latn:"\\d"},R5={arab:[1632,1641],arabext:[1776,1785],bali:[6992,7001],beng:[2534,2543],deva:[2406,2415],fullwide:[65296,65303],gujr:[2790,2799],khmr:[6112,6121],knda:[3302,3311],laoo:[3792,3801],limb:[6470,6479],mlym:[3430,3439],mong:[6160,6169],mymr:[4160,4169],orya:[2918,2927],tamldec:[3046,3055],telu:[3174,3183],thai:[3664,3673],tibt:[3872,3881]},Ege=P1.hanidec.replace(/[\[|\]]/g,"").split("");function Tge(r){let e=parseInt(r,10);if(isNaN(e)){e="";for(let t=0;t<r.length;t++){let n=r.charCodeAt(t);if(r[t].search(P1.hanidec)!==-1)e+=Ege.indexOf(r[t]);else for(let i in R5){let[o,s]=R5[i];n>=o&&n<=s&&(e+=n-o)}}return parseInt(e,10)}else return e}function Ha({numberingSystem:r},e=""){return new RegExp(`${P1[r||"latn"]}${e}`)}var _ge="missing Intl.DateTimeFormat.formatToParts support";function Qt(r,e=t=>t){return{regex:r,deser:([t])=>e(Tge(t))}}var Age="\xA0",R8=`[ ${Age}]`,$8=new RegExp(R8,"g");function kge(r){return r.replace(/\./g,"\\.?").replace($8,R8)}function $5(r){return r.replace(/\./g,"").replace($8," ").toLowerCase()}function ja(r,e){return r===null?null:{regex:RegExp(r.map(kge).join("|")),deser:([t])=>r.findIndex(n=>$5(t)===$5(n))+e}}function O5(r,e){return{regex:r,deser:([,t,n])=>oD(t,n),groups:e}}function VS(r){return{regex:r,deser:([e])=>e}}function Sge(r){return r.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g,"\\$&")}function Dge(r,e){let t=Ha(e),n=Ha(e,"{2}"),i=Ha(e,"{3}"),o=Ha(e,"{4}"),s=Ha(e,"{6}"),a=Ha(e,"{1,2}"),l=Ha(e,"{1,3}"),c=Ha(e,"{1,6}"),u=Ha(e,"{1,9}"),d=Ha(e,"{2,4}"),f=Ha(e,"{4,6}"),p=g=>({regex:RegExp(Sge(g.val)),deser:([y])=>y,literal:!0}),v=(g=>{if(r.literal)return p(g);switch(g.val){case"G":return ja(e.eras("short"),0);case"GG":return ja(e.eras("long"),0);case"y":return Qt(c);case"yy":return Qt(d,v1);case"yyyy":return Qt(o);case"yyyyy":return Qt(f);case"yyyyyy":return Qt(s);case"M":return Qt(a);case"MM":return Qt(n);case"MMM":return ja(e.months("short",!0),1);case"MMMM":return ja(e.months("long",!0),1);case"L":return Qt(a);case"LL":return Qt(n);case"LLL":return ja(e.months("short",!1),1);case"LLLL":return ja(e.months("long",!1),1);case"d":return Qt(a);case"dd":return Qt(n);case"o":return Qt(l);case"ooo":return Qt(i);case"HH":return Qt(n);case"H":return Qt(a);case"hh":return Qt(n);case"h":return Qt(a);case"mm":return Qt(n);case"m":return Qt(a);case"q":return Qt(a);case"qq":return Qt(n);case"s":return Qt(a);case"ss":return Qt(n);case"S":return Qt(l);case"SSS":return Qt(i);case"u":return VS(u);case"uu":return VS(a);case"uuu":return Qt(t);case"a":return ja(e.meridiems(),0);case"kkkk":return Qt(o);case"kk":return Qt(d,v1);case"W":return Qt(a);case"WW":return Qt(n);case"E":case"c":return Qt(t);case"EEE":return ja(e.weekdays("short",!1),1);case"EEEE":return ja(e.weekdays("long",!1),1);case"ccc":return ja(e.weekdays("short",!0),1);case"cccc":return ja(e.weekdays("long",!0),1);case"Z":case"ZZ":return O5(new RegExp(`([+-]${a.source})(?::(${n.source}))?`),2);case"ZZZ":return O5(new RegExp(`([+-]${a.source})(${n.source})?`),2);case"z":return VS(/[a-z_+-/]{1,256}?/i);case" ":return VS(/[^\S\n\r]/);default:return p(g)}})(r)||{invalidReason:_ge};return v.token=r,v}var Ige={year:{"2-digit":"yy",numeric:"yyyyy"},month:{numeric:"M","2-digit":"MM",short:"MMM",long:"MMMM"},day:{numeric:"d","2-digit":"dd"},weekday:{short:"EEE",long:"EEEE"},dayperiod:"a",dayPeriod:"a",hour12:{numeric:"h","2-digit":"hh"},hour24:{numeric:"H","2-digit":"HH"},minute:{numeric:"m","2-digit":"mm"},second:{numeric:"s","2-digit":"ss"},timeZoneName:{long:"ZZZZZ",short:"ZZZ"}};function Pge(r,e,t){let{type:n,value:i}=r;if(n==="literal"){let l=/^\s+$/.test(i);return{literal:!l,val:l?" ":i}}let o=e[n],s=n;n==="hour"&&(e.hour12!=null?s=e.hour12?"hour12":"hour24":e.hourCycle!=null?e.hourCycle==="h11"||e.hourCycle==="h12"?s="hour12":s="hour24":s=t.hour12?"hour12":"hour24");let a=Ige[s];if(typeof a=="object"&&(a=a[o]),a)return{literal:!1,val:a}}function Fge(r){return[`^${r.map(t=>t.regex).reduce((t,n)=>`${t}(${n.source})`,"")}$`,r]}function Mge(r,e,t){let n=r.match(e);if(n){let i={},o=1;for(let s in t)if(Ag(t,s)){let a=t[s],l=a.groups?a.groups+1:1;!a.literal&&a.token&&(i[a.token.val[0]]=a.deser(n.slice(o,o+l))),o+=l}return[n,i]}else return[n,{}]}function Rge(r){let e=o=>{switch(o){case"S":return"millisecond";case"s":return"second";case"m":return"minute";case"h":case"H":return"hour";case"d":return"day";case"o":return"ordinal";case"L":case"M":return"month";case"y":return"year";case"E":case"c":return"weekday";case"W":return"weekNumber";case"k":return"weekYear";case"q":return"quarter";default:return null}},t=null,n;return Mt(r.z)||(t=fd.create(r.z)),Mt(r.Z)||(t||(t=new ia(r.Z)),n=r.Z),Mt(r.q)||(r.M=(r.q-1)*3+1),Mt(r.h)||(r.h<12&&r.a===1?r.h+=12:r.h===12&&r.a===0&&(r.h=0)),r.G===0&&r.y&&(r.y=-r.y),Mt(r.u)||(r.S=A1(r.u)),[Object.keys(r).reduce((o,s)=>{let a=e(s);return a&&(o[a]=r[s]),o},{}),t,n]}var e1=null;function $ge(){return e1||(e1=At.fromMillis(1555555555555)),e1}function Oge(r,e){if(r.literal)return r;let t=ys.macroTokenToFormatOpts(r.val),n=L8(t,e);return n==null||n.includes(void 0)?r:n}function O8(r,e){return Array.prototype.concat(...r.map(t=>Oge(t,e)))}function N8(r,e,t){let n=O8(ys.parseFormat(t),r),i=n.map(s=>Dge(s,r)),o=i.find(s=>s.invalidReason);if(o)return{input:e,tokens:n,invalidReason:o.invalidReason};{let[s,a]=Fge(i),l=RegExp(s,"i"),[c,u]=Mge(e,l,a),[d,f,p]=u?Rge(u):[null,null,void 0];if(Ag(u,"a")&&Ag(u,"H"))throw new rf("Can't include meridiem when specifying 24-hour format");return{input:e,tokens:n,regex:l,rawMatches:c,matches:u,result:d,zone:f,specificOffset:p}}}function Nge(r,e,t){let{result:n,zone:i,specificOffset:o,invalidReason:s}=N8(r,e,t);return[n,i,o,s]}function L8(r,e){if(!r)return null;let n=ys.create(e,r).dtFormatter($ge()),i=n.formatToParts(),o=n.resolvedOptions();return i.map(s=>Pge(s,r,o))}var B8=[0,31,59,90,120,151,181,212,243,273,304,334],U8=[0,31,60,91,121,152,182,213,244,274,305,335];function na(r,e){return new bs("unit out of range",`you specified ${e} (of type ${typeof e}) as a ${r}, which is invalid`)}function V8(r,e,t){let n=new Date(Date.UTC(r,e-1,t));r<100&&r>=0&&n.setUTCFullYear(n.getUTCFullYear()-1900);let i=n.getUTCDay();return i===0?7:i}function q8(r,e,t){return t+(Xx(r)?U8:B8)[e-1]}function W8(r,e){let t=Xx(r)?U8:B8,n=t.findIndex(o=>o<e),i=e-t[n];return{month:n+1,day:i}}function y1(r){let{year:e,month:t,day:n}=r,i=q8(e,t,n),o=V8(e,t,n),s=Math.floor((i-o+10)/7),a;return s<1?(a=e-1,s=XS(a)):s>XS(e)?(a=e+1,s=1):a=e,{weekYear:a,weekNumber:s,weekday:o,...sD(r)}}function N5(r){let{weekYear:e,weekNumber:t,weekday:n}=r,i=V8(e,1,4),o=Gx(e),s=t*7+n-i-3,a;s<1?(a=e-1,s+=Gx(a)):s>o?(a=e+1,s-=Gx(e)):a=e;let{month:l,day:c}=W8(a,s);return{year:a,month:l,day:c,...sD(r)}}function t1(r){let{year:e,month:t,day:n}=r,i=q8(e,t,n);return{year:e,ordinal:i,...sD(r)}}function L5(r){let{year:e,ordinal:t}=r,{month:n,day:i}=W8(e,t);return{year:e,month:n,day:i,...sD(r)}}function Lge(r){let e=nD(r.weekYear),t=Wc(r.weekNumber,1,XS(r.weekYear)),n=Wc(r.weekday,1,7);return e?t?n?!1:na("weekday",r.weekday):na("week",r.week):na("weekYear",r.weekYear)}function Bge(r){let e=nD(r.year),t=Wc(r.ordinal,1,Gx(r.year));return e?t?!1:na("ordinal",r.ordinal):na("year",r.year)}function z8(r){let e=nD(r.year),t=Wc(r.month,1,12),n=Wc(r.day,1,QS(r.year,r.month));return e?t?n?!1:na("day",r.day):na("month",r.month):na("year",r.year)}function H8(r){let{hour:e,minute:t,second:n,millisecond:i}=r,o=Wc(e,0,23)||e===24&&t===0&&n===0&&i===0,s=Wc(t,0,59),a=Wc(n,0,59),l=Wc(i,0,999);return o?s?a?l?!1:na("millisecond",i):na("second",n):na("minute",t):na("hour",e)}var r1="Invalid DateTime",B5=864e13;function qS(r){return new bs("unsupported zone",`the zone "${r.name}" is not supported`)}function n1(r){return r.weekData===null&&(r.weekData=y1(r.c)),r.weekData}function tf(r,e){let t={ts:r.ts,zone:r.zone,c:r.c,o:r.o,loc:r.loc,invalid:r.invalid};return new At({...t,...e,old:t})}function j8(r,e,t){let n=r-e*60*1e3,i=t.offset(n);if(e===i)return[n,e];n-=(i-e)*60*1e3;let o=t.offset(n);return i===o?[n,i]:[r-Math.min(i,o)*60*1e3,Math.max(i,o)]}function WS(r,e){r+=e*60*1e3;let t=new Date(r);return{year:t.getUTCFullYear(),month:t.getUTCMonth()+1,day:t.getUTCDate(),hour:t.getUTCHours(),minute:t.getUTCMinutes(),second:t.getUTCSeconds(),millisecond:t.getUTCMilliseconds()}}function jS(r,e,t){return j8(iD(r),e,t)}function U5(r,e){let t=r.o,n=r.c.year+Math.trunc(e.years),i=r.c.month+Math.trunc(e.months)+Math.trunc(e.quarters)*3,o={...r.c,year:n,month:i,day:Math.min(r.c.day,QS(n,i))+Math.trunc(e.days)+Math.trunc(e.weeks)*7},s=Qe.fromObject({years:e.years-Math.trunc(e.years),quarters:e.quarters-Math.trunc(e.quarters),months:e.months-Math.trunc(e.months),weeks:e.weeks-Math.trunc(e.weeks),days:e.days-Math.trunc(e.days),hours:e.hours,minutes:e.minutes,seconds:e.seconds,milliseconds:e.milliseconds}).as("milliseconds"),a=iD(o),[l,c]=j8(a,t,r.zone);return s!==0&&(l+=s,c=r.zone.offset(l)),{ts:l,o:c}}function Wx(r,e,t,n,i,o){let{setZone:s,zone:a}=t;if(r&&Object.keys(r).length!==0||e){let l=e||a,c=At.fromObject(r,{...t,zone:l,specificOffset:o});return s?c:c.setZone(a)}else return At.invalid(new bs("unparsable",`the input "${i}" can't be parsed as ${n}`))}function zS(r,e,t=!0){return r.isValid?ys.create(Zr.create("en-US"),{allowZ:t,forceSimple:!0}).formatDateTimeFromString(r,e):null}function i1(r,e){let t=r.c.year>9999||r.c.year<0,n="";return t&&r.c.year>=0&&(n+="+"),n+=En(r.c.year,t?6:4),e?(n+="-",n+=En(r.c.month),n+="-",n+=En(r.c.day)):(n+=En(r.c.month),n+=En(r.c.day)),n}function V5(r,e,t,n,i,o){let s=En(r.c.hour);return e?(s+=":",s+=En(r.c.minute),(r.c.millisecond!==0||r.c.second!==0||!t)&&(s+=":")):s+=En(r.c.minute),(r.c.millisecond!==0||r.c.second!==0||!t)&&(s+=En(r.c.second),(r.c.millisecond!==0||!n)&&(s+=".",s+=En(r.c.millisecond,3))),i&&(r.isOffsetFixed&&r.offset===0&&!o?s+="Z":r.o<0?(s+="-",s+=En(Math.trunc(-r.o/60)),s+=":",s+=En(Math.trunc(-r.o%60))):(s+="+",s+=En(Math.trunc(r.o/60)),s+=":",s+=En(Math.trunc(r.o%60)))),o&&(s+="["+r.zone.ianaName+"]"),s}var G8={month:1,day:1,hour:0,minute:0,second:0,millisecond:0},Uge={weekNumber:1,weekday:1,hour:0,minute:0,second:0,millisecond:0},Vge={ordinal:1,hour:0,minute:0,second:0,millisecond:0},Y8=["year","month","day","hour","minute","second","millisecond"],qge=["weekYear","weekNumber","weekday","hour","minute","second","millisecond"],Wge=["year","ordinal","hour","minute","second","millisecond"];function q5(r){let e={year:"year",years:"year",month:"month",months:"month",day:"day",days:"day",hour:"hour",hours:"hour",minute:"minute",minutes:"minute",quarter:"quarter",quarters:"quarter",second:"second",seconds:"second",millisecond:"millisecond",milliseconds:"millisecond",weekday:"weekday",weekdays:"weekday",weeknumber:"weekNumber",weeksnumber:"weekNumber",weeknumbers:"weekNumber",weekyear:"weekYear",weekyears:"weekYear",ordinal:"ordinal"}[r.toLowerCase()];if(!e)throw new GS(r);return e}function W5(r,e){let t=pd(e.zone,Xr.defaultZone),n=Zr.fromObject(e),i=Xr.now(),o,s;if(Mt(r.year))o=i;else{for(let c of Y8)Mt(r[c])&&(r[c]=G8[c]);let a=z8(r)||H8(r);if(a)return At.invalid(a);let l=t.offset(i);[o,s]=jS(r,l,t)}return new At({ts:o,zone:t,loc:n,o:s})}function z5(r,e,t){let n=Mt(t.round)?!0:t.round,i=(s,a)=>(s=k1(s,n||t.calendary?0:2,!0),e.loc.clone(t).relFormatter(t).format(s,a)),o=s=>t.calendary?e.hasSame(r,s)?0:e.startOf(s).diff(r.startOf(s),s).get(s):e.diff(r,s).get(s);if(t.unit)return i(o(t.unit),t.unit);for(let s of t.units){let a=o(s);if(Math.abs(a)>=1)return i(a,s)}return i(r>e?-0:0,t.units[t.units.length-1])}function H5(r){let e={},t;return r.length>0&&typeof r[r.length-1]=="object"?(e=r[r.length-1],t=Array.from(r).slice(0,r.length-1)):t=Array.from(r),[e,t]}var At=class r{constructor(e){let t=e.zone||Xr.defaultZone,n=e.invalid||(Number.isNaN(e.ts)?new bs("invalid input"):null)||(t.isValid?null:qS(t));this.ts=Mt(e.ts)?Xr.now():e.ts;let i=null,o=null;if(!n)if(e.old&&e.old.ts===this.ts&&e.old.zone.equals(t))[i,o]=[e.old.c,e.old.o];else{let a=t.offset(this.ts);i=WS(this.ts,a),n=Number.isNaN(i.year)?new bs("invalid input"):null,i=n?null:i,o=n?null:a}this._zone=t,this.loc=e.loc||Zr.create(),this.invalid=n,this.weekData=null,this.c=i,this.o=o,this.isLuxonDateTime=!0}static now(){return new r({})}static local(){let[e,t]=H5(arguments),[n,i,o,s,a,l,c]=t;return W5({year:n,month:i,day:o,hour:s,minute:a,second:l,millisecond:c},e)}static utc(){let[e,t]=H5(arguments),[n,i,o,s,a,l,c]=t;return e.zone=ia.utcInstance,W5({year:n,month:i,day:o,hour:s,minute:a,second:l,millisecond:c},e)}static fromJSDate(e,t={}){let n=vhe(e)?e.valueOf():NaN;if(Number.isNaN(n))return r.invalid("invalid input");let i=pd(t.zone,Xr.defaultZone);return i.isValid?new r({ts:n,zone:i,loc:Zr.fromObject(t)}):r.invalid(qS(i))}static fromMillis(e,t={}){if(of(e))return e<-B5||e>B5?r.invalid("Timestamp out of range"):new r({ts:e,zone:pd(t.zone,Xr.defaultZone),loc:Zr.fromObject(t)});throw new qo(`fromMillis requires a numerical input, but received a ${typeof e} with value ${e}`)}static fromSeconds(e,t={}){if(of(e))return new r({ts:e*1e3,zone:pd(t.zone,Xr.defaultZone),loc:Zr.fromObject(t)});throw new qo("fromSeconds requires a numerical input")}static fromObject(e,t={}){e=e||{};let n=pd(t.zone,Xr.defaultZone);if(!n.isValid)return r.invalid(qS(n));let i=Xr.now(),o=Mt(t.specificOffset)?n.offset(i):t.specificOffset,s=ZS(e,q5),a=!Mt(s.ordinal),l=!Mt(s.year),c=!Mt(s.month)||!Mt(s.day),u=l||c,d=s.weekYear||s.weekNumber,f=Zr.fromObject(t);if((u||a)&&d)throw new rf("Can't mix weekYear/weekNumber units with year/month/day or ordinals");if(c&&a)throw new rf("Can't mix ordinal dates with month/day");let p=d||s.weekday&&!u,m,v,g=WS(i,o);p?(m=qge,v=Uge,g=y1(g)):a?(m=Wge,v=Vge,g=t1(g)):(m=Y8,v=G8);let y=!1;for(let P of m){let H=s[P];Mt(H)?y?s[P]=v[P]:s[P]=g[P]:y=!0}let w=p?Lge(s):a?Bge(s):z8(s),x=w||H8(s);if(x)return r.invalid(x);let C=p?N5(s):a?L5(s):s,[_,E]=jS(C,o,n),D=new r({ts:_,zone:n,o:E,loc:f});return s.weekday&&u&&e.weekday!==D.weekday?r.invalid("mismatched weekday",`you can't specify both a weekday of ${s.weekday} and a date of ${D.toISO()}`):D}static fromISO(e,t={}){let[n,i]=sge(e);return Wx(n,i,t,"ISO 8601",e)}static fromRFC2822(e,t={}){let[n,i]=age(e);return Wx(n,i,t,"RFC 2822",e)}static fromHTTP(e,t={}){let[n,i]=lge(e);return Wx(n,i,t,"HTTP",t)}static fromFormat(e,t,n={}){if(Mt(e)||Mt(t))throw new qo("fromFormat requires an input string and a format");let{locale:i=null,numberingSystem:o=null}=n,s=Zr.fromOpts({locale:i,numberingSystem:o,defaultToEN:!0}),[a,l,c,u]=Nge(s,e,t);return u?r.invalid(u):Wx(a,l,n,`format ${t}`,e,c)}static fromString(e,t,n={}){return r.fromFormat(e,t,n)}static fromSQL(e,t={}){let[n,i]=hge(e);return Wx(n,i,t,"SQL",e)}static invalid(e,t=null){if(!e)throw new qo("need to specify a reason the DateTime is invalid");let n=e instanceof bs?e:new bs(e,t);if(Xr.throwOnInvalid)throw new s1(n);return new r({invalid:n})}static isDateTime(e){return e&&e.isLuxonDateTime||!1}static parseFormatForOpts(e,t={}){let n=L8(e,Zr.fromObject(t));return n?n.map(i=>i?i.val:null).join(""):null}static expandFormat(e,t={}){return O8(ys.parseFormat(e),Zr.fromObject(t)).map(i=>i.val).join("")}get(e){return this[e]}get isValid(){return this.invalid===null}get invalidReason(){return this.invalid?this.invalid.reason:null}get invalidExplanation(){return this.invalid?this.invalid.explanation:null}get locale(){return this.isValid?this.loc.locale:null}get numberingSystem(){return this.isValid?this.loc.numberingSystem:null}get outputCalendar(){return this.isValid?this.loc.outputCalendar:null}get zone(){return this._zone}get zoneName(){return this.isValid?this.zone.name:null}get year(){return this.isValid?this.c.year:NaN}get quarter(){return this.isValid?Math.ceil(this.c.month/3):NaN}get month(){return this.isValid?this.c.month:NaN}get day(){return this.isValid?this.c.day:NaN}get hour(){return this.isValid?this.c.hour:NaN}get minute(){return this.isValid?this.c.minute:NaN}get second(){return this.isValid?this.c.second:NaN}get millisecond(){return this.isValid?this.c.millisecond:NaN}get weekYear(){return this.isValid?n1(this).weekYear:NaN}get weekNumber(){return this.isValid?n1(this).weekNumber:NaN}get weekday(){return this.isValid?n1(this).weekday:NaN}get ordinal(){return this.isValid?t1(this.c).ordinal:NaN}get monthShort(){return this.isValid?Eg.months("short",{locObj:this.loc})[this.month-1]:null}get monthLong(){return this.isValid?Eg.months("long",{locObj:this.loc})[this.month-1]:null}get weekdayShort(){return this.isValid?Eg.weekdays("short",{locObj:this.loc})[this.weekday-1]:null}get weekdayLong(){return this.isValid?Eg.weekdays("long",{locObj:this.loc})[this.weekday-1]:null}get offset(){return this.isValid?+this.o:NaN}get offsetNameShort(){return this.isValid?this.zone.offsetName(this.ts,{format:"short",locale:this.locale}):null}get offsetNameLong(){return this.isValid?this.zone.offsetName(this.ts,{format:"long",locale:this.locale}):null}get isOffsetFixed(){return this.isValid?this.zone.isUniversal:null}get isInDST(){return this.isOffsetFixed?!1:this.offset>this.set({month:1,day:1}).offset||this.offset>this.set({month:5}).offset}getPossibleOffsets(){if(!this.isValid||this.isOffsetFixed)return[this];let e=864e5,t=6e4,n=iD(this.c),i=this.zone.offset(n-e),o=this.zone.offset(n+e),s=this.zone.offset(n-i*t),a=this.zone.offset(n-o*t);if(s===a)return[this];let l=n-s*t,c=n-a*t,u=WS(l,s),d=WS(c,a);return u.hour===d.hour&&u.minute===d.minute&&u.second===d.second&&u.millisecond===d.millisecond?[tf(this,{ts:l}),tf(this,{ts:c})]:[this]}get isInLeapYear(){return Xx(this.year)}get daysInMonth(){return QS(this.year,this.month)}get daysInYear(){return this.isValid?Gx(this.year):NaN}get weeksInWeekYear(){return this.isValid?XS(this.weekYear):NaN}resolvedLocaleOptions(e={}){let{locale:t,numberingSystem:n,calendar:i}=ys.create(this.loc.clone(e),e).resolvedOptions(this);return{locale:t,numberingSystem:n,outputCalendar:i}}toUTC(e=0,t={}){return this.setZone(ia.instance(e),t)}toLocal(){return this.setZone(Xr.defaultZone)}setZone(e,{keepLocalTime:t=!1,keepCalendarTime:n=!1}={}){if(e=pd(e,Xr.defaultZone),e.equals(this.zone))return this;if(e.isValid){let i=this.ts;if(t||n){let o=e.offset(this.ts),s=this.toObject();[i]=jS(s,o,e)}return tf(this,{ts:i,zone:e})}else return r.invalid(qS(e))}reconfigure({locale:e,numberingSystem:t,outputCalendar:n}={}){let i=this.loc.clone({locale:e,numberingSystem:t,outputCalendar:n});return tf(this,{loc:i})}setLocale(e){return this.reconfigure({locale:e})}set(e){if(!this.isValid)return this;let t=ZS(e,q5),n=!Mt(t.weekYear)||!Mt(t.weekNumber)||!Mt(t.weekday),i=!Mt(t.ordinal),o=!Mt(t.year),s=!Mt(t.month)||!Mt(t.day),a=o||s,l=t.weekYear||t.weekNumber;if((a||i)&&l)throw new rf("Can't mix weekYear/weekNumber units with year/month/day or ordinals");if(s&&i)throw new rf("Can't mix ordinal dates with month/day");let c;n?c=N5({...y1(this.c),...t}):Mt(t.ordinal)?(c={...this.toObject(),...t},Mt(t.day)&&(c.day=Math.min(QS(c.year,c.month),c.day))):c=L5({...t1(this.c),...t});let[u,d]=jS(c,this.o,this.zone);return tf(this,{ts:u,o:d})}plus(e){if(!this.isValid)return this;let t=Qe.fromDurationLike(e);return tf(this,U5(this,t))}minus(e){if(!this.isValid)return this;let t=Qe.fromDurationLike(e).negate();return tf(this,U5(this,t))}startOf(e){if(!this.isValid)return this;let t={},n=Qe.normalizeUnit(e);switch(n){case"years":t.month=1;case"quarters":case"months":t.day=1;case"weeks":case"days":t.hour=0;case"hours":t.minute=0;case"minutes":t.second=0;case"seconds":t.millisecond=0;break}if(n==="weeks"&&(t.weekday=1),n==="quarters"){let i=Math.ceil(this.month/3);t.month=(i-1)*3+1}return this.set(t)}endOf(e){return this.isValid?this.plus({[e]:1}).startOf(e).minus(1):this}toFormat(e,t={}){return this.isValid?ys.create(this.loc.redefaultToEN(t)).formatDateTimeFromString(this,e):r1}toLocaleString(e=YS,t={}){return this.isValid?ys.create(this.loc.clone(t),e).formatDateTime(this):r1}toLocaleParts(e={}){return this.isValid?ys.create(this.loc.clone(e),e).formatDateTimeParts(this):[]}toISO({format:e="extended",suppressSeconds:t=!1,suppressMilliseconds:n=!1,includeOffset:i=!0,extendedZone:o=!1}={}){if(!this.isValid)return null;let s=e==="extended",a=i1(this,s);return a+="T",a+=V5(this,s,t,n,i,o),a}toISODate({format:e="extended"}={}){return this.isValid?i1(this,e==="extended"):null}toISOWeekDate(){return zS(this,"kkkk-'W'WW-c")}toISOTime({suppressMilliseconds:e=!1,suppressSeconds:t=!1,includeOffset:n=!0,includePrefix:i=!1,extendedZone:o=!1,format:s="extended"}={}){return this.isValid?(i?"T":"")+V5(this,s==="extended",t,e,n,o):null}toRFC2822(){return zS(this,"EEE, dd LLL yyyy HH:mm:ss ZZZ",!1)}toHTTP(){return zS(this.toUTC(),"EEE, dd LLL yyyy HH:mm:ss 'GMT'")}toSQLDate(){return this.isValid?i1(this,!0):null}toSQLTime({includeOffset:e=!0,includeZone:t=!1,includeOffsetSpace:n=!0}={}){let i="HH:mm:ss.SSS";return(t||e)&&(n&&(i+=" "),t?i+="z":e&&(i+="ZZ")),zS(this,i,!0)}toSQL(e={}){return this.isValid?`${this.toSQLDate()} ${this.toSQLTime(e)}`:null}toString(){return this.isValid?this.toISO():r1}valueOf(){return this.toMillis()}toMillis(){return this.isValid?this.ts:NaN}toSeconds(){return this.isValid?this.ts/1e3:NaN}toUnixInteger(){return this.isValid?Math.floor(this.ts/1e3):NaN}toJSON(){return this.toISO()}toBSON(){return this.toJSDate()}toObject(e={}){if(!this.isValid)return{};let t={...this.c};return e.includeConfig&&(t.outputCalendar=this.outputCalendar,t.numberingSystem=this.loc.numberingSystem,t.locale=this.loc.locale),t}toJSDate(){return new Date(this.isValid?this.ts:NaN)}diff(e,t="milliseconds",n={}){if(!this.isValid||!e.isValid)return Qe.invalid("created by diffing an invalid DateTime");let i={locale:this.locale,numberingSystem:this.numberingSystem,...n},o=yhe(t).map(Qe.normalizeUnit),s=e.valueOf()>this.valueOf(),a=s?this:e,l=s?e:this,c=xge(a,l,o,i);return s?c.negate():c}diffNow(e="milliseconds",t={}){return this.diff(r.now(),e,t)}until(e){return this.isValid?_g.fromDateTimes(this,e):this}hasSame(e,t){if(!this.isValid)return!1;let n=e.valueOf(),i=this.setZone(e.zone,{keepLocalTime:!0});return i.startOf(t)<=n&&n<=i.endOf(t)}equals(e){return this.isValid&&e.isValid&&this.valueOf()===e.valueOf()&&this.zone.equals(e.zone)&&this.loc.equals(e.loc)}toRelative(e={}){if(!this.isValid)return null;let t=e.base||r.fromObject({},{zone:this.zone}),n=e.padding?this<t?-e.padding:e.padding:0,i=["years","months","days","hours","minutes","seconds"],o=e.unit;return Array.isArray(e.unit)&&(i=e.unit,o=void 0),z5(t,this.plus(n),{...e,numeric:"always",units:i,unit:o})}toRelativeCalendar(e={}){return this.isValid?z5(e.base||r.fromObject({},{zone:this.zone}),this,{...e,numeric:"auto",units:["years","months","days"],calendary:!0}):null}static min(...e){if(!e.every(r.isDateTime))throw new qo("min requires all arguments be DateTimes");return S5(e,t=>t.valueOf(),Math.min)}static max(...e){if(!e.every(r.isDateTime))throw new qo("max requires all arguments be DateTimes");return S5(e,t=>t.valueOf(),Math.max)}static fromFormatExplain(e,t,n={}){let{locale:i=null,numberingSystem:o=null}=n,s=Zr.fromOpts({locale:i,numberingSystem:o,defaultToEN:!0});return N8(s,e,t)}static fromStringExplain(e,t,n={}){return r.fromFormatExplain(e,t,n)}static get DATE_SHORT(){return YS}static get DATE_MED(){return X5}static get DATE_MED_WITH_WEEKDAY(){return the}static get DATE_FULL(){return Z5}static get DATE_HUGE(){return J5}static get TIME_SIMPLE(){return e8}static get TIME_WITH_SECONDS(){return t8}static get TIME_WITH_SHORT_OFFSET(){return r8}static get TIME_WITH_LONG_OFFSET(){return n8}static get TIME_24_SIMPLE(){return i8}static get TIME_24_WITH_SECONDS(){return o8}static get TIME_24_WITH_SHORT_OFFSET(){return s8}static get TIME_24_WITH_LONG_OFFSET(){return a8}static get DATETIME_SHORT(){return l8}static get DATETIME_SHORT_WITH_SECONDS(){return c8}static get DATETIME_MED(){return u8}static get DATETIME_MED_WITH_SECONDS(){return d8}static get DATETIME_MED_WITH_WEEKDAY(){return rhe}static get DATETIME_FULL(){return p8}static get DATETIME_FULL_WITH_SECONDS(){return f8}static get DATETIME_HUGE(){return m8}static get DATETIME_HUGE_WITH_SECONDS(){return h8}};function zx(r){if(At.isDateTime(r))return r;if(r&&r.valueOf&&of(r.valueOf()))return At.fromJSDate(r);if(r&&typeof r=="object")return At.fromObject(r);throw new qo(`Unknown datetime argument: ${r}, of type ${typeof r}`)}var F1={renderNullAs:"\\-",taskCompletionTracking:!1,taskCompletionUseEmojiShorthand:!1,taskCompletionText:"completion",taskCompletionDateFormat:"yyyy-MM-dd",recursiveSubTaskCompletion:!1,warnOnEmptyResult:!0,refreshEnabled:!0,refreshInterval:2500,defaultDateFormat:"MMMM dd, yyyy",defaultDateTimeFormat:"h:mm a - MMMM dd, yyyy",maxRecursiveRenderDepth:4,tableIdColumnName:"File",tableGroupColumnName:"Group",showResultCount:!0},zge={allowHtml:!0};({...F1,...zge});var b1=class r{constructor(e){ae(this,"value");ae(this,"successful");this.value=e,this.successful=!0}map(e){return new r(e(this.value))}flatMap(e){return e(this.value)}mapErr(e){return this}bimap(e,t){return this.map(e)}orElse(e){return this.value}cast(){return this}orElseThrow(e){return this.value}},w1=class r{constructor(e){ae(this,"error");ae(this,"successful");this.error=e,this.successful=!1}map(e){return this}flatMap(e){return this}mapErr(e){return new r(e(this.error))}bimap(e,t){return this.mapErr(t)}orElse(e){return e}cast(){return this}orElseThrow(e){throw e?new Error(e(this.error)):new Error(""+this.error)}},JS;(function(r){function e(o){return new b1(o)}r.success=e;function t(o){return new w1(o)}r.failure=t;function n(o,s,a){return o.successful?s.successful?a(o.value,s.value):t(s.error):t(o.error)}r.flatMap2=n;function i(o,s,a){return n(o,s,(l,c)=>e(a(l,c)))}r.map2=i})(JS||(JS={}));var Hge=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},eD={exports:{}};eD.exports;(function(r,e){(function(t,n){r.exports=n()})(typeof self<"u"?self:Hge,function(){return(function(t){var n={};function i(o){if(n[o])return n[o].exports;var s=n[o]={i:o,l:!1,exports:{}};return t[o].call(s.exports,s,s.exports,i),s.l=!0,s.exports}return i.m=t,i.c=n,i.d=function(o,s,a){i.o(o,s)||Object.defineProperty(o,s,{configurable:!1,enumerable:!0,get:a})},i.r=function(o){Object.defineProperty(o,"__esModule",{value:!0})},i.n=function(o){var s=o&&o.__esModule?function(){return o.default}:function(){return o};return i.d(s,"a",s),s},i.o=function(o,s){return Object.prototype.hasOwnProperty.call(o,s)},i.p="",i(i.s=0)})([function(t,n,i){function o(T){if(!(this instanceof o))return new o(T);this._=T}var s=o.prototype;function a(T,k){for(var L=0;L<T;L++)k(L)}function l(T,k,L){return(function(Q,J){a(J.length,function(ue){Q(J[ue],ue,J)})})(function(Q,J,ue){k=T(k,Q,J,ue)},L),k}function c(T,k){return l(function(L,Q,J,ue){return L.concat([T(Q,J,ue)])},[],k)}function u(T,k){var L={v:0,buf:k};return a(T,function(){var Q;L={v:L.v<<1|(Q=L.buf,Q[0]>>7),buf:(function(J){var ue=l(function(ve,Ve,yt,Pr){return ve.concat(yt===Pr.length-1?Buffer.from([Ve,0]).readUInt16BE(0):Pr.readUInt16BE(yt))},[],J);return Buffer.from(c(function(ve){return(ve<<1&65535)>>8},ue))})(L.buf)}}),L}function d(){return typeof Buffer<"u"}function f(){if(!d())throw new Error("Buffer global does not exist; please use webpack if you need to parse Buffers in the browser.")}function p(T){f();var k=l(function(ue,ve){return ue+ve},0,T);if(k%8!=0)throw new Error("The bits ["+T.join(", ")+"] add up to "+k+" which is not an even number of bytes; the total should be divisible by 8");var L,Q=k/8,J=(L=function(ue){return ue>48},l(function(ue,ve){return ue||(L(ve)?ve:ue)},null,T));if(J)throw new Error(J+" bit range requested exceeds 48 bit (6 byte) Number max.");return new o(function(ue,ve){var Ve=Q+ve;return Ve>ue.length?P(ve,Q.toString()+" bytes"):D(Ve,l(function(yt,Pr){var jt=u(Pr,yt.buf);return{coll:yt.coll.concat(jt.v),buf:jt.buf}},{coll:[],buf:ue.slice(ve,Ve)},T).coll)})}function m(T,k){return new o(function(L,Q){return f(),Q+k>L.length?P(Q,k+" bytes for "+T):D(Q+k,L.slice(Q,Q+k))})}function v(T,k){if(typeof(L=k)!="number"||Math.floor(L)!==L||k<0||k>6)throw new Error(T+" requires integer length in range [0, 6].");var L}function g(T){return v("uintBE",T),m("uintBE("+T+")",T).map(function(k){return k.readUIntBE(0,T)})}function y(T){return v("uintLE",T),m("uintLE("+T+")",T).map(function(k){return k.readUIntLE(0,T)})}function w(T){return v("intBE",T),m("intBE("+T+")",T).map(function(k){return k.readIntBE(0,T)})}function x(T){return v("intLE",T),m("intLE("+T+")",T).map(function(k){return k.readIntLE(0,T)})}function C(T){return T instanceof o}function _(T){return{}.toString.call(T)==="[object Array]"}function E(T){return d()&&Buffer.isBuffer(T)}function D(T,k){return{status:!0,index:T,value:k,furthest:-1,expected:[]}}function P(T,k){return _(k)||(k=[k]),{status:!1,index:-1,value:null,furthest:T,expected:k}}function H(T,k){if(!k||T.furthest>k.furthest)return T;var L=T.furthest===k.furthest?(function(Q,J){if((function(){if(o._supportsSet!==void 0)return o._supportsSet;var pr=typeof Set<"u";return o._supportsSet=pr,pr})()&&Array.from){for(var ue=new Set(Q),ve=0;ve<J.length;ve++)ue.add(J[ve]);var Ve=Array.from(ue);return Ve.sort(),Ve}for(var yt={},Pr=0;Pr<Q.length;Pr++)yt[Q[Pr]]=!0;for(var jt=0;jt<J.length;jt++)yt[J[jt]]=!0;var $i=[];for(var bt in yt)({}).hasOwnProperty.call(yt,bt)&&$i.push(bt);return $i.sort(),$i})(T.expected,k.expected):k.expected;return{status:T.status,index:T.index,value:T.value,furthest:k.furthest,expected:L}}var V={};function oe(T,k){if(E(T))return{offset:k,line:-1,column:-1};T in V||(V[T]={});for(var L=V[T],Q=0,J=0,ue=0,ve=k;ve>=0;){if(ve in L){Q=L[ve].line,ue===0&&(ue=L[ve].lineStart);break}(T.charAt(ve)===`
|
||
`||T.charAt(ve)==="\r"&&T.charAt(ve+1)!==`
|
||
`)&&(J++,ue===0&&(ue=ve+1)),ve--}var Ve=Q+J,yt=k-ue;return L[k]={line:Ve,lineStart:ue},{offset:k,line:Ve+1,column:yt+1}}function ce(T){if(!C(T))throw new Error("not a parser: "+T)}function R(T,k){return typeof T=="string"?T.charAt(k):T[k]}function O(T){if(typeof T!="number")throw new Error("not a number: "+T)}function q(T){if(typeof T!="function")throw new Error("not a function: "+T)}function B(T){if(typeof T!="string")throw new Error("not a string: "+T)}var ie=2,j=3,Y=8,K=5*Y,se=4*Y,pe=" ";function ge(T,k){return new Array(k+1).join(T)}function be(T,k,L){var Q=k-T.length;return Q<=0?T:ge(L,Q)+T}function xe(T,k,L,Q){return{from:T-k>0?T-k:0,to:T+L>Q?Q:T+L}}function Ue(T,k){var L,Q,J,ue,ve,Ve=k.index,yt=Ve.offset,Pr=1;if(yt===T.length)return"Got the end of the input";if(E(T)){var jt=yt-yt%Y,$i=yt-jt,bt=xe(jt,K,se+Y,T.length),pr=c(function(kt){return c(function(Eo){return be(Eo.toString(16),2,"0")},kt)},(function(kt,Eo){var da=kt.length,Ts=[],cn=0;if(da<=Eo)return[kt.slice()];for(var An=0;An<da;An++)Ts[cn]||Ts.push([]),Ts[cn].push(kt[An]),(An+1)%Eo==0&&cn++;return Ts})(T.slice(bt.from,bt.to).toJSON().data,Y));ue=(function(kt){return kt.from===0&&kt.to===1?{from:kt.from,to:kt.to}:{from:kt.from/Y,to:Math.floor(kt.to/Y)}})(bt),Q=jt/Y,L=3*$i,$i>=4&&(L+=1),Pr=2,J=c(function(kt){return kt.length<=4?kt.join(" "):kt.slice(0,4).join(" ")+" "+kt.slice(4).join(" ")},pr),(ve=(8*(ue.to>0?ue.to-1:ue.to)).toString(16).length)<2&&(ve=2)}else{var kr=T.split(/\r\n|[\n\r\u2028\u2029]/);L=Ve.column-1,Q=Ve.line-1,ue=xe(Q,ie,j,kr.length),J=kr.slice(ue.from,ue.to),ve=ue.to.toString().length}var Yn=Q-ue.from;return E(T)&&(ve=(8*(ue.to>0?ue.to-1:ue.to)).toString(16).length)<2&&(ve=2),l(function(kt,Eo,da){var Ts,cn=da===Yn,An=cn?"> ":pe;return Ts=E(T)?be((8*(ue.from+da)).toString(16),ve,"0"):be((ue.from+da+1).toString(),ve," "),[].concat(kt,[An+Ts+" | "+Eo],cn?[pe+ge(" ",ve)+" | "+be("",L," ")+ge("^",Pr)]:[])},[],J).join(`
|
||
`)}function $t(T,k){return[`
|
||
`,"-- PARSING FAILED "+ge("-",50),`
|
||
|
||
`,Ue(T,k),`
|
||
|
||
`,(L=k.expected,L.length===1?`Expected:
|
||
|
||
`+L[0]:`Expected one of the following:
|
||
|
||
`+L.join(", ")),`
|
||
`].join("");var L}function Ne(T){return T.flags!==void 0?T.flags:[T.global?"g":"",T.ignoreCase?"i":"",T.multiline?"m":"",T.unicode?"u":"",T.sticky?"y":""].join("")}function Ke(){for(var T=[].slice.call(arguments),k=T.length,L=0;L<k;L+=1)ce(T[L]);return o(function(Q,J){for(var ue,ve=new Array(k),Ve=0;Ve<k;Ve+=1){if(!(ue=H(T[Ve]._(Q,J),ue)).status)return ue;ve[Ve]=ue.value,J=ue.index}return H(D(J,ve),ue)})}function Xe(){var T=[].slice.call(arguments);if(T.length===0)throw new Error("seqMap needs at least one argument");var k=T.pop();return q(k),Ke.apply(null,T).map(function(L){return k.apply(null,L)})}function ye(){var T=[].slice.call(arguments),k=T.length;if(k===0)return ut("zero alternates");for(var L=0;L<k;L+=1)ce(T[L]);return o(function(Q,J){for(var ue,ve=0;ve<T.length;ve+=1)if((ue=H(T[ve]._(Q,J),ue)).status)return ue;return ue})}function We(T,k){return ht(T,k).or(Be([]))}function ht(T,k){return ce(T),ce(k),Xe(T,k.then(T).many(),function(L,Q){return[L].concat(Q)})}function He(T){B(T);var k="'"+T+"'";return o(function(L,Q){var J=Q+T.length,ue=L.slice(Q,J);return ue===T?D(J,ue):P(Q,k)})}function _e(T,k){(function(J){if(!(J instanceof RegExp))throw new Error("not a regexp: "+J);for(var ue=Ne(J),ve=0;ve<ue.length;ve++){var Ve=ue.charAt(ve);if(Ve!=="i"&&Ve!=="m"&&Ve!=="u"&&Ve!=="s")throw new Error('unsupported regexp flag "'+Ve+'": '+J)}})(T),arguments.length>=2?O(k):k=0;var L=(function(J){return RegExp("^(?:"+J.source+")",Ne(J))})(T),Q=""+T;return o(function(J,ue){var ve=L.exec(J.slice(ue));if(ve){if(0<=k&&k<=ve.length){var Ve=ve[0],yt=ve[k];return D(ue+Ve.length,yt)}return P(ue,"valid match group (0 to "+ve.length+") in "+Q)}return P(ue,Q)})}function Be(T){return o(function(k,L){return D(L,T)})}function ut(T){return o(function(k,L){return P(L,T)})}function or(T){if(C(T))return o(function(k,L){var Q=T._(k,L);return Q.index=L,Q.value="",Q});if(typeof T=="string")return or(He(T));if(T instanceof RegExp)return or(_e(T));throw new Error("not a string, regexp, or parser: "+T)}function yr(T){return ce(T),o(function(k,L){var Q=T._(k,L),J=k.slice(L,Q.index);return Q.status?P(L,'not "'+J+'"'):D(L,null)})}function Pt(T){return q(T),o(function(k,L){var Q=R(k,L);return L<k.length&&T(Q)?D(L+1,Q):P(L,"a character/byte matching "+T)})}function Ar(T,k){arguments.length<2&&(k=T,T=void 0);var L=o(function(Q,J){return L._=k()._,L._(Q,J)});return T?L.desc(T):L}function ur(){return ut("fantasy-land/empty")}s.parse=function(T){if(typeof T!="string"&&!E(T))throw new Error(".parse must be called with a string or Buffer as its argument");var k,L=this.skip(xo)._(T,0);return k=L.status?{status:!0,value:L.value}:{status:!1,index:oe(T,L.furthest),expected:L.expected},delete V[T],k},s.tryParse=function(T){var k=this.parse(T);if(k.status)return k.value;var L=$t(T,k),Q=new Error(L);throw Q.type="ParsimmonError",Q.result=k,Q},s.assert=function(T,k){return this.chain(function(L){return T(L)?Be(L):ut(k)})},s.or=function(T){return ye(this,T)},s.trim=function(T){return this.wrap(T,T)},s.wrap=function(T,k){return Xe(T,this,k,function(L,Q){return Q})},s.thru=function(T){return T(this)},s.then=function(T){return ce(T),Ke(this,T).map(function(k){return k[1]})},s.many=function(){var T=this;return o(function(k,L){for(var Q=[],J=void 0;;){if(!(J=H(T._(k,L),J)).status)return H(D(L,Q),J);if(L===J.index)throw new Error("infinite loop detected in .many() parser --- calling .many() on a parser which can accept zero characters is usually the cause");L=J.index,Q.push(J.value)}})},s.tieWith=function(T){return B(T),this.map(function(k){if((function(J){if(!_(J))throw new Error("not an array: "+J)})(k),k.length){B(k[0]);for(var L=k[0],Q=1;Q<k.length;Q++)B(k[Q]),L+=T+k[Q];return L}return""})},s.tie=function(){return this.tieWith("")},s.times=function(T,k){var L=this;return arguments.length<2&&(k=T),O(T),O(k),o(function(Q,J){for(var ue=[],ve=void 0,Ve=void 0,yt=0;yt<T;yt+=1){if(Ve=H(ve=L._(Q,J),Ve),!ve.status)return Ve;J=ve.index,ue.push(ve.value)}for(;yt<k&&(Ve=H(ve=L._(Q,J),Ve),ve.status);yt+=1)J=ve.index,ue.push(ve.value);return H(D(J,ue),Ve)})},s.result=function(T){return this.map(function(){return T})},s.atMost=function(T){return this.times(0,T)},s.atLeast=function(T){return Xe(this.times(T),this.many(),function(k,L){return k.concat(L)})},s.map=function(T){q(T);var k=this;return o(function(L,Q){var J=k._(L,Q);return J.status?H(D(J.index,T(J.value)),J):J})},s.contramap=function(T){q(T);var k=this;return o(function(L,Q){var J=k.parse(T(L.slice(Q)));return J.status?D(Q+L.length,J.value):J})},s.promap=function(T,k){return q(T),q(k),this.contramap(T).map(k)},s.skip=function(T){return Ke(this,T).map(function(k){return k[0]})},s.mark=function(){return Xe(dt,this,dt,function(T,k,L){return{start:T,value:k,end:L}})},s.node=function(T){return Xe(dt,this,dt,function(k,L,Q){return{name:T,value:L,start:k,end:Q}})},s.sepBy=function(T){return We(this,T)},s.sepBy1=function(T){return ht(this,T)},s.lookahead=function(T){return this.skip(or(T))},s.notFollowedBy=function(T){return this.skip(yr(T))},s.desc=function(T){_(T)||(T=[T]);var k=this;return o(function(L,Q){var J=k._(L,Q);return J.status||(J.expected=T),J})},s.fallback=function(T){return this.or(Be(T))},s.ap=function(T){return Xe(T,this,function(k,L){return k(L)})},s.chain=function(T){var k=this;return o(function(L,Q){var J=k._(L,Q);return J.status?H(T(J.value)._(L,J.index),J):J})},s.concat=s.or,s.empty=ur,s.of=Be,s["fantasy-land/ap"]=s.ap,s["fantasy-land/chain"]=s.chain,s["fantasy-land/concat"]=s.concat,s["fantasy-land/empty"]=s.empty,s["fantasy-land/of"]=s.of,s["fantasy-land/map"]=s.map;var dt=o(function(T,k){return D(k,oe(T,k))}),Ft=o(function(T,k){return k>=T.length?P(k,"any character/byte"):D(k+1,R(T,k))}),jn=o(function(T,k){return D(T.length,T.slice(k))}),xo=o(function(T,k){return k<T.length?P(k,"EOF"):D(k,null)}),Es=_e(/[0-9]/).desc("a digit"),Gn=_e(/[0-9]*/).desc("optional digits"),re=_e(/[a-z]/i).desc("a letter"),Ie=_e(/[a-z]*/i).desc("optional letters"),dr=_e(/\s*/).desc("optional whitespace"),br=_e(/\s+/).desc("whitespace"),_n=He("\r"),Ho=He(`
|
||
`),Qa=He(`\r
|
||
`),Xa=ye(Qa,Ho,_n).desc("newline"),Jc=ye(Xa,xo);o.all=jn,o.alt=ye,o.any=Ft,o.cr=_n,o.createLanguage=function(T){var k={};for(var L in T)({}).hasOwnProperty.call(T,L)&&(function(Q){k[Q]=Ar(function(){return T[Q](k)})})(L);return k},o.crlf=Qa,o.custom=function(T){return o(T(D,P))},o.digit=Es,o.digits=Gn,o.empty=ur,o.end=Jc,o.eof=xo,o.fail=ut,o.formatError=$t,o.index=dt,o.isParser=C,o.lazy=Ar,o.letter=re,o.letters=Ie,o.lf=Ho,o.lookahead=or,o.makeFailure=P,o.makeSuccess=D,o.newline=Xa,o.noneOf=function(T){return Pt(function(k){return T.indexOf(k)<0}).desc("none of '"+T+"'")},o.notFollowedBy=yr,o.of=Be,o.oneOf=function(T){for(var k=T.split(""),L=0;L<k.length;L++)k[L]="'"+k[L]+"'";return Pt(function(Q){return T.indexOf(Q)>=0}).desc(k)},o.optWhitespace=dr,o.Parser=o,o.range=function(T,k){return Pt(function(L){return T<=L&&L<=k}).desc(T+"-"+k)},o.regex=_e,o.regexp=_e,o.sepBy=We,o.sepBy1=ht,o.seq=Ke,o.seqMap=Xe,o.seqObj=function(){for(var T,k={},L=0,Q=(T=arguments,Array.prototype.slice.call(T)),J=Q.length,ue=0;ue<J;ue+=1){var ve=Q[ue];if(!C(ve)){if(_(ve)&&ve.length===2&&typeof ve[0]=="string"&&C(ve[1])){var Ve=ve[0];if(Object.prototype.hasOwnProperty.call(k,Ve))throw new Error("seqObj: duplicate key "+Ve);k[Ve]=!0,L++;continue}throw new Error("seqObj arguments must be parsers or [string, parser] array pairs.")}}if(L===0)throw new Error("seqObj expects at least one named parser, found zero");return o(function(yt,Pr){for(var jt,$i={},bt=0;bt<J;bt+=1){var pr,kr;if(_(Q[bt])?(pr=Q[bt][0],kr=Q[bt][1]):(pr=null,kr=Q[bt]),!(jt=H(kr._(yt,Pr),jt)).status)return jt;pr&&($i[pr]=jt.value),Pr=jt.index}return H(D(Pr,$i),jt)})},o.string=He,o.succeed=Be,o.takeWhile=function(T){return q(T),o(function(k,L){for(var Q=L;Q<k.length&&T(R(k,Q));)Q++;return D(Q,k.slice(L,Q))})},o.test=Pt,o.whitespace=br,o["fantasy-land/empty"]=ur,o["fantasy-land/of"]=Be,o.Binary={bitSeq:p,bitSeqObj:function(T){f();var k={},L=0,Q=c(function(ue){if(_(ue)){var ve=ue;if(ve.length!==2)throw new Error("["+ve.join(", ")+"] should be length 2, got length "+ve.length);if(B(ve[0]),O(ve[1]),Object.prototype.hasOwnProperty.call(k,ve[0]))throw new Error("duplicate key in bitSeqObj: "+ve[0]);return k[ve[0]]=!0,L++,ve}return O(ue),[null,ue]},T);if(L<1)throw new Error("bitSeqObj expects at least one named pair, got ["+T.join(", ")+"]");var J=c(function(ue){return ue[0]},Q);return p(c(function(ue){return ue[1]},Q)).map(function(ue){return l(function(ve,Ve){return Ve[0]!==null&&(ve[Ve[0]]=Ve[1]),ve},{},c(function(ve,Ve){return[ve,ue[Ve]]},J))})},byte:function(T){if(f(),O(T),T>255)throw new Error("Value specified to byte constructor ("+T+"=0x"+T.toString(16)+") is larger in value than a single byte.");var k=(T>15?"0x":"0x0")+T.toString(16);return o(function(L,Q){var J=R(L,Q);return J===T?D(Q+1,J):P(Q,k)})},buffer:function(T){return m("buffer",T).map(function(k){return Buffer.from(k)})},encodedString:function(T,k){return m("string",k).map(function(L){return L.toString(T)})},uintBE:g,uint8BE:g(1),uint16BE:g(2),uint32BE:g(4),uintLE:y,uint8LE:y(1),uint16LE:y(2),uint32LE:y(4),intBE:w,int8BE:w(1),int16BE:w(2),int32BE:w(4),intLE:x,int8LE:x(1),int16LE:x(2),int32LE:x(4),floatBE:m("floatBE",4).map(function(T){return T.readFloatBE(0)}),floatLE:m("floatLE",4).map(function(T){return T.readFloatLE(0)}),doubleBE:m("doubleBE",8).map(function(T){return T.readDoubleBE(0)}),doubleLE:m("doubleLE",8).map(function(T){return T.readDoubleLE(0)})},t.exports=o}])})})(eD,eD.exports);var M=eD.exports,M1=()=>/[#*0-9]\uFE0F?\u20E3|[\xA9\xAE\u203C\u2049\u2122\u2139\u2194-\u2199\u21A9\u21AA\u231A\u231B\u2328\u23CF\u23ED-\u23EF\u23F1\u23F2\u23F8-\u23FA\u24C2\u25AA\u25AB\u25B6\u25C0\u25FB\u25FC\u25FE\u2600-\u2604\u260E\u2611\u2614\u2615\u2618\u2620\u2622\u2623\u2626\u262A\u262E\u262F\u2638-\u263A\u2640\u2642\u2648-\u2653\u265F\u2660\u2663\u2665\u2666\u2668\u267B\u267E\u267F\u2692\u2694-\u2697\u2699\u269B\u269C\u26A0\u26A7\u26AA\u26B0\u26B1\u26BD\u26BE\u26C4\u26C8\u26CF\u26D1\u26D3\u26E9\u26F0-\u26F5\u26F7\u26F8\u26FA\u2702\u2708\u2709\u270F\u2712\u2714\u2716\u271D\u2721\u2733\u2734\u2744\u2747\u2757\u2763\u27A1\u2934\u2935\u2B05-\u2B07\u2B1B\u2B1C\u2B55\u3030\u303D\u3297\u3299]\uFE0F?|[\u261D\u270C\u270D](?:\uFE0F|\uD83C[\uDFFB-\uDFFF])?|[\u270A\u270B](?:\uD83C[\uDFFB-\uDFFF])?|[\u23E9-\u23EC\u23F0\u23F3\u25FD\u2693\u26A1\u26AB\u26C5\u26CE\u26D4\u26EA\u26FD\u2705\u2728\u274C\u274E\u2753-\u2755\u2795-\u2797\u27B0\u27BF\u2B50]|\u26F9(?:\uFE0F|\uD83C[\uDFFB-\uDFFF])?(?:\u200D[\u2640\u2642]\uFE0F?)?|\u2764\uFE0F?(?:\u200D(?:\uD83D\uDD25|\uD83E\uDE79))?|\uD83C(?:[\uDC04\uDD70\uDD71\uDD7E\uDD7F\uDE02\uDE37\uDF21\uDF24-\uDF2C\uDF36\uDF7D\uDF96\uDF97\uDF99-\uDF9B\uDF9E\uDF9F\uDFCD\uDFCE\uDFD4-\uDFDF\uDFF5\uDFF7]\uFE0F?|[\uDF85\uDFC2\uDFC7](?:\uD83C[\uDFFB-\uDFFF])?|[\uDFC3\uDFC4\uDFCA](?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDFCB\uDFCC](?:\uFE0F|\uD83C[\uDFFB-\uDFFF])?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDCCF\uDD8E\uDD91-\uDD9A\uDE01\uDE1A\uDE2F\uDE32-\uDE36\uDE38-\uDE3A\uDE50\uDE51\uDF00-\uDF20\uDF2D-\uDF35\uDF37-\uDF7C\uDF7E-\uDF84\uDF86-\uDF93\uDFA0-\uDFC1\uDFC5\uDFC6\uDFC8\uDFC9\uDFCF-\uDFD3\uDFE0-\uDFF0\uDFF8-\uDFFF]|\uDDE6\uD83C[\uDDE8-\uDDEC\uDDEE\uDDF1\uDDF2\uDDF4\uDDF6-\uDDFA\uDDFC\uDDFD\uDDFF]|\uDDE7\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEF\uDDF1-\uDDF4\uDDF6-\uDDF9\uDDFB\uDDFC\uDDFE\uDDFF]|\uDDE8\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDEE\uDDF0-\uDDF5\uDDF7\uDDFA-\uDDFF]|\uDDE9\uD83C[\uDDEA\uDDEC\uDDEF\uDDF0\uDDF2\uDDF4\uDDFF]|\uDDEA\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDED\uDDF7-\uDDFA]|\uDDEB\uD83C[\uDDEE-\uDDF0\uDDF2\uDDF4\uDDF7]|\uDDEC\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEE\uDDF1-\uDDF3\uDDF5-\uDDFA\uDDFC\uDDFE]|\uDDED\uD83C[\uDDF0\uDDF2\uDDF3\uDDF7\uDDF9\uDDFA]|\uDDEE\uD83C[\uDDE8-\uDDEA\uDDF1-\uDDF4\uDDF6-\uDDF9]|\uDDEF\uD83C[\uDDEA\uDDF2\uDDF4\uDDF5]|\uDDF0\uD83C[\uDDEA\uDDEC-\uDDEE\uDDF2\uDDF3\uDDF5\uDDF7\uDDFC\uDDFE\uDDFF]|\uDDF1\uD83C[\uDDE6-\uDDE8\uDDEE\uDDF0\uDDF7-\uDDFB\uDDFE]|\uDDF2\uD83C[\uDDE6\uDDE8-\uDDED\uDDF0-\uDDFF]|\uDDF3\uD83C[\uDDE6\uDDE8\uDDEA-\uDDEC\uDDEE\uDDF1\uDDF4\uDDF5\uDDF7\uDDFA\uDDFF]|\uDDF4\uD83C\uDDF2|\uDDF5\uD83C[\uDDE6\uDDEA-\uDDED\uDDF0-\uDDF3\uDDF7-\uDDF9\uDDFC\uDDFE]|\uDDF6\uD83C\uDDE6|\uDDF7\uD83C[\uDDEA\uDDF4\uDDF8\uDDFA\uDDFC]|\uDDF8\uD83C[\uDDE6-\uDDEA\uDDEC-\uDDF4\uDDF7-\uDDF9\uDDFB\uDDFD-\uDDFF]|\uDDF9\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDED\uDDEF-\uDDF4\uDDF7\uDDF9\uDDFB\uDDFC\uDDFF]|\uDDFA\uD83C[\uDDE6\uDDEC\uDDF2\uDDF3\uDDF8\uDDFE\uDDFF]|\uDDFB\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDEE\uDDF3\uDDFA]|\uDDFC\uD83C[\uDDEB\uDDF8]|\uDDFD\uD83C\uDDF0|\uDDFE\uD83C[\uDDEA\uDDF9]|\uDDFF\uD83C[\uDDE6\uDDF2\uDDFC]|\uDFF3\uFE0F?(?:\u200D(?:\u26A7\uFE0F?|\uD83C\uDF08))?|\uDFF4(?:\u200D\u2620\uFE0F?|\uDB40\uDC67\uDB40\uDC62\uDB40(?:\uDC65\uDB40\uDC6E\uDB40\uDC67|\uDC73\uDB40\uDC63\uDB40\uDC74|\uDC77\uDB40\uDC6C\uDB40\uDC73)\uDB40\uDC7F)?)|\uD83D(?:[\uDC08\uDC26](?:\u200D\u2B1B)?|[\uDC3F\uDCFD\uDD49\uDD4A\uDD6F\uDD70\uDD73\uDD76-\uDD79\uDD87\uDD8A-\uDD8D\uDDA5\uDDA8\uDDB1\uDDB2\uDDBC\uDDC2-\uDDC4\uDDD1-\uDDD3\uDDDC-\uDDDE\uDDE1\uDDE3\uDDE8\uDDEF\uDDF3\uDDFA\uDECB\uDECD-\uDECF\uDEE0-\uDEE5\uDEE9\uDEF0\uDEF3]\uFE0F?|[\uDC42\uDC43\uDC46-\uDC50\uDC66\uDC67\uDC6B-\uDC6D\uDC72\uDC74-\uDC76\uDC78\uDC7C\uDC83\uDC85\uDC8F\uDC91\uDCAA\uDD7A\uDD95\uDD96\uDE4C\uDE4F\uDEC0\uDECC](?:\uD83C[\uDFFB-\uDFFF])?|[\uDC6E\uDC70\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6](?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDD74\uDD90](?:\uFE0F|\uD83C[\uDFFB-\uDFFF])?|[\uDC00-\uDC07\uDC09-\uDC14\uDC16-\uDC25\uDC27-\uDC3A\uDC3C-\uDC3E\uDC40\uDC44\uDC45\uDC51-\uDC65\uDC6A\uDC79-\uDC7B\uDC7D-\uDC80\uDC84\uDC88-\uDC8E\uDC90\uDC92-\uDCA9\uDCAB-\uDCFC\uDCFF-\uDD3D\uDD4B-\uDD4E\uDD50-\uDD67\uDDA4\uDDFB-\uDE2D\uDE2F-\uDE34\uDE37-\uDE44\uDE48-\uDE4A\uDE80-\uDEA2\uDEA4-\uDEB3\uDEB7-\uDEBF\uDEC1-\uDEC5\uDED0-\uDED2\uDED5-\uDED7\uDEDC-\uDEDF\uDEEB\uDEEC\uDEF4-\uDEFC\uDFE0-\uDFEB\uDFF0]|\uDC15(?:\u200D\uD83E\uDDBA)?|\uDC3B(?:\u200D\u2744\uFE0F?)?|\uDC41\uFE0F?(?:\u200D\uD83D\uDDE8\uFE0F?)?|\uDC68(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDC68\uDC69]\u200D\uD83D(?:\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?)|[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?)|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C(?:\uDFFB(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF-\uDDB3\uDDBC\uDDBD]|\uDD1D\u200D\uD83D\uDC68\uD83C[\uDFFC-\uDFFF])))?|\uDFFC(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF-\uDDB3\uDDBC\uDDBD]|\uDD1D\u200D\uD83D\uDC68\uD83C[\uDFFB\uDFFD-\uDFFF])))?|\uDFFD(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF-\uDDB3\uDDBC\uDDBD]|\uDD1D\u200D\uD83D\uDC68\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])))?|\uDFFE(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF-\uDDB3\uDDBC\uDDBD]|\uDD1D\u200D\uD83D\uDC68\uD83C[\uDFFB-\uDFFD\uDFFF])))?|\uDFFF(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF-\uDDB3\uDDBC\uDDBD]|\uDD1D\u200D\uD83D\uDC68\uD83C[\uDFFB-\uDFFE])))?))?|\uDC69(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?[\uDC68\uDC69]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?|\uDC69\u200D\uD83D(?:\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?))|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C(?:\uDFFB(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF-\uDDB3\uDDBC\uDDBD]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFC-\uDFFF])))?|\uDFFC(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF-\uDDB3\uDDBC\uDDBD]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB\uDFFD-\uDFFF])))?|\uDFFD(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF-\uDDB3\uDDBC\uDDBD]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])))?|\uDFFE(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF-\uDDB3\uDDBC\uDDBD]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB-\uDFFD\uDFFF])))?|\uDFFF(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF-\uDDB3\uDDBC\uDDBD]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB-\uDFFE])))?))?|\uDC6F(?:\u200D[\u2640\u2642]\uFE0F?)?|\uDD75(?:\uFE0F|\uD83C[\uDFFB-\uDFFF])?(?:\u200D[\u2640\u2642]\uFE0F?)?|\uDE2E(?:\u200D\uD83D\uDCA8)?|\uDE35(?:\u200D\uD83D\uDCAB)?|\uDE36(?:\u200D\uD83C\uDF2B\uFE0F?)?)|\uD83E(?:[\uDD0C\uDD0F\uDD18-\uDD1F\uDD30-\uDD34\uDD36\uDD77\uDDB5\uDDB6\uDDBB\uDDD2\uDDD3\uDDD5\uDEC3-\uDEC5\uDEF0\uDEF2-\uDEF8](?:\uD83C[\uDFFB-\uDFFF])?|[\uDD26\uDD35\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD4\uDDD6-\uDDDD](?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDDDE\uDDDF](?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDD0D\uDD0E\uDD10-\uDD17\uDD20-\uDD25\uDD27-\uDD2F\uDD3A\uDD3F-\uDD45\uDD47-\uDD76\uDD78-\uDDB4\uDDB7\uDDBA\uDDBC-\uDDCC\uDDD0\uDDE0-\uDDFF\uDE70-\uDE7C\uDE80-\uDE88\uDE90-\uDEBD\uDEBF-\uDEC2\uDECE-\uDEDB\uDEE0-\uDEE8]|\uDD3C(?:\u200D[\u2640\u2642]\uFE0F?|\uD83C[\uDFFB-\uDFFF])?|\uDDD1(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF-\uDDB3\uDDBC\uDDBD]|\uDD1D\u200D\uD83E\uDDD1))|\uD83C(?:\uDFFB(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFC-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF-\uDDB3\uDDBC\uDDBD]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF])))?|\uDFFC(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB\uDFFD-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF-\uDDB3\uDDBC\uDDBD]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF])))?|\uDFFD(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF-\uDDB3\uDDBC\uDDBD]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF])))?|\uDFFE(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB-\uDFFD\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF-\uDDB3\uDDBC\uDDBD]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF])))?|\uDFFF(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB-\uDFFE]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF-\uDDB3\uDDBC\uDDBD]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF])))?))?|\uDEF1(?:\uD83C(?:\uDFFB(?:\u200D\uD83E\uDEF2\uD83C[\uDFFC-\uDFFF])?|\uDFFC(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB\uDFFD-\uDFFF])?|\uDFFD(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])?|\uDFFE(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB-\uDFFD\uDFFF])?|\uDFFF(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB-\uDFFE])?))?)/g;function K8(r){return r==null?r:r.shiftToAll().normalize()}function j5(r){return r.includes("/")&&(r=r.substring(r.lastIndexOf("/")+1)),r.endsWith(".md")&&(r=r.substring(0,r.length-3)),r}M.alt(M.regex(new RegExp(M1(),"")),M.regex(/[0-9\p{Letter}_-]+/u).map(r=>r.toLocaleLowerCase()),M.whitespace.map(r=>"-"),M.any.map(r=>"")).many().map(r=>r.join(""));var jge=M.alt(M.regex(new RegExp(M1(),"")),M.regex(/[0-9\p{Letter}_-]+/u),M.whitespace.map(r=>" "),M.any.map(r=>" ")).many().map(r=>r.join("").split(/\s+/).join(" ").trim());function Gge(r){return jge.tryParse(r)}function Yge(r){return r=K8(r),r=Qe.fromObject(Object.fromEntries(Object.entries(r.toObject()).filter(([,e])=>e!=0))),r.toHuman()}var Kx;(function(r){function e(C,_=F1,E=!1){let D=t(C);if(!D)return _.renderNullAs;switch(D.type){case"null":return _.renderNullAs;case"string":return D.value;case"number":case"boolean":return""+D.value;case"html":return D.value.outerHTML;case"widget":return D.value.markdown();case"link":return D.value.markdown();case"function":return"<function>";case"array":let P="";return E&&(P+="["),P+=D.value.map(H=>e(H,_,!0)).join(", "),E&&(P+="]"),P;case"object":return"{ "+Object.entries(D.value).map(H=>H[0]+": "+e(H[1],_,!0)).join(", ")+" }";case"date":return D.value.second==0&&D.value.hour==0&&D.value.minute==0?D.value.toFormat(_.defaultDateFormat):D.value.toFormat(_.defaultDateTimeFormat);case"duration":return Yge(D.value)}}r.toString=e;function t(C){return f(C)?{type:"null",value:C}:c(C)?{type:"number",value:C}:l(C)?{type:"string",value:C}:m(C)?{type:"boolean",value:C}:d(C)?{type:"duration",value:C}:u(C)?{type:"date",value:C}:g(C)?{type:"widget",value:C}:p(C)?{type:"array",value:C}:v(C)?{type:"link",value:C}:x(C)?{type:"function",value:C}:y(C)?{type:"html",value:C}:w(C)?{type:"object",value:C}:void 0}r.wrapValue=t;function n(C,_){if(w(C)){let E={};for(let[D,P]of Object.entries(C))E[D]=n(P,_);return E}else if(p(C)){let E=[];for(let D of C)E.push(n(D,_));return E}else return _(C)}r.mapLeaves=n;function i(C,_,E){if(C===void 0&&(C=null),_===void 0&&(_=null),C===null&&_===null)return 0;if(C===null)return-1;if(_===null)return 1;let D=t(C),P=t(_);if(D===void 0&&P===void 0)return 0;if(D===void 0)return-1;if(P===void 0)return 1;if(D.type!=P.type)return D.type.localeCompare(P.type);if(D.value===P.value)return 0;switch(D.type){case"string":return D.value.localeCompare(P.value);case"number":return D.value<P.value?-1:D.value==P.value?0:1;case"null":return 0;case"boolean":return D.value==P.value?0:D.value?1:-1;case"link":let H=D.value,V=P.value,oe=E??(se=>se),ce=oe(H.path).localeCompare(oe(V.path));if(ce!=0)return ce;let R=H.type.localeCompare(V.type);return R!=0?R:H.subpath&&!V.subpath?1:!H.subpath&&V.subpath?-1:!H.subpath&&!V.subpath?0:(H.subpath??"").localeCompare(V.subpath??"");case"date":return D.value<P.value?-1:D.value.equals(P.value)?0:1;case"duration":return D.value<P.value?-1:D.value.equals(P.value)?0:1;case"array":let O=D.value,q=P.value;for(let se=0;se<Math.min(O.length,q.length);se++){let pe=i(O[se],q[se]);if(pe!=0)return pe}return O.length-q.length;case"object":let B=D.value,ie=P.value,j=Array.from(Object.keys(B)),Y=Array.from(Object.keys(ie));j.sort(),Y.sort();let K=i(j,Y);if(K!=0)return K;for(let se of j){let pe=i(B[se],ie[se]);if(pe!=0)return pe}return 0;case"widget":case"html":case"function":return 0}}r.compareValue=i;function o(C){return t(C)?.type}r.typeOf=o;function s(C){let _=t(C);if(!_)return!1;switch(_.type){case"number":return _.value!=0;case"string":return _.value.length>0;case"boolean":return _.value;case"link":return!!_.value.path;case"date":return _.value.toMillis()!=0;case"duration":return _.value.as("seconds")!=0;case"object":return Object.keys(_.value).length>0;case"array":return _.value.length>0;case"null":return!1;case"html":case"widget":case"function":return!0}}r.isTruthy=s;function a(C){if(C==null)return C;if(r.isArray(C))return[].concat(C.map(_=>a(_)));if(r.isObject(C)){let _={};for(let[E,D]of Object.entries(C))_[E]=a(D);return _}else return C}r.deepCopy=a;function l(C){return typeof C=="string"}r.isString=l;function c(C){return typeof C=="number"}r.isNumber=c;function u(C){return C instanceof At}r.isDate=u;function d(C){return C instanceof Qe}r.isDuration=d;function f(C){return C==null}r.isNull=f;function p(C){return Array.isArray(C)}r.isArray=p;function m(C){return typeof C=="boolean"}r.isBoolean=m;function v(C){return C instanceof tD}r.isLink=v;function g(C){return C instanceof Qx}r.isWidget=g;function y(C){return typeof HTMLElement<"u"?C instanceof HTMLElement:!1}r.isHtml=y;function w(C){return typeof C=="object"&&!y(C)&&!g(C)&&!p(C)&&!d(C)&&!u(C)&&!v(C)&&C!==void 0&&!f(C)}r.isObject=w;function x(C){return typeof C=="function"}r.isFunction=x})(Kx||(Kx={}));var G5;(function(r){function e(i){return Kx.isObject(i)&&Object.keys(i).length==2&&"key"in i&&"rows"in i}r.isElementGroup=e;function t(i){for(let o of i)if(!e(o))return!1;return!0}r.isGrouping=t;function n(i){if(t(i)){let o=0;for(let s of i)o+=n(s.rows);return o}else return i.length}r.count=n})(G5||(G5={}));var tD=class r{constructor(e){ae(this,"path");ae(this,"display");ae(this,"subpath");ae(this,"embed");ae(this,"type");Object.assign(this,e)}static file(e,t=!1,n){return new r({path:e,embed:t,display:n,subpath:void 0,type:"file"})}static infer(e,t=!1,n){if(e.includes("#^")){let i=e.split("#^");return r.block(i[0],i[1],t,n)}else if(e.includes("#")){let i=e.split("#");return r.header(i[0],i[1],t,n)}else return r.file(e,t,n)}static header(e,t,n,i){return new r({path:e,embed:n,display:i,subpath:Gge(t),type:"header"})}static block(e,t,n,i){return new r({path:e,embed:n,display:i,subpath:t,type:"block"})}static fromObject(e){return new r(e)}equals(e){return e==null||e==null?!1:this.path==e.path&&this.type==e.type&&this.subpath==e.subpath}toString(){return this.markdown()}toObject(){return{path:this.path,type:this.type,subpath:this.subpath,display:this.display,embed:this.embed}}withPath(e){return new r(Object.assign({},this,{path:e}))}withDisplay(e){return new r(Object.assign({},this,{display:e}))}withHeader(e){return r.header(this.path,e,this.embed,this.display)}toFile(){return r.file(this.path,this.embed,this.display)}toEmbed(){if(this.embed)return this;{let e=new r(this);return e.embed=!0,e}}fromEmbed(){if(this.embed){let e=new r(this);return e.embed=!1,e}else return this}markdown(){let e=(this.embed?"!":"")+"[["+this.obsidianLink();return this.display?e+="|"+this.display:(e+="|"+j5(this.path),(this.type=="header"||this.type=="block")&&(e+=" > "+this.subpath)),e+="]]",e}obsidianLink(){let e=this.path.replaceAll("|","\\|");return this.type=="header"?e+"#"+this.subpath?.replaceAll("|","\\|"):this.type=="block"?e+"#^"+this.subpath?.replaceAll("|","\\|"):e}fileName(){return j5(this.path).replace(".md","")}},Qx=class{constructor(e){ae(this,"$widget");this.$widget=e}},C1=class extends Qx{constructor(t,n){super("dataview:list-pair");ae(this,"key");ae(this,"value");this.key=t,this.value=n}markdown(){return`${Kx.toString(this.key)}: ${Kx.toString(this.value)}`}},x1=class extends Qx{constructor(t,n){super("dataview:external-link");ae(this,"url");ae(this,"display");this.url=t,this.display=n}markdown(){return`[${this.display??this.url}](${this.url})`}},Y5;(function(r){function e(s,a){return new C1(s,a)}r.listPair=e;function t(s,a){return new x1(s,a)}r.externalLink=t;function n(s){return s.$widget==="dataview:list-pair"}r.isListPair=n;function i(s){return s.$widget==="dataview:external-link"}r.isExternalLink=i;function o(s){return n(s)||i(s)}r.isBuiltin=o})(Y5||(Y5={}));var Qr;(function(r){function e(f){return{type:"variable",name:f}}r.variable=e;function t(f){return{type:"literal",value:f}}r.literal=t;function n(f,p,m){return{type:"binaryop",left:f,op:p,right:m}}r.binaryOp=n;function i(f,p){return{type:"index",object:f,index:p}}r.index=i;function o(f){let p=f.split("."),m=r.variable(p[0]);for(let v=1;v<p.length;v++)m=r.index(m,r.literal(p[v]));return m}r.indexVariable=o;function s(f,p){return{type:"lambda",arguments:f,value:p}}r.lambda=s;function a(f,p){return{type:"function",func:f,arguments:p}}r.func=a;function l(f){return{type:"list",values:f}}r.list=l;function c(f){return{type:"object",values:f}}r.object=c;function u(f){return{type:"negated",child:f}}r.negate=u;function d(f){return f=="<="||f=="<"||f==">"||f==">="||f=="!="||f=="="}r.isCompareOp=d,r.NULL=r.literal(null)})(Qr||(Qr={}));var Bl;(function(r){function e(u){return{type:"tag",tag:u}}r.tag=e;function t(u){return{type:"csv",path:u}}r.csv=t;function n(u){return{type:"folder",folder:u}}r.folder=n;function i(u,d){return{type:"link",file:u,direction:d?"incoming":"outgoing"}}r.link=i;function o(u,d,f){return{type:"binaryop",left:u,op:d,right:f}}r.binaryOp=o;function s(u,d){return{type:"binaryop",left:u,op:"&",right:d}}r.and=s;function a(u,d){return{type:"binaryop",left:u,op:"|",right:d}}r.or=a;function l(u){return{type:"negate",child:u}}r.negate=l;function c(){return{type:"empty"}}r.empty=c})(Bl||(Bl={}));var K5=new RegExp(M1(),""),E1={year:Qe.fromObject({years:1}),years:Qe.fromObject({years:1}),yr:Qe.fromObject({years:1}),yrs:Qe.fromObject({years:1}),month:Qe.fromObject({months:1}),months:Qe.fromObject({months:1}),mo:Qe.fromObject({months:1}),mos:Qe.fromObject({months:1}),week:Qe.fromObject({weeks:1}),weeks:Qe.fromObject({weeks:1}),wk:Qe.fromObject({weeks:1}),wks:Qe.fromObject({weeks:1}),w:Qe.fromObject({weeks:1}),day:Qe.fromObject({days:1}),days:Qe.fromObject({days:1}),d:Qe.fromObject({days:1}),hour:Qe.fromObject({hours:1}),hours:Qe.fromObject({hours:1}),hr:Qe.fromObject({hours:1}),hrs:Qe.fromObject({hours:1}),h:Qe.fromObject({hours:1}),minute:Qe.fromObject({minutes:1}),minutes:Qe.fromObject({minutes:1}),min:Qe.fromObject({minutes:1}),mins:Qe.fromObject({minutes:1}),m:Qe.fromObject({minutes:1}),second:Qe.fromObject({seconds:1}),seconds:Qe.fromObject({seconds:1}),sec:Qe.fromObject({seconds:1}),secs:Qe.fromObject({seconds:1}),s:Qe.fromObject({seconds:1})},T1={now:()=>At.local(),today:()=>At.local().startOf("day"),yesterday:()=>At.local().startOf("day").minus(Qe.fromObject({days:1})),tomorrow:()=>At.local().startOf("day").plus(Qe.fromObject({days:1})),sow:()=>At.local().startOf("week"),"start-of-week":()=>At.local().startOf("week"),eow:()=>At.local().endOf("week"),"end-of-week":()=>At.local().endOf("week"),soy:()=>At.local().startOf("year"),"start-of-year":()=>At.local().startOf("year"),eoy:()=>At.local().endOf("year"),"end-of-year":()=>At.local().endOf("year"),som:()=>At.local().startOf("month"),"start-of-month":()=>At.local().startOf("month"),eom:()=>At.local().endOf("month"),"end-of-month":()=>At.local().endOf("month")},_1=["FROM","WHERE","LIMIT","GROUP","FLATTEN"];function Kge(r){let e=-1;for(;(e=r.indexOf("|",e+1))>=0;)if(!(e>0&&r[e-1]=="\\"))return[r.substring(0,e).replace(/\\\|/g,"|"),r.substring(e+1)];return[r.replace(/\\\|/g,"|"),void 0]}function Qge(r){let[e,t]=Kge(r);return tD.infer(e,!1,t)}function Hx(r,e,t){return M.seqMap(r,M.seq(M.optWhitespace,e,M.optWhitespace,r).many(),(n,i)=>{if(i.length==0)return n;let o=t(n,i[0][1],i[0][3]);for(let s=1;s<i.length;s++)o=t(o,i[s][1],i[s][3]);return o})}function Xge(r,...e){return M.custom((t,n)=>(i,o)=>{let s=r._(i,o);if(!s.status)return s;for(let a of e){let l=a(s.value)._(i,s.index);if(!l.status)return s;s=l}return s})}var Ga=M.createLanguage({number:r=>M.regexp(/-?[0-9]+(\.[0-9]+)?/).map(e=>Number.parseFloat(e)).desc("number"),string:r=>M.string('"').then(M.alt(r.escapeCharacter,M.noneOf('"\\')).atLeast(0).map(e=>e.join(""))).skip(M.string('"')).desc("string"),escapeCharacter:r=>M.string("\\").then(M.any).map(e=>e==='"'?'"':e==="\\"?"\\":"\\"+e),bool:r=>M.regexp(/true|false|True|False/).map(e=>e.toLowerCase()=="true").desc("boolean ('true' or 'false')"),tag:r=>M.seqMap(M.string("#"),M.alt(M.regexp(/[^\u2000-\u206F\u2E00-\u2E7F'!"#$%&()*+,.:;<=>?@^`{|}~\[\]\\\s]/).desc("text")).many(),(e,t)=>e+t.join("")).desc("tag ('#hello/stuff')"),identifier:r=>M.seqMap(M.alt(M.regexp(/\p{Letter}/u),M.regexp(K5).desc("text")),M.alt(M.regexp(/[0-9\p{Letter}_-]/u),M.regexp(K5).desc("text")).many(),(e,t)=>e+t.join("")).desc("variable identifier"),link:r=>M.regexp(/\[\[([^\[\]]*?)\]\]/u,1).map(e=>Qge(e)).desc("file link"),embedLink:r=>M.seqMap(M.string("!").atMost(1),r.link,(e,t)=>(e.length>0&&(t.embed=!0),t)).desc("file link"),binaryPlusMinus:r=>M.regexp(/\+|-/).map(e=>e).desc("'+' or '-'"),binaryMulDiv:r=>M.regexp(/\*|\/|%/).map(e=>e).desc("'*' or '/' or '%'"),binaryCompareOp:r=>M.regexp(/>=|<=|!=|>|<|=/).map(e=>e).desc("'>=' or '<=' or '!=' or '=' or '>' or '<'"),binaryBooleanOp:r=>M.regexp(/and|or|&|\|/i).map(e=>e.toLowerCase()=="and"?"&":e.toLowerCase()=="or"?"|":e).desc("'and' or 'or'"),rootDate:r=>M.seqMap(M.regexp(/\d{4}/),M.string("-"),M.regexp(/\d{2}/),(e,t,n)=>At.fromObject({year:Number.parseInt(e),month:Number.parseInt(n)})).desc("date in format YYYY-MM[-DDTHH-MM-SS.MS]"),dateShorthand:r=>M.alt(...Object.keys(T1).sort((e,t)=>t.length-e.length).map(M.string)),date:r=>Xge(r.rootDate,e=>M.seqMap(M.string("-"),M.regexp(/\d{2}/),(t,n)=>e.set({day:Number.parseInt(n)})),e=>M.seqMap(M.string("T"),M.regexp(/\d{2}/),(t,n)=>e.set({hour:Number.parseInt(n)})),e=>M.seqMap(M.string(":"),M.regexp(/\d{2}/),(t,n)=>e.set({minute:Number.parseInt(n)})),e=>M.seqMap(M.string(":"),M.regexp(/\d{2}/),(t,n)=>e.set({second:Number.parseInt(n)})),e=>M.alt(M.seqMap(M.string("."),M.regexp(/\d{3}/),(t,n)=>e.set({millisecond:Number.parseInt(n)})),M.succeed(e)),e=>M.alt(M.seqMap(M.string("+").or(M.string("-")),M.regexp(/\d{1,2}(:\d{2})?/),(t,n)=>e.setZone("UTC"+t+n,{keepLocalTime:!0})),M.seqMap(M.string("Z"),()=>e.setZone("utc",{keepLocalTime:!0})),M.seqMap(M.string("["),M.regexp(/[0-9A-Za-z+-\/]+/u),M.string("]"),(t,n,i)=>e.setZone(n,{keepLocalTime:!0})))).assert(e=>e.isValid,"valid date").desc("date in format YYYY-MM[-DDTHH-MM-SS.MS]"),datePlus:r=>M.alt(r.dateShorthand.map(e=>T1[e]()),r.date).desc("date in format YYYY-MM[-DDTHH-MM-SS.MS] or in shorthand"),durationType:r=>M.alt(...Object.keys(E1).sort((e,t)=>t.length-e.length).map(M.string)),duration:r=>M.seqMap(r.number,M.optWhitespace,r.durationType,(e,t,n)=>E1[n].mapUnits(i=>i*e)).sepBy1(M.string(",").trim(M.optWhitespace).or(M.optWhitespace)).map(e=>e.reduce((t,n)=>t.plus(n))).desc("duration like 4hr2min"),rawNull:r=>M.string("null"),tagSource:r=>r.tag.map(e=>Bl.tag(e)),csvSource:r=>M.seqMap(M.string("csv(").skip(M.optWhitespace),r.string,M.string(")"),(e,t,n)=>Bl.csv(t)),linkIncomingSource:r=>r.link.map(e=>Bl.link(e.path,!0)),linkOutgoingSource:r=>M.seqMap(M.string("outgoing(").skip(M.optWhitespace),r.link,M.string(")"),(e,t,n)=>Bl.link(t.path,!1)),folderSource:r=>r.string.map(e=>Bl.folder(e)),parensSource:r=>M.seqMap(M.string("("),M.optWhitespace,r.source,M.optWhitespace,M.string(")"),(e,t,n,i,o)=>n),negateSource:r=>M.seqMap(M.alt(M.string("-"),M.string("!")),r.atomSource,(e,t)=>Bl.negate(t)),atomSource:r=>M.alt(r.parensSource,r.negateSource,r.linkOutgoingSource,r.linkIncomingSource,r.folderSource,r.tagSource,r.csvSource),binaryOpSource:r=>Hx(r.atomSource,r.binaryBooleanOp.map(e=>e),Bl.binaryOp),source:r=>r.binaryOpSource,variableField:r=>r.identifier.chain(e=>_1.includes(e.toUpperCase())?M.fail("Variable fields cannot be a keyword ("+_1.join(" or ")+")"):M.succeed(Qr.variable(e))).desc("variable"),numberField:r=>r.number.map(e=>Qr.literal(e)).desc("number"),stringField:r=>r.string.map(e=>Qr.literal(e)).desc("string"),boolField:r=>r.bool.map(e=>Qr.literal(e)).desc("boolean"),dateField:r=>M.seqMap(M.string("date("),M.optWhitespace,r.datePlus,M.optWhitespace,M.string(")"),(e,t,n,i,o)=>Qr.literal(n)).desc("date"),durationField:r=>M.seqMap(M.string("dur("),M.optWhitespace,r.duration,M.optWhitespace,M.string(")"),(e,t,n,i,o)=>Qr.literal(n)).desc("duration"),nullField:r=>r.rawNull.map(e=>Qr.NULL),linkField:r=>r.link.map(e=>Qr.literal(e)),listField:r=>r.field.sepBy(M.string(",").trim(M.optWhitespace)).wrap(M.string("[").skip(M.optWhitespace),M.optWhitespace.then(M.string("]"))).map(e=>Qr.list(e)).desc("list ('[1, 2, 3]')"),objectField:r=>M.seqMap(r.identifier.or(r.string),M.string(":").trim(M.optWhitespace),r.field,(e,t,n)=>({name:e,value:n})).sepBy(M.string(",").trim(M.optWhitespace)).wrap(M.string("{").skip(M.optWhitespace),M.optWhitespace.then(M.string("}"))).map(e=>{let t={};for(let n of e)t[n.name]=n.value;return Qr.object(t)}).desc("object ('{ a: 1, b: 2 }')"),atomInlineField:r=>M.alt(r.date,r.duration.map(e=>K8(e)),r.string,r.tag,r.embedLink,r.bool,r.number,r.rawNull),inlineFieldList:r=>r.atomInlineField.sepBy(M.string(",").trim(M.optWhitespace).lookahead(r.atomInlineField)),inlineField:r=>M.alt(M.seqMap(r.atomInlineField,M.string(",").trim(M.optWhitespace),r.inlineFieldList,(e,t,n)=>[e].concat(n)),r.atomInlineField),atomField:r=>M.alt(r.embedLink.map(e=>Qr.literal(e)),r.negatedField,r.linkField,r.listField,r.objectField,r.lambdaField,r.parensField,r.boolField,r.numberField,r.stringField,r.dateField,r.durationField,r.nullField,r.variableField),indexField:r=>M.seqMap(r.atomField,M.alt(r.dotPostfix,r.indexPostfix,r.functionPostfix).many(),(e,t)=>{let n=e;for(let i of t)switch(i.type){case"dot":n=Qr.index(n,Qr.literal(i.field));break;case"index":n=Qr.index(n,i.field);break;case"function":n=Qr.func(n,i.fields);break}return n}),negatedField:r=>M.seqMap(M.string("!"),r.indexField,(e,t)=>Qr.negate(t)).desc("negated field"),parensField:r=>M.seqMap(M.string("("),M.optWhitespace,r.field,M.optWhitespace,M.string(")"),(e,t,n,i,o)=>n),lambdaField:r=>M.seqMap(r.identifier.sepBy(M.string(",").trim(M.optWhitespace)).wrap(M.string("(").trim(M.optWhitespace),M.string(")").trim(M.optWhitespace)),M.string("=>").trim(M.optWhitespace),r.field,(e,t,n)=>({type:"lambda",arguments:e,value:n})),dotPostfix:r=>M.seqMap(M.string("."),r.identifier,(e,t)=>({type:"dot",field:t})),indexPostfix:r=>M.seqMap(M.string("["),M.optWhitespace,r.field,M.optWhitespace,M.string("]"),(e,t,n,i,o)=>({type:"index",field:n})),functionPostfix:r=>M.seqMap(M.string("("),M.optWhitespace,r.field.sepBy(M.string(",").trim(M.optWhitespace)),M.optWhitespace,M.string(")"),(e,t,n,i,o)=>({type:"function",fields:n})),binaryMulDivField:r=>Hx(r.indexField,r.binaryMulDiv,Qr.binaryOp),binaryPlusMinusField:r=>Hx(r.binaryMulDivField,r.binaryPlusMinus,Qr.binaryOp),binaryCompareField:r=>Hx(r.binaryPlusMinusField,r.binaryCompareOp,Qr.binaryOp),binaryBooleanField:r=>Hx(r.binaryCompareField,r.binaryBooleanOp,Qr.binaryOp),binaryOpField:r=>r.binaryBooleanField,field:r=>r.binaryOpField});function Zge(r){try{return JS.success(Ga.field.tryParse(r))}catch(e){return JS.failure(""+e)}}var rD;(function(r){function e(n,i){return{name:n,field:i}}r.named=e;function t(n,i){return{field:n,direction:i}}r.sortBy=t})(rD||(rD={}));function Jge(r){return M.custom((e,t)=>(n,i)=>{let o=r._(n,i);return o.status?Object.assign({},o,{value:[o.value,n.substring(i,o.index)]}):o})}function eve(r){return r.split(/[\r\n]+/).map(e=>e.trim()).join("")}function Q5(r,e){return M.eof.map(r).or(M.whitespace.then(e))}var Q8=M.createLanguage({queryType:r=>M.alt(M.regexp(/TABLE|LIST|TASK|CALENDAR/i)).map(e=>e.toLowerCase()).desc("query type ('TABLE', 'LIST', 'TASK', or 'CALENDAR')"),explicitNamedField:r=>M.seqMap(Ga.field.skip(M.whitespace),M.regexp(/AS/i).skip(M.whitespace),Ga.identifier.or(Ga.string),(e,t,n)=>rD.named(n,e)),comment:()=>M.Parser((r,e)=>{let t=r.substring(e);if(!t.startsWith("//"))return M.makeFailure(e,"Not a comment");t=t.split(`
|
||
`)[0];let n=t.substring(2).trim();return M.makeSuccess(e+t.length,n)}),namedField:r=>M.alt(r.explicitNamedField,Jge(Ga.field).map(([e,t])=>rD.named(eve(t),e))),sortField:r=>M.seqMap(Ga.field.skip(M.optWhitespace),M.regexp(/ASCENDING|DESCENDING|ASC|DESC/i).atMost(1),(e,t)=>{let n=t.length==0?"ascending":t[0].toLowerCase();return n=="desc"&&(n="descending"),n=="asc"&&(n="ascending"),{field:e,direction:n}}),headerClause:r=>r.queryType.chain(e=>{switch(e){case"table":return Q5(()=>({type:e,fields:[],showId:!0}),M.seqMap(M.regexp(/WITHOUT\s+ID/i).skip(M.optWhitespace).atMost(1),M.sepBy(r.namedField,M.string(",").trim(M.optWhitespace)),(t,n)=>({type:e,fields:n,showId:t.length==0})));case"list":return Q5(()=>({type:e,format:void 0,showId:!0}),M.seqMap(M.regexp(/WITHOUT\s+ID/i).skip(M.optWhitespace).atMost(1),Ga.field.atMost(1),(t,n)=>({type:e,format:n.length==1?n[0]:void 0,showId:t.length==0})));case"task":return M.succeed({type:e});case"calendar":return M.whitespace.then(M.seqMap(r.namedField,t=>({type:e,showId:!0,field:t})));default:return M.fail(`Unrecognized query type '${e}'`)}}).desc("TABLE or LIST or TASK or CALENDAR"),fromClause:r=>M.seqMap(M.regexp(/FROM/i),M.whitespace,Ga.source,(e,t,n)=>n),whereClause:r=>M.seqMap(M.regexp(/WHERE/i),M.whitespace,Ga.field,(e,t,n)=>({type:"where",clause:n})).desc("WHERE <expression>"),sortByClause:r=>M.seqMap(M.regexp(/SORT/i),M.whitespace,r.sortField.sepBy1(M.string(",").trim(M.optWhitespace)),(e,t,n)=>({type:"sort",fields:n})).desc("SORT field [ASC/DESC]"),limitClause:r=>M.seqMap(M.regexp(/LIMIT/i),M.whitespace,Ga.field,(e,t,n)=>({type:"limit",amount:n})).desc("LIMIT <value>"),flattenClause:r=>M.seqMap(M.regexp(/FLATTEN/i).skip(M.whitespace),r.namedField,(e,t)=>({type:"flatten",field:t})).desc("FLATTEN <value> [AS <name>]"),groupByClause:r=>M.seqMap(M.regexp(/GROUP BY/i).skip(M.whitespace),r.namedField,(e,t)=>({type:"group",field:t})).desc("GROUP BY <value> [AS <name>]"),clause:r=>M.alt(r.fromClause,r.whereClause,r.sortByClause,r.limitClause,r.groupByClause,r.flattenClause),query:r=>M.seqMap(r.headerClause.trim(o1),r.fromClause.trim(o1).atMost(1),r.clause.trim(o1).many(),(e,t,n)=>({header:e,source:t.length==0?Bl.folder(""):t[0],operations:n,settings:F1}))}),o1=M.alt(M.whitespace,Q8.comment).many().map(r=>r.join("")),tve=r=>r?r.plugins.plugins.dataview?.api:window.DataviewAPI,rve=r=>r.plugins.enabledPlugins.has("dataview");Ul.DATE_SHORTHANDS=T1;Ul.DURATION_TYPES=E1;Ul.EXPRESSION=Ga;Ul.KEYWORDS=_1;Ul.QUERY_LANGUAGE=Q8;Ul.getAPI=tve;Ul.isPluginEnabled=rve;Ul.parseField=Zge});function eE(r){if(!r.includes(",")){let o=r.trim();return o?[o]:[]}let e=[],t="",n=!1;for(let o=0;o<r.length;o++){let s=r[o],a=r[o+1];if(s==="["&&a==="["){n=!0,t+=s;continue}if(s==="]"&&a==="]"){n=!1,t+=s;continue}if(s===","&&!n){let l=t.trim();l&&e.push(l),t="";continue}t+=s}let i=t.trim();return i&&e.push(i),e}var R1=b(()=>{});function tE(r){return r.replace(/[\\"]/g,"\\$&")}function nve(r){return r.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function Z8(r){return tE(nve(r))}function aD(r){return typeof r=="object"&&r!==null&&"path"in r&&typeof r.path=="string"}var $1,rE,J8=b(()=>{$1=HN(X8());Me();R1();rE=class{static getDataviewAPI(e){let t=(0,$1.getAPI)(e);return t||(F.logMessage("Dataview plugin is not installed or enabled"),null)}static async getFieldValues(e,t){let n=new Set,i=this.getDataviewAPI(e);if(!i)return n;try{let s=`field("${tE(t)}")`,a=`TABLE ${s} WHERE ${s}`,l=await i.query(a);if(l.successful&&l.value.values)for(let c of l.value.values){let u=c[1];Array.isArray(u)?u.forEach(d=>{d&&typeof d=="string"?n.add(d.trim()):aD(d)?n.add(d.path):d&&typeof d!="object"&&n.add(String(d).trim())}):aD(u)?n.add(u.path):u&&typeof u=="string"?eE(u).forEach(d=>n.add(d)):u&&typeof u!="object"&&n.add(String(u).trim())}}catch(o){F.logError(new Error(`Failed to query Dataview for field ${t}: ${o}`))}return n}static async getFieldValuesWithFilter(e,t,n={}){let i=new Set,o=this.getDataviewAPI(e);if(!o)return i;try{let a=`field("${tE(t)}")`,l=[a],c=(n.folders?.length?n.folders:n.folder?[n.folder]:[]).map(v=>v.replace(/^\/+|\/+$/g,"")).filter(Boolean);if(c.length>0){let v=c.map(g=>`regexmatch("^${Z8(g)}/", file.path)`);l.push(`(${v.join(" OR ")})`)}n.tags&&n.tags.length>0&&n.tags.forEach(v=>{let g=v.startsWith("#")?v:`#${v}`;l.push(`contains(file.tags, "${tE(g)}")`)}),n.excludeFolders&&n.excludeFolders.length>0&&n.excludeFolders.forEach(v=>{let g=v.replace(/^\/+|\/+$/g,"");l.push(`!regexmatch("^${Z8(g)}/", file.path)`)}),n.excludeTags&&n.excludeTags.length>0&&n.excludeTags.forEach(v=>{let g=v.startsWith("#")?v:`#${v}`;l.push(`!contains(file.tags, "${tE(g)}")`)});let u=l.join(" AND "),d=`TABLE ${a} WHERE ${u}`,f=await o.query(d),p=n.excludeFiles??[],m=v=>{if(p.length===0)return!1;let g=v[0],y=g&&typeof g.path=="string"?g.path:null;if(!y)return!1;let w=y.split("/").pop()??y;return p.some(x=>x===y||x===w)};if(f.successful&&f.value.values)for(let v of f.value.values){if(m(v))continue;let g=v[1];Array.isArray(g)?g.forEach(y=>{y&&typeof y=="string"?i.add(y.trim()):aD(y)?i.add(y.path):y&&typeof y!="object"&&i.add(String(y).trim())}):aD(g)?i.add(g.path):g&&typeof g=="string"?eE(g).forEach(y=>i.add(y)):g&&typeof g!="object"&&i.add(String(g).trim())}}catch(s){F.logError(new Error(`Failed to query Dataview for field ${t} with filters: ${s}`))}return i}static isAvailable(e){return(0,$1.getAPI)(e)!==null}}});var Hc,lD=b(()=>{Hc=class r{constructor(){this.cache=new Map;this.TTL=300*1e3;this.MAX_CACHE_ENTRIES=100;this.MAX_VALUES_PER_ENTRY=1e3;this.cleanupInterval=null;this.revision=0}static getInstance(){return r.instance||(r.instance=new r),r.instance}startAutomaticCleanup(e){if(this.cleanupInterval===null&&typeof window<"u"){let t=window.setInterval(()=>{this.cleanExpired()},6e4);this.cleanupInterval=e(t)}}registerInvalidationListeners(e,t){let n=()=>this.clear();t(e.metadataCache.on("changed",n)),t(e.metadataCache.on("deleted",n)),t(e.vault.on("rename",n))}get(e,t){let n=this.makeKey(e,t),i=this.cache.get(n);return i?Date.now()-i.timestamp>this.TTL?(this.cache.delete(n),null):new Set(i.values):null}set(e,t,n){let i=this.makeKey(e,n),o=new Set,s=0;for(let a of t){if(s>=this.MAX_VALUES_PER_ENTRY)break;o.add(a),s++}this.cache.size>=this.MAX_CACHE_ENTRIES&&!this.cache.has(i)&&this.evictOldestEntries(1),this.cache.set(i,{values:o,timestamp:Date.now()})}getRevision(){return this.revision}setIfRevision(e,t,n,i){return this.revision!==i?!1:(this.set(e,t,n),!0)}evictOldestEntries(e){let t=Array.from(this.cache.entries()).sort(([,n],[,i])=>n.timestamp-i.timestamp).slice(0,e);for(let[n]of t)this.cache.delete(n)}clear(e){if(this.revision++,e){let t=[];for(let n of this.cache.keys())this.keyFieldName(n)===e&&t.push(n);for(let n of t)this.cache.delete(n)}else this.cache.clear()}cleanExpired(){let e=Date.now(),t=[];for(let[n,i]of this.cache.entries())e-i.timestamp>this.TTL&&t.push(n);for(let n of t)this.cache.delete(n)}getStats(){return{size:this.cache.size,maxSize:this.MAX_CACHE_ENTRIES,cleanupInterval:this.cleanupInterval}}destroy(){this.cleanupInterval=null,this.clear()}makeKey(e,t){return JSON.stringify([e,t||null])}keyFieldName(e){try{let t=JSON.parse(e);if(Array.isArray(t)&&typeof t[0]=="string")return t[0]}catch{}}}});var Pg,e9=b(()=>{Pg=class{static deduplicate(e,t={}){let{strategy:n="case-insensitive",preserveFirstOccurrence:i=!0,sortResult:o=!0}=t,s=e.length,a;switch(n){case"exact":a=this.deduplicateExact(e);break;case"case-sensitive":a=this.deduplicateCaseSensitive(e,i);break;default:a=this.deduplicateCaseInsensitive(e,i);break}return o&&(a=this.sortValues(a,n)),{values:a,duplicatesRemoved:s-a.length,strategy:n}}static deduplicateExact(e){return this.deduplicateWithSet(e)}static deduplicateCaseSensitive(e,t){if(t){let n=new Set;return e.filter(i=>n.has(i)?!1:(n.add(i),!0))}return this.deduplicateWithSet(e)}static deduplicateWithSet(e){return Array.from(new Set(e))}static deduplicateCaseInsensitive(e,t){let n=new Map;for(let i of e){let o=this.normalizeForComparison(i);n.has(o)&&t||n.set(o,i)}return Array.from(n.values())}static normalizeForComparison(e){return e.normalize("NFD").replace(/[\u0300-\u036f]/g,"").toLowerCase()}static sortValues(e,t){return e.sort((n,i)=>{if(t==="case-insensitive"){let o=n.toLowerCase(),s=i.toLowerCase();return o===s?this.getCasePriority(n)-this.getCasePriority(i):o.localeCompare(s)}return n.localeCompare(i)})}static getCasePriority(e){return e===e.toUpperCase()?3:e===e.toLowerCase()?2:e[0]===e[0].toUpperCase()?1:0}static analyzeVariations(e){let t=new Map;for(let o of e){let s=this.normalizeForComparison(o);t.has(s)||t.set(s,[]);let a=t.get(s);a&&a.push(o)}let n=0,i="";for(let[o,s]of t)s.length>n&&(n=s.length,i=o);return{totalValues:e.length,uniqueValues:t.size,caseVariations:t,mostCommonCase:i}}static getSuggestions(e,t,n=.8){let i=this.normalizeForComparison(e),o=[];for(let s of t){let a=this.normalizeForComparison(s);this.calculateSimilarity(i,a)>=n&&i!==a&&o.push(s)}return o.slice(0,5)}static calculateSimilarity(e,t){if(e.length===0)return t.length===0?1:0;if(t.length===0)return 0;let n=[];for(let o=0;o<=t.length;o++)n[o]=[o];for(let o=0;o<=e.length;o++)n[0][o]=o;for(let o=1;o<=t.length;o++)for(let s=1;s<=e.length;s++)t.charAt(o-1)===e.charAt(s-1)?n[o][s]=n[o-1][s-1]:n[o][s]=Math.min(n[o-1][s-1]+1,n[o][s-1]+1,n[o-1][s]+1);let i=Math.max(e.length,t.length);return 1-n[t.length][e.length]/i}}});var Ka,O1=b(()=>{Tt();e9();Ka=class{static processValues(e,t){let n=e.size,i=Array.from(e).filter(c=>!this.isUnresolvedFieldToken(c)),o={strategy:t.caseSensitive?"case-sensitive":"case-insensitive",preserveFirstOccurrence:!0,sortResult:!0},s=Pg.deduplicate(i,o);i=s.values;let{processedValues:a,hasDefault:l}=this.applyDefaultValues(i,t);return i=a,{values:i,hasDefaultValue:l,duplicatesRemoved:s.duplicatesRemoved,totalProcessed:n}}static isUnresolvedFieldToken(e){return this.unresolvedFieldTokenRegex.test(e.trim())}static applyDefaultValues(e,t){if(!t.defaultValue)return{processedValues:e,hasDefault:!1};let n=t.defaultValue,i=[...e],o=!1,s=a=>t.caseSensitive?a===n:this.normalizeForComparison(a)===this.normalizeForComparison(n);return t.defaultAlways?(i=i.filter(a=>!s(a)),i.unshift(n),o=!0):t.defaultEmpty&&e.length===0?(i=[n],o=!0):!t.defaultEmpty&&!t.defaultAlways&&(i.some(s)||(i.unshift(n),o=!0)),{processedValues:i,hasDefault:o}}static promoteValueToFront(e,t,n=!1){let i=o=>n?o===t:this.normalizeForComparison(o)===this.normalizeForComparison(t);return[t,...e.filter(o=>!i(o))]}static canonicalizeAgainst(e,t,n=!1){if(n)return t;let i=this.normalizeForComparison(t);return e.find(o=>this.normalizeForComparison(o)===i)??t}static normalizeForComparison(e){return e.normalize("NFD").replace(/[\u0300-\u036f]/g,"").toLowerCase()}static getSmartDefaults(e,t){let n={status:["To Do","In Progress","Done","Cancelled"],priority:["High","Medium","Low"],type:["Note","Task","Project","Reference"],category:["Personal","Work","Study"],mood:["\u{1F60A} Good","\u{1F610} Neutral","\u{1F614} Bad"],rating:["\u2B50","\u2B50\u2B50","\u2B50\u2B50\u2B50","\u2B50\u2B50\u2B50\u2B50","\u2B50\u2B50\u2B50\u2B50\u2B50"],progress:["0%","25%","50%","75%","100%"],difficulty:["Easy","Medium","Hard"],size:["Small","Medium","Large"]},i=e.toLowerCase();if(Object.prototype.hasOwnProperty.call(n,i))return n[i];for(let[o,s]of Object.entries(n))if(i.includes(o)||o.includes(i))return s;if(t.length>0){let o=new Map;for(let s of t)o.set(s,(o.get(s)||0)+1);return Array.from(o.entries()).sort((s,a)=>a[1]-s[1]).slice(0,5).map(([s])=>s)}return[]}static validateDefaultValue(e,t,n){let i=[],o=[];if(t.length>0){let l=Pg.analyzeVariations(t),c=e.toLowerCase();for(let[d,f]of l.caseVariations)if(d===c){f.includes(e)||(o.push(...f.slice(0,3)),i.push(`Consider using existing case: ${f[0]}`));break}let u=Pg.getSuggestions(e,t,.8);u.length>0&&(o.push(...u),i.push(`Similar existing values found: ${u.slice(0,3).join(", ")}`))}let a=this.getSmartDefaults(n,t);return a.length>0&&!a.includes(e)&&(a.map(c=>c.toLowerCase()).includes(e.toLowerCase())||(o.push(...a.slice(0,3)),i.push(`Consider common values for ${n}: ${a.slice(0,3).join(", ")}`))),{isValid:!0,suggestions:[...new Set(o)],warnings:i}}};Ka.unresolvedFieldTokenRegex=new RegExp(`^${_T.source}$`,"i")});var jc,Fg,N1=b(()=>{R1();jc=class jc{static parseInlineFields(e,t){let n=new Map,i=this.removeCodeBlocksAndFrontmatter(e,t),o;for(;(o=jc.INLINE_FIELD_REGEX.exec(i))!==null;){let s=o[1].trim(),a=o[2].trim();if(a){n.has(s)||n.set(s,new Set);for(let l of eE(a))n.get(s)?.add(l)}}return jc.INLINE_FIELD_REGEX.lastIndex=0,n}static removeCodeBlocksAndFrontmatter(e,t){return e=e.replace(this.FRONTMATTER_REGEX,""),e=this.filterFencedCodeBlocks(e,t?.includeCodeBlocks),e.replace(this.INLINE_CODE_SPAN_REGEX,"")}static filterFencedCodeBlocks(e,t){if(!e.includes("```"))return e;let n=new Set((t??[]).map(u=>u.trim().toLowerCase()).filter(u=>u.length>0)),i=e.split(`
|
||
`),o=[],s=!1,a=0,l="",c=[];for(let u of i){if(!s){let d=this.matchFenceOpen(u);d?(s=!0,a=d.length,l=d.info,c=[u]):o.push(u);continue}if(this.matchFenceClose(u,a)){let d=l.trim().split(/\s+/)[0]?.toLowerCase();if(n.size>0&&d!==void 0&&d.length>0&&n.has(d))for(let p=1;p<c.length;p++)o.push(c[p]);s=!1,c=[]}else c.push(u)}if(s)for(let u of c)o.push(u);return o.join(`
|
||
`)}static matchFenceOpen(e){let t=this.FENCE_OPEN_REGEX.exec(this.stripTrailingCarriage(e));return t?{length:t[1].length,info:t[2]}:null}static matchFenceClose(e,t){let n=this.FENCE_CLOSE_REGEX.exec(this.stripTrailingCarriage(e));return n!==null&&n[1].length>=t}static stripTrailingCarriage(e){return e.endsWith("\r")?e.slice(0,-1):e}static getFieldValues(e,t,n){return this.parseInlineFields(e,n).get(t)||new Set}};jc.INLINE_FIELD_REGEX=/(?:^|[\n\r])(?![ \t]*[-*+][ \t]+\[[ xX]\])([^:\n\r]+?)::[ \t]*(.*)$/gmu,jc.FRONTMATTER_REGEX=/^---\r?\n[\s\S]*?\r?\n---\r?\n/,jc.INLINE_CODE_SPAN_REGEX=/`[^`]*`/g,jc.FENCE_OPEN_REGEX=/^[ \t]*(`{3,})([^`]*)$/,jc.FENCE_CLOSE_REGEX=/^[ \t]*(`{3,})[ \t]*$/;Fg=jc});function L1(r){let e=[];return r.folder&&e.push(`folder:${r.folder}`),r.folders?.length&&e.push(`folders:${r.folders.join(",")}`),r.tags&&e.push(`tags:${r.tags.join(",")}`),r.inline&&e.push("inline:true"),r.inlineCodeBlocks?.length&&e.push(`inline-code-blocks:${r.inlineCodeBlocks.join(",")}`),r.caseSensitive&&e.push("case-sensitive:true"),r.excludeFolders&&e.push(`exclude-folders:${r.excludeFolders.join(",")}`),r.excludeTags&&e.push(`exclude-tags:${r.excludeTags.join(",")}`),r.excludeFiles&&e.push(`exclude-files:${r.excludeFiles.join(",")}`),r.defaultValue&&e.push(`default:${r.defaultValue}`),r.defaultEmpty&&e.push("default-empty:true"),r.defaultAlways&&e.push("default-always:true"),e.join("|")}async function t9(r,e,t){let n=await n9(r,e,t);return Ka.processValues(n,t).values}async function r9(r,e,t){let n=await n9(r,e,t),i=Ka.processValues(n,t);return{values:i.values,hasDefaultValue:i.hasDefaultValue}}async function n9(r,e,t){let n=Hc.getInstance(),i=L1(t),o=n.get(e,i);if(o)return o;let s=n.getRevision(),a=await B1(r,e,t);return n.setIfRevision(e,a,i,s),a}async function B1(r,e,t){let n=e.trim().toLowerCase();if(n==="tags"||n==="tag"){let i=await ive(r,t);if(i.size>0)return i}try{if(!t.inline&&rE.isAvailable(r)){let i=await rE.getFieldValuesWithFilter(r,e,t);if(i.size>0)return i}}catch{}return await ave(r,e,t)}async function ive(r,e){if(!(!!e.folder||!!e.folders?.length||!!e.tags?.length||!!e.excludeFolders?.length||!!e.excludeTags?.length||!!e.excludeFiles?.length)){let n=ove(r);if(n.size>0)return n}return await sve(r,e)}function ove(r){let e=new Set;try{let t=r.metadataCache.getTags?.();if(!t)return e;for(let n of Object.keys(t)){let o=(n.startsWith("#")?n.substring(1):n).trim();o&&e.add(o)}}catch{}return e}async function sve(r,e){let t=new Set,n=r.vault.getMarkdownFiles();n=zi.filterFiles(n,e,o=>r.metadataCache.getFileCache(o));let i=50;for(let o=0;o<n.length;o+=i){let a=n.slice(o,o+i).map(async c=>{let u=new Set;try{let d=r.metadataCache.getFileCache(c),f=d?.frontmatter?.tags;if(f!=null){let m=Array.isArray(f)?f:[f];for(let v of m){let g=String(v).trim();g&&u.add(g)}}let p=d?.frontmatter?.tag;if(p!=null){let m=Array.isArray(p)?p:[p];for(let v of m){let g=String(v).trim();g&&u.add(g)}}if(d?.tags)for(let m of d.tags){let v=String(m.tag??"").trim(),g=v.startsWith("#")?v.substring(1):v;g&&u.add(g)}}catch{}return u}),l=await Promise.all(a);for(let c of l)for(let u of c)t.add(u)}return t}async function ave(r,e,t){let n=new Set,i=r.vault.getMarkdownFiles();i=zi.filterFiles(i,t,s=>r.metadataCache.getFileCache(s));let o=50;for(let s=0;s<i.length;s+=o){let l=i.slice(s,s+o).map(async u=>{let d=new Set;try{let p=r.metadataCache.getFileCache(u)?.frontmatter?.[e];if(p!=null){if(Array.isArray(p))p.forEach(m=>{let v=String(m).trim();v&&d.add(v)});else if(typeof p!="object"){let m=String(p).trim();m&&d.add(m)}}if(t.inline)try{let m=await r.vault.read(u);Fg.getFieldValues(m,e,{includeCodeBlocks:t.inlineCodeBlocks}).forEach(g=>{let y=String(g).trim();y&&d.add(y)})}catch{}}catch{}return d}),c=await Promise.all(l);for(let u of c)for(let d of u)n.add(d)}return n}var U1=b(()=>{J8();ip();lD();O1();N1()});function lve(r,e){let t=e.trim();if(!t||!r)return null;let n=r[t];if(n===void 0){let i=t.toLowerCase(),o=Object.keys(r).find(s=>s.toLowerCase()===i);o!==void 0&&(n=r[o])}if(n==null)return null;if(Array.isArray(n)){let i=[];for(let o of n){let s=i9(o);s!==null&&i.push(s)}return i.length>0?i:null}return i9(n)}function cD(r,e,t){if(!e||e.extension!=="md")return null;let n=r.metadataCache.getFileCache(e)?.frontmatter;return lve(n,t)}function i9(r){if(r==null)return null;let e=typeof r;if(e==="string"||e==="number"||e==="boolean"){let t=String(r).trim();return t.length>0?t:null}return null}var V1=b(()=>{});function nE(r){return r.replace(cve," ").replace(/\s+/g," ").trim()}function o9(r){return!(r.trim()===""||/^( {4,}|\t)/.test(r)||/^ {0,3}#{1,6}[ \t]/.test(r)||/^ {0,3}(`{3,}|~{3,})/.test(r)||/^ {0,3}>/.test(r)||/^ {0,3}([-*+]|\d{1,9}[.)])[ \t]/.test(r)||/^ {0,3}(=+|-+)\s*$/.test(r)||/^ {0,3}([*_-])([ \t]*\1){2,}[ \t]*$/.test(r))}function s9(r){let e=[],t=!1,n="",i=0;for(let o=0;o<r.length;o++){let s=r[o];if(o===0&&/^---\s*$/.test(s)){let c=o+1;for(;c<r.length&&!/^---\s*$/.test(r[c]);)c++;o=c;continue}if(t){let c=s.match(/^ {0,3}(`{3,}|~{3,})\s*$/);c&&c[1][0]===n&&c[1].length>=i&&(t=!1,n="",i=0);continue}else{let c=s.match(/^ {0,3}(`{3,}|~{3,})/);if(c){t=!0,n=c[1][0],i=c[1].length;continue}}let a=s.match(/^ {0,3}(#{1,6})[ \t]+(.*)$/);if(a){e.push({heading:a[2],level:a[1].length,line:o});continue}let l=s.match(/^ {0,3}(=+|-+)\s*$/);if(l&&o>0){let c=r[o-1],u=e.length>0&&e[e.length-1].line===o-1,d=o<2||!o9(r[o-2]);!u&&d&&o9(c)&&e.push({heading:c.trim(),level:l[1][0]==="="?1:2,line:o-1});continue}}return e}function uve(r,e){let t=[],n=nE(r[e].heading);n&&t.push(n);let i=r[e].level;for(let o=e-1;o>=0&&i>1;o--)if(r[o].level<i){i=r[o].level;let s=nE(r[o].heading);s&&t.unshift(s)}return t}function a9(r,e){if(r.length===0)return null;let t=-1;for(let u=0;u<r.length&&r[u].line<=e;u++)t=u;if(t===-1)return null;let n=nE(r[t].heading);if(!n)return null;let i=n.toLowerCase();if(!r.some((u,d)=>d!==t&&nE(u.heading).toLowerCase()===i))return`#${n}`;let s=uve(r,t);if(s.length<2)return null;let a=s.join("#"),l=a.toLowerCase();return dve(r).some((u,d)=>d!==t&&u===l)?null:`#${a}`}function dve(r){let e=new Array(r.length),t=[];for(let n=0;n<r.length;n++){for(;t.length>0&&r[t[t.length-1]].level>=r[n].level;)t.pop();let i=t.length>0?e[t[t.length-1]]:[],o=nE(r[n].heading);e[n]=o?[...i,o]:i,t.push(n)}return e.map(n=>n.join("#").toLowerCase())}var cve,l9=b(()=>{cve=/[!"#$%&()*+,.:;<=>?@^`{|}~/[\]\\\r\n]/g});function md(r,{logPrefix:e,noticePrefix:t=e,defaultReason:n}){if(!(r instanceof Nt))return!1;let i=typeof r.message=="string"&&r.message.trim().length>0?r.message:n;return F.logMessage(`${e}: ${i}`),(!(r instanceof St||typeof r.message=="string"&&r.message.toLowerCase().includes("cancelled by user"))||le.getState().showInputCancellationNotification)&&new c9.Notice(`${t}: ${i}`),!0}var c9,iE=b(()=>{c9=require("obsidian");Ns();zr();It();Me()});var u9={};Jr(u9,{SingleMacroEngine:()=>q1});function fve(r){if(r==null)return"";if(typeof r=="string")return r;if(typeof r=="number"||typeof r=="boolean")return String(r);if(typeof r=="bigint"||typeof r=="symbol")return r.toString();if(r instanceof Error)return r.message;try{return JSON.stringify(r)}catch{return Object.prototype.toString.call(r)}}var pve,q1,d9=b(()=>{Me();Kr();qt();Wt();wk();Bc();oE();iE();Ii();Ns();pve=new Set(["settings","entry","quickadd"]);q1=class{constructor(e,t,n,i,o){this.app=e;this.plugin=t;this.choices=n;this.emittedConflictNotice=!1;this.choiceExecutor=i,o?(this.variables=o,this.choiceExecutor.variables=o):i.variables?this.variables=i.variables:(this.variables=new Map,this.choiceExecutor.variables=this.variables)}async runAndGetOutput(e,t){this.emittedConflictNotice=!1;let{basename:n,memberAccess:i}=np(e),o=c=>(c??"").trim(),s=Un(this.choices).find(c=>c.type==="Macro"&&o(c.name)===o(n));if(!s){let c=d=>o(d).toLowerCase(),u=Un(this.choices).filter(d=>d.type==="Macro"&&c(d.name)===c(n));if(u.length>1)throw F.logError(`Ambiguous macro reference '${e}'. Multiple choices match when ignoring case.`),new Error(`Ambiguous macro reference '${e}'. Please disambiguate by renaming macros.`);s=u[0]}if(!s)throw F.logError(`macro '${e}' does not exist.`),new Error(`macro '${e}' does not exist.`);let a=new Vl(this.app,this.plugin,s,this.choiceExecutor,this.variables,void 0,t?.label);if(i?.length){let c=await this.tryExecuteExport(a,s,i);if(this.ensureNotAborted(),c.executed)return this.formatResult(c.result)}await a.run(),this.ensureNotAborted();let l=a.getOutput();if(i?.length){let c=this.resolveMemberAccess(l,i);c.found||F.logWarning(`Macro '${s.name}' was asked for member '${i.join("::")}', but it has no user script exporting it; the result is empty.`),l=c.value}return typeof l=="function"?l=await l():l&&typeof l=="object"&&(l=JSON.stringify(l)),fve(l)}getVariables(){return this.variables}async tryExecuteExport(e,t,n){let i=Dr(t.macro?.commands);if(!i.length)return{executed:!1};let o=i.map((c,u)=>({command:c,index:u})).filter(c=>Si(c.command)&&c.command.type==="UserScript");if(o.length===0)return{executed:!1};let s=await this.selectUserScriptCandidate(t,o,n),a=s.candidate.command.id,l=i.slice(0,s.candidate.index);try{l.length&&(await e.runSubset(l),this.ensureNotAborted());let c=t.macro?.commands,u=hx(c)?c:i,d;a!==void 0?d=u.findIndex(C=>Si(C)&&C.id===a&&C.type==="UserScript"):d=s.candidate.index;let f=d>=0?u[d]:void 0;if(!f||f.type!=="UserScript")throw new Nt(`Could not resolve the member-access script for '${t.name}'.`);let p=f;p.settings||(p.settings={});let m=s.candidate.exportsRef!==void 0?s.candidate.exportsRef:await ka(p,this.app);if(m==null)throw new Nt(`Macro '${t.name}' could not load '${p.name}' for member access.`);let v=typeof m=="object"||typeof m=="function"?m.settings:void 0;v&&typeof v=="object"&&Lh(p.settings,v);let g=s.candidate.resolvedMember??this.resolveMemberAccess(m,s.memberAccess);if(!g.found)throw new Nt(`Macro '${t.name}' routes member access to '${p.name}', but that script does not export '${s.memberAccess.join("::")}'.`);let y=u.slice(d+1),w=p.settings;typeof g.value=="function"&&(await Oh(this.app,p,v&&typeof v=="object"?v:void 0)&&await this.plugin.saveSettings?.(),w=await yk(this.app,p,v&&typeof v=="object"?v:void 0));let x=await this.executeResolvedMember(g.value,e,w);return this.ensureNotAborted(),e.setOutput(x),this.syncVariablesFromParams(e),y.length&&(await e.runSubset(y),this.ensureNotAborted()),{executed:!0,result:x}}catch(c){throw md(c,{logPrefix:"Macro execution aborted",noticePrefix:"Macro execution aborted",defaultReason:"Macro execution aborted"})&&this.choiceExecutor.signalAbort?.(c),c}}resolveMemberAccess(e,t){let n=e;for(let i of t){if(n==null||typeof n!="object"&&typeof n!="function")return{found:!1};let o=n;if(!(i in o))return{found:!1};n=o[i]}return{found:!0,value:n}}async executeResolvedMember(e,t,n){return typeof e=="function"?await e(t.params,n):e}async selectUserScriptCandidate(e,t,n){if(t.length===1)return{candidate:{command:t[0].command,index:t[0].index},memberAccess:n};let i=this.resolveScriptSelector(e,t,n);if(i)return{candidate:{command:i.command,index:i.index},memberAccess:i.memberAccess};let o=[];for(let l of t){let c=await ka(l.command,this.app);o.push({command:l.command,index:l.index,exportsRef:c,resolvedMember:this.resolveMemberAccess(c,n)})}let s=o.filter(l=>l.resolvedMember.found);if(s.length===1)return{candidate:s[0],memberAccess:n};if(s.length===0)throw new Nt(`Macro '${e.name}' could not find '${n.join("::")}' in any user script.`);if(pve.has(n[0])){let l=s[0];return this.warnReservedKeyConflict(e,n,l,s),{candidate:l,memberAccess:n}}let a=s.map(l=>`'${l.command.name}'`).join(", ");throw new Nt(`Macro '${e.name}' has multiple user scripts exporting '${n.join("::")}': ${a}. Disambiguate with '{{MACRO:${e.name}::<Script Name>::${n.join("::")}}}'.`)}warnReservedKeyConflict(e,t,n,i){if(this.emittedConflictNotice)return;this.emittedConflictNotice=!0;let o=i.map(s=>`'${s.command.name}'`).join(", ");F.logWarning(`Macro '${e.name}': multiple user scripts export '${t.join("::")}' (${o}); using '${n.command.name}'. Disambiguate with '{{MACRO:${e.name}::<Script Name>::${t.join("::")}}}'.`)}resolveScriptSelector(e,t,n){if(n.length<2)return null;let i=n[0]?.trim(),o=t.filter(s=>s.command.name.trim()===i);if(o.length===0)return null;if(o.length>1)throw new Nt(`Macro '${e.name}' has multiple user scripts named '${i}'. Rename one of them before using '{{MACRO:${e.name}::${i}::${n.slice(1).join("::")}}}'.`);return{command:o[0].command,index:o[0].index,memberAccess:n.slice(1)}}syncVariablesFromParams(e){Object.keys(e.params.variables).forEach(t=>{this.choiceExecutor.variables.set(t,e.params.variables[t])})}formatResult(e){if(e==null)return"";if(typeof e=="string")return e;if(typeof e=="number"||typeof e=="boolean"||typeof e=="bigint")return e.toString();if(typeof e=="object")try{return JSON.stringify(e)}catch{return Object.prototype.toString.call(e)}return String(e)}ensureNotAborted(){let e=this.choiceExecutor.consumeAbortSignal?.();if(e)throw e}}});var sE,Mg,W1=b(()=>{sE=require("obsidian");Tt();Me();qt();xc();Mg=class{constructor(e){this.app=e}async createFolder(e){await this.app.vault.adapter.exists(e)||await this.app.vault.createFolder(e)}stripLeadingSlash(e){return e.replace(/^\/+/,"")}normalizeMarkdownFilePath(e,t){let n=this.stripLeadingSlash(e),i=n?`${n}/`:"",o=this.stripLeadingSlash(t).replace(ir,"");return`${i}${o}.md`}async fileExists(e){return await this.app.vault.adapter.exists(e)}getFileByPath(e){let t=this.app.vault.getAbstractFileByPath(e);if(!t)throw F.logError(`${e} not found`),new Error(`${e} not found`);if(t instanceof sE.TFolder)throw F.logError(`${e} found but it's a folder`),new Error(`${e} found but it's a folder`);if(!(t instanceof sE.TFile))throw new Error(`${e} is not a file`);return t}async createFileWithInput(e,t,n={}){if(Vn(e))throw new Error(`Refusing to create a file outside the vault: "${e}".`);let i=e.match(/(.*)[/\\]/),o="";i&&(o=i[1]);let s=this.app.vault.getAbstractFileByPath(o);(!s||!(s instanceof sE.TFolder))&&await this.createFolder(o);let a=()=>this.app.vault.create(e,t);return n.suppressTemplaterOnCreate&&e.toLowerCase().endsWith(".md")?await S0(this.app,e,a):await a()}}});function hve(r){let e=[],t=[];for(let[n,i]of r){let o=H1(n,i,new Set,0);e.push(...o.warnings),t.push(...o.errors)}return{isValid:t.length===0,warnings:e,errors:t}}function H1(r,e,t,n){let i=[],o=[];if(typeof e=="function")return o.push(`Variable "${r}" contains a function, which cannot be serialized to YAML`),{warnings:i,errors:o};if(typeof e=="symbol")return o.push(`Variable "${r}" contains a symbol, which cannot be serialized to YAML`),{warnings:i,errors:o};if(typeof e=="bigint")return i.push(`Variable "${r}" contains a BigInt, which will be converted to a string`),{warnings:i,errors:o};if(e==null)return{warnings:i,errors:o};if(typeof e!="object")return{warnings:i,errors:o};if(t.has(e))return o.push(`Variable "${r}" contains a circular reference`),{warnings:i,errors:o};if(n>=z1.MAX_NESTING_DEPTH)return o.push(`Variable "${r}" exceeds maximum nesting depth of ${z1.MAX_NESTING_DEPTH}`),{warnings:i,errors:o};t.add(e);try{if(Array.isArray(e))for(let s=0;s<e.length;s++){let a=H1(`${r}[${s}]`,e[s],t,n+1);i.push(...a.warnings),o.push(...a.errors)}else for(let[s,a]of Object.entries(e)){let l=H1(`${r}.${s}`,a,t,n+1);i.push(...l.warnings),o.push(...l.errors)}}finally{t.delete(e)}return{warnings:i,errors:o}}function Rg(r,e){return mve.includes(r.extension)&&e.size>0}async function $g(r,e,t){let n=hve(t);if(n.warnings.length>0)for(let i of n.warnings)F.logWarning(`Structured variable validation warning: ${i}`);if(!n.isValid){let i=n.errors.join("; ");F.logError(`Cannot post-process front matter for file ${e.path} due to validation errors: ${i}. The file was created successfully, but some structured variables may not be properly formatted. Please check the variable values and ensure they don't contain circular references, exceed nesting depth of ${z1.MAX_NESTING_DEPTH}, or contain unsupported types (functions, symbols).`);return}try{F.logMessage(`Post-processing front matter for ${e.path} with ${t.size} structured variables`),F.logMessage(`Variable types: ${Array.from(t.entries()).map(([i,o])=>`${i}:${typeof o}`).join(", ")}`),await r.fileManager.processFrontMatter(e,i=>{for(let[o,s]of t){let a=o.includes(Ma.PATH_SEPARATOR)?o.split(Ma.PATH_SEPARATOR):[o],l=R_(s);G1(i,a,l)}}),F.logMessage(`Successfully post-processed front matter for ${e.path}`)}catch(i){F.logError(`Failed to post-process front matter for file ${e.path}: ${i}. The file was created successfully, but structured variables may not be properly formatted. This usually happens when variable values contain unexpected types or when Obsidian's YAML processor encounters an issue. Check the console for more details about which variables caused the problem.`)}}function j1(r){return r.some((e,t)=>e==="__proto__"?!0:!(t===r.length-1)&&gve.has(e))}function G1(r,e,t){if(e.length===0)return;if(j1(e)){F.logWarning(`Skipping front matter assignment for unsafe key path "${e.join(".")}" to avoid prototype pollution.`);return}let n=r;for(let i=0;i<e.length-1;i++){let o=e[i],s=n[o];(typeof s!="object"||s===null||Array.isArray(s))&&(n[o]={}),n=n[o]}n[e[e.length-1]]=t}var z1,mve,gve,uD=b(()=>{Me();_y();$_();z1={MAX_NESTING_DEPTH:10},mve=["md"];gve=new Set(["prototype","constructor"])});function Og(r){return((0,Y1.normalizePath)(r).split("/").pop()??"").replace(/\.(md|canvas|base)$/i,"")}function Wo(r){let e=(0,Y1.normalizePath)(r),t=e.lastIndexOf("/");return t===-1?"":e.slice(0,t)}var Y1,Ng=b(()=>{Y1=require("obsidian")});async function oa(r,e){try{return r.promptProvider?await e.remote(r.promptProvider):r.interactive===!1?await e.headless():await e.app()}catch(t){throw Dt(t)?new St("Input cancelled by user"):t}}var Lg=b(()=>{zr();Cr()});async function sa(r,e){let t=e.items.map((s,a)=>`${vve}${a}`),n=await r.suggester(e.items.map(s=>s.title),t,e.placeholder,e.allowCustomInput??!1),i=n==null?"":String(n),o=t.indexOf(i);if(o!==-1)return e.items[o].value;if(i==="")throw new St("Input cancelled by user");if(e.allowCustomInput)return i;throw new Error(`A reply to ${e.what} has to be one of the offered options, and "${i.slice(0,60)}" is not. Reply with the item's \`value\` token exactly as it was sent, or \`{"cancelled": true}\` to dismiss it.`)}var vve,Bg=b(()=>{zr();vve="\0qa-eng:"});function aE(r){let e=Vp(r);if(e.length!==0)throw new Ee(gj(e,r))}function p9(r){return Vp(r).length===0}var dD=b(()=>{Co();_l()});function pD(r){let e=r.map(n=>n||"/");return`Folder must be under: ${e.length>3?`${e.slice(0,3).join(", ")}...`:e.join(", ")}`}function K1(r){return r instanceof Nt||!!r&&typeof r=="object"&&"name"in r&&r.name==="MacroAbortError"}var Ug,yve,ql,hd,fD=b(()=>{W1();uD();Vg();Ug=require("obsidian");qt();qc();nd();Tt();Cr();_l();xc();Ng();B_();Ns();Co();Lg();Bg();Me();dD();yve=3,ql=class extends Error{constructor(e){super(e),this.name="InvalidFolderPathError"}};hd=class extends Mg{constructor(t,n,i,o){super(t);this.plugin=n;this.lastTemplateFileFailure=null;this.templater=PT(t),this.formatter=new Cs(t,n,i),o&&this.formatter.setTemplateInclusionState(o)}async getOrCreateFolder(t,n){let i=this.buildFolderSelectionContext(t,n);if(!this.shouldPromptForFolder(i))return await this.handleSingleSelection(i);let o=await this.promptUntilAllowed(i,n.executor);return o.isEmpty?"":o.resolved}buildFolderSelectionContext(t,n){let i=n.allowCreate??!1,o=n.allowedRoots?.map(d=>this.normalizeFolderPath(d))??[],{items:s,displayItems:a,normalizedItems:l,canonicalByNormalized:c,displayByNormalized:u}=this.buildFolderSuggestions(t,n.topItems??[],o.length>0?o:void 0);return{items:s,displayItems:a,normalizedItems:l,canonicalByNormalized:c,displayByNormalized:u,existingSet:new Set(l),allowCreate:i,allowedRoots:o,placeholder:n.placeholder}}shouldPromptForFolder(t){return t.items.length>1||t.allowCreate&&t.items.length===0}async promptForFolder(t,n){let i=t.placeholder??"Choose a folder or type to create one";return String(await oa(n,{remote:o=>sa(o,{items:t.items.map((s,a)=>({value:s,title:t.displayItems[a]??s})),placeholder:i,allowCustomInput:t.allowCreate,what:"the folder chooser"}),headless:()=>{throw new Ee("This choice needs to ask which folder to create the note in, but this run is non-interactive. Configure a single target folder, or re-run with the ui flag.")},app:()=>t.allowCreate?ln.Suggest(this.app,t.displayItems,t.items,{placeholder:i,renderItem:(o,s)=>{this.renderFolderSuggestion(o,s,t.existingSet,t.displayByNormalized)}}):Nr.Suggest(this.app,t.displayItems,t.items,t.placeholder)}))}async resolveSelection(t,n){let i=this.normalizeFolderPath(t),o=i.length===0,s=n.canonicalByNormalized.get(i),a=s??i,l=o?!1:s!==void 0||await this.app.vault.adapter.exists(a),c=n.allowedRoots.length===0?!0:this.isPathAllowed(o?"":a,n.allowedRoots);return{raw:t,normalized:i,resolved:a,exists:l,isAllowed:c,isEmpty:o}}async promptUntilAllowed(t,n){let i=n.promptProvider?yve:0,o=null;for(;;){if(n.promptProvider&&i--<=0)throw new Ee(o??pD(t.allowedRoots));let s=await this.promptForFolder(t,n),a=await this.resolveSelection(s,t);if(a.isEmpty){if(!a.isAllowed){o=pD(t.allowedRoots),this.showFolderNotAllowedNotice(t.allowedRoots);continue}return a}if(!a.isAllowed){o=pD(t.allowedRoots),this.showFolderNotAllowedNotice(t.allowedRoots);continue}try{this.validateFolderPath(a.resolved)}catch(l){if(l instanceof ql){o=l.message,new Ug.Notice(l.message);continue}throw l}return await this.ensureFolderExists(a),a}}async ensureFolderExists(t){t.isEmpty||t.exists||await this.createFolder(t.resolved)}async handleSingleSelection(t){let n=t.items[0]??"",i=await this.resolveSelection(n,t);if(i.isEmpty)return"";if(!i.isAllowed)throw this.showFolderNotAllowedNotice(t.allowedRoots),new Nt("Selected folder not allowed.");if(i.resolved)try{this.validateFolderPath(i.resolved)}catch(o){if(o instanceof ql)return new Ug.Notice(o.message),"";throw o}return await this.ensureFolderExists(i),i.resolved}normalizeFolderPath(t){return t.trim().replace(/^\/+/,"").replace(/\/+$/,"")}validateFolderPath(t){let n=t.trim();if(!n)return;let i=n.split("/");for(let o of i)this.validateFolderSegment(o)}validateFolderSegment(t){if(!t)throw new ql("Folder name cannot be empty.");if(t==="."||t==="..")throw new ql("Folder name cannot be '.' or '..'.");if(O_.test(t))throw new ql("Folder name cannot contain control characters.");if(N_.test(t))throw new ql('Folder name cannot contain any of the following characters: \\ / : * ? " < > |');if(L_.test(t))throw new ql("Folder name cannot end with a space or a period.");let n=t.split(".")[0]??"";if(n&&Pm(n))throw new ql("Folder name cannot be a reserved name like CON, PRN, AUX, NUL, COM1-9, or LPT1-9.")}isPathAllowed(t,n){let i=this.normalizeFolderPath(t);for(let o of n)if(!o||i===o||i.startsWith(`${o}/`))return!0;return!1}showFolderNotAllowedNotice(t){new Ug.Notice(pD(t))}buildFolderSuggestions(t,n,i){let o=[],s=[],a=[],l=new Map,c=new Map,u=new Set,d=(f,p)=>{let m=this.normalizeFolderPath(f);u.has(m)||i&&i.length>0&&!this.isPathAllowed(m,i)||(u.add(m),o.push(f),s.push(p??f),a.push(m),l.set(m,f),p&&c.set(m,p))};for(let f of n)d(f.path,f.label);for(let f of t)d(f);return{items:o,displayItems:s,normalizedItems:a,canonicalByNormalized:l,displayByNormalized:c}}renderFolderSuggestion(t,n,i,o){n.empty(),n.classList.add("mod-complex");let s=this.normalizeFolderPath(t),a=o.get(s),l=t||"/",c=i.has(s),u="";a==="<current folder>"?u="Current folder":c||(u="Create folder"),n.createDiv("suggestion-content").createDiv("suggestion-title").createSpan({text:l}),u&&n.createDiv("suggestion-aux").createEl("kbd",{cls:"suggestion-hotkey",text:u})}stripDuplicateFolderPrefix(t,n){let i=this.stripLeadingSlash(n),o=this.stripLeadingSlash(t);return i?o.startsWith(`${i}/`)?{fileName:o.slice(i.length+1),strippedPrefix:!0}:{fileName:o,strippedPrefix:!1}:{fileName:o,strippedPrefix:!1}}shouldTreatFormattedNameAsVaultRelativePath(t,n,i){if(i||n)return!1;let o=t.trim();if(!o.includes("/")||o.startsWith("./"))return!1;if(o.startsWith("/"))return!0;let[s]=this.stripLeadingSlash(o).split("/");return s?this.app.vault.getAbstractFileByPath(s)instanceof Ug.TFolder:!1}getTemplateExtension(t){return Wr.test(t)?".canvas":Vi.test(t)?".base":".md"}normalizeTemplateFilePath(t,n,i){let o=this.stripLeadingSlash(t),s=o?`${o}/`:"",a=this.getTemplateExtension(i),l=li(this.stripLeadingSlash(n),"File name"),c=li(l.replace(ir,"").replace(Wr,"").replace(Vi,""),"File name");if(!c.slice(c.lastIndexOf("/")+1).trim())throw new Error("File name is empty after formatting. Make sure the tokens in the file name format produce a value (an optional token left empty can cause this).");let d=`${s}${c}${a}`;if(Vn(d))throw new Error(`Refusing to build a file path outside the vault: "${d}".`);return d}noteTemplateFileFailure(t,n){this.lastTemplateFileFailure=t instanceof Error&&t.message?t.message:n}async createFileWithTemplate(t,n){this.lastTemplateFileFailure=null,aE(t);try{let i=await this.getTemplateContent(n),o=Og(t);this.formatter.setTitle(o),this.formatter.setTargetFolderPath(Wo(t)),this.formatter.setPromptRunContext({destination:t,destinationKind:"file"});let s=await this.formatter.withTemplatePropertyCollection(()=>this.formatter.withPromptScope("noteBody",i,()=>this.formatter.formatFileContent(i))),a=this.formatter.getAndClearTemplatePropertyVars();F.logMessage(`TemplateEngine.createFileWithTemplate: Collected ${a.size} template property variables for ${t}`),a.size>0&&F.logMessage(`Variables: ${Array.from(a.keys()).join(", ")}`);let l=t.toLowerCase().endsWith(".md"),c=await this.createFileWithInput(t,s,{suppressTemplaterOnCreate:l});return Rg(c,a)&&await $g(this.app,c,a),await Qd(this.app,c),c}catch(i){if(K1(i))throw i;return this.noteTemplateFileFailure(i,`Could not create file with template at ${t}`),lt(i,`Could not create file with template at ${t}`),null}}setLinkToCurrentFileBehavior(t){this.formatter.setLinkToCurrentFileBehavior(t)}setTargetFolderPath(t){this.formatter.setTargetFolderPath(t)}setPromptRunContext(t){this.formatter.setPromptRunContext(t)}async resolveTemplateSourcePath(t){return this.formatter.formatTemplateFilePath(t)}async overwriteFileWithTemplate(t,n){this.lastTemplateFileFailure=null;try{let i=await this.getTemplateContent(n),o=t.basename;this.formatter.setTitle(o),this.formatter.setTargetFolderPath(Wo(t.path)),this.formatter.setPromptRunContext({destination:t.path,destinationKind:"file"});let s=await this.formatter.withTemplatePropertyCollection(()=>this.formatter.withPromptScope("noteBody",i,()=>this.formatter.formatFileContent(i))),a=this.formatter.getAndClearTemplatePropertyVars();return F.logMessage(`TemplateEngine.overwriteFileWithTemplate: Collected ${a.size} template property variables for ${t.path}`),a.size>0&&F.logMessage(`Variables: ${Array.from(a.keys()).join(", ")}`),await this.app.vault.modify(t,s),Rg(t,a)&&await $g(this.app,t,a),await Qd(this.app,t),t}catch(i){if(K1(i))throw i;return this.noteTemplateFileFailure(i,"Could not overwrite file with template"),lt(i,"Could not overwrite file with template"),null}}async appendToFileWithTemplate(t,n,i){this.lastTemplateFileFailure=null;try{let o=await this.getTemplateContent(n),s=t.basename;this.formatter.setTitle(s),this.formatter.setTargetFolderPath(Wo(t.path)),this.formatter.setPromptRunContext({destination:t.path,destinationKind:"file"});let a=await this.formatter.withPromptScope("noteBody",o,()=>this.formatter.formatFileContent(o));t.extension==="md"&&(a=await dc(this.app,a,t));let l=await this.app.vault.cachedRead(t),c=i==="top"?`${a}
|
||
${l}`:`${l}
|
||
${a}`;return await this.app.vault.modify(t,c),t}catch(o){if(K1(o))throw o;return this.noteTemplateFileFailure(o,"Could not append to file with template"),lt(o,"Could not append to file with template"),null}}async getTemplateContent(t){let n=fo(this.app,t);if(!n)throw new Error(`Template file not found at path "${t}".`);return await this.app.vault.cachedRead(n)}}});var f9={};Jr(f9,{SingleTemplateEngine:()=>lE});var lE,Q1=b(()=>{fD();Me();lE=class extends hd{constructor(t,n,i,o,s){super(t,n,o,s);this.templatePath=i;this.promptScope="noteBody"}setPromptScope(t){this.promptScope=t}async run(){let t=await this.resolveTemplateSourcePath(this.templatePath),n=await this.getTemplateContent(t);return n||F.logError(`Template ${t} not found.`),n=await this.formatter.withTemplatePropertyCollection(()=>this.formatter.withPromptScope(this.promptScope,n,()=>this.formatter.formatFileContent(n))),n}getAndClearTemplatePropertyVars(){return this.formatter.getAndClearTemplatePropertyVars()}}});var m9={};Jr(m9,{SingleInlineScriptEngine:()=>X1});var X1,h9=b(()=>{oE();X1=class extends Vl{constructor(e,t,n,i){super(e,t,null,n,i)}async runAndGetOutput(e){let t=Object.getPrototypeOf(async function(){}).constructor;return await new t(e).bind(this.params,this).call()}}});var g9,Cs,Vg=b(()=>{g9=require("obsidian");Hs();nd();l5();jO();Tt();qc();h5();b5();uh();Ru();ip();js();yl();U1();O1();V1();Cu();Me();$m();Ey();l9();zr();Co();Cr();Cs=class extends bl{constructor(t,n,i,o){super(t);this.app=t;this.plugin=n;this.choiceExecutor=i;this.contentValuePromptsAcceptImagePaste=!1;this.dateParser=o||Tl,i&&(this.variables=i?.variables)}async format(t){let n=t;return n=await this.replaceInlineJavascriptInString(n),n=await this.replaceMacrosInString(n),n=await this.replaceTemplateInString(n),n=await this.replaceGlobalVarInString(n),n=this.replaceDateInString(n),n=this.replaceTimeInString(n),n=await this.replaceValueInString(n),n=await this.replaceSelectedInString(n),n=await this.replaceClipboardInString(n),n=await this.replaceDateVariableInString(n),n=await this.replaceVariableInString(n),n=await this.replaceFieldVarInString(n),n=await this.replaceFileInString(n),n=await this.replaceMathValueInString(n),n=this.replaceRandomInString(n),n}async replaceGlobalVarInString(t){let n=t,i=0,o=new RegExp(fl.source,"gi");for(;o.test(n)&&!(++i>5);)n=n.replace(o,(s,a)=>{let l=String(a??"").trim();if(!l)return s;let c=this.plugin?.settings?.globalVariables?.[l];return typeof c=="string"?c:""});return n}async formatFileName(t,n="generic"){if(Os.test(t))throw new Error("{{title}} cannot be used in file names as it would create a circular dependency. The title is derived from the filename itself.");let i=await this.withPromptScope(n,t,()=>this.format(t));if(Os.test(i))throw new Error("{{title}} cannot be used in file names as it would create a circular dependency. The title is derived from the filename itself.");return i=this.replaceCurrentFileTokensInString(i,{fileName:!0,folder:!0,activeFolder:"path"}),i}async formatFileContent(t){let n=t,i=this.contentValuePromptsAcceptImagePaste;this.contentValuePromptsAcceptImagePaste=!P_(this.promptScope);try{n=await this.format(n)}finally{this.contentValuePromptsAcceptImagePaste=i}return n=this.replaceCurrentFileTokensInString(n,{links:!0,fileName:!0,folder:!0,activeFolder:"content",title:!0}),n}async formatFolderPath(t){if(Os.test(t))throw new Error("{{title}} cannot be used in folder paths as it would create a circular dependency. The title is derived from the filename itself.");let n=await this.withPromptScope("folder",t,()=>this.format(t));if(Os.test(n))throw new Error("{{title}} cannot be used in folder paths as it would create a circular dependency. The title is derived from the filename itself.");return this.replaceCurrentFileTokensInString(n,{folder:!0,activeFolder:"path"}).replace(/^\/+/,"")}async formatTemplateFilePath(t){if(Os.test(t))throw new Error("{{title}} cannot be used in a template path \u2014 the title is derived from the created file, not the source template.");let n=t;if(n=await this.replaceGlobalVarInString(n),Os.test(n))throw new Error("{{title}} cannot be used in a template path \u2014 the title is derived from the created file, not the source template.");return n=await this.withPromptScope("templatePath",t,async()=>{let i=this.replaceDateInString(n);return i=this.replaceTimeInString(i),i=await this.replaceValueInString(i),i=await this.replaceSelectedInString(i),i=await this.replaceClipboardInString(i),i=await this.replaceDateVariableInString(i),i=await this.replaceVariableInString(i),i=await this.replaceFieldVarInString(i),i=await this.replaceFileInString(i),i=await this.replaceMathValueInString(i),this.replaceRandomInString(i)}),n.trim()}async formatLocationString(t){let n=await this.withPromptScope("lineTarget",t,()=>this.format(t));return n=this.replaceCurrentFileTokensInString(n,{links:!0,fileName:!0,title:!0}),n}getCurrentFileLink(){let t=this.app.workspace.getActiveFile();return t?this.app.fileManager.generateMarkdownLink(t,""):null}getCurrentFileName(){let t=this.app.workspace.getActiveFile();return t?t.basename:null}getCurrentFolderPath(){let t=this.app.workspace.getActiveFile();if(!t)return null;let n=t.parent?.path??"";return n==="/"?"":n}getCurrentFileLinkToSection(){let t=this.app.workspace.getActiveFile();if(!t)return null;let n=this.getLinkSourcePath()??"",i=null;try{i=this.getActiveHeadingSubpath(t)}catch{i=null}return i?this.app.fileManager.generateMarkdownLink(t,n,i):this.app.fileManager.generateMarkdownLink(t,n)}getActiveHeadingSubpath(t){let n=this.app.workspace.getActiveViewOfType(g9.MarkdownView);if(!n||n.file?.path!==t.path||n.getMode()==="preview")return null;let i=n.editor,o=i?.getCursor();if(!i||!o)return null;let s=s9(i.getValue().split(/\r?\n/));return a9(s,o.line)}getVariableValue(t){return this.variables.get(t)??""}shouldUseSelectionForValue(){return!0}async getSelectedTextForValue(){return await this.getSelectedText()}assertInteractivePrompt(t){if(this.choiceExecutor?.interactive===!1)throw new Ee(`This run is non-interactive but a value for ${t} was not provided up front. Pass it (e.g. a value- flag) or re-run with the ui flag.`)}describeAnonymousValuePrompt(){let t=F_(this.promptScope,this.promptScopeSoleValue),n=t.title??(this.promptRunContext?.choiceName?.trim()||"Enter value"),i=zP(this.promptScope);return{title:n,placeholder:t.placeholder,contextLine:xy(this.promptRunContext,n,{showDestination:i}),contextLineFull:xy(this.promptRunContext,n,{elide:!1,showDestination:i})}}async promptForValue(t){if(this.value===void 0){if(this.shouldUseSelectionForValue()){let o=await this.getSelectedTextForValue();if(o){let s=this.normalizeSelectedTextForPrompt(o);if(s!==void 0)return this.value=s,this.value}}if(this.assertInteractivePrompt("{{VALUE}}"),this.valuePromptContext?.inputTypeOverride==="checkbox"){let o=this.choiceExecutor?.promptProvider;if(o)return this.value=String(await o.suggester(["true","false"],["true","false"],this.valuePromptContext.description??this.describeAnonymousValuePrompt().title,!1)),this.value;try{return this.value=await Nr.Suggest(this.app,["true","false"],["true","false"],this.valuePromptContext.description??this.describeAnonymousValuePrompt().title,void 0,this.valuePromptContext.optional?{skippable:!0}:void 0),this.value}catch(s){throw Dt(s)?new St("Input cancelled by user"):s}}let n=this.describeAnonymousValuePrompt(),i=this.choiceExecutor?.promptProvider;if(i)return this.value=await i.inputPrompt(n.contextLine?`${n.title} (${n.contextLine})`:n.title,this.valuePromptContext?.placeholder??n.placeholder,this.valuePromptContext?.defaultValue),this.value;try{let o=this.getLinkSourcePath(),s=new wg().factory(this.valuePromptContext?.inputTypeOverride),a=this.valuePromptContext?.defaultValue,l=this.valuePromptContext?.description,c=this.buildInputPromptOptions(this.valuePromptContext,n.contextLine,n.contextLineFull),u=this.valuePromptContext?.placeholder??n.placeholder;o?this.value=await s.PromptWithContext(this.app,n.title,u,a,o,l,c):this.value=await s.Prompt(this.app,n.title,u,a,l,c)}catch(o){throw Dt(o)?new St("Input cancelled by user"):o}}return this.value}normalizeSelectedTextForPrompt(t){let n=this.valuePromptContext;if(n?.inputTypeOverride==="checkbox"){let s=t.trim().toLowerCase();return s==="true"||s==="false"?s:void 0}if(n?.inputTypeOverride!=="number"&&n?.inputTypeOverride!=="slider")return t;let i=n.sliderConfig??n.numericConfig,o=Ra(t,i);return o===""?void 0:o}buildInputPromptOptions(t,n,i){let o=this.contentValuePromptsAcceptImagePaste&&t?.inputTypeOverride!=="number"&&t?.inputTypeOverride!=="slider"?{sourcePath:this.getLinkSourcePath()??""}:void 0,s=this.promptRunContext?.draftScopeId;if(!(!t?.optional&&!t?.numericConfig&&!t?.sliderConfig&&!o&&!n&&!s))return{optional:t?.optional,numeric:t?.numericConfig,slider:t?.sliderConfig,imagePaste:o,contextLine:n,contextLineFull:i,draftScopeId:s}}async promptForVariable(t,n){let i=this.choiceExecutor?.promptProvider;if(i)return n?.type==="VDATE"?await i.datePrompt(t??n.label??"Enter date",{defaultValue:n.defaultValue,dateFormat:n.dateFormat??"YYYY-MM-DD",withTime:n.withTime}):n?.inputTypeOverride==="checkbox"?String(await i.suggester(["true","false"],["true","false"],n.description??t??n.label??"Choose value",!1)):await i.inputPrompt(t??n?.label??"Enter value",n?.placeholder,n?.defaultValue);this.assertInteractivePrompt(t?`{{VALUE:${t}}}`:"a template variable");try{let o=t??n?.label??"Enter value",s=zP(this.promptScope),a=xy(this.promptRunContext,o,{showDestination:s}),l=xy(this.promptRunContext,o,{elide:!1,showDestination:s});return n?.type==="VDATE"?await Jp.Prompt(this.app,t??n.label??"Enter date",n.withTime?"Enter a date & time (e.g., 'tomorrow at 3pm', '2025-12-25 14:30')":"Enter a date (e.g., 'tomorrow', 'next friday', '2025-12-25')",n.defaultValue,n.dateFormat??"YYYY-MM-DD",{optional:n.optional,contextLine:a,contextLineFull:l,draftScopeId:this.promptRunContext?.draftScopeId},n.withTime):n?.inputTypeOverride==="checkbox"?await Nr.Suggest(this.app,["true","false"],["true","false"],n.description??t??n.label??"Choose value",void 0,n.optional?{skippable:!0}:void 0):await new wg().factory(n?.inputTypeOverride).Prompt(this.app,o,n?.placeholder??(n?.defaultValue?n.defaultValue:void 0),n?.defaultValue,n?.description,this.buildInputPromptOptions(n,a,l))}catch(o){throw Dt(o)?new St("Input cancelled by user"):o}}async promptForMathValue(){let t=this.choiceExecutor?.promptProvider;if(t)return await t.inputPrompt("Enter a math expression");this.assertInteractivePrompt("a {{MVALUE}} math expression");try{return await LS.Prompt()}catch(n){throw Dt(n)?new St("Input cancelled by user"):n}}async suggestForValue(t,n=!1,i){let o=this.choiceExecutor?.promptProvider;if(o)return String(await o.suggester(i?.displayValues??t,t,i?.placeholder,n));this.assertInteractivePrompt(i?.variableKey?`{{VALUE:${i.variableKey}}}`:"a value choice");try{let s=i?.displayValues??t;return n?await ln.Suggest(this.app,s,t,{...i?.placeholder?{placeholder:i.placeholder}:{},...i?.optional?{skippable:!0}:{}}):await Nr.Suggest(this.app,s,t,i?.placeholder,void 0,i?.optional?{skippable:!0}:void 0)}catch(s){throw Dt(s)?new St("Input cancelled by user"):s}}async suggestForValueMulti(t,n=!1,i){let o=i?.displayValues??t,s=this.choiceExecutor?.promptProvider;if(s)return await s.suggesterMulti(o,t,{placeholder:i?.placeholder,allowCustomInput:n});this.assertInteractivePrompt(i?.variableKey?`{{VALUE:${i.variableKey}}}`:"a multi-select value");try{return await Xp.Suggest(this.app,o,t,{...i?.placeholder?{placeholder:i.placeholder}:{},allowCustomValue:n,...i?.optional?{skippable:!0}:{}})}catch(a){throw Dt(a)?new St("Input cancelled by user"):a}}async suggestForField(t){this.assertInteractivePrompt(`{{FIELD:${t}}}`);let n=this.choiceExecutor?.promptProvider;try{let{fieldName:i,filters:o,multiSelect:s}=Yi.parse(t),a=o.defaultFrom==="active"?cD(this.app,this.choiceExecutor?.triggerContext?.activeFile??null,i):null,{values:l,hasDefaultValue:c}=await r9(this.app,i,o),u=l,d=c,f=o.defaultValue;!s&&typeof a=="string"?(u=Ka.promoteValueToFront(u,a,o.caseSensitive),f=a,d=!0):!s&&Array.isArray(a)&&a.length>0&&F.logMessage(`{{FIELD:${i}|default-from:active}}: the active note's "${i}" is a list value, which applies only to |multi FIELD prompts, so no default was prefilled.`);let p=s?`Select values for ${i}`:`Enter value for ${i}`;if(d&&f&&(p=s?`Select values for ${i} (default: ${f})`:`Enter value for ${i} (default: ${f})`),s){let m=u;if(u.length===0&&!o.defaultValue){let g=Ka.getSmartDefaults(i,[]);g.length>0&&(m=g)}let v=a===null?void 0:(Array.isArray(a)?a:[a]).map(g=>Ka.canonicalizeAgainst(m,g,o.caseSensitive));return n?await n.suggesterMulti(m,m,{placeholder:p,allowCustomInput:!0,preselected:v&&v.length>0?v:void 0}):await Xp.Suggest(this.app,m,m,{placeholder:p,allowCustomValue:!0,...v&&v.length>0?{preselected:v}:{}})}if(u.length===0){let m="No existing values were found in your vault.";if(!o.defaultValue){let v=Ka.getSmartDefaults(i,[]);v.length>0&&(m+=`
|
||
|
||
Suggested values for ${i}: ${v.slice(0,3).join(", ")}`)}return n?await n.inputPrompt(`Enter value for ${i}`,m):await Sr.PromptWithContext(this.app,`Enter value for ${i}`,m,void 0,this.getLinkSourcePath()??void 0)}return n?String(await n.suggester(u,u,p,!0)):await ln.Suggest(this.app,u,u,{placeholder:p})}catch(i){throw Dt(i)?new St("Input cancelled by user"):i}}generateCacheKey(t){return L1(t)}async suggestForFile(t){this.assertInteractivePrompt(`{{FILE}} (pick a file from ${t.folderPath})`);let n=this.choiceExecutor?.promptProvider;try{let i=zi.filterFiles(this.app.vault.getMarkdownFiles(),t.filter,c=>this.app.metadataCache.getFileCache(c)),o=t.label??`Select a file from ${t.folderPath}`;if(i.length===0){let c=`No markdown files found in "${t.folderPath}". Type a value or leave empty.`,u=n?await n.inputPrompt(o,c):await Sr.Prompt(this.app,o,c,void 0,void 0,t.optional?{optional:!0}:void 0);return t.multiSelect?u?[`${as}${u}`]:[]:u?`${as}${u}`:""}let s=Ec(i,c=>this.app.metadataCache.getFileCache(c)),a=i.map(c=>`${vl}${c.path}`);if(t.multiSelect)return(n?await n.suggesterMulti(s,a,{placeholder:o,allowCustomInput:t.allowCustomInput}):await Xp.Suggest(this.app,s,a,{placeholder:o,allowCustomValue:t.allowCustomInput,...t.optional?{skippable:!0}:{}})).map(u=>a.includes(u)?u:`${as}${u}`);if(n){let c=String(await n.suggester(s,a,o,t.allowCustomInput));return c?a.includes(c)?c:`${as}${c}`:""}if(t.allowCustomInput){let c=new Set(i.map(f=>f.basename.toLowerCase())),u=new Set(s.map(f=>f.toLowerCase())),d=await ln.Suggest(this.app,s,a,{placeholder:o,valueExists:f=>c.has(f.toLowerCase())||u.has(f.toLowerCase()),...t.optional?{skippable:!0}:{}});return d?a.includes(d)?d:`${as}${d}`:""}return await Nr.Suggest(this.app,s,a,o,void 0,t.optional?{skippable:!0}:void 0)??""}catch(i){throw Dt(i)?new St("Input cancelled by user"):i}}async getMacroValue(t,n){let{SingleMacroEngine:i}=await Promise.resolve().then(()=>(d9(),u9)),o=new i(this.app,this.plugin,this.plugin.settings.choices,this.choiceExecutor,this.variables),s=await o.runAndGetOutput(t,n)??"";return o.getVariables().forEach((a,l)=>{this.variables.set(l,a)}),s}async getTemplateContent(t){let{SingleTemplateEngine:n}=await Promise.resolve().then(()=>(Q1(),f9));this.templateInclusion??(this.templateInclusion={visited:new Set,depth:0});let i={visited:this.templateInclusion.visited,depth:this.templateInclusion.depth+1},o=new n(this.app,this.plugin,t,this.choiceExecutor,i);o.setTargetFolderPath(this.targetFolderPath),this.promptScope!=="generic"&&o.setPromptScope(this.promptScope),this.promptRunContext&&o.setPromptRunContext({...this.promptRunContext,draftScopeId:`${this.promptRunContext.draftScopeId??""}#${t}`});let s=await o.run();return this.mergeTemplatePropertyVars(o.getAndClearTemplatePropertyVars()),s}async getSelectedText(){let t=Nn(this.app);return t?t.editor.getSelection():""}async getClipboardContent(){try{return await navigator.clipboard.readText()}catch{return""}}isTemplatePropertyTypesEnabled(){return this.plugin.settings.enableTemplatePropertyTypes}async replaceInlineJavascriptInString(t){let n=t;for(;uc.test(n);){let i=uc.exec(n);if(!i)break;let o=i.at(1)?.trim();if(o){let{SingleInlineScriptEngine:s}=await Promise.resolve().then(()=>(h9(),m9)),a=new s(this.app,this.plugin,this.choiceExecutor,this.variables),l=await a.runAndGetOutput(o);for(let u in a.params.variables)this.variables.set(u,a.params.variables[u]);let c="";typeof l=="string"?c=l:(typeof l=="number"||typeof l=="boolean"||Array.isArray(l))&&(c=this.renderCollectedOrArrayValue({input:n,matchStart:i.index,matchEnd:i.index+i[0].length,rawValue:l,fallbackKey:"inlineScript",heuristicEnabled:this.isTemplatePropertyTypesEnabled()})??String(l)),n=this.replacer(n,uc,c)}else n=this.replacer(n,uc,"")}return n}async collectValuesManually(t,n){return await B1(this.app,t,n)}}});function af(r){return new TextEncoder().encode(r).length}function bve(r){let e=0;for(let t of r){if(t.role==="tool"){for(let n of t.results)e+=af(n.content);continue}if(e+=af(t.content),t.role==="assistant"&&t.toolCalls){for(let n of t.toolCalls)if(typeof n.rawArgs=="string")e+=af(n.rawArgs);else if(n.args)try{e+=af(JSON.stringify(n.args))}catch{}}}return e}function wve(r,e){let t;if(typeof r=="string")t=r;else if(r==null)t='{"ok":true}';else try{t=JSON.stringify(r)}catch{return{content:"tool returned a value that could not be serialized",isError:!0}}if(af(t)>e){let n=" \u2026[truncated]",i=Math.max(0,e-af(n)),o=Math.min(t.length,i);for(;o>0&&af(t.slice(0,o))>i;)o=Math.floor(o*.9)||o-1;t=t.slice(0,o)+n}return{content:t,isError:!1}}async function v9(r){let e=r.maxResultBytes??32768,t=r.maxTranscriptBytes??524288,n=Math.max(1,r.maxSteps),i=[...r.request.messages],o=[],s={promptTokens:0,completionTokens:0,totalTokens:0},a=0,l=!1,c=null;for(let p=0;p<n;p++){if(p>0&&r.isOnlineDisabled?.())return u("aborted");let m=p===n-1,v=l||m,g={...r.request,messages:i,...v?{toolChoice:"none"}:{}};a+=bve(i);let y;try{y=await r.dispatch(g,{isFinalStep:v})}catch(x){if(r.isContextOverflow?.(x))return u("context-overflow");throw x}if(c=y,s.promptTokens+=y.usage.promptTokens,s.completionTokens+=y.usage.completionTokens,s.totalTokens+=y.usage.totalTokens,y.normalizedStopReason!=="tool_calls"||y.toolCalls.length===0||v){o.push({stepNumber:p,text:y.content,toolCalls:y.toolCalls,toolResults:[],finishReason:y.rawStopReason,usage:y.usage}),await r.onStepFinish?.(o[o.length-1]);let x=y.normalizedStopReason==="length"?"length":m&&!l&&p>0?"max-steps":"stop";return u(x)}i.push({role:"assistant",content:y.content,toolCalls:y.toolCalls,providerRaw:y.providerRaw});let w=[];for(let x of y.toolCalls)w.push(await d(x));i.push({role:"tool",results:w}),o.push({stepNumber:p,text:y.content,toolCalls:y.toolCalls,toolResults:w,finishReason:y.rawStopReason,usage:y.usage}),await r.onStepFinish?.(o[o.length-1]),a>t&&(l=!0),r.shouldStop?.({steps:o})&&(l=!0)}return u("max-steps");function u(p){return{text:c?.content??"",steps:o,finishReason:p,usage:s,messages:i,finalTurn:c??{content:"",toolCalls:[],normalizedStopReason:"stop",rawStopReason:"",usage:{promptTokens:0,completionTokens:0,totalTokens:0}}}}async function d(p){if(p.parseError)return f(p,"could not parse the tool arguments as JSON");let m=r.getTool(p.name);if(!m)return f(p,`unknown tool "${p.name}"`);let v=p.args??{},g=r.validateArgs(m,v);if(g)return f(p,`invalid arguments: ${g}`);if(!await r.confirm(p,m))return f(p,"tool call denied by user");let w;try{w=await m.execute(v,{toolCallId:p.id,toolName:p.name})}catch(_){if(r.isAbortError(_))throw _;return f(p,`tool execution failed: ${_ instanceof Error?_.message:String(_)}`)}let{content:x,isError:C}=wve(w,e);return{toolCallId:p.id,name:p.name,content:x,isError:C}}function f(p,m){return{toolCallId:p.id,name:p.name,content:m,isError:!0}}}var y9=b(()=>{});function hD(r,e="schema"){if(r===null||typeof r!="object"||Array.isArray(r))throw new Gc(`${e} must be a JSON Schema object.`);for(let t of Object.keys(r))if(!b9.has(t))throw new Gc(`${e} uses unsupported JSON Schema keyword "${t}". QuickAdd tool schemas support only: ${[...b9].join(", ")}. (Constraints like pattern/minLength/additionalProperties/$ref/allOf/anyOf/format are rejected because at least one provider would silently drop them.)`);if(r.type!==void 0){let t=Array.isArray(r.type)?r.type:[r.type];for(let n of t)if(!Cve.has(n))throw new Gc(`${e} has invalid type "${String(n)}".`)}if(r.properties!==void 0){if(r.properties===null||typeof r.properties!="object"||Array.isArray(r.properties))throw new Gc(`${e}.properties must be an object.`);for(let[t,n]of Object.entries(r.properties))hD(n,`${e}.properties.${t}`)}if(r.required!==void 0&&(!Array.isArray(r.required)||r.required.some(t=>typeof t!="string")))throw new Gc(`${e}.required must be an array of strings.`);if(r.items!==void 0){if(Array.isArray(r.items))throw new Gc(`${e}.items as an array (tuple validation) is not supported in QuickAdd's schema subset.`);hD(r.items,`${e}.items`)}if(r.enum!==void 0&&!Array.isArray(r.enum))throw new Gc(`${e}.enum must be an array.`)}function mD(r){return r===null?"null":Array.isArray(r)?"array":typeof r=="number"?Number.isInteger(r)?"integer":"number":typeof r=="boolean"?"boolean":typeof r=="string"?"string":"object"}function xve(r,e){let t=mD(r);return t===e||e==="number"&&t==="integer"}function cE(r,e,t="$"){if(e.type!==void 0){let n=Array.isArray(e.type)?e.type:[e.type];if(!n.some(i=>xve(r,i)))return`${t}: expected ${n.join(" | ")}, got ${mD(r)}`}if(Array.isArray(e.enum)&&!e.enum.some(i=>gD(i,r)))return`${t}: value is not one of the allowed enum values`;if("const"in e&&!gD(e.const,r))return`${t}: value does not equal the required const`;if(mD(r)==="object"){let n=r;if(Array.isArray(e.required)){for(let i of e.required)if(!Object.prototype.hasOwnProperty.call(n,i))return`${t}.${i}: required property is missing`}if(e.properties){for(let[i,o]of Object.entries(e.properties))if(i in n){let s=cE(n[i],o,`${t}.${i}`);if(s)return s}}}if(mD(r)==="array"&&e.items&&!Array.isArray(e.items)){let n=r;for(let i=0;i<n.length;i++){let o=cE(n[i],e.items,`${t}[${i}]`);if(o)return o}}return null}function gD(r,e){if(r===e)return!0;if(typeof r!=typeof e)return!1;if(r===null||e===null)return r===e;if(Array.isArray(r)&&Array.isArray(e))return r.length===e.length&&r.every((t,n)=>gD(t,e[n]));if(typeof r=="object"&&typeof e=="object"){let t=Object.keys(r),n=Object.keys(e);return t.length!==n.length?!1:t.every(i=>gD(r[i],e[i]))}return!1}var b9,Cve,Gc,w9=b(()=>{b9=new Set(["type","properties","required","items","enum","const","description","title"]),Cve=new Set(["object","array","string","number","integer","boolean","null"]),Gc=class extends Error{constructor(e){super(e),this.name="ToolSchemaError"}}});function vD(r){return r.toLowerCase().startsWith(b0)}var Z1=b(()=>{Tt()});function uE(r){let e=r.trim();if(!e)throw new Error("assignToVariable cannot be empty.");if(new Set(["value","title","text","meta"]).has(e.toLowerCase()))throw new Error(`assignToVariable "${e}" is reserved (it would hijack a built-in formatter token).`);if(e.toLowerCase().endsWith("-quoted"))throw new Error(`assignToVariable "${e}" cannot end with "-quoted" (collides with the quoted output variable).`);if(vD(e))throw new Error(`assignToVariable "${e}" uses the reserved "__qa." prefix for QuickAdd internal variables.`);if(/[|,]/.test(e))throw new Error(`assignToVariable "${e}" contains characters unreachable by {{VALUE:name}}.`)}var J1=b(()=>{Z1()});function Eve(r,e){if(!e||typeof e!="object")return"";let t=e,n=typeof t.path=="string"?t.path.trim():"",i=typeof t.heading=="string"?t.heading.trim():"";if(!n&&!i)return"";let o=[];return n&&o.push(`Target: ${n}`),i&&o.push(`Heading: ${i}`),o.join(" \xB7 ")}function Tve(r){try{return JSON.stringify(r,null,2)??String(r)}catch{return String(r)}}function _ve(r){r.forEach(e=>{e.addEventListener("keydown",t=>{if(t.key==="ArrowRight"||t.key==="ArrowLeft"){let i=(r.indexOf(e)+(t.key==="ArrowRight"?1:-1)+r.length)%r.length;r[i].focus(),t.preventDefault()}})})}var lf,dE,C9=b(()=>{lf=require("obsidian"),dE=class r extends lf.Modal{constructor(t,n,i){super(t);this.toolName=n;this.args=i;this.outcome=null;this.waitForClose=new Promise(o=>{this.resolvePromise=o}),this.open(),this.display()}static Prompt(t,n,i){return new r(t,n,i).waitForClose}display(){this.containerEl.addClass("quickAddModal","qaAIToolConfirm"),this.contentEl.empty(),this.titleEl.textContent=`Run AI tool: ${this.toolName}?`,this.contentEl.createEl("p",{text:"The AI requested this tool call with the arguments below."});let t=Eve(this.toolName,this.args);t&&this.contentEl.createEl("p",{cls:"qaAIToolSummary",text:t});let n=this.contentEl.createEl("pre",{cls:"qaAIToolArgs"});n.textContent=Tve(this.args),n.setCssStyles({whiteSpace:"pre-wrap",wordBreak:"break-word",maxHeight:"16rem",overflowY:"auto"});let i=this.contentEl.createDiv({cls:"yesNoPromptButtonContainer"}),o=new lf.ButtonComponent(i).setButtonText("Abort run").onClick(()=>this.submit("abort")),s=new lf.ButtonComponent(i).setButtonText("Deny").onClick(()=>this.submit("deny")),a=new lf.ButtonComponent(i).setButtonText("Approve all this run").onClick(()=>this.submit("allow-all")),l=new lf.ButtonComponent(i).setButtonText("Approve").onClick(()=>this.submit("allow"));s.buttonEl.focus(),_ve([o.buttonEl,s.buttonEl,a.buttonEl,l.buttonEl])}submit(t){this.outcome=t,this.close()}onClose(){super.onClose(),this.resolvePromise(this.outcome??"deny")}}});function Sve(r){return r instanceof Nt}function Dve(r){return{content:r.content,toolCalls:r.toolCalls??[],normalizedStopReason:r.normalizedStopReason??"stop",rawStopReason:r.stopReason,usage:r.usage,providerRaw:r.providerRaw}}function Ive(r){if(r)return typeof r=="string"?r:{name:r.toolName}}function Pve(r){return{toolCallId:r.id,toolName:r.name,input:r.args}}function Fve(r){return{toolCallId:r.toolCallId,toolName:r.name,output:r.content,isError:r.isError??!1}}function E9(r,e){let t;try{t=JSON.parse(Mve(r))}catch(i){return{ok:!1,error:`not valid JSON (${i instanceof Error?i.message:String(i)})`}}let n=cE(t,e);return n?{ok:!1,error:n}:{ok:!0,value:t}}function Mve(r){let e=r.trim(),t=e.match(/^```(?:json)?\s*([\s\S]*?)\s*```$/i);return t?t[1]:e}var x9,Ave,kve,eN,yD,T9=b(()=>{It();Vg();NO();Co();Ns();Uh();Kp();Sx();PO();$O();y9();w9();J1();C9();x9=/^[a-zA-Z0-9_-]{1,64}$/,Ave=20,kve=100,eN=new WeakSet;yD=class{constructor(e,t,n,i){this.app=e;this.plugin=t;this.choiceExecutor=n;this.config=i;this.running=!1;this.approveAllThisRun=!1;let o=new Set;for(let[s,a]of Object.entries(i.tools??{})){if(!x9.test(s))throw new Error(`Invalid tool name "${s}". Tool names must match ${x9}.`);if(o.has(s))throw new Error(`Duplicate tool name "${s}".`);o.add(s),hD(a.inputSchema,`tool "${s}".inputSchema`)}}async generate(e={}){if(this.running)throw new Error("This agent is already running a generate() call. Await it, or create a separate agent for concurrent runs.");let t=typeof e.assignToVariable=="string"&&e.assignToVariable.length>0;if(t&&(this.assertAssignableName(e.assignToVariable),eN.has(this.choiceExecutor)))throw new Error("Another AI run with assignToVariable is already in flight in this context \u2014 they would race the shared variables. Run them sequentially.");this.running=!0,t&&eN.add(this.choiceExecutor);let n=FS(this.app);try{return await this.run(e,n)}finally{this.running=!1,t&&eN.delete(this.choiceExecutor);try{n()}catch{}}}async run(e,t){this.approveAllThisRun=!1;let n=le.getState();if(n.disableOnlineFeatures)throw new Error("Rejecting AI request: Online features are disabled in settings.");let{model:i,provider:o}=Bh(this.config.model),s=await Va(this.app,o),a=await this.buildSeedMessages(e),l=this.buildToolDefinitions(),c=this.buildRegistry(),u=e.schema?{schema:e.schema,name:"response",strict:!0}:void 0,d={messages:a,...l.length>0?{tools:l}:{},toolChoice:Ive(e.toolChoice??this.config.toolChoice)??"auto",maxOutputTokens:e.maxOutputTokens??this.config.maxOutputTokens,modelParams:this.config.modelOptions},f=Math.max(1,Math.min(this.config.maxSteps??Ave,kve)),p=gg(n.ai.showAssistant);p.setMessage("starting","QuickAdd is running the AI agent.");try{let m=await v9({request:d,maxSteps:f,dispatch:async(g,y)=>{let w=this.buildTurnRequest(g,y.isFinalStep,u),x=await RO(this.app,s,i,o,w,t);return Dve(x)},getTool:g=>c.get(g),confirm:(g,y)=>this.confirm(g,y),validateArgs:(g,y)=>cE(y,g.definition.parameters),isAbortError:Sve,isContextOverflow:g=>kx(g)==="input_context",isOnlineDisabled:()=>le.getState().disableOnlineFeatures,shouldStop:this.buildShouldStop(),onStepFinish:g=>this.reportStep(p,g)}),v=this.toGenerateResult(m);return e.schema&&(v.object=await this.resolveStructuredObject(m,d,i,o,s,e.schema,t)),typeof e.assignToVariable=="string"&&e.assignToVariable&&this.assignVariable(e.assignToVariable,v.text),p.setMessage("finished",`Ran ${v.steps.length} step${v.steps.length===1?"":"s"}.`),window.setTimeout(()=>p.hide(),5e3),v}catch(m){throw p.setMessage("dead",m?.message??""),window.setTimeout(()=>p.hide(),5e3),m}}reportStep(e,t){let n=t.toolCalls.map(o=>o.name),i=n.length>0?`Step ${t.stepNumber+1}: running ${n.join(", ")}.`:`Step ${t.stepNumber+1}: generating a response.`;e.setMessage("thinking",i)}async buildSeedMessages(e){let t=[],n=e.system??this.config.system??le.getState().ai.defaultSystemPrompt;n&&n.trim().length>0&&t.push({role:"system",content:n});let i=e.prompt??"",o=i?await new Cs(this.app,this.plugin,this.choiceExecutor).formatFileContent(i):"";return t.push({role:"user",content:o}),t}buildToolDefinitions(){return Object.entries(this.config.tools??{}).map(([e,t])=>({name:e,description:t.description,parameters:t.inputSchema,...t.strict?{strict:!0}:{}}))}buildRegistry(){let e=new Map;for(let[t,n]of Object.entries(this.config.tools??{}))e.set(t,{definition:{name:t,description:n.description,parameters:n.inputSchema,strict:n.strict},execute:(i,o)=>n.execute(i,o),readOnly:n.readOnly});return e}buildShouldStop(){let e=this.config.stopWhen?Array.isArray(this.config.stopWhen)?this.config.stopWhen:[this.config.stopWhen]:[];if(e.length!==0)return({steps:t})=>{let n=t.flatMap(i=>i.toolCalls.map(o=>o.name));return e.some(i=>i({stepNumber:t.length,toolCallNames:n}))}}buildTurnRequest(e,t,n){return!!(e.tools&&e.tools.length>0)&&!t?{...e,responseFormat:void 0}:{...e,tools:void 0,toolChoice:t?"none":e.toolChoice,responseFormat:n}}async confirm(e,t){let n=e.args??{},i=await this.resolvePerToolApproval(t,n);if(!(i||this.needsGlobalConfirmation(t))||this.approveAllThisRun&&!i)return!0;if(this.choiceExecutor.interactive===!1)throw new Ee(`'${e.name}' needs approval before it runs, but this run is non-interactive. Set the AI assistant's tool-confirmation to "never", mark the tool readOnly, or re-run with the ui flag.`);let s=await dE.Prompt(this.app,e.name,e.args??{});if(s==="abort")throw new Nt("AI tool run aborted by user");return s==="allow-all"?(this.approveAllThisRun=!0,!0):s==="allow"}async resolvePerToolApproval(e,t){let i=this.config.tools?.[e.definition.name]?.needsApproval;return typeof i=="function"?await i({args:t}):i===!0}needsGlobalConfirmation(e){let t=le.getState().ai.confirmToolCalls??"destructive";return t==="always"?!0:t==="destructive"?e.readOnly!==!0:!1}async resolveStructuredObject(e,t,n,i,o,s,a){let l=E9(e.finalTurn.content,s);if(l.ok)return l.value;if(e.finishReason==="aborted"||e.finishReason==="context-overflow"||le.getState().disableOnlineFeatures)return;let c=[...e.messages,{role:"assistant",content:e.finalTurn.content},{role:"user",content:`Your previous reply was not valid JSON matching the required schema (${l.error}). Reply with ONLY a JSON object that matches the schema \u2014 no prose, no code fences.`}],u={...t,messages:c,tools:void 0,toolChoice:"none",responseFormat:{schema:s,name:"response",strict:!0}};try{let d=await RO(this.app,o,n,i,u,a),f=E9(d.content,s);return f.ok?f.value:void 0}catch{return}}toGenerateResult(e){let t=e.steps.map(i=>({stepNumber:i.stepNumber,text:i.text,toolCalls:i.toolCalls.map(Pve),toolResults:i.toolResults.map(Fve),finishReason:i.finishReason})),n=t[t.length-1];return{text:e.text,steps:t,toolCalls:n?.toolCalls??[],toolResults:n?.toolResults??[],usage:{inputTokens:e.usage.promptTokens,outputTokens:e.usage.completionTokens,totalTokens:e.usage.totalTokens},finishReason:e.finishReason}}assignVariable(e,t){let n=e.trim(),i=("> "+t).replace(/\n/g,`
|
||
> `);this.choiceExecutor.variables.set(n,t),this.choiceExecutor.variables.set(`${n}-quoted`,i)}assertAssignableName(e){uE(e)}}});function tN(r){let e=(0,A9.getFrontMatterInfo)(r);return e.exists?e.contentStart:0}function $ve(r,e){let t=tN(r);if(t===0)return 0;if(_9.test(e))return t;let n=_9.exec(r.slice(t));return n?t+n[0].length:t}function rN(r,e){if(e.length===0)return{content:r,insertedStartOffset:null,insertedEndOffset:null};let t=$ve(r,e),n=r.slice(0,t),i=r.slice(t),o=n.length>0&&!n.endsWith(`
|
||
`)&&!Rve.test(e)?`
|
||
`:"",s=i.length>0&&!e.endsWith(`
|
||
`)?`
|
||
`:"",a=n.length+o.length,l=a+e.length;return{content:`${n}${o}${e}${s}${i}`,insertedStartOffset:a,insertedEndOffset:l}}function bD(r,e){return rN(r,e).content}var A9,_9,Rve,pE=b(()=>{A9=require("obsidian"),_9=/^[^\S\r\n]*\r?\n/,Rve=/^\r?\n/});function nN(r){return(r??"").trim().replace(/\\/g,"/").replace(/\/+/g,"/").replace(/^\/+|\/+$/g,"").normalize("NFC")}function iN(r,e){return e.some(t=>r===t||r.startsWith(`${t}/`))}function cf(r,e){let t=(e??[]).map(n=>nN(n)).filter(n=>n.length>0);return t.length===0?!0:r?iN(r.normalize("NFC"),t):!1}var wD=b(()=>{});function uf(r,e={}){let t=(r??"").trim();if(!t)throw new aa("Path is empty.");let n=t.replace(/\\/g,"/").normalize("NFC");if(n.startsWith("/")||/^[a-zA-Z]:/.test(n))throw new aa(`Refusing to write to an absolute path outside the vault: "${n}".`);let i=n.replace(/\/+/g,"/").replace(/^\/+|\/+$/g,""),o=i.split("/").filter(a=>a.length>0);if(o.length===0)throw new aa("Path is empty after normalization.");for(let a of o){if(a==="."||a==="..")throw new aa(`Refusing path with a traversal segment ("${a}"): "${i}".`);if(a.startsWith("."))throw new aa(`Refusing to write into a dot/config path segment ("${a}"): "${i}".`);Ove(a,i)}let s=(e.allowedRoots??[]).map(a=>nN(a)).filter(a=>a.length>0);if(s.length>0&&!iN(i,s))throw new aa(`Path "${i}" is not under an allowed root (${s.join(", ")}).`);return i}function Ove(r,e){if(O_.test(r))throw new aa(`Path segment "${r}" contains control characters: "${e}".`);if(N_.test(r))throw new aa(`Path segment "${r}" contains an illegal character (\\ : * ? " < > |): "${e}".`);if(L_.test(r))throw new aa(`Path segment "${r}" cannot end with a space or a period: "${e}".`);let t=r.split(".")[0]??"";if(t&&Pm(t))throw new aa(`Path segment "${r}" is a reserved device name: "${e}".`)}var aa,k9=b(()=>{B_();wD();aa=class extends Error{constructor(e){super(e),this.name="UnsafeVaultPathError"}}});function qg(r,e){let t=Object.entries(r),n=new Set(t.map(([o])=>o));if(S9(e.only,n,"only"),S9(e.exclude,n,"exclude"),e.only){let o=new Set(e.only);t=t.filter(([s])=>o.has(s))}if(e.exclude){let o=new Set(e.exclude);t=t.filter(([s])=>!o.has(s))}let i=e.prefix??"";return Object.fromEntries(t.map(([o,s])=>[i+o,s]))}function fE(r){return{...r,__qaTool:!0}}function S9(r,e,t){if(!r)return;let n=r.filter(i=>!e.has(i));n.length!==0&&F.logWarning(`AI tools: ${t} listed unknown tool name(s) ${n.map(i=>`"${i}"`).join(", ")}. Valid names: ${[...e].join(", ")}.`)}var CD=b(()=>{Me()});function $9(r,e={}){let t=e.allowedRoots,n={read_note:df({description:"Read a note's full markdown content by vault path.",inputSchema:pf({path:la("Vault path to the note, e.g. Notes/Foo.md")},["path"]),readOnly:!0,execute:async({path:i})=>{let o=uf(String(i),{allowedRoots:t}),s=r.vault.getAbstractFileByPath(o);if(!(s instanceof sN.TFile))return{found:!1,path:o};let a=await r.vault.cachedRead(s);return{found:!0,path:o,content:a.length>D9?a.slice(0,D9)+`
|
||
\u2026[truncated]`:a}}}),list_notes:df({description:"List markdown notes, optionally within a folder.",inputSchema:pf({folder:la("Folder to list (omit for the whole vault)."),limit:I9("Max results (default 100, capped at 200).")},[]),readOnly:!0,execute:async({folder:i,limit:o})=>{let s=i?uf(String(i),{allowedRoots:t}):"",a=M9(F9(o,Nve),1,Lve),l=rs(r,s).filter(c=>cf(c.path,t));return{total:l.length,notes:l.slice(0,a).map(c=>({path:c.path,basename:c.basename}))}}}),search_notes:df({description:"Search notes by name and/or content. Returns matching paths with a short snippet.",inputSchema:pf({query:la("Text to search for."),in:P9(["name","content","both"],"Where to search (default both)."),limit:I9("Max results (default 25, capped at 50).")},["query"]),readOnly:!0,execute:async({query:i,in:o,limit:s})=>{let a=String(i).toLowerCase(),l=o??"both",c=M9(F9(s,Bve),1,Uve),u=r.vault.getMarkdownFiles().filter(m=>cf(m.path,t)),d=[],f=0,p=!1;for(let m of u){if(d.length>=c)break;if(l!=="content"&&m.basename.toLowerCase().includes(a)){d.push({path:m.path});continue}if(l!=="name"){if(f>=Vve){p=!0;continue}f++;let g=await r.vault.cachedRead(m),y=g.toLowerCase().indexOf(a);y>=0&&d.push({path:m.path,snippet:Wve(g,y)})}}return{results:d,scannedFiles:f,truncated:d.length>=c||p}}}),get_property_values:df({description:"List the distinct values a frontmatter property takes across the vault (e.g. existing tags or statuses).",inputSchema:pf({field:la("Frontmatter property name."),folder:la("Optional folder scope.")},["field"]),readOnly:!0,execute:async({field:i,folder:o})=>{let s=o?uf(String(o),{allowedRoots:t}):"",a=(o?rs(r,s):r.vault.getMarkdownFiles()).filter(c=>cf(c.path,t)),l=new Set;for(let c of a){let d=r.metadataCache.getFileCache(c)?.frontmatter?.[String(i)];if(d!=null){for(let f of Array.isArray(d)?d:[d])if(typeof f!="object"){let p=String(f).trim();p&&l.add(p)}}}return{field:String(i),values:[...l].sort().slice(0,200)}}}),create_note:df({description:"Create a new markdown note. Fails if the path already exists.",inputSchema:pf({path:la("Vault path for the new note."),content:la("Initial markdown content.")},["path"]),needsApproval:!0,execute:async({path:i,content:o})=>{let s=uf(oN(String(i)),{allowedRoots:t});return await dg(r,s),await qve(r,s),{created:!0,path:(await r.vault.create(s,String(o??""))).path}}}),append_to_note:df({description:"Append text to an existing note (frontmatter-aware for top inserts).",inputSchema:pf({path:la("Vault path to the existing note."),content:la("Markdown to append."),position:P9(["top","bottom"],"Where to add it (default bottom).")},["path","content"]),needsApproval:!0,execute:async({path:i,content:o,position:s})=>{let a=uf(oN(String(i)),{allowedRoots:t}),l=R9(r,a);await dg(r,a);let c=await r.vault.read(l),u=String(o),d=s==="top"?bD(c,u.endsWith(`
|
||
`)?u:u+`
|
||
`):`${c}${c.endsWith(`
|
||
`)||c.length===0?"":`
|
||
`}${u}`;return await r.vault.modify(l,d),{appended:!0,path:a}}}),insert_under_heading:df({description:"Insert markdown under an existing heading (matched exactly). Errors if the heading is not found.",inputSchema:pf({path:la("Vault path to the existing note."),heading:la("Exact heading text (without the # markers)."),content:la("Markdown to insert under the heading.")},["path","heading","content"]),needsApproval:!0,execute:async({path:i,heading:o,content:s})=>{let a=uf(oN(String(i)),{allowedRoots:t}),l=R9(r,a);await dg(r,a);let c=r.metadataCache.getFileCache(l)?.headings??[],u=c.find(p=>p.heading===String(o));if(!u)throw new Error(`Heading "${o}" not found in ${a}`);let d=await r.vault.read(l),f=zve(d,u.position.start.line,u.level,String(s),c);return await r.vault.modify(l,f),{inserted:!0,path:a,heading:String(o)}}})};return qg(n,e)}function df(r){return{...r,__qaTool:!0}}function pf(r,e){return{type:"object",properties:r,required:e}}function la(r){return{type:"string",description:r}}function I9(r){return{type:"integer",description:r}}function P9(r,e){return{type:"string",enum:r,description:e}}function F9(r,e){let t=Number(r);return Number.isFinite(t)?Math.floor(t):e}function M9(r,e,t){return Math.max(e,Math.min(t,r))}function oN(r){if(/\.md$/i.test(r))return r;if(/\.[a-z0-9]+$/i.test(r))throw new Error(`This tool only operates on markdown notes (.md); refused path: "${r}".`);return`${r}.md`}function R9(r,e){let t=r.vault.getAbstractFileByPath(e);if(!(t instanceof sN.TFile))throw new Error(`Note not found: ${e}`);return t}async function qve(r,e){let t=e.lastIndexOf("/");if(t<=0)return;let n=e.slice(0,t);if(!r.vault.getAbstractFileByPath(n))try{await r.vault.createFolder(n)}catch{}}function Wve(r,e){let t=Math.max(0,e-40);return r.slice(t,e+80).replace(/\s+/g," ").trim()}function zve(r,e,t,n,i){let o=r.split(`
|
||
`),s=o.length;for(let u of i)if(u.position.start.line>e&&u.level<=t){s=u.position.start.line;break}let a=n.endsWith(`
|
||
`)?n:n+`
|
||
`,l=o.slice(0,s),c=o.slice(s);for(;l.length>e+1&&l[l.length-1].trim()==="";)l.pop();return[...l,a.replace(/\n$/,""),...c].join(`
|
||
`)}var sN,D9,Nve,Lve,Bve,Uve,Vve,O9=b(()=>{sN=require("obsidian");qt();pE();wD();k9();cO();CD();D9=16e3,Nve=100,Lve=200,Bve=25,Uve=50,Vve=400});function L9(r,e={}){let t=e.allowedRoots,n=()=>{let s=r.workspace.getActiveFile();return!(s instanceof xD.TFile)||s.extension!=="md"?null:cf(s.path,t)?s:null},i=()=>{let s=r.workspace.getActiveViewOfType(xD.MarkdownView);return s&&cf(s.file?.path,t)?s:null},o={get_active_note:fE({description:"Get the currently active note (path, basename, and content). Returns active:null if there is none.",inputSchema:{type:"object",properties:{}},readOnly:!0,execute:async()=>{let s=n();if(!s)return{active:null};let a=await r.vault.cachedRead(s);return{active:{path:s.path,basename:s.basename,content:a.length>N9?a.slice(0,N9)+`
|
||
\u2026[truncated]`:a}}}}),get_selection:fE({description:"Get the text currently selected in the active editor (empty string if none).",inputSchema:{type:"object",properties:{}},readOnly:!0,execute:async()=>({selection:i()?.editor?.getSelection()??""})})};return qg(o,e)}var xD,N9,B9=b(()=>{xD=require("obsidian");wD();CD();N9=16e3});function U9(r={}){let e={get_date:fE({description:"Get the current date/time. Optionally pass a moment.js format and a day offset.",inputSchema:{type:"object",properties:{format:{type:"string",description:"moment.js format, e.g. YYYY-MM-DD"},offset:{type:"integer",description:"Day offset from today (e.g. 1 = tomorrow)."}}},readOnly:!0,execute:async({format:t,offset:n})=>({date:Us({format:t!=null?String(t):void 0,offset:n!=null?Number(n):void 0})})})};return qg(e,r)}var V9=b(()=>{qt();CD()});var mE,Wg,q9=b(()=>{mE=require("obsidian");zr();qO();Wg=class r extends mE.Modal{constructor(t,n,i=[],o){super(t);this.items=n;this.selectedItems=i;this.header=o;this._selectedItems=[...i],this.promise=new Promise((s,a)=>{this.resolvePromise=s,this.rejectPromise=a}),this.display(),this.open(),this.picker.focusSearchOnOpen()}static Open(t,n,i,o){return new r(t,n,i,o).promise}display(){this.contentEl.empty(),this.containerEl.addClass("quickAddModal","qaSearchableMultiSelectModal","checkboxPrompt"),this.header&&(this.titleEl.textContent=this.header),this.addSearchableOptions(),this.addSubmitButton()}onClose(){super.onClose(),this.resolved||this.rejectPromise(rn())}addSearchableOptions(){this.picker=new Qp(this.contentEl,{items:this.items.map(t=>({key:t,value:t,label:t})),isSelected:({value:t})=>this._selectedItems.includes(t),onToggle:({value:t},n)=>{if(n){this._selectedItems.includes(t)||this._selectedItems.push(t);return}this._selectedItems=this._selectedItems.filter(i=>i!==t)},getSelectedCount:()=>new Set(this._selectedItems).size})}addSubmitButton(){let t=this.contentEl.createDiv("submitButtonContainer");new mE.ButtonComponent(t).setButtonText("Submit").setCta().onClick(()=>{this.resolved=!0,this.resolvePromise(this._selectedItems),this.close()}),new mE.ButtonComponent(t).setButtonText("Cancel").onClick(()=>{this.close()})}}});var ED,hE,W9=b(()=>{ED=require("obsidian"),hE=class r extends ED.Modal{constructor(t,n,i){super(t);this.header=n;this.text=i;this.waitForClose=new Promise(o=>{this.resolvePromise=o}),this.open(),this.display()}static Show(t,n,i){return new r(t,n,i).waitForClose}display(){this.contentEl.empty(),this.titleEl.textContent=this.header,String.isString(this.text)?this.contentEl.createEl("p",{text:this.text}):Array.isArray(this.text)&&this.text.forEach(i=>this.contentEl.createEl("p",{text:i}));let t=this.contentEl.createDiv(),n=new ED.ButtonComponent(t).setButtonText("OK").onClick(()=>this.close());Object.assign(t.style,{display:"flex",justifyContent:"flex-end"}),n.buttonEl.focus()}onClose(){super.onClose(),this.resolvePromise()}}});var TD,z9=b(()=>{Ru();U1();ml();TD=class extends hn{constructor(e,t,n){super(e,t),this.fieldInput=n;let i=Yi.parse(n);this.fieldName=i.fieldName,this.filters=i.filters}async getSuggestions(e){let t=await t9(this.app,this.fieldName,this.filters),n=(e||"").toLowerCase();return n?t.filter(i=>i.toLowerCase().includes(n)).slice(0,200):t.slice(0,200)}renderSuggestion(e,t){this.renderMatch(t,e,this.getCurrentQuery())}selectSuggestion(e){this.inputEl.value=e;let t=new Event("input",{bubbles:!0});t.fromCompletion=!0,this.inputEl.dispatchEvent(t),this.close()}}});var H9,aN,_D,j9=b(()=>{H9=require("obsidian");ml();aN=200,_D=class extends hn{constructor(t,n,i,o,s,a,l){super(t,n);this.getOptions=i;this.isSelected=o;this.onSelect=s;this.multiSelect=a;this.allowCustomInput=l;a&&n.setAttribute("aria-multiselectable","true")}getSuggestions(t){let n=t.trim(),i=this.getOptions().filter(u=>!this.isSelected(u.value));if(!n)return i.slice(0,aN);let o=(0,H9.prepareFuzzySearch)(n),s=i.map(u=>({option:u,match:o(`${u.label} ${u.path}`)})).filter(u=>u.match!==null).sort((u,d)=>d.match.score-u.match.score).slice(0,aN).map(({option:u})=>u);if(!this.allowCustomInput)return s;let a=n.toLocaleLowerCase(),l=this.getOptions().some(u=>u.label.toLocaleLowerCase()===a||u.path.toLocaleLowerCase()===a),c=this.isSelected(n);return l||c?s:[{value:n,label:`Use \u201C${n}\u201D`,path:"Custom value",isCustom:!0},...s].slice(0,aN)}renderSuggestion(t,n){n.addClass("qa-onepage-file-suggestion");let i=n.createDiv({cls:"qa-onepage-file-suggestion__text"}),o=i.createDiv({cls:"qa-onepage-file-suggestion__label"});t.isCustom?o.setText(t.label):this.renderMatch(o,t.label,this.getCurrentQuery().trim()),i.createDiv({cls:"qa-onepage-file-suggestion__path",text:t.path})}selectSuggestion(t){if(this.onSelect(t),this.inputEl.value="",!this.multiSelect){this.close();return}let n=new Event("input",{bubbles:!0});n.fromCompletion=!0,n.keepOpen=!0,this.inputEl.dispatchEvent(n),this.inputEl.focus()}}});var AD,G9=b(()=>{ml();Fo();AD=class extends hn{constructor(e,t,n,i=!1,o=!1,s){super(e,t),this.options=n.map(a=>mn(a)),this.caseSensitive=i,this.multiSelect=o,this.onSelect=s,this.multiSelect&&this.inputEl.setAttribute("aria-multiselectable","true")}parseMultiSelectInput(e){if(!this.multiSelect)return{alreadySelected:[],activeTerm:e};let t=e.split(",").map(n=>n.trim());return{alreadySelected:t.slice(0,-1).filter(Boolean),activeTerm:t[t.length-1]||""}}getRemainingOptions(e){return this.options.filter(t=>!e.includes(t))}getSuggestions(e){let t=wc(e),{alreadySelected:n,activeTerm:i}=this.parseMultiSelectInput(t),o=this.caseSensitive?i:i.toLowerCase(),s=this.getRemainingOptions(n);return o?s.filter(a=>(this.caseSensitive?a:a.toLowerCase()).includes(o)).slice(0,200):s.slice(0,200)}renderSuggestion(e,t){this.renderMatch(t,e,this.getCurrentQuery())}selectSuggestion(e){this.multiSelect?this.selectMultipleItem(e):this.selectSingleItem(e)}selectSingleItem(e){this.inputEl.value=e;let t=new Event("input",{bubbles:!0});t.fromCompletion=!0,this.inputEl.dispatchEvent(t),this.close()}selectMultipleItem(e){let{alreadySelected:t}=this.parseMultiSelectInput(this.inputEl.value);t.push(e),this.onSelect?.(e);let n=this.getRemainingOptions(t).length>0;this.inputEl.value=n?t.join(", ")+", ":t.join(", "),this.inputEl.setSelectionRange(this.inputEl.value.length,this.inputEl.value.length);let i=new Event("input",{bubbles:!0}),o=i;o.fromCompletion=!0,n?(o.keepOpen=!0,this.inputEl.dispatchEvent(i),this.inputEl.focus()):(this.inputEl.dispatchEvent(i),this.close())}}});function Y9(r,e,t){return t?e.get(r)??r:r}function K9(r,e){return e.length===0?r:r===""?e[0]??"":e.includes(r)?r:e[0]??""}var Q9=b(()=>{});var Xt,zg,lN=b(()=>{Xt=require("obsidian");Tt();HO();z9();j9();G9();Ux();Wd();It();x_();Q9();yl();zr();js();zg=class extends Xt.Modal{constructor(t,n,i,o){super(t);this.result=new Map;this.multiSelections=new Map;this.fileSelections=new Map;this.dateParseErrors=new Set;this.previewContainerEl=null;this.previewToken=0;this.settled=!1;this.imagePasteHandles=[];this.filePickerSuggesters=[];this.requirements=n,this.initialValues=new Map,this.computePreview=o,i?.forEach((s,a)=>{typeof s=="string"&&this.initialValues.set(a,s)}),this.updatePreviewDebounced=(0,Xt.debounce)(this.updatePreviews.bind(this),150,!0),this.waitForClose=new Promise((s,a)=>{this.resolvePromise=s,this.rejectPromise=a}),this.display(),this.open()}display(){this.containerEl.addClass("quickAddModal","onePageInputModal"),this.contentEl.empty(),this.contentEl.createEl("h2",{text:"Provide inputs"}).addClass("qa-onepage-title"),this.computePreview&&(this.previewContainerEl=this.contentEl.createDiv(),this.previewContainerEl.addClass("qa-onepage-preview","qa-hidden")),this.requirements.forEach(i=>this.renderField(i)),this.computePreview&&this.updatePreviews();let n=this.contentEl.createDiv();new Xt.Setting(n).addButton(i=>i.setButtonText("Submit").setCta().onClick(()=>this.submit())).addButton(i=>i.setButtonText("Cancel").onClick(()=>this.cancel()))}onOpen(){this.contentEl.querySelector("input, textarea, select")?.focus();let n=this.scope;typeof n?.register=="function"&&n.register(["Mod"],"Enter",()=>(this.submit(),!1))}renderField(t){let n=(o,s)=>{this.result.set(o,s),this.updatePreviewDebounced()},i=this.initialValues.get(t.id)??t.defaultValue??"";switch(t.type){case"textarea":{let o=new Xt.Setting(this.contentEl).setName(this.decorateLabel(t));t.description&&o.setDesc(t.description);let s=new Xt.TextAreaComponent(o.controlEl);s.setPlaceholder(t.placeholder??"").setValue(i).onChange(a=>n(t.id,a)),s.inputEl.addClass("qa-onepage-textarea"),this.enableImagePaste(t,s.inputEl);break}case"text":{let o=new Xt.Setting(this.contentEl).setName(this.decorateLabel(t));t.description&&o.setDesc(t.description);let s=new Xt.TextComponent(o.controlEl);s.setPlaceholder(t.placeholder??"").setValue(i).onChange(a=>n(t.id,a)),this.enableImagePaste(t,s.inputEl);break}case"number":{let o=new Xt.Setting(this.contentEl).setName(this.decorateLabel(t));t.description&&o.setDesc(t.description);let s=new Xt.TextComponent(o.controlEl);s.inputEl.type="number",s.inputEl.inputMode="decimal",t.numericConfig?.min!==void 0&&(s.inputEl.min=String(t.numericConfig.min)),t.numericConfig?.max!==void 0&&(s.inputEl.max=String(t.numericConfig.max)),s.inputEl.step=t.numericConfig?.step!==void 0?String(t.numericConfig.step):"any";let a=t.numericConfig?Ra(i,t.numericConfig):i;s.setPlaceholder(t.placeholder??"").setValue(a).onChange(l=>n(t.id,t.numericConfig?Ra(l,t.numericConfig):l)),n(t.id,a);break}case"slider":{let o=new Xt.Setting(this.contentEl).setName(this.decorateLabel(t));o.controlEl.parentElement?.addClass("qa-onepage-slider-setting"),t.description&&o.setDesc(t.description);let s=t.sliderConfig??{min:0,max:100,step:1},a=t.optional&&i==="",l=Sy(i,s),c=o.controlEl.createDiv({cls:"qa-onepage-slider"}),u=c.createEl("input");u.type="range",u.min=String(s.min),u.max=String(s.max),u.step=String(s.step),u.value=l;let d=new Xt.TextComponent(c);d.inputEl.type="number",d.inputEl.inputMode="decimal",d.inputEl.min=String(s.min),d.inputEl.max=String(s.max),d.inputEl.step=String(s.step),d.setValue(a?"":l),n(t.id,a?"":l),u.addEventListener("input",()=>{d.inputEl.value=u.value,n(t.id,u.value)}),d.onChange(f=>{if(f===""&&t.optional){n(t.id,"");return}let p=Ra(f,s);p!==""&&(u.value=p,d.inputEl.value=p,n(t.id,p))});break}case"dropdown":{let o=new Xt.Setting(this.contentEl).setName(this.decorateLabel(t));t.description&&o.setDesc(t.description);let s=new Xt.DropdownComponent(o.controlEl),a=t.options??[],l=t.displayOptions??a;if(a.length>0){t.optional&&s.addOption("","Skip (leave empty)"),a.forEach((u,d)=>{let f=l[d]??u;s.addOption(u,f)});let c=K9(i,a);s.setValue(c),n(t.id,c),s.onChange(u=>n(t.id,u))}else s.setDisabled(!0),o.controlEl.createDiv({text:t.placeholder||"No options available"}).addClass("qa-onepage-dropdown-note");break}case"date":{let o=new Xt.Setting(this.contentEl).setName(this.decorateLabel(t));t.description&&o.setDesc(t.description);let s=o.controlEl.createDiv({cls:"qa-date-input"}),a=new Xt.TextComponent(s),l="Enter a date (e.g., 'today', 'next friday', '2025-12-25')",c,u=i;i?.startsWith("@date:")&&(c=i.slice(6),u=(t.dateFormat?Nl(c,t.dateFormat):void 0)??(c.length>=10?c.slice(0,10):c)),a.setPlaceholder(l).setValue(u??"");let d=s.createDiv({cls:"qa-date-picker-container"}),f=OS({container:d,initialIso:c,withTime:t.withTime===!0,onSelect:_=>{_?w(_):x()}}),p=s.createDiv();p.addClass("qa-date-preview-text");let m=Uv(le.getState().dateAliases);if(m.length>0){let _=s.createEl("details");_.addClass("qa-date-alias-details"),_.createEl("summary",{text:`Aliases (${m.length})`}).addClass("qa-date-alias-summary");let D=_.createEl("div");D.textContent=xT(le.getState().dateAliases),D.addClass("qa-date-alias-list")}let v=_=>{if(t.dateFormat){let E=Nl(_,t.dateFormat);if(E)return E}return _.length>=10?_.slice(0,10):_},g=(_,E)=>{p.setText(_),p.toggleClass("is-error",E)},y=_=>{f.setSelectedIso(_)},w=_=>{c=_,this.dateParseErrors.delete(t.id);let E=v(_);a.inputEl.value=E,n(t.id,`@date:${_}`),g(E,!1),y(_)},x=()=>{a.inputEl.value="",C("")},C=_=>{let E=(_??"").trim();if(!E&&t.defaultValue&&!t.optional){let P=Zp(t.defaultValue,t.dateFormat);if(P.isValid&&P.isoString){c=P.isoString,this.dateParseErrors.delete(t.id),n(t.id,`@date:${P.isoString}`),y(P.isoString);let H=P.formatted??v(P.isoString);g(H,!1);return}g(P.error||"Unable to parse date",!0),this.dateParseErrors.add(t.id),n(t.id,""),y();return}if(!E){c=void 0,this.dateParseErrors.delete(t.id),n(t.id,""),y(),g(t.optional?"Will be left empty":"Preview will appear here",!1);return}if(E.startsWith("@date:")){let P=E.slice(6).trim();if(P){this.dateParseErrors.delete(t.id),w(P);return}}let D=Zp(E,t.dateFormat);if(D.isValid&&D.isoString){c=D.isoString,this.dateParseErrors.delete(t.id),n(t.id,`@date:${D.isoString}`),y(D.isoString);let P=D.formatted??v(D.isoString);g(P,!1)}else c=void 0,this.dateParseErrors.add(t.id),n(t.id,""),y(),g(D.error||"Unable to parse date",!0)};a.onChange(_=>C(_)),c?w(c):C(u??"");break}case"field-suggest":{let o=new Xt.Setting(this.contentEl).setName(this.decorateLabel(t));t.description&&o.setDesc(t.description);let s=new Xt.TextComponent(o.controlEl);s.setPlaceholder(t.placeholder??"").setValue(i).onChange(l=>n(t.id,l));let a=t.id.startsWith(jd)?t.id.slice(jd.length):t.id;try{new TD(this.app,s.inputEl,a)}catch{}break}case"suggester":{let o=new Xt.Setting(this.contentEl).setName(this.decorateLabel(t));t.description&&o.setDesc(t.description);let s=t.options??[],a=t.displayOptions??s,l=new Map,c=new Map;s.forEach((f,p)=>{let m=a[p]??f;l.set(m,f),c.has(f)||c.set(f,m)});let u=c.get(i)??i,d=new Xt.TextComponent(o.controlEl);if(d.setPlaceholder(t.placeholder??"Type to search...").setValue(u).onChange(f=>n(t.id,f)),d.inputEl.addEventListener("input",f=>{let p=!!f.fromCompletion,m=d.inputEl.value,v=Y9(m,l,p);(v!==m||p)&&n(t.id,v)}),a.length>0)try{let f=t.suggesterConfig?.caseSensitive??!1,p=t.suggesterConfig?.multiSelect??!1;new AD(this.app,d.inputEl,a,f,p,p?m=>{let v=this.multiSelections.get(t.id)??[];v.push(m),this.multiSelections.set(t.id,v)}:void 0)}catch{}break}case"file-picker":{this.renderFilePickerField(t,i,n);break}default:{let o=new Xt.Setting(this.contentEl).setName(this.decorateLabel(t)),s=new Xt.TextComponent(o.controlEl);s.setPlaceholder(t.placeholder??"").setValue(i).onChange(a=>n(t.id,a)),this.enableImagePaste(t,s.inputEl)}}this.result.has(t.id)||this.result.set(t.id,i)}renderFilePickerField(t,n,i){let o=new Xt.Setting(this.contentEl).setName(this.decorateLabel(t));o.settingEl.addClass("qa-onepage-file-picker-setting"),t.description&&o.setDesc(t.description);let s=t.options??[],a=t.displayOptions??s,l=s.map((_,E)=>{let D=gp(_);return{value:_,label:a[E]??_,path:D.kind==="file"?D.path:_}}),c=new Map(l.map(_=>[_.value,_])),u=t.suggesterConfig?.multiSelect??!1,d=t.suggesterConfig?.allowCustomInput??!1,f=new Set,p=new Map,m=_=>{let E=p.get(_);if(E)return E;let D={value:_,label:_,path:"Custom value",isCustom:!0};return p.set(_,D),D};if(n&&c.has(n))f.add(n);else if(n&&d){let _=gp(n),E=_.kind==="custom"?_.text:n;m(E),f.add(E)}else!u&&l.length>0&&f.add(l[0].value);let v=o.controlEl.createDiv({cls:"qa-onepage-file-picker"}),g=v.createDiv({cls:"qa-onepage-file-picker__selection"});g.setAttribute("aria-live","polite");let y=new Xt.TextComponent(v);y.inputEl.addClass("qa-onepage-file-picker__input"),y.setPlaceholder(t.placeholder??(u?"Search and add files...":"Search files...")),y.inputEl.setAttribute("aria-label",u?`Add files for ${t.label}`:`Choose file for ${t.label}`);let w=()=>{let _=l.filter(E=>f.has(E.value));for(let E of p.values())f.has(E.value)&&_.push(E);return _},x=()=>{let _=w(),E=_.map(D=>D.value);this.fileSelections.set(t.id,E),i(t.id,u?E.join(", "):E[0]??""),g.empty(),g.toggleClass("qa-hidden",_.length===0);for(let D of _){let P=g.createDiv({cls:"qa-onepage-file-picker__chip"});P.setAttribute("title",D.path),P.createSpan({cls:"qa-onepage-file-picker__chip-label",text:D.label});let H=P.createEl("button",{cls:"qa-onepage-file-picker__remove",text:"\xD7"});H.type="button",H.setAttribute("aria-label",`Remove ${D.label}`),H.addEventListener("click",()=>{f.delete(D.value),x(),y.inputEl.focus()})}},C=_=>{let E=_.isCustom?m(_.value):_;u||f.clear(),f.add(E.value),x()};y.inputEl.addEventListener("keydown",_=>{if(_.key==="Backspace"&&y.inputEl.value===""&&f.size>0){let E=w().at(-1);if(!E)return;_.preventDefault(),f.delete(E.value),x()}});try{let _=new _D(this.app,y.inputEl,()=>[...l,...p.values()],E=>f.has(E),C,u,d);this.filePickerSuggesters.push(_)}catch{y.setDisabled(!0)}x()}enableImagePaste(t,n){t.pathContext||this.imagePasteHandles.push(_m(this.app,n,{}))}decorateLabel(t){if(!t.optional)return t.label;let n=this.contentEl.ownerDocument,i=n.createDocumentFragment();i.appendChild(n.createTextNode(t.label));let o=n.createElement("span");return o.textContent=" (optional)",o.className="qa-onepage-optional-badge",i.appendChild(o),i}submit(){if(this.settled)return;let t=this.imagePasteHandles.find(o=>o.isBusy());if(t){t.whenIdle().then(()=>this.submit());return}let n={},i=this.requirements.find(o=>o.type==="date"&&!o.optional&&this.dateParseErrors.has(o.id));if(i){new Xt.Notice(`QuickAdd: "${i.label}" is not a valid date. Fix it or clear it before submitting.`);return}for(let[o,s]of this.multiSelections){let a=(this.result.get(o)??"").replace(/,\s*$/,"").trim();s.join(", ")!==a&&this.multiSelections.delete(o)}Object.assign(n,this.collectAnswers()),this.settled=!0,this.close(),this.resolvePromise(n)}collectAnswers(){let t=new Map(this.requirements.map(i=>[i.id,i])),n={};return this.result.forEach((i,o)=>{let s=t.get(o);if(s?.type==="date"&&i===""){let a=this.dateParseErrors.has(o);if(!s.optional||a)return}n[o]=i}),n}collectPreviewAnswers(){let t=this.collectAnswers(),n=new Map(this.requirements.map(i=>[i.id,i]));for(let[i,o]of this.fileSelections)t[i]=n.get(i)?.suggesterConfig?.multiSelect?[...o]:o[0]??"";return t}cancel(){this.settled=!0,this.close(),this.rejectPromise(rn())}onClose(){for(let t of this.imagePasteHandles)t.detach();this.imagePasteHandles.length=0;for(let t of this.filePickerSuggesters)t.destroy();this.filePickerSuggesters.length=0,this.settled||(this.settled=!0,this.rejectPromise(rn()))}async updatePreviews(){if(!this.computePreview||!this.previewContainerEl)return;let t=++this.previewToken;try{let n=await this.computePreview(this.collectPreviewAnswers());if(t!==this.previewToken||!this.previewContainerEl)return;this.previewContainerEl.empty(),this.previewContainerEl.toggleClass("qa-hidden",n.length===0);for(let i of n){let o=i.diagnostics.filter(u=>u.severity==="error"),a=o.some(u=>u.kind!=="path")?"Unresolved":o.length>0?"Won't be created":i.label,l=this.previewContainerEl.createDiv({cls:"qa-onepage-preview-row"});l.createEl("div",{text:`${a}:`,cls:"qa-preview-key"}),l.createEl("div",{text:i.text,cls:"qa-preview-val"}).setAttribute("title",i.text);for(let u of i.diagnostics){let d=this.previewContainerEl.createDiv({cls:"qa-preview-issue"});d.toggleClass("qa-preview-issue--error",u.severity==="error"),d.createSpan({cls:"qa-visually-hidden",text:u.severity==="error"?"Error: ":"Warning: "}),d.appendText(u.message),d.setAttribute("title",u.message)}}}catch{}}}});var kD,X9=b(()=>{HT();kD=class{static filterFiles(e,t,n){return Object.keys(t).length===0?e:e.filter(i=>{let o=this.getIncludeFolders(t);return!(o.length>0&&!o.some(s=>this.matchesFolder(i,s))||t.tags&&t.tags.length>0&&!this.matchesTags(i,t.tags,n))})}static getIncludeFolders(e){let t=e.folders?.length?e.folders:e.folder?[e.folder]:[];return[...new Set(t.map(n=>this.normalizePath(n)).filter(Boolean))]}static matchesFolder(e,t){let n=this.normalizePath(t),i=this.normalizePath(e.path);return i.startsWith(n+"/")||i.substring(0,i.lastIndexOf("/"))===n}static matchesTags(e,t,n){let i=n(e);if(!i)return!1;let o=this.getAllTags(i);return t.map(hc).filter(Boolean).every(a=>o.some(l=>l===a||l.startsWith(a+"/")))}static getAllTags(e){let t=[];return e.frontmatter?.tags&&t.push(...Eu(e.frontmatter.tags)),e.frontmatter?.tag&&t.push(...Eu(e.frontmatter.tag)),e.tags&&t.push(...e.tags.map(n=>hc(n.tag))),t.filter(Boolean)}static normalizePath(e){return e.replace(/^\/+|\/+$/g,"")}}});function tK(r){return gE.some(e=>e.id===r)}function Z9(r){let e=(0,SD.getFrontMatterInfo)(r);return e.exists?{frontmatterYaml:e.frontmatter,body:r.slice(e.contentStart)}:{frontmatterYaml:null,body:r}}function Hve(r,e,t){return t==="bottom"?`${r}
|
||
${e}`:bD(r,`${e}
|
||
`)}function jve(r){return r==null||r===""||Array.isArray(r)&&r.length===0}function J9(r){return typeof r=="string"?r.length>0?[r]:[]:!Array.isArray(r)||!r.every(e=>typeof e=="string")?null:r}function eK(r,e){let t=J9(r),n=J9(e);if(t===null||n===null)return;let i=[],o=new Set(t);for(let s of n)s.length===0||o.has(s)||(o.add(s),i.push(s));if(i.length!==0)return[...t,...i]}var SD,gE,Hg,DD=b(()=>{SD=require("obsidian");Me();qt();uD();$x();$_();_y();Ng();pE();fD();_l();M_();gE=[{id:"cursor",label:"Insert at cursor",description:"Inserts the template at the cursor position in the editor."},{id:"top",label:"Insert at top",description:"Inserts the template below the note's frontmatter, or at the very top."},{id:"bottom",label:"Append to bottom",description:"Adds the template content to the end of the note."},{id:"replace",label:"Replace note content",description:"Replaces the entire note content with the template."}];Hg=class extends hd{constructor(t,n,i,o,s,a,l){super(t,n,a);this.targetFile=i;this.templatePath=o;this.mode=s;this.resolvedTemplatePath=l??null}async run(){await this.apply()}async getResolvedTemplatePath(){return this.resolvedTemplatePath===null&&(this.resolvedTemplatePath=await this.resolveTemplateSourcePath(this.templatePath)),this.resolvedTemplatePath}async apply(){switch(Mi(this.templatePath,"Cannot apply template: no template path given."),this.mode){case"replace":return await this.overwriteFileWithTemplate(this.targetFile,await this.getResolvedTemplatePath());case"top":case"bottom":return await this.insertTemplateIntoFile(this.mode);case"cursor":return await this.insertTemplateAtCursor()}}async computeChoiceTargetPath(t){let n=t.folder,i;if(this.formatter.setTargetFolderPath(null),n?.enabled){if(n.chooseWhenCreatingNote)return null;if(n.createInSameFolderAsActiveFile)i=this.targetFile.parent?.path??"";else{if(n.chooseFromSubfolders)return null;if(n.folders.length===1)i=await this.formatter.formatFolderPath(n.folders[0]);else return null}}else i=this.targetFile.parent?.path??"";i==="/"&&(i="");let o=this.targetFile.basename,s=!1;if(t.fileNameFormat?.enabled&&t.fileNameFormat.format){this.formatter.setTargetFolderPath(i);let a=await this.formatter.formatFileName(t.fileNameFormat.format,"generic"),l=li(a,"File name"),c=this.stripDuplicateFolderPrefix(l,i);o=c.fileName,s=this.shouldTreatFormattedNameAsVaultRelativePath(l,c.strippedPrefix,n?.enabled??!1)}return o.slice(o.lastIndexOf("/")+1).trim()?this.normalizeTemplateFilePath(s?"":i,o,await this.getResolvedTemplatePath()):null}async insertTemplateIntoFile(t){let{formatted:n,templatePropertyVars:i}=await this.formatTemplateForTargetFile(),{frontmatterYaml:o,body:s}=Z9(n);return s.trim().length>0&&await this.app.vault.process(this.targetFile,a=>Hve(a,s,t)),await this.mergeFrontmatterProperties(o,i),this.targetFile}async insertTemplateAtCursor(){let t=Qv(this.app,this.targetFile);Mi(t,"Cannot insert at cursor: the note is not open in the active editor.");let{formatted:n,templatePropertyVars:i}=await this.formatTemplateForTargetFile(),{frontmatterYaml:o,body:s}=Z9(n);return s.trim().length>0&&t.editor.replaceSelection(s),await this.mergeFrontmatterProperties(o,i),this.targetFile}async formatTemplateForTargetFile(){let t=await this.getTemplateContent(await this.getResolvedTemplatePath());this.formatter.setTitle(this.targetFile.basename),this.formatter.setTargetFolderPath(Wo(this.targetFile.path));let n=await this.formatter.withTemplatePropertyCollection(()=>this.formatter.withPromptScope("noteBody",t,()=>this.formatter.formatFileContent(t))),i=this.formatter.getAndClearTemplatePropertyVars();return this.targetFile.extension==="md"&&(n=await dc(this.app,n,this.targetFile)),{formatted:n,templatePropertyVars:i}}async mergeFrontmatterProperties(t,n){if(!t||this.targetFile.extension!=="md")return;let i;try{i=(0,SD.parseYaml)(t)}catch(o){F.logWarning(`Could not parse template frontmatter for merging: ${o}`);return}if(!(!i||typeof i!="object"||Array.isArray(i))){if(n&&n.size>0)for(let[o,s]of n){let a=o.includes(Ma.PATH_SEPARATOR)?o.split(Ma.PATH_SEPARATOR):[o];G1(i,a,R_(s))}await this.app.fileManager.processFrontMatter(this.targetFile,o=>{for(let[s,a]of Object.entries(i)){if(j1([s])){F.logWarning(`Skipping front matter merge for unsafe key "${s}" to avoid prototype pollution.`);continue}let l=Object.hasOwn(o,s)?o[s]:void 0,c=$V(this.app,s);if(jve(l)){c&&Array.isArray(a)?o[s]=eK([],a)??[]:o[s]=a;continue}if(c){let u=eK(l,a);u!==void 0&&(o[s]=u)}}})}}}});function Gve(r){return r.trim().length===0}function Gg(r){return!Wr.test(r)&&!Vi.test(r)}function Yve(r){return r.kind==="choice"?`Choice: ${r.choice.name}`:`Template: ${r.path}`}function rK(r){let e=r.replace(/^\/+/,"").toLowerCase();return/\.(md|canvas|base)$/.test(e)?e:`${e}.md`}function Kve(r,e){let t=Un(r).filter(o=>o.type==="Template"&&!!o.templatePath&&Gg(o.templatePath)),n=new Set(t.map(o=>rK(o.templatePath))),i=t.map(o=>({kind:"choice",choice:o}));for(let o of e)Gg(o)&&(n.has(rK(o))||i.push({kind:"file",path:o}));return i}async function vE(r,e,t){let n=t.file??r.workspace.getActiveFile();if(!n||n.extension!=="md")return new jg.Notice("QuickAdd: No active markdown note to apply a template to."),null;let i=t.choiceExecutor.triggerContext;i==null&&(t.choiceExecutor.triggerContext={activeFile:n});try{let o=!t.templatePath,s;if(t.templatePath)s={kind:"file",path:t.templatePath};else{let m=await Qve(r,e);if(!m)return null;s=m}let a=s.kind==="choice"?s.choice.templatePath:s.path;if(!Gg(a))return new jg.Notice("QuickAdd: Only markdown templates can be applied to a note. Canvas and base templates create their own file types."),null;let l=await r.vault.cachedRead(n),c=Gve(l),u;if(t.mode)u=t.mode;else if(c)u="replace";else if(!o)u="bottom";else{let m=await Xve(r,n);if(!m)return null;u=m}t.choiceExecutor.variables.has("value")||t.choiceExecutor.variables.set("value",n.basename);let d=new Hg(r,e,n,a,u,t.choiceExecutor);d.setPromptRunContext({choiceName:s.kind==="choice"?s.choice.name:void 0,draftScopeId:s.kind==="choice"?s.choice.id:`template-insert#${a}`,destination:n.path,destinationKind:"file"});let f=await d.getResolvedTemplatePath();return Gg(f)?await d.apply()?(o&&s.kind==="choice"&&(d.setPromptRunContext({destination:void 0,destinationKind:void 0}),await Zve(r,d,s.choice,n)),await wu(r,n),new jg.Notice(`Applied template to '${n.basename}'.`),n):null:(new jg.Notice("QuickAdd: Only markdown templates can be applied to a note. Canvas and base templates create their own file types."),null)}catch(o){return Dt(o)||nK(o)||lt(o,"Error applying template to note"),null}finally{t.choiceExecutor.triggerContext=i}}function nK(r){return!!r&&typeof r=="object"&&r.name==="MacroAbortError"}async function Qve(r,e){let t=Kve(e.settings.choices,e.getTemplateFiles().map(n=>n.path));if(t.length===0)return new jg.Notice("QuickAdd: No Template choices or template files found. Create a Template choice or set the template folder path in settings."),null;try{return await Nr.Suggest(r,t.map(Yve),t,"Apply template to note")}catch(n){if(Dt(n))return null;throw n}}async function Xve(r,e){let t=!!Qv(r,e),n=gE.filter(i=>i.id!=="cursor"||t);try{return await Nr.Suggest(r,n.map(i=>i.label),n.map(i=>i.id),"How should the template be applied?")}catch(i){if(Dt(i))return null;throw i}}async function Zve(r,e,t,n){try{let i=await e.computeChoiceTargetPath(t);if(!i||i===n.path||await r.vault.adapter.exists(i)||!p9(i)||!await Qi.Prompt(r,"Move note to match choice settings?",`'${t.name}' creates notes at '${i}'. Move '${n.path}' there? Links to the note will be updated.`))return;let s=i.lastIndexOf("/"),a=s===-1?"":i.slice(0,s);a&&!await r.vault.adapter.exists(a)&&await r.vault.createFolder(a),await r.fileManager.renameFile(n,i)}catch(i){if(Dt(i)||nK(i))return;F.logWarning(`Could not move note to match choice settings: ${i}`)}}var jg,cN=b(()=>{jg=require("obsidian");Tt();qc();Wp();Me();qt();Wt();dD();Cr();DD()});function oK(r){return Array.from(r.entries())}function sK(r,e){r.clear();for(let[t,n]of e)r.set(t,n)}function Jve(r){if(!r||typeof r!="object")return;let e={};return typeof r.min=="number"&&Number.isFinite(r.min)&&(e.min=r.min),typeof r.max=="number"&&Number.isFinite(r.max)&&(e.max=r.max),e.min!==void 0&&e.max!==void 0&&e.max<e.min&&(delete e.min,delete e.max),typeof r.step=="number"&&Number.isFinite(r.step)&&r.step>0&&(e.step=r.step),Object.keys(e).length>0?e:void 0}function eye(r){if(!r||typeof r!="object")return;let{min:e,max:t}=r,n=r.step??1;if(!(typeof e!="number"||typeof t!="number"||typeof n!="number"||!Number.isFinite(e)||!Number.isFinite(t)||!Number.isFinite(n)||t<=e||n<=0))return{min:e,max:t,step:n}}function Yc(r){throw r instanceof Nt?r:Dt(r)?new St(yu):r}var iK,Yg,uN=b(()=>{Cu();RS();bx();Uh();Kp();T9();O9();B9();V9();J1();Vg();q9();W9();Hs();qc();GO();Wp();nd();jO();Fo();lN();It();Me();qt();Cr();lD();X9();N1();Ns();zr();Ux();cN();DD();iK=!1;Yg=class r{static GetApi(e,t,n){return{requestInputs:async i=>{let o={},s=[];for(let u of i){let d=n.variables.get(u.id);if(d!=null){o[u.id]=String(d);continue}let f=eye(u.sliderConfig),p=f??Jve(u.numericConfig),m=u.type==="slider"&&!f?"number":u.type;s.push({id:u.id,label:u.label??u.id,type:m,placeholder:u.placeholder,defaultValue:u.defaultValue,numericConfig:p,sliderConfig:f,options:u.options,dateFormat:u.dateFormat,description:u.description,optional:u.optional,suggesterConfig:u.suggesterConfig,source:"script"})}let a={};if(s.length>0){let u=n?.promptProvider;if(u)try{let d=await u.requestInputs(s);a=Object.fromEntries(Object.entries(d).map(([f,p])=>[f,Array.isArray(p)?p.join(", "):p]))}catch(d){Yc(d)}else{let d=new zg(e,s,n.variables);try{a=await d.waitForClose}catch(f){Yc(f)}}}let l={...o,...a};for(let u of i)l[u.id]===void 0&&(l[u.id]="");Object.entries(l).forEach(([u,d])=>n.variables.set(u,d));let c={};for(let u of i){let d=l[u.id];if(d===void 0)continue;let f=d;if(u.type==="date"&&u.dateFormat&&typeof d=="string"&&d.startsWith("@date:")){let p=d.slice(6),m=Nl(p,u.dateFormat);m&&(f=m)}c[u.id]=f}return c},inputPrompt:(i,o,s,a)=>{let l=n?.promptProvider;return l?l.inputPrompt(i,o,s):r.inputPrompt(e,i,o,s,a)},datePrompt:(i,o)=>{let s=n?.promptProvider;return s?s.datePrompt(i,o):r.datePrompt(e,i,o)},wideInputPrompt:(i,o,s,a)=>{let l=n?.promptProvider;return l?l.wideInputPrompt(i,o,s):r.wideInputPrompt(e,i,o,s,a)},yesNoPrompt:(i,o)=>{let s=n?.promptProvider;return s?s.yesNoPrompt(i,o):r.yesNoPrompt(e,i,o)},infoDialog:(i,o)=>{let s=n?.promptProvider;return s?s.infoDialog(i,o):r.infoDialog(e,i,o)},suggester:(i,o,s,a=!1,l)=>{let c=n?.promptProvider;return c?c.suggester(i,o,s,a):r.suggester(e,i,o,s,a,l)},checkboxPrompt:(i,o,s)=>{let a=n?.promptProvider;return a?a.checkboxPrompt(i,o,s):r.checkboxPrompt(e,i,o,s)},executeChoice:async(i,o)=>{let s;try{s=t.getChoiceByName(i)}catch{s=void 0}if(!s){lt(new Error(`Choice named '${i}' not found`),"API executeChoice error");return}o&&Object.keys(o).forEach(l=>{n.variables.set(l,o[l])}),await n.execute(s);let a=n.consumeAbortSignal?.();if(n.variables.clear(),a)throw a},applyTemplateToActiveFile:async(i,o)=>{if(!i)throw new Error("applyTemplateToActiveFile requires a template path.");if(!Gg(i))throw new Error("applyTemplateToActiveFile only supports markdown templates. Canvas and base templates cannot be applied to a markdown note.");if(o?.mode!==void 0&&!tK(o.mode))throw new Error(`Invalid mode '${String(o.mode)}'. Valid modes: ${gE.map(a=>a.id).join(", ")}.`);let s=oK(n.variables);try{return await vE(e,t,{templatePath:i,mode:o?.mode,choiceExecutor:n})}finally{sK(n.variables,s)}},format:async(i,o,s=!0)=>{let a=s?oK(n.variables):null;o&&Object.keys(o).forEach(c=>{n.variables.set(c,o[c])});let l=await new Cs(e,t,n).formatFileContent(i);return s&&a&&sK(n.variables,a),l},ai:{prompt:async(i,o,s)=>{let a=le.getState(),l=a.ai;if(a.disableOnlineFeatures)throw new Error("Rejecting request to `prompt` via API AI module. Online features are disabled in settings.");let c=r.GetApi(e,t,n).format,{model:u,provider:d}=Bh(o),f=await Va(e,d);s?.assignToVariable&&uE(s.assignToVariable);let p=await r5(e,{model:u,provider:d,prompt:i,apiKey:f,modelOptions:s?.modelOptions??{},outputVariableName:s?.assignToVariable||s?.variableName||"output",showAssistantMessages:s?.showAssistantMessages??!0,systemPrompt:s?.systemPrompt??l.defaultSystemPrompt},(m,v)=>c(m,v,!1));return p?((s?.shouldAssignVariables||s?.assignToVariable)&&Object.entries(p).forEach(([m,v])=>{n.variables.set(m,v)}),p):(lt(new Error("AI Assistant returned null"),"AI Prompt error"),{})},chunkedPrompt:async(i,o,s,a,l)=>{let c=le.getState(),u=c.ai;if(c.disableOnlineFeatures)throw new Error("Rejecting request to `prompt` via API AI module. Online features are disabled in settings.");let d=r.GetApi(e,t,n).format,{model:f,provider:p}=Bh(s),m=await Va(e,p);a?.assignToVariable&&uE(a.assignToVariable);let v=await s5(e,{model:f,provider:p,text:i,promptTemplate:o,chunkSeparator:a?.chunkSeparator??/\n/,apiKey:m,modelOptions:a?.modelOptions??{},outputVariableName:a?.assignToVariable||a?.variableName||"output",showAssistantMessages:a?.showAssistantMessages??!0,systemPrompt:a?.systemPrompt??u.defaultSystemPrompt,resultJoiner:a?.chunkJoiner??`
|
||
`,shouldMerge:a?.shouldMerge??!0,maxChunkTokens:a?.maxChunkTokens},(g,y)=>{let w={...l,...y};return d(g,w,!1)});return v?((a?.shouldAssignVariables||a?.assignToVariable)&&Object.entries(v).forEach(([g,y])=>{n.variables.set(g,y)}),v):(lt(new Error("AI Assistant returned null"),"Chunked AI Prompt error"),{})},getModels:()=>XG(),getMaxTokens:i=>Bh(i).model.maxTokens,estimateTokens(i){return Uo(i)},countTokens(i,o){return iK||(iK=!0,F.logMessage("quickAddApi.ai.countTokens is deprecated and now returns a provider-agnostic estimate (the model argument is ignored). Use estimateTokens(text) instead.")),Uo(i)},getRequestLogs(i=10){return Q4(i)},getRequestLogById(i){return Z4(i)},getLastRequestLog(){return J4()},clearRequestLogs(){e5()},agent:i=>new yD(e,t,n,i),tool:i=>({...i,__qaTool:!0}),stepCountIs:i=>({stepNumber:o})=>o>=i,hasToolCall:i=>({toolCallNames:o})=>o.includes(i),tools:{vault:i=>$9(e,i),workspace:i=>L9(e,i),system:i=>U9(i)}},utility:{getClipboard:async()=>await navigator.clipboard.readText(),setClipboard:async i=>await navigator.clipboard.writeText(i),getSelection:()=>{let i=Nn(e);return i?i.editor.getSelection()??"":""},getSelectedText:()=>{let i=Nn(e);return i?i.editor.somethingSelected()?i.editor.getSelection():(lt(new Error("No text selected"),"Could not get selected text"),""):(lt(new Error("No active Markdown editor"),"Could not get selected text"),"")}},date:{now:(i,o)=>Us({format:i,offset:o}),tomorrow:i=>Us({format:i,offset:1}),yesterday:i=>Us({format:i,offset:-1})},fieldSuggestions:{getFieldValues:async(i,o)=>{let s=o?.includeInlineCodeBlocks?.map(u=>u.trim().toLowerCase()).filter(u=>u.length>0),a={folder:o?.folder,folders:o?.folders,tags:o?.tags,inline:o?.includeInline??!1,inlineCodeBlocks:s},l=e.vault.getMarkdownFiles();l=kD.filterFiles(l,a,u=>e.metadataCache.getFileCache(u));let c=new Set;for(let u of l){let f=e.metadataCache.getFileCache(u)?.frontmatter?.[i];if(f!=null){if(Array.isArray(f))f.forEach(p=>{if(p==null||typeof p=="object")return;let m=String(p).trim();m&&c.add(m)});else if(typeof f!="object"){let p=String(f).trim();p&&c.add(p)}}if(a.inline)try{let p=await e.vault.read(u);Fg.getFieldValues(p,i,{includeCodeBlocks:s}).forEach(v=>c.add(v))}catch{}}return Array.from(c).sort()},clearCache:i=>{Hc.getInstance().clear(i)}}}}static async inputPrompt(e,t,n,i,o){try{return await Sr.Prompt(e,t,n,i,void 0,o)}catch(s){Yc(s)}}static async datePrompt(e,t,n){try{let i=await Jp.Prompt(e,t,n?.placeholder,n?.defaultValue,n?.dateFormat);if(i&&i.startsWith("@date:")){let o=i.slice(6);return(n?.dateFormat?Nl(o,n.dateFormat):null)??o}return i}catch(i){Yc(i)}}static async wideInputPrompt(e,t,n,i,o){try{return await ld.Prompt(e,t,n,i,void 0,o)}catch(s){Yc(s)}}static async yesNoPrompt(e,t,n){let i;try{i=await Qi.Ask(e,t,n)}catch(o){Yc(o)}if(i===null)throw new St(yu);return i}static async infoDialog(e,t,n){try{return await hE.Show(e,t,n)}catch(i){Yc(i)}}static async suggester(e,t,n,i,o=!1,s){try{let a;return typeof t=="function"?a=n.map((l,c,u)=>mn(t(l,c,u))):a=t.map(l=>mn(l)),o?await ln.Suggest(e,a,n,{...i?{placeholder:i}:{},...s?.renderItem?{renderItem:s.renderItem}:{}}):await Nr.Suggest(e,a,n,i,s?.renderItem)}catch(a){Yc(a)}}static async checkboxPrompt(e,t,n,i){try{return await(i===void 0?Wg.Open(e,t,n):Wg.Open(e,t,n,i))}catch(o){Yc(o)}}}});var Kg,dN=b(()=>{W1();Kg=class extends Mg{}});function aK(r){return new Promise(e=>window.setTimeout(e,r))}function ff(r){return r.split(`
|
||
`)}var ID=b(()=>{});async function cK(r,e){return r.mode==="script"?await e.evaluateScriptCondition(r):tye(r,e.variables)}function tye(r,e){let t=r.variableName?.trim();if(!t)return F.logWarning("Conditional command skipped: No variable name configured."),!1;if(!(t in e))return F.logWarning(`Conditional command skipped: Variable '${t}' is not defined.`),!1;let n=e[t];switch(r.operator){case"isTruthy":return!!n;case"isFalsy":return!n}if(Ou(r.operator)){let i=tq(r);return i===void 0?(F.logWarning(`Conditional command: Operator '${r.operator}' requires a comparison value.`),!1):r.operator==="contains"?lK(n,i,r):r.operator==="notContains"?!lK(n,i,r):rye(n,i,r)}return!1}function lK(r,e,t){if(r==null)return!1;if(typeof e=="string"&&e.length===0)return F.logWarning("Conditional command: 'contains' operator requires a non-empty comparison value."),!1;if(Array.isArray(r))return r.map(o=>tF(o,t.valueType)).some(o=>o===e);if(typeof r=="string")return r.includes($u(e));if(typeof r=="number"&&typeof e=="number")return r===e;let n=$u(r),i=$u(e);return typeof n=="string"&&n.includes(i)}function rye(r,e,t){let n=tF(r,t.valueType);switch(t.operator){case"equals":return n===e;case"notEquals":return n!==e;case"lessThan":return PD(n,e,(i,o)=>i<o);case"lessThanOrEqual":return PD(n,e,(i,o)=>i<=o);case"greaterThan":return PD(n,e,(i,o)=>i>o);case"greaterThanOrEqual":return PD(n,e,(i,o)=>i>=o);default:return!1}}function PD(r,e,t){let n=Number(r),i=Number(e);return Number.isNaN(n)||Number.isNaN(i)?(F.logWarning("Conditional command numeric comparison failed: non-numeric value encountered."),!1):t(n,i)}var uK=b(()=>{Me();Rm()});function dK(r,e=void 0){return r==="horizontal"?"horizontal":r==="vertical"?"vertical":e}function gd(r,e,t){return t?{location:r,direction:t,focus:e,mode:"default"}:{location:r,focus:e,mode:"default"}}function pK(r){let e=r.focus??!0;if(r.location)switch(r.location){case"reuse":return gd("reuse",e);case"tab":return gd("tab",e);case"split":return gd("split",e,dK(r.direction,"vertical"));case"window":return gd("window",e);case"left-sidebar":return gd("left-sidebar",e);case"right-sidebar":return gd("right-sidebar",e);default:break}let t=r.openInNewTab??!1,n=dK(r.direction);return t?gd("split",e,n??"vertical"):gd("reuse",e)}var fK=b(()=>{Ak()});function mK(r){let e={hasOwnProperty:t=>r.has(t)};return new Proxy(e,{get(t,n){if(n==="hasOwnProperty")return e.hasOwnProperty;if(typeof n=="string")return r.get(n)},set(t,n,i){return typeof n!="string"||r.set(n,i),!0},deleteProperty(t,n){return typeof n!="string"||r.delete(n),!0},has(t,n){return typeof n=="string"&&r.has(n)},ownKeys(){return Array.from(r.keys())},getOwnPropertyDescriptor(t,n){if(n==="hasOwnProperty")return{value:e.hasOwnProperty,writable:!0,configurable:!0,enumerable:!1};if(!(typeof n!="string"||!r.has(n)))return{value:r.get(n),writable:!0,configurable:!0,enumerable:!0}}})}var hK=b(()=>{});function bK(r){return r!==null&&typeof r=="object"}function iye(r){return typeof r=="function"}function wK(r){return bK(r)}function oye(r){if(!wK(r))return;let{settings:e}=r;return bK(e)?e:void 0}function gK(r,e="command"){if(typeof r!="string"||!r.trim())return`the saved entry has no ${e} type, so QuickAdd cannot tell what it was meant to do. It is in .obsidian/plugins/quickadd/data.json.`;let t=e==="command"?sye.get(r):void 0;return t||`QuickAdd does not recognise the ${e} type '${r}'. It can come from a newer version of QuickAdd, an imported package, or a hand-edited .obsidian/plugins/quickadd/data.json.`}function vK(r){return`${r.scriptPath}::${r.exportName??"default"}`}var nye,yK,sye,Vl,oE=b(()=>{nye=HN(require("obsidian"));Me();Cr();Kr();uN();dN();qc();Lg();Bg();gl();qt();vs();I$();D$();P$();F$();M$();R$();$$();O$();N$();L$();ID();RS();Kp();It();Vg();Uh();es();qt();yK=require("obsidian");Ns();zr();Co();wk();zT();Bc();uK();iE();fK();hK();Ii();sye=new Map([["InfiniteAIAssistant",'QuickAdd has removed the "Infinite AI Assistant" command type - no released version could ever run one. Delete the step from the macro. For chunked AI prompts, use quickAddApi.ai.chunkedPrompt() in a user script.']]);Vl=class extends Kg{constructor(t,n,i,o,s,a,l,c=null){super(t);this.originLeaf=c;this.conditionalScriptCache=new Map;this.choice=i,this.plugin=n,this.macro=i?.macro,this.choiceExecutor=o,this.preloadedUserScripts=a??new Map,this.promptLabel=l,this.userScriptSettingsDefinition=void 0;let u=this.initSharedVariables(o,s);this.choiceExecutor.variables=u,this.params=this.buildParams(t,n,o,u)}buildParams(t,n,i,o){let s=mK(o),a={app:t,quickAddApi:Yg.GetApi(t,n,i),obsidian:nye,abort:l=>{throw new Nt(l)}};return Object.defineProperty(a,"variables",{get:()=>s,set:l=>{if(l===o||l===s)return;let c=l instanceof Map?Array.from(l.entries()).filter(([u])=>typeof u=="string"):l&&typeof l=="object"?Object.entries(l):null;c&&(o.clear(),c?.forEach(([u,d])=>o.set(u,d)))},enumerable:!0,configurable:!1}),a}initSharedVariables(t,n){let i=t.variables;return n?(i&&n!==i&&i.forEach((o,s)=>{n.has(s)||n.set(s,o)}),n):i??new Map}async run(){if(Di(this.macro?.commands))throw new Error(`Could not read the commands for macro '${this.choice.name}'. The saved value is not a list of commands - QuickAdd has not changed it. It is in .obsidian/plugins/quickadd/data.json.`);let t=Dr(this.macro?.commands);if(t.length===0){hx(this.macro?.commands)||F.logError(`No commands in the macro for choice '${this.choice.name}'`);return}await this.executeCommands(t)}getOutput(){return this.output}async executeCommands(t){try{for(let n of t)if(n)switch(n.type){case"Obsidian":this.executeObsidianCommand(n);break;case"UserScript":await this.executeUserScript(n);break;case"Choice":await this.executeChoice(n);break;case"Wait":await aK(n.time);break;case"NestedChoice":await this.executeNestedChoice(n);break;case"EditorCommand":await this.executeEditorCommand(n);break;case"AIAssistant":await this.executeAIAssistant(n);break;case"OpenFile":await this.executeOpenFile(n);break;case"Conditional":await this.executeConditional(n);break;default:{let i=n.type;this.reportUnrunnableCommand(n,gK(i));break}}}catch(n){if(md(n,{logPrefix:"Macro execution aborted",noticePrefix:"Macro execution aborted",defaultReason:"Macro execution aborted"})){this.choiceExecutor.signalAbort?.(n);return}throw n}}reportUnrunnableCommand(t,n){let i=typeof t?.name=="string"&&t.name.trim()?`'${t.name}'`:"an unnamed command";F.logError(`Skipped ${i} in the macro for '${this.choice.name}': ${n} QuickAdd did not stop the macro, so its result may be incomplete.`)}async executeUserScript(t){let n=WT(t),i;if(n!==void 0){let s=this.preloadedUserScripts.get(n);s!==void 0&&(i=s,this.preloadedUserScripts.delete(n))}if(i===void 0&&(i=await ka(t,this.app)),!i){F.logError(`failed to load user script ${t.path}.`);return}t.settings||(t.settings={});let o=oye(i);o&&Lh(t.settings,o),this.userScriptCommand=t,this.userScriptSettingsDefinition=o;try{await this.userScriptDelegator(i)}catch(s){throw s instanceof Nt||lt(s,`Failed to run user script ${t.name} in "${this.choice.name}"`),s}finally{this.userScriptCommand=null,this.userScriptSettingsDefinition=void 0}}async getResolvedUserScriptSettings(t){return await Oh(this.app,t,this.userScriptSettingsDefinition)&&await this.plugin.saveSettings?.(),yk(this.app,t,this.userScriptSettingsDefinition)}async runScriptWithSettings(t,n){if(typeof t!="function"&&t.entry&&typeof t.entry=="function")return await this.onExportIsFunction(t.entry,await this.getResolvedUserScriptSettings(n));if(typeof t=="function")return await this.onExportIsFunction(t,await this.getResolvedUserScriptSettings(n))}async userScriptDelegator(t){switch(typeof t){case"function":if(!iye(t))break;this.userScriptCommand?await this.runScriptWithSettings(t,this.userScriptCommand):await this.onExportIsFunction(t);break;case"object":wK(t)&&await this.onExportIsObject(t);break;case"bigint":case"boolean":case"number":case"string":this.output=t.toString();break;default:F.logError(`user script in macro for '${this.choice.name}' is invalid`)}}async onExportIsFunction(t,n){this.output=await t(this.params,n||{})}async onExportIsObject(t){if(Object.keys(t).length===0)throw new Error(`user script in macro for '${this.choice.name}' is an empty object`);if(this.userScriptCommand&&typeof t.entry=="function"){await this.runScriptWithSettings(t,this.userScriptCommand);return}let n=Object.keys(t);try{let i=String(await oa(this.choiceExecutor,{remote:o=>sa(o,{items:n.map(s=>({value:s,title:s})),placeholder:this.promptLabel,what:"the user-script member picker"}),headless:()=>{if(n.length===1)return Promise.resolve(n[0]);throw new Ee("This macro's user script exports multiple members and needs to ask which one to run, but this run is non-interactive. Reference a single member (e.g. myScript::start), or re-run with the ui flag.")},app:()=>Nr.Suggest(this.app,n,n,this.promptLabel)}));if(!Object.hasOwn(t,i))throw new Error(`This macro's user script does not export a member named "${i}".`);await this.userScriptDelegator(t[i])}catch(i){throw i instanceof Nt?i:Dt(i)?new St("Input cancelled by user"):i}}executeObsidianCommand(t){let n=this.app.commands.commands;if(n&&!n[t.commandId]){F.logError(`Obsidian command '${t.name}' is no longer available.`);return}this.app.commands.executeCommandById(t.commandId)}async executeChoice(t){let n;try{n=this.plugin.getChoiceById(t.choiceId)}catch(o){let s=o instanceof Error?o.message:String(o);if(!/not found/i.test(s))throw o;F.logError(`choice '${t.name}' could not be found.`);return}await this.choiceExecutor.execute(n);let i=this.choiceExecutor.consumeAbortSignal?.();if(i)throw i}async executeNestedChoice(t){let n=t.choice;if(!n){F.logError(`choice in ${t.name} is invalid`);return}await this.choiceExecutor.execute(n);let i=this.choiceExecutor.consumeAbortSignal?.();if(i)throw i}async executeEditorCommand(t){switch(t.editorCommandType){case"Cut":await Hh.run(this.app);break;case"Copy":await zh.run(this.app);break;case"Paste":await jh.run(this.app);break;case"Paste with format":await Gh.run(this.app);break;case"Select active line":Yh.run(this.app);break;case"Select link on active line":Kh.run(this.app);break;case"Move cursor to file start":Qh.run(this.app);break;case"Move cursor to file end":Xh.run(this.app);break;case"Move cursor to line start":Zh.run(this.app);break;case"Move cursor to line end":Jh.run(this.app);break;default:{let n=t.editorCommandType;this.reportUnrunnableCommand(t,gK(n,"editor command"))}}}async executeAIAssistant(t){if(le.getState().disableOnlineFeatures)throw new Error("Blocking request: Online features are disabled in settings.");let n=le.getState().ai,i;if(t.model==="Ask me")i=await this.pickModelInteractively();else if(i=Yp(mu(t.model,t.modelRef)??t.model),!i)throw new Error(`Model ${t.model} not found with any provider.`);let{model:o,provider:s}=i,a=new Cs(this.app,ni(),this.choiceExecutor);a.setPromptRunContext({choiceName:this.choice?.name,draftScopeId:`${this.choice?.id??"macro"}#aiAssistant:${t.id}`});let l=await Va(this.app,s),c=await t5(this.app,{apiKey:l,model:o,provider:s,outputVariableName:t.outputVariableName,promptTemplate:t.promptTemplate,promptTemplateFolder:n.promptTemplatesFolderPath,systemPrompt:t.systemPrompt,showAssistantMessages:n.showAssistant,modelOptions:t.modelParameters,interactive:this.choiceExecutor.interactive,promptProvider:this.choiceExecutor.promptProvider},async u=>a.formatFileContent(u));for(let u in c)this.choiceExecutor.variables.set(u,c[u])}async pickModelInteractively(){let n=le.getState().ai.providers.flatMap(o=>o.models.map(s=>({label:`${s.name} (${o.name})`,qualified:`${o.id??o.name}/${s.name}`,resolved:{provider:o,model:s}})));if(n.length===0)throw new Error("No AI models are configured. Add a provider with models in the AI Assistant settings.");let i=this.choiceExecutor.promptProvider;if(i){let o=String(await i.suggester(n.map(a=>a.label),n.map(a=>a.qualified),"Select a model")),s=n.find(a=>a.qualified===o);if(!s)throw new Error(`Model ${o} not found with any provider.`);return s.resolved}if(this.choiceExecutor.interactive===!1)throw new Ee('This AI command is set to "Ask me" for the model, but this run is non-interactive. Pick a specific model in the command, or re-run with the ui flag.');try{return await Nr.Suggest(this.app,n.map(o=>o.label),n.map(o=>o.resolved),"Select a model")}catch(o){throw Dt(o)?new St("Input cancelled by user"):o}}async executeConditional(t){let n=await cK(t.condition,{variables:this.params.variables,evaluateScriptCondition:async s=>await this.evaluateScriptCondition(s)}),i=n?t.thenCommands:t.elseCommands;if(Di(i))throw new Error(`Could not read the ${n?"then":"else"} commands for '${t.name}'. The saved value is not a list of commands - QuickAdd has not changed it. It is in .obsidian/plugins/quickadd/data.json.`);if(!Array.isArray(i)||i.length===0)return;await this.executeCommands(i);let o=this.choiceExecutor.consumeAbortSignal?.();if(o)throw o}async runSubset(t){t?.length&&await this.executeCommands(t)}setOutput(t){this.output=t}async evaluateScriptCondition(t){let n=vK(t),i=this.conditionalScriptCache.get(n);if(!i){if(i=await this.loadConditionalScript(t),!i)return!1;this.conditionalScriptCache.set(n,i)}let o;try{o=await i()}catch(s){throw lt(s,`Failed to evaluate conditional script '${t.scriptPath}'.`),s}return typeof o!="boolean"?(F.logWarning(`Conditional script '${t.scriptPath}' must return a boolean result.`),!1):o}async loadConditionalScript(t){try{let n=await ka(this.buildConditionalUserScript(t),this.app);return n==null?void 0:typeof n=="function"?async()=>await n(this.params):async()=>n}catch(n){throw lt(n,`Failed to load conditional script '${t.scriptPath}'.`),n}}buildConditionalUserScript(t){return{id:`conditional-script-${vK(t)}`,name:t.exportName?`${t.scriptPath}::${t.exportName}`:t.scriptPath,type:"UserScript",path:t.scriptPath,settings:{}}}async executeOpenFile(t){try{let n=new Cs(this.app,ni(),this.choiceExecutor);n.setPromptRunContext({choiceName:this.choice?.name,draftScopeId:`${this.choice?.id??"macro"}#openFile:${t.id}`});let o=(await n.formatFileName(t.filePath,"filePath")).replace(/\\/g,"/"),s=o.split("/");if(s.some((u,d)=>u===".."||u===""&&d!==0&&d!==s.length-1)){F.logError(`OpenFile: Path traversal not allowed in '${o}'`);return}let l=this.app.vault.getAbstractFileByPath(o);if(!l||!(l instanceof yK.TFile)){F.logError(`OpenFile: '${o}' does not exist or is not a file`);return}let c=pK(t);await fc(this.app,l,{...c,originLeaf:this.originLeaf})}catch(n){F.logError(`OpenFile: Failed to open file '${t.filePath}': ${n.message}`)}}}});var _we={};Jr(_we,{default:()=>nI});module.exports=G7(_we);var rv=require("obsidian");var od=require("obsidian");var jN;typeof window<"u"&&((jN=window.__svelte??(window.__svelte={})).v??(jN.v=new Set)).add("5");var jl={};var fr=Symbol("uninitialized"),_s=Symbol("filename");var IE="http://www.w3.org/1999/xhtml";var PE=!0;var GN=globalThis.process?.env?.NODE_ENV,te=GN&&!GN.toLowerCase().startsWith("prod");var pa=Array.isArray,YN=Array.prototype.indexOf,nu=Array.prototype.includes,xf=Array.from,aI=Object.keys,Oi=Object.defineProperty,Ao=Object.getOwnPropertyDescriptor,FE=Object.getOwnPropertyDescriptors,ME=Object.prototype,KN=Array.prototype,iu=Object.getPrototypeOf,lI=Object.isExtensible;function cI(r){return typeof r=="function"}var Vt=()=>{};function RE(r){for(var e=0;e<r.length;e++)r[e]()}function $E(){var r,e,t=new Promise((n,i)=>{r=n,e=i});return{promise:t,resolve:r,reject:e}}var Dn=Symbol("$state"),ov=Symbol("legacy props"),QN=Symbol(""),OE=Symbol("proxy path"),NE=Symbol("attributes"),sv=Symbol("class"),av=Symbol("style"),lv=Symbol("text"),ou=Symbol("form reset"),uI=Symbol("hmr anchor"),Gl=new class extends Error{constructor(){super(...arguments);ae(this,"name","StaleReactionError");ae(this,"message","The reaction that called `getAbortSignal()` was re-run or destroyed")}},LE=!!globalThis.document?.contentType&&globalThis.document.contentType.includes("xml");var wd=3,jo=8;function XN(r){if(te){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 BE(r){if(te){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 JN(){if(te){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 dI(){if(te){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 eL(){if(te){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 pI(r,e,t){if(te){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 tL(r,e,t){if(te){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 rL(r){if(te){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 nL(){if(te){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 iL(r){if(te){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 oL(){if(te){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 sL(){if(te){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 aL(){if(te){let r=new Error("invalid_snippet\nCould not `{@render}` snippet due to the expression being `null` or `undefined`. Consider using optional chaining `{@render snippet?.()}`\nhttps://svelte.dev/e/invalid_snippet");throw r.name="Svelte error",r}else throw new Error("https://svelte.dev/e/invalid_snippet")}function lL(r){if(te){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 cL(r){if(te){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 uL(){if(te){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 dL(){if(te){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 pL(){if(te){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 fL(){if(te){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 Ja="font-weight: bold",el="font-weight: normal";function mL(r){te?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`,Ja,el):console.warn("https://svelte.dev/e/await_reactivity_loss")}function hL(r,e){te?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`,Ja,el):console.warn("https://svelte.dev/e/await_waterfall")}function gL(){te?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`,Ja,el):console.warn("https://svelte.dev/e/derived_inert")}function vL(r,e,t){te?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`,Ja,el):console.warn("https://svelte.dev/e/hydration_attribute_changed")}function Cd(r){te?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`,Ja,el):console.warn("https://svelte.dev/e/hydration_mismatch")}function yL(){te?console.warn(`%c[svelte] lifecycle_double_unmount
|
||
%cTried to unmount a component that was not mounted
|
||
https://svelte.dev/e/lifecycle_double_unmount`,Ja,el):console.warn("https://svelte.dev/e/lifecycle_double_unmount")}function bL(){te?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",Ja,el):console.warn("https://svelte.dev/e/select_multiple_invalid_value")}function UE(r){te?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`,Ja,el):console.warn("https://svelte.dev/e/state_proxy_equality_mismatch")}function wL(){te?console.warn(`%c[svelte] state_proxy_unmount
|
||
%cTried to unmount a state proxy, rather than a component
|
||
https://svelte.dev/e/state_proxy_unmount`,Ja,el):console.warn("https://svelte.dev/e/state_proxy_unmount")}function CL(){te?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",Ja,el):console.warn("https://svelte.dev/e/svelte_boundary_reset_noop")}var Re=!1;function In(r){Re=r}var Ze;function tr(r){if(r===null)throw Cd(),jl;return Ze=r}function Kn(){return tr(gi(Ze))}function S(r){if(Re){if(gi(Ze)!==null)throw Cd(),jl;Ze=r}}function Pn(r=1){if(Re){for(var e=r,t=Ze;e--;)t=gi(t);Ze=t}}function tl(r=!0){for(var e=0,t=Ze;;){if(t.nodeType===jo){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=gi(t);r&&t.remove(),t=i}}function uv(r){if(!r||r.nodeType!==jo)throw Cd(),jl;return r.data}function VE(r){return r===this.v}function qE(r,e){return r!=r?e==e:r!==e||r!==null&&typeof r=="object"||typeof r=="function"}function WE(r){return!qE(r,this.v)}var en=!1,Yl=!1,fa=!1;var K7="font-weight: bold",Q7="font-weight: normal";function fI(r){te?console.warn(`%c[svelte] state_snapshot_uncloneable
|
||
%c${r?`The following properties cannot be cloned with \`$state.snapshot\` \u2014 the return value contains the originals:
|
||
|
||
${r}`:"Value cannot be cloned with `$state.snapshot` \u2014 the original value was returned"}
|
||
https://svelte.dev/e/state_snapshot_uncloneable`,K7,Q7):console.warn("https://svelte.dev/e/state_snapshot_uncloneable")}var X7=[];function ma(r,e=!1,t=!1){if(te&&!e){let n=[],i=dv(r,new Map,"",n,null,t);if(n.length===1&&n[0]==="")fI();else if(n.length>0){let o=n.length>10?n.slice(0,7):n.slice(0,10),s=n.length-o.length,a=o.map(l=>`- <value>${l}`).join(`
|
||
`);s>0&&(a+=`
|
||
- ...and ${s} more`),fI(a)}return i}return dv(r,new Map,"",X7,null,t)}function dv(r,e,t,n,i=null,o=!1){if(typeof r=="object"&&r!==null){var s=e.get(r);if(s!==void 0)return s;if(r instanceof Map)return new Map(r);if(r instanceof Set)return new Set(r);if(pa(r)){var a=Array(r.length);e.set(r,a),i!==null&&e.set(i,a);for(var l=0;l<r.length;l+=1){var c=r[l];l in r&&(a[l]=dv(c,e,te?`${t}[${l}]`:t,n,null,o))}return a}if(iu(r)===ME){a={},e.set(r,a),i!==null&&e.set(i,a);for(var u of Object.keys(r))a[u]=dv(r[u],e,te?`${t}.${u}`:t,n,null,o);return a}if(r instanceof Date)return structuredClone(r);if(typeof r.toJSON=="function"&&!o)return dv(r.toJSON(),e,te?`${t}.toJSON()`:t,n,r)}if(r instanceof EventTarget)return r;try{return structuredClone(r)}catch{return te&&n.push(t),r}}var pv=null;function Ni(r,e){return r.label=e,zE(r.v,e),r}function zE(r,e){return r?.[OE]?.(e),r}function ha(r){let e=new Error,t=Z7();return t.length===0?null:(t.unshift(`
|
||
`),Oi(e,"stack",{value:t.join(`
|
||
`)}),Oi(e,"name",{value:r}),e)}function Z7(){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 EL(r,e){if(!te)throw new Error("invariant(...) was not guarded by if (DEV)");r||XN(e)}var _t=null;function Kl(r){_t=r}var rl=null;function _f(r){rl=r}var ga=null;function HE(r){ga=r}function we(r,e=!1,t){_t={p:_t,i:!1,c:null,e:null,s:r,x:null,r:Fe,l:Yl&&!e?{s:null,u:null,$:[]}:null},te&&(_t.function=t,ga=t)}function Ce(r){var e=_t,t=e.e;if(t!==null){e.e=null;for(var n of t)mI(n)}return r!==void 0&&(e.x=r),e.i=!0,_t=e.p,te&&(ga=_t?.function??null),r??{}}function va(){return!Yl||_t!==null&&_t.l===null}var xd=[];function TL(){var r=xd;xd=[],RE(r)}function Ur(r){if(xd.length===0&&!Ed){var e=xd;queueMicrotask(()=>{e===xd&&TL()})}xd.push(r)}function _L(){for(;xd.length>0;)TL()}var hI=new WeakMap;function jE(r){var e=Fe;if(e===null)return je.f|=8388608,r;if(te&&r instanceof Error&&!hI.has(r)&&hI.set(r,J7(r,e)),(e.f&32768)===0&&(e.f&4)===0)throw te&&!e.parent&&r instanceof Error&&AL(r),r;ba(r,e)}function ba(r,e){if(!(e!==null&&(e.f&16384)!==0)){for(;e!==null;){if((e.f&128)!==0){if((e.f&32768)===0)throw r;try{e.b.error(r);return}catch(t){r=t}}e=e.parent}throw te&&r instanceof Error&&AL(r),r}}function J7(r,e){let t=Ao(r,"message");if(!(t&&!t.configurable)){for(var n=mv?" ":" ",i=`
|
||
${n}in ${e.fn?.name||"<unknown>"}`,o=e.ctx;o!==null;)i+=`
|
||
${n}in ${o.function?.[_s].split("/").pop()}`,o=o.p;return{message:r.message+`
|
||
${i}
|
||
`,stack:r.stack?.split(`
|
||
`).filter(s=>!s.includes("svelte/src/internal")).join(`
|
||
`)}}}function AL(r){let e=hI.get(r);e&&(Oi(r,"message",{value:e.message}),Oi(r,"stack",{value:e.stack}))}var eQ=-7169;function rr(r,e){r.f=r.f&eQ|e}function Af(r){(r.f&512)!==0||r.deps===null?rr(r,1024):rr(r,4096)}function kL(r){if(r!==null)for(let e of r)(e.f&2)===0||(e.f&65536)===0||(e.f^=65536,kL(e.deps))}function GE(r,e,t){(r.f&2048)!==0?e.add(r):(r.f&4096)!==0&&t.add(r),kL(r.deps),rr(r,1024)}var SL=!1,YE=!1;function gI(r){var e=YE;try{return YE=!1,[r(),YE]}finally{YE=e}}function Ad(r){Re&&vi(r)!==null&&Sf(r)}var DL=!1;function KE(){DL||(DL=!0,document.addEventListener("reset",r=>{Promise.resolve().then(()=>{if(!r.defaultPrevented)for(let e of r.target.elements)e[ou]?.()})},{capture:!0}))}function Ss(r){var e=je,t=Fe;Rn(null),$n(null);try{return r()}finally{Rn(e),$n(t)}}function QE(r,e,t,n=t){r.addEventListener(e,()=>Ss(t));let i=r[ou];i?r[ou]=()=>{i(),n(!0)}:r[ou]=()=>n(!0),KE()}function IL(r){let e=0,t=Ui(0),n;return te&&Ni(t,"createSubscriber version"),()=>{su()&&(h(t),Zn(()=>(e===0&&(n=Ot(()=>r(()=>kd(t)))),e+=1,()=>{Ur(()=>{e-=1,e===0&&(n?.(),n=void 0,kd(t))})})))}}var rQ=589824;function yv(r,e,t,n){new vI(r,e,t,n)}var Go,hv,Ds,Sd,Do,Is,oo,Yo,Xl,Dd,au,Df,gv,vv,nl,JE,sr,FL,ML,yI,RL,bI,XE,ZE,wI,CI,vI=class{constructor(e,t,n,i){it(this,sr);ae(this,"parent");ae(this,"is_pending",!1);ae(this,"transform_error");it(this,Go);it(this,hv,Re?Ze:null);it(this,Ds);it(this,Sd);it(this,Do);it(this,Is,null);it(this,oo,null);it(this,Yo,null);it(this,Xl,null);it(this,Dd,0);it(this,au,0);it(this,Df,!1);it(this,gv,new Set);it(this,vv,new Set);it(this,nl,null);it(this,JE,IL(()=>(et(this,nl,Ui(z(this,Dd))),te&&Ni(z(this,nl),"$effect.pending()"),()=>{et(this,nl,null)})));et(this,Go,e),et(this,Ds,t),et(this,Sd,o=>{var s=Fe;s.b=this,s.f|=128,n(o)}),this.parent=Fe.b,this.transform_error=i??this.parent?.transform_error??(o=>o),et(this,Do,so(()=>{if(Re){let o=z(this,hv);Kn();let s=o.data==="[!";if(o.data.startsWith("[?")){let l=JSON.parse(o.data.slice("[?".length));xt(this,sr,ML).call(this,l)}else s?xt(this,sr,RL).call(this):xt(this,sr,FL).call(this)}else xt(this,sr,bI).call(this)},rQ)),Re&&et(this,Go,Ze)}defer_effect(e){GE(e,z(this,gv),z(this,vv))}is_rendered(){return!this.is_pending&&(!this.parent||this.parent.is_rendered())}has_pending_snippet(){return!!z(this,Ds).pending}update_pending_count(e,t){xt(this,sr,wI).call(this,e,t),et(this,Dd,z(this,Dd)+e),!(!z(this,nl)||z(this,Df))&&(et(this,Df,!0),Ur(()=>{et(this,Df,!1),z(this,nl)&&wa(z(this,nl),z(this,Dd))}))}get_effect_pending(){return z(this,JE).call(this),h(z(this,nl))}error(e){if(!z(this,Ds).onerror&&!z(this,Ds).failed)throw e;qe?.is_fork?(z(this,Is)&&qe.skip_effect(z(this,Is)),z(this,oo)&&qe.skip_effect(z(this,oo)),z(this,Yo)&&qe.skip_effect(z(this,Yo)),qe.oncommit(()=>{xt(this,sr,CI).call(this,e)})):xt(this,sr,CI).call(this,e)}};Go=new WeakMap,hv=new WeakMap,Ds=new WeakMap,Sd=new WeakMap,Do=new WeakMap,Is=new WeakMap,oo=new WeakMap,Yo=new WeakMap,Xl=new WeakMap,Dd=new WeakMap,au=new WeakMap,Df=new WeakMap,gv=new WeakMap,vv=new WeakMap,nl=new WeakMap,JE=new WeakMap,sr=new WeakSet,FL=function(){try{et(this,Is,On(()=>z(this,Sd).call(this,z(this,Go))))}catch(e){this.error(e)}},ML=function(e){let t=z(this,Ds).failed,{reset:n,invoke_onerror:i}=xt(this,sr,yI).call(this,e);Ur(i),t&&et(this,Yo,On(()=>{t(z(this,Go),()=>e,()=>n)}))},yI=function(e){var t=!1,n=!1;let i=()=>{if(t){CL();return}t=!0,n&&fL(),z(this,Yo)!==null&&il(z(this,Yo),()=>{et(this,Yo,null)}),xt(this,sr,ZE).call(this,()=>{xt(this,sr,bI).call(this)})};return{reset:i,invoke_onerror:()=>{try{n=!0,z(this,Ds).onerror?.(e,i),n=!1}catch(s){ba(s,z(this,Do)&&z(this,Do).parent)}}}},RL=function(){let e=z(this,Ds).pending;e&&(this.is_pending=!0,et(this,oo,On(()=>e(z(this,Go)))),Ur(()=>{var t=et(this,Xl,document.createDocumentFragment()),n=tn();t.append(n),et(this,Is,xt(this,sr,ZE).call(this,()=>On(()=>z(this,Sd).call(this,n)))),z(this,au)===0&&(z(this,Go).before(t),et(this,Xl,null),il(z(this,oo),()=>{et(this,oo,null)}),xt(this,sr,XE).call(this,qe))}))},bI=function(){try{if(this.is_pending=this.has_pending_snippet(),et(this,au,0),et(this,Dd,0),et(this,Is,On(()=>{z(this,Sd).call(this,z(this,Go))})),z(this,au)>0){var e=et(this,Xl,document.createDocumentFragment());If(z(this,Is),e);let t=z(this,Ds).pending;et(this,oo,On(()=>t(z(this,Go))))}else xt(this,sr,XE).call(this,qe)}catch(t){this.error(t)}},XE=function(e){this.is_pending=!1,e.transfer_effects(z(this,gv),z(this,vv))},ZE=function(e){var t=Fe,n=je,i=_t;$n(z(this,Do)),Rn(z(this,Do)),Kl(z(this,Do).ctx);try{return Ko.ensure(),e()}catch(o){return jE(o),null}finally{$n(t),Rn(n),Kl(i)}},wI=function(e,t){var n;if(!this.has_pending_snippet()){this.parent&&xt(n=this.parent,sr,wI).call(n,e,t);return}et(this,au,z(this,au)+e),z(this,au)===0&&(xt(this,sr,XE).call(this,t),z(this,oo)&&il(z(this,oo),()=>{et(this,oo,null)}),z(this,Xl)&&(z(this,Go).before(z(this,Xl)),et(this,Xl,null)))},CI=function(e){z(this,Is)&&(qr(z(this,Is)),et(this,Is,null)),z(this,oo)&&(qr(z(this,oo)),et(this,oo,null)),z(this,Yo)&&(qr(z(this,Yo)),et(this,Yo,null)),Re&&(tr(z(this,hv)),Pn(),tr(tl()));let t=z(this,Ds).failed,n=i=>{let{reset:o,invoke_onerror:s}=xt(this,sr,yI).call(this,i);s(),t&&et(this,Yo,xt(this,sr,ZE).call(this,()=>{try{return On(()=>{var a=Fe;a.b=this,a.f|=128,t(z(this,Go),()=>i,()=>o)})}catch(a){return ba(a,z(this,Do).parent),null}}))};Ur(()=>{var i;try{i=this.transform_error(e)}catch(o){ba(o,z(this,Do)&&z(this,Do).parent);return}i!==null&&typeof i=="object"&&typeof i.then=="function"?i.then(n,o=>ba(o,z(this,Do)&&z(this,Do).parent)):n(i)})};function eT(r,e,t,n){let i=va()?lu:Id;var o=r.filter(p=>!p.settled),s=e.map(i);if(te&&s.forEach((p,m)=>{p.label=e[m].toString().replace("() => ","").replaceAll("$.eager(() => ","$state.eager(").replace(/\$\.get\((.+?)\)/g,(v,g)=>g)}),t.length===0&&o.length===0){n(s);return}var a=Fe,l=$L(),c=o.length===1?o[0].promise:o.length>1?Promise.all(o.map(p=>p.promise)):null;function u(p){if((a.f&16384)===0){l();try{n([...s,...p])}catch(m){ba(m,a)}Pf()}}var d=xI();if(t.length===0){c.then(()=>u([])).finally(d);return}function f(){Promise.all(t.map(p=>TI(p))).then(u).catch(p=>ba(p,a)).finally(d)}c?c.then(()=>{l(),f(),Pf()}):f()}function $L(){var r=Fe,e=je,t=_t,n=qe;if(te)var i=rl;return function(s=!0){$n(r),Rn(e),Kl(t),s&&(r.f&16384)===0&&(n?.activate(),n?.apply()),te&&(EI(null),_f(i))}}function Pf(r=!0){$n(null),Rn(null),Kl(null),r&&qe?.deactivate(),te&&(EI(null),_f(null))}function xI(){var r=Fe,e=r.b,t=qe,n=!!e?.is_rendered();return e?.update_pending_count(1,t),t.increment(n,r),()=>{e?.update_pending_count(-1,t),t.decrement(n,r)}}var Po=null;function EI(r){Po=r}var bv=new Set;function lu(r){var e=2050;Fe!==null&&(Fe.f|=524288);let t={ctx:_t,deps:null,effects:null,equals:VE,f:e,fn:r,reactions:null,rv:0,v:fr,wv:0,parent:Fe,ac:null};return te&&fa&&(t.created=ha("created at")),t}var Ff=Symbol("obsolete");function TI(r,e,t){let n=Fe;n===null&&JN();var i=void 0,o=Ui(fr);te&&(o.label=e??r.toString());var s=!je,a=new Set;return LL(()=>{var l=Fe;te&&(Po={effect:l,effect_deps:new Set,warned:!1});var c=$E();i=c.promise;try{Promise.resolve(r()).then(c.resolve,p=>{p!==Gl&&c.reject(p)}).finally(Pf)}catch(p){c.reject(p),Pf()}if(te){if(Po){if(l.deps!==null)for(let p=0;p<ao;p+=1)Po.effect_deps.add(l.deps[p]);if(Jn!==null)for(let p=0;p<Jn.length;p+=1)Po.effect_deps.add(Jn[p])}Po=null}var u=qe;if(s){if((l.f&32768)!==0)var d=xI();if(n.b?.is_rendered())u.async_deriveds.get(l)?.reject(Ff);else for(let p of a.values())p.reject(Ff);a.add(c),u.async_deriveds.set(l,c)}let f=(p,m=void 0)=>{te&&(Po=null),d?.(),a.delete(c),m!==Ff&&(u.activate(),m?(o.f|=8388608,wa(o,m)):((o.f&8388608)!==0&&(o.f^=8388608),te&&t!==void 0&&!o.equals(p)&&(bv.add(o),setTimeout(()=>{bv.has(o)&&(l.f&16384)===0&&(hL(o.label,t),bv.delete(o))})),wa(o,p)),u.deactivate())};c.promise.then(f,p=>f(null,p||"unknown"))}),Xn(()=>{for(let l of a)l.reject(Ff)}),te&&(o.f|=4194304),new Promise(l=>{function c(u){function d(){u===i?l(o):c(i)}u.then(d,d)}c(i)})}function N(r){let e=lu(r);return en||nT(e),e}function Id(r){let e=lu(r);return e.equals=WE,e}function OL(r){var e=r.effects;if(e!==null){r.effects=null;for(var t=0;t<e.length;t+=1)qr(e[t])}}var _I=[];function wv(r){var e,t=Fe,n=r.parent;if(!Qo&&n!==null&&r.v!==fr&&(n.f&24576)!==0)return gL(),r.v;if($n(n),te){let i=Pd;tT(new Set);try{nu.call(_I,r)&&eL(),_I.push(r),r.f&=-65537,OL(r),e=rT(r)}finally{$n(t),tT(i),_I.pop()}}else try{r.f&=-65537,OL(r),e=rT(r)}finally{$n(t)}return e}function AI(r){var e=wv(r);if(!r.equals(e)&&(r.wv=Mf(),(!qe?.is_fork||r.deps===null)&&(qe!==null?(qe.capture(r,e,!0),ol?.capture(r,e,!0)):r.v=e,r.deps===null))){rr(r,1024);return}Qo||(ei!==null?(su()||qe?.is_fork)&&ei.set(r,e):Af(r))}function NL(r){if(r.effects!==null)for(let e of r.effects)(e.teardown||e.ac)&&(e.teardown?.(),e.ac!==null&&Ss(()=>{e.ac.abort(Gl),e.ac=null}),e.fn!==null&&(e.teardown=Vt),Fd(e,0),Cv(e))}function kI(r){if(r.effects!==null)for(let e of r.effects)e.teardown&&e.fn!==null&&sl(e)}var iT=null,Rf=null,qe=null,ol=null,ei=null,II=null,Ed=!1,SI=!1,Md=null,Tv=null,BL=0,DI=new Set,oQ=1,Of,Jl,ec,Nf,Lf,Bf,tc,Uf,lo,_v,rc,Ca,al,Vf,cu,Zt,PI,xv,FI,VL,qL,$f,WL,Ev,oT=class oT{constructor(){it(this,Zt);ae(this,"id",oQ++);it(this,Of,!1);ae(this,"linked",!0);it(this,Jl,null);it(this,ec,null);ae(this,"async_deriveds",new Map);ae(this,"current",new Map);ae(this,"previous",new Map);it(this,Nf,new Set);it(this,Lf,new Set);it(this,Bf,0);it(this,tc,new Map);it(this,Uf,null);it(this,lo,[]);it(this,_v,[]);it(this,rc,new Set);it(this,Ca,new Set);it(this,al,new Map);it(this,Vf,new Set);ae(this,"is_fork",!1);it(this,cu,!1);Rf===null?iT=Rf=this:(et(Rf,ec,this),et(this,Jl,Rf)),Rf=this}skip_effect(e){z(this,al).has(e)||z(this,al).set(e,{d:[],m:[]}),z(this,Vf).delete(e)}unskip_effect(e,t=n=>this.schedule(n)){var n=z(this,al).get(e);if(n){z(this,al).delete(e);for(var i of n.d)rr(i,2048),t(i);for(i of n.m)rr(i,4096),t(i)}z(this,Vf).add(e)}capture(e,t,n=!1){e.v!==fr&&!this.previous.has(e)&&this.previous.set(e,e.v),(e.f&8388608)===0&&(this.current.set(e,[t,n]),ei?.set(e,t)),this.is_fork||(e.v=t)}activate(){qe=this}deactivate(){qe=null,ei=null}flush(){try{te&&DI.clear(),SI=!0,qe=this,xt(this,Zt,xv).call(this)}finally{if(BL=0,II=null,Md=null,Tv=null,SI=!1,qe=null,ei=null,nc.clear(),te)for(let e of DI)e.updated=null}}discard(){for(let e of z(this,Lf))e(this);z(this,Lf).clear();for(let e of this.async_deriveds.values())e.reject(Ff);xt(this,Zt,Ev).call(this),z(this,Uf)?.resolve()}register_created_effect(e){z(this,_v).push(e)}increment(e,t){if(et(this,Bf,z(this,Bf)+1),e){let n=z(this,tc).get(t)??0;z(this,tc).set(t,n+1)}}decrement(e,t){if(et(this,Bf,z(this,Bf)-1),e){let n=z(this,tc).get(t)??0;n===1?z(this,tc).delete(t):z(this,tc).set(t,n-1)}z(this,cu)||(et(this,cu,!0),Ur(()=>{et(this,cu,!1),this.linked&&this.flush()}))}transfer_effects(e,t){for(let n of e)z(this,rc).add(n);for(let n of t)z(this,Ca).add(n);e.clear(),t.clear()}oncommit(e){z(this,Nf).add(e)}ondiscard(e){z(this,Lf).add(e)}settled(){return(z(this,Uf)??et(this,Uf,$E())).promise}static ensure(){if(qe===null){let e=qe=new oT;!SI&&!Ed&&Ur(()=>{z(e,Of)||e.flush()})}return qe}apply(){if(!en||!this.is_fork&&z(this,Jl)===null&&z(this,ec)===null){ei=null;return}ei=new Map;for(let[t,[n]]of this.current)ei.set(t,n);for(let t=iT;t!==null;t=z(t,ec))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)ei.has(n)||ei.set(n,i)}}schedule(e){if(II=e,e.b?.is_pending&&(e.f&16777228)!==0&&(e.f&32768)===0){e.b.defer_effect(e);return}for(var t=e;t.parent!==null;){t=t.parent;var n=t.f;if(Md!==null&&t===Fe&&(en||(je===null||(je.f&2)===0)&&!SL))return;if((n&96)!==0){if((n&1024)===0)return;t.f^=1024}}z(this,lo).push(t)}};Of=new WeakMap,Jl=new WeakMap,ec=new WeakMap,Nf=new WeakMap,Lf=new WeakMap,Bf=new WeakMap,tc=new WeakMap,Uf=new WeakMap,lo=new WeakMap,_v=new WeakMap,rc=new WeakMap,Ca=new WeakMap,al=new WeakMap,Vf=new WeakMap,cu=new WeakMap,Zt=new WeakSet,PI=function(){if(this.is_fork)return!0;for(let n of z(this,tc).keys()){for(var e=n,t=!1;e.parent!==null;){if(z(this,al).has(e)){t=!0;break}e=e.parent}if(!t)return!0}return!1},xv=function(){var l,c,u;if(et(this,Of,!0),BL++>1e3&&(xt(this,Zt,Ev).call(this),sQ()),te)for(let d of this.current.keys())DI.add(d);for(let d of z(this,rc))z(this,Ca).delete(d),rr(d,2048),this.schedule(d);for(let d of z(this,Ca))rr(d,4096),this.schedule(d);let e=z(this,lo);et(this,lo,[]),this.apply();var t=Md=[],n=[],i=Tv=[];for(let d of e)try{xt(this,Zt,FI).call(this,d,t,n)}catch(f){throw jL(d),xt(this,Zt,PI).call(this)||this.discard(),f}if(qe=null,i.length>0){var o=oT.ensure();for(let d of i)o.schedule(d)}if(Md=null,Tv=null,xt(this,Zt,PI).call(this)){xt(this,Zt,$f).call(this,n),xt(this,Zt,$f).call(this,t);for(let[d,f]of z(this,al))HL(d,f);i.length>0&&xt(l=qe,Zt,xv).call(l);return}let s=xt(this,Zt,VL).call(this);if(s){xt(this,Zt,$f).call(this,n),xt(this,Zt,$f).call(this,t),xt(c=s,Zt,qL).call(c,this);return}z(this,rc).clear(),z(this,Ca).clear();for(let d of z(this,Nf))d(this);z(this,Nf).clear(),ol=this,UL(n),UL(t),ol=null,z(this,Uf)?.resolve();var a=qe;if(z(this,Bf)===0&&(z(this,lo).length===0||a!==null)&&(xt(this,Zt,Ev).call(this),en&&(xt(this,Zt,WL).call(this),qe=a)),z(this,lo).length>0)if(a!==null){let d=a;z(d,lo).push(...z(this,lo).filter(f=>!z(d,lo).includes(f)))}else a=this;a!==null&&xt(u=a,Zt,xv).call(u)},FI=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||z(this,al).has(i);if(!l&&i.fn!==null){s?i.f^=1024:(o&4)!==0?t.push(i):en&&(o&16777224)!==0?n.push(i):uu(i)&&((o&16)!==0&&z(this,Ca).add(i),sl(i));var c=i.first;if(c!==null){i=c;continue}}for(;i!==null;){var u=i.next;if(u!==null){i=u;break}i=i.parent}}},VL=function(){for(var e=z(this,Jl);e!==null;){if(!e.is_fork){for(let[t,[,n]]of this.current)if(e.current.has(t)&&!n)return e}e=z(e,Jl)}return null},qL=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(z(e,rc),z(e,Ca));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)&&(z(this,Ca).delete(a),rr(a,2048),this.schedule(a))}}};for(let i of this.current.keys())t(i);this.oncommit(()=>e.discard()),xt(n=e,Zt,Ev).call(n),qe=this,xt(this,Zt,xv).call(this)},$f=function(e){for(var t=0;t<e.length;t+=1)GE(e[t],z(this,rc),z(this,Ca))},WL=function(){var d;for(let f=iT;f!==null;f=z(f,ec)){var e=f.id<this.id,t=[];for(let[p,[m,v]]of this.current){if(f.current.has(p)){var n=f.current.get(p)[0];if(e&&m!==n)f.current.set(p,[m,v]);else continue}t.push(p)}if(e)for(let[p,m]of this.async_deriveds){let v=f.async_deriveds.get(p);v&&m.promise.then(v.resolve).catch(v.reject)}var i=[...f.current.keys()].filter(p=>!f.current.get(p)[1]);if(!(!z(f,Of)||i.length===0)){var o=i.filter(p=>!this.current.has(p));if(o.length===0)e&&f.discard();else if(t.length>0){if(te&&!z(f,cu)&&EL(z(f,lo).length===0,"Batch has scheduled roots"),e)for(let p of z(this,Vf))f.unskip_effect(p,m=>{var v;(m.f&4194320)!==0?f.schedule(m):xt(v=f,Zt,$f).call(v,[m])});f.activate();var s=new Set,a=new Map;for(var l of t)zL(l,o,s,a);a=new Map;var c=[...f.current].filter(([p,m])=>{let v=this.current.get(p);return v?v[0]!==m[0]||v[1]!==m[1]:!0}).map(([p])=>p);if(c.length>0)for(let p of z(this,_v))(p.f&155648)===0&&MI(p,c,a)&&((p.f&4194320)!==0?(rr(p,2048),f.schedule(p)):z(f,rc).add(p));if(z(f,lo).length>0&&!z(f,cu)){f.apply();for(var u of z(f,lo))xt(d=f,Zt,FI).call(d,u,[],[]);et(f,lo,[])}f.deactivate()}}}},Ev=function(){if(this.linked){var e=z(this,Jl),t=z(this,ec);e===null?iT=t:et(e,ec,t),t===null?Rf=e:et(t,Jl,e),this.linked=!1}};var Ko=oT;function $d(r){var e=Ed;Ed=!0;try{var t;for(r&&(qe!==null&&!qe.is_fork&&qe.flush(),t=r());;){if(_L(),qe===null)return t;qe.flush()}}finally{Ed=e}}function sQ(){if(te){var r=new Map;for(let t of qe.current.keys())for(let[n,i]of t.updated??[]){var e=r.get(n);e||(e={error:i.error,count:0},r.set(n,e)),e.count+=i.count}for(let t of r.values())t.error&&console.error(t.error)}try{oL()}catch(t){te&&Oi(t,"stack",{value:""}),ba(t,II)}}var Ps=null;function UL(r){var e=r.length;if(e!==0){for(var t=0;t<e;){var n=r[t++];if((n.f&24576)===0&&uu(n)&&(Ps=new Set,sl(n),n.deps===null&&n.first===null&&n.nodes===null&&n.teardown===null&&n.ac===null&&RI(n),Ps?.size>0)){nc.clear();for(let i of Ps){if((i.f&24576)!==0)continue;let o=[i],s=i.parent;for(;s!==null;)Ps.has(s)&&(Ps.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&&sl(l)}}Ps.clear()}}Ps=null}}function zL(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?zL(i,e,t,n):(o&4194320)!==0&&(o&2048)===0&&MI(i,e,n)&&(rr(i,2048),kv(i))}}function MI(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(nu.call(e,i))return!0;if((i.f&2)!==0&&MI(i,e,t))return t.set(i,!0),!0}return t.set(r,!1),!1}function kv(r){qe.schedule(r)}function HL(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),rr(r,1024);for(var t=r.first;t!==null;)HL(t,e),t=t.next}}function jL(r){rr(r,1024);for(var e=r.first;e!==null;)jL(e),e=e.next}var Pd=new Set,nc=new Map;function tT(r){Pd=r}var $I=!1;function YL(){$I=!0}function Ui(r,e){var t={f:0,v:r,reactions:null,equals:VE,rv:0,wv:0};return te&&fa&&(t.created=e??ha("created at"),t.updated=null,t.set_during_effect=!1,t.trace=null),t}function Ae(r,e){let t=Ui(r,e);return nT(t),t}function Td(r,e=!1,t=!0){var i;let n=Ui(r);return e||(n.equals=WE),Yl&&t&&_t!==null&&_t.l!==null&&((i=_t.l).s??(i.s=[])).push(n),n}function Z(r,e,t=!1){je!==null&&(!co||(je.f&131072)!==0)&&va()&&(je.f&4325394)!==0&&(xa===null||!xa.has(r))&&pL();let n=t?wt(e):e;return te&&zE(n,r.label),wa(r,n,Tv)}function wa(r,e,t=null){if(!r.equals(e)){nc.set(r,Qo?e:r.v);var n=Ko.ensure();if(n.capture(r,e),te){if(fa||Fe!==null){r.updated??(r.updated=new Map);let i=(r.updated.get("")?.count??0)+1;if(r.updated.set("",{error:null,count:i}),fa||i>5){let o=ha("updated at");if(o!==null){let s=r.updated.get(o.stack);s||(s={error:o,count:0},r.updated.set(o.stack,s)),s.count++}}}Fe!==null&&(r.set_during_effect=!0)}if((r.f&2)!==0){let i=r;(r.f&2048)!==0&&wv(i),ei===null&&Af(i)}r.wv=Mf(),KL(r,2048,t),va()&&Fe!==null&&(Fe.f&1024)!==0&&(Fe.f&96)===0&&(Xo===null?QL([r]):Xo.push(r)),!n.is_fork&&Pd.size>0&&!$I&&sT()}return e}function sT(){$I=!1;for(let r of Pd){(r.f&1024)!==0&&rr(r,4096);let e;try{e=uu(r)}catch{e=!0}e&&sl(r)}Pd.clear()}function OI(r,e=1){var t=h(r);return Z(r,e===1?++t:--t)}function kd(r){Z(r,r.v+1)}function KL(r,e,t){var n=r.reactions;if(n!==null)for(var i=va(),o=n.length,s=0;s<o;s++){var a=n[s],l=a.f;if(!(!i&&a===Fe)){var c=(l&2048)===0;if(c&&rr(a,e),(l&131072)!==0)Pd.add(a);else if((l&2)!==0){var u=a;ei?.delete(u),(l&65536)===0&&(l&512&&(Fe===null||(Fe.f&2097152)===0)&&(a.f|=65536),KL(u,4096,t))}else if(c){var d=a;(l&16)!==0&&Ps!==null&&Ps.add(d),t!==null?t.push(d):kv(d)}}}}var lQ=/^[a-zA-Z_$][a-zA-Z_$0-9]*$/;function wt(r){if(typeof r!="object"||r===null||Dn in r)return r;let e=iu(r);if(e!==ME&&e!==KN)return r;var t=new Map,n=pa(r),i=Ae(0),o=te&&fa?ha("created at"):null,s=du,a=d=>{if(du===s)return d();var f=je,p=du;Rn(null),NI(s);var m=d();return Rn(f),NI(p),m};n&&(t.set("length",Ae(r.length,o)),te&&(r=uQ(r)));var l="";let c=!1;function u(d){if(!c){c=!0,l=d,Ni(i,`${l} version`);for(let[f,p]of t)Ni(p,Od(l,f));c=!1}}return new Proxy(r,{defineProperty(d,f,p){(!("value"in p)||p.configurable===!1||p.enumerable===!1||p.writable===!1)&&uL();var m=t.get(f);return m===void 0?a(()=>{var v=Ae(p.value,o);return t.set(f,v),te&&typeof f=="string"&&Ni(v,Od(l,f)),v}):Z(m,p.value,!0),!0},deleteProperty(d,f){var p=t.get(f);if(p===void 0){if(f in d){let m=a(()=>Ae(fr,o));t.set(f,m),kd(i),te&&Ni(m,Od(l,f))}}else Z(p,fr),kd(i);return!0},get(d,f,p){if(f===Dn)return r;if(te&&f===OE)return u;var m=t.get(f),v=f in d;if(m===void 0&&(!v||Ao(d,f)?.writable)&&(m=a(()=>{var y=wt(v?d[f]:fr),w=Ae(y,o);return te&&Ni(w,Od(l,f)),w}),t.set(f,m)),m!==void 0){var g=h(m);return g===fr?void 0:g}return Reflect.get(d,f,p)},getOwnPropertyDescriptor(d,f){var p=Reflect.getOwnPropertyDescriptor(d,f);if(p&&"value"in p){var m=t.get(f);m&&(p.value=h(m))}else if(p===void 0){var v=t.get(f),g=v?.v;if(v!==void 0&&g!==fr)return{enumerable:!0,configurable:!0,value:g,writable:!0}}return p},has(d,f){if(f===Dn)return!0;var p=t.get(f),m=p!==void 0&&p.v!==fr||Reflect.has(d,f);if(p!==void 0||Fe!==null&&(!m||Ao(d,f)?.writable)){p===void 0&&(p=a(()=>{var g=m?wt(d[f]):fr,y=Ae(g,o);return te&&Ni(y,Od(l,f)),y}),t.set(f,p));var v=h(p);if(v===fr)return!1}return m},set(d,f,p,m){var v=t.get(f),g=f in d;if(n&&f==="length")for(var y=p;y<v.v;y+=1){var w=t.get(y+"");w!==void 0?Z(w,fr):y in d&&(w=a(()=>Ae(fr,o)),t.set(y+"",w),te&&Ni(w,Od(l,y)))}if(v===void 0)(!g||Ao(d,f)?.writable)&&(v=a(()=>Ae(void 0,o)),te&&Ni(v,Od(l,f)),Z(v,wt(p)),t.set(f,v));else{g=v.v!==fr;var x=a(()=>wt(p));Z(v,x)}var C=Reflect.getOwnPropertyDescriptor(d,f);if(C?.set&&C.set.call(m,p),!g){if(n&&typeof f=="string"){var _=t.get("length"),E=Number(f);Number.isInteger(E)&&E>=_.v&&Z(_,E+1)}kd(i)}return!0},ownKeys(d){h(i);var f=Reflect.ownKeys(d).filter(v=>{var g=t.get(v);return g===void 0||g.v!==fr});for(var[p,m]of t)m.v!==fr&&!(p in d)&&f.push(p);return f},setPrototypeOf(){dL()}})}function Od(r,e){return typeof e=="symbol"?`${r}[Symbol(${e.description??""})]`:lQ.test(e)?`${r}.${e}`:/^\d+$/.test(e)?`${r}[${e}]`:`${r}['${e}']`}function Wf(r){try{if(r!==null&&typeof r=="object"&&Dn in r)return r[Dn]}catch{}return r}function LI(r,e){return Object.is(Wf(r),Wf(e))}var cQ=new Set(["copyWithin","fill","pop","push","reverse","shift","sort","splice","unshift"]);function uQ(r){return new Proxy(r,{get(e,t,n){var i=Reflect.get(e,t,n);return cQ.has(t)?function(...o){YL();var s=i.apply(this,o);return sT(),s}:i}})}function XL(){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??0;l<this.length;l+=1)if(Wf(this[l])===o){UE("array.indexOf(...)");break}}return a},r.lastIndexOf=function(o,s){let a=n.call(this,o,s??this.length-1);if(a===-1){for(let l=0;l<=(s??this.length-1);l+=1)if(Wf(this[l])===o){UE("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(Wf(this[l])===o){UE("array.includes(...)");break}}return a},Array.__svelte_cleanup=()=>{r.indexOf=t,r.lastIndexOf=n,r.includes=i}}var BI,ZL,mv,JL,e2;function aT(){if(BI===void 0){BI=window,ZL=document,mv=/Firefox/.test(navigator.userAgent);var r=Element.prototype,e=Node.prototype,t=Text.prototype;JL=Ao(e,"firstChild").get,e2=Ao(e,"nextSibling").get,lI(r)&&(r[sv]=void 0,r[NE]=null,r[av]=void 0,r.__e=void 0),lI(t)&&(t[lv]=void 0),te&&(r.__svelte_meta=null,XL())}}function tn(r=""){return document.createTextNode(r)}function vi(r){return JL.call(r)}function gi(r){return e2.call(r)}function I(r,e){if(!Re)return vi(r);var t=vi(Ze);if(t===null)t=Ze.appendChild(tn());else if(e&&t.nodeType!==wd){var n=tn();return t?.before(n),tr(n),n}return e&&Sv(t),tr(t),t}function Pe(r,e=!1){if(!Re){var t=vi(r);return t instanceof Comment&&t.data===""?gi(t):t}if(e){if(Ze?.nodeType!==wd){var n=tn();return Ze?.before(n),tr(n),n}Sv(Ze)}return Ze}function A(r,e=1,t=!1){let n=Re?Ze:r;for(var i;e--;)i=n,n=gi(n);if(!Re)return n;if(t){if(n?.nodeType!==wd){var o=tn();return n===null?i?.after(o):n.before(o),tr(o),o}Sv(n)}return tr(n),n}function Sf(r){r.textContent=""}function lT(){if(!en||Ps!==null)return!1;var r=Fe.f;return(r&32768)!==0}function ll(r,e,t){return e==null||e===IE?t?document.createElement(r,{is:t}):document.createElement(r):t?document.createElementNS(e,r,{is:t}):document.createElementNS(e,r)}function Sv(r){if(r.nodeValue.length<65536)return;let e=r.nextSibling;for(;e!==null&&e.nodeType===wd;)e.remove(),r.nodeValue+=e.nodeValue,e=r.nextSibling}function r2(r){Fe===null&&(je===null&&iL(r),nL()),Qo&&rL(r)}function pQ(r,e){var t=e.last;t===null?e.last=e.first=r:(t.next=r,r.prev=t,e.last=r)}function cl(r,e){var t=Fe;if(te)for(;t!==null&&(t.f&131072)!==0;)t=t.parent;t!==null&&(t.f&8192)!==0&&(r|=8192);var n={ctx:_t,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};te&&(n.component_function=ga),qe?.register_created_effect(n);var i=n;if((r&4)!==0)Md!==null?Md.push(n):Ko.ensure().schedule(n);else if(e!==null){try{sl(n)}catch(s){throw qr(n),s}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&&pQ(i,t),je!==null&&(je.f&2)!==0&&(r&64)===0)){var o=je;(o.effects??(o.effects=[])).push(i)}return n}function su(){return je!==null&&!co}function Xn(r){let e=cl(8,null);return rr(e,1024),e.teardown=r,e}function hr(r){r2("$effect"),te&&Oi(r,"name",{value:"$effect"});var e=Fe.f,t=!je&&(e&32)!==0&&_t!==null&&!_t.i;if(t){var n=_t;(n.e??(n.e=[])).push(r)}else return mI(r)}function mI(r){return cl(1048580,r)}function VI(r){Ko.ensure();let e=cl(524352,r);return()=>{qr(e)}}function n2(r){Ko.ensure();let e=cl(524352,r);return(t={})=>new Promise(n=>{t.outro?il(e,()=>{qr(e),n(void 0)}):(qr(e),n(void 0))})}function un(r){return cl(4,r)}function LL(r){return cl(4718592,r)}function Zn(r,e=0){return cl(8|e,r)}function de(r,e=[],t=[],n=[]){eT(n,e,t,i=>{cl(8,()=>{r(...i.map(h))})})}function so(r,e=0){var t=cl(16|e,r);return te&&(t.dev_stack=rl),t}function On(r){return cl(524320,r)}function qI(r){var e=r.teardown;if(e!==null){let t=Qo,n=je;UI(!0),Rn(null);try{e.call(null)}finally{UI(t),Rn(n)}}}function Cv(r,e=!1){var t=r.first;for(r.first=r.last=null;t!==null;){let i=t.ac;i!==null&&Ss(()=>{i.abort(Gl)});var n=t.next;(t.f&64)!==0?t.parent=null:qr(t,e),t=n}}function i2(r){for(var e=r.first;e!==null;){var t=e.next;(e.f&32)===0&&qr(e),e=t}}function qr(r,e=!0){var t=!1;(e||(r.f&262144)!==0)&&r.nodes!==null&&r.nodes.end!==null&&(o2(r.nodes.start,r.nodes.end),t=!0),r.f|=33554432,Cv(r,e&&!t),Fd(r,0);var n=r.nodes&&r.nodes.t;if(n!==null)for(let o of n)o.stop();qI(r),r.f^=33554432,r.f|=16384;var i=r.parent;i!==null&&i.first!==null&&RI(r),te&&(r.component_function=null),r.next=r.prev=r.teardown=r.ctx=r.deps=r.fn=r.nodes=r.ac=r.b=null}function o2(r,e){for(;r!==null;){var t=r===e?null:gi(r);r.remove(),r=t}}function RI(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 il(r,e,t=!0){var n=[];s2(r,n,!0);var i=()=>{t&&qr(r),e&&e()},o=n.length;if(o>0){var s=()=>--o||i();for(var a of n)a.out(s)}else i()}function s2(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;s2(i,e,s?t:!1)}i=o}}}function zf(r){a2(r,!0)}function a2(r,e){if((r.f&8192)!==0){r.f^=8192,(r.f&1024)===0&&(rr(r,2048),Ko.ensure().schedule(r));for(var t=r.first;t!==null;){var n=t.next,i=(t.f&65536)!==0||(t.f&32)!==0;a2(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 If(r,e){if(r.nodes)for(var t=r.nodes.start,n=r.nodes.end;t!==null;){var i=t===n?null:gi(t);e.append(t),t=i}}var l2=null;var cT=!1,Qo=!1;function UI(r){Qo=r}var je=null,co=!1;function Rn(r){je=r}var Fe=null;function $n(r){Fe=r}var xa=null;function nT(r){je!==null&&(!en||(je.f&2)!==0)&&(xa??(xa=new Set)).add(r)}var Jn=null,ao=0,Xo=null;function QL(r){Xo=r}var c2=1,Nd=0,du=Nd;function NI(r){du=r}function Mf(){return++c2}function uu(r){var e=r.f;if((e&2048)!==0)return!0;if(e&2&&(r.f&=-65537),(e&4096)!==0){for(var t=r.deps,n=t.length,i=0;i<n;i++){var o=t[i];if(uu(o)&&AI(o),o.wv>r.wv)return!0}(e&512)!==0&&ei===null&&rr(r,1024)}return!1}function u2(r,e,t=!0){var n=r.reactions;if(n!==null&&!(!en&&xa!==null&&xa.has(r)))for(var i=0;i<n.length;i++){var o=n[i];(o.f&2)!==0?u2(o,e,!1):e===o&&(t?rr(o,2048):(o.f&1024)!==0&&rr(o,4096),kv(o))}}function rT(r){var v;var e=Jn,t=ao,n=Xo,i=je,o=xa,s=_t,a=co,l=du,c=r.f;Jn=null,ao=0,Xo=null,je=(c&96)===0?r:null,xa=null,Kl(r.ctx),co=!1,du=++Nd,r.ac!==null&&(Ss(()=>{r.ac.abort(Gl)}),r.ac=null);try{r.f|=2097152;var u=r.fn,d=u();r.f|=32768;var f=r.deps,p=qe?.is_fork;if(Jn!==null){var m;if(p||Fd(r,ao),f!==null&&ao>0)for(f.length=ao+Jn.length,m=0;m<Jn.length;m++)f[ao+m]=Jn[m];else r.deps=f=Jn;if(su()&&(r.f&512)!==0)for(m=ao;m<f.length;m++)((v=f[m]).reactions??(v.reactions=[])).push(r)}else!p&&f!==null&&ao<f.length&&(Fd(r,ao),f.length=ao);if(va()&&Xo!==null&&!co&&f!==null&&(r.f&6146)===0)for(m=0;m<Xo.length;m++)u2(Xo[m],r);if(i!==null&&i!==r){if(Nd++,i.deps!==null)for(let g=0;g<t;g+=1)i.deps[g].rv=Nd;if(e!==null)for(let g of e)g.rv=Nd;Xo!==null&&(n===null?n=Xo:n.push(...Xo))}return(r.f&8388608)!==0&&(r.f^=8388608),d}catch(g){return jE(g)}finally{r.f^=2097152,Jn=e,ao=t,Xo=n,je=i,xa=o,Kl(s),co=a,du=l}}function fQ(r,e){let t=e.reactions;if(t!==null){var n=YN.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&&(Jn===null||!nu.call(Jn,e))){var o=e;(o.f&512)!==0&&(o.f^=512,o.f&=-65537),o.v!==fr&&Af(o),o.ac!==null&&Ss(()=>{o.ac.abort(Gl),o.ac=null,rr(o,2048)}),NL(o),Fd(o,0)}}function Fd(r,e){var t=r.deps;if(t!==null)for(var n=e;n<t.length;n++)fQ(r,t[n])}function sl(r){var e=r.f;if((e&16384)===0){rr(r,1024);var t=Fe,n=cT;if(Fe=r,cT=(e&96)===0,te){var i=ga;HE(r.component_function);var o=rl;_f(r.dev_stack??rl)}try{(e&16777232)!==0?i2(r):Cv(r),qI(r);var s=rT(r);if(r.teardown=typeof s=="function"?s:null,r.wv=c2,te&&fa&&(r.f&2048)!==0&&r.deps!==null)for(var a of r.deps)a.set_during_effect&&(a.wv=Mf(),a.set_during_effect=!1)}finally{cT=n,Fe=t,te&&(HE(i),_f(o))}}}async function Hf(){if(en)return new Promise(r=>{requestAnimationFrame(()=>r()),setTimeout(()=>r())});await Promise.resolve(),$d()}function h(r){var e=r.f,t=(e&2)!==0;if(l2?.add(r),je!==null&&!co){var n=Fe!==null&&(Fe.f&16384)!==0;if(!n&&(xa===null||!xa.has(r))){var i=je.deps;if((je.f&2097152)!==0)r.rv<Nd&&(r.rv=Nd,Jn===null&&i!==null&&i[ao]===r?ao++:Jn===null?Jn=[r]:Jn.push(r));else{je.deps??(je.deps=[]),nu.call(je.deps,r)||je.deps.push(r);var o=r.reactions;o===null?r.reactions=[je]:nu.call(o,je)||o.push(je)}}}if(te){if(!co&&Po&&qe===null&&ol===null&&!Po.warned&&(Po.effect.f&2097152)===0&&!Po.effect_deps.has(r)){Po.warned=!0,mL(r.label);var s=ha("traced at");s&&console.warn(s)}if(bv.delete(r),fa&&!co&&pv!==null&&je!==null&&pv.reaction===je){if(r.trace)r.trace();else if(s=ha("traced at"),s){var a=pv.entries.get(r);a===void 0&&(a={traces:[]},pv.entries.set(r,a));var l=a.traces[a.traces.length-1];s.stack!==l?.stack&&a.traces.push(s)}}}if(Qo&&nc.has(r))return nc.get(r);if(t){var c=r;if(Qo){var u=c.v;return((c.f&1024)===0&&c.reactions!==null||p2(c))&&(u=wv(c)),nc.set(c,u),u}var d=(c.f&512)===0&&!co&&je!==null&&(cT||(je.f&512)!==0),f=(c.f&32768)===0;uu(c)&&(d&&(c.f|=512),AI(c)),d&&!f&&(kI(c),d2(c))}if(ei?.has(r))return ei.get(r);if((r.f&8388608)!==0)throw r.v;return r.v}function d2(r){if(r.f|=512,r.deps!==null)for(let e of r.deps)(e.reactions??(e.reactions=[])).push(r),(e.f&2)!==0&&(e.f&512)===0&&(kI(e),d2(e))}function p2(r){if(r.v===fr)return!0;if(r.deps===null)return!1;for(let e of r.deps)if(nc.has(e)||(e.f&2)!==0&&p2(e))return!0;return!1}function Ot(r){var e=co;try{return co=!0,r()}finally{co=e}}function dT(r){if(!(typeof r!="object"||!r||r instanceof EventTarget)){if(Dn in r)uT(r);else if(!Array.isArray(r))for(let e in r){let t=r[e];typeof t=="object"&&t&&Dn in t&&uT(t)}}}function uT(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{uT(r[n],e)}catch{}let t=iu(r);if(t!==Object.prototype&&t!==Array.prototype&&t!==Map.prototype&&t!==Set.prototype&&t!==Date.prototype){let n=FE(t);for(let i in n){let o=n[i].get;if(o)try{o.call(r)}catch{}}}}}var Ld=Symbol("events"),WI=new Set,pT=new Set;function m2(r,e,t,n={}){function i(o){if(n.capture||fT.call(e,o),!o.cancelBubble)return Ss(()=>t?.call(this,o))}return r.startsWith("pointer")||r.startsWith("touch")||r==="wheel"?Ur(()=>{e.addEventListener(r,i,n)}):e.addEventListener(r,i,n),i}function ic(r,e,t,n,i){var o={capture:n,passive:i},s=m2(r,e,t,o);(e===document.body||e===window||e===document||e instanceof HTMLMediaElement)&&Xn(()=>{e.removeEventListener(r,s,o)})}function De(r,e,t){(e[Ld]??(e[Ld]={}))[r]=t}function Et(r){for(var e=0;e<r.length;e++)WI.add(r[e]);for(var t of pT)t(r)}var f2=null;function fT(r){var e=this,t=e.ownerDocument,n=r.type,i=r.composedPath?.()||[],o=i[0]||r.target;f2=r;var s=0,a=f2===r&&r[Ld];if(a){var l=i.indexOf(a);if(l!==-1&&(e===document||e===window)){r[Ld]=e;return}var c=i.indexOf(e);if(c===-1)return;l<=c&&(s=l)}if(o=i[s]||r.target,o!==e){Oi(r,"currentTarget",{configurable:!0,get(){return o||t}});var u=je,d=Fe;Rn(null),$n(null);try{for(var f,p=[];o!==null&&o!==e;){try{var m=o[Ld]?.[n];m!=null&&(!o.disabled||r.target===o)&&m.call(o,r)}catch(v){f?p.push(v):f=v}if(r.cancelBubble)break;s++,o=s<i.length?i[s]:null}if(f){for(let v of p)queueMicrotask(()=>{throw v});throw f}}finally{r[Ld]=e,delete r.currentTarget,Rn(u),$n(d)}}}var mQ=globalThis?.window?.trustedTypes&&globalThis.window.trustedTypes.createPolicy("svelte-trusted-html",{createHTML:r=>r});function h2(r){return mQ?.createHTML(r)??r}function zI(r){var e=ll("template");return e.innerHTML=h2(r.replaceAll("<!>","<!---->")),e.content}function Zo(r,e){var t=Fe;t.nodes===null&&(t.nodes={start:r,end:e,a:null,t:null})}function W(r,e){var t=(e&1)!==0,n=(e&2)!==0,i,o=!r.startsWith("<!>");return()=>{if(Re)return Zo(Ze,null),Ze;i===void 0&&(i=zI(o?r:"<!>"+r),t||(i=vi(i)));var s=n||mv?document.importNode(i,!0):i.cloneNode(!0);if(t){var a=vi(s),l=s.lastChild;Zo(a,l)}else Zo(s,s);return s}}function ul(r=""){if(!Re){var e=tn(r+"");return Zo(e,e),e}var t=Ze;return t.nodeType!==wd?(t.before(t=tn()),tr(t)):Sv(t),Zo(t,t),t}function dn(){if(Re)return Zo(Ze,null),Ze;var r=document.createDocumentFragment(),e=document.createComment(""),t=tn();return r.append(e,t),Zo(e,t),r}function $(r,e){if(Re){var t=Fe;((t.f&32768)===0||t.nodes.end===null)&&(t.nodes.end=Ze),Kn();return}r!==null&&r.before(e)}function Dv(){var r;if(Re&&Ze&&Ze.nodeType===jo&&Ze.textContent?.startsWith("$")){let e=Ze.textContent.substring(1);return Kn(),e}return(r=window.__svelte??(window.__svelte={})).uid??(r.uid=1),`c${window.__svelte.uid++}`}var wQ=["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 x_e=[...wQ,"formNoValidate","isMap","noModule","playsInline","readOnly","value","volume","defaultValue","defaultChecked","srcObject","noValidate","allowFullscreen","disablePictureInPicture","disableRemotePlayback"];var CQ=["touchstart","touchmove"];function g2(r){return CQ.includes(r)}var xQ=["$state","$state.raw","$derived","$derived.by"],E_e=[...xQ,"$state.eager","$state.snapshot","$props","$props.id","$bindable","$effect","$effect.pre","$effect.tracking","$effect.root","$effect.pending","$inspect","$inspect().with","$inspect.trace","$host"];var jI=!0;function me(r,e){var n;var t=e==null?"":typeof e=="object"?`${e}`:e;t!==(r[n=lv]??(r[n]=r.nodeValue))&&(r[lv]=t,r.nodeValue=`${t}`)}function Bd(r,e){return v2(r,e)}function YI(r,e){aT(),e.intro=e.intro??!1;let t=e.target,n=Re,i=Ze;try{for(var o=vi(t);o&&(o.nodeType!==jo||o.data!=="[");)o=gi(o);if(!o)throw jl;In(!0),tr(o);let s=v2(r,{...e,anchor:o});return In(!1),s}catch(s){if(s instanceof Error&&s.message.split(`
|
||
`).some(a=>a.startsWith("https://svelte.dev/e/")))throw s;return s!==jl&&console.warn("Failed to hydrate: ",s),e.recover===!1&&sL(),aT(),Sf(t),In(!1),Bd(r,e)}finally{In(n),tr(i)}}var mT=new Map;function v2(r,{target:e,anchor:t,props:n={},events:i,context:o,intro:s=!0,transformError:a}){aT();var l=void 0,c=n2(()=>{var u=t??e.appendChild(tn());yv(u,{pending:()=>{}},p=>{we({});var m=_t;if(o&&(m.c=o),i&&(n.$$events=i),Re&&Zo(p,null),jI=s,l=r(p,n)||{},jI=!0,Re&&(Fe.nodes.end=Ze,Ze===null||Ze.nodeType!==jo||Ze.data!=="]"))throw Cd(),jl;Ce()},a);var d=new Set,f=p=>{for(var m=0;m<p.length;m++){var v=p[m];if(!d.has(v)){d.add(v);var g=g2(v);for(let x of[e,document]){var y=mT.get(x);y===void 0&&(y=new Map,mT.set(x,y));var w=y.get(v);w===void 0?(x.addEventListener(v,fT,{passive:g}),y.set(v,1)):y.set(v,w+1)}}}};return f(xf(WI)),pT.add(f),()=>{for(var p of d)for(let g of[e,document]){var m=mT.get(g),v=m.get(p);--v==0?(g.removeEventListener(p,fT),m.delete(p),m.size===0&&mT.delete(g)):m.set(p,v)}pT.delete(f),u!==t&&u.parentNode?.removeChild(u)}});return GI.set(l,c),l}var GI=new WeakMap;function jf(r,e){let t=GI.get(r);return t?(GI.delete(r),t(e)):(te&&(Dn in r?wL():yL()),Promise.resolve())}var Ea,dl,Jo,Ud,Iv,Pv,hT,Ta=class{constructor(e,t=!0){ae(this,"anchor");it(this,Ea,new Map);it(this,dl,new Map);it(this,Jo,new Map);it(this,Ud,new Set);it(this,Iv,!0);it(this,Pv,e=>{if(z(this,Ea).has(e)){var t=z(this,Ea).get(e),n=z(this,dl).get(t);if(n)zf(n),z(this,Ud).delete(t);else{var i=z(this,Jo).get(t);i&&(zf(i.effect),z(this,dl).set(t,i.effect),z(this,Jo).delete(t),te&&(i.fragment.lastChild[uI]=this.anchor),i.fragment.lastChild.remove(),this.anchor.before(i.fragment),n=i.effect)}for(let[o,s]of z(this,Ea)){if(z(this,Ea).delete(o),o===e)break;let a=z(this,Jo).get(s);a&&(qr(a.effect),z(this,Jo).delete(s))}for(let[o,s]of z(this,dl)){if(o===t||z(this,Ud).has(o))continue;let a=()=>{if(Array.from(z(this,Ea).values()).includes(o)){var c=document.createDocumentFragment();If(s,c),c.append(tn()),z(this,Jo).set(o,{effect:s,fragment:c})}else qr(s);z(this,Ud).delete(o),z(this,dl).delete(o)};z(this,Iv)||!n?(z(this,Ud).add(o),il(s,a,!1)):a()}}});it(this,hT,e=>{z(this,Ea).delete(e);let t=Array.from(z(this,Ea).values());for(let[n,i]of z(this,Jo))t.includes(n)||(qr(i.effect),z(this,Jo).delete(n))});this.anchor=e,et(this,Iv,t)}ensure(e,t){var n=qe,i=lT();if(t&&!z(this,dl).has(e)&&!z(this,Jo).has(e))if(i){var o=document.createDocumentFragment(),s=tn();o.append(s),z(this,Jo).set(e,{effect:On(()=>t(s)),fragment:o})}else z(this,dl).set(e,On(()=>t(this.anchor)));if(z(this,Ea).set(n,e),i){for(let[a,l]of z(this,dl))a===e?n.unskip_effect(l):n.skip_effect(l);for(let[a,l]of z(this,Jo))a===e?n.unskip_effect(l.effect):n.skip_effect(l.effect);n.oncommit(z(this,Pv)),n.ondiscard(z(this,hT))}else Re&&(this.anchor=Ze),z(this,Pv).call(this,n)}};Ea=new WeakMap,dl=new WeakMap,Jo=new WeakMap,Ud=new WeakMap,Iv=new WeakMap,Pv=new WeakMap,hT=new WeakMap;function Fv(r,e,...t){var n=new Ta(r);so(()=>{let i=e()??null;te&&i==null&&aL(),n.ensure(i,i&&(o=>i(o,...t)))},65536)}if(te){let r=function(e){if(!(e in globalThis)){let t;Object.defineProperty(globalThis,e,{configurable:!0,get:()=>{if(t!==void 0)return t;cL(e)},set:n=>{t=n}})}};r("$state"),r("$effect"),r("$derived"),r("$inspect"),r("$props"),r("$bindable")}function gT(r){_t===null&&BE("onMount"),Yl&&_t.l!==null?_Q(_t).m.push(r):hr(()=>{let e=Ot(r);if(typeof e=="function")return e})}function _Q(r){var e=r.l;return e.u??(e.u={a:[],b:[],m:[]})}var w2=new Map;function C2(r,e){var t=w2.get(r);t||(t=new Set,w2.set(r,t)),t.add(e)}function ne(r,e,t=!1){var n;Re&&(n=Ze,Kn());var i=new Ta(r),o=t?65536:0;function s(a,l){if(Re){var c=uv(n);if(a!==parseInt(c.substring(1))){var u=tl();tr(u),i.anchor=u,In(!1),i.ensure(a,l),In(!0);return}}i.ensure(a,l)}so(()=>{var a=!1;e((l,c=0)=>{a=!0,s(c,l)}),a||s(-1,null)},o)}var DQ=Symbol("NaN");function KI(r,e,t){Re&&Kn();var n=new Ta(r),i=!va();so(()=>{var o=e();o!==o&&(o=DQ),i&&o!==null&&typeof o=="object"&&(o={}),n.ensure(o,t)})}function $v(r,e){return e}function RQ(r,e,t){for(var n=[],i=e.length,o,s=e.length,a=0;a<i;a++){let d=e[a];il(d,()=>{if(o){if(o.pending.delete(d),o.done.add(d),o.pending.size===0){var f=r.outrogroups;QI(r,xf(o.done)),f.delete(o),f.size===0&&(r.outrogroups=null)}}else s-=1},!1)}if(s===0){var l=n.length===0&&t!==null;if(l){var c=t,u=c.parentNode;Sf(u),u.append(c),r.items.clear()}QI(r,e,!l)}else o={pending:new Set(e),done:new Set},(r.outrogroups??(r.outrogroups=new Set)).add(o)}function QI(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?.has(o)){o.f|=33554432;let s=document.createDocumentFragment();If(o,s)}else qr(e[i],t)}}var x2;function ar(r,e,t,n,i,o=null){var s=r,a=new Map,l=(e&4)!==0;if(l){var c=r;s=Re?tr(vi(c)):c.appendChild(tn())}Re&&Kn();var u=null,d=Id(()=>{var x=t();return pa(x)?x:x==null?[]:xf(x)});te&&Ni(d,"{#each ...}");var f,p=new Map,m=!0;function v(x){(w.effect.f&16384)===0&&(w.pending.delete(x),w.fallback=u,$Q(w,f,s,e,n),u!==null&&(f.length===0?(u.f&33554432)===0?zf(u):(u.f^=33554432,Rv(u,null,s)):il(u,()=>{u=null})))}function g(x){w.pending.delete(x)}var y=so(()=>{f=h(d);var x=f.length;let C=!1;if(Re){var _=uv(s)==="[!";_!==(x===0)&&(s=tl(),tr(s),In(!1),C=!0)}for(var E=new Set,D=qe,P=lT(),H=0;H<x;H+=1){Re&&Ze.nodeType===jo&&Ze.data==="]"&&(s=Ze,C=!0,In(!1));var V=f[H],oe=n(V,H);if(te){var ce=n(V,H);oe!==ce&&tL(String(H),String(oe),String(ce))}var R=m?null:a.get(oe);R?(R.v&&wa(R.v,V),R.i&&wa(R.i,H),P&&D.unskip_effect(R.e)):(R=OQ(a,m?s:x2??(x2=tn()),V,oe,H,i,e,t),m||(R.e.f|=33554432),a.set(oe,R)),E.add(oe)}if(x===0&&o&&!u&&(m?u=On(()=>o(s)):(u=On(()=>o(x2??(x2=tn()))),u.f|=33554432)),x>E.size&&(te?NQ(f,n):pI("","","")),Re&&x>0&&tr(tl()),!m)if(p.set(D,E),P){for(let[O,q]of a)E.has(O)||D.skip_effect(q.e);D.oncommit(v),D.ondiscard(g)}else v(D);C&&In(!0),h(d)}),w={effect:y,flags:e,items:a,pending:p,outrogroups:null,fallback:u};m=!1,Re&&(s=Ze)}function Mv(r){for(;r!==null&&(r.f&32)===0;)r=r.next;return r}function $Q(r,e,t,n,i){var o=(n&8)!==0,s=e.length,a=r.items,l=Mv(r.effect.first),c,u=null,d,f=[],p=[],m,v,g,y;if(o)for(y=0;y<s;y+=1)m=e[y],v=i(m,y),g=a.get(v).e,(g.f&33554432)===0&&(g.nodes?.a?.measure(),(d??(d=new Set)).add(g));for(y=0;y<s;y+=1){if(m=e[y],v=i(m,y),g=a.get(v).e,r.outrogroups!==null)for(let V of r.outrogroups)V.pending.delete(g),V.done.delete(g);if((g.f&8192)!==0&&(zf(g),o&&(g.nodes?.a?.unfix(),(d??(d=new Set)).delete(g))),(g.f&33554432)!==0)if(g.f^=33554432,g===l)Rv(g,null,t);else{var w=u?u.next:l;g===r.effect.last&&(r.effect.last=g.prev),g.prev&&(g.prev.next=g.next),g.next&&(g.next.prev=g.prev),pu(r,u,g),pu(r,g,w),Rv(g,w,t),u=g,f=[],p=[],l=Mv(u.next);continue}if(g!==l){if(c!==void 0&&c.has(g)){if(f.length<p.length){var x=p[0],C;u=x.prev;var _=f[0],E=f[f.length-1];for(C=0;C<f.length;C+=1)Rv(f[C],x,t);for(C=0;C<p.length;C+=1)c.delete(p[C]);pu(r,_.prev,E.next),pu(r,u,_),pu(r,E,x),l=x,u=E,y-=1,f=[],p=[]}else c.delete(g),Rv(g,l,t),pu(r,g.prev,g.next),pu(r,g,u===null?r.effect.first:u.next),pu(r,u,g),u=g;continue}for(f=[],p=[];l!==null&&l!==g;)(c??(c=new Set)).add(l),p.push(l),l=Mv(l.next);if(l===null)continue}(g.f&33554432)===0&&f.push(g),u=g,l=Mv(g.next)}if(r.outrogroups!==null){for(let V of r.outrogroups)V.pending.size===0&&(QI(r,xf(V.done)),r.outrogroups?.delete(V));r.outrogroups.size===0&&(r.outrogroups=null)}if(l!==null||c!==void 0){var D=[];if(c!==void 0)for(g of c)(g.f&8192)===0&&D.push(g);for(;l!==null;)(l.f&8192)===0&&l!==r.fallback&&D.push(l),l=Mv(l.next);var P=D.length;if(P>0){var H=(n&4)!==0&&s===0?t:null;if(o){for(y=0;y<P;y+=1)D[y].nodes?.a?.measure();for(y=0;y<P;y+=1)D[y].nodes?.a?.fix()}RQ(r,D,H)}}o&&Ur(()=>{if(d!==void 0)for(g of d)g.nodes?.a?.apply()})}function OQ(r,e,t,n,i,o,s,a){var l=(s&1)!==0?(s&16)===0?Td(t,!1,!1):Ui(t):null,c=(s&2)!==0?Ui(i):null;return te&&l&&(l.trace=()=>{a()[c?.v??i]}),{v:l,i:c,e:On(()=>(o(e,l??t,c??i,a),()=>{r.delete(n)}))}}function Rv(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=gi(n);if(o.before(n),n===i)return;n=s}}function pu(r,e,t){e===null?r.effect.first=t:e.next=t,t===null?r.effect.last=e:t.prev=e}function NQ(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),pI(s,a,l)}t.set(o,i)}}var LQ=PE?()=>performance.now():()=>Date.now(),_a={tick:r=>(PE?requestAnimationFrame:Vt)(r),now:()=>LQ(),tasks:new Set};function T2(){let r=_a.now();_a.tasks.forEach(e=>{e.c(r)||(_a.tasks.delete(e),e.f())}),_a.tasks.size!==0&&_a.tick(T2)}function _2(r){let e;return _a.tasks.size===0&&_a.tick(T2),{promise:new Promise(t=>{_a.tasks.add(e={c:r,f:t})}),abort(){_a.tasks.delete(e)}}}function BQ(r){if(r==="float")return"cssFloat";if(r==="offset")return"cssOffset";if(r.startsWith("--"))return r;let e=r.split("-");return e.length===1?e[0]:e[0]+e.slice(1).map(t=>t[0].toUpperCase()+t.slice(1)).join("")}function A2(r){let e={},t=r.split(";");for(let n of t){let[i,o]=n.split(":");if(!i||o===void 0)break;let s=BQ(i.trim());e[s]=o.trim()}return e}var UQ=r=>r,VQ=null;function XI(r,e,t){var n=VQ??Fe,i=n.nodes,o,s,a,l=null;i.a??(i.a={element:r,measure(){o=this.element.getBoundingClientRect()},apply(){if(a?.abort(),s=this.element.getBoundingClientRect(),o.left!==s.left||o.right!==s.right||o.top!==s.top||o.bottom!==s.bottom){let c=e()(this.element,{from:o,to:s},t?.());a=k2(this.element,c,void 0,1,()=>{},()=>{a?.abort(),a=void 0})}},fix(){if(!r.getAnimations().length){var{position:c,width:u,height:d}=getComputedStyle(r);if(c!=="absolute"&&c!=="fixed"){var f=r.style;l={position:f.position,width:f.width,height:f.height,transform:f.transform},f.position="absolute",f.width=u,f.height=d;var p=r.getBoundingClientRect();if(o.left!==p.left||o.top!==p.top){var m=`translate(${o.left-p.left}px, ${o.top-p.top}px)`;f.transform=f.transform?`${f.transform} ${m}`:m}}}},unfix(){if(l){var c=r.style;c.position=l.position,c.width=l.width,c.height=l.height,c.transform=l.transform}}}),i.a.element=r}function k2(r,e,t,n,i,o){var s=n===1;if(cI(e)){var a,l=!1;return Ur(()=>{if(!l){var y=e({direction:s?"in":"out"});a=k2(r,y,t,n,i,o)}}),{abort:()=>{l=!0,a?.abort()},deactivate:()=>a.deactivate(),reset:()=>a.reset(),t:()=>a.t()}}if(t?.deactivate(),!e?.duration&&!e?.delay)return i(),o(),{abort:Vt,deactivate:Vt,reset:Vt,t:()=>n};let{delay:c=0,css:u,tick:d,easing:f=UQ}=e;var p=[];if(s&&t===void 0&&(d&&d(0,1),u)){var m=A2(u(0,1));p.push(m,m)}var v=()=>1-n,g=r.animate(p,{duration:c,fill:"forwards"});return g.onfinish=()=>{g.cancel(),i();var y=t?.t()??1-n;t?.abort();var w=n-y,x=e.duration*Math.abs(w),C=[];if(x>0){var _=!1;if(u)for(var E=Math.ceil(x/16.666666666666668),D=0;D<=E;D+=1){var P=y+w*f(D/E),H=A2(u(P,1-P));C.push(H),_||(_=H.overflow==="hidden")}_&&(r.style.overflow="hidden"),v=()=>{var V=g.currentTime;return y+w*f(V/x)},d&&_2(()=>{if(g.playState!=="running")return!1;var V=v();return d(V,1-V),!0})}g=r.animate(C,{duration:x,fill:"forwards"}),g.onfinish=()=>{v=()=>n,d?.(n,1-n),o()}},{abort:()=>{g&&(g.cancel(),g.effect=null,g.onfinish=Vt)},deactivate:()=>{o=Vt},reset:()=>{n===0&&d?.(1,0)},t:()=>v()}}function ot(r,e){un(()=>{var t=r.getRootNode(),n=t.host?t:t.head??t.ownerDocument.head;if(!n.querySelector("#"+e.hash)){let i=ll("style");i.id=e.hash,i.textContent=e.code,n.appendChild(i),te&&C2(e.hash,i)}})}function Fr(r,e,t){un(()=>{var n=Ot(()=>e(r,t?.())||{});if(t&&n?.update){var i=!1,o={};Zn(()=>{var s=t();dT(s),i&&qE(o,s)&&(o=s,n.update(s))}),i=!0}if(n?.destroy)return()=>n.destroy()})}var S2=[...`
|
||
\r\f\xA0\v\uFEFF`];function I2(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||S2.includes(n[s-1]))&&(a===n.length||S2.includes(n[a]))?n=(s===0?"":n.substring(0,s))+n.substring(a+1):s=a}}return n===""?null:n}function D2(r,e=!1){var t=e?" !important;":";",n="";for(var i of Object.keys(r)){var o=r[i];o!=null&&o!==""&&(n+=" "+i+": "+o+t)}return n}function ZI(r){return r[0]!=="-"||r[1]!=="-"?r.toLowerCase():r}function P2(r,e){if(e){var t="",n,i;if(Array.isArray(e)?(n=e[0],i=e[1]):n=e,r){r=String(r).replaceAll(/\s*\/\*.*?\*\/\s*/g,"").trim();var o=!1,s=0,a=!1,l=[];n&&l.push(...Object.keys(n).map(ZI)),i&&l.push(...Object.keys(i).map(ZI));var c=0,u=-1;let v=r.length;for(var d=0;d<v;d++){var f=r[d];if(a?f==="/"&&r[d-1]==="*"&&(a=!1):o?o===f&&(o=!1):f==="/"&&r[d+1]==="*"?a=!0:f==='"'||f==="'"?o=f:f==="("?s++:f===")"&&s--,!a&&o===!1&&s===0){if(f===":"&&u===-1)u=d;else if(f===";"||d===v-1){if(u!==-1){var p=ZI(r.substring(c,u).trim());if(!l.includes(p)){f!==";"&&d++;var m=r.substring(c,d).trim();t+=" "+m+";"}}c=d+1,u=-1}}}}return n&&(t+=D2(n)),i&&(t+=D2(i,!0)),t=t.trim(),t===""?null:t}return r==null?null:String(r)}function Ct(r,e,t,n,i,o){var s=r[sv];if(Re||s!==t||s===void 0){var a=I2(t,n,o);(!Re||a!==r.getAttribute("class"))&&(a==null?r.removeAttribute("class"):e?r.className=a:r.setAttribute("class",a)),r[sv]=t}else if(o&&i!==o)for(var l in o){var c=!!o[l];(i==null||c!==!!i[l])&&r.classList.toggle(l,c)}return o}function JI(r,e={},t,n){for(var i in t){var o=t[i];e[i]!==o&&(t[i]==null?r.style.removeProperty(i):r.style.setProperty(i,o,n))}}function Gf(r,e,t,n){var i=r[av];if(Re||i!==e){var o=P2(e,n);(!Re||o!==r.getAttribute("style"))&&(o==null?r.removeAttribute("style"):r.style.cssText=o),r[av]=e}else n&&(Array.isArray(n)?(JI(r,t?.[0],n[0]),JI(r,t?.[1],n[1],"important")):JI(r,t,n));return n}function fu(r,e,t=!1){if(r.multiple){if(e==null)return;if(!pa(e))return bL();for(var n of r.options)n.selected=e.includes(Ov(n));return}for(n of r.options){var i=Ov(n);if(LI(i,e)){n.selected=!0;return}}(!t||e!==void 0)&&(r.selectedIndex=-1)}function Vd(r){var e=new MutationObserver(()=>{"__value"in r&&fu(r,r.__value)});e.observe(r,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["value"]}),Xn(()=>{e.disconnect()})}function e0(r,e,t=e){var n=new WeakSet,i=!0;QE(r,"change",o=>{var s=o?"[selected]":":checked",a;if(r.multiple)a=[].map.call(r.querySelectorAll(s),Ov);else{var l=r.querySelector(s)??r.querySelector("option:not([disabled])");a=l&&Ov(l)}t(a),r.__value=a,qe!==null&&n.add(qe)}),un(()=>{var o=e();if(r===document.activeElement){var s=en?ol:qe;if(n.has(s))return}if(fu(r,o,i),i&&o===void 0){var a=r.querySelector(":checked");a!==null&&(o=Ov(a),t(o))}r.__value=o,i=!1}),Vd(r)}function Ov(r){return"__value"in r?r.__value:r.value}var HQ=Symbol("is custom element"),jQ=Symbol("is html"),GQ=LE?"link":"LINK";var YQ=LE?"progress":"PROGRESS";function gr(r){if(Re){var e=!1,t=()=>{if(!e){if(e=!0,r.hasAttribute("value")){var n=r.value;ke(r,"value",null),r.value=n}if(r.hasAttribute("checked")){var i=r.checked;ke(r,"checked",null),r.checked=i}}};r[ou]=t,Ur(t),KE()}}function Fs(r,e){var t=r0(r);t.value===(t.value=e??void 0)||r.value===e&&(e!==0||r.nodeName!==YQ)||(r.value=e??"")}function qd(r,e){var t=r0(r);t.checked!==(t.checked=e??void 0)&&(r.checked=e)}function ke(r,e,t,n){var i=r0(r);if(Re&&(i[e]=r.getAttribute(e),e==="src"||e==="srcset"||e==="href"&&r.nodeName===GQ)){n||QQ(r,e,t??"");return}i[e]!==(i[e]=t)&&(e==="loading"&&(r[QN]=t),t==null?r.removeAttribute(e):typeof t!="string"&&KQ(r).includes(e)?r[e]=t:r.setAttribute(e,t))}function r0(r){var e;return r[e=NE]??(r[e]={[HQ]:r.nodeName.includes("-"),[jQ]:r.namespaceURI===IE})}var F2=new Map;function KQ(r){var e=r.getAttribute("is")||r.nodeName,t=F2.get(e);if(t)return t;F2.set(e,t=[]);for(var n,i=r,o=Element.prototype;o!==i;){n=FE(i);for(var s in n)n[s].set&&s!=="innerHTML"&&s!=="textContent"&&s!=="innerText"&&t.push(s);i=iu(i)}return t}function QQ(r,e,t){te&&(e==="srcset"&&XQ(r,t)||t0(r.getAttribute(e)??"",t)||vL(e,r.outerHTML.replace(r.innerHTML,r.innerHTML&&"..."),String(t)))}function t0(r,e){return r===e?!0:new URL(r,document.baseURI).href===new URL(e,document.baseURI).href}function M2(r){return r.split(",").map(e=>e.trim().split(" ").filter(Boolean))}function XQ(r,e){var t=M2(r.srcset),n=M2(e);return n.length===t.length&&n.every(([i,o],s)=>o===t[s][1]&&(t0(t[s][0],i)||t0(i,t[s][0])))}function uo(r,e,t=e){var n=new WeakSet;QE(r,"input",async i=>{te&&r.type==="checkbox"&&dI();var o=i?r.defaultValue:r.value;if(o=n0(r)?i0(o):o,t(o),qe!==null&&n.add(qe),await Hf(),o!==(o=e())){var s=r.selectionStart,a=r.selectionEnd,l=r.value.length;if(r.value=o??"",a!==null){var c=r.value.length;s===a&&a===l&&c>l?(r.selectionStart=c,r.selectionEnd=c):(r.selectionStart=s,r.selectionEnd=Math.min(a,c))}}}),(Re&&r.defaultValue!==r.value||Ot(e)==null&&r.value)&&(t(n0(r)?i0(r.value):r.value),qe!==null&&n.add(qe)),Zn(()=>{te&&r.type==="checkbox"&&dI();var i=e();if(r===document.activeElement){var o=en?ol:qe;if(n.has(o))return}n0(r)&&i===i0(r.value)||r.type==="date"&&!i&&!r.value||i!==r.value&&(r.value=i??"")})}function n0(r){var e=r.type;return e==="number"||e==="range"}function i0(r){return r===""?null:+r}function o0(r,e){return r===e||r?.[Dn]===e}function oc(r={},e,t,n){var i=_t.r,o=Fe;return un(()=>{var s,a;return Zn(()=>{s=a,a=n?.()||[],Ot(()=>{o0(t(...a),r)||(e(r,...a),s&&o0(t(...s),r)&&e(null,...s))})}),()=>{let l=o;for(;l!==i&&l.parent!==null&&l.parent.f&33554432;)l=l.parent;let c=()=>{a&&o0(t(...a),r)&&e(null,...a)},u=l.teardown;l.teardown=()=>{c(),u?.()}}}),r}function he(r,e,t,n){var i=!Yl||(t&2)!==0,o=(t&8)!==0,s=(t&16)!==0,a=n,l=!0,c=void 0,u=()=>s&&i?(c??(c=lu(n)),h(c)):(l&&(l=!1,a=s?Ot(n):n),a);let d;if(o){var f=Dn in r||ov in r;d=Ao(r,e)?.set??(f&&e in r?C=>r[e]=C:void 0)}var p,m=!1;o?[p,m]=gI(()=>r[e]):p=r[e],p===void 0&&n!==void 0&&(p=u(),d&&(i&&lL(e),d(p)));var v;if(i?v=()=>{var C=r[e];return C===void 0?u():(l=!0,C)}:v=()=>{var C=r[e];return C!==void 0&&(a=void 0),C===void 0?a:C},i&&(t&4)===0)return v;if(d){var g=r.$$legacy;return(function(C,_){return arguments.length>0?((!i||!_||g||m)&&d(_?v():C),C):v()})}var y=!1,w=((t&1)!==0?lu:Id)(()=>(y=!1,v()));te&&(w.label=e),o&&h(w);var x=Fe;return(function(C,_){if(arguments.length>0){let E=_?h(w):i&&o?wt(C):C;return Z(w,E),y=!0,a!==void 0&&(a=E),C}return Qo&&y||(x.f&16384)!==0?w.v:h(w)})}function $2(r){return new a0(r)}var sc,Ms,a0=class{constructor(e){it(this,sc);it(this,Ms);var t=new Map,n=(o,s)=>{var a=Td(s,!1,!1);return t.set(o,a),a};let i=new Proxy({...e.props||{},$$events:{}},{get(o,s){return h(t.get(s)??n(s,Reflect.get(o,s)))},has(o,s){return s===ov?!0:(h(t.get(s)??n(s,Reflect.get(o,s))),Reflect.has(o,s))},set(o,s,a){return Z(t.get(s)??n(s,a),a),Reflect.set(o,s,a)}});et(this,Ms,(e.hydrate?YI:Bd)(e.component,{target:e.target,anchor:e.anchor,props:i,context:e.context,intro:e.intro??!1,recover:e.recover,transformError:e.transformError})),!en&&(!e?.props?.$$host||e.sync===!1)&&$d(),et(this,sc,i.$$events);for(let o of Object.keys(z(this,Ms)))o==="$set"||o==="$destroy"||o==="$on"||Oi(this,o,{get(){return z(this,Ms)[o]},set(s){z(this,Ms)[o]=s},enumerable:!0});z(this,Ms).$set=o=>{Object.assign(i,o)},z(this,Ms).$destroy=()=>{jf(z(this,Ms))}}$set(e){z(this,Ms).$set(e)}$on(e,t){z(this,sc)[e]=z(this,sc)[e]||[];let n=(...i)=>t.call(this,...i);return z(this,sc)[e].push(n),()=>{z(this,sc)[e]=z(this,sc)[e].filter(i=>i!==n)}}$destroy(){z(this,Ms).$destroy()}};sc=new WeakMap,Ms=new WeakMap;var uX;typeof HTMLElement=="function"&&(uX=class extends HTMLElement{constructor(e,t,n){super();ae(this,"$$ctor");ae(this,"$$s");ae(this,"$$c");ae(this,"$$cn",!1);ae(this,"$$d",{});ae(this,"$$r",!1);ae(this,"$$p_d",{});ae(this,"$$l",{});ae(this,"$$l_u",new Map);ae(this,"$$me");ae(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=ll("slot");i!=="default"&&(s.name=i),$(o,s)}};if(await Promise.resolve(),!this.$$cn||this.$$c)return;let t={},n=dX(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]=l0(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=$2({component:this.$$ctor,target:this.$$shadowRoot||this,props:{...this.$$d,$$slots:t,$$host:this}}),this.$$me=VI(()=>{Zn(()=>{this.$$r=!0;for(let i of aI(this.$$c)){if(!this.$$p_d[i]?.reflect)continue;this.$$d[i]=this.$$c[i];let o=l0(i,this.$$d[i],this.$$p_d,"toAttribute");o==null?this.removeAttribute(this.$$p_d[i].attribute||i):this.setAttribute(this.$$p_d[i].attribute||i,o)}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){this.$$r||(e=this.$$g_p(e),this.$$d[e]=l0(e,n,this.$$p_d,"toProp"),this.$$c?.$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 aI(this.$$p_d).find(t=>this.$$p_d[t].attribute===e||!this.$$p_d[t].attribute&&t.toLowerCase()===e)||e}});function l0(r,e,t,n){let i=t[r]?.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;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 dX(r){let e={};return r.childNodes.forEach(t=>{e[t.slot||"default"]=!0}),e}var lg=require("obsidian");It();Me();var cY=require("obsidian");Tt();var qv={location:"tab",direction:"vertical",mode:"default",focus:!0};function pn(r,e){if(!(e?.fillMissingOnly??!0))return{...qv,...r??{}};let n={...r??{}};return n.location==null&&(n.location=qv.location),n.direction==null&&(n.direction=qv.direction),n.mode==null&&(n.mode=qv.mode),n.focus==null&&(n.focus=qv.focus),n}Cr();var yB=require("obsidian"),wX=W('<span class="quickadd-icon svelte-1fiwm9k"></span>'),CX={hash:"svelte-1fiwm9k",code:".quickadd-icon.svelte-1fiwm9k {display:inline-flex;align-items:center;}.quickadd-icon.svelte-1fiwm9k svg {display:inline-block;vertical-align:middle;}"};function Rt(r,e){we(e,!0),ot(r,CX);let t=he(e,"size",3,16),n=Ae(void 0);hr(()=>{if(!h(n)||!e.iconId)return;(0,yB.setIcon)(h(n),e.iconId);let o=h(n).querySelector("svg");o&&(o.setAttribute("width",`${t()}`),o.setAttribute("height",`${t()}`))});var i=wX();oc(i,o=>Z(n,o),()=>h(n)),$(r,i),Ce()}var xX=W('<pre class="qaMountFailedDetail svelte-bhgeqn"> </pre>'),EX=W(`<div class="qaMountFailed svelte-bhgeqn"><div class="qaMountFailedHead svelte-bhgeqn"><!> <span class="qaMountFailedTitle svelte-bhgeqn"> </span></div> <p class="qaMountFailedBody svelte-bhgeqn">This part of QuickAdd could not be drawn, so it has been left out. Nothing
|
||
was changed by the error. Include the message below if you report this.</p> <!></div>`),TX={hash:"svelte-bhgeqn",code:".qaMountFailed.svelte-bhgeqn {border:1px solid var(--background-modifier-border);border-radius:var(--radius-m);padding:12px 14px;margin:4px 0 8px;background:var(--background-secondary);}.qaMountFailedHead.svelte-bhgeqn {display:flex;align-items:center;gap:8px;color:var(--text-warning, var(--text-normal));}.qaMountFailedTitle.svelte-bhgeqn {font-weight:var(--font-semibold);color:var(--text-normal);}.qaMountFailedBody.svelte-bhgeqn {margin:8px 0 0;color:var(--text-muted);font-size:var(--font-ui-small, 13px);max-width:68ch;}.qaMountFailedDetail.svelte-bhgeqn {margin:10px 0 0;padding:8px 10px;border-radius:var(--radius-s);background:var(--background-primary);color:var(--text-faint);font-size:var(--font-ui-smaller, 12px);white-space:pre-wrap;word-break:break-word;user-select:text;}"};function C0(r,e){ot(r,TX);let t=he(e,"detail",3,"");var n=EX(),i=I(n),o=I(i);Rt(o,{iconId:"alert-triangle",size:16});var s=A(o,2),a=I(s);S(s),S(i);var l=A(i,4);{var c=u=>{var d=xX(),f=I(d,!0);S(d),de(()=>me(f,t())),$(u,d)};ne(l,u=>{t()&&u(c)})}S(n),de(()=>me(a,`QuickAdd couldn't display ${e.what??""}`)),$(r,n)}var _X="this part of QuickAdd";function qi(r,e,t,n={}){let i=new Set(r.childNodes),o;try{o=Bd(e,{target:r,props:t})}catch(a){return AX(r,i,Yd(a),n)}let s=!1;return{ok:!0,destroy(){s||(s=!0,jf(o))}}}function AX(r,e,t,n){let i=n.what??_X;for(let l of Array.from(r.childNodes))e.has(l)||l.remove();lt(t,`Couldn't display ${i}`);let o=r.ownerDocument.createElement("div");o.className="qa-mount-failed-host",r.appendChild(o);let s=null;try{s=Bd(n.fallbackComponent??C0,{target:o,props:{what:i,detail:t.message}})}catch{o.textContent=`QuickAdd couldn't display ${i}.`}let a=!1;return{ok:!1,destroy(){a||(a=!0,s&&jf(s),o.remove())}}}var bB=require("obsidian");Tt();function em(r){return r.trim().replace(/^\/+/,"")}function bu(r){return r.trim().toLowerCase().endsWith(".canvas")}function E0(r,e){let t=em(e);if(!t||t.includes("{{"))return null;let n=r.vault.getAbstractFileByPath(t);return!n||!(n instanceof bB.TFile)||n.extension!=="canvas"?null:n}function wB(r,e){let n=r.workspace.getMostRecentLeaf?.()?.view;if(!n||n.getViewType?.()!=="canvas")return null;let i=em(e),o=em(n.file?.path??r.workspace.getActiveFile()?.path??"");if(!i||i!==o)return null;let s=n.canvas?.selection?Array.from(n.canvas.selection):[];if(s.length!==1)return null;let a=s[0]?.id;return typeof a=="string"&&a.length>0?a:null}function kX(r){return typeof r=="string"?r:r&&typeof r=="object"&&"path"in r&&typeof r.path=="string"?r.path:"(missing file path)"}function SX(r){return typeof r.x!="number"||typeof r.y!="number"||typeof r.width!="number"||typeof r.height!="number"?"":`${Math.round(r.x)},${Math.round(r.y)} \xB7 ${Math.round(r.width)}x${Math.round(r.height)}`}function x0(r,e){return r.length<=e?r:r.slice(0,e-1)+"\u2026"}async function CB(r,e){try{let t=await r.vault.cachedRead(e),n=JSON.parse(t);if(!n||typeof n!="object")return[];let i=n.nodes;if(!Array.isArray(i))return[];let o=i.filter(a=>!!a&&typeof a=="object"&&typeof a.id=="string").map(a=>{let l=a.type==="text"?"text":a.type==="file"?"file":"other",c=SX(a);if(l==="text"){let m=(typeof a.text=="string"?a.text:"").split(`
|
||
`).map(w=>w.trim()).filter(w=>w.length>0),v=x0(m[0]??"(empty text card)",90),g=[`${m.length} line${m.length===1?"":"s"}`];c&&g.push(c);let y=g.join(" \xB7 ");return{id:a.id,type:l,title:v,subtitle:y,searchText:`${a.id} ${v} ${y}`.toLowerCase(),capturable:!0,capturableReason:""}}if(l==="file"){let p=kX(a.file),m=ir.test(p),v=m?"":"Canvas file cards must link to markdown files (.md).",g=x0(p.split("/").pop()??p,90),y=[x0(p,120)];c&&y.push(c),m||y.push("Not capturable in this version");let w=y.join(" \xB7 ");return{id:a.id,type:l,title:g,subtitle:w,searchText:`${a.id} ${g} ${w}`.toLowerCase(),capturable:m,capturableReason:v}}let d=`Unsupported node (${typeof a.type=="string"&&a.type.length>0?a.type:"unknown"})`,f=c||"Type is not currently capturable";return{id:a.id,type:l,title:d,subtitle:f,searchText:`${a.id} ${d} ${f}`.toLowerCase(),capturable:!1,capturableReason:"This Canvas node type is not capturable."}}),s={text:0,file:1,other:2};return o.sort((a,l)=>{let c=s[a.type]-s[l.type];return c!==0?c:a.title.localeCompare(l.title)})}catch{return[]}}qt();function _u(r){return/\{\{[^}]*\}\}/.test(r)}ml();Fo();Wt();Tt();var aJ=["noteContent","captureTarget","fileName","lineTarget"],lJ=["captureTarget","fileName"],Ci=aJ,XU=3;function Je(r,e,t=r.endsWith(":}}")?2:0){return{insert:r,description:e,caretOffset:t}}var cJ=[{regex:Y2,contexts:Ci,suggestion:Je("{{VALUE}}","Asks you for text when the choice runs")},{regex:K2,contexts:Ci,suggestion:Je("{{VALUE:}}","Asks once and reuses the answer by name, or lists options to pick from"),expansions:()=>[Je("{{VALUE:title}}",'Asks once, then reuses the answer as "title"'),Je("{{VALUE:option1,option2,option3}}","Asks you to pick one of these options"),Je("{{VALUE:option1,option2,option3|custom}}","Same, but you can also type your own"),Je("{{VALUE:title|label:Note title}}","Words the prompt yourself"),Je("{{VALUE:option1,option2|label:Pick one}}","A list with your own prompt text"),Je("{{VALUE:title|label:Note title|default:Untitled}}","Opens the prompt with an answer already filled in"),Je("{{VALUE:<items>|text:<display items>}}","Shows one label in the list and inserts another"),Je("{{VALUE:option1,option2|name:category}}","Names the pick, so {{VALUE:category}} reuses it"),Je("{{VALUE:title|case:kebab}}","Reshapes the answer; type |case: for every style"),Je("{{VALUE:title|trim}}","Trims whitespace off the answer"),Je("{{VALUE:title|optional}}","Lets the prompt be skipped, leaving it empty")]},{regex:G2,contexts:Ci,suggestion:Je("{{NAME}}","Another name for {{VALUE}}; they do the same thing")},{regex:Q2,contexts:Ci,suggestion:Je("{{VDATE:}}",'Asks you for a date; "tomorrow" works'),expansions:()=>[Je("{{VDATE:date,YYYY-MM-DD}}",'Asks for a date, reused by name as "date"'),Je("{{VDATE:date,YYYY-MM-DD|today}}","Same, with today filled in"),Je("{{VDATE:dueDate,YYYY-MM-DD|next monday}}","Same, starting at next Monday"),Je("{{VDATE:dueDate,YYYY-MM-DD|optional}}","Same, but skippable")]},{regex:rB,contexts:Ci,suggestion:Je("{{FIELD:}}","Suggests values a property already has in your vault, like {{FIELD:project}}")},{regex:tB,contexts:Ci,suggestion:Je("{{FILE:}}","Picks a note from a folder"),expansions:({context:r})=>{let e=[Je("{{FILE:<folder>}}","Picks a note from that folder and inserts its name")];return lJ.includes(r)||e.push(Je("{{FILE:<folder>|link}}","Same, but inserts a link to the note"),Je("{{FILE:<folder>|path}}","Same, but inserts its full path"),Je("{{FILE:<folder>|optional}}","Same, but skippable")),e.push(Je("{{FILE:<folder>|custom}}","Same, but you can also type a name that is not there yet")),e}},{regex:oB,contexts:Ci,suggestion:Je("{{MVALUE}}","Asks you for a math formula (LaTeX), with a live preview")},{regex:H2,contexts:Ci,suggestion:Je("{{DATE}}","Today's date, as YYYY-MM-DD")},{regex:j2,contexts:Ci,suggestion:Je("{{DATE:}}","Today's date in a format you choose, like {{DATE:MMMM Do}}"),expansions:({formatDate:r})=>[...["YYYY-MM-DD","MMMM Do, YYYY","ddd D MMM","gggg-[W]ww"].map(e=>Je(`{{DATE:${e}}}`,r(e))),Je("{{DATE+7}}","Seven days from today"),Je("{{DATE:YYYY-MM-DD|startof:week}}","Snapped to the start of the week, month, quarter or year")]},{regex:dB,contexts:Ci,suggestion:Je("{{TIME}}","The current time, as HH:mm")},{regex:pB,contexts:Ci,suggestion:Je("{{TIME:}}","The current time in a format you choose, like {{TIME:HH.mm}}")},{regex:X2,contexts:["noteContent","lineTarget"],suggestion:Je("{{LINKCURRENT}}","A link to that note: [[That note]]")},{regex:Z2,contexts:["noteContent","lineTarget"],suggestion:Je("{{LINKSECTION}}","A link to the section your cursor is in")},{regex:J2,contexts:["noteContent","captureTarget","fileName","lineTarget"],suggestion:Je("{{FILENAMECURRENT}}","That note's file name")},{regex:y0,contexts:["noteContent","captureTarget"],suggestion:Je("{{FOLDERCURRENT}}","That note's folder")},{regex:y0,contexts:["fileName"],suggestion:Je("{{FOLDERCURRENT|name}}","That note's folder name, without the path")},{regex:aB,contexts:Ci,suggestion:Je("{{SELECTED}}","The text you had selected in the editor")},{regex:sB,contexts:["noteContent","lineTarget"],suggestion:Je("{{TITLE}}","The new note's file name")},{regex:eB,contexts:["fileName"],suggestion:Je("{{FOLDER|name}}","The name of the folder the new note lands in")},{regex:lB,contexts:Ci,suggestion:Je("{{CLIPBOARD}}","Whatever you copied last")},{regex:nB,contexts:Ci,suggestion:Je("{{TEMPLATE:}}","The contents of a template file"),expansions:({templatePaths:r})=>r.map(e=>Je(`{{TEMPLATE:${e}}}`,"Inserts this template's contents"))},{regex:iB,contexts:Ci,suggestion:Je("{{MACRO:}}","Whatever a macro returns"),expansions:({macroNames:r})=>[...r.map(e=>Je(`{{MACRO:${e}}}`,`Runs your "${e}" macro`)),Je("{{MACRO:MyMacro|label:Label}}","Word the macro's own prompt yourself")]},{regex:uB,contexts:Ci,suggestion:Je("{{GLOBAL_VAR:}}","A snippet you defined in QuickAdd's settings"),expansions:({globalVariableNames:r})=>r.map(e=>Je(`{{GLOBAL_VAR:${e}}}`,`Inserts your "${e}" snippet`))},{regex:cB,contexts:Ci,suggestion:Je("{{RANDOM:}}","A random ID of the length you give, like {{RANDOM:6}}")}],ZU=[{insert:"kebab",description:"my-note-title",caretOffset:0,isFragment:!0},{insert:"snake",description:"my_note_title",caretOffset:0,isFragment:!0},{insert:"camel",description:"myNoteTitle",caretOffset:0,isFragment:!0},{insert:"pascal",description:"MyNoteTitle",caretOffset:0,isFragment:!0},{insert:"title",description:"My Note Title",caretOffset:0,isFragment:!0},{insert:"lower",description:"my note title",caretOffset:0,isFragment:!0},{insert:"upper",description:"MY NOTE TITLE",caretOffset:0,isFragment:!0},{insert:"slug",description:"my-note-title, guarded against reserved file names",caretOffset:0,isFragment:!0}];function JU(r){return cJ.filter(e=>e.contexts.includes(r))}var uJ=/^\{\{(?:VALUE|NAME)[^\n\r}]*\|case:([a-z-]*)$/i,dJ=/<[^<>\n\r]+>/,Hi=class extends hn{constructor(t,n,i,o="noteContent"){super(t,n);this.app=t;this.inputEl=n;this.plugin=i;this.context=o;this.replaceFrom=0;this.matchedQuery="";this.macroNames=Un(this.plugin.settings.choices).filter(s=>s.type==="Macro").map(s=>s.name),this.templatePaths=this.plugin.getTemplateFiles().map(s=>s.path)}getSuggestions(t){if(this.inputEl.selectionStart===null)return[];let n=this.inputEl.selectionStart,i=t.lastIndexOf("{{",n-1);if(i===-1)return[];let o=t.slice(i,n);if(o.includes("}}"))return[];let s=o.match(uJ);if(s){let m=s[1]??"";this.matchedQuery=m,this.replaceFrom=n-m.length;let v=m.toLowerCase();return ZU.filter(g=>g.insert.startsWith(v)).map(g=>({...g}))}if(o.includes(":"))return[];let a=[],l=new Set,c=m=>{l.has(m.insert)||(l.add(m.insert),a.push(m))};this.replaceFrom=i,this.matchedQuery=o.slice(2);let u=JU(this.context).filter(m=>{let v=m.regex.exec(o);return v!==null&&v.index+v[0].length===o.length}),d=this.matchedQuery.toLowerCase(),f=m=>m.suggestion.insert.slice(2).toLowerCase().startsWith(d),p=[...u.filter(f),...u.filter(m=>!f(m))];for(let m of p)if(c(m.suggestion),!!m.expansions&&!(this.matchedQuery.length<XU))for(let v of m.expansions({templatePaths:this.templatePaths,macroNames:this.macroNames,globalVariableNames:Object.keys(this.plugin?.settings?.globalVariables??{}),context:this.context,formatDate:g=>typeof window.moment=="function"?window.moment().format(g):g}))c(v);return a}selectSuggestion(t){if(this.inputEl.selectionStart===null)return;let n=this.inputEl.selectionStart,i=this.replaceFrom;o_(this.inputEl,i,n,t.insert,{fromCompletion:!0});let o=dJ.exec(t.insert);if(o){let s=i+o.index;this.inputEl.setSelectionRange(s,s+o[0].length)}else if(t.caretOffset>0){let s=i+t.insert.length-t.caretOffset;this.inputEl.setSelectionRange(s,s)}this.close()}renderSuggestion(t,n){if(!t)return;n.classList.add("qa-format-suggestion");let i=n.ownerDocument.createElement("span");i.className=t.isFragment?"qa-format-suggestion-token qa-format-suggestion-token-fragment":"qa-format-suggestion-token",this.renderMatch(i,t.insert,this.matchedQuery),n.appendChild(i);let o=n.ownerDocument.createElement("span");o.className="qa-format-suggestion-description",o.textContent=t.description,n.appendChild(o)}};var pJ=W('<label class="setting-item-name"> </label>'),fJ=W('<div class="setting-item-name"> </div>'),mJ=W('<div class="setting-item-description"> </div>'),hJ=W('<div><div class="setting-item-info"><!> <!></div> <div class="setting-item-control"><!></div></div>');function $e(r,e){let t=he(e,"name",3,void 0),n=he(e,"desc",3,void 0),i=he(e,"heading",3,!1),o=he(e,"labelFor",3,void 0),s=he(e,"control",3,void 0),a=he(e,"children",3,void 0);var l=hJ();let c;var u=I(l),d=I(u);{var f=y=>{var w=dn(),x=Pe(w);{var C=E=>{var D=pJ(),P=I(D,!0);S(D),de(()=>{ke(D,"for",o()),me(P,t())}),$(E,D)},_=E=>{var D=fJ(),P=I(D,!0);S(D),de(()=>me(P,t())),$(E,D)};ne(x,E=>{o()?E(C):E(_,-1)})}$(y,w)};ne(d,y=>{t()&&y(f)})}var p=A(d,2);{var m=y=>{var w=mJ(),x=I(w,!0);S(w),de(()=>me(x,n())),$(y,w)};ne(p,y=>{n()&&y(m)})}S(u);var v=A(u,2),g=I(v);Fv(g,()=>s()??a()??Vt),S(v),S(l),de(()=>c=Ct(l,1,"setting-item",null,c,{"setting-item-heading":i()})),$(r,l)}var gJ=W('<div role="switch"><input type="checkbox" tabindex="-1" aria-hidden="true" class="svelte-1bigjf0"/></div>'),vJ={hash:"svelte-1bigjf0",code:`
|
||
/* Let clicks fall through to the container so a single handler owns toggling. */.checkbox-container.svelte-1bigjf0 > input:where(.svelte-1bigjf0) {pointer-events:none;}`};function lr(r,e){we(e,!0),ot(r,vJ);let t=he(e,"checked",15),n=he(e,"disabled",3,!1),i=he(e,"ariaLabel",3,void 0),o=he(e,"onchange",3,void 0),s=N(()=>t()??!1);function a(){n()||(t(!h(s)),o()?.(t()))}function l(f){(f.key==="Enter"||f.key===" ")&&(f.preventDefault(),a())}var c=gJ();let u;var d=I(c);gr(d),S(c),de(()=>{u=Ct(c,1,"checkbox-container svelte-1bigjf0",null,u,{"is-enabled":h(s),"is-disabled":n()}),ke(c,"aria-checked",h(s)),ke(c,"aria-label",i()),ke(c,"tabindex",n()?-1:0),qd(d,h(s))}),De("click",c,a),De("keydown",c,l),$(r,c),Ce()}Et(["click","keydown"]);var yJ=W("<option> </option>"),bJ=W('<select class="dropdown"></select>');function Jt(r,e){we(e,!0);let t=he(e,"value",15,""),n=he(e,"disabled",3,!1),i=he(e,"ariaLabel",3,void 0),o=he(e,"onchange",3,void 0);var s=bJ();ar(s,21,()=>e.options,a=>a.value,(a,l)=>{var c=yJ(),u=I(c,!0);S(c);var d={};de(()=>{me(u,h(l).label),d!==(d=h(l).value)&&(c.value=(c.__value=h(l).value)??"")}),$(a,c)}),S(s),de(()=>{s.disabled=n(),ke(s,"aria-label",i())}),De("change",s,()=>o()?.(t())),e0(s,t),$(r,s),Ce()}Et(["change"]);Hs();Me();Cr();function km(r){return r==="Multi"?"folder":"choice"}function CV(r){return r==="Multi"?"Folder":"Choice"}function yee(r){return`${CV(r)} name`}async function E_(r,e,t){try{let i=(await Sr.Prompt(r,yee(t),void 0,e)).trim();return!i||i===e?null:i}catch(n){return Dt(n)||F.logError(Yd(n,"Could not rename")),null}}var bee=W('<h2 class="choiceNameHeader"><button type="button" class="choiceNameHeaderButton qa-rename-title-button"><span class="choiceNameHeaderText"> </span> <span class="choiceNameHeaderIcon" aria-hidden="true"><!></span></button></h2>');function hy(r,e){we(e,!0);let t=he(e,"name",15);async function n(){let u=await E_(e.app,t());u&&t(u)}var i=bee(),o=I(i),s=I(o),a=I(s,!0);S(s);var l=A(s,2),c=I(l);Rt(c,{iconId:"pencil",size:16}),S(l),S(o),S(i),de(()=>{ke(o,"aria-label",`Rename ${t()}`),me(a,t())}),De("click",o,n),$(r,i),Ce()}Et(["click"]);ml();Fo();var ii=class extends hn{constructor(t,n,i,o=1/0){super(t,n);this.app=t;this.inputEl=n;this.items=i;this.maxSuggestions=o;this.items=i.map(s=>mn(s))}getSuggestions(t){let n=wc(t).toLowerCase(),i=this.items.filter(s=>s.toLowerCase().includes(n));return i.length===0&&this.close(),i.slice(0,this.maxSuggestions)}selectSuggestion(t){this.inputEl.value=t,this.inputEl.trigger("input"),this.close()}renderSuggestion(t,n){if(!t)return;let i=cy(t),o=cy(this.getCurrentQuery());t.toLowerCase().endsWith(".md")&&o.toLowerCase().startsWith(`${i.toLowerCase()}.`)&&(o=i),this.renderMatch(n,i,o)}getCurrentQuery(){return this.inputEl.value}};function wee(r){return r?Array.isArray(r)?r:[r]:[]}function hp(r,e){let t=wee(e(r));return{destroy(){t.forEach(n=>n.destroy())}}}var Cee=W("<textarea></textarea>"),xee=W('<input type="text"/>'),Eee=W('<!> <div aria-live="polite"> </div>',1);function xi(r,e){we(e,!0);let t=he(e,"value",15,""),n=he(e,"placeholder",3,void 0),i=he(e,"inputKind",3,"text"),o=he(e,"required",3,!1),s=he(e,"requiredMessage",3,"This field is required"),a=he(e,"disabled",3,!1),l=he(e,"validator",3,void 0),c=he(e,"trim",3,!0),u=he(e,"suggestions",3,void 0),d=he(e,"maxSuggestions",3,1/0),f=he(e,"makeSuggesters",19,()=>[]),p=he(e,"app",3,void 0),m=he(e,"id",3,void 0),v=he(e,"ariaLabel",3,void 0),g=he(e,"onChange",3,void 0),y=Ae(!1),w=Ae(""),x=Ae("neutral"),C=0,_=!1,E=`qa-hint-${Math.random().toString(36).slice(2)}`,D=Y=>c()?Y.trim():Y;function P(Y,K=!1,se="neutral"){Z(y,K,!0),Z(w,Y??"",!0),Z(x,K?"neutral":se,!0)}async function H(Y){if(o()&&D(Y).length===0)return P(s(),!0),!1;if(!l())return P(void 0),!0;let K=++C,se=await Promise.resolve(l()(Y));return K!==C||_?!0:typeof se=="boolean"?(P(se?void 0:"Invalid value",!se),se):typeof se=="string"?(P(se,!0),!1):(P(se.message??(se.valid?void 0:"Invalid value"),!se.valid,se.valid?se.variant??"neutral":"neutral"),se.valid)}function V(Y){let K=Y.currentTarget.value;t(K),g()?.(K)}hr(()=>{o();let Y=t();H(Y)}),hr(()=>()=>{_=!0});function oe(Y){let K=[];p()&&u()&&u().length&&K.push(new ii(p(),Y,u(),d()));for(let se of f()){let pe=se(Y);pe&&K.push(pe)}return K}var ce=Eee(),R=Pe(ce);{var O=Y=>{var K=Cee();Ad(K);let se;Fr(K,(pe,ge)=>hp?.(pe,ge),()=>oe),de(()=>{se=Ct(K,1,"qa-validated-input-full-width qa-validated-input-margin-8 qa-validated-input-textarea",null,se,{"is-invalid":h(y),"is-valid":!h(y)&&h(x)==="success"&&h(w).length>0}),ke(K,"id",m()),ke(K,"placeholder",n()),K.disabled=a(),ke(K,"aria-label",v()),ke(K,"aria-invalid",h(y)),ke(K,"aria-describedby",E),Fs(K,t())}),De("input",K,V),$(Y,K)},q=Y=>{var K=xee();gr(K);let se;Fr(K,(pe,ge)=>hp?.(pe,ge),()=>oe),de(()=>{se=Ct(K,1,"qa-validated-input-full-width qa-validated-input-margin-8",null,se,{"is-invalid":h(y),"is-valid":!h(y)&&h(x)==="success"&&h(w).length>0}),ke(K,"id",m()),ke(K,"placeholder",n()),K.disabled=a(),ke(K,"aria-label",v()),ke(K,"aria-invalid",h(y)),ke(K,"aria-describedby",E),Fs(K,t())}),De("input",K,V),$(Y,K)};ne(R,Y=>{i()==="textarea"?Y(O):Y(q,-1)})}var B=A(R,2);let ie;var j=I(B,!0);S(B),de(()=>{ie=Ct(B,1,"qa-field-hint",null,ie,{"qa-field-hint--neutral":!h(y)&&h(x)==="neutral","qa-field-hint--success":!h(y)&&h(x)==="success"}),ke(B,"id",E),me(j,h(w))}),$(r,ce),Ce()}Et(["input"]);var Tee=W('<div class="qa-field-body"><!></div>'),_ee=W('<div class="qa-field"><!> <!></div>');function ss(r,e){let t=Dv(),n=he(e,"desc",3,void 0),i=he(e,"control",3,void 0),o=he(e,"bodyVisible",3,!0);var s=_ee(),a=I(s);{let u=N(()=>o()?t:void 0);$e(a,{get name(){return e.name},get desc(){return n()},get control(){return i()},get labelFor(){return h(u)}})}var l=A(a,2);{var c=u=>{var d=Tee(),f=I(d);Fv(f,()=>e.children,()=>t),S(d),$(u,d)};ne(l,u=>{o()&&u(c)})}S(s),$(r,s)}$m();Cr();var Nu=class{constructor(){this.entries=[];this.seen=new Set}add(e,t,n){let i=xte(t).trim();if(!i)return;let o=`${e} ${i}`;this.seen.has(o)||(this.seen.add(o),this.entries.push({severity:e,message:i,...n?{kind:n}:{}}))}list(){return this.entries}get hasError(){return this.entries.some(e=>e.severity==="error")}};function xte(r){return r.replace(/^\[(QuickAdd:[\s\S]*)\]$/i,"$1").replace(/^QuickAdd:\s*/i,"")}function Om(r){if(Dt(r))return null;if(!(r instanceof Error))return iq;let e=r.message??"";return Dt(e)?null:e.startsWith("Unable to parse variable")?"This token is incomplete. {{VALUE:}} needs a name, for example {{VALUE:title}}.":e.trim()?e:iq}var iq="Preview unavailable - this format could not be resolved.";UT();Tt();uh();_l();var Wae={title:"My Document Title",name:"Document Name",project:"Project Alpha",category:"Notes",author:"Your Name",status:"Draft",priority:"High",tag:"important",type:"meeting",client:"Acme Corp"},zae={clipboard:"clipboard_content",date:"formatted_date",time:"current_time",random:"random_value",uuid:"unique_id"},Hae=[{pattern:/date|time/i,example:"2024-01-15"},{pattern:/title|name/i,example:"Example Title"},{pattern:/tag/i,example:"important"},{pattern:/category|type/i,example:"Notes"},{pattern:/author|user/i,example:"Your Name"},{pattern:/project/i,example:"Project Alpha"},{pattern:/status/i,example:"In Progress"},{pattern:/priority/i,example:"High"},{pattern:/number|count|id/i,example:"001"}];function SA(r){let e=r.toLowerCase(),t=Wae[e];return t||`${r}_example`}function DA(r){return zae[r.toLowerCase()]||`${r}_output`}function IA(r){for(let{pattern:e,example:t}of Hae)if(e.test(r))return t;return`${r}_value`}function PA(r){return r.length>0?`${r[0]} (${r.length} options)`:"suggestion_list"}function dh(r,e){return Vp(r).length>0?e:r}function FA(r){let e=r.fieldName.trim();return e?`${e}_field_value`:"field_value"}function MA(r){return r?.path?r.basename:"current_file"}function ph(r){return`${r?.path?r.basename:"current_file"}#Section`}function RA(r){return r?.basename||"current_filename"}function $A(r){if(!r)return"current_folder";let e=r.parent?.path??"";return e==="/"?"":e}var Al=class{static generate(e,t=new Date){let n=t.getFullYear(),i=this.getWeekNumber(t),o=[["YYYY",n.toString()],["YY",n.toString().slice(-2)],["MMMM",this.MONTH_NAMES[t.getMonth()]],["MMM",this.MONTH_NAMES_SHORT[t.getMonth()]],["MM",(t.getMonth()+1).toString().padStart(2,"0")],["M",(t.getMonth()+1).toString()],["dddd",this.DAY_NAMES[t.getDay()]],["ddd",this.DAY_NAMES_SHORT[t.getDay()]],["DD",t.getDate().toString().padStart(2,"0")],["D",t.getDate().toString()],["HH",t.getHours().toString().padStart(2,"0")],["H",t.getHours().toString()],["mm",t.getMinutes().toString().padStart(2,"0")],["m",t.getMinutes().toString()],["ss",t.getSeconds().toString().padStart(2,"0")],["s",t.getSeconds().toString()],["ww",i.toString().padStart(2,"0")],["w",i.toString()]],s="",a=0;for(;a<e.length;){let l=!1;for(let[c,u]of o)if(e.startsWith(c,a)){s+=u,a+=c.length,l=!0;break}l||(s+=e[a],a+=1)}return s}static getWeekNumber(e){let t=new Date(e.getFullYear(),0,1),n=(e.getTime()-t.getTime())/864e5;return Math.ceil((n+t.getDay()+1)/7)}};Al.MONTH_NAMES=["January","February","March","April","May","June","July","August","September","October","November","December"],Al.MONTH_NAMES_SHORT=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],Al.DAY_NAMES=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],Al.DAY_NAMES_SHORT=["Sun","Mon","Tue","Wed","Thu","Fri","Sat"];yl();Py();ey();function OA(r){let e=new Date;return r?am(window.moment(e),r).toDate():e}ip();js();var fh=class extends bl{constructor(t,n,i,o={}){super(t);this.plugin=n;this.opts=o;this.diagnostics=new Nu;this.dateParser=i||Tl}warn(t){this.diagnostics.add("warning",t)}reportProblem(t){this.diagnostics.add("error",t)}async format(t){this.diagnostics=new Nu;try{return await this.formatInternal(t,{expandLinebreakEscapes:!0})}catch(n){let i=Om(n);return i&&this.diagnostics.add("error",i),t}}async formatInternal(t,{expandLinebreakEscapes:n}){let i=t;return i=await this.replaceGlobalVarInString(i),n&&(i=this.expandLinebreakEscapesOutsideTokens(i)),i=this.replaceDateInString(i),i=this.replaceTimeInString(i),i=await this.replaceValueInString(i),i=await this.replaceSelectedInString(i),i=await this.replaceClipboardInString(i),i=await this.replaceDateVariableInString(i),i=await this.replaceVariableInString(i),i=this.replaceCurrentFileTokensInString(i,{links:!0,fileName:!0,folder:!0,...this.opts.resolveActiveFolder===!1?{}:{activeFolder:"content"}}),i=await this.replaceMacrosInString(i),i=await this.replaceTemplateInString(i),i=await this.replaceFieldVarInString(i),i=await this.replaceFileInString(i),i=await this.replaceMathValueInString(i),i=this.replaceRandomInString(i),i}async replaceGlobalVarInString(t){let n=t,i=0,o=new RegExp(fl.source,"gi");for(;o.test(n)&&!(++i>5);)n=n.replace(o,(s,a)=>{let l=String(a??"").trim();if(!l)return s;let c=this.plugin?.settings?.globalVariables?.[l];return typeof c=="string"?c:""});return n}promptForValue(t){return t||"user input"}getVariableValue(t){let n=this.variables.get(t);if(typeof n=="string")return n;let i=ky(t);return SA(i)}getCurrentFileLink(){return this.app?MA(this.app.workspace.getActiveFile()):null}getCurrentFileLinkToSection(){return this.app?ph(this.app.workspace.getActiveFile()):ph(null)}getCurrentFileName(){return this.app?RA(this.app.workspace.getActiveFile()):"current_filename"}getCurrentFolderPath(){return this.app?$A(this.app.workspace.getActiveFile()):"current_folder"}suggestForValue(t,n=!1,i){return PA(i?.displayValues??t)}getMacroValue(t,n){return DA(t)}promptForMathValue(){return Promise.resolve("calculation_result")}promptForVariable(t,n){return Promise.resolve(IA(t))}async getTemplateContent(t){let n=this.app;if(!n)return this.reportProblem(`Template preview unavailable: ${t}`),`[QuickAdd: template preview unavailable] ${t}`;let i=fo(n,t);if(!i)return this.reportProblem(`Template not found: ${t}`),`[QuickAdd: template not found] ${t}`;this.templateInclusion??(this.templateInclusion={visited:new Set,depth:0}),this.templateInclusion.depth++;try{return await this.formatInternal(await n.vault.cachedRead(i),{expandLinebreakEscapes:!1})}catch(o){let s=Om(o);return s&&this.diagnostics.add("error",s),`[QuickAdd: template preview failed] ${t}`}finally{this.templateInclusion.depth--}}async getSelectedText(){return"selected_text"}async getClipboardContent(){return"clipboard_content"}async suggestForField(t,n){return Promise.resolve(FA(n))}suggestForFile(t){let n=this.app?zi.filterFiles(this.app.vault.getMarkdownFiles(),t.filter,i=>this.app.metadataCache.getFileCache(i)):[];return n.length>0?`${vl}${n[0].path}`:`${as}${t.folderPath||"file"}`}async replaceDateVariableInString(t){let n=t;return n=n.replace(new RegExp(gu.source,"gi"),(i,o,s,a)=>{let l=o?.trim(),{options:c,error:u}=G_(a);u&&this.reportProblem(u);let{defaultValue:d,optional:f,withTime:p,snap:m}=c,v=s?.trim()||My(p);if(!l)return i;let g=Ry(this.variables.get(l),v,m,this.dateParser);if(g)return g.text;let y;try{y=Al.generate(v,OA(m))}catch{y=`[${v} format]`}return d&&(y+=` (default: ${d})`),f&&(y+=" (optional)"),y}),n}replaceRandomInString(t){let n=t;return n=n.replace(/{{RANDOM:(\d+)}}/gi,(i,o)=>{let s=parseInt(o);if(s<=0||s>100)return i;let a="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",l="";for(let c=0;c<Math.min(s,8);c++)l+=a.charAt(Math.floor(Math.random()*a.length));return s>8&&(l+=`... (${s} chars)`),l}),n}isTemplatePropertyTypesEnabled(){return!1}};$m();Py();var mh=require("obsidian");Tt();uh();_l();UT();yl();ip();js();var Cj=25;function jae(r){let e=r.lastIndexOf("{{");return e===-1?!1:r.indexOf("}}",e+2)===-1}function Gae(r){let e=Fy(r);if(e.length===0)return r;let t="",n=0;for(let i of e)t+=r.slice(n,i.start),n=i.end;return t+r.slice(n)}var hh=class extends bl{constructor(t,n,i){super(t);this.plugin=n;this.diagnostics=new Nu;this.templateIncludeBudget=Cj;this.dateParser=i||Tl}warn(t){this.diagnostics.add("warning",t)}reportProblem(t){this.diagnostics.add("error",t)}async format(t){let n=t;this.diagnostics=new Nu,this.templateIncludeBudget=Cj;try{n=await this.formatInternal(t,{included:!1})}catch(o){let s=Om(o);return s&&this.diagnostics.add("error",s),t}this.reportCircularTitle(t,n);let i=bj(n);for(let o of i.problems)this.diagnostics.add("error",o,"path");return this.reportIllegalChars(t,n),i.path}reportCircularTitle(t,n){!Os.test(t)&&!Os.test(n)||this.reportProblem("A file name cannot contain {{title}}, because the title is derived from the file name itself - so this choice would fail at run time.")}reportIllegalChars(t,n){if(this.diagnostics.hasError||jae(t)||nq(t))return;let i=Vp(Gae(n));i.length!==0&&(this.existsInVault(n)||this.diagnostics.add("error",hj(i),"path"))}existsInVault(t){let n=this.app?.vault;if(typeof n?.getAbstractFileByPath!="function")return!1;let i=t.trim();return i?i.endsWith("/")?n.getAbstractFileByPath(i.slice(0,-1))instanceof mh.TFolder:n.getAbstractFileByPath(i)instanceof mh.TFile||n.getAbstractFileByPath(`${i}.md`)instanceof mh.TFile?!0:n.getAbstractFileByPath(i)instanceof mh.TFolder:!1}async formatInternal(t,{included:n}){let i=t;return i=await this.replaceTemplateOutsideScripts(i),i=await this.replaceGlobalVarInString(i),i=await this.replaceMacrosInString(i),i=this.replaceDateInString(i),i=this.replaceTimeInString(i),i=await this.replaceValueInString(i),i=await this.replaceSelectedInString(i),i=await this.replaceClipboardInString(i),i=await this.replaceDateVariableInString(i),i=await this.replaceVariableInString(i),i=await this.replaceFieldVarInString(i),i=await this.replaceFileInString(i),i=await this.replaceMathValueInString(i),i=this.replaceCurrentFileTokensInString(i,n?{links:!0,fileName:!0,folder:!0,activeFolder:"content"}:{fileName:!0,folder:!0,activeFolder:"path"}),i=this.replaceRandomInString(i),i}async replaceGlobalVarInString(t){let n=t,i=0,o=new RegExp(fl.source,"gi");for(;o.test(n)&&!(++i>5);)n=n.replace(o,(s,a)=>{let l=String(a??"").trim();if(!l)return s;let c=this.plugin?.settings?.globalVariables?.[l];return typeof c=="string"?c:""});return n}promptForValue(t){return dh(t||"user input","user input")}getVariableValue(t){let n=this.variables.get(t);if(typeof n=="string")return n;let i=ky(t);return dh(SA(i),"user input")}getCurrentFileLink(){return this.app?MA(this.app.workspace.getActiveFile()):null}getCurrentFileName(){return this.app?RA(this.app.workspace.getActiveFile()):"current_filename"}getCurrentFolderPath(){return this.app?$A(this.app.workspace.getActiveFile()):"current_folder"}suggestForValue(t,n=!1,i){return t[0]??PA(t)}promptForMathValue(){return Promise.resolve("calculation_result")}getMacroValue(t,n){return dh(DA(t),"macro_output")}async promptForVariable(t,n){return dh(IA(t),"user input")}async replaceTemplateOutsideScripts(t){let n=Fy(t);if(n.length===0)return this.replaceTemplateInString(t);let i="",o=0;for(let s of n)i+=await this.replaceTemplateInString(t.slice(o,s.start)),i+=t.slice(s.start,s.end),o=s.end;return i+await this.replaceTemplateInString(t.slice(o))}async getTemplateContent(t){let n=this.app;if(!n)return this.reportProblem(`Template preview unavailable: ${t}`),`[QuickAdd: template preview unavailable] ${t}`;if(this.templateIncludeBudget<=0){let o="[QuickAdd: too many template includes to preview]";return this.reportProblem(o),o}let i=fo(n,t);if(!i)return this.reportProblem(`Template not found: ${t}`),`[QuickAdd: template not found] ${t}`;this.templateIncludeBudget--,this.templateInclusion??(this.templateInclusion={visited:new Set,depth:0}),this.templateInclusion.depth++;try{let o=await n.vault.cachedRead(i),s=this.resolveTitleInIncludedBody(await this.formatInternal(o,{included:!0}));return this.warnIfJoinedIntoOneLine(t,s),s}catch(o){let s=Om(o);return s&&this.diagnostics.add("error",s),`[QuickAdd: template preview failed] ${t}`}finally{this.templateInclusion.depth--}}resolveTitleInIncludedBody(t){if(!Os.test(t))return t;let n=this.variables.get("title"),i=typeof n=="string"?n:"";return t.replace(new RegExp(Os.source,"gi"),()=>i)}warnIfJoinedIntoOneLine(t,n){let i=n.split(/\r?\n/).filter(o=>o.trim());i.length<2||this.warn(`Template "${t}" is ${i.length} lines; a file name is one line, so they are joined with spaces.`)}getCurrentFileLinkToSection(){return this.app?ph(this.app.workspace.getActiveFile()):ph(null)}async getSelectedText(){return"selected_text"}async getClipboardContent(){return"clipboard_content"}async suggestForField(t,n){return dh(FA(n),"field_value")}suggestForFile(t){let n=this.app?zi.filterFiles(this.app.vault.getMarkdownFiles(),t.filter,i=>this.app.metadataCache.getFileCache(i)):[];return n.length>0?`${vl}${n[0].path}`:`${as}${t.folderPath||"file"}`}async replaceDateVariableInString(t){let n=t;return n=n.replace(new RegExp(gu.source,"gi"),(i,o,s,a)=>{let l=o?.trim();if(!l)return i;let{options:c,error:u}=G_(a);u&&this.reportProblem(u);let{withTime:d,snap:f}=c,p=s?.trim()||My(d),m=Ry(this.variables.get(l),p,f,this.dateParser);if(m)return m.text;try{return Al.generate(p,OA(f))}catch{return`[${p}]`}}),n}replaceRandomInString(t){let n=t;return n=n.replace(/{{RANDOM:(\d+)}}/gi,(i,o)=>{let s=parseInt(o);if(s<=0||s>100)return i;let a="ABC123",l="";for(let c=0;c<Math.min(s,6);c++)l+=a.charAt(c%a.length);return s>6&&(l+="..."),l}),n}isTemplatePropertyTypesEnabled(){return!1}};var Yae=W('<div><span class="qa-visually-hidden"> </span> </div>'),Kae=W('<div class="qa-preview-issues"></div>'),Qae=W('<div><span class="qa-preview-label"> </span><span class="qa-preview-value" aria-live="polite"> </span></div> <!>',1);function hs(r,e){we(e,!0);let t=he(e,"formatterKind",3,"format"),n=500,i=Ae(""),o=Ae(wt([])),s=Ae(!1),a=0,l=N(()=>e.value.trim().length>0),c=N(()=>e.hideWhen?e.hideWhen(h(i))&&!h(o).some(g=>g.severity==="error"&&g.kind!=="path"):!1),u=N(()=>h(s)?h(o).filter(g=>g.severity==="error"):[]),d=N(()=>h(u).some(g=>g.kind!=="path")),f=N(()=>!h(d)&&h(u).length>0);hr(()=>{let g=e.value;if(!g.trim()){a++,Z(i,""),Z(o,[],!0);return}let y=t()==="fileName"?new hh(e.app,e.plugin):new fh(e.app,e.plugin,void 0,{resolveActiveFolder:t()!=="lineTarget"});y.setTargetFolderPath(e.targetFolderPath===null?null:e.targetFolderPath?.trim()?e.targetFolderPath:"Folder/Name");let w=++a;(async()=>{try{let x=await y.format(g);if(w!==a)return;Z(i,x,!0),Z(o,y.diagnostics.list(),!0)}catch{if(w!==a)return;Z(i,g,!0),Z(o,[{severity:"error",message:"Preview unavailable."}],!0)}})()}),hr(()=>{e.value,Z(s,!1);let g=setTimeout(()=>{Z(s,!0)},n);return()=>clearTimeout(g)});var p=dn(),m=Pe(p);{var v=g=>{var y=Qae(),w=Pe(y);let x;var C=I(w),_=I(C,!0);S(C);var E=A(C),D=I(E,!0);S(E),S(w);var P=A(w,2);{var H=V=>{var oe=Kae();ar(oe,21,()=>h(o),ce=>ce.severity+ce.message,(ce,R)=>{var O=Yae();let q;var B=I(O),ie=I(B,!0);S(B);var j=A(B,1,!0);S(O),de(()=>{q=Ct(O,1,"qa-preview-issue",null,q,{"qa-preview-issue--error":h(R).severity==="error"}),ke(O,"title",h(R).message),me(ie,h(R).severity==="error"?"Error: ":"Warning: "),me(j,h(R).message)}),$(ce,O)}),S(oe),$(V,oe)};ne(P,V=>{h(s)&&h(o).length>0&&V(H)})}de(()=>{x=Ct(w,1,"qa-preview-row",null,x,{"qa-preview-row--one-line":t()==="fileName"}),ke(w,"title",t()==="fileName"?h(i):void 0),me(_,h(d)?"Unresolved: ":h(f)?"Won't be created: ":"Preview: "),me(D,h(i))}),$(g,y)};ne(m,g=>{h(l)&&!h(c)&&g(v)})}$(r,p),Ce()}pc();Me();var KC="https://quickadd.obsidian.guide",kl={gettingStarted:`${KC}/docs/`,formatSyntax:`${KC}/docs/FormatSyntax/`,onePageInputs:`${KC}/docs/Advanced/onePageInputs/`,userScripts:`${KC}/docs/Choices/MacroChoice/#user-scripts`,packages:`${KC}/docs/Choices/Packages/`};function xj(r,e){try{(e?ep(e):window).open(r,"_blank","noopener,noreferrer")}catch(t){F.logError(`QuickAdd: Failed to open documentation (${r}): ${t}`)}}function NA(r,e,t){let n=Hr(r,"a");return n.textContent=t,n.href=e,n.target="_blank",n.rel="noopener noreferrer",n.classList.add("quickadd-docs-link"),r.append(n),n}var Xae=W('<div class="qa-token-hint">Type <code>{{</code> to insert a token · <a class="quickadd-docs-link" target="_blank" rel="noopener noreferrer">Format syntax</a></div>');function qp(r,e){we(e,!0);let t=N(()=>!e.value.includes("{{"));var n=dn(),i=Pe(n);{var o=s=>{var a=Xae(),l=A(I(a),3);S(a),de(()=>ke(l,"href",kl.formatSyntax)),$(s,a)};ne(i,s=>{h(t)&&s(o)})}$(r,n),Ce()}var Ej=require("obsidian");Jd();Yv();var Zae=W('<input type="text" class="text-input" aria-label="Frontmatter property" placeholder="related" required=""/>'),FR=W("<!> <!>",1),Jae=W("<!> <!> <!> <!>",1);function QC(r,e){we(e,!0);let t=he(e,"appendLink",15),n=he(e,"app",3,void 0),i=N(()=>xu(t())),o=N(()=>h(i).linkType??"link"),s=N(()=>h(i).displayText),a=N(()=>h(i).frontmatterHandling??Xd),l=N(()=>h(i).destination.type==="specifiedFile"?h(i).destination.path:""),c=N(()=>h(i).enabled?h(i).requireActiveFile?"required":"optional":"disabled"),u=N(()=>h(i).destination.type),d=N(()=>n()?n().vault.getMarkdownFiles().map(B=>B.path):[]),f=[{value:"required",label:"Enabled (strict)"},{value:"optional",label:"Enabled (skip if unavailable)"},{value:"disabled",label:"Disabled"}],p=[{value:"activeFile",label:"Current note"},{value:"specifiedFile",label:"Specified note"}],m=[{value:"replaceSelection",label:"Replace selection"},{value:"afterSelection",label:"After selection"},{value:"endOfLine",label:"End of line"},{value:"newLine",label:"New line"},{value:"inFrontmatter",label:"In frontmatter property"}],v=[{value:"link",label:"Link"},{value:"embed",label:"Embed"}],g=[{value:"none",label:"Default"},{value:"selection",label:"Selected text"}],y=[{value:"alwaysAppend",label:"Create or convert"},{value:"createProperty",label:"Create if missing"},{value:"error",label:"Require list"}];function w(B){let ie=t(),j=typeof ie=="boolean"?h(i):ie,Y=B.placement??j.placement,K=B.destination??j.destination??h(i).destination,se=K.type==="activeFile"&&tm(Y)?B.linkType??j.linkType??h(o):"link",pe=K.type==="activeFile"&&FT(Y)&&se==="link"?B.displayText??h(s):"none";return{enabled:B.enabled??!0,placement:Y,requireActiveFile:B.requireActiveFile??j.requireActiveFile??h(i).requireActiveFile,linkType:se,displayText:pe,destination:K,frontmatterProperty:B.frontmatterProperty??j.frontmatterProperty,frontmatterHandling:B.frontmatterHandling??j.frontmatterHandling}}function x(B){switch(B){case"disabled":t(w({enabled:!1}));break;case"required":t(w({requireActiveFile:!0}));break;case"optional":t(w({requireActiveFile:!1}));break}}function C(B){t(w({placement:B}))}function _(B){t(w({linkType:B}))}function E(B){t(w({displayText:B}))}function D(B){t(w({frontmatterProperty:B.currentTarget.value}))}function P(B){t(w({frontmatterHandling:B}))}function H(B){let ie=B==="specifiedFile"?{type:"specifiedFile",path:h(l)}:{type:"activeFile"};t(w({destination:ie}))}function V(B){t(w({destination:{type:"specifiedFile",path:B.trim()}}))}function oe(B){let ie=B.trim();if(!ie)return"Destination file is required";if(!n())return!0;let j=n().vault.getAbstractFileByPath(D0(ie));return j instanceof Ej.TFile&&j.extension==="md"?!0:"Markdown file not found"}var ce=FR(),R=Pe(ce);{let B=Y=>{Jt(Y,{get value(){return h(c)},get options(){return f},onchange:x})},ie=N(()=>`Link to ${e.fileLabel} file`),j=N(()=>`Choose whether QuickAdd should insert a link to the ${e.fileLabel} file.`);$e(R,{get name(){return h(ie)},get desc(){return h(j)},control:B,$$slots:{control:!0}})}var O=A(R,2);{var q=B=>{var ie=FR(),j=Pe(ie);{let pe=be=>{Jt(be,{get value(){return h(u)},get options(){return p},onchange:H})},ge=N(()=>`Where QuickAdd writes the link to the ${e.fileLabel} file.`);$e(j,{name:"Link destination",get desc(){return h(ge)},control:pe,$$slots:{control:!0}})}var Y=A(j,2);{var K=pe=>{var ge=Jae(),be=Pe(ge);$e(be,{name:"Link placement",desc:"Where to place the link when appending",control:_e=>{Jt(_e,{get value(){return h(i).placement},get options(){return m},onchange:C})},$$slots:{control:!0}});var xe=A(be,2);{var Ue=He=>{$e(He,{name:"Link type",desc:"Choose whether to insert a link or an embed. Embeds transclude the note's contents at the placement position.",control:Be=>{Jt(Be,{get value(){return h(o)},get options(){return v},onchange:_})},$$slots:{control:!0}})},$t=N(()=>tm(h(i).placement));ne(xe,He=>{h($t)&&He(Ue)})}var Ne=A(xe,2);{var Ke=He=>{$e(He,{name:"Link display text",desc:"What the inserted link displays. 'Selected text' keeps the highlighted text as the link's display text; with nothing selected, the plain link is inserted.",control:Be=>{Jt(Be,{get value(){return h(s)},get options(){return g},onchange:E})},$$slots:{control:!0}})},Xe=N(()=>FT(h(i).placement)&&h(o)==="link");ne(Ne,He=>{h(Xe)&&He(Ke)})}var ye=A(Ne,2);{var We=He=>{var _e=FR(),Be=Pe(_e);$e(Be,{name:"Frontmatter property",desc:"Required property to insert the link into.",control:yr=>{var Pt=Zae();gr(Pt),de(Ar=>{Fs(Pt,h(i).frontmatterProperty??""),ke(Pt,"aria-invalid",Ar)},[()=>!h(i).frontmatterProperty?.trim()]),De("input",Pt,D),$(yr,Pt)},$$slots:{control:!0}});var ut=A(Be,2);$e(ut,{name:"Property handling",desc:"Choose how strict QuickAdd should be when the property is missing or not a list.",control:yr=>{Jt(yr,{get value(){return h(a)},get options(){return y},onchange:P})},$$slots:{control:!0}}),$(He,_e)},ht=N(()=>Zd(h(i).placement));ne(ye,He=>{h(ht)&&He(We)})}$(pe,ge)},se=pe=>{$e(pe,{name:"Destination file",desc:"Existing Markdown note that receives the link at the bottom.",control:be=>{xi(be,{get value(){return h(l)},placeholder:"Index.md",get app(){return n()},get suggestions(){return h(d)},maxSuggestions:50,required:!0,requiredMessage:"Destination file is required",validator:oe,ariaLabel:"Append link destination file",onChange:V})},$$slots:{control:!0}})};ne(Y,pe=>{h(u)==="activeFile"?pe(K):pe(se,-1)})}$(B,ie)};ne(O,B=>{h(c)!=="disabled"&&B(q)})}$(r,ce),Ce()}Et(["input"]);function XC(r,e){we(e,!0);let t=he(e,"openFile",15);$e(r,{name:"Open",get desc(){return e.description},control:i=>{lr(i,{get checked(){return t()},set checked(o){t(o)}})},$$slots:{control:!0}}),Ce()}var ele=W("<!> <!> <!> <!>",1);function ZC(r,e){we(e,!0);let t=he(e,"fileOpening",15);t(pn(t()));let n=[{value:"reuse",label:"Reuse current tab"},{value:"tab",label:"New tab"},{value:"split",label:"Split pane"},{value:"window",label:"New window"},{value:"left-sidebar",label:"Left sidebar"},{value:"right-sidebar",label:"Right sidebar"}],i=[{value:"vertical",label:"Split right"},{value:"horizontal",label:"Split down"}],o=[{value:"source",label:"Source"},{value:"preview",label:"Preview"},{value:"live",label:"Live Preview"},{value:"default",label:"Default"}],s=N(()=>typeof t().mode=="string"?t().mode:"default");var a=ele(),l=Pe(a);{let m=g=>{Jt(g,{get value(){return t().location},get options(){return n},onchange:y=>t(t().location=y,!0)})},v=N(()=>`Where to open the ${e.contextLabel} file`);$e(l,{name:"File opening location",get desc(){return h(v)},control:m,$$slots:{control:!0}})}var c=A(l,2);{var u=m=>{$e(m,{name:"Split direction",desc:"How to arrange the new pane relative to the current one",control:g=>{Jt(g,{get value(){return t().direction},get options(){return i},onchange:y=>t(t().direction=y,!0)})},$$slots:{control:!0}})};ne(c,m=>{t().location==="split"&&m(u)})}var d=A(c,2);$e(d,{name:"View mode",desc:"How to display the opened file",control:v=>{Jt(v,{get value(){return h(s)},get options(){return o},onchange:g=>t(t().mode=g,!0)})},$$slots:{control:!0}});var f=A(d,2);{var p=m=>{$e(m,{name:"Focus new pane",desc:"Focus the opened tab immediately after opening",control:g=>{lr(g,{get checked(){return t().focus},set checked(y){t(t().focus=y,!0)}})},$$slots:{control:!0}})};ne(f,m=>{t().location!=="reuse"&&m(p)})}$(r,a),Ce()}function JC(r,e){we(e,!0);let t=he(e,"onePageInput",15),n=[{value:"",label:"Follow global setting"},{value:"always",label:"Always"},{value:"never",label:"Never"}],i=N(()=>t()??"");function o(s){t(s==="always"||s==="never"?s:void 0)}$e(r,{name:"One-page input override",desc:"Override the global setting for this choice. 'Always' forces the one-page modal even if disabled globally; 'Never' disables it even if enabled globally.",control:a=>{Jt(a,{get value(){return h(i)},get options(){return n},onchange:o})},$$slots:{control:!0}}),Ce()}qt();var tle=new Intl.Collator(void 0,{numeric:!0,sensitivity:"base"}),rle=new Intl.Collator(void 0,{numeric:!0,sensitivity:"variant"});function LA(r){return r.trim().replace(/^\/+/,"").replace(/\/+$/,"")}function nle(r,e){let t=LA(r),n=LA(e);if(t===n)return 0;let i=t===""?[]:t.split("/"),o=n===""?[]:n.split("/"),s=Math.min(i.length,o.length);for(let a=0;a<s;a++){let l=tle.compare(i[a],o[a]);if(l!==0)return l;let c=rle.compare(i[a],o[a]);if(c!==0)return c}return i.length-o.length}function Oc(r){return[...r].sort(nle)}function ile(r,e){let t=LA(r),n=LA(e);return n?t===n||t.startsWith(`${n}/`):!0}function Tj(r,e){return r.filter(t=>e.some(n=>ile(t,n)))}var Ku=require("obsidian");var ole=W('<div class="qa-canvas-node-empty"> </div>'),sle=W('<div class="qa-canvas-node-empty">No nodes match the current filter.</div>'),ale=W('<button type="button"> </button>'),lle=W('<button type="button" disabled="">Unavailable</button>'),cle=W('<div><div class="qa-canvas-node-item-header"><span> </span> <span class="qa-canvas-node-title"> </span></div> <div class="qa-canvas-node-subtitle"> </div> <div class="qa-canvas-node-meta"><code> </code></div> <div class="qa-canvas-node-item-actions"><!> <button type="button">Copy ID</button></div></div>'),ule=W('<div class="qa-canvas-node-picker"><div class="qa-canvas-node-actions"><button type="button">Open target canvas</button> <button type="button">Use selected in open canvas</button> <button type="button">Clear</button></div> <div class="qa-canvas-node-filter"><input type="text" placeholder="Filter by card text, file path, or node id\u2026" aria-label="Filter canvas nodes"/></div> <div class="qa-canvas-node-status"> </div> <div class="qa-canvas-node-list"><!></div></div>');function MR(r,e){we(e,!0);let t=he(e,"nodeId",15),n=Ae(wt([])),i=Ae("loading"),o=Ae(""),s=Ae(""),a=N(()=>{let R=h(s).trim().toLowerCase();return R.length?h(n).filter(O=>O.searchText.includes(R)):h(n)}),l=N(()=>(t()??"").trim()),c=N(()=>h(i)==="ready"?`Showing ${h(a).length} of ${h(n).length} nodes`:h(i)==="empty"?h(o):"Loading canvas nodes\u2026");gT(()=>{(async()=>{let R=E0(e.app,e.canvasTargetPath);if(!R){Z(o,"Node picker works for direct .canvas paths that already exist in your vault. Format syntax paths cannot be listed here."),Z(i,"empty");return}if(Z(n,await CB(e.app,R),!0),h(n).length===0){Z(o,"No selectable nodes found in the target canvas."),Z(i,"empty");return}Z(i,"ready")})()});function u(R){t(R)}function d(){let R=E0(e.app,e.canvasTargetPath);if(!R){new Ku.Notice("Target canvas file was not found.");return}e.app.workspace.getLeaf(!0).openFile(R).catch(()=>new Ku.Notice("Could not open target canvas."))}function f(){let R=wB(e.app,e.canvasTargetPath);if(!R){new Ku.Notice("Open the target canvas and select exactly one card to use this action.");return}let O=h(n).find(q=>q.id===R);if(!O){new Ku.Notice(h(i)==="ready"?"The selected node was not found in the loaded canvas.":"Canvas nodes are still loading. Wait a moment and try again.");return}if(!O.capturable){new Ku.Notice(O.capturableReason);return}u(R)}function p(R){(async()=>{try{await navigator.clipboard.writeText(R),new Ku.Notice(`Copied node id ${R}`)}catch{new Ku.Notice("Could not copy node id automatically.")}})()}function m(R){return R==="text"?"TEXT":R==="file"?"FILE":"NODE"}var v=ule(),g=I(v),y=I(g),w=A(y,2),x=A(w,2);S(g);var C=A(g,2),_=I(C);gr(_),S(C);var E=A(C,2),D=I(E,!0);S(E);var P=A(E,2),H=I(P);{var V=R=>{var O=ole(),q=I(O,!0);S(O),de(()=>me(q,h(o))),$(R,O)},oe=R=>{var O=sle();$(R,O)},ce=R=>{var O=dn(),q=Pe(O);ar(q,17,()=>h(a),B=>B.id,(B,ie)=>{let j=N(()=>h(l)===h(ie).id);var Y=cle();let K;var se=I(Y),pe=I(se),ge=I(pe,!0);S(pe);var be=A(pe,2),xe=I(be,!0);S(be),S(se);var Ue=A(se,2),$t=I(Ue,!0);S(Ue);var Ne=A(Ue,2),Ke=I(Ne),Xe=I(Ke,!0);S(Ke),S(Ne);var ye=A(Ne,2),We=I(ye);{var ht=Be=>{var ut=ale();let or;var yr=I(ut,!0);S(ut),de(()=>{or=Ct(ut,1,"",null,or,{"mod-cta":h(j)}),me(yr,h(j)?"Selected":"Use node")}),De("click",ut,()=>u(h(ie).id)),$(Be,ut)},He=Be=>{var ut=lle();de(()=>ke(ut,"title",h(ie).capturableReason)),$(Be,ut)};ne(We,Be=>{h(ie).capturable?Be(ht):Be(He,-1)})}var _e=A(We,2);S(ye),S(Y),de(Be=>{K=Ct(Y,1,"qa-canvas-node-item",null,K,{"is-selected":h(j)}),Ct(pe,1,`qa-canvas-node-type is-${h(ie).type??""}`),me(ge,Be),me(xe,h(ie).title),me($t,h(ie).subtitle),me(Xe,h(ie).id)},[()=>m(h(ie).type)]),De("click",_e,()=>p(h(ie).id)),$(B,Y)}),$(R,O)};ne(H,R=>{h(i)==="empty"?R(V):h(i)==="ready"&&h(a).length===0?R(oe,1):R(ce,-1)})}S(P),S(v),de(()=>me(D,h(c))),De("click",y,d),De("click",w,f),De("click",x,()=>u("")),uo(_,()=>h(s),R=>Z(s,R)),$(r,v),Ce()}Et(["click"]);Ru();op();var dle=new Set(["folder","tag","exclude-folder","exclude-tag","exclude-file"]);function ple(r,e){let t=[r,...e??[]].filter(n=>typeof n=="string").map(n=>n.trim()).filter(Boolean);return t.length>0?t:void 0}function _j(r){let e=Yi.parse(`__capture_scope|${r}`);return{filter:e.filters,multiSelect:e.multiSelect??!1}}function fle(r){return!!(r.folder||r.folders?.length||r.tags?.length||r.excludeFolders?.length||r.excludeTags?.length||r.excludeFiles?.length)}function gh(r){let e=r.trim();if(!e)return null;if(e.startsWith("#")){let o=Bs(e),s=(o.shift()??"").replace(/^#/,"").replace(/\.md$/i,"").trim();if(!s)return null;let a=o.length>0?_j(o.join("|")):{filter:{},multiSelect:!1};return{filter:{...a.filter,tags:ple(s,a.filter.tags)},multiSelect:a.multiSelect}}let t=Bs(e)[0]??"",n=mo(t);if(!n||!dle.has(n.key))return null;let i=_j(e);return fle(i.filter)?i:null}Ru();var Aj=/^property:/i;function vh(r){let e=r.trim();if(!Aj.test(e))return null;let t=e.replace(Aj,""),{fieldName:n,filters:i}=Yi.parse(t),o=n.indexOf("="),s=(o>=0?n.slice(0,o):n).trim(),a=o>=0?n.slice(o+1).trim():"",l=a.length>0?a:void 0;return{field:s,value:l,filter:i}}function mle(r){return r.trim().replace(/^\/+/,"")}function ex(r){return[...new Set((r??[]).map(e=>e.trim()).filter(Boolean))]}function tx(r,e="or"){return r.length<=1?r[0]??"":e==="+"?r.join(" + "):r.length===2?`${r[0]} ${e} ${r[1]}`:`${r.slice(0,-1).join(", ")}, ${e} ${r[r.length-1]}`}function kj(r){let e=ex(r.folders??(r.folder?[r.folder]:[])),t=ex(r.tags),n=ex(r.excludeFolders),i=ex(r.excludeTags),o=ex(r.excludeFiles),s=[];return e.length>0&&s.push(`${e.length===1?"folder":"folders"} ${tx(e)}`),t.length>0&&s.push(`${t.length===1?"tag":"tags"} ${tx(t,"+")}`),n.length>0&&s.push(`excluding ${n.length===1?"folder":"folders"} ${tx(n)}`),i.length>0&&s.push(`excluding ${i.length===1?"tag":"tags"} ${tx(i,"+")}`),o.length>0&&s.push(`excluding ${o.length===1?"file":"files"} ${tx(o)}`),s.length>0?s.join("; "):"all notes"}function rx(r){let e=mle(r),t=vh(e);if(t){if(!t.field)return{recognized:!0,valid:!1,variant:"error",message:"Property capture target needs a field name, e.g. property:type=draft."};let i=t.value?`frontmatter ${t.field} = ${t.value}`:`frontmatter field ${t.field}`,o=kj(t.filter),s=o==="all notes"?"":`; ${o}`;return{recognized:!0,valid:!0,variant:"success",message:`Recognized property target: ${i}${s}.`}}let n=gh(e);return n?n.multiSelect?{recognized:!0,valid:!1,variant:"error",message:"Capture target filters select one destination file. Use {{FILE:...|multi}} in the capture format for multi-value metadata."}:{recognized:!0,valid:!0,variant:"success",message:`Recognized filtered picker: ${kj(n.filter)}.`}:null}var hle=W("<!> <!> <!>",1),gle=W('<!> <div class="qa-canvas-node-helper">Tip: open this canvas and select one card to grab its id instantly.</div> <!>',1),Sj=W("<!> <!>",1);function RR(r,e){we(e,!0);let t=he(e,"choice",15),n=N(()=>{let g=Oc(Ls(e.app)).filter(x=>x.length>0).map(x=>x.endsWith("/")?x:x+"/"),y=e.app.vault.getMarkdownFiles().map(x=>x.path),w=e.app.vault.getFiles().filter(x=>x.extension==="canvas").map(x=>x.path);return Array.from(new Set([...g,...y,...w]))}),i=[g=>new Hi(e.app,g,e.plugin,"captureTarget")],o=N(()=>rx(t().captureTo??"")),s=N(()=>h(o)!==null),a=g=>rx(g)!==null,l=N(()=>!h(s)&&bu(t().captureTo));function c(g){let y=!!t().captureToActiveFile&&t().activeFileWritePosition==="bottom";t(t().captureToActiveFile=g,!0),!g&&y&&t(t().prepend=!0,!0),!g&&t().newLineCapture?.enabled&&t(t().newLineCapture.enabled=!1,!0)}function u(g){let y=em(t().captureTo),w=bu(t().captureTo),x=rx(g)!==null;t(t().captureTo=g,!0);let C=em(g),_=bu(g);(x||!_||w&&_&&y!==C)&&t(t().captureToCanvasNodeId="",!0)}function d(g){let y=rx(g);return y?{valid:y.valid,message:y.message,variant:y.valid?"success":void 0}:g.trim()?!0:{valid:!0,message:"Leave empty to pick the note each time this choice runs."}}var f=Sj(),p=Pe(f);$e(p,{name:"Capture to active file",desc:"Capture into whichever note is open when the choice runs, instead of a fixed target.",control:y=>{lr(y,{get checked(){return t().captureToActiveFile},onchange:c})},$$slots:{control:!0}});var m=A(p,2);{var v=g=>{var y=Sj(),w=Pe(y);ss(w,{name:"Capture to",desc:"Vault-relative path to a file or folder, a #tag, or property:field=value. Supports format syntax like {{DATE}}; end with '/' to capture into a folder.",children:(E,D=Vt)=>{var P=hle(),H=Pe(P);xi(H,{get id(){return D()},get value(){return t().captureTo},placeholder:"Daily/{{DATE}}.md",get app(){return e.app},get suggestions(){return h(n)},maxSuggestions:50,get makeSuggesters(){return i},validator:d,onChange:u});var V=A(H,2);qp(V,{get value(){return t().captureTo}});var oe=A(V,2);{var ce=R=>{hs(R,{get value(){return t().captureTo},formatterKind:"fileName",get app(){return e.app},get plugin(){return e.plugin},hideWhen:a})};ne(oe,R=>{h(s)||R(ce)})}$(E,P)},$$slots:{default:!0}});var x=A(w,2);{var C=_=>{var E=gle(),D=Pe(E);$e(D,{name:"Target canvas node",desc:"Choose a card from the canvas below, or paste an exact node id.",control:V=>{{let oe=N(()=>t().captureToCanvasNodeId??"");xi(V,{get value(){return h(oe)},placeholder:"Canvas node id",ariaLabel:"Canvas node id",required:!0,requiredMessage:"A canvas capture target requires a node id \u2014 pick a card below or paste an exact node id.",onChange:ce=>t(t().captureToCanvasNodeId=ce.trim(),!0)})}},$$slots:{control:!0}});var P=A(D,4);KI(P,()=>t().captureTo,H=>{MR(H,{get canvasTargetPath(){return t().captureTo},get app(){return e.app},get nodeId(){return t().captureToCanvasNodeId},set nodeId(V){t(t().captureToCanvasNodeId=V,!0)}})}),$(_,E)};ne(x,_=>{h(l)&&_(C)})}$(g,y)};ne(m,g=>{t().captureToActiveFile||g(v)})}$(r,f),Ce()}var Fj=require("obsidian");var Pj=require("obsidian");Tt();function $R(r){let t=r.match(/\{\{DATE:((?:[^}\n\r+|]|\|(?!(?:startof|endof):[a-z]))*)(?:\+-?\d+)?(?:\|(?:startof|endof):[a-z]+)?\}\}/i)?.[1]?.trim();if(t)return t;let i=r.match(/\{\{VDATE:[^,}]+,([^}\n\r]*)\}\}/i)?.[1]?.split("|")[0]?.trim();if(i)return i}var vle=W(`<div class="setting-item-description">You'll pick a heading from the target note when you run this capture, and the
|
||
text is inserted under it. Use the toggles below to control placement within that
|
||
section.</div>`),Dj=W("<!> <!>",1),yle=W(`<div class="setting-item-description">Inline insertion needs a single-line target. The line break (\\n) can't be
|
||
matched on the same line \u2014 remove it, or turn off "Inline insertion".</div>`),Ij=W("<!> <!> <!>",1),ble=W(`<div class="setting-item-description">No sorting: newest-first prepends the new section above existing ones;
|
||
oldest-first appends it below.</div>`),wle=W(`<div class="setting-item-description">This heading uses a date token QuickAdd can't auto-read for sorting. Pick
|
||
"Date" and enter the format, or sections stay in insertion order.</div>`),Cle=W(`<div class="setting-item-description">The "Insert after" heading is created at its sorted position among ALL
|
||
same-level headings in the note (it is not scoped to one parent section). It
|
||
does NOT re-sort headings you already have; only the new one is placed. Use
|
||
"Insert at end of section" above for newest-on-top vs. appended entries within
|
||
each section.</div> <!> <!> <!> <!> <!> <!>`,1),xle=W("<!> <!> <!> <!> <!>",1);function OR(r,e){we(e,!0);let t=he(e,"insertAfter",15);t().inline===void 0&&t(t().inline=!1,!0),t().replaceExisting===void 0&&t(t().replaceExisting=!1,!0),t().promptHeading===void 0&&t(t().promptHeading=!1,!0),t().insertAtEnd===void 0&&t(t().insertAtEnd=!1,!0),t().considerSubsections===void 0&&t(t().considerSubsections=!1,!0),t().blankLineAfterMatchMode||t(t().blankLineAfterMatchMode="auto",!0),t().createIfNotFound||t(t().createIfNotFound=!1,!0),t().createIfNotFoundLocation||t(t().createIfNotFoundLocation=po,!0);let n=[B=>new Hi(e.app,B,e.plugin,"lineTarget")],i=[{value:"auto",label:"Auto (headings only)"},{value:"skip",label:"Always skip"},{value:"none",label:"Never skip"}],o=N(()=>t().inline?[{value:po,label:"Top"},{value:ac,label:"Bottom"},{value:lc,label:"Cursor"}]:[{value:po,label:"Top"},{value:ac,label:"Bottom"},{value:lc,label:"Cursor"},{value:Aa,label:"Ordered (place new section among siblings)"}]),s=[{value:"insertion",label:"Insertion order (no sorting)"},{value:"lexical",label:"Text (A\u2192Z)"},{value:"numeric",label:"Number"},{value:"date",label:"Date"},{value:"semver",label:"Version (semver)"}],a=[{value:"desc",label:"Newest / highest first"},{value:"asc",label:"Oldest / lowest first"}],l=[{value:"bottom",label:"Sort existing unparseable headings to bottom"},{value:"top",label:"Sort existing unparseable headings to top"}],c=Ae(!!t().orderBy),u=N(()=>t().createIfNotFoundLocation===Aa),d=N(()=>t().createIfNotFound&&h(u)),f=N(()=>new fh(e.app,e.plugin)),p=Ae(!1);hr(()=>{let B=t().after??"",ie=h(f);if(!t().inline||B===""){Z(p,!1);return}let j=!1;return ie.format(B).then(Y=>{j||Z(p,/[\n\r]/.test(Y),!0)}).catch(()=>{j||Z(p,!1)}),()=>{j=!0}});let m=N(()=>t().orderBy??{by:"insertion",direction:"desc",unparseable:"bottom"}),v=N(()=>/\{\{V?DATE\b/i.test(t().after??"")),g=N(()=>h(d)&&t().orderBy?.by==="insertion"&&h(v)&&!$R(t().after??""));hr(()=>{if(!h(d))return;let B=$R(t().after??"");if(!t().orderBy){t(t().orderBy={by:B?"date":"insertion",direction:"desc",dateFormat:B,unparseable:"bottom"},!0);return}!h(c)&&(t().orderBy.by==="insertion"||t().orderBy.by==="date")&&(t(t().orderBy.by=B?"date":"insertion",!0),t(t().orderBy.dateFormat=B,!0))});function y(B){t(t().createIfNotFoundLocation=B,!0),B===Aa?t(t().inline=!1,!0):(t(t().orderBy=void 0,!0),Z(c,!1))}function w(B){Z(c,!0),t().orderBy&&t(t().orderBy.by=B,!0)}function x(B){t().promptHeading||B&&!t().after.startsWith("#")&&(t(t().considerSubsections=!1,!0),new Pj.Notice("Consider subsections requires the target to be a heading (starts with #)"))}function C(B){B&&(t(t().inline=!1,!0),t(t().replaceExisting=!1,!0))}var _=xle(),E=Pe(_);$e(E,{name:"Choose heading when capturing",desc:"Instead of typing a target line now, show a dropdown of the target note's headings when you run this capture and insert under the one you pick.",control:ie=>{lr(ie,{onchange:C,get checked(){return t().promptHeading},set checked(j){t(t().promptHeading=j,!0)}})},$$slots:{control:!0}});var D=A(E,2);{var P=B=>{var ie=vle();$(B,ie)},H=B=>{var ie=Ij(),j=Pe(ie);ss(j,{name:"Insert after",desc:"Insert capture after specified text. Accepts format syntax. Tip: use a heading (starts with #) to target a section. Blank line handling is configurable below.",children:(ge,be=Vt)=>{var xe=Dj(),Ue=Pe(xe);xi(Ue,{get id(){return be()},placeholder:"Insert after",required:!0,requiredMessage:"Insert after text is required",get makeSuggesters(){return n},get value(){return t().after},set value(Ne){t(t().after=Ne,!0)}});var $t=A(Ue,2);hs($t,{get value(){return t().after},formatterKind:"lineTarget",get app(){return e.app},get plugin(){return e.plugin}}),$(ge,xe)},$$slots:{default:!0}});var Y=A(j,2);{let pe=be=>{lr(be,{get disabled(){return h(u)},get checked(){return t().inline},set checked(xe){t(t().inline=xe,!0)}})},ge=N(()=>h(u)?"Inline insertion can't be combined with ordered placement.":"Insert captured content on the same line, immediately after the matched text (no newline added).");$e(Y,{name:"Inline insertion",get desc(){return h(ge)},control:pe,$$slots:{control:!0}})}var K=A(Y,2);{var se=pe=>{var ge=yle();$(pe,ge)};ne(K,pe=>{h(p)&&pe(se)})}$(B,ie)};ne(D,B=>{t().promptHeading?B(P):B(H,-1)})}var V=A(D,2);{var oe=B=>{$e(B,{name:"Replace existing value",desc:"Replace everything after the matched text up to end-of-line.",control:j=>{lr(j,{get checked(){return t().replaceExisting},set checked(Y){t(t().replaceExisting=Y,!0)}})},$$slots:{control:!0}})},ce=B=>{var ie=Ij(),j=Pe(ie);$e(j,{name:"Insert at end of section",desc:"Place the text at the end of the matched section instead of the top.",control:pe=>{lr(pe,{get checked(){return t().insertAtEnd},set checked(ge){t(t().insertAtEnd=ge,!0)}})},$$slots:{control:!0}});var Y=A(j,2);{let se=ge=>{{let be=N(()=>t().blankLineAfterMatchMode??"auto");Jt(ge,{get value(){return h(be)},get options(){return i},get disabled(){return t().insertAtEnd},onchange:xe=>t(t().blankLineAfterMatchMode=xe,!0)})}},pe=N(()=>t().insertAtEnd?"Not used when inserting at end of section.":"Controls whether Insert After skips existing blank lines after the matched line.");$e(Y,{name:"Blank lines after match",get desc(){return h(pe)},control:se,$$slots:{control:!0}})}var K=A(Y,2);{let se=ge=>{{let be=N(()=>!t().insertAtEnd);lr(ge,{get disabled(){return h(be)},onchange:x,get checked(){return t().considerSubsections},set checked(xe){t(t().considerSubsections=xe,!0)}})}},pe=N(()=>t().insertAtEnd?t().promptHeading?"Also include the chosen heading\u2019s subsections (nested headings inside its section).":"Also include the section\u2019s subsections (requires target to be a heading starting with #). Subsections are headings inside the section.":"Only affects placement when \u201CInsert at end of section\u201D is on.");$e(K,{name:"Consider subsections",get desc(){return h(pe)},control:se,$$slots:{control:!0}})}$(B,ie)};ne(V,B=>{t().inline?B(oe):B(ce,-1)})}var R=A(V,2);$e(R,{name:"Create line if not found",desc:"Creates the 'insert after' line if it is not found.",control:ie=>{var j=Dj(),Y=Pe(j);lr(Y,{get checked(){return t().createIfNotFound},set checked(se){t(t().createIfNotFound=se,!0)}});var K=A(Y,2);{let se=N(()=>t().createIfNotFoundLocation||po);Jt(K,{get value(){return h(se)},get options(){return h(o)},onchange:y})}$(ie,j)},$$slots:{control:!0}});var O=A(R,2);{var q=B=>{var ie=Cle(),j=A(Pe(ie),2);$e(j,{name:"Sort sections by",control:Ke=>{Jt(Ke,{get value(){return h(m).by},get options(){return s},onchange:w})},$$slots:{control:!0}});var Y=A(j,2);$e(Y,{name:"Section order",control:Ke=>{Jt(Ke,{get value(){return h(m).direction},get options(){return a},onchange:Xe=>{t().orderBy&&t(t().orderBy.direction=Xe,!0)}})},$$slots:{control:!0}});var K=A(Y,2);{var se=Ne=>{$e(Ne,{name:"Date format",desc:"Moment format used to parse existing heading dates for sorting (e.g. YYYY-MM-DD).",control:Xe=>{{let ye=N(()=>h(m).dateFormat??"");xi(Xe,{get value(){return h(ye)},placeholder:"YYYY-MM-DD",ariaLabel:"Date format",onChange:We=>{Z(c,!0),t().orderBy&&t(t().orderBy.dateFormat=We,!0)}})}},$$slots:{control:!0}})};ne(K,Ne=>{h(m).by==="date"&&Ne(se)})}var pe=A(K,2);{var ge=Ne=>{$e(Ne,{name:"Existing unparseable headings",desc:"Where to rank EXISTING headings whose text can't be parsed for this sort. (A new heading that can't be parsed is appended at the end.)",control:Xe=>{{let ye=N(()=>h(m).unparseable??"bottom");Jt(Xe,{get value(){return h(ye)},get options(){return l},onchange:We=>{t().orderBy&&t(t().orderBy.unparseable=We,!0)}})}},$$slots:{control:!0}})};ne(pe,Ne=>{(h(m).by==="date"||h(m).by==="numeric"||h(m).by==="semver")&&Ne(ge)})}var be=A(pe,2);{var xe=Ne=>{var Ke=ble();$(Ne,Ke)};ne(be,Ne=>{h(m).by==="insertion"&&Ne(xe)})}var Ue=A(be,2);{var $t=Ne=>{var Ke=wle();$(Ne,Ke)};ne(Ue,Ne=>{h(g)&&Ne($t)})}$(B,ie)};ne(O,B=>{h(d)&&t().orderBy&&B(q)})}$(r,_),Ce()}Tt();var NR=W("<!> <!>",1);function LR(r,e){we(e,!0);let t=he(e,"insertBefore",15);t().createIfNotFound===void 0&&t(t().createIfNotFound=!1,!0),t().createIfNotFoundLocation||t(t().createIfNotFoundLocation=po,!0);let n=[l=>new Hi(e.app,l,e.plugin,"lineTarget")],i=[{value:po,label:"Top"},{value:ac,label:"Bottom"},{value:lc,label:"Cursor"}];var o=NR(),s=Pe(o);ss(s,{name:"Insert before",desc:"Insert capture before specified text. Accepts format syntax.",children:(c,u=Vt)=>{var d=NR(),f=Pe(d);xi(f,{get id(){return u()},placeholder:"Insert before",required:!0,requiredMessage:"Insert before text is required",get makeSuggesters(){return n},get value(){return t().before},set value(m){t(t().before=m,!0)}});var p=A(f,2);hs(p,{get value(){return t().before},formatterKind:"lineTarget",get app(){return e.app},get plugin(){return e.plugin}}),$(c,d)},$$slots:{default:!0}});var a=A(s,2);$e(a,{name:"Create line if not found",desc:"Creates the 'insert before' line if it is not found.",control:c=>{var u=NR(),d=Pe(u);lr(d,{get checked(){return t().createIfNotFound},set checked(p){t(t().createIfNotFound=p,!0)}});var f=A(d,2);{let p=N(()=>t().createIfNotFoundLocation||po);Jt(f,{get value(){return h(p)},get options(){return i},onchange:m=>t(t().createIfNotFoundLocation=m,!0)})}$(c,u)},$$slots:{control:!0}}),$(r,o),Ce()}var Ele=W(`<div class="setting-item-description">Canvas note: 'At cursor' and 'New line above/below cursor' are not supported
|
||
for Canvas card capture. Use top, bottom, insert-after, or insert-before
|
||
placement.</div>`),Tle=W("<!> <!> <!> <!>",1);function BR(r,e){we(e,!0);let t=he(e,"choice",15),n=N(()=>!!t().captureToActiveFile),i=N(()=>t().insertAfter?.enabled?"after":t().insertBefore?.enabled?"before":t().newLineCapture?.enabled?t().newLineCapture.direction==="above"?"newLineAbove":"newLineBelow":h(n)?t().activeFileWritePosition==="top"?"activeTop":t().activeFileWritePosition==="bottom"||t().prepend?"bottom":"top":t().prepend?"bottom":"top"),o=N(()=>[{value:"top",label:h(n)?"At cursor":"Top of file"},...h(n)?[{value:"activeTop",label:"Top of file (after frontmatter)"},{value:"newLineAbove",label:"New line above cursor"},{value:"newLineBelow",label:"New line below cursor"}]:[],{value:"after",label:"After line\u2026"},{value:"before",label:"Before line\u2026"},{value:"bottom",label:"Bottom of file"}]);function s(g){if(t(t().prepend=!1,!0),t(t().insertAfter.enabled=!1,!0),t(t().insertAfter.promptHeading=!1,!0),t(t().insertAfter.inline=!1,!0),t(t().insertAfter.replaceExisting=!1,!0),t().insertBefore||t(t().insertBefore={enabled:!1,before:"",createIfNotFound:!1,createIfNotFoundLocation:"top"},!0),t(t().insertBefore.enabled=!1,!0),t().newLineCapture||t(t().newLineCapture={enabled:!1,direction:"below"},!0),t(t().newLineCapture.enabled=!1,!0),t(t().activeFileWritePosition="cursor",!0),g==="top"){h(n)||t(t().prepend=!1,!0);return}if(g==="activeTop"){h(n)&&t(t().activeFileWritePosition="top",!0);return}if(g==="bottom"){h(n)?t(t().activeFileWritePosition="bottom",!0):t(t().prepend=!0,!0);return}if(g==="newLineAbove"){t(t().newLineCapture.enabled=!0,!0),t(t().newLineCapture.direction="above",!0);return}if(g==="newLineBelow"){t(t().newLineCapture.enabled=!0,!0),t(t().newLineCapture.direction="below",!0);return}if(g==="before"){t(t().insertBefore.enabled=!0,!0);return}t(t().insertAfter.enabled=!0,!0)}let a=N(()=>{let g=typeof t().captureTo=="string"&&bu(t().captureTo),y=e.app.workspace.getActiveViewOfType(Fj.FileView)?.getViewType()==="canvas",w=h(n)&&!t().insertAfter.enabled&&!t().insertBefore?.enabled&&!t().newLineCapture?.enabled&&(t().activeFileWritePosition??"cursor")==="cursor"&&!t().prepend;return!(!(t().newLineCapture?.enabled||w)||(h(n)?!y:!g))});var l=Tle(),c=Pe(l);{let g=w=>{Jt(w,{get value(){return h(i)},get options(){return h(o)},onchange:s})},y=N(()=>h(n)?"Where to place the capture in the current file.":"Where to place the capture in the target file.");$e(c,{name:"Write position",get desc(){return h(y)},control:g,$$slots:{control:!0}})}var u=A(c,2);{var d=g=>{OR(g,{get app(){return e.app},get plugin(){return e.plugin},get insertAfter(){return t().insertAfter},set insertAfter(y){t(t().insertAfter=y,!0)}})};ne(u,g=>{t().insertAfter.enabled&&g(d)})}var f=A(u,2);{var p=g=>{LR(g,{get app(){return e.app},get plugin(){return e.plugin},get insertBefore(){return t().insertBefore},set insertBefore(y){t(t().insertBefore=y,!0)}})};ne(f,g=>{t().insertBefore?.enabled&&g(p)})}var m=A(f,2);{var v=g=>{var y=Ele();$(g,y)};ne(m,g=>{h(a)&&g(v)})}$(r,l),Ce()}var _le=new Set(["activity","airplay","alarm-check","alarm-clock-off","alarm-clock","alarm-minus","alarm-plus","album","alert-circle","alert-octagon","alert-triangle","align-center-horizontal","align-center-vertical","align-center","align-end-horizontal","align-end-vertical","align-horizontal-distribute-center","align-horizontal-distribute-end","align-horizontal-distribute-start","align-horizontal-justify-center","align-horizontal-justify-end","align-horizontal-justify-start","align-horizontal-space-around","align-horizontal-space-between","align-justify","align-left","align-right","align-start-horizontal","align-start-vertical","align-vertical-distribute-center","align-vertical-distribute-end","align-vertical-distribute-start","align-vertical-justify-center","align-vertical-justify-end","align-vertical-justify-start","align-vertical-space-around","align-vertical-space-between","anchor","aperture","archive","arrow-big-down","arrow-big-left","arrow-big-right","arrow-big-up","arrow-down-circle","arrow-down-left","arrow-down-right","arrow-down","arrow-left-circle","arrow-left-right","arrow-left","arrow-right-circle","arrow-right","arrow-up-circle","arrow-up-left","arrow-up-right","arrow-up","asterisk","at-sign","award","axe","banknote","bar-chart-2","bar-chart","baseline","battery-charging","battery-full","battery-low","battery-medium","battery","beaker","bell-minus","bell-off","bell-plus","bell-ring","bell","bike","binary","bitcoin","bluetooth-connected","bluetooth-off","bluetooth-searching","bluetooth","bold","book-open","book","bookmark-minus","bookmark-plus","bookmark","bot","box-select","box","briefcase","brush","bug","building-2","building","bus","calculator","calendar","camera-off","camera","car","carrot","cast","check-circle-2","check-circle","check-square","check","chevron-down","chevron-first","chevron-last","chevron-left","chevron-right","chevron-up","chevrons-down-up","chevrons-down","chevrons-left","chevrons-right","chevrons-up-down","chevrons-up","chrome","circle-slashed","circle","clipboard-check","clipboard-copy","clipboard-list","clipboard-x","clipboard","clock-1","clock-10","clock-11","clock-12","clock-2","clock-3","clock-4","clock-5","clock-6","clock-7","clock-8","clock-9","clock","cloud-drizzle","cloud-fog","cloud-hail","cloud-lightning","cloud-moon","cloud-off","cloud-rain-wind","cloud-rain","cloud-snow","cloud-sun","cloud","cloudy","clover","code-2","code","codepen","codesandbox","coffee","coins","columns","command","compass","contact","contrast","cookie","copy","copyleft","copyright","corner-down-left","corner-down-right","corner-left-down","corner-left-up","corner-right-down","corner-right-up","corner-up-left","corner-up-right","cpu","credit-card","crop","cross","crosshair","crown","currency","database","delete","dice-1","dice-2","dice-3","dice-4","dice-5","dice-6","disc","divide-circle","divide-square","divide","dollar-sign","download-cloud","download","dribbble","droplet","droplets","drumstick","edit-2","edit-3","edit","egg","equal-not","equal","eraser","euro","expand","external-link","eye-off","eye","facebook","fast-forward","feather","figma","file-check-2","file-check","file-code","file-digit","file-input","file-minus-2","file-minus","file-output","file-plus-2","file-plus","file-search","file-text","file-x-2","file-x","file","files","film","filter","flag-off","flag-triangle-left","flag-triangle-right","flag","flame","flashlight-off","flashlight","flask-conical","flask-round","folder-minus","folder-open","folder-plus","folder","form-input","forward","frame","framer","frown","function-square","gamepad-2","gamepad","gauge","gavel","gem","ghost","gift","git-branch-plus","git-branch","git-commit","git-fork","git-merge","git-pull-request","github","gitlab","glasses","globe-2","globe","grab","graduation-cap","grid","grip-horizontal","grip-vertical","hammer","hand-metal","hand","hard-drive","hard-hat","hash","haze","headphones","heart","help-circle","hexagon","highlighter","history","home","image-minus","image-off","image-plus","image","import","inbox","indent","indian-rupee","infinity","info","inspect","instagram","italic","japanese-yen","key","keyboard","landmark","languages","laptop-2","laptop","lasso-select","lasso","layers","layout-dashboard","layout-grid","layout-list","layout-template","layout","library","life-buoy","lightbulb-off","lightbulb","link-2-off","link-2","link","linkedin","list-checks","list-minus","list-ordered","list-plus","list-x","list","loader-2","loader","locate-fixed","locate-off","locate","lock","log-in","log-out","mail","map-pin","map","maximize-2","maximize","megaphone","meh","menu","message-circle","message-square","mic-off","mic","minimize-2","minimize","minus-circle","minus-square","minus","monitor-off","monitor-speaker","monitor","moon","more-horizontal","more-vertical","mountain-snow","mountain","mouse-pointer-2","mouse-pointer-click","mouse-pointer","mouse","move-diagonal-2","move-diagonal","move-horizontal","move-vertical","move","music","navigation-2","navigation","network","octagon","option","outdent","package-check","package-minus","package-plus","package-search","package-x","package","palette","palmtree","paperclip","pause-circle","pause-octagon","pause","pen-tool","pencil","percent","person-standing","phone-call","phone-forwarded","phone-incoming","phone-missed","phone-off","phone-outgoing","phone","pie-chart","piggy-bank","pin","pipette","plane","play-circle","play","plug-zap","plus-circle","plus-square","plus","pocket","podcast","pointer","pound-sterling","power-off","power","printer","qr-code","quote","radio-receiver","radio","redo","refresh-ccw","refresh-cw","regex","repeat-1","repeat","reply-all","reply","rewind","rocket","rocking-chair","rotate-ccw","rotate-cw","rss","ruler","russian-ruble","save","scale","scan-line","scan","scissors","screen-share-off","screen-share","search","send","separator-horizontal","separator-vertical","server-crash","server-off","server","settings-2","settings","share-2","share","sheet","shield-alert","shield-check","shield-close","shield-off","shield","shirt","shopping-bag","shopping-cart","shovel","shrink","shuffle","sidebar-close","sidebar-open","sidebar","sigma","signal-high","signal-low","signal-medium","signal-zero","signal","skip-back","skip-forward","skull","slack","slash","sliders","smartphone-charging","smartphone","smile","snowflake","sort-asc","sort-desc","speaker","sprout","square","star-half","star","stop-circle","stretch-horizontal","stretch-vertical","strikethrough","subscript","sun","sunrise","sunset","superscript","swiss-franc","switch-camera","table","tablet","tag","target","tent","terminal-square","terminal","text-cursor-input","text-cursor","thermometer-snowflake","thermometer-sun","thermometer","thumbs-down","thumbs-up","ticket","timer-off","timer-reset","timer","toggle-left","toggle-right","tornado","trash-2","trash","trello","trending-down","trending-up","triangle","truck","tv-2","tv","twitch","twitter","type","umbrella","underline","undo","unlink-2","unlink","unlock","upload-cloud","upload","user-check","user-minus","user-plus","user-x","user","users","verified","vibrate","video-off","video","view","voicemail","volume-1","volume-2","volume-x","volume","wallet","wand","watch","waves","webcam","wifi-off","wifi","wind","wrap-text","wrench","x-circle","x-octagon","x-square","x","youtube","zap-off","zap","zoom-in","zoom-out","search-large","lucide-clock","lucide-cloud","lucide-cross","lucide-folder","lucide-info","lucide-languages","lucide-link","lucide-pencil","lucide-pin","lucide-search","lucide-star","lucide-trash"]),BA=Array.from(_le);Wt();var Ale=W('<div class="qa-choice-icon-setting-control svelte-p1gcdx"><span class="qa-choice-icon-setting-preview svelte-p1gcdx" aria-hidden="true"><!></span> <input type="text" class="qa-choice-icon-input svelte-p1gcdx" aria-label="Choice icon"/></div>'),kle={hash:"svelte-p1gcdx",code:".qa-choice-icon-setting-control.svelte-p1gcdx {display:flex;align-items:center;gap:8px;min-width:min(18rem, 100%);}.qa-choice-icon-setting-preview.svelte-p1gcdx {display:inline-flex;align-items:center;justify-content:center;flex:0 0 auto;color:var(--text-muted);}.qa-choice-icon-input.svelte-p1gcdx {width:100%;min-width:0;}"};function nx(r,e){we(e,!0),ot(r,kle);let t=he(e,"icon",15),n=N(()=>ym(e.type)),i=N(()=>typeof t()=="string"?t():""),o=N(()=>h(i).trim()||h(n));function s(l){return new ii(e.app,l,BA,50)}function a(l){let c=l.currentTarget.value.trim();t(c||void 0)}{let l=u=>{var d=Ale(),f=I(d),p=I(f);Rt(p,{get iconId(){return h(o)},size:18}),S(f);var m=A(f,2);gr(m),Fr(m,(v,g)=>hp?.(v,g),()=>s),S(d),de(()=>{Fs(m,h(i)),ke(m,"placeholder",h(n))}),De("input",m,a),$(u,d)},c=N(()=>`Lucide/Obsidian icon id. Leave empty to use ${h(n)}.`);$e(r,{name:"Icon",get desc(){return h(c)},control:l,$$slots:{control:!0}})}Ce()}Et(["input"]);var Mj=W("<!> <!>",1),Sle=W("<!> <!> <!>",1),Dle=W("<!> <!> <!> <!> <!> <!> <!> <!> <!> <!> <!> <!> <!> <!> <!> <!> <!> <!>",1);function UR(r,e){we(e,!0);let t=he(e,"choice",15),n=N(()=>e.plugin.getTemplateFiles().map(q=>q.path)),i=[q=>new Hi(e.app,q,e.plugin)];function o(q){let B=q.trim();return B?_u(B)?{valid:!0,message:"Contains format syntax \u2014 resolved at run time."}:fo(e.app,B)!==null||"Template not found":!0}let s=[{value:"",label:"Follow global setting"},{value:"enabled",label:"Use selection"},{value:"disabled",label:"Ignore selection"}],a=N(()=>typeof t().useSelectionAsCaptureValue=="boolean"?t().useSelectionAsCaptureValue?"enabled":"disabled":"");function l(q){if(q===""){t(t().useSelectionAsCaptureValue=void 0,!0);return}t(t().useSelectionAsCaptureValue=q==="enabled",!0)}function c(q){t().templater||t(t().templater={},!0),t(t().templater.afterCapture=q?"wholeFile":"none",!0)}var u=Dle(),d=Pe(u);hy(d,{get app(){return e.app},get name(){return t().name},set name(q){t(t().name=q,!0)}});var f=A(d,2);$e(f,{name:"Location",heading:!0});var p=A(f,2);RR(p,{get app(){return e.app},get plugin(){return e.plugin},get choice(){return t()},set choice(q){t(q)}});var m=A(p,2);{var v=q=>{var B=Mj(),ie=Pe(B);$e(ie,{name:"Create file if it doesn't exist",control:se=>{lr(se,{get checked(){return t().createFileIfItDoesntExist.enabled},set checked(pe){t(t().createFileIfItDoesntExist.enabled=pe,!0)}})},$$slots:{control:!0}});var j=A(ie,2);{var Y=K=>{ss(K,{name:"Create file with a template",desc:"Path to the template QuickAdd applies to the new file.",get bodyVisible(){return t().createFileIfItDoesntExist.createWithTemplate},control:ge=>{lr(ge,{get checked(){return t().createFileIfItDoesntExist.createWithTemplate},set checked(be){t(t().createFileIfItDoesntExist.createWithTemplate=be,!0)}})},children:(ge,be=Vt)=>{xi(ge,{get id(){return be()},get value(){return t().createFileIfItDoesntExist.template},placeholder:"Template path",get app(){return e.app},get suggestions(){return h(n)},maxSuggestions:50,validator:o,onChange:xe=>t(t().createFileIfItDoesntExist.template=xe.trim(),!0)})},$$slots:{control:!0,default:!0}})};ne(j,K=>{t().createFileIfItDoesntExist.enabled&&K(Y)})}$(q,B)};ne(m,q=>{t().captureToActiveFile||q(v)})}var g=A(m,2);$e(g,{name:"Position",heading:!0});var y=A(g,2);BR(y,{get app(){return e.app},get plugin(){return e.plugin},get choice(){return t()},set choice(q){t(q)}});var w=A(y,2);$e(w,{name:"Linking",heading:!0});var x=A(w,2);QC(x,{fileLabel:"captured",get app(){return e.app},get appendLink(){return t().appendLink},set appendLink(q){t(t().appendLink=q,!0)}});var C=A(x,2);$e(C,{name:"Copy link to clipboard",desc:"Copy a link to the captured file after the Capture choice runs.",control:B=>{{let ie=N(()=>t().copyLinkToClipboard??!1);lr(B,{get checked(){return h(ie)},onchange:j=>t(t().copyLinkToClipboard=j,!0)})}},$$slots:{control:!0}});var _=A(C,2);$e(_,{name:"Content",heading:!0});var E=A(_,2);$e(E,{name:"Task",desc:"Formats the value as a task.",control:B=>{lr(B,{get checked(){return t().task},set checked(ie){t(t().task=ie,!0)}})},$$slots:{control:!0}});var D=A(E,2);ss(D,{name:"Capture format",desc:"Set the format of the capture. When off, QuickAdd captures {{VALUE}} on its own - what you type at the prompt, or the current selection.",get bodyVisible(){return t().format.enabled},control:ie=>{lr(ie,{get checked(){return t().format.enabled},set checked(j){t(t().format.enabled=j,!0)}})},children:(ie,j=Vt)=>{var Y=Sle(),K=Pe(Y);xi(K,{get id(){return j()},inputKind:"textarea",placeholder:"Format",required:!0,requiredMessage:"Capture format is required when enabled",get makeSuggesters(){return i},get value(){return t().format.format},set value(ge){t(t().format.format=ge,!0)}});var se=A(K,2);qp(se,{get value(){return t().format.format}});var pe=A(se,2);hs(pe,{get value(){return t().format.format},get app(){return e.app},get plugin(){return e.plugin}}),$(ie,Y)},$$slots:{control:!0,default:!0}});var P=A(D,2);$e(P,{name:"Behavior",heading:!0});var H=A(P,2);{var V=q=>{var B=Mj(),ie=Pe(B);XC(ie,{description:"Open the captured file.",get openFile(){return t().openFile},set openFile(K){t(t().openFile=K,!0)}});var j=A(ie,2);{var Y=K=>{ZC(K,{contextLabel:"captured",get fileOpening(){return t().fileOpening},set fileOpening(se){t(t().fileOpening=se,!0)}})};ne(j,K=>{t().openFile&&K(Y)})}$(q,B)};ne(H,q=>{t().captureToActiveFile||q(V)})}var oe=A(H,2);$e(oe,{name:"Use editor selection as default value",desc:"Controls whether this Capture uses the current editor selection as {{VALUE}}. Does not affect {{SELECTED}}.",control:B=>{Jt(B,{get value(){return h(a)},get options(){return s},onchange:l})},$$slots:{control:!0}});var ce=A(oe,2);$e(ce,{name:"Run Templater on entire destination file after capture",desc:"Advanced / legacy: this executes any <% %> anywhere in the destination file (including inside code blocks).",control:B=>{{let ie=N(()=>t().templater?.afterCapture==="wholeFile");lr(B,{get checked(){return h(ie)},onchange:c})}},$$slots:{control:!0}});var R=A(ce,2);JC(R,{get onePageInput(){return t().onePageInput},set onePageInput(q){t(t().onePageInput=q,!0)}});var O=A(R,2);nx(O,{get type(){return t().type},get app(){return e.app},get icon(){return t().icon},set icon(q){t(t().icon=q,!0)}}),$(r,u),Ce()}function Rj(r){return wt({...r,choice:ma(r.choice)})}var $j=require("obsidian");function yh(r){return ma(r)}function UA(r,e){if(r.containerEl.addClass("qa-choice-builder"),r.modalEl.querySelector(".qa-builder-footer"))return;let t=r.modalEl.ownerDocument,n=t.createElement("div");n.className="qa-builder-footer";let i=t.createElement("span");i.className="qa-builder-footer-note",i.textContent=`Changes to this ${e} are saved automatically`,n.appendChild(i);let o=t.createElement("button");o.type="button",o.className="mod-cta",o.textContent="Done",o.addEventListener("click",()=>r.close()),n.appendChild(o),r.modalEl.appendChild(n)}var bh=class extends $j.Modal{constructor(t){super(t);this.svelteElements=[];this.waitForClose=new Promise(n=>{this.resolvePromise=n}),this.containerEl.addClass("quickAddModal"),UA(this,"choice"),this.open()}destroySvelteElements(){this.svelteElements.forEach(t=>t.destroy()),this.svelteElements=[]}getResultChoice(){return this.choice}onClose(){super.onClose(),this.destroySvelteElements(),this.resolvePromise(yh(this.getResultChoice()))}};var wh=class extends bh{constructor(t,n,i){super(t);this.plugin=i;this.choice=n,this.normalizeChoice(),this.display()}normalizeChoice(){this.choice.insertBefore||(this.choice.insertBefore={enabled:!1,before:"",createIfNotFound:!1,createIfNotFoundLocation:po}),this.choice.activeFileWritePosition||(this.choice.activeFileWritePosition="cursor"),this.choice.createFileIfItDoesntExist||(this.choice.createFileIfItDoesntExist={enabled:!1,createWithTemplate:!1,template:""}),!this.choice.captureToActiveFile&&!bu(this.choice.captureTo)&&(this.choice.captureToCanvasNodeId=""),this.choice.openFile&&(this.choice.fileOpening=pn(this.choice.fileOpening))}display(){this.containerEl.addClass("captureChoiceBuilder"),this.formProps=Rj({choice:this.choice,app:this.app,plugin:this.plugin});let t=qi(this.contentEl,UR,this.formProps,{what:"this capture choice's settings"});t.ok||(this.formProps=void 0),this.svelteElements.push(t)}getResultChoice(){return this.formProps?.choice??this.choice}};Tt();var Nj=[{id:"prompt",label:"Ask every time"},{id:"update",label:"Update existing file"},{id:"create",label:"Create another file"},{id:"keep",label:"Keep existing file"}],VR=[{id:"appendBottom",category:"update",label:"Append to bottom",description:"Adds the template content to the end of the existing file.",requiresExistingFile:!0,resolutionKind:"modifyExisting"},{id:"appendTop",category:"update",label:"Append to top",description:"Adds the template content to the beginning of the existing file.",requiresExistingFile:!0,resolutionKind:"modifyExisting"},{id:"overwrite",category:"update",label:"Overwrite file",description:"Replaces the existing file content with the template.",requiresExistingFile:!0,resolutionKind:"modifyExisting"},{id:"increment",category:"create",label:"Increment trailing number",description:"Changes trailing digits only. Example: Draft009.md -> Draft010.md.",requiresExistingFile:!1,resolutionKind:"createNew"},{id:"duplicateSuffix",category:"create",label:"Append duplicate suffix",description:"Keeps the original name and adds a duplicate marker. Example: Project Plan.md -> Project Plan (1).md.",requiresExistingFile:!1,resolutionKind:"createNew"},{id:"doNothing",category:"keep",label:"Do nothing",description:"Leaves the file unchanged and opens the existing file.",requiresExistingFile:!0,resolutionKind:"reuseExisting"}],Ile=new Map(VR.map(r=>[r.id,r])),Ple={update:"appendBottom",create:"duplicateSuffix",keep:"doNothing"},Oj={"Append to the bottom of the file":"appendBottom","Append to the top of the file":"appendTop","Overwrite the file":"overwrite","Increment the file name":"increment","Append duplicate suffix":"duplicateSuffix",Nothing:"doNothing",appendBottom:"appendBottom",appendTop:"appendTop",overwrite:"overwrite",increment:"increment",duplicateSuffix:"duplicateSuffix",doNothing:"doNothing"},Fle={increment:Mle,duplicateSuffix:Rle};function Ch(r){let e=Ile.get(r);if(!e)throw new Error(`Unknown file exists mode: ${r}`);return e}function Lj(r){return VR.filter(e=>e.category===r)}function Bj(r){return Ch(r).category}function Uj(){return[...VR]}function Vj(r){return r.kind==="prompt"?"prompt":Bj(r.mode)}function qj(r,e){return r==="prompt"?{kind:"prompt"}:e?.kind==="apply"&&Bj(e.mode)===r?e:{kind:"apply",mode:Ple[r]}}function Wj(r){return typeof r!="string"||!Object.prototype.hasOwnProperty.call(Oj,r)?null:Oj[r]??null}async function zj(r,e,t){return await Fle[e](r,t)}async function Mle(r,e){let t=r;for(;await e(t);){let{basename:n,extension:i}=Hj(t),o=n.match(/^(.*?)(\d+)$/);t=`${o?`${o[1]}${String(BigInt(o[2])+1n).padStart(o[2].length,"0")}`:`${n}1`}${i}`}return t}async function Rle(r,e){let t=r;for(;await e(t);){let{basename:n,extension:i}=Hj(t),o=n.match(/^(.*) \((\d+)\)$/);t=`${o?`${o[1]} (${String(BigInt(o[2])+1n)})`:`${n} (1)`}${i}`}return t}function Hj(r){return Wr.test(r)?{basename:r.replace(Wr,""),extension:".canvas"}:Vi.test(r)?{basename:r.replace(Vi,""),extension:".base"}:{basename:r.replace(ir,""),extension:".md"}}Me();qt();ml();var VA=class extends hn{constructor(t,n,i,o){super(t,n);this.app=t;this.inputEl=n;this.suggestItems=i;this.currentItems=o}updateCurrentItems(t){this.currentItems=t}getSuggestions(t){return this.suggestItems.filter(n=>n.contains(t))}selectSuggestion(t){this.inputEl.value=t,this.inputEl.trigger("input"),this.close()}renderSuggestion(t,n){t&&n.setText(t)}};function qA(r){let e=t=>t.stopPropagation();return r.addEventListener("mousedown",e),r.addEventListener("touchstart",e,{passive:!0}),{destroy(){r.removeEventListener("mousedown",e),r.removeEventListener("touchstart",e)}}}var $le=W('<button type="button"><!></button>');function er(r,e){let t=he(e,"size",3,16),n=he(e,"extraClass",3,""),i=he(e,"disabled",3,!1);var o=$le();let s;var a=I(o);Rt(a,{get iconId(){return e.iconId},get size(){return t()}}),S(o),Fr(o,l=>qA?.(l)),de(()=>{s=Ct(o,1,`qa-icon-button ${n()}`,null,s,{"is-pressed":e.ariaPressed===!0}),ke(o,"aria-label",e.label),ke(o,"aria-pressed",e.ariaPressed),ke(o,"aria-haspopup",e.ariaHasPopup),ke(o,"title",e.title),o.disabled=i()}),De("click",o,function(...l){e.onclick?.apply(this,l)}),$(r,o)}Et(["click"]);var Ole=W('<div class="quickAddCommandListItem svelte-ee11ws"><span> </span> <!></div>'),Nle=W('<div class="quickAddFolderListGrid quickAddCommandList svelte-ee11ws"></div>'),Lle={hash:"svelte-ee11ws",code:`.quickAddCommandListItem.svelte-ee11ws {display:flex;align-items:center;justify-content:space-between;}
|
||
|
||
@media (min-width: 768px) {.quickAddFolderListGrid.svelte-ee11ws {display:grid;grid-template-columns:repeat(2, 1fr);column-gap:20px;}
|
||
}.quickAddCommandList.svelte-ee11ws {max-width:50%;margin:12px auto;}`};function qR(r,e){we(e,!0),ot(r,Lle);var t=Nle();ar(t,20,()=>e.folders,n=>n,(n,i)=>{var o=Ole(),s=I(o),a=I(s,!0);S(s);var l=A(s,2);{let c=N(()=>`Remove folder ${i}`);er(l,{iconId:"trash-2",get label(){return h(c)},onclick:()=>e.deleteFolder(i)})}S(o),de(()=>me(a,i)),$(n,o)}),S(t),$(r,t),Ce()}function jj(r){return r.enabled?r.chooseWhenCreatingNote?"prompt":r.createInSameFolderAsActiveFile?"active-file":"specified":"obsidian-default"}function Gj(r,e){switch(e){case"obsidian-default":return{...r,enabled:!1,chooseWhenCreatingNote:!1,createInSameFolderAsActiveFile:!1};case"specified":return{...r,enabled:!0,chooseWhenCreatingNote:!1,createInSameFolderAsActiveFile:!1};case"active-file":return{...r,enabled:!0,createInSameFolderAsActiveFile:!0,chooseWhenCreatingNote:!1};case"prompt":return{...r,enabled:!0,chooseWhenCreatingNote:!0,createInSameFolderAsActiveFile:!1}}}var Yj=[{value:"obsidian-default",label:"Obsidian default"},{value:"specified",label:"In a specific folder"},{value:"active-file",label:"Same folder as current file"},{value:"prompt",label:"Ask for folder each time"}],Kj={"obsidian-default":"Use Obsidian's \u201CDefault location for new notes\u201D setting.",specified:"Create the note in the folder(s) below. With multiple folders, you'll be asked which one when the note is created.","active-file":"Create the note next to the currently active file (falls back to the vault root if no file is open).",prompt:"Choose any folder in the vault when the note is created."};Tt();Tt();function WA(r,e){if(!r.fileNameFormat?.enabled)return!0;let t=e.trim().toLowerCase();return t===Rs.toLowerCase()||t===q2.toLowerCase()}function WR(r,e){return r.discoverExistingNotesBeforeCreate===!0&&WA(r,e)}function zR(r,e,t){return!(!WR(r,e)||t!=null)}Tt();function zA(r){if(!r?.enabled||r.chooseWhenCreatingNote||r.chooseFromSubfolders||r.createInSameFolderAsActiveFile)return;let e=r.folders??[];if(e.length!==1)return;let t=e[0]?.trim();if(t&&!t.includes("{{")&&!uc.test(t))return t}var Ble=W("<!> <!> <!>",1),Ule=W(`<div class="qa-folder-mode-warning">Add at least one folder. With none, the note falls back to the active
|
||
file's folder (or you'll be prompted to pick one if no file is open).</div>`),Vle=W('<div class="folderSelectionContainer"><div class="folderList"><!></div> <div class="folderInputContainer"><input type="text" class="qa-folder-path-input" placeholder="Folder path" aria-label="Folder path"/> <button type="button" class="mod-cta">Add</button></div></div> <!> <!>',1),qle=W("<!> <!> <!> <!> <!> <!> <!> <!> <!> <!> <!> <!> <!> <!> <!> <!> <!> <!>",1);function HR(r,e){we(e,!0);let t=he(e,"choice",15),n=N(()=>e.plugin.getTemplateFiles().map(ye=>ye.path)),i=N(()=>Oc(Ls(e.app)));function o(ye){let We=ye.trim();return We?_u(We)?{valid:!0,message:"Contains format syntax \u2014 resolved at run time."}:fo(e.app,We)!==null||"Template not found":!0}let s=[ye=>new Hi(e.app,ye,e.plugin,"fileName")],a=N(()=>WA(t(),t().fileNameFormat.enabled?t().fileNameFormat.format:Rs)),l=N(()=>h(a)?"For the default note-title prompt, show matching notes first. Choosing one opens it unchanged; choosing the create row continues with this template.":"Only available when the file name prompt is the default note title: no custom format, {{VALUE}}, or {{NAME}}."),c=N(()=>jj(t().folder)),u=N(()=>Kj[h(c)]),d=N(()=>h(c)==="specified"&&t().folder.folders.length===0);function f(ye){t(t().folder=Gj(t().folder,ye),!0)}let p=Ae(""),m;function v(ye){return m=new VA(e.app,ye,h(i),t().folder.folders),m}hr(()=>{m?.updateCurrentItems(t().folder.folders)});function g(){let ye=h(p).trim();if(ye){if(t().folder.folders.some(We=>We===ye)){F.logWarning("cannot add same folder twice.");return}t().folder.folders.push(ye),Z(p,"")}}function y(ye){t(t().folder.folders=t().folder.folders.filter(We=>We!==ye),!0)}function w(ye){ye.key==="Enter"&&g()}let x=N(()=>Vj(t().fileExistsBehavior)),C=N(()=>h(x)!=="prompt"&&h(x)!=="keep"),_=N(()=>Lj(h(x)==="update"?"update":"create")),E=N(()=>t().fileExistsBehavior.kind==="apply"?t().fileExistsBehavior.mode:h(_)[0].id);function D(ye){t(t().fileExistsBehavior=qj(ye,t().fileExistsBehavior),!0)}function P(ye){t(t().fileExistsBehavior={kind:"apply",mode:ye},!0)}var H=qle(),V=Pe(H);hy(V,{get app(){return e.app},get name(){return t().name},set name(ye){t(t().name=ye,!0)}});var oe=A(V,2);$e(oe,{name:"Template",heading:!0});var ce=A(oe,2);ss(ce,{name:"Template path",desc:"Path to the template this choice creates notes from.",children:(We,ht=Vt)=>{xi(We,{get id(){return ht()},get value(){return t().templatePath},placeholder:"Template path",get app(){return e.app},get suggestions(){return h(n)},maxSuggestions:50,validator:o,onChange:He=>t(t().templatePath=He.trim(),!0)})},$$slots:{default:!0}});var R=A(ce,2);ss(R,{name:"File name format",desc:"Set the file name format. When off, QuickAdd asks for the note title.",get bodyVisible(){return t().fileNameFormat.enabled},control:ht=>{lr(ht,{get checked(){return t().fileNameFormat.enabled},set checked(He){t(t().fileNameFormat.enabled=He,!0)}})},children:(ht,He=Vt)=>{var _e=Ble(),Be=Pe(_e);xi(Be,{get id(){return He()},placeholder:"File name format",get makeSuggesters(){return s},get value(){return t().fileNameFormat.format},set value(yr){t(t().fileNameFormat.format=yr,!0)}});var ut=A(Be,2);qp(ut,{get value(){return t().fileNameFormat.format}});var or=A(ut,2);{let yr=N(()=>zA(t().folder));hs(or,{get value(){return t().fileNameFormat.format},formatterKind:"fileName",get targetFolderPath(){return h(yr)},get app(){return e.app},get plugin(){return e.plugin}})}$(ht,_e)},$$slots:{control:!0,default:!0}});var O=A(R,2);$e(O,{name:"Location",heading:!0});var q=A(O,2);$e(q,{name:"New note location",get desc(){return h(u)},control:We=>{Jt(We,{get value(){return h(c)},get options(){return Yj},ariaLabel:"New note location",onchange:f})},$$slots:{control:!0}});var B=A(q,2);{var ie=ye=>{var We=Vle(),ht=Pe(We),He=I(ht),_e=I(He);qR(_e,{get folders(){return t().folder.folders},deleteFolder:y}),S(He);var Be=A(He,2),ut=I(Be);gr(ut),un(()=>uo(ut,()=>h(p),ur=>Z(p,ur))),Fr(ut,(ur,dt)=>hp?.(ur,dt),()=>v);var or=A(ut,2);S(Be),S(ht);var yr=A(ht,2);{var Pt=ur=>{var dt=Ule();$(ur,dt)};ne(yr,ur=>{h(d)&&ur(Pt)})}var Ar=A(yr,2);$e(Ar,{name:"Include subfolders",desc:"Get prompted to choose from both the selected folders and their subfolders when creating the note.",control:dt=>{lr(dt,{get checked(){return t().folder.chooseFromSubfolders},set checked(Ft){t(t().folder.chooseFromSubfolders=Ft,!0)}})},$$slots:{control:!0}}),ic("keypress",ut,w),De("click",or,g),$(ye,We)};ne(B,ye=>{h(c)==="specified"&&ye(ie)})}var j=A(B,2);$e(j,{name:"Linking",heading:!0});var Y=A(j,2);QC(Y,{fileLabel:"created",get app(){return e.app},get appendLink(){return t().appendLink},set appendLink(ye){t(t().appendLink=ye,!0)}});var K=A(Y,2);$e(K,{name:"Copy link to clipboard",desc:"Copy a link to the created file after the Template choice runs.",control:We=>{{let ht=N(()=>t().copyLinkToClipboard??!1);lr(We,{get checked(){return h(ht)},onchange:He=>t(t().copyLinkToClipboard=He,!0)})}},$$slots:{control:!0}});var se=A(K,2);$e(se,{name:"Behavior",heading:!0});var pe=A(se,2);$e(pe,{name:"Search existing notes before creating",get desc(){return h(l)},control:We=>{{let ht=N(()=>h(a)?t().discoverExistingNotesBeforeCreate??!1:!1),He=N(()=>!h(a));lr(We,{get checked(){return h(ht)},get disabled(){return h(He)},onchange:_e=>t(t().discoverExistingNotesBeforeCreate=_e,!0)})}},$$slots:{control:!0}});var ge=A(pe,2);$e(ge,{name:"If the target file already exists",desc:"Choose whether QuickAdd should ask what to do, update the existing file, create another file, or keep the existing file.",control:We=>{{let ht=N(()=>Nj.map(He=>({value:He.id,label:He.label})));Jt(We,{get value(){return h(x)},get options(){return h(ht)},onchange:D})}},$$slots:{control:!0}});var be=A(ge,2);{var xe=ye=>{{let We=_e=>{{let Be=N(()=>h(_).map(ut=>({value:ut.id,label:ut.label})));Jt(_e,{get value(){return h(E)},get options(){return h(Be)},onchange:P})}},ht=N(()=>h(x)==="update"?"Update action":"New file naming"),He=N(()=>Ch(h(E)).description);$e(ye,{get name(){return h(ht)},get desc(){return h(He)},control:We,$$slots:{control:!0}})}};ne(be,ye=>{h(C)&&ye(xe)})}var Ue=A(be,2);XC(Ue,{description:"Open the created file.",get openFile(){return t().openFile},set openFile(ye){t(t().openFile=ye,!0)}});var $t=A(Ue,2);{var Ne=ye=>{ZC(ye,{contextLabel:"created",get fileOpening(){return t().fileOpening},set fileOpening(We){t(t().fileOpening=We,!0)}})};ne($t,ye=>{t().openFile&&ye(Ne)})}var Ke=A($t,2);JC(Ke,{get onePageInput(){return t().onePageInput},set onePageInput(ye){t(t().onePageInput=ye,!0)}});var Xe=A(Ke,2);nx(Xe,{get type(){return t().type},get app(){return e.app},get icon(){return t().icon},set icon(ye){t(t().icon=ye,!0)}}),$(r,H),Ce()}Et(["click"]);function Qj(r){return wt({...r,choice:ma(r.choice)})}var xh=class extends bh{constructor(t,n,i){super(t);this.plugin=i;this.choice=n,this.normalizeChoice(),this.display()}normalizeChoice(){var t,n,i,o,s,a,l,c,u,d,f;(t=this.choice).fileExistsBehavior??(t.fileExistsBehavior={kind:"prompt"}),this.choice.fileOpening=pn(this.choice.fileOpening),(n=this.choice).templatePath??(n.templatePath=""),(i=this.choice).fileNameFormat??(i.fileNameFormat={enabled:!1,format:""}),(o=this.choice.fileNameFormat).enabled??(o.enabled=!1),(s=this.choice.fileNameFormat).format??(s.format=""),(a=this.choice).folder??(a.folder={enabled:!1,folders:[],chooseWhenCreatingNote:!1,createInSameFolderAsActiveFile:!1,chooseFromSubfolders:!1}),(l=this.choice.folder).enabled??(l.enabled=!1),(c=this.choice.folder).folders??(c.folders=[]),(u=this.choice.folder).chooseWhenCreatingNote??(u.chooseWhenCreatingNote=!1),(d=this.choice.folder).createInSameFolderAsActiveFile??(d.createInSameFolderAsActiveFile=!1),(f=this.choice.folder).chooseFromSubfolders??(f.chooseFromSubfolders=!1)}display(){this.containerEl.addClass("templateChoiceBuilder"),this.formProps=Qj({choice:this.choice,app:this.app,plugin:this.plugin});let t=qi(this.contentEl,HR,this.formProps,{what:"this template choice's settings"});t.ok||(this.formProps=void 0),this.svelteElements.push(t)}getResultChoice(){return this.formProps?.choice??this.choice}};Wp();var qk=require("obsidian");Hs();var Fi=require("obsidian");var rY=require("obsidian");function Zj(r,e){var t=Object.keys(r);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(r);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(r,i).enumerable})),t.push.apply(t,n)}return t}function ux(r){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?Zj(Object(t),!0).forEach(function(n){Sh(r,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(t)):Zj(Object(t)).forEach(function(n){Object.defineProperty(r,n,Object.getOwnPropertyDescriptor(t,n))})}return r}function Eh(r){"@babel/helpers - typeof";return Eh=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Eh(r)}function Sh(r,e,t){return e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function zle(r,e){if(r==null)return{};var t={},n=Object.keys(r),i,o;for(o=0;o<n.length;o++)i=n[o],!(e.indexOf(i)>=0)&&(t[i]=r[i]);return t}function Hle(r,e){if(r==null)return{};var t=zle(r,e),n,i;if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(r);for(i=0;i<o.length;i++)n=o[i],!(e.indexOf(n)>=0)&&Object.prototype.propertyIsEnumerable.call(r,n)&&(t[n]=r[n])}return t}function jle(r,e){return Yle(r)||Qle(r,e)||n$(r,e)||Zle()}function ea(r){return Gle(r)||Kle(r)||n$(r)||Xle()}function Gle(r){if(Array.isArray(r))return YR(r)}function Yle(r){if(Array.isArray(r))return r}function Kle(r){if(typeof Symbol<"u"&&r[Symbol.iterator]!=null||r["@@iterator"]!=null)return Array.from(r)}function Qle(r,e){var t=r==null?null:typeof Symbol<"u"&&r[Symbol.iterator]||r["@@iterator"];if(t!=null){var n=[],i=!0,o=!1,s,a;try{for(t=t.call(r);!(i=(s=t.next()).done)&&(n.push(s.value),!(e&&n.length===e));i=!0);}catch(l){o=!0,a=l}finally{try{!i&&t.return!=null&&t.return()}finally{if(o)throw a}}return n}}function n$(r,e){if(r){if(typeof r=="string")return YR(r,e);var t=Object.prototype.toString.call(r).slice(8,-1);if(t==="Object"&&r.constructor&&(t=r.constructor.name),t==="Map"||t==="Set")return Array.from(r);if(t==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t))return YR(r,e)}}function YR(r,e){(e==null||e>r.length)&&(e=r.length);for(var t=0,n=new Array(e);t<e;t++)n[t]=r[t];return n}function Xle(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
|
||
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Zle(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
|
||
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function jp(r,e){var t=typeof Symbol<"u"&&r[Symbol.iterator]||r["@@iterator"];if(!t){if(Array.isArray(r)||(t=n$(r))||e&&r&&typeof r.length=="number"){t&&(r=t);var n=0,i=function(){};return{s:i,n:function(){return n>=r.length?{done:!0}:{done:!1,value:r[n++]}},e:function(l){throw l},f:i}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
|
||
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var o=!0,s=!1,a;return{s:function(){t=t.call(r)},n:function(){var l=t.next();return o=l.done,l},e:function(l){s=!0,a=l},f:function(){try{!o&&t.return!=null&&t.return()}finally{if(s)throw a}}}}var Jle="finalize",ece="consider";function Dh(r,e,t){r.dispatchEvent(new CustomEvent(Jle,{detail:{items:e,info:t}}))}function Ju(r,e,t){r.dispatchEvent(new CustomEvent(ece,{detail:{items:e,info:t}}))}var tk="draggedEntered",px="draggedLeft",rk="draggedOverIndex",i$="draggedLeftDocument",YA={LEFT_FOR_ANOTHER:"leftForAnother",OUTSIDE_OF_ANY:"outsideOfAny"};function tce(r,e,t){r.dispatchEvent(new CustomEvent(tk,{detail:{indexObj:e,draggedEl:t}}))}function rce(r,e,t){r.dispatchEvent(new CustomEvent(px,{detail:{draggedEl:e,type:YA.LEFT_FOR_ANOTHER,theOtherDz:t}}))}function nce(r,e){r.dispatchEvent(new CustomEvent(px,{detail:{draggedEl:e,type:YA.OUTSIDE_OF_ANY}}))}function ice(r,e,t){r.dispatchEvent(new CustomEvent(rk,{detail:{indexObj:e,draggedEl:t}}))}function oce(r){window.dispatchEvent(new CustomEvent(i$,{detail:{draggedEl:r}}))}var Ai={DRAG_STARTED:"dragStarted",DRAGGED_ENTERED:tk,DRAGGED_ENTERED_ANOTHER:"dragEnteredAnother",DRAGGED_OVER_INDEX:rk,DRAGGED_LEFT:px,DRAGGED_LEFT_ALL:"draggedLeftAll",DROPPED_INTO_ZONE:"droppedIntoZone",DROPPED_INTO_ANOTHER:"droppedIntoAnother",DROPPED_OUTSIDE_OF_ANY:"droppedOutsideOfAny",DRAG_STOPPED:"dragStopped"},Zi={POINTER:"pointer",KEYBOARD:"keyboard"},sce={space:[" "],enter:["Enter"],space_or_enter:[" ","Enter"]},uG="space_or_enter",ace={space:"space-bar",enter:"enter",space_or_enter:"space-bar or enter"},nk="isDndShadowItem",ik="data-is-dnd-shadow-item-internal",lce="data-is-dnd-shadow-item-hint",ok="id:dnd-shadow-placeholder-0000",cce="dnd-action-dragged-el",Lr="id",KR=0;function dG(){KR++}function pG(){if(KR===0)throw new Error("Bug! trying to decrement when there are no dropzones");KR--}var o$=typeof window>"u",mt=function(){};function QR(r){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0,t,n=e?pce(r):r.getBoundingClientRect(),i=getComputedStyle(r),o=i.transform;if(o){var s,a,l,c;if(o.startsWith("matrix3d("))t=o.slice(9,-1).split(/, /),s=+t[0],a=+t[5],l=+t[12],c=+t[13];else if(o.startsWith("matrix("))t=o.slice(7,-1).split(/, /),s=+t[0],a=+t[3],l=+t[4],c=+t[5];else return n;var u=i.transformOrigin,d=n.x-l-(1-s)*parseFloat(u),f=n.y-c-(1-a)*parseFloat(u.slice(u.indexOf(" ")+1)),p=s?n.width/s:r.offsetWidth,m=a?n.height/a:r.offsetHeight;return{x:d,y:f,width:p,height:m,top:f,right:d+p,bottom:f+m,left:d}}else return n}function XR(r){var e=QR(r);return{top:e.top+window.scrollY,bottom:e.bottom+window.scrollY,left:e.left+window.scrollX,right:e.right+window.scrollX}}function fG(r){var e=r.getBoundingClientRect();return{top:e.top+window.scrollY,bottom:e.bottom+window.scrollY,left:e.left+window.scrollX,right:e.right+window.scrollX}}function mG(r){return{x:(r.left+r.right)/2,y:(r.top+r.bottom)/2}}function uce(r,e){return Math.sqrt(Math.pow(r.x-e.x,2)+Math.pow(r.y-e.y,2))}function lx(r,e){return r.y<=e.bottom&&r.y>=e.top&&r.x>=e.left&&r.x<=e.right}function hG(r){return mG(fG(r))}function Jj(r,e){var t=hG(e);return uce(r,t)}function dce(r){var e=fG(r);return e.right<0||e.left>document.documentElement.scrollWidth||e.bottom<0||e.top>document.documentElement.scrollHeight}function pce(r){for(var e=r.getBoundingClientRect(),t={top:e.top,bottom:e.bottom,left:e.left,right:e.right},n=!1,i=!1,o=r.parentElement;o&&o!==document.body;){var s=window.getComputedStyle(o),a=s.overflowY,l=s.overflowX,c=a==="scroll"||a==="auto",u=l==="scroll"||l==="auto";if(c||u){var d=o.getBoundingClientRect();if(c){var f=Math.max(t.top,d.top),p=Math.min(t.bottom,d.bottom);(f!==t.top||p!==t.bottom)&&(n=!0),t.top=f,t.bottom=p}if(u){var m=Math.max(t.left,d.left),v=Math.min(t.right,d.right);(m!==t.left||v!==t.right)&&(i=!0),t.left=m,t.right=v}}o=o.parentElement}return n||i?{top:t.top,bottom:t.bottom,left:t.left,right:t.right,width:Math.max(0,t.right-t.left),height:Math.max(0,t.bottom-t.top)}:{top:e.top,bottom:e.bottom,left:e.left,right:e.right,width:Math.max(0,e.right-e.left),height:Math.max(0,e.bottom-e.top)}}var _h;function s$(){mt(function(){return"resetting indexes cache"}),_h=new Map}s$();function fce(r){var e=Array.from(r.children).findIndex(function(t){return t.getAttribute(ik)});if(e>=0)return _h.has(r)||_h.set(r,new Map),_h.get(r).set(e,XR(r.children[e])),e}function mce(r,e){var t=XR(e);if(!lx(r,t))return null;var n=e.children;if(n.length===0)return{index:0,isProximityBased:!0};for(var i=fce(e),o=0;o<n.length;o++){var s=XR(n[o]);if(lx(r,s)){var a=_h.has(e)&&_h.get(e).get(o);return a&&!lx(r,a)?{index:i,isProximityBased:!1}:{index:o,isProximityBased:!1}}}for(var l=Number.MAX_VALUE,c=void 0,u=0;u<n.length;u++){var d=Jj(r,n[u]);d<l&&(l=d,c=u)}if(n.length>0){var f=n.length,p=n[f-1],m=p.cloneNode(!1);m.style.visibility="hidden",m.style.pointerEvents="none",e.appendChild(m);var v=Jj(r,m);v<l&&(c=f),e.removeChild(m)}return{index:c,isProximityBased:!0}}function Na(r){return JSON.stringify(r,null,2)}function KA(r){if(!r)throw new Error("cannot get depth of a falsy node");return gG(r,0)}function gG(r){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0;return r.parentElement?gG(r.parentElement,e+1):e-1}function hce(r,e){if(Object.keys(r).length!==Object.keys(e).length)return!1;for(var t in r)if(!{}.hasOwnProperty.call(e,t)||e[t]!==r[t])return!1;return!0}function gce(r,e){if(r.length!==e.length)return!1;for(var t=0;t<r.length;t++)if(r[t]!==e[t])return!1;return!0}var vce=200,eG=10,ZR;function yce(r,e){var t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:vce,n=arguments.length>3?arguments[3]:void 0,i=arguments.length>4?arguments[4]:void 0,o,s,a=!1,l,c=Array.from(e).sort(function(d,f){return KA(f)-KA(d)});function u(){var d=i(),f=n.multiScrollIfNeeded();if(!f&&l&&Math.abs(l.x-d.x)<eG&&Math.abs(l.y-d.y)<eG){ZR=window.setTimeout(u,t);return}if(dce(r)){mt(function(){return"off document"}),oce(r);return}l=d;var p=!1,m=jp(c),v;try{for(m.s();!(v=m.n()).done;){var g=v.value;f&&s$();var y=mce(d,g);if(y!==null){var w=y.index;p=!0,g!==o?(o&&rce(o,r,g),tce(g,y,r),o=g):w!==s&&(ice(g,y,r),s=w);break}}}catch(x){m.e(x)}finally{m.f()}!p&&a&&o?(nce(o,r),o=void 0,s=void 0,a=!1):a=!0,ZR=window.setTimeout(u,t)}u()}function bce(){mt(function(){return"unobserving"}),clearTimeout(ZR),s$()}var ox=30;function wce(){var r;function e(){r={directionObj:void 0,stepPx:0}}e();function t(o){var s=r,a=s.directionObj,l=s.stepPx;a&&(o.scrollBy(a.x*l,a.y*l),window.requestAnimationFrame(function(){return t(o)}))}function n(o){return ox-o}function i(o,s){if(!s)return!1;var a=Cce(o,s),l=!!r.directionObj;if(a===null)return l&&e(),!1;var c=!1,u=!1;return s.scrollHeight>s.clientHeight&&(a.bottom<ox?(c=!0,r.directionObj={x:0,y:1},r.stepPx=n(a.bottom)):a.top<ox&&(c=!0,r.directionObj={x:0,y:-1},r.stepPx=n(a.top)),!l&&c)||s.scrollWidth>s.clientWidth&&(a.right<ox?(u=!0,r.directionObj={x:1,y:0},r.stepPx=n(a.right)):a.left<ox&&(u=!0,r.directionObj={x:-1,y:0},r.stepPx=n(a.left)),!l&&u)?(t(s),!0):(e(),!1)}return{scrollIfNeeded:i,resetScrolling:e}}function Cce(r,e){var t=e===document.scrollingElement?{top:0,bottom:window.innerHeight,left:0,right:window.innerWidth}:e.getBoundingClientRect();return lx(r,t)?{top:r.y-t.top,bottom:t.bottom-r.y,left:r.x-t.left,right:t.right-r.x}:null}function xce(){var r=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],e=arguments.length>1?arguments[1]:void 0;mt(function(){return"creating multi-scroller"});var t=Tce(r),n=Array.from(t).sort(function(l,c){return KA(c)-KA(l)}),i=wce(),o=i.scrollIfNeeded,s=i.resetScrolling;function a(){var l=e();if(!l||!n)return!1;for(var c=n.filter(function(f){return lx(l,f.getBoundingClientRect())||f===document.scrollingElement}),u=0;u<c.length;u++){var d=o(l,c[u]);if(d)return!0}return!1}return{multiScrollIfNeeded:t.size>0?a:function(){return!1},destroy:function(){return s()}}}function Ece(r){if(!r)return[];for(var e=[],t=r;t;){var n=window.getComputedStyle(t),i=n.overflow;i.split(" ").some(function(o){return o.includes("auto")||o.includes("scroll")})&&e.push(t),t=t.parentElement}return e}function Tce(r){var e=new Set,t=jp(r),n;try{for(t.s();!(n=t.n()).done;){var i=n.value;Ece(i).forEach(function(o){return e.add(o)})}}catch(o){t.e(o)}finally{t.f()}return(document.scrollingElement.scrollHeight>document.scrollingElement.clientHeight||document.scrollingElement.scrollWidth>document.scrollingElement.clientHeight)&&e.add(document.scrollingElement),e}function _ce(r){var e=r.cloneNode(!0),t=[],n=r.tagName==="SELECT",i=n?[r]:ea(r.querySelectorAll("select")),o=jp(i),s;try{for(o.s();!(s=o.n()).done;){var a=s.value;t.push(a.value)}}catch(x){o.e(x)}finally{o.f()}if(i.length>0)for(var l=n?[e]:ea(e.querySelectorAll("select")),c=0;c<l.length;c++){var u=l[c],d=t[c],f=u.querySelector('option[value="'.concat(d,'"'));f&&f.setAttribute("selected",!0)}var p=r.tagName==="CANVAS",m=p?[r]:ea(r.querySelectorAll("canvas"));if(m.length>0)for(var v=p?[e]:ea(e.querySelectorAll("canvas")),g=0;g<v.length;g++){var y=m[g],w=v[g];w.width=y.width,w.height=y.height,y.width>0&&y.height>0&&w.getContext("2d").drawImage(y,0,0)}return e}var dx=Object.freeze({USE_COMPUTED_STYLE_INSTEAD_OF_BOUNDING_RECT:"USE_COMPUTED_STYLE_INSTEAD_OF_BOUNDING_RECT"}),Ace=Sh({},dx.USE_COMPUTED_STYLE_INSTEAD_OF_BOUNDING_RECT,!1);function vG(r){if(!dx[r])throw new Error("Can't get non existing feature flag ".concat(r,"! Supported flags: ").concat(Object.keys(dx)));return Ace[r]}var kce=.2;function zp(r){return"".concat(r," ").concat(kce,"s ease")}function yG(r){var e=r.style.transitionProperty.split(",").map(function(t){return t.trim()});e.includes("all")||(e.includes("width")||(r.style.transition+=", ".concat(zp("width"))),e.includes("height")||(r.style.transition+=", ".concat(zp("height"))))}function Sce(r,e){var t=r.getBoundingClientRect(),n=_ce(r);bG(r,n),n.id=cce,n.style.position="fixed";var i=t.top,o=t.left;if(n.style.top="".concat(i,"px"),n.style.left="".concat(o,"px"),e){var s=mG(t);i-=s.y-e.y,o-=s.x-e.x,window.setTimeout(function(){n.style.top="".concat(i,"px"),n.style.left="".concat(o,"px")},0)}return n.style.margin="0",n.style.boxSizing="border-box",n.style.height="".concat(t.height,"px"),n.style.width="".concat(t.width,"px"),n.style.transition="".concat(zp("top"),", ").concat(zp("left"),", ").concat(zp("background-color"),", ").concat(zp("opacity"),", ").concat(zp("color")," "),window.setTimeout(function(){return yG(n)},0),n.style.zIndex="9999",n.style.cursor="grabbing",n}function Dce(r){r.style.cursor="grab"}function Ice(r,e,t,n){yG(r),bG(e,r);var i=e.getBoundingClientRect(),o=r.getBoundingClientRect(),s=window.getComputedStyle(r),a=parseFloat(s.left),l=parseFloat(s.top),c=i.width-o.width,u=i.height-o.height;if(c||u){var d={left:o.width?(t-o.left)/o.width:0,top:o.height?(n-o.top)/o.height:0};vG(dx.USE_COMPUTED_STYLE_INSTEAD_OF_BOUNDING_RECT)||(r.style.height="".concat(i.height,"px"),r.style.width="".concat(i.width,"px")),r.style.left="".concat(a-d.left*c,"px"),r.style.top="".concat(l-d.top*u,"px")}}function bG(r,e){var t=window.getComputedStyle(r);Array.from(t).filter(function(n){return n.startsWith("background")||n.startsWith("padding")||n.startsWith("font")||n.startsWith("text")||n.startsWith("align")||n.startsWith("justify")||n.startsWith("display")||n.startsWith("flex")||n.startsWith("border")||n==="opacity"||n==="color"||n==="list-style-type"||vG(dx.USE_COMPUTED_STYLE_INSTEAD_OF_BOUNDING_RECT)&&(n==="width"||n==="height")}).forEach(function(n){return e.style.setProperty(n,t.getPropertyValue(n),t.getPropertyPriority(n))})}function Pce(r,e){r.draggable=!1,r.ondragstart=function(){return!1},e?(r.style.userSelect="",r.style.WebkitUserSelect="",r.style.cursor=""):(r.style.userSelect="none",r.style.WebkitUserSelect="none",r.style.cursor="grab")}function wG(r){r.style.display="none",r.style.position="fixed",r.style.zIndex="-5"}function Fce(r){r.style.visibility="hidden",r.setAttribute(ik,"true")}function Mce(r){r.style.visibility="",r.removeAttribute(ik)}function GA(r){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:function(){},t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:function(){return[]};r.forEach(function(n){var i=e(n);Object.keys(i).forEach(function(o){n.style[o]=i[o]}),t(n).forEach(function(o){return n.classList.add(o)})})}function QA(r){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:function(){},t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:function(){return[]};r.forEach(function(n){var i=e(n);Object.keys(i).forEach(function(o){n.style[o]=""}),t(n).forEach(function(o){return n.classList.contains(o)&&n.classList.remove(o)})})}function Rce(r){var e=r.style.minHeight;r.style.minHeight=window.getComputedStyle(r).getPropertyValue("height");var t=r.style.minWidth;return r.style.minWidth=window.getComputedStyle(r).getPropertyValue("width"),function(){r.style.minHeight=e,r.style.minWidth=t}}var $ce="--any--",Oce=100,Nce=20,HA=3,Lce=80,tG={outline:"rgba(255, 255, 102, 0.7) solid 2px"},rG="data-is-dnd-original-dragged-item",_i,xn,Bo,a$,Or,sk,Zu,ui,Dl,ci,Nc=!1,XA=!1,l$,fx=!1,Th=[],cx,Il,ax=!1,c$=!1,Sl,Qu=new Set,Lc=new Map,an=new Map,sx=new WeakMap;function Bce(r,e){mt(function(){return"registering drop-zone if absent"}),Lc.has(e)||Lc.set(e,new Set),Lc.get(e).has(r)||(Lc.get(e).add(r),dG())}function nG(r,e){var t=Lc.get(e);!t||!t.delete(r)||(pG(),t.size===0&&Lc.delete(e))}function Uce(){mt(function(){return"watching dragged element"});var r=Lc.get(a$);if(!(!r||r.size===0)){Qu.size>0&&JR(),Qu=new Set(r);var e=jp(Qu),t;try{for(e.s();!(t=e.n()).done;){var n=t.value;n.addEventListener(tk,CG),n.addEventListener(px,xG),n.addEventListener(rk,EG)}}catch(a){e.e(a)}finally{e.f()}window.addEventListener(i$,Ih);var i=Math.max.apply(Math,ea(Array.from(Qu).map(function(a){return an.get(a).dropAnimationDurationMs}))),o=i===0?Nce:Math.max(i,Oce);cx=xce(Qu,function(){return ci});var s=c$?function(){return{x:ci.x+window.scrollX,y:ci.y+window.scrollY}}:function(){return hG(xn)};yce(xn,Qu,o*1.07,cx,s)}}function JR(){mt(function(){return"unwatching dragged element"});var r=jp(Qu),e;try{for(r.s();!(e=r.n()).done;){var t=e.value;t.removeEventListener(tk,CG),t.removeEventListener(px,xG),t.removeEventListener(rk,EG)}}catch(n){r.e(n)}finally{r.f()}Qu=new Set,window.removeEventListener(i$,Ih),cx&&(cx.destroy(),cx=void 0),bce()}function ak(r){return r.findIndex(function(e){return!!e[nk]})}function Vce(r){var e;return ux(ux({},r),{},(e={},Sh(e,nk,!0),Sh(e,Lr,ok),e))}function CG(r){mt(function(){return["dragged entered",r.currentTarget,r.detail]});var e=an.get(r.currentTarget),t=e.items,n=e.dropFromOthersDisabled;if(n&&r.currentTarget!==Or){mt(function(){return"ignoring dragged entered because drop is currently disabled"});return}if(fx=!1,t=t.filter(function(a){return a[Lr]!==Zu[Lr]&&a[Lr]!==ok}),mt(function(){return"dragged entered items ".concat(Na(t))}),Or!==r.currentTarget){var i=an.get(Or).items,o=i.filter(function(a){return!a[nk]});Ju(Or,o,{trigger:Ai.DRAGGED_ENTERED_ANOTHER,id:Bo[Lr],source:Zi.POINTER})}var s=r.detail.indexObj.index;ui=r.currentTarget,t.splice(s,0,Zu),Ju(r.currentTarget,t,{trigger:Ai.DRAGGED_ENTERED,id:Bo[Lr],source:Zi.POINTER})}function xG(r){if(Nc){mt(function(){return["dragged left",r.currentTarget,r.detail]});var e=an.get(r.currentTarget),t=e.items,n=e.dropFromOthersDisabled;if(n&&r.currentTarget!==Or&&r.currentTarget!==ui){mt(function(){return"drop is currently disabled"});return}var i=ea(t),o=ak(i);o!==-1&&i.splice(o,1);var s=ui;ui=void 0;var a=r.detail,l=a.type,c=a.theOtherDz;if(l===YA.OUTSIDE_OF_ANY||l===YA.LEFT_FOR_ANOTHER&&c!==Or&&an.get(c).dropFromOthersDisabled){mt(function(){return"dragged left all, putting shadow element back in the origin dz"}),fx=!0,ui=Or;var u=s===Or?i:ea(an.get(Or).items);u.splice(sk,0,Zu),Ju(Or,u,{trigger:Ai.DRAGGED_LEFT_ALL,id:Bo[Lr],source:Zi.POINTER})}Ju(r.currentTarget,i,{trigger:Ai.DRAGGED_LEFT,id:Bo[Lr],source:Zi.POINTER})}}function EG(r){mt(function(){return["dragged is over index",r.currentTarget,r.detail]});var e=an.get(r.currentTarget),t=e.items,n=e.dropFromOthersDisabled;if(n&&r.currentTarget!==Or){mt(function(){return"drop is currently disabled"});return}var i=ea(t);fx=!1;var o=r.detail.indexObj.index,s=ak(i);s!==-1&&i.splice(s,1),i.splice(o,0,Zu),Ju(r.currentTarget,i,{trigger:Ai.DRAGGED_OVER_INDEX,id:Bo[Lr],source:Zi.POINTER})}function ZA(r){r.preventDefault();var e=r.touches?r.touches[0]:r;ci={x:e.clientX,y:e.clientY},xn.style.transform="translate3d(".concat(ci.x-Dl.x,"px, ").concat(ci.y-Dl.y,"px, 0)")}function Ih(){mt(function(){return"dropped"}),XA=!0,window.removeEventListener("mousemove",ZA),window.removeEventListener("touchmove",ZA),window.removeEventListener("mouseup",Ih),window.removeEventListener("touchend",Ih),JR(),Dce(xn),ui||(mt(function(){return"element was dropped right after it left origin but before entering somewhere else"}),ui=Or),mt(function(){return["dropped in dz",ui]});var r=an.get(ui),e=r.items,t=r.type;QA(Lc.get(t),function(o){return an.get(o).dropTargetStyle},function(o){return an.get(o).dropTargetClasses});var n=ak(e);n===-1&&ui===Or&&(n=sk),e=e.map(function(o){return o[nk]?Bo:o});function i(){JR(),l$(),Dh(ui,e,{trigger:fx?Ai.DROPPED_OUTSIDE_OF_ANY:Ai.DROPPED_INTO_ZONE,id:Bo[Lr],source:Zi.POINTER}),ui!==Or&&Dh(Or,an.get(Or).items,{trigger:Ai.DROPPED_INTO_ANOTHER,id:Bo[Lr],source:Zi.POINTER});var o=Array.from(ui.children).find(function(s){return s.getAttribute(ik)});o&&Mce(o),zce()}an.get(ui).dropAnimationDisabled?i():qce(n,i)}function qce(r,e){var t=r>-1?QR(ui.children[r],!1):QR(ui,!1),n={x:t.left-parseFloat(xn.style.left),y:t.top-parseFloat(xn.style.top)},i=an.get(ui),o=i.dropAnimationDurationMs,s="transform ".concat(o,"ms ease");xn.style.transition=xn.style.transition?xn.style.transition+","+s:s,xn.style.transform="translate3d(".concat(n.x,"px, ").concat(n.y,"px, 0)"),window.setTimeout(e,o)}function Wce(r,e){var t={dz:r,destroy:e};Th.push(t),window.requestAnimationFrame(function(){Th.includes(t)&&(wG(r),document.body.appendChild(r))})}function zce(){xn&&xn.remove&&xn.remove(),_i&&_i.remove&&_i.remove(),xn=void 0,_i=void 0,Bo=void 0,a$=void 0,Or=void 0,sk=void 0,Zu=void 0,ui=void 0,Dl=void 0,ci=void 0,Nc=!1,XA=!1,l$=void 0,fx=!1,Il&&clearTimeout(Il),Il=void 0,ax=!1,c$=!1,Sl=void 0,Th.length&&(mt(function(){return["will destroy zones that were removed during drag",Th]}),Th.forEach(function(r){var e=r.dz,t=r.destroy;t(),e.remove()}),Th=[])}function Hce(r,e){var t=!1,n=!1,i={items:void 0,type:void 0,flipDurationMs:0,dragDisabled:!1,morphDisabled:!1,dropFromOthersDisabled:!1,dropTargetStyle:tG,dropTargetClasses:[],transformDraggedElement:function(){},centreDraggedOnCursor:!1,useCursorForDetection:!1,dropAnimationDisabled:!1,delayTouchStartMs:0};mt(function(){return["dndzone good to go options: ".concat(Na(e),", config: ").concat(Na(i)),{node:r}]});var o=new Map;function s(){window.addEventListener("mousemove",u,{passive:!1}),window.addEventListener("touchmove",u,{passive:!1,capture:!1}),window.addEventListener("mouseup",c,{passive:!1}),window.addEventListener("touchend",c,{passive:!1})}function a(){window.removeEventListener("mousemove",u),window.removeEventListener("touchmove",u),window.removeEventListener("mouseup",c),window.removeEventListener("touchend",c),Il&&(clearTimeout(Il),Il=void 0,ax=!1)}function l(){Sl===r&&(a(),Sl=void 0,_i=void 0,Dl=void 0,ci=void 0)}function c(m){if(Sl===r&&(l(),m.type==="touchend")){var v=new Event("click",{bubbles:!0,cancelable:!0});m.target.dispatchEvent(v)}}function u(m){if(!(n||Sl!==r)){var v=!!m.touches,g=v?m.touches[0]:m;if(v&&i.delayTouchStartMs>0&&!ax){ci={x:g.clientX,y:g.clientY},(Math.abs(ci.x-Dl.x)>=HA||Math.abs(ci.y-Dl.y)>=HA)&&(Il&&(clearTimeout(Il),Il=void 0),c(m));return}m.preventDefault(),ci={x:g.clientX,y:g.clientY},(Math.abs(ci.x-Dl.x)>=HA||Math.abs(ci.y-Dl.y)>=HA)&&f()}}function d(m){if(m.target!==m.currentTarget&&(m.target.value!==void 0||m.target.isContentEditable)){mt(function(){return"won't initiate drag on a nested input element"});return}if(m.button){mt(function(){return"ignoring none left click button: ".concat(m.button)});return}if(n||Nc||Sl){mt(function(){return"cannot start a new drag before finalizing the current drag or pending gesture"});return}var v=!!m.touches,g=v&&i.delayTouchStartMs>0;g||m.preventDefault(),m.stopPropagation(),Sl=r;var y=v?m.touches[0]:m;if(Dl={x:y.clientX,y:y.clientY},ci=ux({},Dl),_i=m.currentTarget,g){var w=_i;ax=!1,Il=window.setTimeout(function(){n||Sl!==r||_i!==w||(ax=!0,f())},i.delayTouchStartMs)}s()}function f(){var m;if(n||Sl!==r||Nc||!((m=_i)!==null&&m!==void 0&&m.parentElement)){l();return}a(),Sl=void 0,mt(function(){return["drag start config: ".concat(Na(i)),_i]}),Nc=!0;var v=o.get(_i);sk=v,Or=_i.parentElement;var g=Or.closest("dialog")||Or.closest("[popover]")||Or.getRootNode(),y=g.body||g,w=i.items,x=i.type,C=i.centreDraggedOnCursor,_=i.useCursorForDetection,E=ea(w);Bo=E[v],a$=x,Zu=Vce(Bo),c$=_,xn=Sce(_i,C&&ci),y.appendChild(xn);function D(){!xn||XA||(_i.parentElement?window.requestAnimationFrame(D):(_i.setAttribute(rG,!0),y.appendChild(_i),Uce(),wG(_i),Zu[Lr]=Bo[Lr],xn.focus()))}window.requestAnimationFrame(D),GA(Array.from(Lc.get(i.type)).filter(function(P){return P===Or||!an.get(P).dropFromOthersDisabled}),function(P){return an.get(P).dropTargetStyle},function(P){return an.get(P).dropTargetClasses}),E.splice(v,1,Zu),l$=Rce(Or),Ju(Or,E,{trigger:Ai.DRAG_STARTED,id:Bo[Lr],source:Zi.POINTER}),window.addEventListener("mousemove",ZA,{passive:!1}),window.addEventListener("touchmove",ZA,{passive:!1,capture:!1}),window.addEventListener("mouseup",Ih,{passive:!1}),window.addEventListener("touchend",Ih,{passive:!1})}function p(m){var v=m.items,g=v===void 0?void 0:v,y=m.flipDurationMs,w=y===void 0?0:y,x=m.type,C=x===void 0?$ce:x,_=m.dragDisabled,E=_===void 0?!1:_,D=m.morphDisabled,P=D===void 0?!1:D,H=m.dropFromOthersDisabled,V=H===void 0?!1:H,oe=m.dropTargetStyle,ce=oe===void 0?tG:oe,R=m.dropTargetClasses,O=R===void 0?[]:R,q=m.transformDraggedElement,B=q===void 0?function(){}:q,ie=m.centreDraggedOnCursor,j=ie===void 0?!1:ie,Y=m.useCursorForDetection,K=Y===void 0?!1:Y,se=m.dropAnimationDisabled,pe=se===void 0?!1:se,ge=m.delayTouchStart,be=ge===void 0?!1:ge;i.dropAnimationDurationMs=w;var xe=0;be===!0?xe=Lce:typeof be=="number"&&isFinite(be)&&be>=0&&(xe=be),i.delayTouchStartMs=xe,i.type&&C!==i.type&&nG(r,i.type),i.type=C,i.items=ea(g),i.dragDisabled=E,i.morphDisabled=P,i.transformDraggedElement=B,i.centreDraggedOnCursor=j,i.useCursorForDetection=K,i.dropAnimationDisabled=pe,t&&Nc&&!XA&&(!hce(ce,i.dropTargetStyle)||!gce(O,i.dropTargetClasses))&&(QA([r],function(){return i.dropTargetStyle},function(){return O}),GA([r],function(){return ce},function(){return O})),i.dropTargetStyle=ce,i.dropTargetClasses=ea(O);function Ue(Xe,ye){return an.get(Xe)?an.get(Xe)[ye]:i[ye]}t&&Nc&&i.dropFromOthersDisabled!==V&&(V?QA([r],function(Xe){return Ue(Xe,"dropTargetStyle")},function(Xe){return Ue(Xe,"dropTargetClasses")}):GA([r],function(Xe){return Ue(Xe,"dropTargetStyle")},function(Xe){return Ue(Xe,"dropTargetClasses")})),i.dropFromOthersDisabled=V,an.set(r,i),Bce(r,C);for(var $t=Nc?ak(i.items):-1,Ne=0;Ne<r.children.length;Ne++){var Ke=r.children[Ne];if(Pce(Ke,E),Ne===$t){P||Ice(xn,Ke,ci.x,ci.y),i.transformDraggedElement(xn,Bo,Ne),Fce(Ke);continue}Ke.removeEventListener("mousedown",sx.get(Ke)),Ke.removeEventListener("touchstart",sx.get(Ke)),E||(Ke.addEventListener("mousedown",d),Ke.addEventListener("touchstart",d),sx.set(Ke,d)),o.set(Ke,Ne),t||(t=!0)}}return p(e),{update:function(v){mt(function(){return"pointer dndzone will update newOptions: ".concat(Na(v))}),p(v)},destroy:function(){if(n)return;n=!0,l();var v=jp(r.children),g;try{for(v.s();!(g=v.n()).done;){var y=g.value;y.removeEventListener("mousedown",sx.get(y)),y.removeEventListener("touchstart",sx.get(y))}}catch(x){v.e(x)}finally{v.f()}function w(){mt(function(){return"pointer dndzone will destroy"});var x=an.get(r);x&&(nG(r,x.type),an.delete(r))}Nc&&!r.closest("[".concat(rG,"]"))?(mt(function(){return"pointer dndzone will be scheduled for destruction"}),Wce(r,w)):w()}}}var jA,e$={DND_ZONE_ACTIVE:"dnd-zone-active",DND_ZONE_DRAG_DISABLED:"dnd-zone-drag-disabled"},TG=(jA={},Sh(jA,e$.DND_ZONE_ACTIVE,"zoneActiveInstruction"),Sh(jA,e$.DND_ZONE_DRAG_DISABLED,"zoneDragDisabledInstruction"),jA),_G={dragStarted:function(e){var t=e.itemLabel,n=e.zoneLabel,i=e.canMoveBetweenZones;return"Started dragging item ".concat(t,". Use the arrow keys to move it within its list ").concat(n)+(i?", or tab to another list in order to move the item into it":"")},movedToPosition:function(e){var t=e.itemLabel,n=e.zoneLabel,i=e.position;return"Moved item ".concat(t," to position ").concat(i," in the list ").concat(n)},movedToZoneEnd:function(e){var t=e.itemLabel,n=e.zoneLabel;return"Moved item ".concat(t," to the end of the list ").concat(n)},movedToZoneStart:function(e){var t=e.itemLabel,n=e.zoneLabel;return"Moved item ".concat(t," to the beginning of the list ").concat(n)},dropped:function(e){var t=e.itemLabel;return"Stopped dragging item ".concat(t)},zoneActiveInstruction:function(e){var t=e.keyboardDragTrigger;return"Tab to one the items and press ".concat(ace[t]," to start dragging it")},zoneDragDisabledInstruction:"This is a disabled drag and drop list"};var jce=ux({},_G),Gce={keyboardDragTrigger:uG},Yce="dnd-action-aria-alert",Cn;function t$(){Cn||(Cn=document.createElement("div"),(function(){Cn.id=Yce,Cn.style.position="fixed",Cn.style.bottom="0",Cn.style.left="0",Cn.style.zIndex="-5",Cn.style.opacity="0",Cn.style.height="0",Cn.style.width="0",Cn.setAttribute("role","alert")})(),document.body.prepend(Cn),Object.entries(TG).forEach(function(r){var e=jle(r,2),t=e[0],n=e[1];return document.body.prepend(Xce(t,AG(n,Gce)))}))}function Kce(){return o$?null:(document.readyState==="complete"?t$():window.addEventListener("DOMContentLoaded",t$),ux({},e$))}function Qce(){o$||!Cn||(Object.keys(TG).forEach(function(r){var e;return(e=document.getElementById(r))===null||e===void 0?void 0:e.remove()}),Cn.remove(),Cn=void 0)}function Xce(r,e){var t=document.createElement("div");return t.id=r,Zce(t,e),t.style.display="none",t.style.position="fixed",t.style.zIndex="-5",t}function Zce(r,e){r.replaceChildren();var t=document.createElement("p");t.textContent=e,r.appendChild(t)}function mx(r){if(!o$){Cn||t$(),Cn.innerHTML="";var e=document.createTextNode(r);Cn.appendChild(e),Cn.style.display="none",Cn.style.display="inline"}}function iG(r,e,t){var n=r[e];return typeof n=="function"?n(t):n}function AG(r,e){try{return iG(jce,r,e)}catch(t){mt(function(){return['aria string formatter for "'.concat(r,'" threw, falling back to the default'),t]});try{return iG(_G,r,e)}catch(n){return mt(function(){return['default aria string formatter for "'.concat(r,'" also threw'),n]}),""}}}function Ah(r,e){mx(AG(r,e))}var Jce=uG;function eue(r){return sce[Jce].includes(r)}var tue="--any--",oG={outline:"rgba(255, 255, 102, 0.7) solid 2px"},Lo=!1,kh,Xi,Pl="",Hp,gs,Xu="",JA=new WeakSet,jR=new WeakMap,GR=new WeakMap,r$=new Map,Wn=new Map,Fl=new Map,ek;function rue(r,e){mt(function(){return"registering drop-zone if absent"}),Fl.size===0&&(mt(function(){return"adding global keydown and click handlers"}),ek=Kce(),window.addEventListener("keydown",kG),window.addEventListener("click",SG)),Fl.has(e)||Fl.set(e,new Set),Fl.get(e).has(r)||(Fl.get(e).add(r),dG())}function sG(r,e){mt(function(){return"unregistering drop-zone"}),Lo&&Xi===r&&Ph();var t=Fl.get(e);!t||!t.delete(r)||(pG(),t.size===0&&Fl.delete(e),Fl.size===0&&(mt(function(){return"removing global keydown and click handlers"}),window.removeEventListener("keydown",kG),window.removeEventListener("click",SG),ek=void 0,Qce()))}function kG(r){Lo&&r.key==="Escape"&&Ph()}function SG(){Lo&&(JA.has(document.activeElement)||(mt(function(){return"clicked outside of any draggable"}),Ph()))}function DG(r,e){return r===Xi||Hp.contains(r)||e.dropFromOthersDisabled||e.type!==kh?-1:0}function nue(){Wn.forEach(function(r,e){e.tabIndex=DG(e,r)})}function iue(){var r=Wn.get(Xi);return r!=null&&r.items.some(function(e){return e[Lr]===gs})?!0:(mt(function(){return"dragged item is gone, dropping"}),Ph(),!1)}function aG(r){if(mt(function(){return"zone focus"}),!!Lo){var e=r.currentTarget;if(e!==Xi&&iue()){Pl=e.getAttribute("aria-label")||"";var t=Wn.get(Xi),n=t.items,i=n.find(function(f){return f[Lr]===gs}),o=n.indexOf(i),s=n.splice(o,1)[0],a=Wn.get(e),l=a.items,c=a.autoAriaDisabled;e.getBoundingClientRect().top<Xi.getBoundingClientRect().top||e.getBoundingClientRect().left<Xi.getBoundingClientRect().left?(l.push(s),c||Ah("movedToZoneEnd",{itemLabel:Xu,zoneLabel:Pl,position:l.length,count:l.length})):(l.unshift(s),c||Ah("movedToZoneStart",{itemLabel:Xu,zoneLabel:Pl,position:1,count:l.length}));var u=Xi,d=gs;Xi=e,Dh(u,n,{trigger:Ai.DROPPED_INTO_ANOTHER,id:d,source:Zi.KEYBOARD}),Wn.has(e)&&Dh(e,l,{trigger:Ai.DROPPED_INTO_ZONE,id:d,source:Zi.KEYBOARD})}}}function IG(){r$.forEach(function(r,e){var t=r.update;return t(Wn.get(e))})}function Ph(){var r=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!0;if(!(!Lo||!Xi)){mt(function(){return"drop"});var e=Xi,t=Wn.get(e),n=gs,i=kh;if(t){if(!t.autoAriaDisabled){var o=t.items,s=o.findIndex(function(l){return l[Lr]===n});Ah("dropped",{itemLabel:Xu,zoneLabel:Pl,position:(s<0?0:s)+1,count:o.length})}JA.has(document.activeElement)&&document.activeElement.blur(),Hp=null,gs=null,Xu="",kh=null,Xi=null,Pl="",Lo=!1,r&&Ju(e,t.items,{trigger:Ai.DRAG_STOPPED,id:n,source:Zi.KEYBOARD});var a=Fl.get(i);a&&QA(a,function(l){return Wn.get(l).dropTargetStyle},function(l){return Wn.get(l).dropTargetClasses}),IG()}}}function oue(r,e){var t=!1,n={items:void 0,type:void 0,dragDisabled:!1,zoneTabIndex:0,zoneItemTabIndex:0,dropFromOthersDisabled:!1,dropTargetStyle:oG,dropTargetClasses:[],autoAriaDisabled:!1};function i(d,f,p){d.length<=1||d.splice(p,1,d.splice(f,1,d[p])[0])}function o(d){switch(mt(function(){return["handling key down",d.key]}),d.key){case"Enter":case" ":{if(!eue(d.key)||(d.target.disabled!==void 0||d.target.href||d.target.isContentEditable)&&!JA.has(d.target))return;d.preventDefault(),d.stopPropagation(),Lo?Ph():s(d);break}case"ArrowDown":case"ArrowRight":{if(!Lo)return;d.preventDefault(),d.stopPropagation();var f=Wn.get(r),p=f.items,m=Array.from(r.children),v=m.indexOf(d.currentTarget);mt(function(){return["arrow down",v]}),v<m.length-1&&(n.autoAriaDisabled||Ah("movedToPosition",{itemLabel:Xu,zoneLabel:Pl,position:v+2,count:p.length}),i(p,v,v+1),Dh(r,p,{trigger:Ai.DROPPED_INTO_ZONE,id:gs,source:Zi.KEYBOARD}));break}case"ArrowUp":case"ArrowLeft":{if(!Lo)return;d.preventDefault(),d.stopPropagation();var g=Wn.get(r),y=g.items,w=Array.from(r.children),x=w.indexOf(d.currentTarget);mt(function(){return["arrow up",x]}),x>0&&(n.autoAriaDisabled||Ah("movedToPosition",{itemLabel:Xu,zoneLabel:Pl,position:x,count:y.length}),i(y,x,x-1),Dh(r,y,{trigger:Ai.DROPPED_INTO_ZONE,id:gs,source:Zi.KEYBOARD}));break}}}function s(d){mt(function(){return"drag start"}),l(d.currentTarget),Xi=r,Pl=r.getAttribute("aria-label")||"",kh=n.type,Lo=!0;var f=Array.from(Fl.get(n.type)).filter(function(v){return v===Xi||!Wn.get(v).dropFromOthersDisabled});if(GA(f,function(v){return Wn.get(v).dropTargetStyle},function(v){return Wn.get(v).dropTargetClasses}),!n.autoAriaDisabled){var p=Wn.get(r).items,m=p.findIndex(function(v){return v[Lr]===gs});Ah("dragStarted",{itemLabel:Xu,zoneLabel:Pl,position:(m<0?0:m)+1,count:p.length,canMoveBetweenZones:f.length>1})}Ju(r,Wn.get(r).items,{trigger:Ai.DRAG_STARTED,id:gs,source:Zi.KEYBOARD}),IG()}function a(d){Lo&&d.currentTarget!==Hp&&(d.stopPropagation(),Ph(!1),s(d))}function l(d){var f=Wn.get(r),p=f.items,m=Array.from(r.children),v=m.indexOf(d);Hp=d,Hp.tabIndex=n.zoneItemTabIndex,gs=p[v][Lr],Xu=m[v].getAttribute("aria-label")||""}function c(d){var f=d.items,p=f===void 0?[]:f,m=d.type,v=m===void 0?tue:m,g=d.dragDisabled,y=g===void 0?!1:g,w=d.zoneTabIndex,x=w===void 0?0:w,C=d.zoneItemTabIndex,_=C===void 0?0:C,E=d.dropFromOthersDisabled,D=E===void 0?!1:E,P=d.dropTargetStyle,H=P===void 0?oG:P,V=d.dropTargetClasses,oe=V===void 0?[]:V,ce=d.autoAriaDisabled,R=ce===void 0?!1:ce;n.items=ea(p),n.dragDisabled=y,n.dropFromOthersDisabled=D,n.zoneTabIndex=x,n.zoneItemTabIndex=_,n.dropTargetStyle=H,n.dropTargetClasses=oe,n.autoAriaDisabled=R,n.type&&v!==n.type&&sG(r,n.type),n.type=v,rue(r,v),R||(r.setAttribute("role","list"),r.setAttribute("aria-describedby",y?ek.DND_ZONE_DRAG_DISABLED:ek.DND_ZONE_ACTIVE)),Wn.set(r,n);var O=!1;Lo?(O=n.type===kh&&n.items.some(function(ie){return ie[Lr]===gs})&&r!==Xi,O&&(Xi=r,Pl=r.getAttribute("aria-label")||""),r.tabIndex=DG(r,n)):r.tabIndex=n.zoneTabIndex,r.addEventListener("focus",aG);for(var q=function(j){var Y,K=r.children[j];JA.add(K),K.tabIndex=Lo?-1:n.zoneItemTabIndex,R||K.setAttribute("role","listitem"),K.removeEventListener("keydown",jR.get(K)),K.removeEventListener("click",GR.get(K)),y||(K.addEventListener("keydown",o),jR.set(K,o),K.addEventListener("click",a),GR.set(K,a)),Lo&&n.type===kh&&((Y=n.items[j])===null||Y===void 0?void 0:Y[Lr])===gs&&(mt(function(){return["focusing on",{i:j,focusedItemId:gs}]}),Hp=K,Hp.tabIndex=n.zoneItemTabIndex,K.focus())},B=0;B<r.children.length;B++)q(B);O&&nue()}c(e);var u={update:function(f){mt(function(){return"keyboard dndzone will update newOptions: ".concat(Na(f))}),c(f)},destroy:function(){if(!t){t=!0,mt(function(){return"keyboard dndzone will destroy"}),r.removeEventListener("focus",aG);var f=jp(r.children),p;try{for(f.s();!(p=f.n()).done;){var m=p.value;m.removeEventListener("keydown",jR.get(m)),m.removeEventListener("click",GR.get(m))}}catch(v){f.e(v)}finally{f.f()}sG(r,n.type),Wn.delete(r),r$.delete(r)}}};return r$.set(r,u),u}var sue=["items","flipDurationMs","type","dragDisabled","morphDisabled","dropFromOthersDisabled","zoneTabIndex","zoneItemTabIndex","dropTargetStyle","dropTargetClasses","transformDraggedElement","autoAriaDisabled","centreDraggedOnCursor","useCursorForDetection","delayTouchStart","dropAnimationDisabled"];function lk(r,e){if(aue(r))return{update:function(){},destroy:function(){}};lG(e);var t=Hce(r,e),n=oue(r,e);return{update:function(o){lG(o),t.update(o),n.update(o)},destroy:function(){t.destroy(),n.destroy()}}}function aue(r){return!!r.closest("[".concat(lce,'="true"]'))}function lG(r){var e=r.items;r.flipDurationMs,r.type,r.dragDisabled,r.morphDisabled,r.dropFromOthersDisabled;var t=r.zoneTabIndex,n=r.zoneItemTabIndex;r.dropTargetStyle;var i=r.dropTargetClasses;r.transformDraggedElement,r.autoAriaDisabled,r.centreDraggedOnCursor,r.useCursorForDetection;var o=r.delayTouchStart;r.dropAnimationDisabled;var s=Hle(r,sue);if(Object.keys(s).length>0&&console.warn("dndzone will ignore unknown options",s),!e)throw new Error("no 'items' key provided to dndzone");var a=e.find(function(u){return!{}.hasOwnProperty.call(u,Lr)});if(a)throw new Error("missing '".concat(Lr,"' property for item ").concat(Na(a)));if(i&&!Array.isArray(i))throw new Error("dropTargetClasses should be an array but instead it is a ".concat(Eh(i),", ").concat(Na(i)));if(t&&!cG(t))throw new Error("zoneTabIndex should be a number but instead it is a ".concat(Eh(t),", ").concat(Na(t)));if(n&&!cG(n))throw new Error("zoneItemTabIndex should be a number but instead it is a ".concat(Eh(n),", ").concat(Na(n)));if(o!==void 0&&o!==!1){var l=o===!0,c=typeof o=="number"&&isFinite(o)&&o>=0;if(!l&&!c)throw new Error("delayTouchStart should be a boolean (true/false) or a non-negative number but instead it is a ".concat(Eh(o),", ").concat(Na(o)))}}function cG(r){return!isNaN(r)&&(function(e){return(e|0)===e})(parseFloat(r))}function PG(r){var e=r,t=new Set;return{get:function(){return e},set:function(i){e=i,Array.from(t).forEach(function(o){return o(e)})},subscribe:function(i){t.add(i),i(e)},unsubscribe:function(i){t.delete(i)}}}var oit=PG(!0),sit=PG(!1);var lue=[[9,5],[9,12],[9,19],[15,5],[15,12],[15,19]];function FG(r,e,t=!1){if(!r)return;r.classList.add("qa-drag-clone"),r.dataset.qaMulti=t?"true":"false";let n=r.querySelector(":scope > .qa-drag-pill");if(!n){n=r.createDiv({cls:"qa-drag-pill"});let s=n.createSpan({cls:"qa-drag-pill-grip"}).createSvg("svg",{attr:{viewBox:"0 0 24 24",width:14,height:14,fill:"none",stroke:"currentColor","stroke-width":2,"stroke-linecap":"round","stroke-linejoin":"round"}});for(let[a,l]of lue)s.createSvg("circle",{attr:{cx:a,cy:l,r:1}});n.createSpan({cls:"qa-drag-pill-label"})}let i=n.querySelector(".qa-drag-pill-label");i&&i.textContent!==e&&(i.textContent=e)}function Ml(r){return r.filter(e=>e.id!==ok)}function MG(r,e){return r.map(t=>t.id===e.id?e:t)}function ck(r){let e=r.resolveLabel??(t=>t.name??"");return{items:r.items,dragDisabled:r.dragDisabled,flipDurationMs:r.flipDurationMs??0,morphDisabled:!0,useCursorForDetection:!0,centreDraggedOnCursor:!1,transformDraggedElement:(t,n)=>FG(t,n?e(n):"",n?.type==="Multi"),dropTargetStyle:{},dropTargetClasses:r.dropTargetClasses??[],autoAriaDisabled:!0,zoneItemTabIndex:-1,delayTouchStart:200,...r.type?{type:r.type}:{}}}function uk(){let r=Ae(!1),e=!1;function t(){Z(r,!0),e=!1;let n=()=>{window.removeEventListener("pointerup",n,!0),window.removeEventListener("pointercancel",n,!0),e||Z(r,!1)};window.addEventListener("pointerup",n,!0),window.addEventListener("pointercancel",n,!0)}return{get armed(){return h(r)},markStarted(){e=!0},reset(){Z(r,!1),e=!1},startDrag:t}}gl();Kr();Rm();function Gp(r){if(r.type==="Choice")try{return ni().getChoiceById(r.choiceId).name}catch{return"(missing choice)"}if(r.type==="Conditional"){let e=r.condition;return`If ${Mm(e)}`}return r.name}var cue=W('<button type="button"><!></button>');function ki(r,e){we(e,!0);let t=he(e,"size",3,16),n=N(()=>!!(e.onMoveUp||e.onMoveDown));function i(l){l.key==="ArrowUp"&&e.onMoveUp?(l.preventDefault(),l.stopPropagation(),e.onMoveUp()):l.key==="ArrowDown"&&e.onMoveDown&&(l.preventDefault(),l.stopPropagation(),e.onMoveDown())}var o=cue();let s;var a=I(o);Rt(a,{iconId:"grip-vertical",get size(){return t()}}),S(o),de(()=>{s=Ct(o,1,"qa-icon-button qa-drag-handle",null,s,{"qa-drag-handle-ready":e.dragDisabled,"qa-drag-handle-active":!e.dragDisabled}),ke(o,"aria-label",e.label),ke(o,"aria-keyshortcuts",h(n)?"ArrowUp ArrowDown":void 0),ke(o,"tabindex",e.dragDisabled?0:-1)}),De("pointerdown",o,()=>e.onDragStart()),De("keydown",o,i),$(r,o),Ce()}Et(["pointerdown","keydown"]);var uue=W('<li class="quickAddCommandListItem"><span class="quickAddCommandLabel"> </span> <div class="quickAddCommandControls"><!> <!></div></li>');function u$(r,e){we(e,!0);var t=uue(),n=I(t),i=I(n,!0);S(n);var o=A(n,2),s=I(o);{let l=N(()=>`Delete ${Gp(e.command)}`);er(s,{iconId:"trash-2",get label(){return h(l)},extraClass:"clickable",onclick:()=>e.onDeleteCommand(e.command.id)})}var a=A(s,2);{let l=N(()=>`Reorder ${Gp(e.command)}`);ki(a,{get label(){return h(l)},get dragDisabled(){return e.dragDisabled},get onDragStart(){return e.startDrag},get onMoveUp(){return e.onMoveUp},get onMoveDown(){return e.onMoveDown}})}S(o),S(t),de(l=>me(i,l),[()=>Gp(e.command)]),$(r,t),Ce()}Kr();var due=W('<li class="quickAddCommandListItem"><span class="quickAddCommandLabel"> <input type="number" min="0" placeholder=" " class="dotInput svelte-1h5tx3b" aria-label="Wait duration in milliseconds"/>ms</span> <div class="quickAddCommandControls"><!> <!></div></li>'),pue={hash:"svelte-1h5tx3b",code:".dotInput.svelte-1h5tx3b {border:none;display:inline;font-family:inherit;font-size:inherit;padding:0;width:var(--qa-wait-input-width, 2ch);text-decoration:underline dotted;background-color:transparent;}.dotInput.svelte-1h5tx3b:hover {background-color:transparent;}"};function d$(r,e){we(e,!0),ot(r,pue);let t=Ae(void 0),n=Ae(wt(Ot(()=>e.command.time)));function i(){if(!h(t))return;let p=String(h(t).value).length;h(t).style.setProperty("--qa-wait-input-width",`${p===0?2:p}ch`)}function o(p){let m=p.currentTarget.valueAsNumber;Z(n,Number.isNaN(m)||m<0?0:m,!0),i(),e.onUpdateCommand({...e.command,time:h(n)})}gT(i);var s=due(),a=I(s),l=I(a),c=A(l);gr(c),oc(c,p=>Z(t,p),()=>h(t)),Pn(),S(a);var u=A(a,2),d=I(u);{let p=N(()=>`Delete ${e.command.name}`);er(d,{iconId:"trash-2",get label(){return h(p)},extraClass:"clickable",onclick:()=>e.onDeleteCommand(e.command.id)})}var f=A(d,2);{let p=N(()=>`Reorder ${e.command.name}`);ki(f,{get label(){return h(p)},get dragDisabled(){return e.dragDisabled},get onDragStart(){return e.startDrag},get onMoveUp(){return e.onMoveUp},get onMoveDown(){return e.onMoveDown}})}S(u),S(s),de(()=>{me(l,`${e.command.name??""} for `),Fs(c,h(n))}),De("input",c,o),$(r,s),Ce()}Et(["input"]);var fue=W('<li class="quickAddCommandListItem"><span class="quickAddCommandLabel"> </span> <div class="quickAddCommandControls"><!> <!> <!></div></li>');function p$(r,e){we(e,!0);var t=fue(),n=I(t),i=I(n,!0);S(n);var o=A(n,2),s=I(o);{let c=N(()=>`Configure ${e.command.name}`);er(s,{iconId:"settings",get label(){return h(c)},extraClass:"clickable",onclick:()=>e.onConfigureChoice(e.command)})}var a=A(s,2);{let c=N(()=>`Delete ${e.command.name}`);er(a,{iconId:"trash-2",get label(){return h(c)},extraClass:"clickable",onclick:()=>e.onDeleteCommand(e.command.id)})}var l=A(a,2);{let c=N(()=>`Reorder ${e.command.name}`);ki(l,{get label(){return h(c)},get dragDisabled(){return e.dragDisabled},get onDragStart(){return e.startDrag},get onMoveUp(){return e.onMoveUp},get onMoveDown(){return e.onMoveDown}})}S(o),S(t),de(()=>me(i,e.command.name)),$(r,t),Ce()}var mue=W('<li class="quickAddCommandListItem"><span class="quickAddCommandLabel"> </span> <div class="quickAddCommandControls"><!> <!> <!></div></li>');function f$(r,e){we(e,!0);var t=mue(),n=I(t),i=I(n,!0);S(n);var o=A(n,2),s=I(o);{let c=N(()=>`Configure ${e.command.name}`);er(s,{iconId:"settings",get label(){return h(c)},extraClass:"clickable",onclick:()=>e.onConfigureScript(e.command)})}var a=A(s,2);{let c=N(()=>`Delete ${e.command.name}`);er(a,{iconId:"trash-2",get label(){return h(c)},extraClass:"clickable",onclick:()=>e.onDeleteCommand(e.command.id)})}var l=A(a,2);{let c=N(()=>`Reorder ${e.command.name}`);ki(l,{get label(){return h(c)},get dragDisabled(){return e.dragDisabled},get onDragStart(){return e.startDrag},get onMoveUp(){return e.onMoveUp},get onMoveDown(){return e.onMoveDown}})}S(o),S(t),de(()=>me(i,e.command.name)),$(r,t),Ce()}var Pi=require("obsidian");gl();function RG(r,e){let t=r.ownerDocument.createElement("div");t.className="qa-format-preview-host",r.appendChild(t);let n=wt({value:e.value,app:e.app,plugin:e.plugin,targetFolderPath:null}),i=qi(t,hs,n,{what:"the preview for this field"}),o=!1;return{setValue(s){o||(n.value=s)},destroy(){o||(o=!0,i.destroy(),t.remove())}}}function $G(r){r.addEventListener("focus",()=>{r.type="text"}),r.addEventListener("blur",()=>{r.type="password"}),r.type="password"}wk();Bc();function Pue(r){return typeof r=="string"?r:r==null?"":String(r)}function jG(r){if(typeof r=="string")return r;if(r==null)return"";if(typeof r=="number"||typeof r=="boolean")return String(r);try{return JSON.stringify(r)??String(r)}catch{return String(r)}}var Ck=class extends Pi.Modal{constructor(t,n,i,o){super(t);this.command=n;this.settings=i;this.onCommandChange=o;this.previewHandles=[];this.command.settings||(this.command.settings={}),Lh(this.command.settings,this.settings),this.display(),this.migrateSecretSettings()}display(){this.containerEl.addClass("quickAddModal","userScriptSettingsModal"),this.destroyPreviews(),this.contentEl.empty();let t=jG(this.settings?.name??this.command.name),n=jG(this.settings?.author);this.titleEl.innerText=`${t}${n?` by ${n}`:""}`;let i=this.settings.options;if(i)for(let o in i){if(!Object.prototype.hasOwnProperty.call(i,o))continue;let s=i[o];if($h(s)){let u=this.addSecretInput(o,"placeholder"in s?s.placeholder:void 0);s.description&&u.setDesc(s.description);continue}let a=s.defaultValue;this.command.settings[o]!==void 0&&(a=this.command.settings[o]);let l,c=s.type;c==="text"||c==="input"?l=this.addInputBox(o,a,s?.placeholder,s.secret):c==="textarea"?l=this.addTextArea(o,a,s?.placeholder):c==="checkbox"||c==="toggle"?l=this.addToggle(o,a):c==="dropdown"||c==="select"?l=this.addDropdown(o,s.options,a):c==="format"&&(l=this.addFormatInput(o,a,s.placeholder)),s.description&&l&&l.setDesc(s.description)}}addInputBox(t,n,i,o){return new Pi.Setting(this.contentEl).setName(t).addText(s=>{s.setValue(n).onChange(a=>{this.command.settings[t]=a,this.onCommandChange?.()}).setPlaceholder(i??""),o&&$G(s.inputEl)})}addSecretInput(t,n){let i=new Pi.Setting(this.contentEl).setName(t),o="",s,a=()=>{let c=this.command.settings?.[t];return bk(this.command,t)!==void 0||typeof c=="string"&&c.length>0},l=()=>{s&&(s.placeholder=a()?"Secret saved":n??"Paste secret")};return i.addText(c=>{c.setValue("").onChange(u=>{o=u}),c.inputEl.type="password",c.inputEl.addClass("qa-user-script-secret-input"),c.inputEl.setAttribute("aria-label",t),s=c.inputEl,l()}),i.addButton(c=>{c.setIcon("save").setTooltip("Save secret").onClick(async()=>{if(o.length===0){new Pi.Notice("Paste a secret before saving.");return}let u=await b$(this.app,this.command,t,o,bk(this.command,t),this.settings.options?.[t]);if(!u){new Pi.Notice("SecretStorage is unavailable. Secret was not saved.");return}this.command.settings[t]=mk(u),o="",s&&(s.value=""),l(),this.onCommandChange?.(),new Pi.Notice("Secret saved.")}),c.buttonEl.setAttribute("aria-label",`Save ${t}`)}),i.addButton(c=>{c.setIcon("trash-2").setTooltip("Clear secret").onClick(async()=>{let u=bk(this.command,t);if(u&&!await w$(this.app,u)){new Pi.Notice("SecretStorage is unavailable. Secret was not cleared.");return}delete this.command.settings[t],o="",s&&(s.value=""),l(),this.onCommandChange?.(),new Pi.Notice("Secret cleared.")}),c.buttonEl.setAttribute("aria-label",`Clear ${t}`)}),i}addTextArea(t,n,i){return new Pi.Setting(this.contentEl).setName(t).addTextArea(o=>{o.setValue(n).onChange(s=>{this.command.settings[t]=s,this.onCommandChange?.()}).setPlaceholder(i??""),o.inputEl.addClass("qa-user-script-argument-textarea")})}addToggle(t,n){return new Pi.Setting(this.contentEl).setName(t).addToggle(i=>i.setValue(n).onChange(o=>{this.command.settings[t]=o,this.onCommandChange?.()}))}addDropdown(t,n,i){return new Pi.Setting(this.contentEl).setName(t).addDropdown(o=>{n.forEach(s=>{o.addOption(s,s)}),o.setValue(i),o.onChange(s=>{this.command.settings[t]=s,this.onCommandChange?.()})})}addFormatInput(t,n,i){let o=new Pi.Setting(this.contentEl).setName(t),s=Pue(n),a=new Pi.TextAreaComponent(this.contentEl);new Hi(this.app,a.inputEl,ni()),a.inputEl.addClass("qa-user-script-format-textarea"),a.inputEl.setAttribute("aria-label",t);let l=RG(this.contentEl,{app:this.app,plugin:ni(),value:s});return this.previewHandles.push(l),a.setValue(s).onChange(c=>{this.command.settings[t]=c,l.setValue(c),this.onCommandChange?.()}).setPlaceholder(i??""),o}destroyPreviews(){for(let t of this.previewHandles)t.destroy();this.previewHandles=[]}onClose(){this.destroyPreviews(),super.onClose()}async migrateSecretSettings(){await Oh(this.app,this.command,this.settings)&&(this.onCommandChange?.(),this.display())}};Me();qt();var Fue=W('<li class="quickAddCommandListItem"><span class="quickAddCommandLabel"> </span> <div class="quickAddCommandControls"><!> <!> <!></div></li>');function x$(r,e){we(e,!0);var t=Fue(),n=I(t),i=I(n,!0);S(n);var o=A(n,2),s=I(o);{let c=N(()=>`Configure ${e.command.name}`);er(s,{iconId:"settings",get label(){return h(c)},extraClass:"clickable",onclick:()=>e.onConfigureAssistant(e.command)})}var a=A(s,2);{let c=N(()=>`Delete ${e.command.name}`);er(a,{iconId:"trash-2",get label(){return h(c)},extraClass:"clickable",onclick:()=>e.onDeleteCommand(e.command.id)})}var l=A(a,2);{let c=N(()=>`Reorder ${e.command.name}`);ki(l,{get label(){return h(c)},get dragDisabled(){return e.dragDisabled},get onDragStart(){return e.startDrag},get onMoveUp(){return e.onMoveUp},get onMoveDown(){return e.onMoveDown}})}S(o),S(t),de(()=>me(i,e.command.name)),$(r,t),Ce()}var wo=require("obsidian");var Mue="QuickAdd sends the system prompt to the model as written - format syntax like {{DATE}} is not resolved here. Only the prompt template is formatted.",Rue=0;function xk(r,e,t){let n=r.createEl("div",{text:Mue,cls:"qa-literal-format-note"}),i=`qa-literal-format-note-${++Rue}`;n.id=i;let o=s=>{let a=s.includes("{{");n.classList.toggle("qa-literal-format-note--shown",a),a?e.setAttribute("aria-describedby",i):e.removeAttribute("aria-describedby")};return o(t),o}qt();It();Hs();bx();var JG=require("obsidian");Uh();var Bue=[{key:"temperature",name:"Temperature",desc:"Sampling temperature (0-1, the range every provider accepts). Higher values like 0.8 make the output more random; lower values like 0.2 make it more focused and deterministic.",min:0,max:1,step:.1,fallback:1},{key:"top_p",name:"Top P",desc:"Nucleus sampling - an alternative to temperature. The model considers only the tokens comprising the top P probability mass, so 0.1 means the top 10%.",min:0,max:1,step:.1,fallback:1},{key:"frequency_penalty",name:"Frequency penalty",desc:"Positive values penalize tokens by how often they already appear, reducing verbatim repetition; negative values encourage it. Only sent to providers that support it.",min:-2,max:2,step:.1,fallback:0},{key:"presence_penalty",name:"Presence penalty",desc:"Positive values penalize tokens that have appeared at all, encouraging new topics; negative values do the opposite. Only sent to providers that support it.",min:-2,max:2,step:.1,fallback:0}];function eY(r,e,t,n){let i=Yp(t,{silent:!0})?.model;i?.supportsTemperature===!1&&r.createEl("div",{text:`${i.name} uses fixed sampling, so these settings are not sent to it.`,cls:"setting-item-description"});for(let o of Bue){let s=typeof e[o.key]=="number";new JG.Setting(r).setName(o.name).setDesc(s?o.desc:`${o.desc} Currently using the provider's default.`).addSlider(a=>{a.setLimits(o.min,o.max,o.step),a.setDynamicTooltip(),a.setValue(e[o.key]??o.fallback),a.onChange(l=>{e[o.key]=l})}).addExtraButton(a=>{a.setIcon("rotate-ccw"),a.setTooltip("Reset to provider default"),a.setDisabled(!s),a.onClick(()=>{delete e[o.key],n()})})}}Uh();es();It();var Vh="Ask me",Ek="__qa-missing-model__";function Tk(r,e,t){let n=le.getState().ai.providers,i=r.selectEl,o=i.ownerDocument;e={model:e.model,modelRef:mu(e.model,e.modelRef)},r.addOption(Vh,Vh);let s=new Map,a=0;for(let c of n){if(c.models.length===0)continue;let u=o.createElement("optgroup");u.label=c.name,i.appendChild(u);for(let d of c.models){let f=`${c.id??c.name}/${d.name}:${a++}`;s.set(f,{providerId:c.id,modelName:d.name});let p=o.createElement("option");p.value=f,p.text=d.name,u.appendChild(p)}}let l=Uue(e,s);if(l)r.setValue(l);else{let c=e.modelRef?`${e.modelRef.providerId}/${e.modelRef.name}`:e.model;r.addOption(Ek,`(missing) ${c}`);let u=Array.from(i.options).find(d=>d.value===Ek);u&&(u.disabled=!0),r.setValue(Ek)}r.onChange(c=>{if(c===Ek)return;if(c===Vh){t({model:Vh,modelRef:void 0});return}let u=s.get(c);u&&t({model:u.modelName,modelRef:u.providerId?{providerId:u.providerId,name:u.modelName}:void 0})})}function Uue(r,e){if(!r.model||r.model===Vh)return Vh;if(r.modelRef){for(let[n,i]of e)if(i.providerId===r.modelRef.providerId&&i.modelName===r.modelRef.name)return n;return}let t=Yp(r.model,{silent:!0});if(t){for(let[n,i]of e)if(i.providerId===t.provider.id&&i.modelName===t.model.name)return n}}es();var _k=class extends wo.Modal{constructor(t,n){super(t);this.isResolved=!1;this.showAdvancedSettings=!1;this.settings=n,this.originalSettings=this.cloneSettings(n),this.waitForClose=new Promise((i,o)=>{this.rejectPromise=o,this.resolvePromise=i}),this.open(),this.display()}get systemPromptTokenLength(){return Uo(this.settings.systemPrompt)}resolve(t){this.isResolved||(this.isResolved=!0,this.resolvePromise(t))}cloneSettings(t){return{...t,promptTemplate:{...t.promptTemplate},modelParameters:{...t.modelParameters}}}restoreOriginal(){let t=this.cloneSettings(this.originalSettings);Object.assign(this.settings,t),this.settings.promptTemplate=t.promptTemplate,this.settings.modelParameters=t.modelParameters}display(){let t=this.contentEl.createEl("h2");t.addClass("qa-clickable-modal-title"),t.createEl("button",{cls:"qa-rename-title-button",text:`${this.settings.name} settings`,attr:{type:"button","aria-label":`Rename ${this.settings.name}`}}).addEventListener("click",()=>{(async()=>{try{let i=await Sr.Prompt(this.app,"New name",this.settings.name,this.settings.name);i&&i!==this.settings.name&&(this.settings.name=i,this.reload())}catch{}})()}),this.addPromptTemplateSetting(this.contentEl),this.addModelSetting(this.contentEl),this.addOutputVariableNameSetting(this.contentEl),this.addShowAdvancedSettingsToggle(this.contentEl),this.showAdvancedSettings&&(this.settings.modelParameters||(this.settings.modelParameters={}),eY(this.contentEl,this.settings.modelParameters,mu(this.settings.model,this.settings.modelRef)??this.settings.model,()=>this.reload())),this.addSystemPromptSetting(this.contentEl),this.addButtonBar(this.contentEl)}addButtonBar(t){let n=t.createDiv({cls:"qa-command-button-row"});new wo.ButtonComponent(n).setButtonText("Cancel").onClick(()=>{this.restoreOriginal(),this.resolve(null),this.close()}),new wo.ButtonComponent(n).setButtonText("Save").setCta().onClick(()=>{this.resolve(this.settings),this.close()})}reload(){this.contentEl.empty(),this.display()}addPromptTemplateSetting(t){let n=le.getState().ai.promptTemplatesFolderPath,i=rs(this.app,n).map(o=>o.name);new wo.Setting(t).setName("Prompt template").setDesc("Enabling this will have the assistant use the prompt template you specify. If disable, the assistant will ask you for a prompt template to use.").addToggle(o=>{o.setValue(this.settings.promptTemplate.enable),o.onChange(s=>{this.settings.promptTemplate.enable=s})}).addText(o=>{o.setValue(this.settings.promptTemplate.name).onChange(s=>{this.settings.promptTemplate.name=s}),new ii(this.app,o.inputEl,i)})}addModelSetting(t){new wo.Setting(t).setName("Model").setDesc("The model the AI Assistant will use").addDropdown(n=>{Tk(n,this.settings,i=>{this.settings.model=i.model,this.settings.modelRef=i.modelRef,this.reload()})})}addOutputVariableNameSetting(t){new wo.Setting(t).setName("Output variable name").setDesc("The name of the variable used to store the AI Assistant output, i.e. {{value:output}}.").addText(n=>{n.setValue(this.settings.outputVariableName).onChange(i=>{this.settings.outputVariableName=i})})}addSystemPromptSetting(t){new wo.Setting(t).setName("System prompt").setDesc("The system prompt for the AI Assistant");let n=this.contentEl.createEl("div"),i=n.createEl("span",{cls:"qa-ai-token-count"}),o=n.createEl("div",{text:"Estimated locally. Providers enforce exact context limits.",cls:"qa-ai-token-note"});n.appendChild(i),n.appendChild(o);let s=new wo.TextAreaComponent(t);s.inputEl.addClass("qa-ai-prompt-textarea"),s.inputEl.setAttribute("aria-label","System prompt");let a=xk(t,s.inputEl,this.settings.systemPrompt??""),l=(0,wo.debounce)(()=>{i.innerText=`Estimated tokens: ${this.systemPromptTokenLength}`},50);s.setValue(this.settings.systemPrompt).onChange(c=>{this.settings.systemPrompt=c,a(c),l()}),l()}addShowAdvancedSettingsToggle(t){new wo.Setting(t).setName("Show advanced settings").setDesc("Sampling settings such as temperature and top p. Untouched settings use the provider's defaults.").addToggle(n=>{n.setValue(this.showAdvancedSettings),n.onChange(i=>{this.showAdvancedSettings=i,this.reload()})})}onClose(){this.isResolved||(this.restoreOriginal(),this.resolve(null)),super.onClose()}};var Vue=W('<li class="quickAddCommandListItem"><span class="quickAddCommandLabel"> </span> <div class="quickAddCommandControls"><!> <!> <!></div></li>');function _$(r,e){we(e,!0);var t=Vue(),n=I(t),i=I(n,!0);S(n);var o=A(n,2),s=I(o);{let c=N(()=>`Configure ${e.command.name}`);er(s,{iconId:"settings",get label(){return h(c)},extraClass:"clickable",onclick:()=>e.onConfigureOpenFile(e.command)})}var a=A(s,2);{let c=N(()=>`Delete ${e.command.name}`);er(a,{iconId:"trash-2",get label(){return h(c)},extraClass:"clickable",onclick:()=>e.onDeleteCommand(e.command.id)})}var l=A(a,2);{let c=N(()=>`Reorder ${e.command.name}`);ki(l,{get label(){return h(c)},get dragDisabled(){return e.dragDisabled},get onDragStart(){return e.startDrag},get onMoveUp(){return e.onMoveUp},get onMoveDown(){return e.onMoveDown}})}S(o),S(t),de(()=>me(i,e.command.name)),$(r,t),Ce()}var Rl=require("obsidian");Ak();Kr();var kk=class extends Rl.Modal{constructor(t,n){super(t);this.isResolved=!1;this.originalCommand=n,this.command={...n,type:"OpenFile"},this.command.focus=this.command.focus??!0,this.command.location=this.command.location??this.deriveLocation(),this.syncLegacyFlagsFromLocation(this.command.location),this.waitForClose=new Promise(i=>{this.resolvePromise=i}),this.display(),this.open()}onClose(){super.onClose(),this.isResolved||(this.resolvePromise(null),this.isResolved=!0)}resolveWithGuard(t){this.isResolved||(this.resolvePromise(t),this.isResolved=!0)}display(){this.containerEl.addClass("quickAddModal","openFileCommandSettingsModal"),this.contentEl.empty();let t=this.contentEl.createEl("h2");t.textContent="Open file command settings",t.addClass("qa-modal-title"),this.addFilePathSetting(),this.addOpenLocationSetting(),this.addFocusSetting(),this.addButtonBar()}addFilePathSetting(){new Rl.Setting(this.contentEl).setName("File path").setDesc("Path to the file. Supports formatting like {{DATE}}, {{VALUE}}, etc.").addText(t=>t.setPlaceholder("{{DATE}}todo.md").setValue(this.command.filePath).onChange(n=>{this.command.filePath=n,this.command.name=`Open file: ${n}`}))}addOpenLocationSetting(){let t=[{value:"reuse",label:"Reuse active tab"},{value:"tab",label:"New tab"},{value:"split",label:"Split"},{value:"window",label:"New window"},{value:"left-sidebar",label:"Left sidebar"},{value:"right-sidebar",label:"Right sidebar"}];new Rl.Setting(this.contentEl).setName("Where to open").setDesc("Choose tab, split, window, or sidebar").addDropdown(n=>{for(let{value:i,label:o}of t)n.addOption(i,o);n.setValue(this.deriveLocation()).onChange(i=>{this.command.location=i,this.syncLegacyFlagsFromLocation(i),this.reload()})}),this.deriveLocation()==="split"&&this.addDirectionSetting()}syncLegacyFlagsFromLocation(t){switch(t){case"split":this.command.openInNewTab=!0,this.command.direction||(this.command.direction="vertical");break;case"tab":case"reuse":this.command.openInNewTab=!1,this.command.direction=void 0;break;default:this.command.openInNewTab=!0,this.command.direction=void 0;break}}addDirectionSetting(){new Rl.Setting(this.contentEl).setName("Split direction").setDesc("How to arrange the new pane relative to the current one").addDropdown(t=>{t.addOption("vertical","Split right").addOption("horizontal","Split down").setValue(this.command.direction??"vertical").onChange(n=>{this.command.direction=n})})}addFocusSetting(){new Rl.Setting(this.contentEl).setName("Focus opened file").setDesc("Bring the opened file to the foreground").addToggle(t=>t.setValue(this.command.focus??!0).onChange(n=>{this.command.focus=n}))}deriveLocation(){return this.command.location?this.command.location:this.command.openInNewTab?"split":"reuse"}addButtonBar(){let t=this.contentEl.createDiv({cls:"qa-command-button-row qa-command-button-row-compact"});new Rl.ButtonComponent(t).setButtonText("Cancel").onClick(()=>{this.resolveWithGuard(null),this.close()}),new Rl.ButtonComponent(t).setButtonText("Save").setCta().onClick(()=>{this.resolveWithGuard(this.command),this.close()})}reload(){this.display()}};Rm();Ii();var que=W('<li class="quickAddCommandListItem conditionalCommand svelte-p3uofi"><div class="quickAddCommandLabel"><div class="conditionalSummary svelte-p3uofi"> </div> <div class="conditionalBranches svelte-p3uofi"><span> </span> <span> </span></div></div> <div class="quickAddCommandControls"><!> <!> <!> <!> <!></div></li>'),Wue={hash:"svelte-p3uofi",code:".conditionalCommand.svelte-p3uofi {flex-wrap:wrap;}.conditionalSummary.svelte-p3uofi {font-weight:600;margin-bottom:4px;}.conditionalBranches.svelte-p3uofi {display:flex;gap:12px;font-size:0.9em;opacity:0.8;}"};function A$(r,e){we(e,!0),ot(r,Wue);let t=N(()=>Mm(e.command.condition)),n=N(()=>Dr(e.command.thenCommands).length),i=N(()=>Dr(e.command.elseCommands).length);var o=que(),s=I(o),a=I(s),l=I(a,!0);S(a);var c=A(a,2),u=I(c),d=I(u);S(u);var f=A(u,2),p=I(f);S(f),S(c),S(s);var m=A(s,2),v=I(m);{let C=N(()=>`Edit condition for ${h(t)}`);er(v,{iconId:"settings",get label(){return h(C)},extraClass:"clickable",onclick:()=>e.onConfigureCondition(e.command)})}var g=A(v,2);{let C=N(()=>`Edit then branch for ${h(t)}`);er(g,{iconId:"corner-down-right",get label(){return h(C)},extraClass:"clickable",onclick:()=>e.onEditThenBranch(e.command)})}var y=A(g,2);{let C=N(()=>`Edit else branch for ${h(t)}`);er(y,{iconId:"corner-down-left",get label(){return h(C)},extraClass:"clickable",onclick:()=>e.onEditElseBranch(e.command)})}var w=A(y,2);{let C=N(()=>`Delete ${e.command.name}`);er(w,{iconId:"trash-2",get label(){return h(C)},extraClass:"clickable",onclick:()=>e.onDeleteCommand(e.command.id)})}var x=A(w,2);{let C=N(()=>`Reorder ${e.command.name}`);ki(x,{get label(){return h(C)},get dragDisabled(){return e.dragDisabled},get onDragStart(){return e.startDrag},get onMoveUp(){return e.onMoveUp},get onMoveDown(){return e.onMoveDown}})}S(m),S(o),de(()=>{me(l,h(t)),me(d,`Then: ${h(n)??""}`),me(p,`Else: ${h(i)??""}`)}),$(r,o),Ce()}var zue=W('<ol class="quickAddCommandList svelte-16btmqx"></ol>'),Hue={hash:"svelte-16btmqx",code:".quickAddCommandList.svelte-16btmqx {display:grid;grid-template-columns:auto;width:auto;border:0 solid black;overflow-y:auto;height:auto;margin-bottom:8px;padding:20px;}"};function k$(r,e){let t=Dv();we(e,!0),ot(r,Hue);let n=he(e,"commands",31,()=>wt([])),i=N(()=>{let O=new Set;return Array.isArray(n())?n().filter(q=>{if(typeof q!="object"||q===null)return!1;let B=q.id;return typeof B!="string"||B===""||O.has(B)?!1:(O.add(B),!0)}):[]}),o=`command:${t}`,s=rY.Platform.isMobile,a=uk(),l=N(()=>!s&&!a.armed),c=O=>O,u=O=>O,d=O=>O,f=O=>O,p=O=>O,m=O=>O;function v(){e.saveCommands(yh(n()))}function g(O){a.markStarted(),n(Ml(O.detail.items))}function y(O){n(Ml(O.detail.items)),O.detail.info.source===Zi.POINTER&&a.reset(),v()}let w=()=>{a.startDrag()};function x(O,q){let B=Ml(h(i)),ie=B.findIndex(se=>se.id===O);if(ie===-1)return;let j=ie+q;if(j<0||j>=B.length)return;let Y=[...B],[K]=Y.splice(ie,1);Y.splice(j,0,K),n(Y),v(),mx(`Moved ${Gp(K)} to position ${j+1} of ${B.length}`)}function C(O){n(MG(h(i),O)),v()}async function _(O){await e.onConfigureCondition?.(O)&&C(O)}async function E(O){await e.onEditThenBranch?.(O)&&C(O)}async function D(O){await e.onEditElseBranch?.(O)&&C(O)}async function P(O){let q=await H(O.choice)?.waitForClose;if(!q)return;let B={...O,choice:q,name:q.name};C(B)}function H(O){switch(O.type){case"Template":return new xh(e.app,O,e.plugin);case"Capture":return new wh(e.app,O,e.plugin);default:break}}async function V(O){let q=await ka(O,e.app);if(!q){F.logWarning(`${O.name} could not be loaded.`);return}let B=q.settings??{};new Ck(e.app,O,B,()=>v()).open()}async function oe(O){await new _k(e.app,O).waitForClose&&C(O)}async function ce(O){let q=await new kk(e.app,O).waitForClose;q&&C(q)}var R=zue();ar(R,21,()=>Ml(h(i)),O=>O.id,(O,q)=>{var B=dn(),ie=Pe(B);{var j=xe=>{{let Ue=N(()=>c(h(q)));d$(xe,{get command(){return h(Ue)},get dragDisabled(){return h(l)},startDrag:w,get onDeleteCommand(){return e.deleteCommand},onUpdateCommand:C,onMoveUp:()=>x(h(q).id,-1),onMoveDown:()=>x(h(q).id,1)})}},Y=xe=>{{let Ue=N(()=>u(h(q)));p$(xe,{get command(){return h(Ue)},get dragDisabled(){return h(l)},startDrag:w,get onDeleteCommand(){return e.deleteCommand},onConfigureChoice:P,onMoveUp:()=>x(h(q).id,-1),onMoveDown:()=>x(h(q).id,1)})}},K=xe=>{{let Ue=N(()=>d(h(q)));f$(xe,{get command(){return h(Ue)},get dragDisabled(){return h(l)},startDrag:w,get onDeleteCommand(){return e.deleteCommand},onConfigureScript:V,onMoveUp:()=>x(h(q).id,-1),onMoveDown:()=>x(h(q).id,1)})}},se=xe=>{{let Ue=N(()=>f(h(q)));x$(xe,{get command(){return h(Ue)},get dragDisabled(){return h(l)},startDrag:w,get onDeleteCommand(){return e.deleteCommand},onConfigureAssistant:oe,onMoveUp:()=>x(h(q).id,-1),onMoveDown:()=>x(h(q).id,1)})}},pe=xe=>{{let Ue=N(()=>p(h(q)));_$(xe,{get command(){return h(Ue)},get dragDisabled(){return h(l)},startDrag:w,get onDeleteCommand(){return e.deleteCommand},onConfigureOpenFile:ce,onMoveUp:()=>x(h(q).id,-1),onMoveDown:()=>x(h(q).id,1)})}},ge=xe=>{{let Ue=N(()=>m(h(q)));A$(xe,{get command(){return h(Ue)},get dragDisabled(){return h(l)},startDrag:w,get onDeleteCommand(){return e.deleteCommand},onConfigureCondition:_,onEditThenBranch:E,onEditElseBranch:D,onMoveUp:()=>x(h(q).id,-1),onMoveDown:()=>x(h(q).id,1)})}},be=xe=>{u$(xe,{get command(){return h(q)},get dragDisabled(){return h(l)},startDrag:w,get onDeleteCommand(){return e.deleteCommand},onMoveUp:()=>x(h(q).id,-1),onMoveDown:()=>x(h(q).id,1)})};ne(ie,xe=>{h(q).type==="Wait"?xe(j):h(q).type==="NestedChoice"?xe(Y,1):h(q).type==="UserScript"?xe(K,2):h(q).type==="AIAssistant"?xe(se,3):h(q).type==="OpenFile"?xe(pe,4):h(q).type==="Conditional"?xe(ge,5):xe(be,-1)})}$(O,B)}),S(R),Fr(R,(O,q)=>lk?.(O,q),()=>ck({items:h(i),dragDisabled:h(l),type:o,resolveLabel:Gp})),ic("consider",R,g),ic("finalize",R,y),$(r,R),Ce()}function nY(r){return wt(r)}Uc();Kr();hl();var wx=class extends di{constructor(t,n){super(t,"Obsidian");this.generateId=()=>this.id=xr();this.commandId=n}};Uc();Kr();var Sk=class extends di{constructor(e,t){super(e,"Choice"),this.choiceId=t}};Uc();Kr();var Dk=class extends di{constructor(e){super("Wait","Wait"),this.time=e}};Kr();Uc();var Ik=class extends di{constructor(e){super(e.name,"NestedChoice"),this.choice=e}};hl();var $l=class{constructor(e,t){this.id=xr(),this.name=e,this.type=t,this.command=!1,this.onePageInput=void 0}};Tt();var qh=class extends $l{constructor(e){super(e,"Capture"),this.appendLink=!1,this.copyLinkToClipboard=!1,this.captureTo="",this.captureToActiveFile=!1,this.captureToCanvasNodeId="",this.activeFileWritePosition="cursor",this.createFileIfItDoesntExist={enabled:!1,createWithTemplate:!1,template:""},this.format={enabled:!1,format:""},this.insertAfter={enabled:!1,after:"",insertAtEnd:!1,considerSubsections:!1,createIfNotFound:!1,createIfNotFoundLocation:"top",inline:!1,replaceExisting:!1,blankLineAfterMatchMode:"auto",promptHeading:!1},this.insertBefore={enabled:!1,before:"",createIfNotFound:!1,createIfNotFoundLocation:"top"},this.newLineCapture={enabled:!1,direction:"below"},this.prepend=!1,this.task=!1,this.openFile=!1,this.fileOpening=pn(),this.templater={afterCapture:"none"}}static Load(e){let t=e;return t.activeFileWritePosition!=="cursor"&&t.activeFileWritePosition!=="top"&&t.activeFileWritePosition!=="bottom"&&(t.activeFileWritePosition="cursor"),typeof t.captureToCanvasNodeId!="string"&&(t.captureToCanvasNodeId=""),t.insertBefore||(t.insertBefore={enabled:!1,before:"",createIfNotFound:!1,createIfNotFoundLocation:"top"}),t.captureToActiveFile&&t.prepend&&!t.insertAfter?.enabled&&!t.insertBefore.enabled&&!t.newLineCapture?.enabled&&(t.activeFileWritePosition!=="top"&&(t.activeFileWritePosition="bottom"),t.prepend=!1),t.templater||(t.templater={afterCapture:"none"}),t.templater.afterCapture!=="wholeFile"&&(t.templater.afterCapture="none"),t.insertAfter&&!t.insertAfter.blankLineAfterMatchMode&&(t.insertAfter.blankLineAfterMatchMode="auto"),t.insertAfter&&t.insertAfter.inline===void 0&&(t.insertAfter.inline=!1),t.insertAfter&&t.insertAfter.replaceExisting===void 0&&(t.insertAfter.replaceExisting=!1),t.insertAfter&&t.insertAfter.promptHeading===void 0&&(t.insertAfter.promptHeading=!1),t.insertAfter?.createIfNotFoundLocation===Aa&&(t.insertAfter.createIfNotFound&&!t.insertAfter.orderBy&&(t.insertAfter.orderBy={by:"insertion",direction:"desc",unparseable:"bottom"}),t.insertAfter.inline=!1),t}};var rd=class extends $l{constructor(e){super(e,"Template"),this.templatePath="",this.fileNameFormat={enabled:!1,format:""},this.discoverExistingNotesBeforeCreate=!1,this.folder={enabled:!1,folders:[],chooseWhenCreatingNote:!1,createInSameFolderAsActiveFile:!1,chooseFromSubfolders:!1},this.appendLink=!1,this.copyLinkToClipboard=!1,this.openFile=!1,this.fileOpening=pn(),this.fileExistsBehavior={kind:"prompt"}}static Load(e){return e}};var iY=require("obsidian");Tt();Zv();function Pk(r){let e=[];for(let t of r.vault.getFiles())m0.test(t.path)?e.push({file:t,isMarkdown:!1}):ir.test(t.path)&&jue(r,t)&&e.push({file:t,isMarkdown:!0});return e}function jue(r,e){return r.metadataCache.getFileCache(e)?.sections?.some(n=>n.type==="code")??!1}function oY(r,e,t){let n=e.find(s=>s.file.path===t);if(n)return n;let i=e.find(s=>!s.isMarkdown&&s.file.basename===t);if(i)return i;let o=r.vault.getAbstractFileByPath(t);if(o instanceof iY.TFile){if(m0.test(o.path))return{file:o,isMarkdown:!1};if(ir.test(o.path))return{file:o,isMarkdown:!0}}return null}async function Cx(r,e){let t=await r.vault.read(e),{code:n,error:i}=mc(t);return n!==null&&n.length>0?null:i??"No ```js code block found in the note."}function S$(r){return r.isMarkdown?r.file.path:r.file.basename}Uc();Kr();var xx=class extends di{constructor(e,t){super(e,"UserScript"),this.path=t,this.settings={}}};Wp();var sY=require("obsidian");function Fk(r){let t=new sY.Notice("",1e4).messageEl;t.replaceChildren(),Wh(t,"No scripts found","quickadd-notice-title");let n=t.ownerDocument,i=n.createElement("div");t.append(i),Wh(i,"QuickAdd cannot find any .js files or notes with a ```js code block in your vault."),i.append(n.createElement("br")),Wh(i,"Please make sure your scripts are:"),Wh(i,`\u2713 In your vault (not in ${r.vault.configDir} folder)`),Wh(i,"\u2713 Not in hidden folders (starting with a dot)"),Wh(i,"\u2713 A .js file, or a note containing a ```js code block"),i.append(n.createElement("br")),NA(i,kl.userScripts,"View documentation")}function Wh(r,e,t){let n=r.ownerDocument.createElement("div");return n.textContent=e,t&&n.classList.add(t),r.append(n),n}nd();Me();vs();D$();I$();P$();F$();M$();R$();$$();O$();N$();L$();Uc();Kr();It();es();var Rk=class extends di{constructor(){super("AI Assistant","AIAssistant");let e=le.getState().ai;this.model=e.defaultModel;let t=mu(e.defaultModel,e.defaultModelRef);this.modelRef=t?{...t}:void 0,this.systemPrompt=e.defaultSystemPrompt,this.outputVariableName="output",this.promptTemplate={enable:!1,name:""},this.modelParameters={}}};It();Kr();hl();Ak();var $k=class{constructor(e="{{DATE}}.md",t=!1,n,i,o=!0){this.filePath=e;this.type="OpenFile";this.id=xr();this.openInNewTab=t,this.direction=n,this.location=i,this.focus=o,this.name=`Open file: ${this.filePath}`,this.applyLegacyFromLocation()}applyLegacyFromLocation(){if(this.location)switch(this.location){case"split":this.openInNewTab=!0,this.direction||(this.direction="vertical");break;case"tab":case"reuse":this.openInNewTab=!1,this.direction=void 0;break;default:this.openInNewTab=!0,this.direction=void 0;break}}};qt();Uc();Kr();function Gue(){return{mode:"variable",variableName:"",operator:"isTruthy",valueType:"string"}}function Yue(r){return r.mode==="variable"?{...r}:{...r}}var Ok=class extends di{constructor(e){super(e?.name??"If condition","Conditional"),this.condition=e?.condition?Yue(e.condition):Gue(),this.thenCommands=e?.thenCommands?[...e.thenCommands]:[],this.elseCommands=e?.elseCommands?[...e.elseCommands]:[]}};Bc();Ii();var Kue=W(`<div class="qaDataUnreadable svelte-ktqmtm"><div class="qaDataUnreadableHead svelte-ktqmtm"><!> <span class="qaDataUnreadableTitle svelte-ktqmtm"> </span></div> <p class="qaDataUnreadableBody svelte-ktqmtm">The saved value isn't in a shape QuickAdd understands, so it can't be shown
|
||
or edited here. Nothing has been changed or deleted, and QuickAdd will not
|
||
overwrite it.</p> <p class="qaDataUnreadableBody svelte-ktqmtm">It's stored in <code>.obsidian/plugins/quickadd/data.json</code> inside this
|
||
vault. Make a copy of that file before editing it.</p></div>`),Que={hash:"svelte-ktqmtm",code:".qaDataUnreadable.svelte-ktqmtm {border:1px solid var(--background-modifier-border);border-radius:var(--radius-m);padding:12px 14px;margin:4px 0 8px;background:var(--background-secondary);}.qaDataUnreadableHead.svelte-ktqmtm {display:flex;align-items:center;gap:8px;color:var(--text-warning, var(--text-normal));}.qaDataUnreadableTitle.svelte-ktqmtm {font-weight:var(--font-semibold);color:var(--text-normal);}.qaDataUnreadableBody.svelte-ktqmtm {margin:8px 0 0;color:var(--text-muted);font-size:var(--font-ui-small, 13px);max-width:68ch;}"};function B$(r,e){ot(r,Que);var t=Kue(),n=I(t),i=I(n);Rt(i,{iconId:"alert-triangle",size:16});var o=A(i,2),s=I(o);S(o),S(n),Pn(4),S(t),de(()=>me(s,`QuickAdd couldn't read ${e.what??""}`)),$(r,t)}var eg=class{constructor(e){this.obsidianCommands=[];this.scriptCandidates=[];this.commandListHandle=null;this.commandListProps=null;this.containerEl=null;this.unreadableCardHandle=null;this.app=e.app,this.plugin=e.plugin,this.unreadable=Di(e.commands),this.commandsRef=m$(e.commands).commands,this.choices=e.choices,this.onCommandsChange=e.onCommandsChange,this.conditionalHandlers=e.conditionalHandlers,this.loadObsidianCommands(),this.loadScriptCandidates()}render(e){return this.destroy(),this.containerEl=e,e.empty(),e.addClass("quickAddCommandEditor"),this.unreadable?(this.renderUnreadableCard(e),!1):this.renderCommandList(e)?(this.renderCommandBar(e),this.renderAddObsidianCommandSetting(e),this.renderAddEditorCommandSetting(e),this.renderAddUserScriptSetting(e),this.renderAddChoiceSetting(e),!0):!1}renderUnreadableCard(e){let t=e.createDiv("commandList");this.unreadableCardHandle=qi(t,B$,{what:"this macro's commands"},{what:"this macro's commands"})}destroy(){this.commandListHandle?.destroy(),this.commandListHandle=null,this.commandListProps=null,this.unreadableCardHandle?.destroy(),this.unreadableCardHandle=null}loadObsidianCommands(){Object.keys(this.app.commands.commands).forEach(e=>{let t=this.app.commands.commands[e];this.obsidianCommands.push(new wx(t.name,t.id))})}loadScriptCandidates(){this.scriptCandidates=Pk(this.app)}renderCommandList(e){let t=e.createDiv("commandList");return this.commandListProps=nY({app:this.app,plugin:this.plugin,commands:this.commandsRef,deleteCommand:async n=>{let i=this.commandsRef.find(a=>a.id===n);if(!i)throw F.logError("command not found"),new Error("command not found");if(!await Qi.Prompt(this.app,"Are you sure you wish to delete this command?",`If you click yes, you will delete '${i.name}'.`))return;if(!await yx(this.app,i)){new Fi.Notice("Could not clear user script secrets. Command was not deleted.");return}this.commandsRef=this.commandsRef.filter(a=>a.id!==n),this.emitCommandsChanged()},saveCommands:n=>{this.commandsRef=n,this.onCommandsChange?.(n)},onConfigureCondition:this.conditionalHandlers?.configureCondition,onEditThenBranch:this.conditionalHandlers?.editThenBranch,onEditElseBranch:this.conditionalHandlers?.editElseBranch}),this.commandListHandle=qi(t,k$,this.commandListProps,{what:"this macro's commands"}),this.commandListHandle.ok}renderCommandBar(e){let t=e.createDiv("quickCommandContainer");this.addChoiceButton(t,"Capture",qh),this.addChoiceButton(t,"Template",rd),this.addOpenFileCommandButton(t),this.addWaitCommandButton(t),this.addConditionalCommandButton(t),le.getState().disableOnlineFeatures||this.addAIAssistantCommandButton(t)}renderAddObsidianCommandSetting(e){let t,n=()=>{let i=t.getValue(),o=this.obsidianCommands.find(a=>a.name===i);if(!o){F.logError(`Could not find Obsidian command with name "${i}"`);return}let s=new wx(o.name,o.commandId);s.generateId(),this.addCommand(s),t.setValue("")};new Fi.Setting(e).setName("Obsidian command").setDesc("Add an Obsidian command").addText(i=>{t=i,i.inputEl.addClass("qa-command-sequence-input"),i.setPlaceholder("Obsidian command"),new ii(this.app,i.inputEl,this.obsidianCommands.map(o=>o.name)),i.inputEl.addEventListener("keypress",o=>{o.key==="Enter"&&n()})}).addButton(i=>i.setCta().setButtonText("Add").onClick(n))}renderAddEditorCommandSetting(e){let t,n=()=>{let i=t.getValue(),o;switch(i){case"Copy":o=new zh;break;case"Cut":o=new Hh;break;case"Paste":o=new jh;break;case"Paste with format":o=new Gh;break;case"Select active line":o=new Yh;break;case"Select link on active line":o=new Kh;break;case"Move cursor to file start":o=new Qh;break;case"Move cursor to file end":o=new Xh;break;case"Move cursor to line start":o=new Zh;break;case"Move cursor to line end":o=new Jh;break;default:throw F.logError("invalid editor command type"),new Error("invalid editor command type")}this.addCommand(o),t.setValue("")};new Fi.Setting(e).setName("Editor commands").setDesc("Add editor command").addDropdown(i=>{t=i,i.selectEl.addClass("qa-command-sequence-input"),i.addOption("","Select command").addOption("Copy","Copy").addOption("Cut","Cut").addOption("Paste","Paste").addOption("Paste with format","Paste with format").addOption("Select active line","Select active line").addOption("Select link on active line","Select link on active line").addOption("Move cursor to file start","Move cursor to file start").addOption("Move cursor to file end","Move cursor to file end").addOption("Move cursor to line start","Move cursor to line start").addOption("Move cursor to line end","Move cursor to line end")}).addButton(i=>i.setCta().setButtonText("Add").onClick(n))}renderAddUserScriptSetting(e){let t,n=null,i=async()=>{this.loadScriptCandidates();let o=t.getValue().trim();if(!o)return;let s=np(o).basename??o,a=oY(this.app,this.scriptCandidates,s);if(!a){new Fi.Notice(`QuickAdd: No script or js-block note named "${o}" found.`);return}if(a.isMarkdown){let l=await Cx(this.app,a.file);if(l){new Fi.Notice(`QuickAdd: "${a.file.path}" \u2014 ${l}`);return}}this.addCommand(new xx(o,a.file.path)),t.setValue(""),n&&n.buttonEl.addClass("qa-hidden")};new Fi.Setting(e).setName("User scripts").setDesc("Add a .js file or a note with a ```js code block - type the name or click Browse").addText(o=>{t=o,o.inputEl.addClass("qa-command-sequence-input"),o.setPlaceholder("Start typing script name..."),new ii(this.app,o.inputEl,this.scriptCandidates.map(s=>S$(s))),o.inputEl.addEventListener("keypress",s=>{s.key==="Enter"&&i()})}).addButton(o=>o.setButtonText("Browse").setTooltip("Browse and select a script (.js file or note)").onClick(async()=>{let s=await this.showScriptPicker();if(s){let a=s.isMarkdown?s.file.path:s.file.basename;this.addCommand(new xx(a,s.file.path))}})).addButton(o=>{n=o,o.setButtonText("Add").setCta().onClick(()=>{i()}),o.buttonEl.addClass("qa-hidden")}),t.onChange(o=>{n&&n.buttonEl.toggleClass("qa-hidden",o.trim().length===0)})}renderAddChoiceSetting(e){let t,n=()=>{let i=t.getValue(),o=this.choices.find(s=>s.name===i);if(!o){new Fi.Notice(`QuickAdd: No choice named "${i}".`);return}this.addCommand(new Sk(o.name,o.id)),t.setValue("")};new Fi.Setting(e).setName("Choices").setDesc("Add existing choice").addText(i=>{t=i,i.inputEl.addClass("qa-command-sequence-input"),i.setPlaceholder("Choice"),new ii(this.app,i.inputEl,this.choices.map(o=>o.name)),i.inputEl.addEventListener("keypress",o=>{o.key==="Enter"&&n()})}).addButton(i=>i.setCta().setButtonText("Add").onClick(n))}addChoiceButton(e,t,n){new Fi.ButtonComponent(e).setButtonText(t).setTooltip(`Add ${t} choice`).onClick(()=>{let o=new n(`Untitled ${t} Choice`);this.addCommand(new Ik(o))})}addOpenFileCommandButton(e){new Fi.ButtonComponent(e).setIcon("file-search").setTooltip("Add open file command").onClick(()=>{this.addCommand(new $k)})}addAIAssistantCommandButton(e){new Fi.ButtonComponent(e).setIcon("bot").setTooltip("Add AI Assistant command").onClick(()=>{this.addCommand(new Rk)})}addWaitCommandButton(e){new Fi.ButtonComponent(e).setIcon("clock").setTooltip("Add wait command").onClick(()=>{this.addCommand(new Dk(100))})}addConditionalCommandButton(e){new Fi.ButtonComponent(e).setIcon("git-branch").setTooltip("Add conditional command").onClick(()=>{this.addCommand(new Ok)})}async showScriptPicker(){if(this.loadScriptCandidates(),this.scriptCandidates.length===0)return Fk(this.app),null;let e=this.scriptCandidates.map(o=>o.file.path),t=this.scriptCandidates.map(o=>S$(o)),n=await ln.Suggest(this.app,t,e,{placeholder:"Select a script (.js file or note with a ```js block)",emptyStateText:"No scripts found in your vault"});if(!n)return null;let i=this.scriptCandidates.find(o=>o.file.path===n);if(!i)return null;if(i.isMarkdown){let o=await Cx(this.app,i.file);if(o)return new Fi.Notice(`QuickAdd: "${i.file.path}" \u2014 ${o}`),null}return i}addCommand(e){this.commandsRef=[...this.commandsRef,e],this.emitCommandsChanged()}emitCommandsChanged(){this.commandListProps&&(this.commandListProps.commands=[...this.commandsRef]),this.onCommandsChange?.(this.commandsRef)}};var pi=require("obsidian");Rm();nd();function lY(r){return r.mode==="variable"?{...r}:{...r}}function Xue(){return{mode:"variable",variableName:"",operator:"isTruthy",valueType:"boolean"}}function Zue(){return{mode:"script",scriptPath:""}}var Nk=class extends pi.Modal{constructor(t,n){super(t);this.isResolved=!1;this.scriptCandidates=[];this.originalCommand=n,this.workingCommand={...n,condition:lY(n.condition)},this.waitForClose=new Promise(i=>{this.resolvePromise=i}),this.loadScriptCandidates(),this.display(),this.open()}onClose(){super.onClose(),this.isResolved||this.resolve(null)}resolve(t){this.isResolved||(this.isResolved=!0,this.resolvePromise(t))}loadScriptCandidates(){this.scriptCandidates=Pk(this.app)}reload(){this.display()}display(){this.containerEl.addClass("quickAddModal","conditionalSettingsModal"),this.contentEl.empty(),this.contentEl.createEl("h2",{text:"Configure conditional command"}).addClass("qa-modal-title"),this.renderModeSelector(),this.workingCommand.condition.mode==="variable"?this.renderVariableConfiguration(this.workingCommand.condition):this.renderScriptConfiguration(this.workingCommand.condition),this.renderButtonBar()}renderModeSelector(){new pi.Setting(this.contentEl).setName("Condition type").setDesc("Choose how this condition should be evaluated.").addDropdown(t=>{t.addOption("variable","Macro variable").addOption("script","Run script").setValue(this.workingCommand.condition.mode).onChange(n=>{n!==this.workingCommand.condition.mode&&(this.workingCommand.condition=n==="variable"?Xue():Zue(),this.reload())})})}renderVariableConfiguration(t){this.renderVariableNameSetting(t),this.renderOperatorSetting(t),this.renderValueTypeSetting(t),Ou(t.operator)&&this.renderExpectedValueSetting(t)}renderVariableNameSetting(t){new pi.Setting(this.contentEl).setName("Variable name").setDesc("Name of the macro variable to inspect (without the $ prefix).").addText(n=>n.setPlaceholder("e.g. projectStatus").setValue(t.variableName).onChange(i=>{t.variableName=i.trim()}))}renderOperatorSetting(t){let n=[{value:"equals",label:"Equals"},{value:"notEquals",label:"Does not equal"},{value:"lessThan",label:"Less than"},{value:"lessThanOrEqual",label:"Less than or equal"},{value:"greaterThan",label:"Greater than"},{value:"greaterThanOrEqual",label:"Greater than or equal"},{value:"contains",label:"Contains"},{value:"notContains",label:"Does not contain"},{value:"isTruthy",label:"Is truthy"},{value:"isFalsy",label:"Is falsy"}];new pi.Setting(this.contentEl).setName("Operator").setDesc("How to compare the variable value.").addDropdown(i=>{i.addOptions(n.reduce((o,s)=>(o[s.value]=s.label,o),{})),i.setValue(t.operator),i.onChange(o=>{t.operator=o,t.valueType=eq(t.operator),Ou(t.operator)||delete t.expectedValue,this.reload()})})}renderValueTypeSetting(t){new pi.Setting(this.contentEl).setName("Value type").setDesc("How to interpret the comparison value.").addDropdown(n=>{n.addOption("string","Text").addOption("number","Number").addOption("boolean","Boolean").setValue(t.valueType).onChange(i=>{t.valueType=i,this.reload()})})}renderExpectedValueSetting(t){if(t.valueType==="boolean"){new pi.Setting(this.contentEl).setName("Expected value").setDesc("Choose true or false.").addDropdown(n=>{n.addOption("true","True").addOption("false","False").setValue(t.expectedValue??"true").onChange(i=>{t.expectedValue=i})});return}new pi.Setting(this.contentEl).setName("Expected value").setDesc("Value to compare against.").addText(n=>{n.setPlaceholder("Enter comparison value").setValue(t.expectedValue??"").onChange(i=>{t.expectedValue=i})})}renderScriptConfiguration(t){this.renderScriptPathSetting(t),this.renderScriptExportSetting(t)}renderScriptPathSetting(t){let n;new pi.Setting(this.contentEl).setName("Script path").setDesc("Vault-relative path to a .js file or a note with a ```js code block.").addText(i=>{n=i,i.setPlaceholder("scripts/myCheck.js or Notes/myCheck.md").setValue(t.scriptPath).onChange(o=>{t.scriptPath=o.trim()})}).addButton(i=>i.setButtonText("Browse").setTooltip("Select a script (.js file or note)").onClick(async()=>{if(this.loadScriptCandidates(),this.scriptCandidates.length===0){Fk(this.app);return}let o=this.scriptCandidates.map(l=>l.file.path),s=await ln.Suggest(this.app,o,o,{placeholder:"Select a script (.js file or note with a ```js block)",emptyStateText:"No scripts found in your vault"});if(!s)return;let a=this.scriptCandidates.find(l=>l.file.path===s);if(a?.isMarkdown){let l=await Cx(this.app,a.file);if(l){new pi.Notice(`QuickAdd: "${a.file.path}" \u2014 ${l}`);return}}t.scriptPath=s,n.setValue(s)}))}renderScriptExportSetting(t){new pi.Setting(this.contentEl).setName("Export name").setDesc("Optional export or member to call (use :: to access nested members).").addText(n=>n.setPlaceholder("default").setValue(t.exportName??"").onChange(i=>{t.exportName=i.trim()||void 0}))}renderButtonBar(){let t=this.contentEl.createDiv({cls:"qa-command-button-row"});new pi.ButtonComponent(t).setButtonText("Cancel").onClick(()=>{this.resolve(null),this.close()}),new pi.ButtonComponent(t).setCta().setButtonText("Save").onClick(()=>{this.validateCondition()&&(this.applyChanges(),this.resolve(this.originalCommand),this.close())})}validateCondition(){let t=this.workingCommand.condition;return t.mode==="variable"?t.variableName.trim()?!0:(new pi.Notice("QuickAdd: Enter a variable name before saving."),!1):t.scriptPath.trim()?!0:(new pi.Notice("QuickAdd: Enter a script path before saving."),!1)}applyChanges(){this.originalCommand.condition=lY(this.workingCommand.condition);let t=Mm(this.originalCommand.condition);this.originalCommand.name=`If ${t}`}};var tg=require("obsidian");yi();Ii();var Lk=class extends tg.Modal{constructor(t){super(t.app);this.commandEditor=null;this.isResolved=!1;this.plugin=t.plugin,this.choices=t.choices,this.conditionalHandlers=t.conditionalHandlers,this.workingCommands=gt(t.commands),this.waitForClose=new Promise(n=>{this.resolvePromise=n}),this.display(t.title),this.open()}onClose(){super.onClose(),this.commandEditor?.destroy(),this.isResolved||this.resolve(null)}resolve(t){this.isResolved||(this.isResolved=!0,this.resolvePromise(t))}display(t){this.containerEl.addClass("quickAddModal","conditionalBranchModal"),this.contentEl.empty(),this.contentEl.createEl("h2",{text:t}).addClass("qa-modal-title");let i=this.contentEl.createDiv("branchCommandEditor");this.commandEditor=new eg({app:this.app,plugin:this.plugin,commands:this.workingCommands,choices:this.choices,onCommandsChange:s=>{this.workingCommands=s},conditionalHandlers:this.conditionalHandlers});let o=this.commandEditor.render(i);this.renderButtonBar(o)}renderButtonBar(t){let n=this.contentEl.createDiv({cls:"qa-command-button-row"});if(!t){new tg.ButtonComponent(n).setCta().setButtonText("Close").onClick(()=>{this.resolve(null),this.close()});return}new tg.ButtonComponent(n).setButtonText("Cancel").onClick(()=>{this.resolve(null),this.close()}),new tg.ButtonComponent(n).setCta().setButtonText("Save").onClick(()=>{this.resolve(Dr(this.workingCommands)),this.close()})}};var Bk=require("obsidian");Wt();pc();function Jue(r){let e=r.trim();return e||void 0}function ede(r){return(typeof r.icon=="string"?r.icon.trim():"")||ym(r.type)}function Uk(r,e,t,n){let i=ym(t.type),o=new Bk.Setting(e).setName("Icon").setDesc(`Lucide/Obsidian icon id. Leave empty to use ${i}.`);o.settingEl.addClass("qa-choice-icon-setting");let s=Hr(e,"span");s.classList.add("qa-choice-icon-setting-preview"),s.setAttribute("aria-hidden","true"),o.controlEl.appendChild(s);function a(){s.replaceChildren(),(0,Bk.setIcon)(s,ede(t))}o.addText(l=>{l.setPlaceholder(i),l.setValue(typeof t.icon=="string"?t.icon:""),l.inputEl.addClass("qa-choice-icon-input"),l.inputEl.setAttribute("aria-label","Choice icon"),new ii(r,l.inputEl,BA,50),l.onChange(c=>{let u=Jue(c);t.icon=u,n(u),a()})}),a()}Wt();Ii();hl();function tde(r){let e=[],t=n=>{n.forEach(i=>{Ye(i)&&(i.type==="Multi"?t(st(i)):e.push(i))})};return t(gn(r)),e}var Vk=class extends qk.Modal{constructor(t,n,i,o){super(t);this.choices=[];this.commandEditor=null;this.choice=i,this.macro=i.macro,this.choices=tde(o),this.plugin=n,this.waitForClose=new Promise(s=>{this.resolvePromise=s}),this.display(),UA(this,"macro"),this.open()}onClose(){super.onClose(),this.resolvePromise(this.choice),this.commandEditor?.destroy(),this.commandEditor=null}display(){this.containerEl.addClass("quickAddModal","macroBuilder"),this.contentEl.empty(),this.addCenteredHeader(this.choice.name),this.addCommandEditor(),this.addRunOnStartupSetting(),this.addIconSetting()}addCenteredHeader(t){let n=this.contentEl.createEl("h2");n.addClass("qa-clickable-modal-title"),n.createEl("button",{cls:"qa-rename-title-button",text:t,attr:{type:"button","aria-label":`Rename ${t}`}}).addEventListener("click",()=>{(async()=>{try{let o=await Sr.Prompt(this.app,`Update name for ${this.choice.name}`,this.choice.name,this.choice.name);if(!o)return;this.choice.name=o,ed(this.macro)&&(this.macro.name=o),this.reload()}catch{}})()})}addRunOnStartupSetting(){new qk.Setting(this.contentEl).setName("Run on startup").setDesc("Execute this macro when Obsidian starts").addToggle(t=>t.setValue(this.choice.runOnStartup).onChange(n=>{this.choice.runOnStartup=n}))}addIconSetting(){Uk(this.app,this.contentEl,this.choice,t=>{this.choice.icon=t})}reload(){this.commandEditor?.destroy(),this.commandEditor=null,this.display()}macroCommandsValue(){return zn(this.macro)}setMacroCommands(t){if(!ed(this.macro)){this.macro={id:xr(),name:this.choice.name,commands:t},this.choice.macro=this.macro;return}this.macro.commands=t}addCommandEditor(){let t=this.contentEl.createDiv("macroBuilder__editor");this.commandEditor=new eg({app:this.app,plugin:this.plugin,commands:this.macroCommandsValue(),choices:this.choices,onCommandsChange:n=>{this.setMacroCommands(n)},conditionalHandlers:this.buildConditionalHandlers()}),this.commandEditor.render(t)}buildConditionalHandlers(){return{configureCondition:t=>this.configureConditionalCondition(t),editThenBranch:t=>this.configureConditionalBranch(t,"then"),editElseBranch:t=>this.configureConditionalBranch(t,"else")}}async configureConditionalCondition(t){return await new Nk(this.app,t).waitForClose!==null}async configureConditionalBranch(t,n){let i=n==="then"?"Then branch":"Else branch",s=await new Lk({app:this.app,plugin:this.plugin,choices:this.choices,title:`Edit ${i} commands`,commands:n==="then"?t.thenCommands:t.elseCommands,conditionalHandlers:this.buildConditionalHandlers()}).waitForClose;return s?(n==="then"?t.thenCommands=s:t.elseCommands=s,!0):!1}};var id=require("obsidian");zr();var Wk=class extends id.Modal{constructor(t,n){super(t);this.choice=n;this.didSubmit=!1;this.name=n.name,this.placeholder=n.placeholder??"",this.icon=typeof n.icon=="string"?n.icon:void 0,this.waitForClose=new Promise((i,o)=>{this.resolvePromise=i,this.rejectPromise=o}),this.containerEl.addClass("quickAddModal","qaMultiChoiceSettingsModal"),this.display(),this.open()}display(){this.contentEl.empty(),this.titleEl.setText("Edit folder"),new id.Setting(this.contentEl).setName("Name").addText(n=>{n.setValue(this.name).onChange(i=>{this.name=i})}),new id.Setting(this.contentEl).setName("Placeholder").setDesc("Shown in the choice picker search box when this folder opens. Leave blank to use the folder name.").addText(n=>{n.setPlaceholder("Defaults to the folder name"),n.setValue(this.placeholder).onChange(i=>{this.placeholder=i})}),Uk(this.app,this.contentEl,{type:this.choice.type,icon:this.icon},n=>{this.icon=n});let t=this.contentEl.createDiv();new id.ButtonComponent(t).setButtonText("Save").setCta().onClick(()=>this.submit()),new id.ButtonComponent(t).setButtonText("Cancel").onClick(()=>this.cancel()),t.addClass("qa-modal-button-row")}submit(){this.didSubmit||(this.didSubmit=!0,this.close())}cancel(){this.close()}onClose(){if(super.onClose(),!this.didSubmit){this.rejectPromise(rn());return}let t=this.placeholder.trim(),n={...this.choice,name:this.name.trim()||this.choice.name,placeholder:t||void 0,icon:this.icon};this.resolvePromise(n)}};It();hl();var zk=class{constructor(e){this.name=e,this.id=xr(),this.commands=[]}};var rg=class extends $l{constructor(t){super(t,"Macro");this.runOnStartup=!1;this.macro=new zk(t)}};var ng=class extends $l{constructor(t){super(t,"Multi");this.choices=[];this.collapsed=!1}addChoice(t){return this.choices.push(t),this}addChoices(t){return this.choices.push(...t),this}};Ii();Wt();yi();function U$(r,e){let t=gt(r);for(let n of e)delete t[n];return t}yi();Bc();Me();xc();var rde={Template:rd,Capture:qh,Macro:rg,Multi:ng};function q$(r,e){let t=rde[r];if(!t)throw new Error(`Unknown choice type: ${r}`);return new t(e)}function uY(r,e){let t=q$(r.type,`${r.name} (copy)`);if(r.type==="Multi"){let n=t,i=r;return Object.assign(n,U$(i,["id","name","choices"])),Cc(i)?n.choices=st(i).filter(Ye).map(o=>uY(o,e)):n.choices=i.choices,n}return Object.assign(t,U$(r,["id","name"])),r.type==="Macro"&&(t.macro=gt(r.macro),OG(t.macro),Nh(t,e)),t}async function dY(r,e){let t=await nde(e,r);return uY(r,{secretOptionNamesByPath:t,stripUnknownStringSettings:!0})}function pY(r){return r!==null&&typeof r=="object"}function V$(r,e){if(pY(r)){if(r.type==="UserScript"&&typeof r.path=="string"&&e.add(r.path),Array.isArray(r.thenCommands))for(let t of r.thenCommands)V$(t,e);if(Array.isArray(r.elseCommands))for(let t of r.elseCommands)V$(t,e);W$(r.choice,e)}}function W$(r,e){if(pY(r)){if(r.type==="Macro"){let t=zn(r.macro);if(Array.isArray(t))for(let n of t)V$(n,e)}if(r.type==="Multi"&&Array.isArray(r.choices))for(let t of r.choices)W$(t,e)}}async function nde(r,e){let t=new Set;W$(e,t);let n=new Map;for(let i of t)try{if(Vn(i)||!await r.vault.adapter.exists(i))continue;let s=Rh(await r.vault.adapter.read(i),i);n.set(i,s.foundSecretOptions&&s.names.size===0?null:s.names)}catch(o){F.logWarning(`QuickAdd could not inspect user-script settings '${i}' while duplicating choice: ${o?.message??o}`)}return n}function ide(r,e,t){let i={Template:()=>new xh(e,r,t),Capture:()=>new wh(e,r,t),Macro:()=>new Vk(e,t,r,le.getState().choices),Multi:()=>{}}[r.type];return typeof i=="function"?i():void 0}async function fY(r,e){let t=r.type==="Multi",n=r.type==="Macro",i=l=>{if(zs(l))return"QuickAdd couldn't read this folder's contents. Deleting it also deletes whatever is still stored under it in data.json.";let c=Un(st(l));if(c.length===0)return"";let u=c.filter(p=>p.type==="Multi").length,d=c.length-u,f=[];return d>0&&f.push(`${d} ${d===1?"choice":"choices"}`),u>0&&f.push(`${u} ${u===1?"folder":"folders"}`),`Deleting this folder will also delete everything inside it: ${f.join(" and ")}.`},o=l=>Di(zn(l.macro))?"QuickAdd couldn't read this macro's commands. Deleting it also deletes whatever is still stored under it in data.json.":"Deleting this choice will also delete its macro commands.",s=[`Are you sure you want to delete '${r.name}'?`,t?i(r):"",n?o(r):""].filter(Boolean).join(" ");return await Qi.Prompt(e,`Delete ${km(r.type)}`,s)?(n||t)&&!await yx(e,{type:"NestedChoice",choice:r})?(new cY.Notice(`Could not clear user script secrets. The ${km(r.type)} was not deleted.`),!1):!0:!1}async function mY(r,e,t){if(r.type==="Multi")try{return await new Wk(e,r).waitForClose}catch{return}let n=ide(r,e,t);if(!n)throw new Error("Invalid choice type");return await n.waitForClose}function hY(r){return{...r,command:!r.command}}var Hk=class{constructor(e){this.plugin=e}enableCommand(e){this.plugin.addCommandForChoice(e)}disableCommand(e,t){t?this.plugin.removeCommandForChoice(e,t):this.plugin.removeCommandForChoice(e)}updateCommand(e,t){this.plugin.removeCommandForChoice(e),this.plugin.addCommandForChoice(t)}};function gY(r,e,t){if(!e||!t)return r;let n=Ex(r,e),i=Ex(r,t);if(!n||!i||i.type!=="Multi"||n.type==="Multi"&&(n.id===i.id||ode(n).has(i.id)))return r;let{updated:o,removed:s}=Tx(r,e);return s?z$(o,t,s)??r:r}function vY(r,e){if(!e||r.some(i=>Ye(i)&&i.id===e))return r;let{updated:t,removed:n}=Tx(r,e);return n?[...t,n]:r}function Ex(r,e){for(let t of r){if(!Ye(t))continue;if(t.id===e)return t;let n=Ex(st(t),e);if(n)return n}}function ode(r){let e=new Set,t=n=>{Ye(n)&&(e.add(n.id),st(n).forEach(t))};return st(r).forEach(t),e}function Tx(r,e){let t;return{updated:r.map(i=>{if(!Ye(i))return i;if(i.id===e){t=i;return}if(!Cc(i))return i;let o=Tx(st(i),e);return o.removed&&(t=o.removed),o.removed?{...i,choices:o.updated}:i}).filter(Boolean),removed:t}}function z$(r,e,t){let n=!1,i=r.map(o=>{if(!Ye(o))return o;if(o.id===e&&o.type==="Multi"){if(zs(o))return o;n=!0;let a=o;return{...a,choices:[...st(a),t]}}if(!Cc(o))return o;let s=z$(st(o),e,t);return s?(n=!0,{...o,choices:s}):o});return n?i:void 0}function H$(r,e,t){let n=r.findIndex(s=>Ye(s)&&s.id===e);if(n!==-1){let s=[...r];return s.splice(n+1,0,t),s}let i=!1,o=r.map(s=>{if(!Ye(s)||!Cc(s))return s;let a=H$(st(s),e,t);return a?(i=!0,{...s,choices:a}):s});return i?o:void 0}function yY(r,e,t){if(!t)return[...r,e];let n=z$(r,t,e)??[...r,e];return sde(n,t)}function j$(r,e,t){return r.map(n=>{if(!Ye(n)||n.type!=="Multi")return n;let i=n;return i.id===e?t(i):Cc(i)?{...i,choices:j$(st(i),e,t)}:n})}function G$(r,e,t){return j$(r,e,n=>({...n,collapsed:t}))}function sde(r,e){return G$(r,e,!1)}function bY(r,e,t){return j$(r,e,n=>({...n,choices:t}))}var wY=require("obsidian");Wt();var Y$="quickadd:move-to-root";function ade(r,e){let t=gn(e);if(t.some(i=>Ye(i)&&i.id===r.id))return!1;let n=i=>{for(let o of i){if(!Ye(o))continue;let s=st(o);if(s.some(a=>a?.id===r.id)||n(s))return!0}return!1};return n(t)}function lde(r,e){let t=[],n=Array.isArray(e)?e:[],i=(o,s=[])=>{for(let a of o){if(!Ye(a))continue;let l=a.name??"";if(a.type==="Multi"){let c=[...s,l];cde(r,a)||t.push({id:a.id,path:c.join(" / ")}),i(st(a),[...s,l])}}};return i(n,[]),t}function cde(r,e){if(e.type!=="Multi"||r.id===e.id||zs(e))return!0;if(r.type==="Multi"){let t=new Set,n=i=>{Ye(i)&&(t.add(i.id),st(i).forEach(n))};if(st(r).forEach(n),t.has(e.id))return!0}return!1}function CY(r,e,t,n){let i=new wY.Menu;i.addItem(s=>s.setTitle(e.command?"Disable in command palette":"Enable in command palette").setIcon("zap").onClick(n.onToggle)).addItem(s=>s.setTitle("Rename").setIcon("pencil").onClick(n.onRename)).addItem(s=>s.setTitle("Configure").setIcon("settings").onClick(n.onConfigure)).addItem(s=>s.setTitle("Duplicate").setIcon("copy").onClick(n.onDuplicate)).addItem(s=>s.setTitle("Delete").setIcon("trash-2").onClick(n.onDelete)).addSeparator(),ade(e,t)&&i.addItem(s=>s.setTitle("Move to: (root)").setIcon("folder-up").onClick(()=>n.onMove(Y$)));let o=lde(e,t);return o.length===0?i.addItem(s=>s.setTitle("Move to: (no folders)").setDisabled(!0).setIcon("folder")):o.forEach(s=>i.addItem(a=>a.setTitle(`Move to: ${s.path}`).setIcon("folder-open").onClick(()=>n.onMove(s.id)))),i}function jk(r,e,t,n,i){e.preventDefault(),CY(r,t,n,i).showAtMouseEvent(e)}function Gk(r,e,t,n,i){let o=e.getBoundingClientRect();CY(r,t,n,i).showAtPosition({x:o.left,y:o.bottom})}var qa=require("obsidian");var Ir=require("obsidian");es();var xY=require("obsidian");It();var Yk=null,ude=1440*60*1e3;async function K$(){if(Yk&&Date.now()-Yk.fetchedAt<ude)return Yk.data;if(le.getState().disableOnlineFeatures)throw new Error("Fetching models directory is disabled: Online features are turned off.");let e=await(await(0,xY.requestUrl)({url:"https://models.dev/api.json",method:"GET"})).json;return Yk={data:e,fetchedAt:Date.now()},e}function dde(r){for(let e of[r,`https://${r}`])try{let t=new URL(e).hostname.toLowerCase();if(t)return t}catch{}return""}function _x(r){let e=r.toLowerCase(),t=dde(r),n=i=>t===i||t.endsWith(`.${i}`);return n("openai.com")?"openai":n("openrouter.ai")?"openrouter":n("generativelanguage.googleapis.com")?"google":e.includes("anthropic")?"anthropic":n("groq.com")?"groq":n("together.ai")||n("together.xyz")?"togetherai":e.includes("huggingface")?"huggingface":e.includes("github")&&e.includes("models")?"github-models":e.includes("bedrock")||e.includes("aws")?"amazon-bedrock":e.includes("modelscope")?"modelscope":e.includes("dashscope")?"alibaba":n("fireworks.ai")?"fireworks-ai":e.includes("vercel")?"vercel":n("inference.net")?"inference":n("z.ai")||e.includes("zhipu")?"zhipuai":n("deepseek.com")?"deepseek":n("mistral.ai")?"mistral":e.includes("cerebras")?"cerebras":n("venice.ai")?"venice":n("upstage.ai")?"upstage":n("llama.com")?"llama":e.includes("morphllm")?"morph":n("inceptionlabs.ai")?"inception":e.includes("deepinfra")?"deepinfra":n("opencode.ai")?"opencode":n("inference.wandb.ai")?"wandb":n("githubcopilot.com")?"github-copilot":null}function pde(r){let e=r.modalities?.output;if(Array.isArray(e)&&!e.includes("text"))return!1;let t=r.limit??{};if(typeof t.context=="number"&&t.context<=0||typeof t.output=="number"&&t.output<=1)return!1;let n=(r.family??"").toLowerCase(),i=r.id.toLowerCase();return!(n.includes("embedding")||i.includes("embedding"))}function EY(r){return r.filter(pde).map(e=>{let t={name:e.id,maxTokens:Math.max(1,Math.floor(e.limit?.context??128e3))};return typeof e.limit?.output=="number"&&e.limit.output>0&&(t.maxOutputTokens=Math.floor(e.limit.output)),typeof e.temperature=="boolean"&&(t.supportsTemperature=e.temperature),t})}async function TY(r,e){let t=_x(r);if(!t)return e;let n;try{n=await K$()}catch{return e}let i=n[t]?.models;return i?e.map(o=>{let s=i[o.name];if(!s)return o;let a={...o};return typeof s.limit?.context=="number"&&s.limit.context>0&&(a.maxTokens=Math.floor(s.limit.context)),a.maxOutputTokens===void 0&&typeof s.limit?.output=="number"&&s.limit.output>0&&(a.maxOutputTokens=Math.floor(s.limit.output)),a.supportsTemperature===void 0&&typeof s.temperature=="boolean"&&(a.supportsTemperature=s.temperature),a}):e}function Ax(r,e){let t=new Map(e.map(s=>[s.name,s])),n=r.map(s=>{let a=t.get(s.name);return a?{...s,maxTokens:a.maxTokens,maxOutputTokens:a.maxOutputTokens??s.maxOutputTokens,supportsTemperature:a.supportsTemperature??s.supportsTemperature}:s}),i=new Set(r.map(s=>s.name)),o=e.filter(s=>!i.has(s.name));return n.concat(o)}Me();It();var DY=require("obsidian");es();Sx();It();var Xk=128e3;async function Zk(r,e){let t=r.modelSource??"providerApi";if(t==="modelsDev")return kY(r);if(t==="providerApi")return SY(r,e);try{return await SY(r,e)}catch(n){if(!_x(r.endpoint))throw n;return kY(r,n)}}async function kY(r,e){try{let t=await K$(),n=_x(r.endpoint);if(!n||!(n in t))throw new Error(`models.dev does not list a provider that matches ${r.endpoint}.`);let i=Object.values(t[n].models);return EY(i)}catch(t){throw e?new Error(`Provider API failed (${e.message}). Fallback to models.dev also failed: ${t.message}`):t}}async function SY(r,e){let{disableOnlineFeatures:t}=le.getState();if(t)throw new Error("Online features are disabled \u2014 enable them to browse provider models.");if(!r.endpoint)throw new Error("Provider is missing an endpoint URL.");let n=e??r.apiKey??"",i=Nv(r),o=i==="anthropic"?await Cde(r,n):i==="gemini"?await xde(r,n):await wde(r,n);if(!o.length)throw new Error("The provider's models endpoint did not include any usable models.");let s=await TY(r.endpoint,o);return yde(r.endpoint,s)}function yde(r,e){let t=_x(r);if(t!=="openai"&&t!=="google"&&t!=="anthropic")return e;let n=new Map(Lv[t].map(i=>[i.name,i]));return e.map(i=>{let o=n.get(i.name);return o?{...i,maxTokens:i.maxTokens===Xk?o.maxTokens:i.maxTokens,maxOutputTokens:i.maxOutputTokens??o.maxOutputTokens,supportsTemperature:i.supportsTemperature??o.supportsTemperature}:i})}async function Q$(r,e,t){try{let n=await(0,DY.requestUrl)({url:e,headers:t,throw:!1});if(n.status>=400)throw Qk(r.name,n);return await n.json}catch(n){throw new Error(`Provider rejected the models request: ${n.message}`)}}var bde=/(whisper|-tts|tts-|embed|dall-e|image|moderation|transcribe|realtime|rerank)/i;async function wde(r,e){let t=r.endpoint.replace(/\/+$/,""),n=t.endsWith("/v1")?`${t}/models`:`${t}/v1/models`,i={};e&&(i.Authorization=`Bearer ${e}`);let o=await Q$(r,n,i),s=Ede(o),a=[];for(let l of s){let c=Tde(l);c&&!bde.test(c.name)&&a.push(c)}return a}async function Cde(r,e){let t=r.endpoint.replace(/\/+$/,""),n={"anthropic-version":"2023-06-01"};e&&(n["x-api-key"]=e);let i=[],o=null;for(let s=0;s<10;s++){let a=`${t}/v1/models?limit=1000`+(o?`&after_id=${encodeURIComponent(o)}`:""),l=await Q$(r,a,n);for(let c of l.data??[])c.id&&i.push({name:c.id,maxTokens:Xk});if(!l.has_more||!l.last_id)break;o=l.last_id}return i}async function xde(r,e){let t=r.endpoint.replace(/\/+$/,""),n={};e&&(n["x-goog-api-key"]=e);let i=[],o=null;for(let s=0;s<10;s++){let a=`${t}/v1beta/models?pageSize=1000`+(o?`&pageToken=${encodeURIComponent(o)}`:""),l=await Q$(r,a,n);for(let c of l.models??[]){if(!c.name)continue;let u=c.supportedGenerationMethods;if(Array.isArray(u)&&!u.includes("generateContent"))continue;let d={name:c.name.replace(/^models\//,""),maxTokens:typeof c.inputTokenLimit=="number"&&c.inputTokenLimit>0?c.inputTokenLimit:Xk};typeof c.outputTokenLimit=="number"&&c.outputTokenLimit>0&&(d.maxOutputTokens=c.outputTokenLimit),i.push(d)}if(!l.nextPageToken)break;o=l.nextPageToken}return i}function Ede(r){if(Array.isArray(r))return r;if(r&&typeof r=="object"&&Array.isArray(r.data))return r.data;throw new Error("The provider's models response was not a list.")}function Tde(r){let e=r.id??r.name;return e?{name:e,maxTokens:_de(r)}:null}function _de(r){let e=[r.context_length,r.contextLength,r.context_tokens,r.max_context_tokens,r.max_context_length,r.max_input_tokens,r.max_tokens,r.limit?.context];for(let t of e){let n=Ade(t);if(n&&n>0)return Math.floor(n)}return Xk}function Ade(r){if(typeof r=="number"&&Number.isFinite(r))return r;if(typeof r=="string"){let e=Number(r);if(Number.isFinite(e))return e}return null}Kp();var Ide=1440*60*1e3;function Pde(r,e){let t=new Map(r.map(i=>[i.name,JSON.stringify(i)])),n=0;for(let i of e){let o=t.get(i.name);o!==void 0&&o!==JSON.stringify(i)&&(n+=1)}return n}async function ig(r,e){let t=await Va(r,e),n=await Zk(e,t),i=e.models;return e.models=Ax(e.models,n),{added:e.models.length-i.length,updated:Pde(i,e.models)}}function FY(r){return`${(r.name??"").trim().toLowerCase()}\0${(r.endpoint??"").trim().toLowerCase().replace(/\/+$/,"")}`}async function MY(r,e={}){let t=le.getState();if(t.disableOnlineFeatures)return[];let n=t.ai.providers.filter(l=>l.autoSyncModels);if(n.length===0)return[];let i=t.ai.lastModelAutoSyncAt??0;if(!e.ignoreThrottle&&Date.now()-i<Ide)return[];let o=[],s=new Map;for(let l of n){let c={...l,models:l.models.map(u=>({...u}))};try{let{added:u,updated:d}=await ig(r,c);o.push({provider:c.name,added:u,updated:d}),s.set(FY(c),c)}catch(u){o.push({provider:c.name,added:0,updated:0,error:u.message??String(u)})}}let a=o.some(l=>!l.error);le.setState(l=>({...l,ai:{...l.ai,providers:l.ai.providers.map(c=>{let u=s.get(FY(c));return u?{...c,models:Ax(c.models,u.models)}:c}),lastModelAutoSyncAt:a?Date.now():l.ai.lastModelAutoSyncAt}}));for(let l of o)l.error?F.logMessage(`[Model auto-sync] ${l.provider}: failed (${l.error})`):(l.added>0||l.updated>0)&&F.logMessage(`[Model auto-sync] ${l.provider}: ${l.added} new model(s), ${l.updated} updated.`);return o}It();var Ol=require("obsidian");Kp();var Jk=class extends Ol.Modal{constructor(t,n){super(t);this.allModels=[];this.filtered=[];this.selectedIds=new Set;this.mode="add";this.resolved=!1;this.loadError=null;this.provider=n,this.waitForClose=new Promise((i,o)=>{this.resolvePromise=i,this.rejectPromise=o}),this.open(),this.loadData().then(()=>this.display())}async loadData(){try{let t=await Va(this.app,this.provider);this.allModels=await Zk(this.provider,t),this.filtered=this.allModels.slice(),this.loadError=null}catch(t){this.loadError=`${t.message??t}`,new Ol.Notice(`Failed to load model directory: ${this.loadError}`)}}display(){this.contentEl.empty(),this.modalEl.addClass("qa-ai-wide-modal"),this.contentEl.addClass("qa-ai-scroll-content"),this.contentEl.createEl("h2",{text:`Browse models for ${this.provider.name}`,cls:"qa-modal-title"}),new Ol.Setting(this.contentEl).setName("Search").addText(t=>{t.setPlaceholder("Filter by name").onChange(n=>{let i=n.trim().toLowerCase();this.filtered=this.allModels.filter(o=>o.name.toLowerCase().includes(i)),this.renderList()})}).addExtraButton(t=>{t.setIcon("check"),t.setTooltip("Select all"),t.onClick(()=>{this.filtered.forEach(n=>this.selectedIds.add(n.name)),this.renderList()})}).addExtraButton(t=>{t.setIcon("x"),t.setTooltip("Clear selection"),t.onClick(()=>{this.selectedIds.clear(),this.renderList()})}),new Ol.Setting(this.contentEl).setName("Import mode").setDesc("Add will append new models. Replace will overwrite existing models with the selected list.").addDropdown(t=>{t.addOption("add","Add only"),t.addOption("replace","Replace existing"),t.setValue(this.mode),t.onChange(n=>this.mode=n)}).addButton(t=>{t.setButtonText("Import selected").setCta().onClick(()=>this.importSelected())}),this.contentEl.createDiv({cls:"qa-model-directory"}),this.renderList()}renderList(){let t=this.contentEl.querySelector(".qa-model-directory");if(t){if(t.empty(),this.filtered.length===0){let n=this.loadError?`Couldn't load models: ${this.loadError}. Check the API key and endpoint.`:this.allModels.length===0?"No models available for this provider.":"No models match your filter.";t.createDiv({text:n,cls:"qa-model-directory-empty"});return}for(let n of this.filtered){let i=t.createEl("label",{cls:"qa-model-row"}),o=this.contentEl.ownerDocument.createElement("input");o.type="checkbox",o.checked=this.selectedIds.has(n.name),o.onchange=()=>{o.checked?this.selectedIds.add(n.name):this.selectedIds.delete(n.name)},i.appendChild(o),i.createDiv({text:n.name,cls:"qa-model-row-title"}),i.createDiv({text:`${n.maxTokens.toLocaleString()} tokens max`,cls:"qa-model-row-meta"})}}}importSelected(){if(this.selectedIds.size===0){new Ol.Notice("Select at least one model.");return}try{let n=this.allModels.filter(i=>this.selectedIds.has(i.name)).map(i=>({...i}));if(!n.length){new Ol.Notice("No models selected to import.");return}this.resolved=!0,this.resolvePromise({imported:n,mode:this.mode}),this.close()}catch(t){new Ol.Notice(`Import failed: ${t.message??t}`)}}onClose(){this.resolved||this.resolvePromise(null),super.onClose()}};yi();Hs();var Ji=require("obsidian");es();var RY=[{id:"openai",name:"OpenAI",endpoint:"https://api.openai.com/v1",doc:"https://platform.openai.com/docs/models",kind:"openai",modelSource:"modelsDev",seedKey:"openai"},{id:"gemini",name:"Gemini",endpoint:"https://generativelanguage.googleapis.com",doc:"https://ai.google.dev/gemini-api/docs",kind:"gemini",modelSource:"auto",seedKey:"google"},{id:"anthropic",name:"Anthropic",endpoint:"https://api.anthropic.com",doc:"https://docs.anthropic.com/",kind:"anthropic",modelSource:"auto",seedKey:"anthropic"},{id:"groq",name:"Groq",endpoint:"https://api.groq.com/openai/v1",doc:"https://console.groq.com/docs/models",kind:"openai",modelSource:"auto"},{id:"togetherai",name:"TogetherAI",endpoint:"https://api.together.xyz/v1",doc:"https://docs.together.ai/docs/serverless-models",kind:"openai",modelSource:"auto"},{id:"openrouter",name:"OpenRouter",endpoint:"https://openrouter.ai/api/v1",doc:"https://openrouter.ai/models",kind:"openai",modelSource:"auto"},{id:"hugging-face",name:"Hugging Face",endpoint:"https://router.huggingface.co/v1",doc:"https://huggingface.co/docs/inference-providers",kind:"openai",modelSource:"auto"},{id:"mistral",name:"Mistral",endpoint:"https://api.mistral.ai/v1",doc:"https://docs.mistral.ai/getting-started/models/",kind:"openai",modelSource:"auto"},{id:"deepseek",name:"DeepSeek",endpoint:"https://api.deepseek.com",doc:"https://platform.deepseek.com/api-docs/",kind:"openai",modelSource:"auto"}];var eS=class extends Ji.Modal{constructor(e,t){super(e),this.providers=t,this.waitForClose=new Promise((n,i)=>{this.resolvePromise=n,this.rejectPromise=i}),this.open(),this.display()}addHeader(e){e.createEl("h2",{text:"Add a provider",cls:"qa-modal-title"})}display(){this.contentEl.empty(),this.modalEl.addClass("qa-ai-wide-modal"),this.contentEl.addClass("qa-ai-scroll-content"),this.addHeader(this.contentEl);let e=this.contentEl.createDiv({cls:"qa-provider-grid"});for(let t of RY){let n=e.createDiv({cls:"qa-provider-card"});if(n.createEl("div",{text:t.name,cls:"qa-provider-card-title"}),n.createEl("div",{text:t.endpoint,cls:"qa-provider-card-endpoint"}),t.doc){let s=n.createEl("a",{text:"Docs",href:t.doc});s.target="_blank",s.rel="noopener noreferrer"}let i="",o=new Ji.Setting(n).setName("API key").setDesc("Select a secret from SecretStorage").addComponent(s=>new Ji.SecretComponent(this.app,s).setValue(i).onChange(a=>{i=a}));o.settingEl.addClass("qa-provider-api-setting"),o.addButton(s=>{s.setButtonText("Connect").setCta().onClick(async()=>{try{let a=i.trim();try{new URL(t.endpoint)}catch{new Ji.Notice(`Invalid endpoint URL for ${t.name}.`);return}let l=t.endpoint.toLowerCase();if(["openai.com","generativelanguage.googleapis.com","anthropic","api.groq.com","together.xyz","openrouter.ai","router.huggingface.co","api.mistral.ai","api.deepseek.com"].some(m=>l.includes(m))&&!a){new Ji.Notice(`${t.name} requires an API key.`);return}let u=m=>m.trim().toLowerCase(),d=m=>m.trim().toLowerCase().replace(/\/+$/,"");if(this.providers.some(m=>u(m.name)===u(t.name)&&d(m.endpoint)===d(t.endpoint))){new Ji.Notice(`${t.name} is already configured.`);return}let p={name:t.name,endpoint:t.endpoint,id:yT(t.id,this.providers),kind:t.kind,apiKey:"",apiKeyRef:a,models:[],modelSource:t.modelSource??"auto",autoSyncModels:!0};s.setButtonText("Connecting..."),s.setDisabled(!0),await this.importInitialModels(p,t),this.providers.push(p),this.close()}catch(a){s.setButtonText("Connect"),s.setDisabled(!1),new Ji.Notice(`Failed to add provider: ${a.message??a}`)}})})}new Ji.Setting(this.contentEl).setName("Custom provider").setDesc("Create any custom endpoint (OpenAI-compatible or otherwise)").addButton(t=>{t.setButtonText("Add custom...").onClick(()=>{let n={id:yT("custom",this.providers),name:"Custom",endpoint:"",apiKey:"",apiKeyRef:"",models:[],modelSource:"providerApi"};this.providers.push(n),new Ji.Notice("Custom provider added. Click Edit to configure."),this.close()})})}async importInitialModels(e,t){try{await ig(this.app,e),new Ji.Notice(`${t.name} connected with ${e.models.length} models.`)}catch(n){let i=n.message??String(n);t.seedKey?(e.models=wT(t.seedKey),new Ji.Notice(`${t.name} added with its built-in model list. Live model loading failed: ${i}`)):new Ji.Notice(`${t.name} added, but loading models failed: ${i} Use "Sync now" in the provider's settings to retry.`)}}onClose(){this.resolvePromise(this.providers??null),super.onClose()}};Wp();var tS=class extends Ir.Modal{constructor(e,t){super(t),this.providers=e,bT(this.providers),this.waitForClose=new Promise((n,i)=>{this.rejectPromise=i,this.resolvePromise=n}),this.open(),this.display(),this.autoSyncOnOpen()}async autoSyncOnOpen(){if(le.getState().disableOnlineFeatures)return;let e=!1;for(let t of this.providers)if(t.autoSyncModels)try{let{added:n}=await ig(this.app,t);e=e||n>0}catch{}e&&!this.selectedProvider&&this.reload()}display(){let e=this.selectedProvider?`${this.selectedProvider.name}`:"Providers";if(this.contentEl.createEl("h2",{text:e,cls:"qa-modal-title"}),this.selectedProvider){this.addProviderSetting(this.contentEl);return}this.addProvidersSetting(this.contentEl)}reload(){this.contentEl.empty(),this.display()}addProvidersSetting(e){new Ir.Setting(e).setName("Providers").setDesc("Providers for the AI Assistant").addButton(n=>{n.setButtonText("Add provider").onClick(async()=>{await new eS(this.app,this.providers).waitForClose,this.reload()}),n.setCta()});let t=e.createDiv({cls:"providers-container qa-ai-list-container"});this.providers.forEach((n,i)=>{new Ir.Setting(t).setName(n.name).setDesc(n.endpoint).addButton(o=>{o.onClick(async()=>{await Qi.Prompt(this.app,`Are you sure you want to delete ${n.name}?`)&&(this.providers.splice(i,1),this.reload())}),o.setDestructive(),o.setIcon("trash")}).addButton(o=>{o.setButtonText("Edit").onClick(()=>{this.selectedProvider=n,this._selectedProviderClone=gt(n),this.reload()})})})}addProviderSetting(e){this.addNameSetting(e),this.addEndpointSetting(e),this.addApiKeySetting(e),this.addKindSetting(e),this.addModelSourceSetting(e),this.addProviderModelsSetting(e),this.addImportModelsFromDirectorySetting(e),this.addAutoSyncSetting(e),this.addProviderSettingButtonRow(this.contentEl)}addNameSetting(e){let t=this.selectedProvider.id;new Ir.Setting(e).setName("Name").setDesc(t?`The display name of the provider. Its stable ID is "${t}" \u2014 use that to qualify models in scripts, e.g. ai.prompt with "${t}/model-name".`:"The display name of the provider").addText(n=>{n.setValue(this.selectedProvider.name).onChange(i=>{this.selectedProvider.name=i})})}addEndpointSetting(e){new Ir.Setting(e).setName("Endpoint").setDesc("The endpoint for the AI Assistant").addText(t=>{t.setValue(this.selectedProvider.endpoint).onChange(n=>{this.selectedProvider.endpoint=n})})}addApiKeySetting(e){let n=!!this.selectedProvider?.apiKey&&!this.selectedProvider?.apiKeyRef?"Legacy API key detected. Select a SecretStorage entry to migrate.":"Select a secret from SecretStorage";new Ir.Setting(e).setName("API key").setDesc(n).addComponent(i=>new Ir.SecretComponent(this.app,i).setValue(this.selectedProvider?.apiKeyRef??"").onChange(o=>{this.selectedProvider&&(this.selectedProvider.apiKeyRef=o,this.selectedProvider.apiKey="")}))}addKindSetting(e){new Ir.Setting(e).setName("Provider type").setDesc("The request format this provider expects. Auto-detect recognizes the official Anthropic and Gemini endpoints and treats everything else as OpenAI-compatible; pick a type explicitly for a proxy or custom endpoint.").addDropdown(t=>{t.addOption("","Auto-detect"),t.addOption("openai","OpenAI-compatible"),t.addOption("anthropic","Anthropic"),t.addOption("gemini","Gemini"),t.setValue(this.selectedProvider?.kind??""),t.onChange(n=>{this.selectedProvider&&(this.selectedProvider.kind=n||void 0)})})}addModelSourceSetting(e){let t=this.selectedProvider;new Ir.Setting(e).setName("Model source").setDesc("Choose where QuickAdd looks when browsing or syncing models for this provider.").addDropdown(n=>{n.addOption("providerApi","Provider models endpoint (requires API key)"),n.addOption("modelsDev","models.dev directory"),n.addOption("auto","Automatic (try provider, fallback to models.dev)");let i=t?.modelSource??"providerApi";n.setValue(i),n.onChange(o=>{this.selectedProvider&&(this.selectedProvider.modelSource=o,this.reload())})})}addProviderModelsSetting(e){let t=e.createDiv({cls:"models-container qa-ai-list-container"});this.selectedProvider.models.forEach((n,i)=>{let o=[`Context: ${n.maxTokens.toLocaleString()} tokens`];n.maxOutputTokens&&o.push(`Output: ${n.maxOutputTokens.toLocaleString()} tokens`),n.supportsTemperature===!1&&o.push("Fixed sampling (no temperature)"),new Ir.Setting(t).setName(n.name).setDesc(o.join(" \xB7 ")).addButton(s=>{s.onClick(async()=>{await Qi.Prompt(this.app,`Are you sure you want to delete ${n.name}?`)&&(this.selectedProvider.models.splice(i,1),this.reload())}),s.setDestructive(),s.setIcon("trash")})}),new Ir.Setting(t).setName("Add model").addButton(n=>{n.setButtonText("Add model").onClick(async()=>{let i,o;try{i=await Sr.Prompt(this.app,"Model name"),o=await Sr.Prompt(this.app,"Max tokens")}catch{return}let s=i.trim();if(!s){new Ir.Notice("Model name cannot be empty.");return}let a=o.trim();if(!/^[1-9]\d*$/.test(a)){new Ir.Notice("Max tokens must be a positive number.");return}let l=Number(a);this.selectedProvider.models.push({name:s,maxTokens:l}),this.reload()}),n.setCta()})}addImportModelsFromDirectorySetting(e){let t=this.describeModelSource(this.selectedProvider);new Ir.Setting(e).setName("Import models").setDesc(`Browse and import models from ${t}.`).addButton(n=>{n.setButtonText("Browse models").onClick(async()=>{let i=await new Jk(this.app,this.selectedProvider).waitForClose;if(!i)return;let{imported:o,mode:s}=i;s==="replace"?this.selectedProvider.models=o:this.selectedProvider.models=Ax(this.selectedProvider.models,o),new Ir.Notice(`Imported ${o.length} models${s==="replace"?" (replaced)":" (added)"}.`),this.reload()}),n.setCta()})}addAutoSyncSetting(e){let t=this.describeModelSource(this.selectedProvider);new Ir.Setting(e).setName("Auto-sync models").setDesc(`Keep this provider's models current automatically: QuickAdd imports new models and refreshed context limits from ${t} once a day and when these settings open.`).addToggle(n=>{let i=!!this.selectedProvider?.autoSyncModels;n.setValue(i).onChange(o=>{this.selectedProvider&&(this.selectedProvider.autoSyncModels=o)})}).addButton(n=>{n.setButtonText("Sync now").onClick(async()=>{try{let{added:i,updated:o}=await ig(this.app,this.selectedProvider);new Ir.Notice(i>0||o>0?`Synced from ${t}: ${i} new model(s), ${o} updated.`:`Synced from ${t}: already up to date.`),this.reload()}catch(i){new Ir.Notice(`Sync failed: ${i.message??i}`)}}),n.setCta()})}restoreSelectedProviderFromClone(){if(!this.selectedProvider||!this._selectedProviderClone)return;let e=this.providers.indexOf(this.selectedProvider);e!==-1&&(this.providers[e]=this._selectedProviderClone),this.selectedProvider=null,this._selectedProviderClone=null}addProviderSettingButtonRow(e){let t=e.createDiv({cls:"button-row qa-ai-provider-button-row"}),n=new Ir.ButtonComponent(t);n.setButtonText("Cancel"),n.setDestructive(),n.onClick(()=>{this.restoreSelectedProviderFromClone(),this.reload()});let i=new Ir.ButtonComponent(t);i.setButtonText("Save"),i.setCta(),i.onClick(()=>{this.selectedProvider=null,this.reload()})}describeModelSource(e){switch(e?.modelSource??"providerApi"){case"modelsDev":return"the models.dev directory";case"auto":return"the provider's models endpoint (falls back to models.dev)";default:return"the provider's models endpoint"}}onClose(){this.restoreSelectedProviderFromClone(),this.resolvePromise(this.providers),super.onClose()}};qt();var rS=class extends qa.Modal{constructor(e,t){super(e),this.settings=t,this.waitForClose=new Promise((n,i)=>{this.rejectPromise=i,this.resolvePromise=n}),this.open(),this.display()}display(){this.modalEl.addClass("qa-ai-wide-modal"),this.contentEl.addClass("qa-ai-scroll-content"),this.contentEl.createEl("h2",{text:"AI Assistant settings",cls:"qa-modal-title"}),this.addProvidersSetting(this.contentEl),this.addDefaultModelSetting(this.contentEl),this.addPromptTemplateFolderPathSetting(this.contentEl),this.addShowAssistantSetting(this.contentEl),this.addConfirmToolCallsSetting(this.contentEl),this.addDefaultSystemPromptSetting(this.contentEl)}reload(){this.contentEl.empty(),this.display()}addProvidersSetting(e){new qa.Setting(e).setName("Providers").setDesc("The providers for the AI Assistant").addButton(t=>{t.setButtonText("Edit providers").onClick(()=>{new tS(this.settings.providers,this.app).waitForClose.then(()=>{this.reload()})})})}addDefaultModelSetting(e){new qa.Setting(e).setName("Default model").setDesc("The default model for the AI Assistant").addDropdown(t=>{Tk(t,{model:this.settings.defaultModel,modelRef:this.settings.defaultModelRef},n=>{this.settings.defaultModel=n.model,this.settings.defaultModelRef=n.modelRef})})}addPromptTemplateFolderPathSetting(e){new qa.Setting(e).setName("Prompt template folder path").setDesc("Path to your folder with prompt templates").addText(t=>{t.setValue(this.settings.promptTemplatesFolderPath).onChange(n=>{this.settings.promptTemplatesFolderPath=n}),new ii(this.app,t.inputEl,Ls(this.app))})}addShowAssistantSetting(e){new qa.Setting(e).setName("Show assistant").setDesc("Show status messages from the AI Assistant").addToggle(t=>{t.setValue(this.settings.showAssistant),t.onChange(n=>{this.settings.showAssistant=n})})}addConfirmToolCallsSetting(e){new qa.Setting(e).setName("Confirm AI tool calls").setDesc("When an AI agent runs script-defined or built-in tools, ask before executing. 'Destructive only' confirms tools not marked read-only; 'Always' confirms every tool; 'Never' defers to each tool's own setting. A tool that requires approval is always confirmed regardless.").addDropdown(t=>{t.addOption("destructive","Destructive tools only (recommended)"),t.addOption("always","Always confirm every tool"),t.addOption("never","Never (use each tool's own setting)"),t.setValue(this.settings.confirmToolCalls??"destructive"),t.onChange(n=>{this.settings.confirmToolCalls=n})})}addDefaultSystemPromptSetting(e){new qa.Setting(e).setName("Default system prompt").setDesc("The default system prompt for the AI Assistant");let t=new qa.TextAreaComponent(e);t.inputEl.addClass("qa-ai-prompt-textarea"),t.inputEl.setAttribute("aria-label","Default system prompt");let n=xk(e,t.inputEl,this.settings.defaultSystemPrompt??"");t.setValue(this.settings.defaultSystemPrompt).onChange(i=>{this.settings.defaultSystemPrompt=i,n(i)})}onClose(){this.resolvePromise(this.settings),super.onClose()}};var NY=require("obsidian");Wt();var $Y=[{type:"Template",label:"Template",description:"Create a note from a template file.",iconId:"file-text"},{type:"Capture",label:"Capture",description:"Add text to a note \u2014 append, prepend, or insert.",iconId:"pencil"},{type:"Macro",label:"Macro",description:"Run a sequence of commands and scripts.",iconId:"terminal"}];function nS(r){switch(r){case"Template":return"New template";case"Capture":return"New capture";case"Macro":return"New macro";case"Multi":return"New folder"}}function OY(r,e){let t=nS(r),n=new Set(Un(e).map(o=>o.name));if(!n.has(t))return t;let i=2;for(;n.has(`${t} ${i}`);)i++;return`${t} ${i}`}var Fde=W('<div><button type="button" class="qaNewFolderBtn svelte-a7rp4h"><!> <span> </span></button> <button type="button" aria-haspopup="menu"><!> <span> </span> <!></button></div>'),Mde={hash:"svelte-a7rp4h",code:`.qaAddChoiceControls.svelte-a7rp4h {display:flex;flex-direction:row;align-items:center;gap:0.5rem;}.qaAddChoiceControls.svelte-a7rp4h button:where(.svelte-a7rp4h) {display:inline-flex;align-items:center;gap:0.35em;}
|
||
|
||
/* The chevron sits tighter to the label than the leading plus. */.qaNewChoiceBtn.svelte-a7rp4h svg:last-child {margin-left:-0.1em;opacity:0.85;}
|
||
|
||
/* Per-folder ("compact") controls render as quiet, clickable text links \u2014 not
|
||
filled buttons \u2014 so they read as "add inside this folder" affordances and
|
||
don't compete with the global primary CTA, especially when repeated across
|
||
nested folders. */.qaAddChoiceControls.compact.svelte-a7rp4h {gap:1rem;}.qaAddChoiceControls.compact.svelte-a7rp4h button:where(.svelte-a7rp4h) {font-size:var(--font-ui-smaller);padding:2px 0;gap:0.25em;background:transparent;border:none;box-shadow:none;color:var(--text-muted);}.qaAddChoiceControls.compact.svelte-a7rp4h button:where(.svelte-a7rp4h):hover {color:var(--text-accent);text-decoration:underline;}
|
||
|
||
/* Mobile/touch: stretch so the two buttons fill the bar width instead of
|
||
cramming to the right. Driven by \`fill\` (Platform.isMobile from the bottom
|
||
bar) because viewport media queries don't fire under desktop mobile-emulation. */.qaAddChoiceControls.fill.svelte-a7rp4h {flex:1;}.qaAddChoiceControls.fill.svelte-a7rp4h button:where(.svelte-a7rp4h) {flex:1;justify-content:center;}
|
||
|
||
/* Narrow desktop windows stack the non-compact controls. Filled controls (the
|
||
mobile bottom bar) are excluded so this can't override \`.fill\`'s side-by-side
|
||
50/50 layout on a phone-width viewport (Platform.isMobile + width <= 800px). */
|
||
@media (max-width: 800px) {.qaAddChoiceControls.svelte-a7rp4h:not(.compact):not(.fill) {flex-direction:column;align-items:stretch;}
|
||
}`};function og(r,e){we(e,!0),ot(r,Mde);let t=he(e,"targetFolderId",3,void 0),n=he(e,"targetFolderName",3,void 0),i=he(e,"compact",3,!1),o=he(e,"fill",3,!1),s=Ae(!1);function a(V){let oe=new NY.Menu;for(let R of $Y)oe.addItem(O=>O.setTitle(`${R.label} \u2014 ${R.description}`).setIcon(R.iconId).onClick(q=>{let B=q.altKey===!0;e.onAddChoice(nS(R.type),R.type,t(),B)}));Z(s,!0),oe.onHide(()=>{Z(s,!1)});let ce=V.target?.closest("button");if(ce){let R=ce.getBoundingClientRect();oe.showAtPosition({x:R.left,y:R.bottom+4})}else oe.showAtMouseEvent(V)}function l(){e.onAddChoice(nS("Multi"),"Multi",t(),!0)}let c=N(()=>i()?"Add choice":"New choice"),u=N(()=>i()?"Add folder":"New folder"),d=N(()=>n()?`Add choice to ${n()}`:h(c)),f=N(()=>n()?`Add folder to ${n()}`:h(u));var p=Fde();let m;var v=I(p),g=I(v);Rt(g,{iconId:"folder-plus",size:14});var y=A(g,2),w=I(y,!0);S(y),S(v);var x=A(v,2);let C;var _=I(x);Rt(_,{iconId:"plus",size:14});var E=A(_,2),D=I(E,!0);S(E);var P=A(E,2);{var H=V=>{Rt(V,{iconId:"chevron-down",size:12})};ne(P,V=>{i()||V(H)})}S(x),S(p),de(()=>{m=Ct(p,1,"qaAddChoiceControls svelte-a7rp4h",null,m,{compact:i(),fill:o()&&!i()}),ke(v,"aria-label",h(f)),ke(v,"title",i()?h(f):void 0),me(w,h(u)),C=Ct(x,1,"qaNewChoiceBtn svelte-a7rp4h",null,C,{"mod-cta":!i()}),ke(x,"aria-expanded",h(s)),ke(x,"aria-label",h(d)),ke(x,"title",i()?h(d):void 0),me(D,h(c))}),De("click",v,l),De("click",x,a),$(r,p),Ce()}Et(["click"]);var Rde=W('<div class="rightButtonsContainer svelte-1es4f02"><!> <!> <!> <!> <!> <!></div>'),$de={hash:"svelte-1es4f02",code:`.rightButtonsContainer.svelte-1es4f02 {display:flex;align-items:center;
|
||
/* Icons carry their own 3px padding inside the choice rows (24px hit
|
||
boxes), so a tight gap keeps the cluster compact without touching. */gap:2px;flex:0 0 auto;}`};function Dx(r,e){we(e,!0),ot(r,$de);let t=he(e,"showConfigureButton",3,!0),n=he(e,"showDuplicateButton",3,!0),i=he(e,"commandEnabled",3,!1),o=he(e,"choiceName",3,"");var s=Rde(),a=I(s);{var l=g=>{{let y=N(()=>`Configure${o()?" "+o():""}`);er(g,{iconId:"settings",get label(){return h(y)},extraClass:"qa-row-secondary-action",get onclick(){return e.onConfigureChoice}})}};ne(a,g=>{t()&&g(l)})}var c=A(a,2);{var u=g=>{{let y=N(()=>`Duplicate${o()?" "+o():""}`);er(g,{iconId:"copy",get label(){return h(y)},extraClass:"qa-row-secondary-action",get onclick(){return e.onDuplicateChoice}})}};ne(c,g=>{n()&&g(u)})}var d=A(c,2);{let g=N(()=>`Delete${o()?" "+o():""}`);er(d,{iconId:"trash-2",get label(){return h(g)},extraClass:"qa-row-secondary-action",get onclick(){return e.onDeleteChoice}})}var f=A(d,2);{var p=g=>{{let y=N(()=>`More options${o()?" for "+o():""}`);er(g,{iconId:"more-vertical",ariaHasPopup:"menu",get label(){return h(y)},onclick:w=>e.onOpenMenu?.(w.currentTarget)})}};ne(f,g=>{e.onOpenMenu&&g(p)})}var m=A(f,2);{let g=N(()=>`Command palette${o()?": "+o():""}`);er(m,{iconId:"zap",get ariaPressed(){return i()},get label(){return h(g)},extraClass:"qa-row-secondary-action",get onclick(){return e.onToggleCommand}})}var v=A(m,2);{let g=N(()=>`Reorder${o()?" "+o():""}`);ki(v,{get label(){return h(g)},get dragDisabled(){return e.dragDisabled},get onDragStart(){return e.onDragHandleDown},get onMoveUp(){return e.onMoveUp},get onMoveDown(){return e.onMoveDown}})}S(s),$(r,s),Ce()}var oS=require("obsidian");var LY=require("obsidian");function iS(r,e,t,n){e.replaceChildren(),LY.MarkdownRenderer.render(n,r,e,"/",t)}Wt();var Ode=W('<div class="choiceListItem"><span class="qaChoiceRowIcon" aria-hidden="true"><!></span> <span class="choiceListItemName"></span> <!></div>'),Nde={hash:"svelte-1aljzaf",code:""};function X$(r,e){we(e,!0),ot(r,Nde);let t=!0,n=Ae(void 0),i=new oS.Component;hr(()=>{h(n)&&iS(e.choice.name,h(n),i,e.app)}),hr(()=>()=>i.unload());let o=()=>({onRename:()=>e.actions.onRenameChoice(e.choice),onToggle:()=>e.actions.onToggleCommand(e.choice),onConfigure:()=>e.actions.onConfigureChoice(e.choice),onDuplicate:()=>e.actions.onDuplicateChoice(e.choice),onDelete:()=>e.actions.onDeleteChoice(e.choice),onMove:p=>e.actions.onMoveChoice(e.choice,p)});function s(p){jk(e.app,p,e.choice,e.roots,o())}function a(p){Gk(e.app,p,e.choice,e.roots,o())}var l=Ode(),c=I(l),u=I(c);{let p=N(()=>bm(e.choice));Rt(u,{get iconId(){return h(p)},size:15})}S(c);var d=A(c,2);oc(d,p=>Z(n,p),()=>h(n));var f=A(d,2);Dx(f,{get onDragHandleDown(){return e.startDrag},onDeleteChoice:()=>e.actions.onDeleteChoice(e.choice),onConfigureChoice:()=>e.actions.onConfigureChoice(e.choice),onToggleCommand:()=>e.actions.onToggleCommand(e.choice),onDuplicateChoice:()=>e.actions.onDuplicateChoice(e.choice),onOpenMenu:a,get onMoveUp(){return e.onMoveUp},get onMoveDown(){return e.onMoveDown},get choiceName(){return e.choice.name},get commandEnabled(){return e.choice.command},showConfigureButton:t,get dragDisabled(){return e.dragDisabled},showDuplicateButton:!0}),S(l),de(()=>ke(l,"data-choice-id",e.choice.id)),De("contextmenu",l,s),De("dblclick",l,p=>{oS.Platform.isMobile||p.target.closest("button, a")||e.actions.onConfigureChoice(e.choice)}),$(r,l),Ce()}Et(["contextmenu","dblclick"]);var sS=require("obsidian");Wt();var Lde=W('<span class="qaFolderCount svelte-1jxjn06" aria-hidden="true"> </span>'),Bde=W(`<p class="qaUnreadableFolder svelte-1jxjn06">QuickAdd couldn't read this folder's contents. They're still
|
||
in <code class="svelte-1jxjn06">data.json</code>.</p>`),Ude=W('<div class="nestedAddRow svelte-1jxjn06"><!></div>'),Vde=W("<!> <!>",1),qde=W('<div class="nestedChoiceList svelte-1jxjn06"><!></div>'),Wde=W('<div><div class="multiChoiceListItem"><button type="button" class="multiChoiceListItemName svelte-1jxjn06"><span aria-hidden="true"><!></span> <span class="choiceListItemName"></span> <!></button> <!></div> <!></div>'),zde={hash:"svelte-1jxjn06",code:`
|
||
/* Row surface (min-height, padding, radius, hover, rhythm) is shared with
|
||
leaf rows and lives in styles.css \u2014 see "Choice list rows". Only the
|
||
folder-specific pieces stay here. */
|
||
|
||
/* Base icon = chevron-down (expanded); collapsed rotates to point RIGHT,
|
||
matching Obsidian's own collapse grammar (file explorer, outline). */.multiChoiceCollapseIcon.svelte-1jxjn06 {transition:transform 150ms ease;}.multiChoiceCollapseIcon.is-collapsed.svelte-1jxjn06 {transform:rotate(-90deg);}
|
||
|
||
@media (prefers-reduced-motion: reduce) {.multiChoiceCollapseIcon.svelte-1jxjn06 {transition:none;}
|
||
}
|
||
|
||
/* Full-width collapse toggle: reset native <button> chrome while keeping
|
||
native keyboard activation + aria-expanded. It hosts the shared icon
|
||
column (the chevron), so the folder NAME lands on the exact leaf-name x
|
||
for free \u2014 same 8px column gap as the leaf rows. */.multiChoiceListItemName.svelte-1jxjn06 {flex:1 1 auto;min-width:0;align-self:stretch;display:flex;align-items:center;
|
||
/* Obsidian's base button centers flex content; the name must not rely
|
||
on a growing child to stay left (it stopped growing for the count). */justify-content:flex-start;gap:8px;background:transparent;border:none;box-shadow:none;padding:0;
|
||
/* Obsidian's base button rule sets height: var(--input-height) (30px),
|
||
which would make folder rows 4px taller than leaf rows \u2014 the exact
|
||
rhythm break this redesign removes. */height:auto;min-height:0;font:inherit;color:inherit;text-align:left;cursor:pointer;
|
||
/* Suppress double-tap-zoom + its click delay on touch \u2014 proper touch hygiene
|
||
for a tap target, and reduces the ghost-click the dedupe above also guards. */touch-action:manipulation;}
|
||
|
||
/* The count reads as part of the label ("Misc \xB7 12"), so the name must not
|
||
grow \u2014 it keeps its ellipsis via flex-shrink + the shared min-width: 0. */.multiChoiceListItemName.svelte-1jxjn06 .choiceListItemName {flex:0 1 auto;}
|
||
|
||
/* Same slot, weight and colour as the empty-folder hint in ChoiceList, so a
|
||
folder we cannot read reads as a variation of "empty" rather than an alarm. */.qaUnreadableFolder.svelte-1jxjn06 {margin:0;padding:6px 8px 8px;color:var(--text-faint);font-size:var(--font-ui-smaller, 12px);line-height:1.4;}.qaUnreadableFolder.svelte-1jxjn06 code:where(.svelte-1jxjn06) {font-size:inherit;}.qaFolderCount.svelte-1jxjn06 {flex:0 0 auto;color:var(--text-faint);font-size:var(--font-ui-smaller, 12px);font-variant-numeric:tabular-nums;line-height:1;}.multiChoiceListItemName.svelte-1jxjn06:focus-visible {outline:2px solid var(--interactive-accent);outline-offset:1px;border-radius:var(--radius-s, 4px);}
|
||
|
||
/* Just the indent \u2014 the drop-into-folder ring is drawn on the ACTUAL dndzone
|
||
(.choiceList, in ChoiceList.svelte) so the highlighted area equals the
|
||
droppable area (WYSIWYG); it is NOT drawn on this wrapper, which extends past
|
||
the zone to the add-row/hint. The ::before is an indent GUIDE under the
|
||
parent's icon column (x = row padding 8px + half the 18px column, minus
|
||
half the line), clarifying what belongs to the open folder. */.nestedChoiceList.svelte-1jxjn06 {position:relative;padding-left:26px;}.nestedChoiceList.svelte-1jxjn06::before {content:"";position:absolute;left:16px;top:3px;bottom:3px;width:1px;background:var(--background-modifier-border);pointer-events:none;}
|
||
|
||
/* The per-folder add-row reads as a ghost row of the folder: aligned to the
|
||
child rows' padding, one tight step (4px) below the last child. */.nestedAddRow.svelte-1jxjn06 {margin:2px 0 4px 0;padding:0 8px;}`};function Z$(r,e){we(e,!0),ot(r,zde);let t=he(e,"choice",7),n=he(e,"forceDragDisabled",3,!1),i=N(()=>st(t())),o=N(()=>zs(t())),s=!0,a=Ae(void 0),l=new sS.Component;hr(()=>{h(a)&&iS(t().name,h(a),l,e.app)}),hr(()=>()=>l.unload());let c=()=>({onRename:()=>e.actions.onRenameChoice(t()),onToggle:()=>e.actions.onToggleCommand(t()),onConfigure:()=>e.actions.onConfigureChoice(t()),onDuplicate:()=>e.actions.onDuplicateChoice(t()),onDelete:()=>e.actions.onDeleteChoice(t()),onMove:V=>e.actions.onMoveChoice(t(),V)});function u(V){jk(e.app,V,t(),e.roots,c())}function d(V){Gk(e.app,V,t(),e.roots,c())}let f={...Ot(()=>e.actions),onReorderChoices:V=>{t().choices=V,e.actions.onCommitFolder(t().id,V)}};function p(){n()||e.actions.onToggleCollapsed(t())}var m=Wde(),v=I(m),g=I(v),y=I(g);let w;var x=I(y);Rt(x,{iconId:"chevron-down",size:16}),S(y);var C=A(y,2);oc(C,V=>Z(a,V),()=>h(a));var _=A(C,2);{var E=V=>{var oe=Lde(),ce=I(oe,!0);S(oe),de(()=>me(ce,h(i).length)),$(V,oe)};ne(_,V=>{t().collapsed&&h(i).length>0&&V(E)})}S(g),Fr(g,V=>qA?.(V));var D=A(g,2);Dx(D,{get onDragHandleDown(){return e.startDrag},onDeleteChoice:()=>e.actions.onDeleteChoice(t()),onConfigureChoice:()=>e.actions.onConfigureChoice(t()),onToggleCommand:()=>e.actions.onToggleCommand(t()),onDuplicateChoice:()=>e.actions.onDuplicateChoice(t()),onOpenMenu:d,get onMoveUp(){return e.onMoveUp},get onMoveDown(){return e.onMoveDown},showConfigureButton:s,get dragDisabled(){return e.dragDisabled},get choiceName(){return t().name},get commandEnabled(){return t().command},showDuplicateButton:!0}),S(v);var P=A(v,2);{var H=V=>{var oe=dn(),ce=Pe(oe);{var R=O=>{var q=qde(),B=I(q);{var ie=Y=>{var K=Bde();$(Y,K)},j=Y=>{var K=Vde(),se=Pe(K);{let be=N(()=>h(i).length===0),xe=N(()=>e.rootReorder??e.actions.onReorderChoices);sg(se,{get app(){return e.app},get roots(){return e.roots},get choices(){return h(i)},nested:!0,get isEmptyFolder(){return h(be)},get forceDragDisabled(){return n()},get rootReorder(){return h(xe)},get actions(){return f}})}var pe=A(se,2);{var ge=be=>{var xe=Ude(),Ue=I(xe);og(Ue,{compact:!0,get targetFolderId(){return t().id},get targetFolderName(){return t().name},get onAddChoice(){return e.actions.onAddChoice}}),S(xe),$(be,xe)};ne(pe,be=>{n()||be(ge)})}$(Y,K)};ne(B,Y=>{h(o)?Y(ie):Y(j,-1)})}S(q),$(O,q)};ne(ce,O=>{t().collapsed||O(R)})}$(V,oe)};ne(P,V=>{(!e.collapseId||e.collapseId&&t().id!==e.collapseId)&&V(H)})}S(m),de(()=>{ke(v,"data-choice-id",t().id),ke(g,"aria-expanded",!t().collapsed),ke(g,"aria-label",`Toggle ${t().name}`),w=Ct(y,1,"qaChoiceRowIcon multiChoiceCollapseIcon svelte-1jxjn06",null,w,{"is-collapsed":t().collapsed})}),De("contextmenu",v,u),De("click",v,V=>{sS.Platform.isMobile||V.target.closest("button, a")||p()}),De("click",g,p),$(r,m),Ce()}Et(["contextmenu","click"]);function BY(r){let e=r-1;return e*e*e+1}function UY(r,{from:e,to:t},n={}){var{delay:i=0,duration:o=E=>Math.sqrt(E)*120,easing:s=BY}=n,a=getComputedStyle(r),l=a.transform==="none"?"":a.transform,[c,u]=a.transformOrigin.split(" ").map(parseFloat);c/=r.clientWidth,u/=r.clientHeight;var d=Hde(r),f=r.clientWidth/t.width/d,p=r.clientHeight/t.height/d,m=e.left+e.width*c,v=e.top+e.height*u,g=t.left+t.width*c,y=t.top+t.height*u,w=(m-g)*f,x=(v-y)*p,C=e.width/t.width,_=e.height/t.height;return{delay:i,duration:typeof o=="function"?o(Math.sqrt(w*w+x*x)):o,easing:s,css:(E,D)=>{var P=D*w,H=D*x,V=E+D*C,oe=E+D*_;return`transform: ${l} translate(${P}px, ${H}px) scale(${V}, ${oe});`}}}function Hde(r){if("currentCSSZoom"in r)return r.currentCSSZoom;for(var e=r,t=1;e!==null;)t*=+getComputedStyle(e).zoom,e=e.parentElement;return t}var VY=require("obsidian");Wt();var jde=W("<div><!></div>"),Gde=W("<div></div>"),Yde={hash:"svelte-2ry05y",code:`.choiceList.svelte-2ry05y {width:auto;}
|
||
|
||
/* Root (non-nested) empty list keeps a little bottom breathing room. The only way to
|
||
render it empty is a zero-match filter \u2014 a truly empty tree shows the hero state. */.choiceList.qa-empty.svelte-2ry05y:not(.qa-nested) {padding-bottom:0.5rem;}.choiceList.qa-nested.svelte-2ry05y {
|
||
/* Own the 2px name->first-row gap so the empty drop band sits the same distance
|
||
below the folder name as a populated folder's first row (collapses with the
|
||
row's own margin-top, so populated folders look identical). */margin-top:2px;position:relative; /* anchor the ring (::before) */border-radius:var(--radius-m);transition:background-color 120ms ease;}
|
||
|
||
/* The drop ring is drawn a few px OUTSIDE the content as an absolutely-positioned
|
||
::before (adds no layout) \u2014 "synthetically" bigger than the rows so it doesn't
|
||
clamp straight against the choice names. The right edge stays at the content edge:
|
||
the settings pane is overflow-x:hidden, so extending the ring right would clip it. */.choiceList.qa-nested.svelte-2ry05y::before {content:"";position:absolute;inset:-4px 0 -4px -6px;border-radius:var(--radius-m);border:2px dashed transparent;pointer-events:none;transition:border-color 120ms ease;}.choiceList.qa-nested.svelte-2ry05y.qa-folder-droptarget {background-color:var(--background-modifier-hover);}.choiceList.qa-nested.svelte-2ry05y.qa-folder-droptarget::before {border-color:var(--interactive-accent);}
|
||
|
||
/* Empty folder: a GENEROUS, STABLE drop target. The band is sized by the folder's
|
||
PERSISTED emptiness (qa-folder-empty), NOT the live \`choices\` length \u2014 so when a
|
||
dragged item is previewed into the zone (filling \`choices\`, toggling qa-empty off)
|
||
the band keeps its height instead of collapsing/expanding under the cursor (the
|
||
"jumps all over the place"). Only persisted-empty folders get it, so populated
|
||
folders never heave at drag start. */.choiceList.qa-nested.qa-folder-empty.svelte-2ry05y {min-height:3rem;display:flex;align-items:center;}
|
||
|
||
/* Hint shows only when the folder is persisted-empty AND nothing is previewed in it
|
||
(qa-empty = live \`choices\` empty), so it cleanly swaps out for the previewed row
|
||
without changing the band's size. */.choiceList.qa-nested.qa-folder-empty.qa-empty.svelte-2ry05y::after {content:"Empty \u2014 add a choice or drag one here.";color:var(--text-faint);font-size:var(--font-ui-smaller, 12px);line-height:1.3;padding-left:8px; /* align with the child rows' own left padding */pointer-events:none;user-select:none;}
|
||
|
||
@media (prefers-reduced-motion: reduce) {.choiceList.qa-nested.svelte-2ry05y,
|
||
.choiceList.qa-nested.svelte-2ry05y::before {transition:none;}
|
||
}`};function sg(r,e){we(e,!0),ot(r,Yde);let t=he(e,"choices",31,()=>wt([])),n=he(e,"forceDragDisabled",3,!1),i=he(e,"isEmptyFolder",3,!1),o=he(e,"nested",3,!1),s=N(()=>{let x=new Set;return gn(t()).filter(C=>{if(!Ye(C))return!1;let _=C.id;return typeof _!="string"||_===""||x.has(_)?!1:(x.add(_),!0)})}),a=N(()=>e.rootReorder??e.actions.onReorderChoices),l=0,c=VY.Platform.isMobile,u=Ae(""),d=uk(),f=N(()=>n()||!c&&!d.armed);function p(x){n()||(d.markStarted(),Z(u,x.detail.info.id,!0),t(Ml(x.detail.items)))}function m(x){if(n())return;Z(u,"");let C=Ml(x.detail.items);x.detail.info.trigger===Ai.DROPPED_INTO_ANOTHER&&(C=C.filter(_=>_.id!==x.detail.info.id)),t(C),d.reset(),e.actions.onReorderChoices(t())}let v=()=>{n()||d.startDrag()};function g(x,C){if(n())return;let _=Ml(h(s)),E=_.findIndex(V=>V.id===x.id);if(E===-1)return;let D=E+C;if(D<0||D>=_.length)return;let P=[..._],[H]=P.splice(E,1);P.splice(D,0,H),t(P),e.actions.onReorderChoices(t()),mx(`Moved ${x.name} to position ${D+1} of ${_.length}`)}var y=Gde();let w;ar(y,29,()=>Ml(h(s)),x=>x.id,(x,C)=>{var _=jde(),E=I(_);{var D=H=>{{let V=N(()=>e.roots??t()),oe=N(()=>n()?void 0:()=>g(h(C),-1)),ce=N(()=>n()?void 0:()=>g(h(C),1));X$(H,{get app(){return e.app},get roots(){return h(V)},get dragDisabled(){return h(f)},startDrag:v,get actions(){return e.actions},get choice(){return h(C)},get onMoveUp(){return h(oe)},get onMoveDown(){return h(ce)}})}},P=H=>{{let V=N(()=>e.roots??t()),oe=N(()=>n()?void 0:()=>g(h(C),-1)),ce=N(()=>n()?void 0:()=>g(h(C),1));Z$(H,{get app(){return e.app},get roots(){return h(V)},get dragDisabled(){return h(f)},startDrag:v,get actions(){return e.actions},get collapseId(){return h(u)},get forceDragDisabled(){return n()},get rootReorder(){return h(a)},get choice(){return h(C)},get onMoveUp(){return h(oe)},get onMoveDown(){return h(ce)}})}};ne(E,H=>{h(C).type!=="Multi"?H(D):H(P,-1)})}S(_),XI(_,()=>UY,()=>({duration:l})),$(x,_)}),S(y),Fr(y,(x,C)=>lk?.(x,C),()=>ck({items:h(s),dragDisabled:h(f),flipDurationMs:l,dropTargetClasses:o()?["qa-folder-droptarget"]:[]})),de(()=>w=Ct(y,1,"choiceList svelte-2ry05y",null,w,{"qa-nested":o(),"qa-folder-empty":i(),"qa-empty":h(s).length===0})),ic("consider",y,p),ic("finalize",y,m),$(r,y),Ce()}var Kde=W('<pre class="qaChoicesUnavailableDetail svelte-1fs8ikt"> </pre>'),Qde=W(`<div class="qaChoicesUnavailable svelte-1fs8ikt"><div class="qaChoicesUnavailableHead svelte-1fs8ikt"><!> <span class="qaChoicesUnavailableTitle svelte-1fs8ikt"> </span></div> <p class="qaChoicesUnavailableBody svelte-1fs8ikt">Something in this vault's QuickAdd settings could not be read. Your choices
|
||
have not been changed or deleted, and QuickAdd will not overwrite them.</p> <p class="qaChoicesUnavailableBody svelte-1fs8ikt">They are stored in <code>.obsidian/plugins/quickadd/data.json</code> inside this vault. Make a
|
||
copy of that file before editing it.</p> <!></div>`),Xde={hash:"svelte-1fs8ikt",code:".qaChoicesUnavailable.svelte-1fs8ikt {border:1px solid var(--background-modifier-border);border-radius:var(--radius-m);padding:12px 14px;margin:4px 0 8px;background:var(--background-secondary);}.qaChoicesUnavailableHead.svelte-1fs8ikt {display:flex;align-items:center;gap:8px;color:var(--text-warning, var(--text-normal));}.qaChoicesUnavailableTitle.svelte-1fs8ikt {font-weight:var(--font-semibold);color:var(--text-normal);}.qaChoicesUnavailableBody.svelte-1fs8ikt {margin:8px 0 0;color:var(--text-muted);font-size:var(--font-ui-small, 13px);max-width:68ch;}.qaChoicesUnavailableDetail.svelte-1fs8ikt {margin:10px 0 0;padding:8px 10px;border-radius:var(--radius-s);background:var(--background-primary);color:var(--text-faint);font-size:var(--font-ui-smaller, 12px);white-space:pre-wrap;word-break:break-word;user-select:text;}"};function ag(r,e){ot(r,Xde);let t=he(e,"what",3,"your choices"),n=he(e,"detail",3,"");var i=Qde(),o=I(i),s=I(o);Rt(s,{iconId:"alert-triangle",size:16});var a=A(s,2),l=I(a);S(a),S(o);var c=A(o,6);{var u=d=>{var f=Kde(),p=I(f,!0);S(f),de(()=>me(p,n())),$(d,f)};ne(c,d=>{n()&&d(u)})}S(i),de(()=>me(l,`QuickAdd couldn't display ${t()??""}`)),$(r,i)}Wt();Wt();var J$=new WeakMap;function qY(r){let e=J$.get(r);if(e)return e;let t=QU(r);return J$.set(r,t),t}function WY(r){return J$.has(r)}Cr();var Zde=W(`<div class="choiceEmptyState svelte-1r4uuo1"><!> <div class="choiceEmptyTitle svelte-1r4uuo1">No choices yet</div> <p class="choiceEmptyBody svelte-1r4uuo1">A choice is an action QuickAdd can run: create a note, capture
|
||
text, or run a macro. Group them with folders. <a class="quickadd-docs-link" target="_blank" rel="noopener noreferrer">Learn more</a></p> <div class="choiceEmptyActions svelte-1r4uuo1"><!></div></div>`),Jde=W('<button class="search-input-clear-button qaFilterClearButton svelte-1r4uuo1" aria-label="Clear filter"></button>'),epe=W('<div class="choiceFilterEmpty svelte-1r4uuo1">No choices match your filter.</div>'),tpe=W('<button type="button" class="qaAIAssistantBtn clickable-icon svelte-1r4uuo1" aria-label="Configure AI Assistant" title="Configure AI Assistant"><!></button>'),rpe=W('<div class="choiceFilterBar svelte-1r4uuo1"><div class="search-input-container choiceFilterInput svelte-1r4uuo1"><input type="search" placeholder="Filter choices..." autocapitalize="off" autocorrect="off" enterkeyhint="search"/> <!></div></div> <!> <div class="choiceViewBottomBar svelte-1r4uuo1"><!> <!></div>',1),npe=W("<div><!></div>"),ipe={hash:"svelte-1r4uuo1",code:`.choiceViewBottomBar.svelte-1r4uuo1 {display:flex;flex-direction:row;align-items:center;justify-content:flex-end; /* pack right; "New choice" (primary) is the terminal action */flex-wrap:wrap;gap:0.5rem;margin-top:0.75rem;}
|
||
|
||
/* AI Assistant as a quiet icon button (matches the per-row action icons),
|
||
leading the right cluster so the bar's width barely changes when AI/online
|
||
features toggle. */.qaAIAssistantBtn.svelte-1r4uuo1 {flex:0 0 auto;display:inline-flex;align-items:center;justify-content:center;color:var(--text-muted);}.qaAIAssistantBtn.svelte-1r4uuo1:hover {color:var(--text-normal);}.choiceEmptyState.svelte-1r4uuo1 {display:flex;flex-direction:column;align-items:center;text-align:center;gap:0.5rem;padding:2.5rem 1rem;color:var(--text-muted);}.choiceEmptyTitle.svelte-1r4uuo1 {font-weight:var(--font-semibold);color:var(--text-normal);}.choiceEmptyBody.svelte-1r4uuo1 {margin:0;max-width:42ch;}.choiceEmptyActions.svelte-1r4uuo1 {margin-top:0.5rem;}.choiceFilterBar.svelte-1r4uuo1 {margin-bottom:8px;}
|
||
|
||
/* The native container is inline-block by default in some contexts; span
|
||
the full row so the filter aligns with the list edges. */.choiceFilterInput.svelte-1r4uuo1 {width:100%;}
|
||
|
||
/* Obsidian styles .search-input-clear-button (position, the \xD7 glyph, hover)
|
||
\u2014 we only reset the <button> chrome so that styling shows through. A real
|
||
<button> (Obsidian uses a div) keeps it keyboard-operable. */.qaFilterClearButton.svelte-1r4uuo1 {background:transparent;border:none;box-shadow:none;padding:0;margin:0;cursor:var(--cursor, pointer);}.choiceFilterEmpty.svelte-1r4uuo1 {color:var(--text-faint);font-size:var(--font-ui-small, 13px);padding:12px 8px 16px;}`};function eO(r,e){we(e,!0),ot(r,ipe);let t=he(e,"choices",31,()=>wt([])),n=Ae(""),i=N(()=>!Array.isArray(t())),o=N(()=>`The "choices" value in data.json is ${t()===null?"null":`of type "${typeof t()}"`}, but QuickAdd expects a list.`),s=lg.Platform.isMobile,a=Ae(wt(le.getState().disableOnlineFeatures)),l=new Hk(Ot(()=>e.plugin));function c(j){if(!Array.isArray(j))return j;let Y=WY(j),{choices:K,repaired:se}=qY(j);if(Y)return K;for(let{choice:pe}of se)if(pe.command)try{l.enableCommand(pe)}catch(ge){F.logError(`Could not register a command for the repaired choice "${pe.name}": ${ge instanceof Error?ge.message:String(ge)}`)}return K}t(c(t())),hr(()=>{let j=le.subscribe(Y=>{t(c(Y.choices)),Z(a,Y.disableOnlineFeatures,!0)});return()=>j()});function u(){e.saveChoices(yh(t()))}let d=j=>j.type==="Multi";function f(j,Y){let K=Y.trim();if(!K)return j;let se=(0,lg.prepareFuzzySearch)(K),pe=ge=>{if(!Ye(ge))return null;let be=!!se(ge.name??"");if(!d(ge))return be?ge:null;let xe=st(ge).map(Ue=>pe(Ue)).filter(Boolean);return be||xe.length>0?{...ge,collapsed:!1,choices:xe}:null};return j.map(ge=>pe(ge)).filter(Boolean)}async function p(j,Y,K,se=!1){let pe=OY(Y,t()),ge=q$(Y,pe);if(t(yY(t(),ge,K)),!K&&h(n).trim().length>0&&Z(n,""),Y==="Multi")u(),await C(ge),await m(ge.id);else if(se)u(),await m(ge.id);else{u();try{await w(ge)}catch(be){F.logError(`Failed to configure the new choice: ${be instanceof Error?be.message:String(be)}`),u()}await m(ge.id)}}async function m(j){await Hf();try{document.querySelector(`[data-choice-id="${j}"]`)?.scrollIntoView({block:"nearest"})}catch{}}function v(j){return Ex(t(),j.id)??j}function g(j){return Ye(j)?j.command?!0:st(j).some(g):!1}async function y(j){let Y=v(j);await fY(Y,e.app)&&(t(Tx(t(),j.id).updated),l.disableCommand(Y,{recursive:!0}),u())}async function w(j){let Y=v(j),K=await mY(Y,e.app,e.plugin);K&&(t(t().map(se=>x(se,K))),l.updateCommand(Y,K),u())}function x(j,Y){if(!Ye(j))return j;if(j.id===Y.id)return{...j,...Y};if(Cc(j)){let K=st(j).map(pe=>x(pe,Y));return{...j,choices:K}}return j}async function C(j){if(!j)return;let Y=await E_(e.app,j.name,j.type);if(!Y)return;let K=v(j),se={...K,name:Y};t(t().map(pe=>x(pe,se))),l.updateCommand(K,se),u()}function _(j){let Y=hY(v(j));t(t().map(K=>x(K,Y))),Y.command?l.enableCommand(Y):l.disableCommand(Y),u()}async function E(j){let Y=await dY(v(j),e.app);t(H$(t(),j.id,Y)??[...t(),Y]),g(Y)&&l.enableCommand(Y),u(),new lg.Notice(`Duplicated "${j.name}".`),await m(Y.id)}function D(j,Y){t(Y===Y$?vY(t(),j.id):gY(t(),j.id,Y)),u()}function P(j){t(j),u()}function H(j,Y){t(bY(t(),j,Y)),u()}function V(j){t(G$(t(),j.id,!j.collapsed)),u()}function oe(j,Y){return(K,...se)=>{let pe=km(K?.type),ge=K?.name?`the ${pe} \u201C${K.name}\u201D`:`that ${pe}`;Jf(`Couldn't ${j} ${ge}`,Y)(K,...se)}}let ce={onDeleteChoice:oe("delete",y),onConfigureChoice:oe("open the settings for",w),onToggleCommand:oe("update the command palette entry for",_),onDuplicateChoice:oe("duplicate",E),onRenameChoice:oe("rename",C),onMoveChoice:oe("move",D),onToggleCollapsed:oe("open or close",V),onReorderChoices:Jf("Couldn't save the new order",P),onCommitFolder:Jf("Couldn't save that folder's contents",H),onAddChoice:(j,Y,K,se)=>Jf(`Couldn't add that ${km(Y)}`,p)(j,Y,K,se)},R=Jf("Couldn't open the AI assistant settings",async()=>{let j=await new rS(e.app,le.getState().ai).waitForClose;j&&le.setState(Y=>({...Y,ai:j}))});var O=npe(),q=I(O);{var B=j=>{ag(j,{get detail(){return h(o)}})},ie=j=>{var Y=dn(),K=Pe(Y);yv(K,{onerror:pe=>F.logError(`QuickAdd could not render the choice list: ${pe instanceof Error?pe.message:String(pe)}`),failed:(pe,ge=Vt)=>{{let be=N(()=>ge()instanceof Error?ge().message:String(ge()));ag(pe,{get detail(){return h(be)}})}}},pe=>{var ge=dn(),be=Pe(ge);{var xe=Ne=>{var Ke=Zde(),Xe=I(Ke);Rt(Xe,{iconId:"folder-plus",size:28});var ye=A(Xe,4),We=A(I(ye));S(ye);var ht=A(ye,2),He=I(ht);og(He,{get onAddChoice(){return ce.onAddChoice}}),S(ht),S(Ke),de(()=>ke(We,"href",kl.gettingStarted)),$(Ne,Ke)},Ue=N(()=>t().length===0&&h(n).trim().length===0),$t=Ne=>{var Ke=rpe(),Xe=Pe(Ke),ye=I(Xe),We=I(ye);gr(We),ke(We,"spellcheck",!1);var ht=A(We,2);{var He=dt=>{var Ft=Jde();De("click",Ft,()=>Z(n,"")),$(dt,Ft)};ne(ht,dt=>{h(n)&&dt(He)})}S(ye),S(Xe);var _e=A(Xe,2);{var Be=dt=>{sg(dt,{get app(){return e.app},get roots(){return t()},get actions(){return ce},get choices(){return t()},set choices(Ft){t(Ft)}})},ut=N(()=>h(n).trim().length===0),or=dt=>{let Ft=N(()=>f(t(),h(n)));var jn=dn(),xo=Pe(jn);{var Es=re=>{var Ie=epe();$(re,Ie)},Gn=re=>{sg(re,{get app(){return e.app},get roots(){return t()},get choices(){return h(Ft)},forceDragDisabled:!0,get actions(){return ce}})};ne(xo,re=>{h(Ft).length===0?re(Es):re(Gn,-1)})}$(dt,jn)};ne(_e,dt=>{h(ut)?dt(Be):dt(or,-1)})}var yr=A(_e,2),Pt=I(yr);{var Ar=dt=>{var Ft=tpe(),jn=I(Ft);Rt(jn,{iconId:"sparkles",size:16}),S(Ft),De("click",Ft,R),$(dt,Ft)};ne(Pt,dt=>{h(a)||dt(Ar)})}var ur=A(Pt,2);og(ur,{get onAddChoice(){return ce.onAddChoice},get fill(){return s}}),S(yr),De("keydown",We,dt=>{dt.key==="Escape"&&h(n)&&(Z(n,""),dt.stopPropagation())}),uo(We,()=>h(n),dt=>Z(n,dt)),$(Ne,Ke)};ne(be,Ne=>{h(Ue)?Ne(xe):Ne($t,-1)})}$(pe,ge)}),$(j,Y)};ne(q,j=>{h(i)?j(B):j(ie,-1)})}S(O),$(r,O),Ce()}Et(["keydown","click"]);It();var ope=W('<div class="qa-gv__empty svelte-hx6w4t">No global variables yet.</div>'),spe=W('<div class="qa-gv__row qa-gv__row--head svelte-hx6w4t"><div class="qa-gv__cell qa-gv__name">Name</div> <div class="qa-gv__cell qa-gv__value">Value</div> <div class="qa-gv__cell qa-gv__ops svelte-hx6w4t">Actions</div></div>'),ape=W('<div class="qa-gv__row svelte-hx6w4t"><div class="qa-gv__cell qa-gv__name svelte-hx6w4t"><input type="text" placeholder="Name" class="svelte-hx6w4t"/></div> <div class="qa-gv__cell qa-gv__value svelte-hx6w4t"><textarea rows="2" placeholder="Snippet value (supports QuickAdd tokens)" class="svelte-hx6w4t"></textarea></div> <div class="qa-gv__cell qa-gv__ops svelte-hx6w4t"><button class="qa-gv__btn danger svelte-hx6w4t" title="Delete">Delete</button></div></div>'),lpe=W('<div class="qa-gv svelte-hx6w4t"><div class="qa-gv__desc svelte-hx6w4t">Define reusable snippets referenced as <code>{{GLOBAL_VAR:<name>}}</code>. Snippets support other QuickAdd tokens and expand before VALUE/VDATE/etc.</div> <div class="qa-gv__table svelte-hx6w4t"><!> <!></div> <div class="qa-gv__actions svelte-hx6w4t"><button class="mod-cta">Add variable</button></div></div>'),cpe={hash:"svelte-hx6w4t",code:`.qa-gv.svelte-hx6w4t {display:flex;flex-direction:column;gap:8px;}
|
||
/* Keeps "Add variable" right-aligned now that it is the row's only child. */.qa-gv__actions.svelte-hx6w4t {display:flex;justify-content:flex-end;}.qa-gv__desc.svelte-hx6w4t {color:var(--text-muted);font-size:12px;}
|
||
/* Mirrors .qa-template-folder-empty, the sibling list's empty state. */.qa-gv__empty.svelte-hx6w4t {color:var(--text-muted);font-size:var(--font-ui-smaller);padding:6px 0;}.qa-gv__table.svelte-hx6w4t {display:grid;gap:8px;}.qa-gv__row.svelte-hx6w4t {display:grid;grid-template-columns:180px 1fr 140px;gap:8px;align-items:start;}.qa-gv__row--head.svelte-hx6w4t {font-weight:600;color:var(--text-muted);}.qa-gv__cell.svelte-hx6w4t input[type="text"]:where(.svelte-hx6w4t) {width:100%;}.qa-gv__cell.svelte-hx6w4t textarea:where(.svelte-hx6w4t) {width:100%;resize:vertical;}.qa-gv__ops.svelte-hx6w4t {display:flex;gap:6px;align-items:center;}.qa-gv__btn.svelte-hx6w4t {padding:4px 8px;}.qa-gv__btn.danger.svelte-hx6w4t {color:var(--text-error);}
|
||
@media (max-width: 900px) {.qa-gv__row.svelte-hx6w4t {grid-template-columns:1fr;}.qa-gv__row--head.svelte-hx6w4t {display:none;}
|
||
}`};function tO(r,e){we(e,!0),ot(r,cpe);let t=Ae(wt([]));function n(C,_){if(!_.has(C))return C;let E=1;for(;_.has(`${C}${E}`);)E++;return`${C}${E}`}function i(){let _=le.getState().globalVariables||{};Z(t,Object.keys(_).map(E=>({name:E,value:_[E]??""})),!0)}let o=!1;function s(){let C=h(t).map(P=>P.name.trim()),_=C.some(P=>!P),E=new Set(C).size!==C.length;if(_||E)return;let D={};for(let P of h(t))D[P.name.trim()]=P.value??"";o=!0;try{le.setState({globalVariables:D})}finally{o=!1}}function a(){let C=new Set(h(t).map(E=>E.name)),_=n("NewVar",C);Z(t,[...h(t),{name:_,value:""}],!0),s()}function l(C){Z(t,h(t).filter((_,E)=>E!==C),!0),s()}function c(C){return new Hi(e.app,C,e.plugin),{destroy(){}}}let u;function d(C){u!==void 0&&window.clearTimeout(u),u=window.setTimeout(()=>{s()},200)}hr(()=>{let C=le.subscribe(()=>{o||i()});return i(),()=>{u!==void 0&&window.clearTimeout(u),C()}});var f=lpe(),p=A(I(f),2),m=I(p);{var v=C=>{var _=ope();$(C,_)},g=C=>{var _=spe();$(C,_)};ne(m,C=>{h(t).length===0?C(v):C(g,-1)})}var y=A(m,2);ar(y,17,()=>h(t),$v,(C,_,E)=>{var D=ape(),P=I(D),H=I(P);gr(H),Fr(H,O=>c?.(O)),un(()=>uo(H,()=>h(_).name,O=>h(_).name=O)),S(P);var V=A(P,2),oe=I(V);Ad(oe),Fr(oe,O=>c?.(O)),un(()=>uo(oe,()=>h(_).value,O=>h(_).value=O)),S(V);var ce=A(V,2),R=I(ce);S(ce),S(D),De("input",H,()=>{d(h(_))}),De("input",oe,()=>d(h(_))),De("click",R,()=>l(h(t).indexOf(h(_)))),$(C,D)}),S(p);var w=A(p,2),x=I(w);S(w),S(f),De("click",x,a),$(r,f),Ce()}Et(["input","click"]);It();qt();var i4=require("obsidian");var Wa=require("obsidian");Wt();Ii();Kr();var upe=new Set;function nO(r){return r.type==="Multi"}function iO(r){return r.type==="Macro"}function dpe(r){return r.type==="Template"}function ppe(r){return r.type==="Capture"}function aS(r,e,t){return r?e.has(r.id)?t.has(r.id):!0:!1}function zY(r,e,t,n){switch(r.type){case"Choice":{let i=r;if(!t.has(i.choiceId))return!0;let o=e.get(i.choiceId);return o&&aS(o.choice,e,t)&&n(o.choice),!0}case"NestedChoice":{let i=r;return i.choice&&aS(i.choice,e,t)&&n(i.choice),!0}default:return!1}}function fpe(r){let e=new Map,t=(n,i,o)=>{for(let s of n){if(!Ye(s))continue;let a=[...o,s.name];e.set(s.id,{choice:s,parentId:i,path:a}),nO(s)&&Array.isArray(s.choices)&&t(s.choices,s.id,a)}};return t(gn(r),null,[]),e}function HY(r){let e=new Set;for(let t of st(r))Ye(t)&&e.add(t.id);return iO(r)&&rO(r.macro?.commands,e),e}function rO(r,e){for(let t of Dr(r))if(Si(t))switch(t.type){case"Choice":{let n=t;n.choiceId&&e.add(n.choiceId);break}case"Conditional":{let n=t;rO(n.thenCommands,e),rO(n.elseCommands,e);break}case"NestedChoice":{let i=t.choice;if(!i)break;let o=HY(i);for(let s of o)e.add(s);break}default:break}}function lS(r,e,t){let n=fpe(r),i=new Set,o=new Set,s=t?.excludedChoiceIds??upe,a=e.filter(c=>!s.has(c)),l=[];for(;a.length>0;){let c=a.shift();if(i.has(c))continue;if(s.has(c)){i.add(c);continue}let u=n.get(c);if(!u){o.add(c);continue}i.add(c),l.push(c);let d=HY(u.choice);for(let f of d){if(!n.has(f)){o.add(f);continue}s.has(f)||a.push(f)}}return{catalog:n,choiceIds:l,missingChoiceIds:Array.from(o)}}function cS(r,e){let t=new Set(e),n=new Set,i=new Set,o=new Set,s=l=>{if(l&&aS(l,r,t)&&!n.has(l.id)){if(n.add(l.id),nO(l)&&Array.isArray(l.choices))for(let c of l.choices)s(c);iO(l)&&a(l.macro?.commands)}},a=l=>{for(let c of Dr(l))if(Si(c)&&!zY(c,r,t,s))switch(c.type){case"UserScript":{let u=c;u.path&&i.add(u.path);break}case"Conditional":{let u=c,d=u.condition;d.mode==="script"&&d.scriptPath&&o.add(d.scriptPath),a(u.thenCommands),a(u.elseCommands);break}default:break}};for(let l of e){let c=r.get(l);c&&s(c.choice)}return{userScriptPaths:i,conditionalScriptPaths:o}}function uS(r,e){let t=new Set(e),n=new Set,i=new Set,o=new Set,s=l=>{if(l&&aS(l,r,t)&&!n.has(l.id)){if(n.add(l.id),dpe(l)&&l.templatePath&&i.add(l.templatePath),ppe(l)&&l.createFileIfItDoesntExist?.enabled&&l.createFileIfItDoesntExist.createWithTemplate&&l.createFileIfItDoesntExist.template&&o.add(l.createFileIfItDoesntExist.template),nO(l)&&Array.isArray(l.choices))for(let c of l.choices)s(c);iO(l)&&a(l.macro?.commands)}},a=l=>{for(let c of Dr(l))if(Si(c)&&!zY(c,r,t,s)&&c.type==="Conditional"){let u=c;a(u.thenCommands),a(u.elseCommands)}};for(let l of e){let c=r.get(l);c&&s(c.choice)}return{templatePaths:i,captureTemplatePaths:o}}Wt();var JY=require("obsidian");function dS(r){return!!r&&typeof r=="object"}function jY(r){return Array.isArray(r)&&r.every(e=>typeof e=="string")}function mpe(r){return dS(r)?typeof r.id=="string"&&typeof r.name=="string"&&typeof r.type=="string":!1}function hpe(r){return dS(r)?mpe(r.choice)&&jY(r.pathHint)&&(r.parentChoiceId===null||typeof r.parentChoiceId=="string"):!1}function gpe(r){if(!dS(r))return!1;let{kind:e,originalPath:t,contentEncoding:n,content:i}=r;return(e==="user-script"||e==="conditional-script"||e==="template"||e==="capture-template")&&typeof t=="string"&&n==="base64"&&typeof i=="string"}function GY(r){if(!dS(r))return!1;let{schemaVersion:e,quickAddVersion:t,createdAt:n,rootChoiceIds:i,choices:o,assets:s}=r;return typeof e=="number"&&Number.isInteger(e)&&e>=1&&typeof t=="string"&&typeof n=="string"&&jY(i)&&Array.isArray(o)&&o.every(hpe)&&Array.isArray(s)&&s.every(gpe)}Me();Wp();var YY=typeof TextEncoder<"u"?new TextEncoder:void 0,KY=typeof TextDecoder<"u"?new TextDecoder:void 0;function QY(r){return typeof window>"u"?!1:typeof window[r]=="function"}function XY(){if(!(typeof Buffer>"u"))return Buffer}function ZY(r){if(YY&&QY("btoa")){let t=YY.encode(r),n="";for(let i=0;i<t.length;i++)n+=String.fromCharCode(t[i]);return window.btoa(n)}let e=XY();if(e)return e.from(r,"utf8").toString("base64");throw new Error("Base64 encoding is not supported in this environment.")}function Vc(r){if(KY&&QY("atob")){let t=window.atob(r),n=Uint8Array.from(t,i=>i.charCodeAt(0));return KY.decode(n)}let e=XY();if(e)return e.from(r,"base64").toString("utf8");throw new Error("Base64 decoding is not supported in this environment.")}yi();Wt();async function pS(r,e){let t=e.lastIndexOf("/");if(t<0)return;let n=e.slice(0,t);if(!n)return;let i=n.split("/").filter(Boolean),o="";for(let s of i)o=o?`${o}/${s}`:s,await r.vault.adapter.exists(o)||await r.vault.createFolder(o)}Bc();function e4(){return`QuickAdd Packages/quickadd-package-${new Date().toISOString().replace(/[:.]/g,"-")}.quickadd.json`}async function t4(r,e){let{choices:t,rootChoiceIds:n,quickAddVersion:i}=e,o=new Set(e.excludedChoiceIds??[]),s=e.createdAt??new Date().toISOString(),a=lS(t,n,{excludedChoiceIds:o}),l=new Set(a.choiceIds),c=cS(a.catalog,a.choiceIds),u=uS(a.catalog,a.choiceIds),d=vpe(c,u),f=await ype(r,d),p=bpe(f.encodedAssets),m=a.choiceIds.map(y=>{let w=a.catalog.get(y);if(!w)throw new Error(`Choice '${y}' missing from catalog.`);let x=gt(w.choice);return r4(x,l),Nh(x,{secretOptionNamesByPath:p,stripUnknownStringSettings:!0}),{choice:x,pathHint:[...w.path],parentChoiceId:w.parentId}}),v=n.filter(y=>l.has(y));return{pkg:{schemaVersion:1,quickAddVersion:i,createdAt:s,rootChoiceIds:[...v],choices:m,assets:f.encodedAssets},missingChoiceIds:a.missingChoiceIds,missingAssets:f.missingAssets}}function vpe(r,e){let t=new Map;for(let n of r.userScriptPaths)n&&t.set(n,"user-script");for(let n of r.conditionalScriptPaths)n&&t.set(n,"conditional-script");for(let n of e.templatePaths)n&&(t.has(n)||t.set(n,"template"));for(let n of e.captureTemplatePaths)n&&(t.has(n)||t.set(n,"capture-template"));return Array.from(t.entries()).map(([n,i])=>({path:n,kind:i}))}async function ype(r,e){let t=[],n=[];for(let{path:i,kind:o}of e)try{if(!await r.vault.adapter.exists(i)){n.push({path:i,kind:o}),F.logWarning(`QuickAdd export skipped missing ${o}: ${i}`);continue}let a=await r.vault.adapter.read(i);t.push({kind:o,originalPath:i,contentEncoding:"base64",content:ZY(a)})}catch(s){n.push({path:i,kind:o}),F.logWarning(`QuickAdd export failed to read ${o} '${i}': ${s?.message??s}`)}return{encodedAssets:t,missingAssets:n}}function bpe(r){let e=new Map;for(let t of r)if(t.kind==="user-script")try{let n=Rh(Vc(t.content),t.originalPath);e.set(t.originalPath,n.foundSecretOptions&&n.names.size===0?null:n.names)}catch(n){F.logWarning(`QuickAdd export could not inspect user-script settings '${t.originalPath}': ${n?.message??n}`)}return e}function r4(r,e){if(r.type!=="Multi")return;let t=r;if(!Array.isArray(t.choices)||t.choices.length===0){t.choices=[];return}t.choices=t.choices.filter(n=>Ye(n)&&e.has(n.id)).map(n=>(r4(n,e),n))}async function wpe(r,e){return Qi.Prompt(r,"Overwrite existing file?",`A file already exists at '${e}'. Saving the package will overwrite it. Continue?`)}async function n4(r,e,t,n={}){let i=(0,JY.normalizePath)(t.trim());if(!i)throw new Error("Output path cannot be empty.");let o=await r.vault.adapter.exists(i);if(o&&!await(n.confirmOverwrite??(c=>wpe(r,c)))(i))throw new Error(`Save cancelled: '${i}' already exists.`);await pS(r,i);let s=JSON.stringify(e,null,2);return await r.vault.adapter.write(i,s),{overwritten:o}}var Cpe=W('<p class="emptyState svelte-llmxn2">No choices match the current filter.</p>'),xpe=W('<span class="choicePath svelte-llmxn2"> </span>'),Epe=W('<li><label class="svelte-llmxn2"><input type="checkbox"/> <span class="choiceName svelte-llmxn2"> </span> <!> <span class="choiceType svelte-llmxn2"> </span></label></li>'),Tpe=W('<ul class="svelte-llmxn2"></ul>'),_pe=W('<div class="warning svelte-llmxn2"><strong>Missing dependencies detected</strong> <p> </p></div>'),Ape=W("<p> </p>"),kpe=W('<li> <span class="assetKind svelte-llmxn2"> </span></li>'),Spe=W('<div><p>Missing assets:</p> <ul class="svelte-llmxn2"></ul></div>'),Dpe=W('<section class="warning svelte-llmxn2"><h4>Warnings</h4> <!> <!></section>'),Ipe=W('<div class="exportPackageModal svelte-llmxn2"><header class="svelte-llmxn2"><h2>Export QuickAdd package</h2> <p class="svelte-llmxn2">Select choices to bundle. Dependencies are added automatically.</p></header> <section class="controls svelte-llmxn2"><input type="text" placeholder="Filter choices" autocapitalize="off" autocorrect="off" class="svelte-llmxn2"/> <div class="controlButtons svelte-llmxn2"><button type="button" class="svelte-llmxn2">Select visible</button> <button type="button" class="svelte-llmxn2">Clear selection</button></div></section> <section class="choiceList svelte-llmxn2"><!></section> <section class="summary svelte-llmxn2"><h3 class="svelte-llmxn2">Package summary</h3> <div class="summaryGrid svelte-llmxn2"><div class="svelte-llmxn2"><strong class="svelte-llmxn2"> </strong> <span>Selected choices</span></div> <div class="svelte-llmxn2"><strong class="svelte-llmxn2"> </strong> <span>Total packaged</span></div> <div class="svelte-llmxn2"><strong class="svelte-llmxn2"> </strong> <span>Auto-included</span></div> <div class="svelte-llmxn2"><strong class="svelte-llmxn2"> </strong> <span>Scripts embedded</span></div> <div class="svelte-llmxn2"><strong class="svelte-llmxn2"> </strong> <span>Templates embedded</span></div></div> <!></section> <!> <section class="actions svelte-llmxn2"><div class="actionGroup svelte-llmxn2"><button type="button" class="secondary svelte-llmxn2"><!></button></div> <div class="actionGroup svelte-llmxn2"><label><span>Save to file</span> <div class="saveRow svelte-llmxn2"><input type="text" placeholder="QuickAdd Packages/quickadd-package-YYYY-MM-DD.quickadd.json" class="svelte-llmxn2"/> <button type="button" class="svelte-llmxn2"><!></button></div></label></div></section> <section class="footer svelte-llmxn2"><button type="button" class="secondary svelte-llmxn2">Cancel</button></section></div>'),Ppe={hash:"svelte-llmxn2",code:`.exportPackageModal.svelte-llmxn2 {display:flex;flex-direction:column;gap:1rem;width:min(640px, 100%);min-width:0;max-height:75vh;}header.svelte-llmxn2 p:where(.svelte-llmxn2) {margin:0;color:var(--text-muted);}.controls.svelte-llmxn2 {display:flex;gap:0.75rem;align-items:center;flex-wrap:wrap;}.controls.svelte-llmxn2 input:where(.svelte-llmxn2) {flex:1;}.controlButtons.svelte-llmxn2 {display:flex;gap:0.5rem;flex-wrap:wrap;justify-content:flex-end;}.choiceList.svelte-llmxn2 {flex:1;min-height:180px;max-height:260px;overflow:auto;border:1px solid var(--background-modifier-border);border-radius:6px;padding:0.5rem;}.choiceList.svelte-llmxn2 ul:where(.svelte-llmxn2) {list-style:none;margin:0;padding:0;display:flex;flex-direction:column;gap:0.25rem;}.choiceList.svelte-llmxn2 label:where(.svelte-llmxn2) {display:flex;align-items:center;gap:0.5rem;padding:0.25rem 0.5rem;border-radius:4px;}.choiceList.svelte-llmxn2 label:where(.svelte-llmxn2):hover {background:var(--background-modifier-hover);}.choiceName.svelte-llmxn2 {font-weight:600;}.choicePath.svelte-llmxn2 {color:var(--text-muted);font-size:0.8rem;}.choiceType.svelte-llmxn2 {margin-left:auto;font-size:0.75rem;text-transform:uppercase;color:var(--text-faint);}.emptyState.svelte-llmxn2 {margin:0;color:var(--text-muted);text-align:center;}.summary.svelte-llmxn2 {border:1px solid var(--background-modifier-border);border-radius:6px;padding:0.75rem;display:flex;flex-direction:column;gap:0.5rem;}.summary.svelte-llmxn2 h3:where(.svelte-llmxn2) {margin:0 0 0.5rem 0;font-size:1rem;}.summaryGrid.svelte-llmxn2 {display:grid;grid-template-columns:repeat(auto-fit, minmax(140px, 1fr));gap:0.75rem;}.summaryGrid.svelte-llmxn2 div:where(.svelte-llmxn2) {display:flex;flex-direction:column;}.summaryGrid.svelte-llmxn2 strong:where(.svelte-llmxn2) {font-size:1.1rem;}
|
||
|
||
/* Neutral surface with an amber-tinted border (these are warnings, not
|
||
critical danger): ranked, not a blanket-red fill \u2014 matches the import
|
||
modal's CapabilityBanner treatment. */.warning.svelte-llmxn2 {border:1px solid var(--qa-sev-warning-border);background:var(--background-secondary);border-radius:var(--radius-m, 8px);padding:0.6rem 0.75rem;color:var(--text-normal);}.warning.svelte-llmxn2 ul:where(.svelte-llmxn2) {margin:0.25rem 0 0 1rem;padding:0;}.assetKind.svelte-llmxn2 {color:var(--text-muted);}.actions.svelte-llmxn2 {display:flex;flex-direction:column;gap:1rem;}.actionGroup.svelte-llmxn2 {display:flex;flex-direction:column;gap:0.5rem;}.saveRow.svelte-llmxn2 {display:flex;gap:0.5rem;}.saveRow.svelte-llmxn2 input:where(.svelte-llmxn2) {flex:1;}.footer.svelte-llmxn2 {display:flex;justify-content:flex-end;gap:0.5rem;margin-top:0.5rem;}.footer.svelte-llmxn2 button.secondary:where(.svelte-llmxn2) {background:transparent;}
|
||
|
||
@media (max-width: 600px) {.exportPackageModal.svelte-llmxn2 {max-height:90vh;padding-bottom:0.5rem;}.controls.svelte-llmxn2 {flex-direction:column;align-items:stretch;gap:0.5rem;}.controlButtons.svelte-llmxn2 {width:100%;flex-direction:column;gap:0.5rem;align-items:stretch;}.controlButtons.svelte-llmxn2 button:where(.svelte-llmxn2) {width:100%;}.choiceList.svelte-llmxn2 {min-height:160px;max-height:40vh;}.summaryGrid.svelte-llmxn2 {grid-template-columns:1fr;}.actions.svelte-llmxn2 {gap:0.75rem;}.actionGroup.svelte-llmxn2 {align-items:stretch;}.actionGroup.svelte-llmxn2 button:where(.svelte-llmxn2) {width:100%;}.saveRow.svelte-llmxn2 {flex-direction:column;}.saveRow.svelte-llmxn2 button:where(.svelte-llmxn2) {width:100%;}.footer.svelte-llmxn2 {flex-direction:column-reverse;align-items:stretch;}.footer.svelte-llmxn2 button:where(.svelte-llmxn2) {width:100%;}
|
||
}`};function oO(r,e){we(e,!0),ot(r,Ppe);let t={"user-script":"User script","conditional-script":"Conditional script",template:"Template file","capture-template":"Capture template"},n=Ae(""),i=Ae(wt(new Set)),o=Ae(wt(new Set)),s=Ae(wt(e4())),a=Ae(null),l=Ae(null),c=N(()=>dy(e.allChoices)),u=N(()=>v(h(c),h(n))),d=N(()=>_(h(c),h(i))),f=N(()=>E(e.allChoices,h(d),h(o))),p=N(()=>new Map(h(c).map(k=>[k.id,k.path.join(" / ")])));function m(k){return k.type==="Multi"}function v(k,L){let Q=L.trim().toLowerCase();return Q?k.filter(J=>`${J.path.join(" ")} ${J.choice.type}`.toLowerCase().includes(Q)):k}function g(k){let L=[];for(let Q of st(k))Ye(Q)&&L.push(Q.id,...g(Q));return L}function y(k,L){let Q=[k.id,...g(k)];if(L){let J=new Set(h(i));for(let ue of Q)J.add(ue);if(Z(i,J,!0),h(o).size>0){let ue=new Set(h(o));for(let ve of Q)ue.delete(ve);Z(o,ue,!0)}}else{let J=new Set(h(i));for(let ve of Q)J.delete(ve);Z(i,J,!0);let ue=new Set(h(o));for(let ve of Q)ue.add(ve);Z(o,ue,!0)}}function w(k){let L=h(c).find(J=>J.id===k);if(!L)return;let Q=h(i).has(k);y(L.choice,!Q),Z(a,null)}function x(){for(let k of h(u))y(k.choice,!0);Z(a,null)}function C(){Z(i,new Set,!0),Z(o,new Set,!0),Z(a,null)}function _(k,L){let Q=[];for(let J of k)L.has(J.id)&&(!J.parentId||!L.has(J.parentId))&&Q.push(J.id);return Q}function E(k,L,Q){if(L.length===0)return{rootCount:0,totalChoices:0,dependencyCount:0,missingChoiceIds:[],userScripts:0,conditionalScripts:0,templateFiles:0,captureTemplates:0};let J=lS(k,L,{excludedChoiceIds:Q}),ue=cS(J.catalog,J.choiceIds),ve=uS(J.catalog,J.choiceIds);return{rootCount:L.length,totalChoices:J.choiceIds.length,dependencyCount:Math.max(J.choiceIds.length-L.length,0),missingChoiceIds:J.missingChoiceIds,userScripts:ue.userScriptPaths.size,conditionalScripts:ue.conditionalScriptPaths.size,templateFiles:ve.templatePaths.size,captureTemplates:ve.captureTemplatePaths.size}}function D(k){let{missingChoiceIds:L,missingAssets:Q}=k;return L.length===0&&Q.length===0?null:{missingChoices:L,missingAssets:Q}}async function P(){if(h(d).length===0)return new Wa.Notice("Select at least one choice to export."),null;try{let k=await t4(e.app,{choices:e.allChoices,rootChoiceIds:h(d),excludedChoiceIds:Array.from(h(o)),quickAddVersion:e.plugin.manifest.version});return Z(a,D(k),!0),k}catch(k){return console.error(k),Z(a,null),new Wa.Notice(`Export failed: ${k?.message??String(k)}`),null}}async function H(){if(!h(l)){Z(l,"copy");try{let k=await P();if(!k)return;let L=JSON.stringify(k.pkg,null,2);await oe(L),new Wa.Notice(`Copied package (${k.pkg.choices.length} choice${k.pkg.choices.length===1?"":"s"}) to clipboard.`),h(a)?new Wa.Notice("Package copied with warnings. Review details below."):e.close()}catch(k){console.error(k),new Wa.Notice(`Copy failed: ${k?.message??String(k)}`)}finally{Z(l,null)}}}async function V(){if(h(l))return;let k=h(s).trim();if(!k){new Wa.Notice("Enter a file path before saving.");return}Z(l,"save");try{let L=await P();if(!L)return;let{overwritten:Q}=await n4(e.app,L.pkg,k),J=L.pkg.choices.length,ue=`${J} choice${J===1?"":"s"}`;new Wa.Notice(Q?`Overwrote package (${ue}) at '${k}'.`:`Saved package (${ue}) to '${k}'.`),h(a)?new Wa.Notice("Package saved with warnings. Review details below."):e.close()}catch(L){let Q=L?.message??String(L);if(Q.startsWith("Save cancelled:")){new Wa.Notice("Save cancelled.");return}console.error(L),new Wa.Notice(`Save failed: ${Q}`)}finally{Z(l,null)}}async function oe(k){if(navigator.clipboard?.writeText){await navigator.clipboard.writeText(k);return}let L=document.createElement("textarea");L.value=k,L.setAttribute("readonly","true"),L.style.position="fixed",L.style.opacity="0",document.body.appendChild(L),L.focus(),L.select();let Q=document.execCommand("copy");if(document.body.removeChild(L),!Q)throw new Error("Clipboard copy is not supported in this environment.")}var ce=Ipe(),R=A(I(ce),2),O=I(R);gr(O),ke(O,"spellcheck",!1);var q=A(O,2),B=I(q),ie=A(B,2);S(q),S(R);var j=A(R,2),Y=I(j);{var K=k=>{var L=Cpe();$(k,L)},se=k=>{var L=Tpe();ar(L,21,()=>h(u),Q=>Q.id,(Q,J)=>{var ue=Epe(),ve=I(ue),Ve=I(ve);gr(Ve);var yt=A(Ve,2),Pr=I(yt,!0);S(yt);var jt=A(yt,2);{var $i=kr=>{var Yn=xpe(),kt=I(Yn,!0);S(Yn),de(Eo=>me(kt,Eo),[()=>h(J).path.slice(0,-1).join(" \u203A ")]),$(kr,Yn)};ne(jt,kr=>{h(J).path.length>1&&kr($i)})}var bt=A(jt,2),pr=I(bt,!0);S(bt),S(ve),S(ue),de((kr,Yn)=>{Gf(ue,`padding-left: ${h(J).depth*16}px`),qd(Ve,kr),me(Pr,Yn),me(pr,h(J).choice.type)},[()=>h(i).has(h(J).id),()=>h(J).path.at(-1)]),De("change",Ve,()=>w(h(J).id)),$(Q,ue)}),S(L),$(k,L)};ne(Y,k=>{h(u).length===0?k(K):k(se,-1)})}S(j);var pe=A(j,2),ge=A(I(pe),2),be=I(ge),xe=I(be),Ue=I(xe,!0);S(xe),Pn(2),S(be);var $t=A(be,2),Ne=I($t),Ke=I(Ne,!0);S(Ne),Pn(2),S($t);var Xe=A($t,2),ye=I(Xe),We=I(ye,!0);S(ye),Pn(2),S(Xe);var ht=A(Xe,2),He=I(ht),_e=I(He,!0);S(He),Pn(2),S(ht);var Be=A(ht,2),ut=I(Be),or=I(ut,!0);S(ut),Pn(2),S(Be),S(ge);var yr=A(ge,2);{var Pt=k=>{var L=_pe(),Q=A(I(L),2),J=I(Q);S(Q),S(L),de(ue=>me(J,`The following choice IDs were referenced but not found:
|
||
${ue??""}`),[()=>h(f).missingChoiceIds.join(", ")]),$(k,L)};ne(yr,k=>{h(f).missingChoiceIds.length>0&&k(Pt)})}S(pe);var Ar=A(pe,2);{var ur=k=>{var L=Dpe(),Q=A(I(L),2);{var J=Ve=>{var yt=Ape(),Pr=I(yt);S(yt),de(jt=>me(Pr,`Missing choices:
|
||
${jt??""}`),[()=>h(a).missingChoices.map(jt=>h(p).get(jt)??jt).join(", ")]),$(Ve,yt)};ne(Q,Ve=>{h(a).missingChoices.length>0&&Ve(J)})}var ue=A(Q,2);{var ve=Ve=>{var yt=Spe(),Pr=A(I(yt),2);ar(Pr,21,()=>h(a).missingAssets,jt=>jt.path,(jt,$i)=>{var bt=kpe(),pr=I(bt),kr=A(pr),Yn=I(kr);S(kr),S(bt),de(()=>{me(pr,`${h($i).path??""} `),me(Yn,`(${t[h($i).kind]??""})`)}),$(jt,bt)}),S(Pr),S(yt),$(Ve,yt)};ne(ue,Ve=>{h(a).missingAssets.length>0&&Ve(ve)})}S(L),$(k,L)};ne(Ar,k=>{h(a)&&k(ur)})}var dt=A(Ar,2),Ft=I(dt),jn=I(Ft),xo=I(jn);{var Es=k=>{var L=ul("Copying\u2026");$(k,L)},Gn=k=>{var L=ul("Copy JSON");$(k,L)};ne(xo,k=>{h(l)==="copy"?k(Es):k(Gn,-1)})}S(jn),S(Ft);var re=A(Ft,2),Ie=I(re),dr=A(I(Ie),2),br=I(dr);gr(br);var _n=A(br,2),Ho=I(_n);{var Qa=k=>{var L=ul("Saving\u2026");$(k,L)},Xa=k=>{var L=ul("Save to file");$(k,L)};ne(Ho,k=>{h(l)==="save"?k(Qa):k(Xa,-1)})}S(_n),S(dr),S(Ie),S(re),S(dt);var Jc=A(dt,2),T=I(Jc);S(Jc),S(ce),de(()=>{me(Ue,h(f).rootCount),me(Ke,h(f).totalChoices),me(We,h(f).dependencyCount),me(_e,h(f).userScripts+h(f).conditionalScripts),me(or,h(f).templateFiles+h(f).captureTemplates),jn.disabled=h(l)!==null,_n.disabled=h(l)!==null,T.disabled=h(l)!==null}),uo(O,()=>h(n),k=>Z(n,k)),De("click",B,x),De("click",ie,C),De("click",jn,H),uo(br,()=>h(s),k=>Z(s,k)),De("click",_n,V),De("click",T,function(...k){e.close?.apply(this,k)}),$(r,ce),Ce()}Et(["click","change"]);var mS=class extends i4.Modal{constructor(t,n,i){super(t);this.plugin=n;this.choices=i;this.handle=null}onOpen(){this.modalEl.addClass("quickAddModal","packageExportModal"),this.handle=qi(this.contentEl,oO,{app:this.app,plugin:this.plugin,allChoices:this.choices,close:()=>this.close()},{what:"the package exporter"})}onClose(){this.handle?.destroy(),this.handle=null}};var R4=require("obsidian");var Mx=require("obsidian");It();qt();var CS=require("obsidian");hl();Wt();Ii();Kr();Kr();Kr();Wt();Ii();function Fpe(r){return r.type==="Multi"}function Mpe(r){return r.type==="Macro"}function sO(r,e,t){if(!(!r||typeof r!="object")){if(Array.isArray(r)){e.onUnreadable?.();return}if(!t.has(r)){if(t.add(r),e.onChoice?.(r),Fpe(r))if(Array.isArray(r.choices))for(let n of r.choices)sO(n,e,t);else l_(r.choices)&&e.onUnreadable?.();Mpe(r)&&hS(zn(r.macro),e,t)}}}function hS(r,e,t){if(!Array.isArray(r)){Di(r)&&e.onUnreadable?.();return}for(let n of r){if(!n||typeof n!="object")continue;if(Array.isArray(n)){e.onUnreadable?.();continue}e.onCommand?.(n);let i=n;(n.type==="Conditional"||Array.isArray(i.thenCommands)||Array.isArray(i.elseCommands))&&(hS(i.thenCommands,e,t),hS(i.elseCommands,e,t));let s=n,a=n.type==="NestedChoice"||s.choice&&typeof s.choice=="object"?s.choice:void 0;a&&sO(a,e,t)}}function aO(r,e){let t=new Set;if(Array.isArray(r.choices))for(let i of r.choices)sO(i,e,t);else e.onUnreadable?.();let n=r.macros;if(Array.isArray(n))for(let i of n)hS(zn(i),e,t);else Di(n)&&e.onUnreadable?.()}function cg(r){let e=!1;return aO(r,{onUnreadable:()=>{e=!0}}),e}function ug(r,e){aO(r.settings,{onChoice:e})}function gS(r,e){aO(r,{onCommand:e})}function Rpe(r){return r.type==="AIAssistant"}function vS(r,e,t){let n=0;return gS({choices:r},i=>{if(!Rpe(i)||i.modelRef&&i.modelRef.name===i.model&&e.find(l=>l.id===i.modelRef?.providerId)?.models.some(l=>l.name===i.model)||!i.model||i.model==="Ask me")return;let o=e.find(a=>a.models.some(l=>l.name===i.model));if(!o?.id)return;let s={providerId:o.id,name:i.model};i.modelRef=s,n++,t?.(i,s)}),n}Me();yi();cO();xc();Bc();Kr();Wt();Ii();Zv();Tt();var dO={"user-script":{severity:"critical",label:"SCRIPT",description:"Runs custom JavaScript with full access to your vault and the network."},"conditional-script":{severity:"critical",label:"CONDITIONAL",description:"Runs custom JavaScript to decide which branch executes."},"bundled-script":{severity:"critical",label:"SCRIPT FILE",description:"Bundles a file that will be written to your vault and can be run as code."},"run-on-startup":{severity:"critical",label:"STARTUP",description:"Runs automatically every time Obsidian starts."},"mislabeled-executable":{severity:"critical",label:"EXECUTABLE",description:"A bundled file is run as code even though it is labeled a template."},"registers-command":{severity:"warning",label:"COMMAND",description:"Adds a command to the command palette."},"obsidian-command":{severity:"warning",label:"OBSIDIAN",description:"Triggers another Obsidian command."},ai:{severity:"warning",label:"AI",description:"Sends note content to your AI provider over the network."},"ai-tools":{severity:"critical",label:"AI TOOLS",description:"Lets an AI model read and write your vault: the script gives the model tools (functions) it calls with model-chosen arguments."},"capture-writes":{severity:"warning",label:"WRITES",description:"Writes captured text into your notes."},"template-write":{severity:"warning",label:"TEMPLATE",description:"Creates notes from a bundled template."},"overwrites-existing-choice":{severity:"warning",label:"OVERWRITES",description:"Replaces a choice that already exists in your vault."},"overwrites-existing-file":{severity:"warning",label:"OVERWRITES",description:"Overwrites a file that already exists in your vault."},"missing-reference":{severity:"warning",label:"MISSING",description:"References a file that is not bundled in this package."},"unknown-command":{severity:"warning",label:"UNKNOWN",description:"An unrecognised command type. Review it manually."},"editor-command":{severity:"info",label:"EDITOR",description:"Runs a built-in editor command."},"open-file":{severity:"info",label:"OPEN FILE",description:"Opens a file in your vault."}};function yS(r){return dO[r].severity}function a4(r){return dO[r].label}function l4(r){return dO[r].description}function c4(r){return r==="user-script"||r==="conditional-script"}function Ope(r,e){return c4(r)||!ir.test(e)}function Npe(r,e){if(!ir.test(r))return!1;let t;try{t=Vc(e)}catch{return!1}let{code:n}=mc(t);return n!==null&&n.length>0}function Lpe(r,e){let t;try{t=Vc(e)}catch{return null}if(ir.test(r)){let{code:n}=mc(t);return n!==null&&n.length>0?n:null}return t}var Bpe=/\bai\s*\.\s*(?:tools|agent|tool)\b|\btools\s*\.\s*(?:vault|workspace|system)\s*\(/;function Upe(r){return Bpe.test(r)}var bS={critical:0,warning:1,info:2},Vpe=new Set(Object.values(Br));function za(r){return r.filter(e=>!!e).join(" \u203A ")}function qpe(r){let e=r.name?.trim();return e&&e.length>0?e:String(r.type)}function Wpe(r){if(r.mode==="script")return`script: ${r.scriptPath}${r.exportName?` (${r.exportName})`:""}`;let e=r.expectedValue!==void 0?` ${r.expectedValue}`:"";return`${r.variableName} ${r.operator}${e}`}function zpe(r){return r.type==="Macro"}function Hpe(r){return r.type==="Multi"}function jpe(r){return r.type==="Template"}function Gpe(r){return r.type==="Capture"}function Ype(r){let e=r.fileExistsBehavior;return!e||e.kind!=="apply"?!1:e.mode==="overwrite"||e.mode==="appendTop"||e.mode==="appendBottom"}function u4(r){let e=[],t=new Set(r.choices.map(n=>n.choice.id));for(let n of r.choices){let i=n.choice,o=za(n.pathHint.slice(0,-1))||"Root",s={choiceId:i.id,name:i.name,type:i.type,location:o,registersCommand:!1,flags:new Set,commands:[],usages:[],rows:[]};pO(i,s,[i.name],t,0),e.push(s)}return{choiceWalks:e}}function pO(r,e,t,n,i){if(r.command&&(e.registersCommand=!0,e.flags.add("registers-command")),zpe(r)&&(r.runOnStartup&&(e.flags.add("run-on-startup"),e.rows.push({flag:"run-on-startup",severity:"critical",title:"Runs automatically every time Obsidian starts",detail:za(t)})),uO(r.macro?.commands,e,t,n,i)),jpe(r)&&(r.templatePath&&e.usages.push({choiceId:e.choiceId,path:r.templatePath,asScript:!1,impliedKind:"template",breadcrumb:za([...t,"template"])}),Ype(r)&&e.flags.add("template-write")),Gpe(r)){e.flags.add("capture-writes");let o=r.createFileIfItDoesntExist;o?.enabled&&o.createWithTemplate&&o.template&&e.usages.push({choiceId:e.choiceId,path:o.template,asScript:!1,impliedKind:"capture-template",breadcrumb:za([...t,"new-file template"])})}if(Hpe(r)&&Array.isArray(r.choices))for(let o of r.choices)Ye(o)&&(n.has(o.id)||pO(o,e,[...t,o.name],n,i))}function uO(r,e,t,n,i){for(let o of Dr(r)){if(!Si(o))continue;let s=qpe(o),a=[...t,s];switch(o.type){case"UserScript":{let l=o;e.flags.add("user-script"),e.commands.push({name:s,type:o.type,depth:i,flag:"user-script",scriptPath:l.path}),l.path&&(e.usages.push({choiceId:e.choiceId,path:l.path,asScript:!0,impliedKind:"user-script",breadcrumb:za(a)}),e.rows.push({flag:"user-script",severity:"critical",title:"Runs custom JavaScript with full access to your vault and the network",detail:`${za(a)} (${l.path})`,scriptPath:l.path}));break}case"Conditional":{let l=o,c=l.condition,u=c?Wpe(c):void 0,d=c?.mode==="script"&&!!c.scriptPath;if(e.commands.push({name:s,type:o.type,depth:i,flag:d?"conditional-script":void 0,scriptPath:d?c.scriptPath:void 0,summary:u}),d){let f=c.scriptPath;e.flags.add("conditional-script"),e.usages.push({choiceId:e.choiceId,path:f,asScript:!0,impliedKind:"conditional-script",breadcrumb:za(a)}),e.rows.push({flag:"conditional-script",severity:"critical",title:"Runs custom JavaScript chosen by a condition",detail:`${za(a)} (${f})`,scriptPath:f})}uO(l.thenCommands??[],e,[...a,"then"],n,i+1),uO(l.elseCommands??[],e,[...a,"else"],n,i+1);break}case"NestedChoice":{let l=o;e.commands.push({name:s,type:o.type,depth:i}),l.choice&&pO(l.choice,e,[...a,l.choice.name],n,i+1);break}case"Obsidian":{let l=o;e.flags.add("obsidian-command"),e.commands.push({name:s,type:o.type,depth:i}),e.rows.push({flag:"obsidian-command",severity:"warning",title:"Triggers another Obsidian command",detail:`${za(a)}${l.commandId?` (${l.commandId})`:""}`});break}case"AIAssistant":{e.flags.add("ai"),e.commands.push({name:s,type:o.type,depth:i}),e.rows.push({flag:"ai",severity:"warning",title:"Sends note content to your AI provider over the network",detail:za(a)});break}case"EditorCommand":{e.flags.add("editor-command"),e.commands.push({name:s,type:o.type,depth:i});break}case"OpenFile":{e.flags.add("open-file"),e.commands.push({name:s,type:o.type,depth:i});break}case"Choice":case"Wait":{e.commands.push({name:s,type:o.type,depth:i});break}default:{Vpe.has(String(o.type))?e.commands.push({name:s,type:String(o.type),depth:i}):(e.flags.add("unknown-command"),e.commands.push({name:s,type:String(o.type),depth:i,flag:"unknown-command"}),e.rows.push({flag:"unknown-command",severity:"warning",title:"Unknown capability. Review it manually.",detail:`${za(a)} (${String(o.type)})`}));break}}}}function d4(r){let{choiceWalks:e}=u4(r),t=new Set;for(let n of e)for(let i of n.usages)i.path&&t.add(i.path);return Array.from(t)}function Kpe(r){let e=r.length;if(e===0)return 0;let t=0;return r.endsWith("==")?t=2:r.endsWith("=")&&(t=1),Math.max(0,Math.floor(e*3/4)-t)}function Qpe(r,e){return bS[yS(r)]-bS[yS(e)]}function p4(r,e,t){let{choiceWalks:n}=u4(e),i=new Set(Un(r).map(E=>E.id)),o=new Map;for(let E of n)for(let D of E.usages){let P=o.get(D.path)??[];P.push(D),o.set(D.path,P)}let s=new Set;for(let[E,D]of o)D.some(P=>P.asScript)&&s.add(E);let a=new Set(e.assets.map(E=>E.originalPath)),l=e.assets.map(E=>{let D=o.get(E.originalPath)??[],P=s.has(E.originalPath),H=P||Ope(E.kind,E.originalPath)||Npe(E.originalPath,E.content);return{originalPath:E.originalPath,kind:E.kind,bundled:!0,executable:P,requiresReview:H,exists:t.has(E.originalPath),sizeBytes:Kpe(E.content),orphan:D.length===0,referencedBy:D}}),c=n.map(E=>{let D=i.has(E.choiceId),P=Array.from(E.flags);return D&&P.push("overwrites-existing-choice"),P.sort(Qpe),{choiceId:E.choiceId,name:E.name,type:E.type,location:E.location,exists:D,registersCommand:E.registersCommand,flags:P,commands:E.commands}}),u=[];for(let[E,D]of o){if(a.has(E)||t.has(E))continue;let P=D.some(H=>H.asScript);u.push({path:E,asScript:P,breadcrumb:D[0]?.breadcrumb??E})}let d=l.filter(E=>E.orphan).map(E=>E.originalPath),f=[];for(let E of n)for(let D of E.rows)f.push(D);for(let E of l)E.executable&&(c4(E.kind)||f.push({flag:"mislabeled-executable",severity:"critical",title:"Runs a file as code even though it is labeled a template",detail:E.originalPath,scriptPath:E.originalPath}));for(let E of l)E.requiresReview&&(E.executable||f.push({flag:"bundled-script",severity:"critical",title:"Bundles a file that will be written to your vault and can be run as code",detail:E.originalPath,scriptPath:E.originalPath}));for(let E of l){if(!E.requiresReview)continue;let D=e.assets.find(H=>H.originalPath===E.originalPath);if(!D)continue;let P=Lpe(D.originalPath,D.content);!P||!Upe(P)||f.push({flag:"ai-tools",severity:"critical",title:"Lets an AI model read and write your vault",detail:E.originalPath,scriptPath:E.originalPath})}let p=c.filter(E=>E.registersCommand).length;p>0&&f.push({flag:"registers-command",severity:"warning",title:"Adds commands to the command palette",detail:`${p} choice${p===1?"":"s"}`});let m=c.filter(E=>E.exists).length;m>0&&f.push({flag:"overwrites-existing-choice",severity:"warning",title:"Replaces choices that already exist in your vault",detail:`${m} choice${m===1?"":"s"}`});let v=l.filter(E=>E.exists).length;if(v>0&&f.push({flag:"overwrites-existing-file",severity:"warning",title:"Overwrites existing files in your vault",detail:`${v} file${v===1?"":"s"}`}),u.length>0){let E=u.filter(D=>D.asScript).length;f.push({flag:"missing-reference",severity:E>0?"critical":"warning",title:E>0?"References scripts that are not bundled, so they run from whatever exists at those paths after import":"References files that are not bundled and not in your vault",detail:`${u.length} reference${u.length===1?"":"s"}`})}f.sort((E,D)=>bS[E.severity]-bS[D.severity]);let g=l.filter(E=>E.requiresReview).map(E=>E.originalPath),y=s.size,w=n.some(E=>E.flags.has("run-on-startup")),x=f.filter(E=>E.severity==="critical").length,C=f.filter(E=>E.severity==="warning").length,_={hasCritical:x>0,hasWarning:C>0,criticalCount:x,warningCount:C,runsOnStartup:w,scriptCount:y,registersCommandCount:p,overwritesChoices:m,overwritesFiles:v,missingCount:u.length};return{quickAddVersion:e.quickAddVersion,createdAt:e.createdAt,choiceCount:e.choices.length,fileCount:e.assets.length,choices:c,files:l,capabilityRows:f,missingReferences:u,orphanAssets:d,criticalScriptPaths:g,summary:_}}var s4=1e5;function Xpe(r){return typeof TextEncoder<"u"?new TextEncoder().encode(r).length:r.length}function Zpe(r){if(r.length<1e3)return!1;let e=0,t=1,n=0;for(let o=0;o<r.length;o++)r[o]===`
|
||
`?(n>e&&(e=n),n=0,t++):n++;n>e&&(e=n);let i=r.length/t;return e>1e3||i>250}function wS(r,e){let t=r.assets.find(n=>n.originalPath===e);if(!t)return{found:!1,text:"",truncated:!1,sizeBytes:0,looksMinified:!1,error:"File is not bundled in this package."};try{let n=Vc(t.content),i=n.length>s4,o=i?n.slice(0,s4):n;return{found:!0,text:o,truncated:i,sizeBytes:Xpe(n),looksMinified:Zpe(o)}}catch(n){return{found:!0,text:"",truncated:!1,sizeBytes:0,looksMinified:!1,error:n instanceof Error?n.message:String(n)}}}function f4(r){return r.summary.hasCritical}function m4(r,e){return r.criticalScriptPaths.every(t=>e.has(t))}async function h4(r,e){if(Vn(e))throw new Error(`Refusing to read a package outside the vault: "${e}".`);let t=(0,CS.normalizePath)(e.trim());if(!t)throw new Error("Package path cannot be empty.");if(!await r.vault.adapter.exists(t))throw new Error(`Package file not found: ${t}`);let i=await r.vault.adapter.read(t);return{pkg:vO(i),path:t}}function vO(r){let e;try{e=JSON.parse(r)}catch(o){throw new Error(`Package content is not valid JSON: ${o?.message??o}`)}if(!GY(e))throw new Error("Content is not a valid QuickAdd package.");if(e.schemaVersion>1)throw new Error(`Package schema version ${e.schemaVersion} is newer than this plugin supports (${1}).`);let t=Jpe(e.assets);if(t!==null)throw new Error(`Package contains duplicate asset path "${t}". Each asset must have a unique path.`);let n=efe(e.choices);if(n!==null)throw new Error(`Package contains conflicting definitions for choice "${n}". Each choice id must describe the same choice everywhere it appears.`);let i=tfe(e.choices);if(i!==null)throw new Error(`Package choice "${i}" names a parent that does not list it as a child. Each parented choice must appear inside its parent.`);return e}function Jpe(r){let e=new Set;for(let t of r){let n=(0,CS.normalizePath)(t.originalPath??"");if(e.has(n))return t.originalPath;e.add(n)}return null}function efe(r){let e=new Map,t=null,n=i=>{if(t!==null||!i||typeof i!="object")return;let o=i.id;if(typeof o=="string"){let s=mO(i),a=e.get(o);if(a===void 0)e.set(o,s);else if(a!==s){t=o;return}}if(i.type==="Multi"){let s=i;if(Array.isArray(s.choices))for(let a of s.choices)n(a)}i.type==="Macro"&&fO(i.macro?.commands,n)};for(let i of r){if(t!==null)break;n(i?.choice)}return t}function fO(r,e){if(Array.isArray(r)){for(let t of r)if(t){if(t.type==="NestedChoice")e(t.choice);else if(t.type==="Conditional"){let n=t;fO(n.thenCommands,e),fO(n.elseCommands,e)}}}}function mO(r){if(r===null||typeof r!="object"){let n=JSON.stringify(r);return n===void 0?"\0undefined":n}if(Array.isArray(r))return`[${r.map(mO).join(",")}]`;let e=r;return`{${Object.keys(e).sort().map(n=>`${JSON.stringify(n)}:${mO(e[n])}`).join(",")}}`}function tfe(r){let e=new Map(r.map(t=>[t.choice.id,t]));for(let t of r){let n=t.parentChoiceId;if(n===null)continue;let i=e.get(n);if(!i)continue;let o=i.choice;if(!st(o).some(a=>a?.id===t.choice.id))return t.choice.id}return null}async function g4(r,e,t){let n=new Map(Un(e).map(s=>[s.id,s])),i=t.choices.map(s=>({choiceId:s.choice.id,name:s.choice.name,parentChoiceId:s.parentChoiceId,pathHint:s.pathHint??[],exists:n.has(s.choice.id)})),o=[];for(let s of t.assets){let a=Vn(s.originalPath)?!1:await r.vault.adapter.exists(s.originalPath);o.push({originalPath:s.originalPath,exists:a,kind:s.kind})}return{choiceConflicts:i,assetConflicts:o}}async function xS(r,e,t){let n=new Set([...t.assets.map(a=>a.originalPath),...d4(t)]),i=new Set;await Promise.all(Array.from(n,async a=>{a&&(Vn(a)||await y4(r,a)&&i.add(a))}));let o=p4(e,t,i),{summary:s}=o;return F.logMessage(`QuickAdd import preview: choices=${o.choiceCount} files=${o.fileCount} scripts=${s.scriptCount} runOnStartup=${s.runsOnStartup} registersCommands=${s.registersCommandCount} overwritesChoices=${s.overwritesChoices} overwritesFiles=${s.overwritesFiles} missing=${s.missingCount} critical=${s.criticalCount} warning=${s.warningCount}`),o}function rfe(r){let t=(r??"").trim();if(!t)throw new Error("Package asset has an empty destination path.");let n=t.replace(/\\/g,"/");if(n.startsWith("/")||/^[a-zA-Z]:/.test(n))throw new Error(`Refusing to import asset to an absolute path outside the vault: "${n}".`);let i=(0,CS.normalizePath)(t);if(!i||i.trim()==="")throw new Error("Package asset has an empty destination path.");let o=i.split("/").filter(a=>a.length>0);if(o.some(a=>a===".."))throw new Error(`Refusing to import asset with a path-traversal segment ("..") in: "${i}".`);if(o.find(a=>a.startsWith(".")&&!a.startsWith("..%")))throw new Error(`Refusing to import asset into a config directory: "${i}".`);return i}async function v4(r){let{app:e,existingChoices:t,pkg:n}=r,i=new Map(r.choiceDecisions.map(R=>[R.choiceId,R.mode])),o=new Map(r.assetDecisions.map(R=>[R.originalPath,R])),s=new Map(n.choices.map(R=>[R.choice.id,R])),a=nfe(n),l=new Set,c=new Map,u=new Set,d=R=>{let O=K=>(c.set(R,K),u.delete(R),K);if(c.has(R))return c.get(R);if(u.has(R))return!0;if(u.add(R),i.get(R)==="skip")return O(!1);let B=s.get(R);if(!B)return O(!1);let ie=B.parentChoiceId;if(!ie||!s.has(ie)||i.get(ie)==="skip")return O(!0);let Y=d(ie);return O(Y)};for(let R of n.choices)d(R.choice.id)&&l.add(R.choice.id);let f=new Set,p=new Set,m=new Set,v=new Map,g=R=>{let O=()=>(f.add(R),p.delete(R),!0),q=()=>(p.add(R),!1);if(!l.has(R))return!1;if(f.has(R))return!0;if(p.has(R))return!1;if(m.has(R))return q();m.add(R);try{if(i.get(R)==="duplicate")return O();let j=s.get(R)?.parentChoiceId??null;return j&&(i.get(j)==="duplicate"||l.has(j)&&g(j))?O():q()}finally{m.delete(R)}};for(let R of n.choices){if(!l.has(R.choice.id))continue;let q=g(R.choice.id)?xr():R.choice.id;v.set(R.choice.id,q)}let y=gt(t),w=[],x=[],C=[],_=new Map;for(let R of n.choices){if(!l.has(R.choice.id)){C.push(R.choice.id);continue}let O=gt(R.choice),q=yO(O,v,l,{secretOptionNamesByPath:a,stripUnknownStringSettings:!0});_.set(R.choice.id,q)}r.aiProviders?.length&&vS(Array.from(_.values()),r.aiProviders);let E=new Set;for(let R of n.choices){let O=R.choice.id;if(!l.has(O)||E.has(O))continue;let q=_.get(O);if(!q)continue;let B=q.id,ie=i.get(O)??"import",j=R.parentChoiceId;if(j&&l.has(j)?_.get(j):null){E.add(O);continue}if((ie==="overwrite"||ie==="import")&&b4(y,q)){x.push(B),E.add(O);continue}if(j){let se=v.get(j)??j;if(w4(y,se,q)){w.push(B),E.add(O);continue}let ge=ofe(y,R.pathHint.slice(0,-1));if(ge&&C4(ge,q)){w.push(B),E.add(O);continue}F.logWarning(`QuickAdd import: could not locate parent for '${R.choice.name}'. Adding to root.`)}let K=y.findIndex(se=>Ye(se)&&se.id===B);K!==-1?(y.splice(K,1,q),x.push(B)):(y.push(q),w.push(B)),E.add(O)}let D=new Map,P=[],H=[],V=n.assets.map(R=>{let q=o.get(R.originalPath)?.destinationPath?.trim(),B=rfe(q||R.originalPath);return{asset:R,destinationPath:B}}),oe=await ife(e),ce=new Map;for(let{asset:R,destinationPath:O}of V){if(o.get(R.originalPath)?.mode==="skip")continue;let q=oe?O.toLowerCase():O,B=ce.get(q);if(B)throw new Error(`Refusing to import: assets "${B.originalPath}" and "${R.originalPath}" resolve to the same destination ("${O}"). Rename one so each imported file is unique.`);ce.set(q,{originalPath:R.originalPath,destinationPath:O})}for(let{destinationPath:R}of V)await dg(e,R);for(let{asset:R,destinationPath:O}of V){let q=o.get(R.originalPath),B=await y4(e,O);if((q?.mode??(B?"overwrite":"write"))==="skip"){H.push(O);continue}await pS(e,O);let j=Vc(R.content);await e.vault.adapter.write(O,j),P.push(O),D.set(R.originalPath,O)}for(let R of _.values())bO(R,D);return{updatedChoices:y,addedChoiceIds:w,overwrittenChoiceIds:x,skippedChoiceIds:C,writtenAssets:P,skippedAssets:H}}function nfe(r){let e=new Map;for(let t of r.assets)if(t.kind==="user-script")try{let n=Rh(Vc(t.content),t.originalPath);e.set(t.originalPath,n.foundSecretOptions&&n.names.size===0?null:n.names)}catch(n){F.logWarning(`QuickAdd import could not inspect user-script settings '${t.originalPath}': ${n?.message??n}`)}return e}async function y4(r,e){try{return await r.vault.adapter.exists(e)}catch{return!1}}async function ife(r){let e=r.vault.configDir;if(!e)return!1;let t=e===e.toLowerCase()?e.toUpperCase():e.toLowerCase();if(t===e)return!1;try{return await r.vault.adapter.exists(t)}catch{return!1}}function yO(r,e,t,n){let i=r.id,o=e.get(i)??i;r.id=o;let s=o!==i;if(r.type==="Macro"){let a=r;s&&ed(a.macro)&&(a.macro.id=xr()),hO(zn(a.macro),e,t,s,n)}if(r.type==="Multi"){let a=r;Array.isArray(a.choices)&&(a.choices=a.choices.filter(l=>Ye(l)&&t.has(l.id)).map(l=>yO(l,e,t,n)))}return r}function hO(r,e,t,n,i){for(let o of Dr(r))if(Si(o))switch(C$(o,i),n&&(o.id=xr()),o.type){case"Choice":{let s=o,a=e.get(s.choiceId);a&&(s.choiceId=a);break}case"Conditional":{let s=o;hO(s.thenCommands,e,t,n,i),hO(s.elseCommands,e,t,n,i);break}case"NestedChoice":{let s=o;s.choice&&t.has(s.choice.id)&&(s.choice=yO(s.choice,e,t,i));break}default:break}}function b4(r,e){for(let t=0;t<r.length;t++){let n=r[t];if(Ye(n)){if(n.id===e.id)return r.splice(t,1,e),!0;if(b4(st(n),e))return!0}}return!1}function w4(r,e,t){for(let n of r)if(Ye(n)){if(n.id===e&&n.type==="Multi")return C4(n,t);if(w4(st(n),e,t))return!0}return!1}function C4(r,e){if(!Array.isArray(r.choices)){if(zs(r))return!1;r.choices=[]}let t=r.choices.findIndex(n=>Ye(n)&&n.id===e.id);return t!==-1?r.choices.splice(t,1,e):r.choices.push(e),!0}function ofe(r,e){if(e.length===0)return null;let t=r,n=null;for(let i of e){let o=t.find(s=>Ye(s)&&s.type==="Multi"&&s.name===i);if(!o)return null;n=o,t=st(o)}return n}function bO(r,e){switch(r.type){case"Macro":{gO(zn(r.macro),e);break}case"Template":{let t=r,n=e.get(t.templatePath);n&&(t.templatePath=n);break}case"Capture":{let t=r,n=t.createFileIfItDoesntExist?.template;if(n){let i=e.get(n);i&&(t.createFileIfItDoesntExist={...t.createFileIfItDoesntExist,template:i})}break}case"Multi":{r.choices?.forEach(n=>bO(n,e));break}default:break}}function gO(r,e){for(let t of Dr(r))if(Si(t))switch(t.type){case"UserScript":{let n=t,i=e.get(n.path);i&&(n.name===n.path?n.name=i:n.name.startsWith(`${n.path}::`)&&(n.name=i+n.name.slice(n.path.length)),n.path=i);break}case"Conditional":{let n=t;if(n.condition.mode==="script"&&n.condition.scriptPath){let i=e.get(n.condition.scriptPath);i&&(n.condition={...n.condition,scriptPath:i})}gO(n.thenCommands,e),gO(n.elseCommands,e);break}case"NestedChoice":{let n=t;n.choice&&bO(n.choice,e);break}default:break}}var ES=require("obsidian");function Px(r,e){return e&&(0,ES.setTooltip)(r,e),{update(t){(0,ES.setTooltip)(r,t??"")},destroy(){(0,ES.setTooltip)(r,"")}}}var sfe=W("<span> </span>"),afe={hash:"svelte-5jkd35",code:`.qa-import-tag.svelte-5jkd35 {display:inline-flex;align-items:center;padding:0.05rem 0.4rem;border-radius:var(--radius-s, 4px);font-size:0.7rem;font-weight:600;letter-spacing:0.02em;text-transform:uppercase;line-height:1.45;white-space:nowrap;cursor:help;}
|
||
|
||
/* Critical: darkened red so white text clears WCAG AA (~5:1) at this size,
|
||
where Obsidian's stock --color-red (#e93147) lands at ~3.5:1. */.qa-import-tag.critical.svelte-5jkd35 {background:var(--qa-sev-critical-pill);color:#fff;}
|
||
|
||
/* Warning: amber is medium-luminance in both themes, so near-black text
|
||
(~8:1) beats white-on-amber (~2.9:1). Fallback #ff8c00 matches styles.css
|
||
and clears AA (~5.9:1) with #1a1a1a. */.qa-import-tag.warning.svelte-5jkd35 {background:var(--color-orange, #ff8c00);color:#1a1a1a;}.qa-import-tag.info.svelte-5jkd35 {background:var(--background-modifier-border);color:var(--text-normal);}`};function Fx(r,e){we(e,!0),ot(r,afe);let t=N(()=>yS(e.flag)),n=N(()=>a4(e.flag)),i=N(()=>l4(e.flag));var o=sfe();let s;var a=I(o,!0);S(o),Fr(o,(l,c)=>Px?.(l,c),()=>h(i)),de(()=>{s=Ct(o,1,"qa-import-tag svelte-5jkd35",null,s,{critical:h(t)==="critical",warning:h(t)==="warning",info:h(t)==="info"}),me(a,h(n))}),$(r,o),Ce()}var lfe=W('<span class="qa-import-banner-detail svelte-tb9yz"> </span>'),cfe=W('<li><span class="qa-import-banner-tag svelte-tb9yz"><!></span><span class="qa-import-banner-title svelte-tb9yz"> </span> <!></li>'),ufe=W('<p class="qa-import-banner-note svelte-tb9yz">Takes effect after you reload the plugin or restart Obsidian.</p>'),dfe=W('<section aria-label="What this package can do"><div class="qa-import-banner-head svelte-tb9yz"><span class="qa-import-banner-icon svelte-tb9yz"><!></span> <h3 class="svelte-tb9yz">What this package can do</h3></div> <ul class="qa-import-banner-rows svelte-tb9yz"></ul> <!></section>'),pfe={hash:"svelte-tb9yz",code:`.qa-import-banner.svelte-tb9yz {background:var(--background-secondary);border:1px solid var(--background-modifier-border);border-radius:var(--radius-m, 8px);padding:0.85rem;display:flex;flex-direction:column;gap:0.5rem;}
|
||
|
||
/* Critical packages get a red-tinted hairline + red icon, not a blanket-red
|
||
fill: severity stays ranked and all text keeps its contrast on the neutral
|
||
surface. (A solid colored side-stripe would be the banned pattern.) */.qa-import-banner.critical.svelte-tb9yz {border-color:var(--qa-sev-critical-border);}.qa-import-banner-head.svelte-tb9yz {display:flex;align-items:center;gap:0.5rem;}.qa-import-banner-icon.svelte-tb9yz {display:inline-flex;color:var(--text-warning, var(--text-muted));}.qa-import-banner.critical.svelte-tb9yz .qa-import-banner-icon:where(.svelte-tb9yz) {color:var(--text-error);}.qa-import-banner-head.svelte-tb9yz h3:where(.svelte-tb9yz) {margin:0;font-size:1rem;}.qa-import-banner-rows.svelte-tb9yz {list-style:none;margin:0;padding:0;display:flex;flex-direction:column;gap:0.25rem;}
|
||
|
||
/* The pill is an inline lead-in to the sentence (not a fixed left column),
|
||
so long titles wrap full-width under it instead of leaving a dead column
|
||
of whitespace beside a one-line pill. */.qa-import-banner-rows.svelte-tb9yz li:where(.svelte-tb9yz) {display:block;padding:0.4rem 0.5rem;border-radius:var(--radius-s, 4px);}.qa-import-banner-tag.svelte-tb9yz {display:inline-block;vertical-align:middle;margin:0 0.4rem 0.15rem 0;}
|
||
|
||
/* Faint per-row severity wash so critical rows read hottest while warnings
|
||
recede, without saturating the whole banner. Composited over the banner
|
||
surface (not transparent) so the tint is a solid, predictable colour. */.qa-import-banner-rows.svelte-tb9yz li.sev-critical:where(.svelte-tb9yz) {background:var(--qa-sev-critical-wash);}.qa-import-banner-rows.svelte-tb9yz li.sev-warning:where(.svelte-tb9yz) {background:var(--qa-sev-warning-wash);}.qa-import-banner-rows.svelte-tb9yz li.sev-info:where(.svelte-tb9yz) {background:var(--qa-sev-info-wash);}.qa-import-banner-title.svelte-tb9yz {line-height:1.4;}.qa-import-banner-detail.svelte-tb9yz {display:block;margin-top:0.15rem;font-size:var(--font-ui-smaller, 0.8rem);color:var(--text-muted);overflow-wrap:anywhere;}.qa-import-banner-note.svelte-tb9yz {margin:0;font-size:var(--font-ui-smaller, 0.8rem);color:var(--text-muted);}`};function wO(r,e){we(e,!0),ot(r,pfe);let t=N(()=>e.preview.summary.runsOnStartup||e.preview.summary.registersCommandCount>0);var n=dfe();let i;var o=I(n),s=I(o),a=I(s);Rt(a,{iconId:"alert-triangle",size:17}),S(s),Pn(2),S(o);var l=A(o,2);ar(l,21,()=>e.preview.capabilityRows,d=>d.flag+d.detail,(d,f)=>{var p=cfe();let m;var v=I(p),g=I(v);Fx(g,{get flag(){return h(f).flag}}),S(v);var y=A(v),w=I(y,!0);S(y);var x=A(y,2);{var C=_=>{var E=lfe(),D=I(E,!0);S(E),de(()=>me(D,h(f).detail)),$(_,E)};ne(x,_=>{h(f).detail&&_(C)})}S(p),de(()=>{m=Ct(p,1,"svelte-tb9yz",null,m,{"sev-critical":h(f).severity==="critical","sev-warning":h(f).severity==="warning","sev-info":h(f).severity==="info"}),me(w,h(f).title)}),$(d,p)}),S(l);var c=A(l,2);{var u=d=>{var f=ufe();$(d,f)};ne(c,d=>{h(t)&&d(u)})}S(n),de(()=>i=Ct(n,1,"qa-import-banner svelte-tb9yz",null,i,{critical:e.preview.summary.hasCritical})),$(r,n),Ce()}var ffe=W('<span class="qa-import-file-exec svelte-lmqem5">Executable</span>'),mfe=W('<span class="qa-import-file-reviewed svelte-lmqem5"><!> Reviewed</span>'),hfe=W('<span class="qa-import-file-orphan svelte-lmqem5">Unused</span>'),gfe=W("<option>Overwrite</option>"),vfe=W(`<p class="qa-import-file-skip-warn svelte-lmqem5" role="note">Won't be written. Any choice that uses this script will run whatever
|
||
file already exists at this path after import, not the contents you
|
||
reviewed.</p>`),yfe=W('<p class="qa-import-file-error svelte-lmqem5"> </p>'),bfe=W(`<p class="qa-import-file-warn svelte-lmqem5">Minified: cannot be visually reviewed. Import
|
||
only if you trust the source.</p>`),wfe=W('<p class="qa-import-file-warn svelte-lmqem5"> </p>'),Cfe=W('<!> <pre class="qa-import-file-code svelte-lmqem5" tabindex="0" role="region"> </pre> <!>',1),xfe=W('<div class="qa-import-file-preview svelte-lmqem5"><!></div>'),Efe=W('<div><div class="qa-import-file-head svelte-lmqem5"><!> <span> </span> <span class="qa-import-file-arrow svelte-lmqem5" aria-hidden="true">\u2192</span> <span class="qa-import-file-dest svelte-lmqem5"> </span></div> <div class="qa-import-file-badges svelte-lmqem5"><!> <!> <!> <span class="qa-import-file-size svelte-lmqem5"> </span></div> <div class="qa-import-file-fields svelte-lmqem5"><label class="qa-import-file-field svelte-lmqem5"><span class="qa-import-file-field-name svelte-lmqem5">Destination</span> <input type="text" placeholder="vault/path/to/file" class="svelte-lmqem5"/></label> <label class="qa-import-file-field svelte-lmqem5"><span class="qa-import-file-field-name svelte-lmqem5">Action</span> <select class="dropdown svelte-lmqem5"><option>Write</option><!><option>Skip</option></select></label></div> <!> <button type="button" class="qa-import-file-toggle svelte-lmqem5"><span><!></span> <span> </span></button> <div><div class="qa-import-file-preview-inner svelte-lmqem5"><!></div></div></div>'),Tfe={hash:"svelte-lmqem5",code:`.qa-import-file.svelte-lmqem5 {border:1px solid var(--background-modifier-border);border-radius:var(--radius-m, 8px);padding:0.6rem 0.75rem;display:flex;flex-direction:column;gap:0.5rem;background:var(--background-secondary);}.qa-import-file.overwrite.svelte-lmqem5 {border-color:var(--qa-sev-critical-border);}.qa-import-file-head.svelte-lmqem5 {display:flex;align-items:center;gap:0.4rem;flex-wrap:wrap;}.qa-import-file-status.svelte-lmqem5 {font-size:0.78rem;font-weight:700;letter-spacing:0.01em;color:var(--text-muted);}.qa-import-file-status.overwrite.svelte-lmqem5 {color:var(--text-error);}.qa-import-file-arrow.svelte-lmqem5 {color:var(--text-muted);}.qa-import-file-dest.svelte-lmqem5 {font-family:var(--font-monospace);font-size:0.85rem;overflow-wrap:anywhere;}.qa-import-file-badges.svelte-lmqem5 {display:flex;flex-wrap:wrap;gap:0.35rem;align-items:center;}.qa-import-file-orphan.svelte-lmqem5 {display:inline-flex;padding:0.05rem 0.4rem;border-radius:var(--radius-s, 4px);font-size:0.7rem;background:var(--background-modifier-hover);
|
||
/* --text-normal (not --text-muted) so the badge clears AA on the hover
|
||
surface in dark themes too. */color:var(--text-normal);cursor:help;}.qa-import-file-exec.svelte-lmqem5 {display:inline-flex;padding:0.05rem 0.4rem;border-radius:var(--radius-s, 4px);font-size:0.7rem;font-weight:700;letter-spacing:0.02em;text-transform:uppercase;background:var(--qa-sev-critical-pill);color:#fff;cursor:help;}.qa-import-file-reviewed.svelte-lmqem5 {display:inline-flex;align-items:center;gap:0.15rem;font-size:0.72rem;color:var(--text-success, var(--color-green, #0aa344));}.qa-import-file-size.svelte-lmqem5 {font-size:0.72rem;color:var(--text-faint);margin-left:auto;}
|
||
|
||
/* Obsidian Setting-row geometry: field name on the left at --text-normal,
|
||
control docked right at its native height \u2014 not a stacked label-above
|
||
form field (which read as non-native). */.qa-import-file-fields.svelte-lmqem5 {display:flex;flex-direction:column;gap:0.4rem;}.qa-import-file-field.svelte-lmqem5 {display:flex;align-items:center;gap:1rem;}.qa-import-file-field-name.svelte-lmqem5 {flex:1 1 auto;min-width:0;color:var(--text-normal);}.qa-import-file-field.svelte-lmqem5 input:where(.svelte-lmqem5) {flex:0 1 300px;min-width:0;}.qa-import-file-field.svelte-lmqem5 select:where(.svelte-lmqem5) {flex:0 0 auto;}
|
||
|
||
/* The native Obsidian input/dropdown focus box-shadow handles focus; no
|
||
custom outline (which would read as non-native). */.qa-import-file-field.svelte-lmqem5 input:where(.svelte-lmqem5):disabled {opacity:0.5;cursor:not-allowed;}.qa-import-file-toggle.svelte-lmqem5 {display:inline-flex;align-items:center;gap:0.3rem;align-self:flex-start;background:transparent;border:none;box-shadow:none;padding:0.1rem 0.2rem;margin-left:-0.2rem;cursor:pointer;color:var(--text-accent);font-size:0.85rem;border-radius:var(--radius-s, 4px);}.qa-import-file-toggle.svelte-lmqem5:hover {color:var(--interactive-accent-hover, var(--text-accent));text-decoration:underline;}.qa-import-file-toggle.svelte-lmqem5:focus-visible {outline:2px solid var(--interactive-accent);outline-offset:1px;}.qa-import-file-chevron.svelte-lmqem5 {display:inline-flex;transition:transform 180ms ease;}.qa-import-file-chevron.open.svelte-lmqem5 {transform:rotate(90deg);}.qa-import-file-preview-wrap.svelte-lmqem5 {display:grid;grid-template-rows:0fr;transition:grid-template-rows 200ms ease;}.qa-import-file-preview-wrap.open.svelte-lmqem5 {grid-template-rows:1fr;}.qa-import-file-preview-inner.svelte-lmqem5 {overflow:hidden;min-height:0;}.qa-import-file-preview.svelte-lmqem5 {display:flex;flex-direction:column;gap:0.4rem;padding-top:0.2rem;}.qa-import-file-warn.svelte-lmqem5 {margin:0;color:var(--text-warning, var(--text-muted));font-size:var(--font-ui-smaller, 0.85rem);}.qa-import-file-skip-warn.svelte-lmqem5 {margin:0;padding:0.4rem 0.5rem;border-radius:var(--radius-s, 4px);background:var(--qa-sev-warning-wash);color:var(--text-normal);font-size:var(--font-ui-smaller, 0.85rem);line-height:1.4;}.qa-import-file-error.svelte-lmqem5 {margin:0;color:var(--text-error);font-size:var(--font-ui-smaller, 0.85rem);}.qa-import-file-code.svelte-lmqem5 {margin:0;max-height:240px;overflow:auto;padding:0.5rem 0.6rem;border-radius:var(--radius-s, 4px);background:var(--background-modifier-form-field);border:1px solid var(--background-modifier-border);font-family:var(--font-monospace);font-size:0.8rem;line-height:1.5;white-space:pre;tab-size:4;}.qa-import-file-code.svelte-lmqem5:focus-visible {outline:2px solid var(--interactive-accent);outline-offset:1px;}
|
||
|
||
@media (max-width: 600px) {
|
||
/* Stack control under its name and let it use the full width on narrow
|
||
screens, where a right-docked control would be cramped. */.qa-import-file-field.svelte-lmqem5 {flex-wrap:wrap;gap:0.25rem;}.qa-import-file-field.svelte-lmqem5 input:where(.svelte-lmqem5),
|
||
.qa-import-file-field.svelte-lmqem5 select:where(.svelte-lmqem5) {flex:1 1 100%;}.qa-import-file-size.svelte-lmqem5 {margin-left:0;}
|
||
}.is-mobile .qa-import-file-toggle.svelte-lmqem5 {min-height:36px;padding:0.4rem 0.3rem;}
|
||
|
||
@media (prefers-reduced-motion: reduce) {.qa-import-file-chevron.svelte-lmqem5,
|
||
.qa-import-file-preview-wrap.svelte-lmqem5 {transition:none;}
|
||
}`};function TS(r,e){we(e,!0),ot(r,Tfe);let t=he(e,"reviewed",3,!1),n=Ae(!1),i=N(()=>h(n)?wS(e.pkg,e.file.originalPath):null),o=N(()=>`qa-file-preview-${e.file.originalPath.replace(/[^a-zA-Z0-9_-]/g,"-")}`);function s(_e){return _e<1024?`${_e} B`:_e<1024*1024?`${(_e/1024).toFixed(1)} KB`:`${(_e/(1024*1024)).toFixed(1)} MB`}function a(){Z(n,!h(n)),h(n)&&e.file.requiresReview&&e.onReviewed(e.file.originalPath)}function l(_e){e.onPathInput(_e.currentTarget.value)}function c(_e){e.onModeChange(_e.currentTarget.value)}var u=Efe();let d;var f=I(u),p=I(f);{let _e=N(()=>e.destinationExists?"file-warning":"file-plus");Rt(p,{get iconId(){return h(_e)},size:16})}var m=A(p,2);let v;var g=I(m,!0);S(m);var y=A(m,4),w=I(y,!0);S(y),S(f);var x=A(f,2),C=I(x);{var _=_e=>{var Be=ffe();Fr(Be,(ut,or)=>Px?.(ut,or),()=>"Runs as code when its choice runs. It can read, change, or delete files in your vault and access the network."),$(_e,Be)};ne(C,_e=>{e.file.executable&&_e(_)})}var E=A(C,2);{var D=_e=>{var Be=mfe(),ut=I(Be);Rt(ut,{iconId:"check",size:12}),Pn(),S(Be),$(_e,Be)};ne(E,_e=>{t()&&e.mode!=="skip"&&e.file.requiresReview&&_e(D)})}var P=A(E,2);{var H=_e=>{var Be=hfe();Fr(Be,(ut,or)=>Px?.(ut,or),()=>"Bundled in this package but not referenced by any choice."),$(_e,Be)};ne(P,_e=>{e.file.orphan&&_e(H)})}var V=A(P,2),oe=I(V,!0);S(V),S(x);var ce=A(x,2),R=I(ce),O=A(I(R),2);gr(O),S(R);var q=A(R,2),B=A(I(q),2),ie=I(B);ie.value=ie.__value="write";var j=A(ie);{var Y=_e=>{var Be=gfe();Be.value=Be.__value="overwrite",$(_e,Be)};ne(j,_e=>{e.destinationExists&&_e(Y)})}var K=A(j);K.value=K.__value="skip",S(B);var se;Vd(B),S(q),S(ce);var pe=A(ce,2);{var ge=_e=>{var Be=vfe();$(_e,Be)};ne(pe,_e=>{e.file.requiresReview&&e.mode==="skip"&&_e(ge)})}var be=A(pe,2),xe=I(be);let Ue;var $t=I(xe);Rt($t,{iconId:"chevron-right",size:14}),S(xe);var Ne=A(xe,2),Ke=I(Ne,!0);S(Ne),S(be);var Xe=A(be,2);let ye;var We=I(Xe),ht=I(We);{var He=_e=>{var Be=xfe(),ut=I(Be);{var or=Pt=>{var Ar=yfe(),ur=I(Ar);S(Ar),de(()=>me(ur,`Preview unavailable: ${h(i).error??""}`)),$(Pt,Ar)},yr=Pt=>{var Ar=Cfe(),ur=Pe(Ar);{var dt=Gn=>{var re=bfe();$(Gn,re)};ne(ur,Gn=>{h(i).looksMinified&&Gn(dt)})}var Ft=A(ur,2),jn=I(Ft,!0);S(Ft);var xo=A(Ft,2);{var Es=Gn=>{var re=wfe(),Ie=I(re);S(re),de(()=>me(Ie,`Preview truncated. The full ${e.file.executable?"script will run":"file will be imported"}.`)),$(Gn,re)};ne(xo,Gn=>{h(i).truncated&&Gn(Es)})}de(()=>{ke(Ft,"aria-label",`Contents of ${e.file.originalPath??""}`),me(jn,h(i).text)}),$(Pt,Ar)};ne(ut,Pt=>{h(i).error?Pt(or):Pt(yr,-1)})}S(Be),$(_e,Be)};ne(ht,_e=>{h(i)&&_e(He)})}S(We),S(Xe),S(u),de(_e=>{d=Ct(u,1,"qa-import-file svelte-lmqem5",null,d,{overwrite:e.destinationExists}),v=Ct(m,1,"qa-import-file-status svelte-lmqem5",null,v,{overwrite:e.destinationExists}),me(g,e.destinationExists?"Will overwrite":"New file"),me(w,e.destinationPath),me(oe,_e),Fs(O,e.destinationPath),O.disabled=e.mode==="skip",se!==(se=e.mode)&&(B.value=(B.__value=e.mode)??"",fu(B,e.mode)),ke(be,"aria-expanded",h(n)),ke(be,"aria-controls",h(o)),Ue=Ct(xe,1,"qa-import-file-chevron svelte-lmqem5",null,Ue,{open:h(n)}),me(Ke,h(n)?"Hide contents":"View contents"),ye=Ct(Xe,1,"qa-import-file-preview-wrap svelte-lmqem5",null,ye,{open:h(n)}),ke(Xe,"id",h(o))},[()=>s(e.file.sizeBytes)]),De("input",O,l),De("change",B,c),De("click",be,a),$(r,u),Ce()}Et(["input","change","click"]);var _fe=W('<span class="macroCommandType svelte-1qj0pve"> </span>'),Afe=W("<code> </code>"),kfe=W('<span class="macroCommandSummary svelte-1qj0pve"> </span>'),Sfe=W('<li class="svelte-1qj0pve"><span class="macroCommandName svelte-1qj0pve"> </span> <!> <!></li>'),Dfe=W('<ul class="macroCommands svelte-1qj0pve"></ul>'),Ife={hash:"svelte-1qj0pve",code:".macroCommands.svelte-1qj0pve {list-style:none;margin:0;padding:0;display:flex;flex-direction:column;gap:0.25rem;}.macroCommands.svelte-1qj0pve li:where(.svelte-1qj0pve) {display:flex;flex-wrap:wrap;align-items:center;gap:0.4rem;font-size:var(--font-ui-smaller, 0.85rem);}.macroCommandName.svelte-1qj0pve {font-weight:500;}.macroCommandType.svelte-1qj0pve {color:var(--text-muted);font-size:0.72rem;}.macroCommandSummary.svelte-1qj0pve {color:var(--text-muted);}"};function CO(r,e){ot(r,Ife);let t={UserScript:"User script",Conditional:"Conditional",NestedChoice:"Nested choice",Obsidian:"Obsidian command",Choice:"Choice",Wait:"Wait",EditorCommand:"Editor command",AIAssistant:"AI assistant",OpenFile:"Open file"};function n(o){return t[o]??o}var i=Dfe();ar(i,21,()=>e.commands,$v,(o,s)=>{var a=Sfe(),l=I(a),c=I(l,!0);S(l);var u=A(l,2);{var d=g=>{Fx(g,{get flag(){return h(s).flag}})},f=g=>{var y=_fe(),w=I(y,!0);S(y),de(x=>me(w,x),[()=>n(h(s).type)]),$(g,y)};ne(u,g=>{h(s).flag?g(d):g(f,-1)})}var p=A(u,2);{var m=g=>{var y=Afe(),w=I(y,!0);S(y),de(()=>me(w,h(s).scriptPath)),$(g,y)},v=g=>{var y=kfe(),w=I(y,!0);S(y),de(()=>me(w,h(s).summary)),$(g,y)};ne(p,g=>{h(s).scriptPath?g(m):h(s).summary&&g(v,1)})}S(a),de(()=>{Gf(a,`padding-left:${h(s).depth*1}rem`),me(c,h(s).name)}),$(o,a)}),S(i),$(r,i)}var xO=require("obsidian");xc();function x4(r,e){return r==="skip"?r:e&&r==="write"?"overwrite":!e&&r==="overwrite"?"write":r}function EO(r,e){return!e&&r==="overwrite"?"import":r}function E4(r,e,t){let n=e(r),i=r.exists||t(n);return{mode:i?"overwrite":"write",destinationPath:n,destinationExists:i}}function T4(r,e){let t=e(r);return{mode:t?"overwrite":"write",destinationPath:r,destinationExists:t}}function _4(r,e,t){let n=new Map;for(let i of r)n.set(i.originalPath,E4(i,e,t));return n}function A4(r,e,t,n){return r.get(e.originalPath)??E4(e,t,n)}function k4(r){let e=new Map;for(let t of r)e.set(t.choiceId,t.exists?"overwrite":"import");return e}function S4(r,e,t){let n=new Map(r);return n.set(e,t),n}function D4(r,e,t,n){let i=r.get(e)??T4(e,n),o=new Map(r);return o.set(e,{...i,mode:t}),o}function I4(r,e,t,n){let i=r.get(e)??T4(e,n),o=t.trim(),s=o||e,a=o||t,l=n(s),c=new Map(r);return c.set(e,{...i,mode:x4(i.mode,l),destinationPath:a,destinationExists:l}),{decisions:c,effectivePath:s}}function P4(r,e,t){let n=r.get(e);if(!n||n.destinationExists===t)return r;let i=new Map(r);return i.set(e,{...n,destinationExists:t,mode:x4(n.mode,t)}),i}function F4(r,e){return r.map(t=>({choiceId:t.choiceId,mode:EO(e.get(t.choiceId)??"import",t.exists)}))}function M4(r,e,t){return r.map(n=>{let i=e.get(n.originalPath),o=i?.destinationPath?.trim()||n.originalPath,s=i?.destinationExists??(n.exists||t(o)),a=i?.mode??(s?"overwrite":"write");return{originalPath:n.originalPath,destinationPath:o,mode:a}})}var _S=class{constructor(e){this.app=e;this.tokens=new Map}optimistic(e){let t=e.trim();return!t||Vn(t)?!1:!!this.app.vault.getAbstractFileByPath((0,xO.normalizePath)(t))}async resolve(e){let t=e.trim();if(!t||Vn(t))return!1;try{return await this.app.vault.adapter.exists((0,xO.normalizePath)(t))}catch{return!1}}schedule(e,t,n){let i=(this.tokens.get(e)??0)+1;this.tokens.set(e,i),this.resolve(t).then(o=>{this.tokens.get(e)===i&&n(o)})}};var Pfe=W('<div class="errorMessage svelte-1nd6fqb"> </div>'),Ffe=W('<div class="info svelte-1nd6fqb">Analyzing package\u2026</div>'),Mfe=W('<p class="svelte-1nd6fqb">No choices found in this package.</p>'),Rfe=W('<div class="choiceExists svelte-1nd6fqb">already in vault</div>'),$fe=W('<button type="button" class="macroToggle svelte-1nd6fqb"> </button>'),Ofe=W('<option class="svelte-1nd6fqb">Overwrite</option>'),Nfe=W('<tr class="macroRow svelte-1nd6fqb"><td colspan="3" class="svelte-1nd6fqb"><!></td></tr>'),Lfe=W('<tr class="svelte-1nd6fqb"><td data-label="Name" class="svelte-1nd6fqb"><div class="choiceName svelte-1nd6fqb"> </div> <!> <!></td><td data-label="Location" class="svelte-1nd6fqb"> </td><td data-label="Action" class="svelte-1nd6fqb"><select class="dropdown svelte-1nd6fqb"><option class="svelte-1nd6fqb">Import</option><!><option class="svelte-1nd6fqb">Duplicate</option><option class="svelte-1nd6fqb">Skip</option></select></td></tr> <!>',1),Bfe=W('<table class="svelte-1nd6fqb"><colgroup class="svelte-1nd6fqb"><col class="colName svelte-1nd6fqb"/><col class="colLocation svelte-1nd6fqb"/><col class="colAction svelte-1nd6fqb"/></colgroup><thead class="svelte-1nd6fqb"><tr class="svelte-1nd6fqb"><th class="svelte-1nd6fqb">Name</th><th class="svelte-1nd6fqb">Location</th><th class="svelte-1nd6fqb">Action</th></tr></thead><tbody class="svelte-1nd6fqb"></tbody></table>'),Ufe=W('<p class="svelte-1nd6fqb">No files bundled with this package.</p>'),Vfe=W('<h4 class="filesGroupHeading svelte-1nd6fqb"> </h4> <div class="fileRows svelte-1nd6fqb"></div>',1),qfe=W('<h4 class="filesGroupHeading overwrite svelte-1nd6fqb"> </h4> <div class="fileRows svelte-1nd6fqb"></div>',1),Wfe=W("<!> <!>",1),zfe=W('<li><code class="svelte-1nd6fqb"> </code> <span class="warnLoc svelte-1nd6fqb"> </span></li>'),Hfe=W('<div class="warnItem svelte-1nd6fqb"><h4 class="svelte-1nd6fqb">Missing files</h4> <ul class="svelte-1nd6fqb"></ul></div>'),jfe=W(`<li class="svelte-1nd6fqb"><code class="svelte-1nd6fqb"> </code>: bundled but not
|
||
used by any choice</li>`),Gfe=W('<div class="warnItem svelte-1nd6fqb"><h4 class="svelte-1nd6fqb">Unreferenced files</h4> <ul class="svelte-1nd6fqb"></ul></div>'),Yfe=W('<section class="warningsBand svelte-1nd6fqb"><!> <!></section>'),Kfe=W('<section class="filesSection svelte-1nd6fqb"><h3 class="svelte-1nd6fqb">Files</h3> <!></section> <!>',1),Qfe=W('<section class="summary svelte-1nd6fqb"><!> <span class="svelte-1nd6fqb"> </span></section>'),Xfe=W('<section class="packageMeta svelte-1nd6fqb"><span class="svelte-1nd6fqb"><span class="metaLabel svelte-1nd6fqb">Version</span> </span> <span class="metaSep svelte-1nd6fqb" aria-hidden="true">\xB7</span> <span class="svelte-1nd6fqb"><span class="metaLabel svelte-1nd6fqb">Created</span> </span> <span class="metaSep svelte-1nd6fqb" aria-hidden="true">\xB7</span> <span class="svelte-1nd6fqb"> </span> <span class="metaSep svelte-1nd6fqb" aria-hidden="true">\xB7</span> <span class="svelte-1nd6fqb"> </span></section> <!> <section class="choicesSection svelte-1nd6fqb"><h3 class="svelte-1nd6fqb">Choices</h3> <!></section> <!> <!>',1),Zfe=W('<p id="qa-import-ack-hint" class="ackGate-hint svelte-1nd6fqb"> </p>'),Jfe=W('<section><label class="ackGate-label svelte-1nd6fqb"><input id="qa-import-ack-checkbox" type="checkbox" class="svelte-1nd6fqb"/> <span class="svelte-1nd6fqb"> </span></label> <!></section>'),eme=W('<div class="importPackageModal svelte-1nd6fqb"><header class="svelte-1nd6fqb"><h2 class="svelte-1nd6fqb">Import QuickAdd package</h2> <p class="svelte-1nd6fqb">Review what this package adds and runs before importing.</p></header> <section class="pasteSection svelte-1nd6fqb"><label class="svelte-1nd6fqb"><span class="svelte-1nd6fqb">Paste package JSON</span> <textarea placeholder="Paste the contents of a .quickadd.json package here" rows="8" class="svelte-1nd6fqb"></textarea></label> <!></section> <!> <!> <section class="footer svelte-1nd6fqb"><button type="button" class="secondary svelte-1nd6fqb">Cancel</button> <button type="button" class="primary svelte-1nd6fqb"><!></button></section></div>'),tme={hash:"svelte-1nd6fqb",code:`.importPackageModal.svelte-1nd6fqb {display:flex;flex-direction:column;gap:1rem;width:min(720px, 100%);max-height:80vh;overflow-y:auto;
|
||
/* overflow-x:hidden (paired with overflow-y:auto) clips child focus rings
|
||
at the flush left/right edges; the inline padding gives the ring room. */overflow-x:hidden;box-sizing:border-box;padding:2px 4px;}.importPackageModal.svelte-1nd6fqb :where(.svelte-1nd6fqb) {box-sizing:border-box;}.importPackageModal.svelte-1nd6fqb > section:where(.svelte-1nd6fqb) {max-width:100%;}.pasteSection.svelte-1nd6fqb label:where(.svelte-1nd6fqb) {display:flex;flex-direction:column;gap:0.5rem;}.pasteSection.svelte-1nd6fqb textarea:where(.svelte-1nd6fqb) {width:100%;font-family:var(--font-monospace);resize:vertical;}.errorMessage.svelte-1nd6fqb {color:var(--text-error);}.info.svelte-1nd6fqb {color:var(--text-muted);}
|
||
|
||
/* A single compact line that sizes to content and wraps naturally, instead
|
||
of a 4-equal-column grid where the date wraps to 3 lines and the rest
|
||
leave dead space. */.packageMeta.svelte-1nd6fqb {display:flex;flex-wrap:wrap;align-items:baseline;gap:0.3rem 0.6rem;padding:0.55rem 0.75rem;border:1px solid var(--background-modifier-border);border-radius:var(--radius-m, 8px);width:100%;font-size:var(--font-ui-small, 0.9rem);overflow-wrap:anywhere;}.metaLabel.svelte-1nd6fqb {color:var(--text-muted);}.metaSep.svelte-1nd6fqb {color:var(--text-faint);}.choicesSection.svelte-1nd6fqb,
|
||
.filesSection.svelte-1nd6fqb {display:flex;flex-direction:column;gap:0.75rem;}.filesGroupHeading.svelte-1nd6fqb {margin:0;font-size:var(--font-ui-small, 0.9rem);font-weight:600;color:var(--text-muted);}.filesGroupHeading.overwrite.svelte-1nd6fqb {color:var(--text-error);}.fileRows.svelte-1nd6fqb {display:flex;flex-direction:column;gap:0.5rem;}.choiceName.svelte-1nd6fqb {font-weight:500;}
|
||
|
||
/* A plain inline text link, not a chrome button: neutralise Obsidian's
|
||
default button background/shadow on every state (!important to win over
|
||
the global button:hover / :focus rules that paint the grey box). */.macroToggle.svelte-1nd6fqb {display:inline-block;margin-top:0.35rem;padding:0;background:transparent !important;border:none;box-shadow:none !important;color:var(--text-accent);cursor:pointer;font-size:var(--font-ui-smaller, 0.8rem);border-radius:var(--radius-s, 4px);}.macroToggle.svelte-1nd6fqb:hover {color:var(--interactive-accent-hover, var(--text-accent));text-decoration:underline;}.macroToggle.svelte-1nd6fqb:focus-visible {outline:2px solid var(--interactive-accent);outline-offset:2px;}.macroRow.svelte-1nd6fqb td:where(.svelte-1nd6fqb) {background:var(--background-primary-alt, var(--background-secondary));}.warningsBand.svelte-1nd6fqb {display:flex;flex-direction:column;border:1px solid var(--background-modifier-border);border-radius:var(--radius-m, 8px);padding:0.6rem 0.75rem;gap:0.5rem;}.warnItem.svelte-1nd6fqb h4:where(.svelte-1nd6fqb) {margin:0;font-size:var(--font-ui-small, 0.9rem);}.warnItem.svelte-1nd6fqb ul:where(.svelte-1nd6fqb) {margin:0.25rem 0 0;padding-left:1rem;}.warnItem.svelte-1nd6fqb li:where(.svelte-1nd6fqb) {overflow-wrap:anywhere;}
|
||
|
||
/* A missing SCRIPT reference is an execution-hijack risk, not a broken
|
||
link: it runs from whatever exists at that path. Mark it as critical. */.warnItem.svelte-1nd6fqb li.script:where(.svelte-1nd6fqb) {padding:0.25rem 0.4rem;border-radius:var(--radius-s, 4px);background:var(--qa-sev-critical-wash);}.warnLoc.svelte-1nd6fqb {color:var(--text-muted);font-size:var(--font-ui-smaller, 0.8rem);}.choicesSection.svelte-1nd6fqb table:where(.svelte-1nd6fqb) {width:100%;border-collapse:collapse;table-layout:fixed;}.choicesSection.svelte-1nd6fqb col.colName:where(.svelte-1nd6fqb) {width:52%;}.choicesSection.svelte-1nd6fqb col.colLocation:where(.svelte-1nd6fqb) {width:26%;}.choicesSection.svelte-1nd6fqb col.colAction:where(.svelte-1nd6fqb) {width:22%;}.choicesSection.svelte-1nd6fqb th:where(.svelte-1nd6fqb),
|
||
.choicesSection.svelte-1nd6fqb td:where(.svelte-1nd6fqb) {padding:0.5rem;border-bottom:1px solid var(--background-modifier-border);text-align:left;word-break:break-word;overflow-wrap:anywhere;white-space:normal;vertical-align:top;}.choicesSection.svelte-1nd6fqb th:where(.svelte-1nd6fqb) {font-size:var(--font-ui-smaller, 0.8rem);color:var(--text-muted);font-weight:600;}.choiceExists.svelte-1nd6fqb {font-size:var(--font-ui-smaller, 0.8rem);color:var(--text-muted);margin-top:0.1rem;}.choicesSection.svelte-1nd6fqb tbody:where(.svelte-1nd6fqb) tr:where(.svelte-1nd6fqb):not(.macroRow):hover td:where(.svelte-1nd6fqb) {background:var(--background-modifier-hover);}.choicesSection.svelte-1nd6fqb select:where(.svelte-1nd6fqb) {max-width:100%;}
|
||
|
||
/* Narrow viewports (mobile): a 3-column table can't breathe, so each row
|
||
becomes a stacked card with the column name as an inline label. */
|
||
@media (max-width: 500px) {.choicesSection.svelte-1nd6fqb thead:where(.svelte-1nd6fqb) {display:none;}.choicesSection.svelte-1nd6fqb table:where(.svelte-1nd6fqb),
|
||
.choicesSection.svelte-1nd6fqb tbody:where(.svelte-1nd6fqb),
|
||
.choicesSection.svelte-1nd6fqb tr:where(.svelte-1nd6fqb),
|
||
.choicesSection.svelte-1nd6fqb td:where(.svelte-1nd6fqb) {display:block;width:100%;}.choicesSection.svelte-1nd6fqb tbody:where(.svelte-1nd6fqb) tr:where(.svelte-1nd6fqb):not(.macroRow) {border:1px solid var(--background-modifier-border);border-radius:var(--radius-m, 8px);padding:0.5rem 0.6rem;margin-bottom:0.5rem;}.choicesSection.svelte-1nd6fqb td:where(.svelte-1nd6fqb) {border-bottom:none;padding:0.15rem 0;}.choicesSection.svelte-1nd6fqb td[data-label="Location"]:where(.svelte-1nd6fqb)::before,
|
||
.choicesSection.svelte-1nd6fqb td[data-label="Action"]:where(.svelte-1nd6fqb)::before {content:attr(data-label) ": ";font-weight:600;color:var(--text-muted);}.choicesSection.svelte-1nd6fqb td[data-label="Action"]:where(.svelte-1nd6fqb) {display:flex;align-items:center;gap:0.4rem;margin-top:0.25rem;}.choicesSection.svelte-1nd6fqb td[data-label="Action"]:where(.svelte-1nd6fqb) select:where(.svelte-1nd6fqb) {flex:1;}.macroRow.svelte-1nd6fqb td:where(.svelte-1nd6fqb) {padding:0.25rem 0;}
|
||
}.summary.svelte-1nd6fqb {display:flex;align-items:center;gap:0.5rem;padding:0.55rem 0.7rem;border-radius:var(--radius-m, 8px);border:1px solid var(--qa-sev-success-border);background:var(--qa-sev-success-wash);color:var(--text-normal);}.summary.svelte-1nd6fqb .quickadd-icon {color:var(--text-success, var(--color-green, #0aa344));flex-shrink:0;}.ackGate.svelte-1nd6fqb {display:flex;flex-direction:column;gap:0.4rem;padding:0.75rem;border:1px solid var(--background-modifier-border);border-radius:var(--radius-m, 8px);background:var(--background-secondary);}.ackGate.critical.svelte-1nd6fqb {border-color:var(--qa-sev-critical-border);}.ackGate-label.svelte-1nd6fqb {display:flex;align-items:flex-start;gap:0.5rem;font-weight:600;cursor:pointer;}.ackGate-label.svelte-1nd6fqb:has(input:where(.svelte-1nd6fqb):disabled) {cursor:not-allowed;opacity:0.6;}.ackGate-label.svelte-1nd6fqb input:where(.svelte-1nd6fqb) {margin-top:0.2rem;flex-shrink:0;}.ackGate-label.svelte-1nd6fqb input:where(.svelte-1nd6fqb):focus-visible {outline:2px solid var(--interactive-accent);outline-offset:2px;}.ackGate-hint.svelte-1nd6fqb {margin:0;font-size:var(--font-ui-smaller, 0.8rem);color:var(--text-muted);}.footer.svelte-1nd6fqb {display:flex;justify-content:flex-end;gap:0.5rem;margin-top:0.5rem;}.footer.svelte-1nd6fqb .primary:where(.svelte-1nd6fqb) {background:var(--interactive-accent);color:var(--text-on-accent);}.footer.svelte-1nd6fqb .primary:where(.svelte-1nd6fqb):hover:not(:disabled) {background:var(--interactive-accent-hover);}.footer.svelte-1nd6fqb .primary:where(.svelte-1nd6fqb):active:not(:disabled),
|
||
.footer.svelte-1nd6fqb .secondary:where(.svelte-1nd6fqb):active:not(:disabled) {transform:translateY(1px);}.footer.svelte-1nd6fqb .secondary:where(.svelte-1nd6fqb) {background:transparent;}.footer.svelte-1nd6fqb .secondary:where(.svelte-1nd6fqb):hover:not(:disabled) {background:var(--background-modifier-hover);}.footer.svelte-1nd6fqb .secondary:where(.svelte-1nd6fqb):focus-visible {outline:2px solid var(--interactive-accent);outline-offset:2px;}
|
||
|
||
/* Accent background needs a light outline to stay visible. */.footer.svelte-1nd6fqb .primary:where(.svelte-1nd6fqb):focus-visible {outline:2px solid var(--text-on-accent);outline-offset:-4px;}.is-mobile .macroToggle.svelte-1nd6fqb {min-height:36px;padding:0.4rem 0.3rem;}
|
||
|
||
@media (prefers-reduced-motion: reduce) {.footer.svelte-1nd6fqb .primary:where(.svelte-1nd6fqb),
|
||
.footer.svelte-1nd6fqb .secondary:where(.svelte-1nd6fqb) {transition:none;}.footer.svelte-1nd6fqb .primary:where(.svelte-1nd6fqb):active:not(:disabled),
|
||
.footer.svelte-1nd6fqb .secondary:where(.svelte-1nd6fqb):active:not(:disabled) {transform:none;}
|
||
}`};function TO(r,e){we(e,!0),ot(r,tme);let t;function n(){return t??(t=new _S(e.app))}let i=Ae(null),o=Ae(null),s=Ae(null),a=Ae(!1),l=Ae(wt(new Set)),c=Ae(wt(new Set)),u=Ae(null),d=Ae(!1),f=Ae(null),p=Ae(wt(new Map)),m=Ae(wt(new Map)),v=Ae(""),g=Ae(!1),y=Ae(0),w=Ae(!1),x=N(()=>h(s)?f4(h(s)):!1),C=N(()=>h(s)?m4(h(s),h(l)):!0),_=N(()=>new Map((h(s)?.choices??[]).map(re=>[re.choiceId,re]))),E=N(()=>new Map((h(s)?.files??[]).map(re=>[re.originalPath,re]))),D=N(()=>!!(h(s)&&(h(s).summary.hasCritical||h(s).summary.hasWarning))),P=N(()=>!!(h(i)&&h(o))&&!h(g)&&(!h(x)||h(a)&&h(C))),H=N(()=>h(s)?.criticalScriptPaths.length??0),V=N(()=>h(s)?.missingReferences.some(re=>re.asScript)??!1),oe=N(()=>{let re=h(f);if(!re)return"";let Ie=[];re.added&&Ie.push(`${re.added} choice${re.added===1?"":"s"} added`),re.overwritten&&Ie.push(`${re.overwritten} overwritten`),re.assetsWritten&&Ie.push(`${re.assetsWritten} file${re.assetsWritten===1?"":"s"} written`);let dr=re.skipped+re.assetsSkipped;return dr&&Ie.push(`${dr} skipped`),Ie.length?`Imported: ${Ie.join(", ")}.`:"Nothing was imported."}),ce=N(()=>h(H)>0?h(V)?"I have reviewed each bundled script above and trust the source, including scripts that are not included and cannot be shown.":"I have reviewed each script above and trust the source.":h(V)?"This package runs scripts that are not included and cannot be reviewed. I trust the source.":"I understand this package can run code, and I trust the source.");function R(re){if(h(l).has(re))return;let Ie=new Set(h(l));Ie.add(re),Z(l,Ie,!0)}function O(re){let Ie=new Set(h(c));Ie.has(re)?Ie.delete(re):Ie.add(re),Z(c,Ie,!0)}let q=re=>n().optimistic(re),B=N(()=>(h(o)?.assetConflicts??[]).map(re=>({conflict:re,state:A4(h(m),re,Y,q),file:h(E).get(re.originalPath)}))),ie=N(()=>h(B).filter(re=>!re.state.destinationExists)),j=N(()=>h(B).filter(re=>re.state.destinationExists));function Y(re){let[Ie]=Wi(le.getState().templateFolderPaths),dr=re.kind==="template"||re.kind==="capture-template";if(Ie&&dr){let br=re.originalPath.split("/").pop()??re.originalPath;return`${Ie}/${br}`}return re.originalPath}function K(re,Ie){n().schedule(re,Ie,dr=>{Z(m,P4(h(m),re,dr),!0)})}function se(){if(!h(o)){Z(p,new Map,!0),Z(m,new Map,!0);return}Z(p,k4(h(o).choiceConflicts),!0),Z(m,_4(h(o).assetConflicts,Y,q),!0);for(let re of h(o).assetConflicts){let Ie=h(m).get(re.originalPath);Ie&&K(re.originalPath,Ie.destinationPath)}}function pe(re,Ie){Z(p,S4(h(p),re,Ie),!0)}function ge(re,Ie){Z(m,D4(h(m),re,Ie,q),!0)}function be(re,Ie){let{decisions:dr,effectivePath:br}=I4(h(m),re.originalPath,Ie,q);Z(m,dr,!0),K(re.originalPath,br)}function xe(re,Ie){let br=Ie.currentTarget.value;pe(re,br)}function Ue(){Z(s,null),Z(a,!1),Z(l,new Set,!0),Z(c,new Set,!0)}async function $t(re){let Ie=re.trim(),dr=OI(y);if(Z(f,null),Z(w,!1),!Ie){Z(i,null),Z(o,null),Z(p,new Map,!0),Z(m,new Map,!0),Ue(),Z(u,null);return}Z(g,!0);try{let br=vO(Ie),_n=le.getState().choices,Ho=await g4(e.app,_n,br),Qa=await xS(e.app,_n,br);if(dr!==h(y))return;Z(i,{pkg:br,path:"[pasted]"},!0),Z(o,Ho,!0),Ue(),Z(s,Qa,!0),Z(u,null),se()}catch(br){if(dr!==h(y))return;Z(u,br?.message??String(br),!0),Z(i,null),Z(o,null),Z(p,new Map,!0),Z(m,new Map,!0),Ue()}finally{dr===h(y)&&Z(g,!1)}}function Ne(re){let Ie=re.currentTarget.value;Z(v,Ie,!0),$t(Ie)}function Ke(re){return!re||re.length===0?"Root":re.slice(0,-1).join(" \u203A ")||"Root"}async function Xe(){if(h(w)){new Mx.Notice("This package has already been imported.");return}if(!h(i)||!h(o)){new Mx.Notice("Load a package before importing.");return}Z(d,!0),Z(f,null);try{let re=await v4({app:e.app,existingChoices:le.getState().choices,aiProviders:le.getState().ai.providers,pkg:h(i).pkg,choiceDecisions:F4(h(o).choiceConflicts,h(p)),assetDecisions:M4(h(o).assetConflicts,h(m),q)});le.setState(Ie=>({...Ie,choices:re.updatedChoices})),Z(f,{added:re.addedChoiceIds.length,overwritten:re.overwrittenChoiceIds.length,skipped:re.skippedChoiceIds.length,assetsWritten:re.writtenAssets.length,assetsSkipped:re.skippedAssets.length},!0),Z(w,!0),new Mx.Notice(`Imported ${re.addedChoiceIds.length+re.overwrittenChoiceIds.length} choice${re.addedChoiceIds.length+re.overwrittenChoiceIds.length===1?"":"s"} successfully.`)}catch(re){console.error(re),new Mx.Notice(`Import failed: ${re?.message??re}`)}finally{Z(d,!1)}}var ye=eme(),We=A(I(ye),2),ht=I(We),He=A(I(ht),2);Ad(He),S(ht);var _e=A(ht,2);{var Be=re=>{var Ie=Pfe(),dr=I(Ie,!0);S(Ie),de(()=>me(dr,h(u))),$(re,Ie)},ut=re=>{var Ie=Ffe();$(re,Ie)};ne(_e,re=>{h(u)?re(Be):h(g)&&re(ut,1)})}S(We);var or=A(We,2);{var yr=re=>{var Ie=Xfe(),dr=Pe(Ie),br=I(dr),_n=A(I(br));S(br);var Ho=A(br,4),Qa=A(I(Ho));S(Ho);var Xa=A(Ho,4),Jc=I(Xa);S(Xa);var T=A(Xa,4),k=I(T);S(T),S(dr);var L=A(dr,2);{var Q=bt=>{wO(bt,{get preview(){return h(s)}})};ne(L,bt=>{h(D)&&h(s)&&bt(Q)})}var J=A(L,2),ue=A(I(J),2);{var ve=bt=>{var pr=Mfe();$(bt,pr)},Ve=bt=>{var pr=Bfe(),kr=A(I(pr),2);ar(kr,21,()=>h(o).choiceConflicts,Yn=>Yn.choiceId,(Yn,kt)=>{let Eo=N(()=>EO(h(p).get(h(kt).choiceId)??"import",h(kt).exists)),da=N(()=>h(_).get(h(kt).choiceId)),Ts=N(()=>(h(da)?.commands?.length??0)>0);var cn=Lfe(),An=Pe(cn),Hl=I(An),bd=I(Hl),nv=I(bd,!0);S(bd);var Cf=A(bd,2);{var fi=Sn=>{var io=Rfe();$(Sn,io)};ne(Cf,Sn=>{h(kt).exists&&Sn(fi)})}var eo=A(Cf,2);{var to=Sn=>{var io=$fe(),DE=I(io,!0);S(io),de((iI,oI)=>{ke(io,"aria-expanded",iI),me(DE,oI)},[()=>h(c).has(h(kt).choiceId),()=>h(c).has(h(kt).choiceId)?"Hide macro":"Show macro"]),De("click",io,()=>O(h(kt).choiceId)),$(Sn,io)};ne(eo,Sn=>{h(Ts)&&Sn(to)})}S(Hl);var ro=A(Hl),To=I(ro,!0);S(ro);var kn=A(ro),Gt=I(kn),no=I(Gt);no.value=no.__value="import";var eu=A(no);{var tu=Sn=>{var io=Ofe();io.value=io.__value="overwrite",$(Sn,io)};ne(eu,Sn=>{h(kt).exists&&Sn(tu)})}var _o=A(eu);_o.value=_o.__value="duplicate";var ru=A(_o);ru.value=ru.__value="skip",S(Gt);var Za;Vd(Gt),S(kn),S(An);var N7=A(An,2);{var L7=Sn=>{var io=Nfe(),DE=I(io),iI=I(DE);{let oI=N(()=>h(da)?.commands??[]);CO(iI,{get commands(){return h(oI)}})}S(DE),S(io),$(Sn,io)},B7=N(()=>h(Ts)&&h(c).has(h(kt).choiceId));ne(N7,Sn=>{h(B7)&&Sn(L7)})}de(Sn=>{me(nv,h(kt).name),me(To,Sn),Za!==(Za=h(Eo))&&(Gt.value=(Gt.__value=h(Eo))??"",fu(Gt,h(Eo)))},[()=>Ke(h(kt).pathHint)]),De("change",Gt,Sn=>xe(h(kt).choiceId,Sn)),$(Yn,cn)}),S(kr),S(pr),$(bt,pr)};ne(ue,bt=>{h(o).choiceConflicts.length===0?bt(ve):bt(Ve,-1)})}S(J);var yt=A(J,2);{var Pr=bt=>{var pr=Kfe(),kr=Pe(pr),Yn=A(I(kr),2);{var kt=cn=>{var An=Ufe();$(cn,An)},Eo=cn=>{var An=Wfe(),Hl=Pe(An);{var bd=fi=>{var eo=Vfe(),to=Pe(eo),ro=I(to);S(to);var To=A(to,2);ar(To,21,()=>h(ie),kn=>kn.conflict.originalPath,(kn,Gt)=>{var no=dn(),eu=Pe(no);{var tu=_o=>{{let ru=N(()=>h(l).has(h(Gt).file.originalPath));TS(_o,{get file(){return h(Gt).file},get pkg(){return h(i).pkg},get mode(){return h(Gt).state.mode},get destinationPath(){return h(Gt).state.destinationPath},get destinationExists(){return h(Gt).state.destinationExists},onPathInput:Za=>be(h(Gt).conflict,Za),onModeChange:Za=>ge(h(Gt).conflict.originalPath,Za),get reviewed(){return h(ru)},onReviewed:R})}};ne(eu,_o=>{h(Gt).file&&_o(tu)})}$(kn,no)}),S(To),de(()=>me(ro,`Added (${h(ie).length??""})`)),$(fi,eo)};ne(Hl,fi=>{h(ie).length>0&&fi(bd)})}var nv=A(Hl,2);{var Cf=fi=>{var eo=qfe(),to=Pe(eo),ro=I(to);S(to);var To=A(to,2);ar(To,21,()=>h(j),kn=>kn.conflict.originalPath,(kn,Gt)=>{var no=dn(),eu=Pe(no);{var tu=_o=>{{let ru=N(()=>h(l).has(h(Gt).file.originalPath));TS(_o,{get file(){return h(Gt).file},get pkg(){return h(i).pkg},get mode(){return h(Gt).state.mode},get destinationPath(){return h(Gt).state.destinationPath},get destinationExists(){return h(Gt).state.destinationExists},onPathInput:Za=>be(h(Gt).conflict,Za),onModeChange:Za=>ge(h(Gt).conflict.originalPath,Za),get reviewed(){return h(ru)},onReviewed:R})}};ne(eu,_o=>{h(Gt).file&&_o(tu)})}$(kn,no)}),S(To),de(()=>me(ro,`Will overwrite (${h(j).length??""})`)),$(fi,eo)};ne(nv,fi=>{h(j).length>0&&fi(Cf)})}$(cn,An)};ne(Yn,cn=>{h(B).length===0?cn(kt):cn(Eo,-1)})}S(kr);var da=A(kr,2);{var Ts=cn=>{var An=Yfe(),Hl=I(An);{var bd=fi=>{var eo=Hfe(),to=A(I(eo),2);ar(to,21,()=>h(s).missingReferences,ro=>ro.path,(ro,To)=>{var kn=zfe();let Gt;var no=I(kn),eu=I(no,!0);S(no);var tu=A(no),_o=A(tu),ru=I(_o,!0);S(_o),S(kn),de(()=>{Gt=Ct(kn,1,"svelte-1nd6fqb",null,Gt,{script:h(To).asScript}),me(eu,h(To).path),me(tu,`:
|
||
${h(To).asScript?"not bundled, so it runs from whatever file exists at that path after import":"not bundled and not in your vault"} `),me(ru,h(To).breadcrumb)}),$(ro,kn)}),S(to),S(eo),$(fi,eo)};ne(Hl,fi=>{h(s).missingReferences.length>0&&fi(bd)})}var nv=A(Hl,2);{var Cf=fi=>{var eo=Gfe(),to=A(I(eo),2);ar(to,20,()=>h(s).orphanAssets,ro=>ro,(ro,To)=>{var kn=jfe(),Gt=I(kn),no=I(Gt,!0);S(Gt),Pn(),S(kn),de(()=>me(no,To)),$(ro,kn)}),S(to),S(eo),$(fi,eo)};ne(nv,fi=>{h(s).orphanAssets.length>0&&fi(Cf)})}S(An),$(cn,An)};ne(da,cn=>{h(s)&&(h(s).missingReferences.length>0||h(s).orphanAssets.length>0)&&cn(Ts)})}$(bt,pr)};ne(yt,bt=>{h(i)&&bt(Pr)})}var jt=A(yt,2);{var $i=bt=>{var pr=Qfe(),kr=I(pr);Rt(kr,{iconId:"check-circle",size:16});var Yn=A(kr,2),kt=I(Yn,!0);S(Yn),S(pr),de(()=>me(kt,h(oe))),$(bt,pr)};ne(jt,bt=>{h(f)&&bt($i)})}de(bt=>{me(_n,` ${h(i).pkg.quickAddVersion??""}`),me(Qa,` ${bt??""}`),me(Jc,`${h(o).choiceConflicts.length??""} choice${h(o).choiceConflicts.length===1?"":"s"}`),me(k,`${h(i).pkg.assets.length??""} file${h(i).pkg.assets.length===1?"":"s"}`)},[()=>new Date(h(i).pkg.createdAt).toLocaleDateString()]),$(re,Ie)};ne(or,re=>{h(i)&&h(o)&&re(yr)})}var Pt=A(or,2);{var Ar=re=>{var Ie=Jfe();let dr;var br=I(Ie),_n=I(br);gr(_n);var Ho=A(_n,2),Qa=I(Ho,!0);S(Ho),S(br);var Xa=A(br,2);{var Jc=T=>{var k=Zfe(),L=I(k);S(k),de(()=>me(L,`Open \u201CView contents\u201D on each of the ${h(H)??""} executable
|
||
script${h(H)===1?"":"s"} above to enable this.`)),$(T,k)};ne(Xa,T=>{h(H)>0&&!h(C)&&T(Jc)})}S(Ie),de(()=>{dr=Ct(Ie,1,"ackGate svelte-1nd6fqb",null,dr,{critical:h(s)?.summary.hasCritical}),qd(_n,h(a)),_n.disabled=!h(C),ke(_n,"aria-describedby",h(H)>0&&!h(C)?"qa-import-ack-hint":void 0),me(Qa,h(ce))}),De("change",_n,T=>Z(a,T.currentTarget.checked,!0)),$(re,Ie)};ne(Pt,re=>{h(i)&&h(x)&&!h(w)&&re(Ar)})}var ur=A(Pt,2),dt=I(ur),Ft=A(dt,2),jn=I(Ft);{var xo=re=>{var Ie=ul("Importing\u2026");$(re,Ie)},Es=re=>{var Ie=ul("Close");$(re,Ie)},Gn=re=>{var Ie=ul("Import package");$(re,Ie)};ne(jn,re=>{h(d)?re(xo):h(w)?re(Es,1):re(Gn,-1)})}S(Ft),S(ur),S(ye),de(()=>{dt.disabled=h(d),Ft.disabled=h(d)||!h(w)&&!h(P),ke(Ft,"title",!h(w)&&h(x)&&h(C)&&!h(a)?"Confirm the acknowledgement above to continue":void 0)}),De("input",He,Ne),uo(He,()=>h(v),re=>Z(v,re)),De("click",dt,function(...re){e.close?.apply(this,re)}),De("click",Ft,function(...re){(h(w)?e.close:Xe)?.apply(this,re)}),$(r,ye),Ce()}Et(["input","click","change"]);var AS=class extends R4.Modal{constructor(t){super(t);this.handle=null}onOpen(){this.modalEl.addClass("quickAddModal","packageImportModal"),this.handle=qi(this.contentEl,TO,{app:this.app,close:()=>this.close()},{what:"the package importer"})}onClose(){this.handle?.destroy(),this.handle=null}};Em();Wd();pc();function _O(r,e,t,n){let i=Hr(r,"div"),o=Hr(r,"strong");return o.textContent=e,i.appendChild(o),i.appendChild(Kv(r,` ${t}`)),n?.className&&i.classList.add(n.className),i.classList.add("qa-dev-info-row"),r.appendChild(i),i}function $4(r,e){if(e.branch!==null&&_O(r,"Branch:",e.branch),e.commit!==null&&_O(r,"Commit:",e.commit),e.dirty!==null){let t=e.dirty?"Yes (uncommitted changes)":"No",n=e.dirty?"qa-dev-dirty-status":"qa-dev-clean-status";_O(r,"Uncommitted changes:",t,{className:n})}}Wt();var AO="Bundle or import QuickAdd automations as reusable packages.",kS=class extends od.PluginSettingTab{constructor(t,n){super(t,n);this.choiceViewHandle=null;this.globalVariablesViewHandle=null;this.packagesUnsubscribe=null;this.plugin=n,this.icon="zap"}getControlValue(t){let n=le.getState();return t==="inputPrompt"?n.inputPrompt==="multi-line":n[t]}setControlValue(t,n){if(t==="inputPrompt"){le.setState({inputPrompt:n?"multi-line":"single-line"});return}if(t==="persistInputPromptDrafts"){let i=!!n;le.setState({persistInputPromptDrafts:i}),i||Gi.getInstance().clearAll();return}le.setState({[t]:n})}getSettingDefinitions(){return[this.choicesAndPackagesGroup(),this.choicePickerGroup(),this.inputGroup(),this.templatesGroup(),this.notificationsGroup(),this.globalVariablesGroup(),this.aiAndOnlineGroup(),this.appearanceGroup()]}hide(){super.hide(),this.destroySettingViews()}destroySettingViews(){this.choiceViewHandle?.destroy(),this.choiceViewHandle=null,this.globalVariablesViewHandle?.destroy(),this.globalVariablesViewHandle=null,this.packagesUnsubscribe?.(),this.packagesUnsubscribe=null}choicesAndPackagesGroup(){return{type:"group",heading:"Choices & packages",extraButtons:[t=>t.setIcon("help-circle").setTooltip("QuickAdd documentation").onClick(()=>xj(kl.gettingStarted,t.extraSettingsEl))],items:[{name:"Choices",render:t=>this.renderChoicesView(t)},{name:"Packages",desc:AO,render:t=>this.renderPackages(t)}]}}choicePickerGroup(){return{type:"group",heading:"Choice picker",items:[{name:"Search nested choices",desc:"When searching in the choice picker, also match choices nested inside folders and show their path. Note that nested matches can outrank same-level ones. Disable to search only the open level.",control:{type:"toggle",key:"searchNestedChoices"}},{name:"\u201CNew note from template\u201D in the launcher",desc:"Add a row to Run QuickAdd that lists templates from your configured template folder, so you can create a note from a template without a dedicated Template choice. Only appears when a template folder is configured; the command palette entry works regardless.",control:{type:"dropdown",key:"templateFolderLauncherRow",defaultValue:"bottom",options:{bottom:"Show at the bottom (keeps your top choice first)",top:"Show at the top",off:"Hide"}}}]}}inputGroup(){return{type:"group",heading:"Input",items:[{name:"Use multi-line input prompt",desc:"Use multi-line input prompt instead of single-line input prompt. Submit multi-line prompts with Ctrl/Cmd+Enter; Enter inserts a newline.",control:{type:"toggle",key:"inputPrompt"}},{name:"Persist input prompt drafts",desc:"Keep drafts when closing input prompts so they can be restored on reopen. Drafts are stored only for this session.",control:{type:"toggle",key:"persistInputPromptDrafts"}},{name:"Use editor selection as default Capture value",desc:"When enabled, Capture uses the current editor selection as {{VALUE}} and may skip the prompt. When disabled, Capture always prompts for {{VALUE}}.",control:{type:"toggle",key:"useSelectionAsCaptureValue"}},{name:"One-page input for choices",desc:this.descWithDocsLink("Collect a choice's inputs in one form before it runs, instead of one prompt at a time. Works with Template and Capture choices, and with Macros whose scripts declare inputs. Template and Capture choices can override this individually. ",kl.onePageInputs,"Learn more about one-page inputs"),control:{type:"toggle",key:"onePageInputEnabled"}},{name:"Date aliases",desc:"Shortcodes for natural language date parsing. One per line: alias = phrase. Example: tm = tomorrow.",render:t=>this.renderDateAliases(t)}]}}templatesGroup(){return{type:"group",heading:"Templates & properties",items:[{name:"Template folder paths",desc:"Folders where templates are stored. Used to suggest template files when configuring QuickAdd. Add as many as you like; leave empty to suggest every template file in the vault.",render:t=>this.renderTemplateFolderPaths(t)},{name:"Convert string front matter variables to typed properties (Beta)",desc:'List/object values from scripts are always written as proper Obsidian properties (a list becomes a List). This toggle additionally converts string values into typed properties: a comma or bullet-list string becomes a List, "42" becomes a Number, "true" becomes a Checkbox, etc. Disabled by default; the string conversion is a beta heuristic that may have edge cases.',control:{type:"toggle",key:"enableTemplatePropertyTypes"}}]}}notificationsGroup(){return{type:"group",heading:"Notifications",items:[{name:"Announce updates",desc:"Display release notes when a new version is installed. This includes new features, demo videos, and bug fixes.",control:{type:"dropdown",key:"announceUpdates",defaultValue:"major",options:{all:"Show updates on each new release",major:"Show updates only on major releases (new features, breaking changes)",none:"Don't show"}}},{name:"Show capture notifications",desc:"Display a notification when content is captured successfully to confirm the operation completed.",control:{type:"toggle",key:"showCaptureNotification"}},{name:"Show input cancellation notifications",desc:"Display a notification when an input prompt is cancelled without submitting. Disable this to avoid extra notices when dismissing prompts.",control:{type:"toggle",key:"showInputCancellationNotification"}}]}}globalVariablesGroup(){return{type:"group",heading:"Global variables",items:[{name:"Global variables",render:t=>this.renderGlobalVariablesView(t)}]}}aiAndOnlineGroup(){return{type:"group",heading:"AI & online",items:[{name:"Disable AI & online features",desc:"This prevents the plugin from making requests to external providers like OpenAI. You can still use user scripts to execute arbitrary code, including contacting external providers. However, this setting disables plugin features like the AI Assistant from doing so. You need to disable this setting to use the AI Assistant.",control:{type:"toggle",key:"disableOnlineFeatures"}},{name:"Allow URI x-callback-url",desc:"When on, an obsidian://quickadd URI may open a callback URL (x-success / x-error / x-cancel) after a Template or Capture choice finishes \u2014 sending the outcome and the affected note's vault path and URL to that callback. While on, a URI that carries x-* callback params is restricted to Template and Capture choices (other choice types are warned and skipped). Off by default because the callback URL is set by whoever creates the obsidian:// link. Only shortcuts: and obsidian: callback URLs are permitted.",control:{type:"toggle",key:"enableUriCallbacks"}}]}}appearanceGroup(){return{type:"group",heading:"Appearance",items:[{name:"Show icon in sidebar",desc:"Add QuickAdd icon to the sidebar ribbon. Requires a reload.",control:{type:"toggle",key:"enableRibbonIcon"}}]}}developerGroup(){return{type:"group",heading:"Developer",items:[{name:"Development information",desc:"Git information for developers.",render:t=>this.renderDevInfo(t)}]}}descWithDocsLink(t,n,i="Learn more"){let o=document.createDocumentFragment();return o.append(document.createTextNode(t)),NA(o,n,i),o}prepareFullWidthSetting(t){t.infoEl.remove(),t.settingEl.addClass("qa-setting-full-width"),t.controlEl.addClass("qa-setting-full-width-control")}renderChoicesView(t){this.prepareFullWidthSetting(t),this.choiceViewHandle?.destroy();let n=qi(t.controlEl,eO,{app:this.app,plugin:this.plugin,choices:le.getState().choices,saveChoices:i=>{le.setState({choices:i})}},{what:"your choices",fallbackComponent:ag});return this.choiceViewHandle=n,()=>{n.destroy(),this.choiceViewHandle===n&&(this.choiceViewHandle=null)}}renderGlobalVariablesView(t){this.prepareFullWidthSetting(t),this.globalVariablesViewHandle?.destroy();let n=qi(t.controlEl,tO,{app:this.app,plugin:this.plugin},{what:"your global variables"});return this.globalVariablesViewHandle=n,()=>{n.destroy(),this.globalVariablesViewHandle===n&&(this.globalVariablesViewHandle=null)}}packagesDesc(t){return this.descWithDocsLink(t?`${AO} Export becomes available once you have a choice. `:`${AO} `,kl.packages,"Learn more about packages")}renderPackages(t){let n;t.addButton(a=>{n=a,a.setButtonText("Export package\u2026").onClick(()=>{let l=gn(le.getState().choices);new mS(this.app,this.plugin,l).open()})}),t.addButton(a=>a.setButtonText("Import package\u2026").onClick(()=>{new AS(this.app).open()}));let i=a=>{t.setDesc(this.packagesDesc(a)),n&&(n.setDisabled(a),a?n.setTooltip("Nothing to export yet"):n.buttonEl.removeAttribute("aria-label"))},o=gn(le.getState().choices).length===0;i(o),this.packagesUnsubscribe?.();let s=le.subscribe(a=>{let l=gn(a.choices).length===0;l!==o&&(o=l,i(l))});return this.packagesUnsubscribe=s,()=>{s(),this.packagesUnsubscribe===s&&(this.packagesUnsubscribe=null)}}renderDateAliases(t){t.settingEl.addClass("qa-date-alias-setting"),t.controlEl.addClass("qa-date-alias-control");let n=null;t.addTextArea(i=>{n=i,i.setPlaceholder(`t = today
|
||
tm = tomorrow
|
||
yd = yesterday`).setValue(c0(le.getState().dateAliases)).onChange(o=>{le.setState({dateAliases:V2(o)})}),i.inputEl.addClass("qa-date-alias-input")}),t.addButton(i=>{i.setButtonText("Reset to defaults").onClick(()=>{le.setState({dateAliases:Yf}),n?.setValue(c0(Yf))}),i.buttonEl.addClass("qa-date-alias-reset")})}renderTemplateFolderPaths(t){t.settingEl.addClass("qa-template-folders-setting");let n=t.controlEl.createDiv("qa-template-folders"),i=n.createDiv("qa-template-folder-list"),o=()=>Wi(le.getState().templateFolderPaths),s=p=>{le.setState({templateFolderPaths:p})},a=()=>{i.empty();let p=o();if(p.length===0){i.createDiv({cls:"qa-template-folder-empty",text:"No folders added yet."});return}for(let m of p){let v=i.createDiv("qa-template-folder-row");v.createSpan({cls:"qa-template-folder-name",text:m,attr:{title:m}}),new od.ExtraButtonComponent(v).setIcon("trash-2").setTooltip(`Remove ${m}`).onClick(()=>{s(o().filter(g=>g!==m)),a()})}},l=n.createDiv("qa-template-folder-input-row"),c=new od.TextComponent(l);c.setPlaceholder("templates/"),c.inputEl.addClass("qa-template-folder-input");let u=new ii(this.app,c.inputEl,Oc(Ls(this.app)).filter(p=>p!=="/")),d=()=>{let[p]=Wi([c.inputEl.value]);if(c.inputEl.value="",!p)return;let m=o();m.includes(p)||(s([...m,p]),a())},f=p=>{p.key==="Enter"&&(p.preventDefault(),d())};return c.inputEl.addEventListener("keydown",f),new od.ButtonComponent(l).setCta().setButtonText("Add").onClick(()=>d()),a(),()=>{c.inputEl.removeEventListener("keydown",f),u.destroy()}}renderDevInfo(t){let n=t.settingEl.createDiv();n.addClass("qa-dev-info"),$4(n,{branch:null,commit:null,dirty:null})}};u0();Me();ST();var pg=class{formatOutputString(e){return`QuickAdd: (${e.level}) ${e.message}`}getQuickAddError(e,t,n,i){return{message:e,level:t,time:Date.now(),stack:n,originalError:i}}};Cr();var Rx=class extends pg{constructor(){super(...arguments);this.ErrorLog=[]}logError(t,n,i){let o=this.getQuickAddError(t,"ERROR",n,i);this.addMessageToErrorLog(o);let s=i||new Error(t);console.error(this.formatOutputString(o),s)}logWarning(t,n,i){let o=this.getQuickAddError(t,"WARNING",n,i);this.addMessageToErrorLog(o);let s=i||new Error(t);console.warn(this.formatOutputString(o),s)}logMessage(t,n,i){let o=this.getQuickAddError(t,"LOG",n,i);this.addMessageToErrorLog(o),i?console.log(this.formatOutputString(o),i):console.log(this.formatOutputString(o))}addMessageToErrorLog(t){this.ErrorLog.push(t),this.ErrorLog.length>w0&&(this.ErrorLog=this.ErrorLog.slice(-w0))}clearErrorLog(){this.ErrorLog=[]}};var kO=require("obsidian");ST();var SS=class extends pg{constructor(t){super();this.plugin=t}logError(t,n,i){let o=this.getQuickAddError(t,"ERROR",n,i);new kO.Notice(this.formatOutputString(o),15e3)}logWarning(t,n,i){let o=this.getQuickAddError(t,"WARNING",n,i);new kO.Notice(this.formatOutputString(o))}logMessage(t,n,i){}};Me();Cr();Cr();var O4=1e4,N4=50,rme=/plugin:([^\s:)]+)/;function nme(r){let e=r.stack??"",t=`${r.name}: ${r.message}`;return(e.startsWith(t)?e.slice(t.length):e).split(`
|
||
`)}function ime(r){for(let e of nme(r)){let t=rme.exec(e);if(t)return{pluginId:t[1],frame:e.trim()}}return null}function ome(r,e){return`${r.name}@${e}`}function L4(r,e=Date.now){let t=r.manifest.id,n=new Map;r.registerDomEvent(window,"unhandledrejection",i=>{let o=i.reason,s=o instanceof Error?ime(o):null;if(s?.pluginId!==t)return;if(Dt(o)){i.preventDefault();return}let a=o,l=ome(a,s.frame),c=e(),u=n.get(l);if(n.set(l,c),!(u!==void 0&&c-u<O4)){if(n.size>=N4){for(let[d,f]of n)c-f>=O4&&n.delete(d);if(n.size>=N4){let d=n.keys().next();!d.done&&d.value!==l&&n.delete(d.value)}}lt(a,"A QuickAdd action failed")&&i.preventDefault()}})}var B4=require("obsidian");Me();function sme(r,e){try{let t=r.setting;return!t?.open||!t?.openTabById?(F.logMessage("QuickAdd: Obsidian internal settings API is unavailable."),!1):(t.open(),t.openTabById(e),!0)}catch(t){return F.logMessage(`QuickAdd: Failed to open plugin settings automatically: ${t}`),!1}}function fg(r,e,t){let n=sme(r,e);return!n&&t?.notice!==!1&&new B4.Notice("QuickAdd: Unable to open settings automatically. Open Settings \u2192 QuickAdd manually."),n}oE();Wt();Cr();var FD=class{constructor(e,t,n,i){this.app=e;this.plugin=t;this.choices=n;this.choiceExecutor=i}async run(){let e=Un(this.choices).filter(t=>t.type==="Macro"&&t.runOnStartup);for(let t of e)try{await new Vl(this.app,this.plugin,t,this.choiceExecutor,new Map).run()}catch(n){lt(n,`Startup macro '${t.name}' failed`)}}};var i7=require("obsidian");var Xg=require("obsidian");$x();Tt();qc();Me();var xK=require("obsidian");nd();Lg();Bg();Co();var CK=require("obsidian");js();Fo();function yE(r,e,t){let n=e.lastIndexOf("/"),i=n>=0?e.slice(0,n):"",o=cy(n>=0?e.slice(n+1):e),s=t?.vault.getAbstractFileByPath(e),a=t&&s instanceof CK.TFile?WP([s],d=>t.metadataCache.getFileCache(d))[0]:null,l=a?.primary??o,c=a?.secondary??i;r.addClass("mod-complex");let u=r.createDiv({cls:"suggestion-content"});u.createDiv({cls:"suggestion-title",text:l}),c&&u.createDiv({cls:"suggestion-note",text:c})}function mf(r,e={}){let{openedAtOf:t,recentRankOf:n,isExcluded:i}=e;return r.map(o=>({file:o,name:o.basename||o.path,excluded:i?.(o.path)??!1,openedAt:t?.(o.path),recentRank:n?.(o.path)})).sort((o,s)=>{if(o.excluded!==s.excluded)return o.excluded?1:-1;let a=o.openedAt!=null,l=s.openedAt!=null;if(a!==l)return a?-1:1;if(a&&l&&o.openedAt!==s.openedAt)return s.openedAt-o.openedAt;let c=o.recentRank??Number.POSITIVE_INFINITY,u=s.recentRank??Number.POSITIVE_INFINITY;return c!==u?c-u:o.name.localeCompare(s.name)}).map(o=>o.file)}DP();function hf(r){let e=r.workspace?.getLastOpenFiles?.(),t=Array.isArray(e)?e:[],n=new Map;t.forEach((s,a)=>{n.has(s)||n.set(s,a)});let i;try{i=wm.getInstanceIfExists()}catch{i=void 0}let o=r.metadataCache;return{openedAtOf:s=>i?.getLastOpenedAt(s),recentRankOf:s=>n.get(s),isExcluded:s=>o?.isUserIgnored?.(s)??!1}}Cr();zr();_l();xc();var pN="@quickadd-existing-note:",fN="@quickadd-unresolved-note:";function aye(r){return`${pN}${r}`}function lye(r){return`${fN}${r}`}function cye(r){return r.startsWith(pN)}function uye(r){return r.startsWith(fN)}function dye(r){return r.slice(pN.length)}function pye(r){return r.slice(fN.length)}function gf(r){return r.trim().replace(/\.md$/i,"").toLowerCase()}function EK(r){return r.trim().replace(/^\/+/,"")}function fye(r){return r.trim().length>0&&!r.includes("{{")}function mye(r){if(!fye(r.templatePath))return new Set;let e=EK(r.templatePath),t=/\.md$/i.test(e)?e:`${e}.md`;return new Set([t.toLowerCase()])}function hye(r,e,t){let n=e.replace(/\.md$/i,"");r.add(gf(e)),r.add(gf(n)),r.add(gf(t))}function gye(r,e){let t=r.metadataCache.getFileCache(e)?.frontmatter;if(!t)return[];let n=[];for(let[i,o]of Object.entries(t)){let s=i.toLowerCase();s!=="alias"&&s!=="aliases"||(typeof o=="string"?n.push(...o.split(",").map(a=>a.trim()).filter(Boolean)):Array.isArray(o)&&n.push(...o.filter(a=>typeof a=="string").map(a=>a.trim()).filter(Boolean)))}return n}function vye(r){let n=((r.split("|")[0]?.trim()??"").split("#")[0]?.trim()??"").replace(/\.md$/i,"").trim();return!n||n==="/"||Vn(n)?null:n}function yye(r){let e=r.metadataCache.unresolvedLinks??{},t=new Map;for(let n of Object.values(e))for(let i of Object.keys(n)){let o=vye(i);if(!o)continue;let s=gf(o);t.has(s)||t.set(s,o)}return[...t.values()].sort((n,i)=>n.localeCompare(i))}function bye(r,e){let t=new Set,n=mye(e),i=mf(r.vault.getMarkdownFiles(),hf(r)),o=[];for(let s of i){if(n.has(EK(s.path).toLowerCase()))continue;hye(t,s.path,s.basename);let a=gye(r,s),l=[s.basename,s.path,...a].join(" ");o.push({item:aye(s.path),display:l,title:a[0]?`${s.basename} (${s.path})`:s.path,renderPath:s.path,renderAlias:a[0]})}for(let s of yye(r)){let a=gf(s);t.has(a)||o.push({item:lye(s),display:s,title:`${s} (unresolved link)`,unresolvedTitle:s})}return{candidates:o,existingKeys:t}}function wye(r,e){r.addClass("mod-complex");let t=r.createDiv({cls:"suggestion-content"});t.createDiv({cls:"suggestion-title",text:e}),t.createDiv({cls:"suggestion-note",text:"Unresolved link"})}function Cye(r,e,t){if(yE(r,e),!t)return;r.querySelector(".suggestion-content")?.createDiv({cls:"suggestion-note",text:`Alias: ${t}`})}async function TK(r,e,t){let{candidates:n,existingKeys:i}=bye(r,e),o=new Map(n.map(a=>[a.item,a])),s=`Search notes or create ${e.name}`;try{let a=String(await oa(t,{remote:c=>sa(c,{items:n.map(u=>({value:u.item,title:u.title})),placeholder:s,allowCustomInput:!0,what:"the note-discovery picker"}),headless:()=>{throw new Ee(`'${e.name}' needs to ask which note to open or create, but this run is non-interactive. Pass the note name (e.g. value-value=<name>), or re-run with the ui flag.`)},app:()=>ln.Suggest(r,n.map(c=>c.display),n.map(c=>c.item),{placeholder:s,allowCustomValue:!0,customValueLabel:c=>`Create new note: ${c}`,valueExists:c=>{let u=gf(c);return i.has(u)||n.some(d=>d.unresolvedTitle&&gf(d.unresolvedTitle)===u)},renderItem:(c,u)=>{let d=o.get(c);if(d){if(d.renderPath){Cye(u,d.renderPath,d.renderAlias);return}d.unresolvedTitle&&wye(u,d.unresolvedTitle)}}})}));if(cye(a)){let c=r.vault.getAbstractFileByPath(dye(a));if(c instanceof xK.TFile)return{kind:"openExisting",file:c};throw new Error("Selected note no longer exists. Please run QuickAdd again.")}if(uye(a)){let c=li(pye(a),"Note title");return{kind:"create",title:c,...c.includes("/")?{vaultRelativePath:c}:{}}}let l=li(a,"Note title");return{kind:"create",title:l,...l.includes("/")?{vaultRelativePath:l}:{}}}catch(a){throw Dt(a)?new St("Input cancelled by user"):a}}Lg();Bg();Jd();qt();Cr();var Qg=class{constructor(e){this.executor=e;this.closed=!1}success(e,t){this.closed=!0,this.executor.recordExecutionResult?.({status:"success",file:e,effect:t})}failure(e){this.closed||this.executor.recordExecutionResult?.({status:"error",reason:e})}};function MD(r){return r instanceof Error?r.message||_K:String(r)||_K}var _K="Choice execution failed.";_l();Yv();rm();Em();fD();DD();Ns();Co();iE();Ng();var RD=class extends hd{constructor(t,n,i,o,s=null){super(t,n,o);this.originLeaf=s;this.choiceExecutor=o,this.outcome=new Qg(o),this.choice=i,this.formatter.setPromptRunContext({draftScopeId:i.id,choiceName:i.name})}async run(){let t=null,n=null;try{Mi(this.choice.templatePath,()=>`Invalid template path for ${this.choice.name}. ${this.choice.templatePath.length===0?"Template path is empty.":`Template path is not valid: ${this.choice.templatePath}`}`);let i=xu(this.choice.appendLink);if(this.setLinkToCurrentFileBehavior(i.enabled&&!i.requireActiveFile?"optional":"required"),!this.validateAppendLinkDestination(i))return;let o=this.choice.fileNameFormat.enabled?this.choice.fileNameFormat.format:Rs;if(zR(this.choice,o,this.choiceExecutor.variables.get("value"))){let w=await TK(this.app,this.choice,this.choiceExecutor);if(w.kind==="openExisting"){await this.openDiscoveredExistingNote(w.file),this.outcome.success(w.file,"unchanged");return}t=this.setTemporaryValueVariable(w.title),n=w.vaultRelativePath??null}let s=await this.resolveTemplateSourcePath(this.choice.templatePath),a="";if(n)a=Wo(n);else if(this.choice.folder.enabled)a=await this.getFolderPath();else{let w=this.app.fileManager.getNewFileParent(this.app.workspace.getActiveFile()?.path??"");a=w===this.app.vault.getRoot()?"":w.path}this.formatter.setTargetFolderPath(a),this.choice.folder.enabled&&this.formatter.setPromptRunContext({destination:a,destinationKind:"folder"});let l=n||await this.formatter.formatFileName(o,"noteTitle"),c=li(l,"File name"),{fileName:u,strippedPrefix:d}=n?{fileName:c,strippedPrefix:!1}:this.stripDuplicateFolderPrefix(c,a),f=this.shouldTreatFormattedNameAsVaultRelativePath(c,d,this.choice.folder.enabled),p=this.normalizeTemplateFilePath(n||f?"":a,u,s),m,v=!1,g=!1,y="created";if(await this.app.vault.adapter.exists(p)){let w=await this.getSelectedFileExistsMode(),x=Ch(w);y=x.resolutionKind==="reuseExisting"?"unchanged":x.resolutionKind==="createNew"?"created":"changed";let C=x.requiresExistingFile?this.findExistingFile(p):null;if(x.requiresExistingFile&&(!(C instanceof Xg.TFile)||C.extension!=="md"&&C.extension!=="canvas"&&C.extension!=="base")){this.failRun(`'${p}' already exists but could not be resolved as a markdown, canvas, or base file.`);return}if({createdFile:m,shouldAutoOpen:v}=await this.applyFileExistsMode(w,p,C,s,i),!m){this.lastTemplateFileFailure?this.failRun(this.lastTemplateFileFailure,"none"):this.failRun(`Could not resolve file exists behavior for '${p}'.`,"warning");return}}else{if(m=await this.createFileWithTemplate(p,s),!m){this.failRun(this.lastTemplateFileFailure??`Could not create file '${p}'.`,"none");return}g=!0}if(this.outcome.success(m,y),i.enabled&&m)try{i.destination.type==="specifiedFile"?await RT(this.app,m,i):Zd(i.placement)?await tp(this.app,m,i):this.choiceExecutor.focusedProperty?await NT(this.app,this.choiceExecutor.focusedProperty,m):await tp(this.app,m,i)}catch(w){if(w instanceof Nt)throw w;F.logWarning(`Created '${m.basename}' but could not insert the link: ${w instanceof Error?w.message:String(w)}`)}if(this.choice.copyLinkToClipboard&&m)try{await $T(m)}catch(w){F.logWarning(`Could not copy link to clipboard for '${m.path}': ${w instanceof Error?w.message:String(w)}`)}if((this.choice.openFile||v)&&m){let w=pn(this.choice.fileOpening),x=w.focus??!0;rp(this.app,m,x)||await fc(this.app,m,{...w,originLeaf:this.originLeaf}),await wu(this.app,m)}else g&&!i.enabled&&!this.choice.copyLinkToClipboard&&new Xg.Notice(`Created '${m.basename}'.`)}catch(i){if(md(i,{logPrefix:"Template execution aborted",noticePrefix:"Template execution aborted",defaultReason:"Template execution aborted"})){this.choiceExecutor.signalAbort?.(i);return}Gi.getInstance().markExecutionScopeFailed(),this.outcome.failure(MD(i)),lt(i,`Error running template choice "${this.choice.name}"`)}finally{t?.()}}failRun(t,n="error"){Gi.getInstance().markExecutionScopeFailed(),n==="warning"?F.logWarning(t):n==="error"&&F.logError(t),this.outcome.failure(t)}setTemporaryValueVariable(t){let n=this.choiceExecutor.variables,i=n.has("value"),o=n.get("value");return n.set("value",t),()=>{if(i){n.set("value",o);return}n.delete("value")}}validateAppendLinkDestination(t){return!t.enabled||t.destination.type!=="specifiedFile"||Gv(this.app,t.destination)?!0:(this.failRun(`Append link target file not found or is not a Markdown file: ${t.destination.path}`),!1)}async getSelectedFileExistsMode(){var i;if((i=this.choice).fileExistsBehavior??(i.fileExistsBehavior={kind:"prompt"}),this.choice.fileExistsBehavior.kind==="apply")return this.choice.fileExistsBehavior.mode;let t=Uj(),n="If the target file already exists";return await oa(this.choiceExecutor,{remote:o=>sa(o,{items:t.map(s=>({value:s.id,title:s.label})),placeholder:n,what:'the "file already exists" chooser'}),headless:()=>{throw new Ee(`'${this.choice.name}' needs to ask what to do because a note with that name already exists, but this run is non-interactive. Set the choice's "If the file already exists" behaviour to a specific action (e.g. Increment, Overwrite), or re-run with the ui flag.`)},app:()=>Nr.Suggest(this.app,t.map(o=>o.label),t.map(o=>o.id),n)})}async applyFileExistsMode(t,n,i,o,s){let a=Ch(t);switch(a.resolutionKind){case"modifyExisting":return{createdFile:await this.applyExistingFileUpdate(a.id,i,o,s),shouldAutoOpen:!1};case"createNew":{let l=await zj(n,a.id,async u=>await this.app.vault.adapter.exists(u)),c=await this.createFileWithTemplate(l,o);return c&&l!==n&&!this.choice.openFile&&new Xg.Notice(`Created '${c.basename}'.`),{createdFile:c,shouldAutoOpen:!1}}case"reuseExisting":return F.logMessage(`Opening existing file: ${i.path}`),{createdFile:i,shouldAutoOpen:!0}}}async openDiscoveredExistingNote(t){let n=pn(this.choice.fileOpening);rp(this.app,t,!0)||await fc(this.app,t,{...n,focus:!0,originLeaf:this.originLeaf})}async applyExistingFileUpdate(t,n,i,o){switch(t){case"appendTop":return await this.appendToExistingFileWithTemplate(n,i,"top",o);case"appendBottom":return await this.appendToExistingFileWithTemplate(n,i,"bottom",o);case"overwrite":return await this.overwriteFileWithTemplate(n,i)}}async appendToExistingFileWithTemplate(t,n,i,o){if(t.extension==="canvas"||t.extension==="base")return this.lastTemplateFileFailure=`Cannot append to '${t.path}': appending a template to a ${t.extension} file would corrupt it. Use the "Overwrite" file-exists option instead.`,Gi.getInstance().markExecutionScopeFailed(),F.logError(this.lastTemplateFileFailure),null;if(t.extension!=="md")return await this.appendToFileWithTemplate(t,n,i);let s=new Hg(this.app,this.plugin,t,n,i,this.choiceExecutor,n);return s.setPromptRunContext({draftScopeId:this.choice.id,choiceName:this.choice.name,destination:t.path,destinationKind:"file"}),s.setLinkToCurrentFileBehavior(o.enabled&&!o.requireActiveFile?"optional":"required"),await this.withAnonymousValueForInsertEngine(()=>s.apply())}async withAnonymousValueForInsertEngine(t){let n=this.formatter.getAnonymousValue(),i=this.choiceExecutor.variables;if(!(n!==void 0&&!i.has("value")))return await t();i.set("value",n);try{return await t()}finally{i.delete("value")}}findExistingFile(t){let n=this.app.vault.getAbstractFileByPath(t);if(n instanceof Xg.TFile)return n;if(n)return null;let i=t.toLowerCase(),o=this.app.vault.getFiles().filter(s=>s.path.toLowerCase()===i);if(o.length===1)return o[0];if(o.length>1){let s=o.map(a=>a.path).join(", ");F.logError(`Multiple files match '${t}' when ignoring case: ${s}`)}return null}async formatFolderPaths(t){let n=[];for(let i of t)n.push(await this.formatter.formatFolderPath(i));return n}async getFolderPath(){let t=await this.formatFolderPaths([...this.choice.folder.folders]),n=this.getCurrentFolderSuggestion(),i=n?[n]:[],o=this.choiceExecutor;if(this.choice.folder?.chooseFromSubfolders&&!(this.choice.folder?.chooseWhenCreatingNote||this.choice.folder?.createInSameFolderAsActiveFile)){let s=Oc(Ls(this.app)),a=Tj(s,t);return await this.getOrCreateFolder(a,{allowCreate:!0,allowedRoots:t,topItems:i,executor:o})}if(this.choice.folder?.chooseWhenCreatingNote){let s=Oc(Ls(this.app));return await this.getOrCreateFolder(s,{allowCreate:!0,topItems:i,executor:o})}if(this.choice.folder?.createInSameFolderAsActiveFile){let s=this.app.workspace.getActiveFile();return!s||!s.parent?(F.logWarning("No active file or active file has no parent. Cannot create file in same folder as active file. Creating in root folder."),""):await this.getOrCreateFolder([s.parent.path],{allowCreate:!0,topItems:i,executor:o})}return await this.getOrCreateFolder(t,{allowCreate:!0,allowedRoots:t,topItems:i,executor:o})}getCurrentFolderSuggestion(){let t=this.app.workspace.getActiveFile(),n=t?.parent;return!t||!n?null:{path:n.path??"",label:"<current folder>"}}};var Zc=require("obsidian");Cu();nd();$x();var $D=class{isResolved(){return!this.hasConflicts}isConflicted(){return this.hasConflicts}},bE=class r extends $D{constructor(e,t,n){super(),this.left=e,this.base=t,this.right=n,this.hasConflicts=!0}static create(e){return new r(e.left,e.base,e.right)}apply(e){return r.create({left:e(this.left),base:e(this.base),right:e(this.right)})}},ca=class r extends $D{constructor(e){super(),this.hasConflicts=!1,this.result=e}combine(e){this.result=this.result.concat(e.result)}apply(e){return new r(e(this.result))}};var Kc=class r{constructor(e,t){this.left=e,this.right=t}static executeDiff(e,t){if(!e.push)throw new Error("Argument is not an array");let n=r.diff(e,t);return new hN(e,t,n).convertToTypedOutput()}static diff(e,t){return new r(e,t).performDiff()}performDiff(){let e=this.identifyUniquePositions();e.sort((o,s)=>s[0]-o[0]);let[t,n]=this.findNextChange(),i=new OD(t,n,[]);return e.forEach(o=>{i=this.getDifferences(i,o)}),i.changeRanges}getDifferences(e,t){let[n,i]=[e.leftChangePos,e.rightChangePos],[o,s]=t;if(o<n||s<i)return e;{let[a,l,c,u]=this.findPrevChange(n,i,o-1,s-1),[d,f]=this.findNextChange(o+1,s+1),p=this.appendChangeRange(e.changeRanges,a,l,c,u);return new OD(d,f,p)}}findNextChange(e=0,t=0){let n=this.left.slice(e)||[],i=this.right.slice(t)||[],o=this.mismatchOffset(n,i);return[e+o,t+o]}findPrevChange(e,t,n,i){if(e>n||t>i)return[e,n,t,i];{let o=this.left.slice(e,n+1).reverse()||[],s=this.right.slice(t,i+1).reverse()||[],a=this.mismatchOffset(o,s);return[e,n-a,t,i-a]}}mismatchOffset(e,t){let n=Math.max(e.length,t.length);for(let i=0;i<n;i++)if(e[i]!==t[i])return i;return Math.min(e.length,t.length)}identifyUniquePositions(){let e=this.findUnique(this.left),t=this.findUnique(this.right),n=new Set(...e.keys()),i=new Set(...t.keys()),s=[...new Set([...n].filter(a=>i.has(a)))].map(a=>[e.get(a),t.get(a)]);return s.unshift([this.left.length,this.right.length]),s}findUnique(e){let t=new Map;e.forEach((i,o)=>{t.set(i,new mN(o,!t.has(i)))});let n=new Map;for(let[i,o]of t.entries())o.unique&&n.set(i,o.pos);return n}appendChangeRange(e,t,n,i,o){return t<=n&&i<=o?e.push(new wE(Wl.change,t+1,n+1,i+1,o+1)):t<=n?e.push(new wE(Wl.remove,t+1,n+1,i+1,i)):i<=o&&e.push(new wE(Wl.add,t+1,t,i+1,o+1)),e}},mN=class{constructor(e,t){this.pos=e,this.unique=t}},Zg=class{constructor(e,t){this.text=e,this.low=t}},hN=class{constructor(e,t,n){this.oldTextArray=e,this.newTextArray=t,this.chunks=n,this.oldText=[],this.newText=[]}convertToTypedOutput(){let e=new gN(0,0);return this.chunks.forEach(t=>{let[n,i]=this.setTextNodeIndexes(t,e.oldIndex,e.newIndex),[o,s]=this.appendChanges(t,e.oldIndex+n,e.newIndex+i);e.oldIndex=o,e.newIndex=s}),this.setTheRemainingTextNodeIndexes(e.oldIndex,e.newIndex),{oldText:this.oldText,newText:this.newText}}setTextNodeIndexes(e,t,n){let i=0;for(;t+i<e.leftLo-1;)this.oldText.push(new Zg(this.oldTextArray[t+i],n+i)),i+=1;let o=0;for(;n+o<e.rightLo-1;)this.newText.push(new Zg(this.newTextArray[n+o],t+o)),o+=1;return[i,o]}appendChanges(e,t,n){for(;t<=e.leftHi-1;)this.oldText.push(this.oldTextArray[t]),t+=1;for(;n<=e.rightHi-1;)this.newText.push(this.newTextArray[n]),n+=1;return[t,n]}setTheRemainingTextNodeIndexes(e,t){let n=0;for(;e+n<this.oldTextArray.length;)this.oldText.push(new Zg(this.oldTextArray[e+n],t+n)),n+=1;for(;t+n<this.newTextArray.length;)this.newText.push(new Zg(this.newTextArray[t+n],e+n)),n+=1}},gN=class{constructor(e,t){this.oldIndex=e,this.newIndex=t}},Wl;(function(r){r.change="change",r.add="add",r.remove="remove"})(Wl||(Wl={}));var wE=class{constructor(e,t,n,i,o){this.action=e,this.leftLo=t,this.leftHi=n,this.rightLo=i,this.rightHi=o}},OD=class{constructor(e,t,n){this.leftChangePos=e,this.rightChangePos=t,this.changeRanges=n}};var ND=class r{constructor(e,t,n,i,o){this.code=e,this.baseLo=t,this.baseHi=n,this.sideLo=i,this.sideHi=o}static fromChangeRange(e){return new r(e.action,e.leftLo,e.leftHi,e.rightLo,e.rightHi)}},Jg=class r{constructor(e,t,n){this.left=e,this.base=t,this.right=n}static executeDiff(e,t,n){return new r(e,t,n).getDifferences()}getDifferences(){let e=Kc.diff(this.base,this.left).map(n=>ND.fromChangeRange(n)),t=Kc.diff(this.base,this.right).map(n=>ND.fromChangeRange(n));return this.collapseDifferences(new LD(e,t))}collapseDifferences(e,t=[]){if(e.isFinished())return t;{let n=new LD,i=e.chooseSide(),o=e.dequeue();return n.enqueue(i,o),e.switchSides(),this.buildResultQueue(e,o.baseHi,n),t.push(this.determineDifference(n,i,e.switchSides())),this.collapseDifferences(e,t)}}buildResultQueue(e,t,n){if(this.queueIsFinished(e.peek(),t))return n;{let i=e.dequeue();return n.enqueue(e.currentSide,i),t<i.baseHi?(e.switchSides(),this.buildResultQueue(e,i.baseHi,n)):this.buildResultQueue(e,t,n)}}queueIsFinished(e,t){return e.length===0||e[0].baseLo>t+1}determineDifference(e,t,n){let i=e.get(t)[0].baseLo,o=e.get(n),s=o[o.length-1].baseHi,[a,l]=this.diffableEndpoints(e.get(Hn.left),i,s),[c,u]=this.diffableEndpoints(e.get(Hn.right),i,s),d=this.left.slice(a-1,l),f=this.right.slice(c-1,u),p=this.decideAction(e,d,f);return new vN(p,a,l,c,u,i,s)}diffableEndpoints(e,t,n){if(e.length){let i=e[0],o=e[e.length-1],s=i.sideLo-i.baseLo+t,a=o.sideHi-o.baseHi+n;return[s,a]}else return[t,n]}decideAction(e,t,n){return e.isEmpty(Hn.left)?Qc.chooseRight:e.isEmpty(Hn.right)?Qc.chooseLeft:t.every((i,o)=>n[o]===i)?Qc.noConflictFound:Qc.possibleConflict}},vN=class{constructor(e,t,n,i,o,s,a){this.changeType=e,this.leftLo=t,this.leftHi=n,this.rightLo=i,this.rightHi=o,this.baseLo=s,this.baseHi=a}},Qc;(function(r){r.chooseRight="choose_right",r.chooseLeft="choose_left",r.possibleConflict="possible_conflict",r.noConflictFound="no_conflict_found"})(Qc||(Qc={}));var Hn;(function(r){r.left="left",r.right="right"})(Hn||(Hn={}));var LD=class{constructor(e=[],t=[]){this.diffs={left:e,right:t}}dequeue(e=this.currentSide){return this.diffs[e].shift()}peek(e=this.currentSide){return this.diffs[e]}isFinished(){return this.isEmpty(Hn.left)&&this.isEmpty(Hn.right)}enqueue(e=this.currentSide,t){return this.diffs[e].push(t)}get(e=this.currentSide){return this.diffs[e]}isEmpty(e=this.currentSide){return this.diffs[e].length===0}switchSides(e=this.currentSide){return this.currentSide=e===Hn.left?Hn.right:Hn.left}chooseSide(){return this.isEmpty(Hn.left)?this.currentSide=Hn.right:this.isEmpty(Hn.right)?this.currentSide=Hn.left:this.currentSide=this.get(Hn.left)[0].baseLo<=this.get(Hn.right)[0].baseLo?Hn.left:Hn.right,this.currentSide}};var CE=class r{static merge(e,t,n){let i=new r(e,t,n);return i.executeThreeWayMerge(),i.result}constructor(e,t,n){this.result=[],this.text3=new yN(e,n,t)}executeThreeWayMerge(){let e=Jg.executeDiff(this.text3.left,this.text3.base,this.text3.right),t=1;e.forEach(i=>{let o=[];for(let s=t;s<i.baseLo;s++)o.push(this.text3.base[s-1]);o.length&&this.result.push(new ca(o)),this.interpretChunk(i),t=i.baseHi+1});let n=this.accumulateLines(t,this.text3.base.length,this.text3.base);n.length&&this.result.push(new ca(n))}setConflict(e){let t=bE.create({left:this.accumulateLines(e.leftLo,e.leftHi,this.text3.left),base:this.accumulateLines(e.baseLo,e.baseHi,this.text3.base),right:this.accumulateLines(e.rightLo,e.rightHi,this.text3.right)});this.result.push(t)}determineConflict(e,t,n){let i=1;e.forEach(s=>{for(let l=i;l<=s.leftLo;l++)this.result.push(new ca(this.accumulateLines(i,l,n)));let a=this.determineOutcome(s,t,n);i=s.rightHi+1,a&&this.result.push(a)});let o=this.accumulateLines(i,n.length+1,n);o.length&&this.result.push(new ca(o))}determineOutcome(e,t,n){return e.action===Wl.change?bE.create({left:this.accumulateLines(e.rightLo,e.rightHi,t),right:this.accumulateLines(e.leftLo,e.leftHi,n),base:[]}):e.action===Wl.add?new ca(this.accumulateLines(e.rightLo,e.rightHi,t)):null}setText(e,t,n){let i=[];for(let o=t;o<=n;o++)i.push(e[o-1]);return i}_conflictRange(e){let t=this.setText(this.text3.right,e.rightLo,e.rightHi),n=this.setText(this.text3.left,e.leftLo,e.leftHi),i=Kc.diff(t,n);(this._assocRange(i,Wl.change)||this._assocRange(i,Wl.remove))&&e.baseLo<=e.baseHi?this.setConflict(e):this.determineConflict(i,n,t)}interpretChunk(e){if(e.changeType==Qc.chooseLeft){let t=this.accumulateLines(e.leftLo,e.leftHi,this.text3.left);t.length&&this.result.push(new ca(t))}else if(e.changeType!==Qc.possibleConflict){let t=this.accumulateLines(e.rightLo,e.rightHi,this.text3.right);t.length&&this.result.push(new ca(t))}else this._conflictRange(e)}_assocRange(e,t){for(let n=0;n<e.length;n++){let i=e[n];if(i.action===t)return i}return null}accumulateLines(e,t,n){let i=[];for(let o=e;o<=t;o++)n[o-1]&&i.push(n[o-1]);return i}},yN=class{constructor(e,t,n){this.left=e,this.right=t,this.base=n}};var vf=class{constructor(e,t,n={}){this.results=e,this.joinFunction=t,this.conflictHandler=n.conflictHandler,this.conflict=n.conflict||!1}isSuccess(){return!this.conflict}isConflict(){return!!this.conflict}joinedResults(){if(this.isConflict())return this.conflictHandler?this.conflictHandler(this.results):this.results;{let[e,t]=[this.results[0],this.results.slice(1)],n=e;return t.forEach(i=>n.combine(i)),n.apply(this.joinFunction).result}}};var xE=class r{static collateMerge(e,t,n){return e.length?(e=r.combineNonConflicts(e),e.length===1&&e[0].isResolved()?new vf(e,t):new vf(e,t,{conflict:!0,conflictHandler:n})):new vf([new ca([])],t)}static combineNonConflicts(e){let t=[];return e.forEach(n=>{t.length&&t[t.length-1].isResolved()&&n.isResolved()?t[t.length-1].combine(n):t.push(n)}),t}};function AK(r,e,t,n){return function(o){return o.map(s=>{if(s.isResolved())return s.apply(n).result;{let a=s.apply(n),{left:l,right:c}=a;return[r,l,e,c,t].join(`
|
||
`)}}).join(`
|
||
`)}}var kK=r=>r.join(""),xye=r=>r.split(/\b/),Eye=AK("<<<<<<< YOUR CHANGES","=======",">>>>>>> APP AUTHORS CHANGES",kK),Tye={splitFunction:xye,joinFunction:kK,conflictFunction:Eye};function bN(r,e,t,n={}){n=Object.assign({},Tye,n);let[i,o,s]=[r,e,t].map(c=>n.splitFunction.call(n,c)),a=CE.merge(i,o,s);return xE.collateMerge(a,n.joinFunction,n.conflictFunction)}var SK=bN;Tt();Cu();ID();Tt();qt();Co();Vg();function DK(r,e){return r.line===e.line}function Xc(r){let e=[];return r.forEach((t,n)=>{let i=t.match(/^(#+)[\s]+(.*)$/);i&&e.push({level:i[1].length,text:i[2],line:n})}),e}function vd(r,e,t=!1){let n=Xc(r),i=n.find(c=>c.line===e),o=!!i;if(!o&&t)throw new Error(`Target line ${e} is not a heading, but we are trying to find the end of its section.`);if(!o&&!t){let c=IK(r,e,u=>u.trim()==="");return c!==null&&c>e?c-1:e}let s=r.length-1,a=_ye(i,n,r,t),l=Sye(r,a,c=>c.trim()!=="");if(l!==null){if(l<e)return e;let c=r[l+1].trim()==="";return l+1===s&&!c?a:l===0?l+1:l}return a}function _ye(r,e,t,n){let i=e.findIndex(u=>DK(u,r)),o=i===e.length-1,s=t.length-1;if(o)return s;let[a,l]=Aye(r,e);if(l&&a===e.length)return s;if(l&&n)return e[a].line-1;if(l&&!n)return e[i+1].line;if(!n&&!l){let u=kye(r.line,e);return u===null?s:u}return s}function Aye(r,e){let t=e.findIndex(i=>DK(i,r)),n=IK(e,t,i=>i.level<=r.level);return n===null?[-1,!1]:[n,!0]}function kye(r,e){let t=e.find(n=>n.line>r);return t?t.line:null}function Sye(r,e,t){for(let n=e-1;n>=0;n--)if(t(r[n]))return n;return null}function IK(r,e,t){for(let n=e+1;n<r.length;n++)if(t(r[n]))return n;return null}var Dye="\u200B";function EE(r){let e=r.slice(),t=!1,n="",i=0;for(let o=0;o<r.length;o++){let s=r[o].match(/^(\s*)(`{3,}|~{3,})/);if(!t){s&&(t=!0,n=s[2][0],i=s[2].length);continue}e[o]=r[o].replace(/^(\s*)#+(\s)/,`$1${Dye}$2`),s&&s[2][0]===n&&s[2].length>=i&&r[o].slice(s[1].length+s[2].length).trim()===""&&(t=!1,n="",i=0)}return e}function PK(r){return(r.match(/^#+\s+(.*)$/)?.[1]??"").trim()}function Iye(r){let e=r.match(/^\[?v?(\d+)\.(\d+)\.(\d+)(?:[-+\]].*)?$/i)??r.match(/^\[?v?(\d+)(?:\.(\d+))?(?:\.(\d+))?/i);if(!e)return{value:0,parsed:!1};let t=n=>Math.min(Number(n??"0"),999999);return{value:t(e[1])*1e12+t(e[2])*1e6+t(e[3]),parsed:!0}}function FK(r,e,t){switch(e.by){case"lexical":return{value:r.toLocaleLowerCase(),parsed:!0};case"numeric":{let n=r.match(/^-?\d+(?:\.\d+)?/);return n?{value:Number(n[0]),parsed:!0}:{value:0,parsed:!1}}case"date":{let n=t?t(r,e.dateFormat||void 0,!1):null;return n&&n.isValid()?{value:n.valueOf(),parsed:!0}:{value:0,parsed:!1}}case"semver":return Iye(r);default:return{value:0,parsed:!0}}}function Pye(r,e){if(typeof r.value=="string"&&typeof e.value=="string")return r.value<e.value?-1:r.value>e.value?1:0;let t=r.value,n=e.value;return t<n?-1:t>n?1:0}function MK(r,e,t,n,i,o=0){let s=EE(r),a=Xc(s).filter(f=>f.line>=o),l=a.filter(f=>f.level===t),c=FK(PK(e),n,i);if(l.length===0){let f=a.filter(p=>p.level<t).pop();return f?{mode:"after",line:vd(s,f.line,!0)}:{mode:"bodyStart"}}let u=()=>{let f=l[l.length-1];return{mode:"after",line:vd(s,f.line,!0)}};if(n.by==="insertion")return n.direction==="desc"?{mode:"before",line:l[0].line}:u();if(!c.parsed)return u();let d=n.unparseable??"bottom";for(let f of l){let p=FK(PK(s[f.line]),n,i),m;if(!p.parsed)m=d==="bottom";else{let v=Pye(c,p);m=n.direction==="desc"?v>0:v<0}if(m)return{mode:"before",line:f.line}}return u()}pE();function wN(r){let e=r.split(`
|
||
`);for(;e.length>1&&e[e.length-1].trim()==="";)e.pop();return e}function CN(r){return r.length===0||r.length===1&&r[0].trim()===""}function xN(r,e){if(e.length<=1){let t=Fye(r,e[0]??"");return{start:t,end:t}}return Mye(r,e)}function Fye(r,e){let t=e.trimEnd(),n=-1;for(let i=0;i<r.length;i++){let o=r[i].trimStart();if(o===t)return i;if(o.startsWith(t)){let a=o.slice(t.length);if(/^\s*$/.test(a))return i;n===-1&&(n=i);continue}let s=o.indexOf(t);if(s!==-1){let a=o.slice(s+t.length);if(/^\s*$/.test(a))return i;n===-1&&(n=i)}}return n}function Mye(r,e){let t=e.length,n=e.map(i=>RK(i));for(let i=0;i+t<=r.length;i++){let o=!0;for(let s=0;s<t;s++)if(RK(r[i+s])!==n[s]){o=!1;break}if(o)return{start:i,end:i+t-1}}return{start:-1,end:-1}}function RK(r){return r.trimEnd()}function $K(r,e,t){return r?Xc([e[t]??""]).length>0:!1}function Rye(r,e){return r==="skip"?!0:r==="none"?!1:$ye(e)}function $ye(r){return/^\s{0,3}#{1,6}\s+\S/.test(r)}function EN(r,e,t,n){if(e<0)return e;let i=r[e]??"";if(!Rye(n,i))return e;let s=t.endsWith(`
|
||
`)?Math.max(r.length-1,0):r.length,a=e;for(let l=e+1;l<s;l++){if(r[l].trim().length===0){a=l;continue}break}return a}function BD(r,e,t,n){if(e<0)return e;let i=e,o=e+1;for(;o<r.length&&r[o].trim().length===0;)i=o,o++;return i===e||o!==r.length||!n.endsWith(`
|
||
`)?e:t.endsWith(`
|
||
`)?Math.max(e,i-1):i}function OK(r){return r.includes(`
|
||
`)||r.includes("\r")}function NK(r,e){let t=r.indexOf(`
|
||
`,e);return t===-1?r.length:t>0&&r[t-1]==="\r"?t-1:t}function TN(r){let e=tN(r);return e>0?r.slice(0,e).split(`
|
||
`).length-1:0}function LK(r,e){let t=TN(e),n=r.map((i,o)=>o<t?"":i);return EE(n).map(i=>i.replace(/\r$/,""))}function BK(r,e,t,n){let i=e.split(`
|
||
`),o=i.slice(0,t+1).join(`
|
||
`),s=i.slice(t+1).join(`
|
||
`),l=(i[t+1]??"").trim(),c=e.endsWith(`
|
||
`)&&t+1===i.length-1,u=t+1<i.length&&!c&&l==="",d=n&&r.endsWith(`
|
||
`)&&u?r.slice(0,-1):r,f=!d.endsWith(`
|
||
`)&&l!==""?`
|
||
`:"";return{content:`${o}
|
||
${d}${f}${s}`,insertedEndOffset:o.length+1+d.length}}function UK(r,e,t,n=r.length){let i=e.length>0&&!r.endsWith(`
|
||
`)?`
|
||
`:"",o=Math.max(0,Math.min(n,r.length));if(t<=0)return{content:`${r}${i}${e}`,insertedEndOffset:o};let s=e.split(`
|
||
`),a=s.slice(0,t).join(`
|
||
`),l=s.slice(t).join(`
|
||
`);return{content:`${a}
|
||
${r}${i}${l}`,insertedEndOffset:a.length+1+o}}function VK(r,e,t,n){let i=n,o=i.includes(`\r
|
||
`)?`\r
|
||
`:`
|
||
`,s=e.mode==="before"?e.line:e.line+1,a=0;for(let w=0;w<s&&w<r.length;w++)a+=r[w].length+1;a>i.length&&(a=i.length);let l=i.slice(0,a),c=i.slice(a),u=s>0?(r[s-1]??"").replace(/\r$/,""):"",d=s<r.length?(r[s]??"").replace(/\r$/,""):"",f=t.split(`
|
||
`).map(w=>w.replace(/\r$/,""));f.length>1&&f[f.length-1]===""&&f.pop();let p=[];s>0&&u.trim()!==""&&p.push(""),p.push(...f),s<r.length&&d.trim()!==""&&p.push("");let m=p.join(o),v=l.length>0&&!/\n$/.test(l)?o:"",g=c.length>0||/\n$/.test(i)?o:"",y=l.length+v.length;return{content:`${l}${v}${m}${g}${c}`,insertedEndOffset:y+m.length}}pE();Ng();OP();var Nye=/^[ \t\r\n\f\v]*$/;function qK(r){return Nye.test(r)}var UD=class extends Cs{constructor(){super(...arguments);this.file=null;this.fileContent="";this.sourcePath=null;this.useSelectionAsCaptureValue=!0;this.clipboardImageFallbackEnabled=!1;this.createdClipboardAttachmentPaths=[];this.templaterProcessed=!1;this.insertAfterTargetOverride=null;this.lastResolvedInsertAfterHeading=null;this.linebreaksProcessed=!1;this.captureInsertionEndOffset=null}setDestinationFile(t){this.file=t,this.sourcePath=t.path,this.clipboardAttachmentLink=void 0,this.setTargetFolderPath(Wo(t.path)),this.setPromptRunContext({destination:t.path,destinationKind:"file"})}setDestinationSourcePath(t){this.sourcePath=t,this.file=null,this.clipboardAttachmentLink=void 0,this.setTargetFolderPath(Wo(t)),this.setPromptRunContext({destination:t,destinationKind:"file"})}setUseSelectionAsCaptureValue(t){this.useSelectionAsCaptureValue=t}setInsertAfterTargetOverride(t){this.insertAfterTargetOverride=t}getResolvedInsertAfterHeading(){return this.lastResolvedInsertAfterHeading}consumeCreatedClipboardAttachmentPaths(){let t=this.createdClipboardAttachmentPaths;return this.createdClipboardAttachmentPaths=[],t}getCaptureInsertionEndOffset(){return this.captureInsertionEndOffset}setCaptureInsertionEndOffset(t){this.captureInsertionEndOffset=typeof t=="number"&&Number.isFinite(t)&&t>=0?t:null}shouldUseSelectionForValue(){return this.useSelectionAsCaptureValue}async getSelectedTextForValue(){let t=await this.getSelectedText();return t.trim().length>0?t:""}getLinkSourcePath(){return this.sourcePath??this.file?.path??null}async getClipboardContent(){let t=await super.getClipboardContent();return t.length>0||!this.clipboardImageFallbackEnabled?t:this.clipboardAttachmentLink!==void 0?this.clipboardAttachmentLink??"":(this.clipboardAttachmentLink=await this.saveClipboardImageAsAttachment(),this.clipboardAttachmentLink??"")}async withClipboardImageFallback(t){let n=this.clipboardImageFallbackEnabled;this.clipboardImageFallbackEnabled=!0;try{return await t()}finally{this.clipboardImageFallbackEnabled=n}}async saveClipboardImageAsAttachment(){let t=navigator.clipboard;if(typeof t?.read!="function")return null;let n,i;try{if(n=await this.getFirstClipboardImageItem(t),!n)return null;i=await(await n.clipboardItem.getType(n.mimeType)).arrayBuffer()}catch{return null}let o=this.getLinkSourcePath()??"",s=await b_(this.app,i,n.mimeType,o);return this.createdClipboardAttachmentPaths.push(s.path),w_(this.app,s,o)}async getFirstClipboardImageItem(t){let n=await t.read();for(let i of n){let o=i.types.find(s=>my[s]!==void 0);if(o)return{clipboardItem:i,mimeType:o}}return null}getCurrentFileLink(){let t=this.app.workspace.getActiveFile();if(!t)return null;let n=this.sourcePath??this.file?.path??"";return this.app.fileManager.generateMarkdownLink(t,n)}async formatContentWithFile(t,n,i,o){if(this.setCaptureInsertionEndOffset(null),this.choice=n,this.file=o,this.fileContent=i,!n||!o||i===null)return t;this.setTargetFolderPath(Wo(o.path));let s=n.insertAfter.enabled||!!n.insertBefore?.enabled||n.prepend||!n.captureToActiveFile||n.activeFileWritePosition==="top"||n.activeFileWritePosition==="bottom";return await this.formatFileContent(t,s)}async formatContent(t,n){return this.choice=n,n?await this.formatFileContent(t):t}async formatFileContent(t,n=!0){let i=await this.withClipboardImageFallback(async()=>this.withPromptScope("captureText",t,async()=>super.formatFileContent(await this.expandTemplateLinebreaksOnce(t))));if(n&&this.file&&!this.templaterProcessed){let a=await dc(this.app,i,this.file);a&&(i=a),this.templaterProcessed=!0}if(qK(i))return this.fileContent;if(this.choice.prepend||this.choice.captureToActiveFile&&this.choice.activeFileWritePosition==="bottom"){let a=!this.choice.task,l=this.fileContent.length>0&&!this.fileContent.endsWith(`
|
||
`)&&!i.startsWith(`
|
||
`),c=a||l?`
|
||
`:"";return this.setCaptureInsertionEndOffset(this.fileContent.length+c.length+i.length),`${this.fileContent}${c}${i}`}return this.choice.insertAfter.enabled?await this.insertAfterHandler(i):this.choice.insertBefore?.enabled?await this.insertBeforeHandler(i):this.insertAtNoteBodyStartTracking(i)}async formatContentOnly(t){let n=await this.withClipboardImageFallback(async()=>this.withPromptScope("captureText",t,async()=>super.formatFileContent(await this.expandTemplateLinebreaksOnce(t))));return qK(n)?this.fileContent:n}async expandTemplateLinebreaksOnce(t){return this.linebreaksProcessed?t:(this.linebreaksProcessed=!0,this.expandFormatTemplateEscapes(t))}async expandFormatTemplateEscapes(t){let n=await this.replaceGlobalVarInString(t);return this.expandLinebreakEscapesOutsideTokens(n)}async insertAfterHandler(t){let n=this.insertAfterTargetOverride;if(this.choice.insertAfter?.inline&&n===null){let f=await this.formatLocationString(await this.expandFormatTemplateEscapes(this.choice.insertAfter.after));return await this.insertAfterInlineHandler(t,f)}let i=n??await this.formatLocationString(await this.expandFormatTemplateEscapes(this.choice.insertAfter.after));if(n===null){let f=i.split(`
|
||
`,1)[0];this.lastResolvedInsertAfterHeading=/^#+\s+\S/.test(f)?f.trim():null}let o=wN(i);if(CN(o))throw new Ee("Insert-after target is empty after formatting.");let s=ff(this.fileContent),a=this.isOrderedCreate()?LK(s,this.fileContent):s,{start:l,end:c}=xN(a,o);if(l===-1){if(this.choice.insertAfter?.createIfNotFound)return await this.createInsertAfterIfNotFound(t,i);throw new Ee(`Insert-after target not found: '${i}'.`)}let d;if(this.choice.insertAfter?.insertAtEnd){if(!this.file)throw new Error("Tried to get sections without file.");let f=vd(s,l,this.considerSubsectionsForAnchor(s,l)),p=Math.max(f??s.length-1,c);d=BD(s,p,this.fileContent,t)}else{let f=this.choice.insertAfter?.blankLineAfterMatchMode??"auto";d=EN(s,c,this.fileContent,f)}return this.insertTextAfterPositionInBody(t,this.fileContent,d)}async insertBeforeHandler(t){let n=this.choice.insertBefore;if(!n)throw new Ee("Insert-before settings are missing.");let i=await this.formatLocationString(await this.expandFormatTemplateEscapes(n.before)),o=wN(i);if(CN(o))throw new Ee("Insert-before target is empty after formatting.");let s=ff(this.fileContent),{start:a}=xN(s,o);if(a===-1){if(n.createIfNotFound)return await this.createInsertBeforeIfNotFound(t,i);throw new Ee(`Insert-before target not found: '${i}'.`)}return this.insertTextBeforePositionInBody(t,this.fileContent,a)}async insertAfterInlineHandler(t,n){if(OK(n))throw new Ee("Inline insert-after target must be a single line \u2014 remove the line break (\\n) or turn off inline insertion.");let i=this.fileContent.indexOf(n);if(i===-1){if(this.choice.insertAfter?.createIfNotFound)return await this.createInlineInsertAfterIfNotFound(t,n);throw new Ee(`Inline insert-after target not found: '${n}'.`)}let o=i+n.length;if(this.setCaptureInsertionEndOffset(o+t.length),this.choice.insertAfter?.replaceExisting){let s=NK(this.fileContent,o);return this.fileContent.slice(0,o)+t+this.fileContent.slice(s)}return this.fileContent.slice(0,o)+t+this.fileContent.slice(o)}async createInsertAfterIfNotFound(t,n){let i=`${n}
|
||
${t}`;if(this.choice.insertAfter?.createIfNotFoundLocation===po)return this.insertAtNoteBodyStartTracking(i);if(this.choice.insertAfter?.createIfNotFoundLocation===ac)return this.setCaptureInsertionEndOffset(this.fileContent.length+1+i.length),`${this.fileContent}
|
||
${i}`;if(this.choice.insertAfter?.createIfNotFoundLocation===lc){let o=Nn(this.app);if(!o)throw new Ee(`Unable to insert line '${this.choice.insertAfter.after}' at cursor position: no active markdown editor.`);try{let a=o.editor.getCursor().line;if(this.choice.insertAfter?.insertAtEnd){if(!this.file)throw new Error("Tried to get sections without file.");let c=ff(this.fileContent),u=vd(c,a,this.considerSubsectionsForAnchor(c,a));a=BD(c,u??c.length-1,this.fileContent,i)}return this.insertTextAfterPositionInBody(i,this.fileContent,a)}catch{throw new Ee(`Unable to insert line '${this.choice.insertAfter.after}' at cursor position.`)}}if(this.choice.insertAfter?.createIfNotFoundLocation===Aa)return this.createInsertAfterOrdered(t,n);throw new Ee(`Unknown createIfNotFoundLocation: ${this.choice.insertAfter?.createIfNotFoundLocation}`)}isOrderedCreate(){return!!this.choice.insertAfter?.createIfNotFound&&this.choice.insertAfter?.createIfNotFoundLocation===Aa}considerSubsectionsForAnchor(t,n){return $K(!!this.choice.insertAfter?.considerSubsections,t,n)}createInsertAfterOrdered(t,n){let i=this.choice.insertAfter?.orderBy??{by:"insertion",direction:"desc",unparseable:"bottom"},o=n.split(/\r?\n/,1)[0],s=Xc([o])[0]?.level??0,a=`${n}
|
||
${t}`;if(s===0)return this.insertAtNoteBodyStartTracking(a);let l=ff(this.fileContent),c=l.map(g=>g.replace(/\r$/,"")),u=TN(this.fileContent),d=EE(c),f=o.replace(/\r$/,"").trimEnd(),p=d.findIndex((g,y)=>y>=u&&g.trimEnd()===f);if(p!==-1){let g=this.choice.insertAfter?.insertAtEnd?BD(d,vd(d,p,this.considerSubsectionsForAnchor(d,p))??d.length-1,this.fileContent,t):EN(d,p,this.fileContent,this.choice.insertAfter?.blankLineAfterMatchMode??"auto");return this.insertTextAfterPositionInBody(t,this.fileContent,g)}let m=typeof window<"u"?window.moment:void 0,v=MK(c,o,s,i,m,u);return v.mode==="bodyStart"?this.insertAtNoteBodyStartTracking(a):this.spliceOrderedSection(l,v,a)}spliceOrderedSection(t,n,i){let{content:o,insertedEndOffset:s}=VK(t,n,i,this.fileContent);return this.setCaptureInsertionEndOffset(s),o}async createInsertBeforeIfNotFound(t,n){let i=this.choice.insertBefore;if(!i)throw new Ee("Insert-before settings are missing.");let o=t.endsWith(`
|
||
`)||t.length===0?`${t}${n}`:`${t}
|
||
${n}`;if(i.createIfNotFoundLocation===po)return this.insertAtNoteBodyStartTracking(o,t.length);if(i.createIfNotFoundLocation===ac)return this.setCaptureInsertionEndOffset(this.fileContent.length+1+t.length),`${this.fileContent}
|
||
${o}`;if(i.createIfNotFoundLocation===lc){let s=Nn(this.app);if(!s)throw new Ee(`Unable to insert line '${i.before}' at cursor position: no active markdown editor.`);try{let a=s.editor.getCursor();return this.insertTextBeforePositionInBody(o,this.fileContent,a.line,t.length)}catch{throw new Ee(`Unable to insert line '${i.before}' at cursor position.`)}}throw new Ee(`Unknown createIfNotFoundLocation: ${i.createIfNotFoundLocation}`)}async createInlineInsertAfterIfNotFound(t,n){let i=`${n}${t}`;if(this.choice.insertAfter?.createIfNotFoundLocation===po)return this.insertAtNoteBodyStartTracking(i);if(this.choice.insertAfter?.createIfNotFoundLocation===ac)return this.setCaptureInsertionEndOffset(this.fileContent.length+1+i.length),`${this.fileContent}
|
||
${i}`;if(this.choice.insertAfter?.createIfNotFoundLocation===lc){let o=Nn(this.app);if(!o)throw new Ee(`Unable to insert line '${this.choice.insertAfter.after}' at cursor position: no active markdown editor.`);try{let a=o.editor.getCursor().line;return this.insertTextAfterPositionInBody(i,this.fileContent,a)}catch{throw new Ee(`Unable to insert line '${this.choice.insertAfter.after}' at cursor position.`)}}throw new Ee(`Unknown createIfNotFoundLocation: ${this.choice.insertAfter?.createIfNotFoundLocation}`)}insertAtNoteBodyStartTracking(t,n=t.length){let i=rN(this.fileContent,t);if(i.insertedStartOffset===null)return this.setCaptureInsertionEndOffset(null),i.content;let o=Math.max(0,Math.min(n,t.length));return this.setCaptureInsertionEndOffset(i.insertedStartOffset+o),i.content}insertTextAfterPositionInBody(t,n,i){let{content:o,insertedEndOffset:s}=BK(t,n,i,!!this.choice.task);return this.setCaptureInsertionEndOffset(s),o}insertTextBeforePositionInBody(t,n,i,o=t.length){let{content:s,insertedEndOffset:a}=UK(t,n,i,o);return this.setCaptureInsertionEndOffset(a),s}};ID();Me();Jd();qt();Cr();Lg();Bg();var WK=require("obsidian");Tt();Co();_l();function zK(r,e){let t=r.trim().replace(/^\/+/,"");if(t==="")return{kind:"vault"};let n=vh(t);if(n){if(!n.field)throw new Ee("Property capture target needs a field name, e.g. property:type=draft");return{kind:"property",field:n.field,value:n.value,filter:n.filter}}let i=gh(t);if(i){if(i.multiSelect)throw new Ee("Capture target filters select one destination file. Use {{FILE:...|multi}} in the capture format for multi-value metadata.");return{kind:"filter",filter:i.filter}}let o=li(t,"Capture target file path");if(Vi.test(o))throw new Ee(`Capture to '.base' files is not supported (${o}). Use a Template choice instead.`);let s=o.endsWith("/"),a=o.replace(/\/+$/,"");if(s)return{kind:"folder",folder:a};if(ir.test(o)||Wr.test(o))return{kind:"file",path:o};let l=e.normalizeMarkdownFilePath("",a),u=e.getAbstractFileByPath(l)instanceof WK.TFile;return e.isFolder(a)&&!u?{kind:"folder",folder:a}:{kind:"file",path:o}}Tt();function VD(r){return`${r.replace(/^\/+/,"").replace(ir,"")}.md`}function qD(r,e,t){if(t)return null;let n=(e??"").trim().replace(/^\/+/,"");if(_u(n))return null;let i=vh(n),o=!!i&&!!i.field,s=o?null:gh(n),a=!!s&&!s.multiSelect,l=!o&&!s&&n.startsWith("#"),c=n.endsWith("/"),u=!l&&!o&&!a&&!c&&(ir.test(n)||Wr.test(n)||Vi.test(n)),d=n.replace(/\/+$/,""),f=!l&&!o&&!a&&!u&&(n===""||r.isFolder(d)&&!r.markdownFileExists(d)),p=!o&&!a&&c;if(o&&i)return{kind:"property",field:i.field,value:i.value,filter:i.filter};if(a&&s)return{kind:"filter",filter:s.filter};if(l)return{kind:"tag",tag:n};if(f||p){let m=d;return{kind:"folder",folderPathSlash:m===""?"":`${m}/`}}return null}Yv();_l();xc();Em();rm();Ng();js();dN();uD();Co();dD();Q1();function HK(r){let e=r.insertAfter.enabled||!!r.insertBefore?.enabled;return r.captureToActiveFile&&!e&&r.newLineCapture?.enabled?r.newLineCapture.direction==="above"?"newLineAbove":"newLineBelow":r.captureToActiveFile&&!e?r.activeFileWritePosition==="top"?"activeFileTop":r.activeFileWritePosition==="bottom"||r.prepend?"append":"currentLine":r.insertAfter.enabled?"insertAfter":r.insertBefore?.enabled?"insertBefore":r.prepend?"prepend":"append"}Tt();Co();function _N(r){return r?.type==="text"?"text":r?.type==="file"||r?.file?"file":typeof r?.text=="string"?"text":"unsupported"}function Lye(r,e){let t=e.id;if(!t)return null;let n=r.getData?.();return n?.nodes?.length?n.nodes.find(i=>i.id===t)??null:null}function jK(r,e){if(r==="text"){if(e==="currentLine")return"Canvas capture does not support 'At cursor' for text cards. Use top, bottom, insert-after, or insert-before placement.";if(e==="newLineAbove"||e==="newLineBelow")return"Canvas capture does not support 'New line above/below cursor' for text cards. Use top, bottom, insert-after, or insert-before placement."}return r==="file"&&(e==="currentLine"||e==="newLineAbove"||e==="newLineBelow")?"Canvas file cards do not support cursor-based capture modes. Use top, bottom, insert-after, or insert-before modes.":null}function Bye(r){let e=r.file;return e?typeof e=="string"?e:typeof e=="object"&&"path"in e&&typeof e.path=="string"?e.path:null:null}function AN(r){return!!r&&"path"in r&&"extension"in r}function Uye(r){let t=(r.workspace.activeLeaf??r.workspace.getMostRecentLeaf?.()??null)?.view;return!t||t.getViewType?.()!=="canvas"?null:t}function Vye(r,e){let t=e.file??r.workspace.getActiveFile?.();if(!t)throw new Ee("Cannot capture to Canvas because no active Canvas file is available.");return t}function qye(r){let e=r.selection?Array.from(r.selection):[];if(e.length!==1)throw new Ee("Canvas capture requires exactly one selected node.");return e[0]}function GK(r){let e=Bye(r);if(!e)throw new Ee("Selected Canvas file card does not have a valid linked file path.");if(!ir.test(e))throw new Ee("Canvas file card targets markdown files only in this version.");return e}function Wye(r,e){let t=GK(e),n=r.vault.getAbstractFileByPath(t);if(!AN(n))throw new Ee(`Selected Canvas file card target not found: ${t}`);return n}function zye(r,e){let t=GK(e),n=r.vault.getAbstractFileByPath(t);if(!n)return{targetPath:t};if(!AN(n))throw new Ee(`Selected Canvas file card target not found: ${t}`);return{targetPath:t,targetFile:n}}function Hye(r,e){let t;try{t=JSON.parse(r)}catch{throw new Ee(`Canvas file is not valid JSON: ${e}`)}if(!t||typeof t!="object")throw new Ee(`Canvas file has invalid structure: ${e}`);if(!Array.isArray(t.nodes))throw new Ee(`Canvas file has no nodes array: ${e}`);return t}function YK(r,e){let t=r,n=Uye(t);if(!n)return null;let i=n.canvas;if(!i)throw new Ee("Canvas capture is unavailable in this Obsidian version.");let o=Vye(t,n),s=qye(i),a=Lye(i,s),l=_N(s);if(l==="unsupported"&&a&&(l=_N(a)),l==="unsupported")throw new Ee("Canvas capture currently supports only text and file cards.");let c=jK(l,e);if(c)throw new Ee(c);if(l==="text")return{kind:"text",source:"active",canvas:i,canvasFile:o,node:s,nodeData:a};let u=s.file||!a?.file?s:{...s,file:a.file};return{kind:"file",source:"active",canvasFile:o,node:u,targetFile:Wye(t,u)}}async function KK(r,e,t,n){let i=t.trim();if(!i)throw new Ee("Canvas node id is required for Canvas node capture.");let o=r.vault.getAbstractFileByPath(e);if(!AN(o))throw new Ee(`Canvas target not found: ${e}`);if(!Wr.test(o.path))throw new Ee("Canvas node capture requires the target path to be a .canvas file.");let s=await r.vault.read(o),a=Hye(s,o.path),l=a.nodes.findIndex(v=>v.id===i);if(l===-1)throw new Ee(`Canvas node id '${i}' was not found in ${o.path}.`);let c=a.nodes[l],u=_N(c);if(u==="unsupported")throw new Ee("Canvas capture currently supports only text and file cards.");let d=jK(u,n);if(d)throw new Ee(d);if(u==="text")return{kind:"text",source:"configured",canvasFile:o,rawCanvas:s,canvasData:a,nodeData:c,nodeIndex:l};let f=r,{targetPath:p,targetFile:m}=zye(f,c);return{kind:"file",source:"configured",canvasFile:o,nodeData:c,targetPath:p,targetFile:m}}function QK(r){return r.source==="active"?typeof r.node.text=="string"?r.node.text:typeof r.nodeData?.text=="string"?r.nodeData.text:"":typeof r.nodeData.text=="string"?r.nodeData.text:""}async function XK(r,e,t){if(e.source==="active"){typeof e.node.setText=="function"?e.node.setText(t):e.node.text=t,e.canvas.requestSave?.();return}if(await r.vault.read(e.canvasFile)!==e.rawCanvas)throw new Ee("Canvas target changed while capture was running. Re-run capture to avoid overwriting newer Canvas edits.");e.nodeData.text=t,e.canvasData.nodes[e.nodeIndex]=e.nodeData,await r.vault.modify(e.canvasFile,JSON.stringify(e.canvasData,null," "))}iE();var WD=4e3,jye=/^[ \t\r\n\f\v]*$/;function Gye(r){return jye.test(r)}var Yye=/\{\{(?:VALUE|FILE|FIELD):[^}]*\|\s*multi\s*(?=[:}|]|$)[^}]*\}\}/gi,Kye=/\|\s*format\s*:\s*(?:inline|yaml|markdown)\s*(?=\||}})/i;function Qye(r){return Array.from(r.matchAll(Yye)).some(e=>!Kye.test(e[0]))}var zD=class extends Kg{constructor(t,n,i,o,s=null){super(t);this.choiceExecutor=o;this.originLeaf=s;this.capturePropertyVars=new Map;this.suppressFrontmatterCollection=!1;this.resolvedInsertAfterHeading=null;this.choice=i,this.plugin=n,this.outcome=new Qg(o),this.formatter=new UD(t,n,o),this.formatter.setPromptRunContext({draftScopeId:i.id,choiceName:i.name})}captureResolvedOrderedHeading(){if(this.choice.insertAfter?.enabled&&this.choice.insertAfter.createIfNotFoundLocation===Aa){let t=this.formatter.getResolvedInsertAfterHeading();t&&(this.resolvedInsertAfterHeading=t)}}showSuccessNotice(t,{wasNewFile:n,action:i}){let o=`'${t.basename}'`;if(n){new Zc.Notice(`Created and captured to ${o}`,WD);return}let s=this.choice.prepend||this.choice.captureToActiveFile&&this.choice.activeFileWritePosition==="bottom",a="";switch(i){case"currentLine":a=`Captured to current line in ${o}`;break;case"newLineAbove":a=`Captured on a new line above cursor in ${o}`;break;case"newLineBelow":a=`Captured on a new line below cursor in ${o}`;break;case"activeFileTop":a=`Captured to top of ${o}`;break;case"prepend":case"append":a=s?`Captured to bottom of ${o}`:`Captured to top of ${o}`;break;case"insertAfter":{let l=this.resolvedInsertAfterHeading??this.choice.insertAfter.after;a=l?`Captured to ${o} under '${l}'`:`Captured to ${o}`;break}case"insertBefore":{let l=this.choice.insertBefore?.before;a=l?`Captured to ${o} before '${l}'`:`Captured to ${o}`;break}default:a=`Captured to ${o}`;break}new Zc.Notice(a,WD)}showNothingToCaptureNotice(t,{wasNewFile:n}){let i=`'${t.basename}'`;new Zc.Notice(n?`Created ${i} \u2014 nothing to capture (no content)`:`Nothing to capture \u2014 ${i} unchanged`,WD)}hasActiveMarkdownCaptureContext(){let t=!!this.app.workspace.getActiveFile(),n=!!Nn(this.app);return t&&n}shouldSkipRequiredCanvasLinkInsertion(t,n){return n&&t.destination?.type!=="specifiedFile"&&t.requireActiveFile&&!this.hasActiveMarkdownCaptureContext()}async insertCaptureLink(t,n,{isCanvasTriggered:i}){if(!n.enabled)return;if(n.destination?.type==="specifiedFile"){await RT(this.app,t,n);return}if(Zd(n.placement)){await tp(this.app,t,n);return}if(this.shouldSkipRequiredCanvasLinkInsertion(n,i)){this.plugin.settings.showCaptureNotification&&new Zc.Notice("Canvas capture skipped link insertion because no Markdown editor is focused.",WD);return}let o=this.choiceExecutor.focusedProperty;if(o){await NT(this.app,o,t);return}await tp(this.app,t,n)}async copyCapturedFileLinkToClipboard(t){if(this.choice.copyLinkToClipboard)try{await $T(t)}catch(n){F.logWarning(`Could not copy link to clipboard for '${t.path}': ${n instanceof Error?n.message:String(n)}`)}}validateAppendLinkDestination(t){return!t.enabled||t.destination.type!=="specifiedFile"||Gv(this.app,t.destination)?!0:(this.failRun(`Append link target file not found or is not a Markdown file: ${t.destination.path}`),!1)}async run(){let t=!1;try{this.capturePropertyVars.clear();let n=xu(this.choice.appendLink);if(this.formatter.setLinkToCurrentFileBehavior(n.enabled&&!n.requireActiveFile?"optional":"required"),!this.validateAppendLinkDestination(n))return;let i=this.choice.useSelectionAsCaptureValue,o=this.plugin.settings.useSelectionAsCaptureValue??!0,s=typeof i=="boolean"?i:o;this.formatter.setUseSelectionAsCaptureValue(s);let a=HK(this.choice),l=a==="currentLine"||a==="newLineAbove"||a==="newLineBelow",c=this.choice.captureToActiveFile?YK(this.app,a):null,u=await this.resolveConfiguredCanvasTarget(a),d=c??u;if(d?.kind==="text"){await this.handleCanvasTextCapture(d,a,n,()=>{t=!0});return}if(d?.kind==="file"&&(a==="insertAfter"&&this.choice.insertAfter?.createIfNotFound&&this.choice.insertAfter?.createIfNotFoundLocation==="cursor"||a==="insertBefore"&&this.choice.insertBefore?.createIfNotFound&&this.choice.insertBefore?.createIfNotFoundLocation==="cursor"))throw new Ee("Canvas file cards do not support creating missing line targets at cursor. Use top or bottom.");let f=d?.kind==="file"?d.source==="configured"?d.targetFile?.path??d.targetPath:d.targetFile.path:await this.getFormattedPathToCaptureTo(this.choice.captureToActiveFile);if(!d&&!this.choice.captureToActiveFile&&Wr.test(f))throw new Ee("Capture to a .canvas file requires a target canvas node id.");let p=this.getCaptureContent(),m,v=await this.fileExists(f);!v&&this.choice?.createFileIfItDoesntExist?.enabled&&aE(f),this.isInsertAfterHeadingMode()&&!Wr.test(f)&&await this.maybeResolveInsertAfterHeading(await this.readNoteBodyForHeadingPicker(f,v));let g=!v&&!!this.choice?.createFileIfItDoesntExist?.enabled&&!this.choice?.createFileIfItDoesntExist?.createWithTemplate;if(this.suppressFrontmatterCollection=!g,this.suppressFrontmatterCollection&&Qye(this.choice?.format?.format??"")&&F.logWarning("QuickAdd: {{VALUE:\u2026|multi}}, {{FILE:\u2026|multi}} and {{FIELD:\u2026|multi}} in this capture write comma-separated strings by default. Add |format:yaml, |format:markdown or |format:inline to choose the output explicitly."),v)m=this.onFileExists.bind(this);else if(this.choice?.createFileIfItDoesntExist?.enabled)m=((ce,R,O)=>this.onCreateFileIfItDoesntExist(ce,R,n));else throw new Ee(`Target file missing: ${f}. Enable "Create file if it doesn't exist" or choose an existing file.`);let{file:y,newFileContent:w,captureContent:x,priorContent:C,cursorEndOffset:_,cursorPlacementSafe:E=!0}=await m(f,p),D=null,P=E,H=!1,V=Gye(x);if(this.captureResolvedOrderedHeading(),l)if(V)t=!0;else{let ce=await dc(this.app,x,y),R=!1;switch(a){case"currentLine":R=I0(ce,this.app);break;case"newLineAbove":R=F0(ce,this.app);break;case"newLineBelow":R=M0(ce,this.app);break}if(!R){await this.cleanupCreatedClipboardAttachments(),this.failRun(`Capture "${this.choice.name}": no active Markdown editor to insert into.`);return}t=!0}else{await this.app.vault.modify(y,w),t=!0,this.choice.templater?.afterCapture==="wholeFile"&&(await Qd(this.app,y),P=!1,H=!0);let ce=await this.applyCapturePropertyVars(y);ce&&(P=!1),ce&&(H=!0),D=P?w:null}let oe=l?V?"unchanged":"changed":v?w!==C||H?"changed":"unchanged":"created";if(this.outcome.success(y,oe),this.plugin.settings.showCaptureNotification&&(V?this.showNothingToCaptureNotice(y,{wasNewFile:!v}):this.showSuccessNotice(y,{wasNewFile:!v,action:a})),await this.copyCapturedFileLinkToClipboard(y),await this.insertCaptureLink(y,n,{isCanvasTriggered:!!d}),this.choice.openFile&&y){let ce=pn(this.choice.fileOpening),R=ce.focus??!0;rp(this.app,y,R)||await fc(this.app,y,{...ce,originLeaf:this.originLeaf}),!await wu(this.app,y)&&P&&R&&D!==null&&typeof _=="number"&&R0(this.app,y,_,D)}}catch(n){if(t||await this.cleanupCreatedClipboardAttachments(),md(n,{logPrefix:"Capture execution aborted",noticePrefix:"Capture execution aborted",defaultReason:"Capture aborted"})){this.choiceExecutor.signalAbort?.(n);return}Gi.getInstance().markExecutionScopeFailed(),this.outcome.failure(MD(n)),lt(n,`Error running capture choice "${this.choice.name}"`)}finally{t&&this.formatter.consumeCreatedClipboardAttachmentPaths()}}failRun(t){Gi.getInstance().markExecutionScopeFailed(),F.logError(t),this.outcome.failure(t)}async cleanupCreatedClipboardAttachments(){let t=this.formatter.consumeCreatedClipboardAttachmentPaths();for(let n of t)try{let i=this.app.vault.getAbstractFileByPath(n);i instanceof Zc.TFile&&await this.app.fileManager.trashFile(i)}catch(i){F.logWarning(`QuickAdd: failed to clean up clipboard attachment '${n}': ${String(i)}`)}}async handleCanvasTextCapture(t,n,i,o){if(n==="currentLine"||n==="newLineAbove"||n==="newLineBelow")throw new Ee("Canvas text cards support top, bottom, insert-after, and insert-before positions only.");if(n==="insertAfter"&&this.choice.insertAfter?.createIfNotFound&&this.choice.insertAfter?.createIfNotFoundLocation==="cursor"||n==="insertBefore"&&this.choice.insertBefore?.createIfNotFound&&this.choice.insertBefore?.createIfNotFoundLocation==="cursor")throw new Ee("Canvas text cards do not support creating missing line targets at cursor. Use top or bottom.");let s=t.canvasFile;this.formatter.setTitle(Og(s.basename)),this.formatter.setDestinationFile(s);let a=this.getCaptureContent(),l=QK(t);this.isInsertAfterHeadingMode()&&await this.maybeResolveInsertAfterHeading(l);let c=await this.formatter.formatContentWithFile(a,this.choice,l,s);this.captureResolvedOrderedHeading();let u=c===l;if(u||await XK(this.app,t,c),o(),this.outcome.success(s,u?"unchanged":"changed"),this.plugin.settings.showCaptureNotification&&(u?this.showNothingToCaptureNotice(s,{wasNewFile:!1}):this.showSuccessNotice(s,{wasNewFile:!1,action:n})),await this.copyCapturedFileLinkToClipboard(s),await this.insertCaptureLink(s,i,{isCanvasTriggered:!0}),this.choice.openFile&&s){let d=pn(this.choice.fileOpening),f=d.focus??!0;rp(this.app,s,f)||await fc(this.app,s,{...d,originLeaf:this.originLeaf}),await wu(this.app,s)}}async resolveConfiguredCanvasTarget(t){if(this.choice.captureToActiveFile)return null;let n=this.choice.captureTo?.trim()??"",i=this.choice.captureToCanvasNodeId?.trim()??"";if(!n||!i)return null;let o=await this.formatFilePath(n);return Wr.test(o)?await KK(this.app,o,i,t):null}assertInteractiveCaptureTarget(){if(this.choiceExecutor.interactive===!1)throw new Ee(`'${this.choice.name}' needs to ask which note to capture into, but this run is non-interactive. Point "Capture to" at a specific file, or re-run with the ui flag.`)}async maybeResolveInsertAfterHeading(t){let n=this.choice.insertAfter;if(!n?.enabled||!n.promptHeading)return;let i=!!n.createIfNotFound,o=ff(t),s=Xc(o),a=s.map(p=>o[p.line]),l=s.map(p=>`${" ".repeat(Math.max(0,p.level-1))}${p.text}`),c=s.map(p=>p.text),u="Choose a heading to insert under",d=String(await oa(this.choiceExecutor,{remote:p=>sa(p,{items:a.map((m,v)=>({value:m,title:l[v]??m})),placeholder:u,allowCustomInput:i,what:"the heading picker"}),headless:()=>{throw new Ee(`'${this.choice.name}' needs to ask which heading to capture under, but this run is non-interactive. Turn off "Choose heading when capturing" and set a fixed heading, or re-run with the ui flag.`)},app:()=>ln.Suggest(this.app,l,a,{allowCustomValue:i,placeholder:u,emptyStateText:i?"No headings found \u2014 type a heading to create":"No headings found in the target note",customValueLabel:p=>`Insert after new line: ${p}`})}));Mi(!!d&&d.length>0,"No heading selected for capture."),this.formatter.setInsertAfterTargetOverride(d);let f=a.indexOf(d);this.resolvedInsertAfterHeading=f>=0?c[f]:d}isInsertAfterHeadingMode(){return!!this.choice.insertAfter?.enabled&&!!this.choice.insertAfter.promptHeading}async readNoteBodyForHeadingPicker(t,n){if(!n)return"";let i=this.app.vault.getAbstractFileByPath(t);return i instanceof Zc.TFile?await this.app.vault.read(i):""}getCaptureContent(){let t;return this.choice.format.enabled?t=this.choice.format.format:t=Rs,this.choice.task&&(t=`- [ ] ${t}
|
||
`),t}async getFormattedPathToCaptureTo(t){if(t){let a=this.app.workspace.getActiveFile();return Mi(a,"Cannot capture to active file - no active file."),a.path}let n=this.getPreselectedCaptureTargetPath();if(n!==void 0){let a=qD({isFolder:l=>im(this.app,l),markdownFileExists:l=>this.app.vault.getAbstractFileByPath(VD(l))instanceof Zc.TFile},this.choice.captureTo??"",!1);if(a){let l=this.confinePreselectedToScope(a,n);if(l!==null)return this.normalizeCaptureFilePath(l)}}let i=this.choice.captureTo,o=await this.formatter.formatFileName(i,"captureTarget"),s=this.resolveCaptureTarget(o);switch(s.kind){case"vault":return this.selectFileInFolder("",!0);case"filter":return this.selectFileWithFilter(s.filter);case"property":return this.selectFileWithProperty(s.field,s.value,s.filter);case"folder":return this.selectFileInFolder(s.folder,!1);case"file":return this.normalizeCaptureFilePath(s.path)}}getPreselectedCaptureTargetPath(){let t=this.choiceExecutor?.variables?.get(Gd);return typeof t=="string"&&t.length>0?t:void 0}confinePreselectedToScope(t,n){let i=this.stripLeadingSlash(n);if(t.kind==="folder")return t.folderPathSlash&&!i.startsWith(t.folderPathSlash)?`${t.folderPathSlash}${i}`:i;if(this.resolveScopeFiles(t).some(l=>l.path===i))return i;if(!(this.choice.createFileIfItDoesntExist?.enabled??!1))return null;let a=new Set(this.app.vault.getMarkdownFiles().map(l=>l.basename.toLowerCase()));return this.captureTargetAlreadyExists(i,a)?null:i}resolveScopeFiles(t){switch(t.kind){case"filter":return om(this.app,t.filter);case"property":return sm(this.app,t.field,t.value,t.filter);case"tag":return Jv(this.app,t.tag);case"folder":return rs(this.app,t.folderPathSlash)}}resolveCaptureTarget(t){return zK(t,{getAbstractFileByPath:n=>this.app.vault.getAbstractFileByPath(n),isFolder:n=>im(this.app,n),normalizeMarkdownFilePath:(n,i)=>this.normalizeMarkdownFilePath(n,i)})}captureTargetExists(t,n){let i=n.startsWith(t)?n:`${t}${n}`,o;try{o=li(i,"Capture target file path")}catch{return!1}let s=[o];return/\.(md|canvas)$/i.test(o)||s.push(`${o}.md`,`${o}.canvas`),s.some(a=>!!this.app.vault.getAbstractFileByPath(a))}async selectFileInFolder(t,n){let i=t.endsWith("/")||n?t:`${t}/`,o=rs(this.app,i),s=this.choice.createFileIfItDoesntExist?.enabled??!1;Mi(s||o.length>0,`Folder ${i} is empty.`);let a=mf(o,hf(this.app)),l=a.map(v=>v.path),c=Ec(a,v=>this.app.metadataCache.getFileCache(v)),u=l.map((v,g)=>`${c[g]??v} ${v}`),d=new Set(c.map(v=>v.toLowerCase())),f=s?"Choose a note or type to create one":void 0,p=String(await oa(this.choiceExecutor,{remote:v=>sa(v,{items:l.map((g,y)=>({value:g,title:c[y]??g})),placeholder:f,allowCustomInput:s,what:"the capture-target picker"}),headless:()=>{throw this.assertInteractiveCaptureTarget(),new Error("unreachable")},app:()=>ln.Suggest(this.app,c,l,{placeholder:f,emptyStateText:s?"Type a note name to create it":void 0,renderItem:(v,g)=>yE(g,v,this.app),searchItems:u,allowCustomValue:s,customValueLabel:v=>`Create new note: ${v}`,valueExists:v=>d.has(v.toLowerCase())||this.captureTargetExists(i,v)})}));Mi(!!p&&p.length>0,"No file selected for capture.");let m=p.startsWith(`${i}`)?p:`${i}${p}`;return await this.formatFilePath(m)}async selectFileWithFilter(t){let n=om(this.app,t);return this.selectFileFromSet(n,"No files matched the capture target filters.")}async selectFileWithProperty(t,n,i){let o=sm(this.app,t,n,i),s=n!==void 0?`${t}=${n}`:t;return this.selectFileFromSet(o,`No notes with property ${s}.`)}captureTargetAlreadyExists(t,n){let i=t.trim();if(!i)return!1;let o;try{o=li(i,"Capture target file path")}catch{return!1}let s=o.replace(/\.(md|canvas)$/i,"");if([o,`${s}.md`,`${s}.canvas`].some(c=>!!this.app.vault.getAbstractFileByPath(c)))return!0;let l=s.slice(s.lastIndexOf("/")+1);return n.has(l.toLowerCase())}async selectFileFromSet(t,n){let i=this.choice.createFileIfItDoesntExist?.enabled??!1;Mi(i||t.length>0,n);let o=mf(t,hf(this.app)),s=o.map(m=>m.path),a=Ec(o,m=>this.app.metadataCache.getFileCache(m)),l=s.map((m,v)=>`${a[v]??m} ${m}`),c=new Set(this.app.vault.getMarkdownFiles().map(m=>m.basename.toLowerCase())),u=new Set(a.map(m=>m.toLowerCase())),d=m=>u.has(m.toLowerCase())||this.captureTargetAlreadyExists(m,c),f=i?"Choose a note or type to create one":void 0,p=String(await oa(this.choiceExecutor,{remote:async m=>{let v=await sa(m,{items:s.map((g,y)=>({value:g,title:a[y]??g})),placeholder:f,allowCustomInput:i,what:"the capture-target picker"});if(!s.includes(v)&&d(v))throw new Error(`"${v}" already exists but is not one of the notes this capture targets. Pick one of the offered notes, or type a name that does not exist yet.`);return v},headless:()=>{throw this.assertInteractiveCaptureTarget(),new Error("unreachable")},app:()=>ln.Suggest(this.app,a,s,{placeholder:f,emptyStateText:i?"Type a note name to create it":void 0,renderItem:(m,v)=>yE(v,m,this.app),searchItems:l,allowCustomValue:i,customValueLabel:m=>`Create new note: ${m}`,valueExists:d})}));return Mi(!!p&&p.length>0,"No file selected for capture."),await this.formatFilePath(p)}async onFileExists(t,n){let i=this.getFileByPath(t);if(!i)throw new Error("File not found");this.formatter.setTitle(i.basename),this.formatter.setDestinationFile(i);let o=await this.collectIfFrontmatter(()=>this.formatter.formatContentOnly(n));this.mergeCapturePropertyVars(this.formatter.getAndClearTemplatePropertyVars());let s=await this.app.vault.read(i),a=await this.collectIfFrontmatter(()=>this.formatter.formatContentWithFile(o,this.choice,s,i));this.mergeCapturePropertyVars(this.formatter.getAndClearTemplatePropertyVars());let l=this.formatter.getCaptureInsertionEndOffset(),c=await this.app.vault.read(i),u=a,d=!0;if(c!==s){let f=SK(c,s,a);Mi(f.isSuccess(),()=>`The file ${t} has been modified since the last read.
|
||
QuickAdd could not merge the versions two without conflicts, and will not modify the file.
|
||
This is in order to prevent data loss.`),u=f.joinedResults(),d=!1}return{file:i,newFileContent:u,captureContent:o,priorContent:c,cursorEndOffset:l??void 0,cursorPlacementSafe:d}}async onCreateFileIfItDoesntExist(t,n,i){aE(t);let o=Og(t);this.formatter.setTitle(o),this.formatter.setDestinationSourcePath(t);let s=await this.collectIfFrontmatter(()=>this.formatter.formatContentOnly(n));this.mergeCapturePropertyVars(this.formatter.getAndClearTemplatePropertyVars());let a="";if(this.choice.createFileIfItDoesntExist.createWithTemplate){let f=new lE(this.app,this.plugin,this.choice.createFileIfItDoesntExist.template,this.choiceExecutor);i?.enabled&&!i.requireActiveFile&&f.setLinkToCurrentFileBehavior("optional"),f.setTargetFolderPath(Wo(t)),f.setPromptRunContext({draftScopeId:`${this.choice.id}#${this.choice.createFileIfItDoesntExist.template}`,choiceName:this.choice.name,destination:t,destinationKind:"file"}),a=await f.run();let p=f.getAndClearTemplatePropertyVars();F.logMessage(`CaptureChoiceEngine: Collected ${p.size} template property variables`),p.size>0&&F.logMessage(`Variables: ${Array.from(p.keys()).join(", ")}`),this.templatePropertyVars=p}let l=await this.createFileWithInput(t,a,{suppressTemplaterOnCreate:this.choice.createFileIfItDoesntExist.createWithTemplate});this.choice.createFileIfItDoesntExist.createWithTemplate&&this.templatePropertyVars&&Rg(l,this.templatePropertyVars)&&await $g(this.app,l,this.templatePropertyVars),this.choice.createFileIfItDoesntExist.createWithTemplate&&a?await Qd(this.app,l):Hv(this.app)&&await k0(this.app,l);let c=await this.app.vault.read(l),u=await this.collectIfFrontmatter(()=>this.formatter.formatContentWithFile(s,this.choice,c,l));this.mergeCapturePropertyVars(this.formatter.getAndClearTemplatePropertyVars());let d=this.formatter.getCaptureInsertionEndOffset();return{file:l,newFileContent:u,captureContent:s,priorContent:c,cursorEndOffset:d??void 0,cursorPlacementSafe:!0}}async formatFilePath(t){let n=await this.formatter.formatFileName(t,"captureTarget");return this.normalizeCaptureFilePath(n)}normalizeCaptureFilePath(t){let n=li(this.stripLeadingSlash(t),"Capture target file path");if(Vi.test(n))throw new Ee(`Capture to '.base' files is not supported (${n}). Use a Template choice instead.`);let i=this.normalizeCaptureFilePathExtension(n);if(!Og(i).trim())throw new Ee(`Capture target file name is empty after formatting ('${i}'). Make sure the tokens in 'Capture to' produce a value.`);if(Vn(i))throw new Ee(`Refusing to capture to a file outside the vault: "${i}".`);return i}normalizeCaptureFilePathExtension(t){let n=t.match(ir)?.[0];if(n)return`${li(t.replace(ir,""),"Capture target file path")}${n}`;let i=t.match(Wr)?.[0];return i?`${li(t.replace(Wr,""),"Capture target file path")}${i}`:this.normalizeMarkdownFilePath("",t)}collectIfFrontmatter(t){return this.suppressFrontmatterCollection?t():this.formatter.withTemplatePropertyCollection(t)}mergeCapturePropertyVars(t){if(!(!t||t.size===0)){for(let[n,i]of t)this.capturePropertyVars.set(n,i);F.logMessage(`CaptureChoiceEngine: Accumulated ${this.capturePropertyVars.size} structured capture variables`)}}async applyCapturePropertyVars(t){return this.capturePropertyVars.size===0?!1:Rg(t,this.capturePropertyVars)?(F.logMessage(`CaptureChoiceEngine: Post-processing front matter with ${this.capturePropertyVars.size} capture variables`),await $g(this.app,t,this.capturePropertyVars),this.capturePropertyVars.clear(),!0):(this.capturePropertyVars.clear(),!1)}};oE();var xs=require("obsidian");Fo();Cr();zr();It();Wt();rm();var kN=require("obsidian");Tt();qc();qt();Cr();function ZK(r){let e=r.split("/").pop()??r,t=e.lastIndexOf(".");return t>0?e.slice(0,t):e}function SN(r){let e=new rd(ZK(r));return e.id=`folder-template:${r}`,e.templatePath=r,e.openFile=!0,e.fileNameFormat={enabled:!0,format:Rs},e.discoverExistingNotesBeforeCreate=!0,e}function DN(r){return Wi(r.settings.templateFolderPaths).length>0}function Xye(r,e){let t=r.lastIndexOf("/"),n=t===-1?"":r.slice(0,t),i=e.createDiv({cls:"suggestion-content"});i.createDiv({cls:"suggestion-title",text:ZK(r)}),n&&(e.classList.add("mod-complex"),i.createDiv({cls:"suggestion-note",text:n}))}async function Zye(r,e){let n=[...e].sort((i,o)=>i.path.localeCompare(o.path)).map(i=>i.path);try{return await Nr.Suggest(r,n,n,"New note from template",(i,o)=>Xye(i,o))}catch(i){if(Dt(i))return null;throw i}}async function HD(r,e,t){try{let n=t.templatePath?.trim()||void 0;if(!n){if(!DN(e)){new kN.Notice("QuickAdd: Set a template folder in Settings \u2192 QuickAdd \u2192 Templates & properties to use \u201CNew note from template\u201D.",8e3),fg(r,e.manifest.id,{notice:!1});return}let i=e.getTemplateFiles();if(i.length===0){new kN.Notice("QuickAdd: No template files found in your configured template folder(s).");return}let o=await Zye(r,i);if(!o)return;n=o}await t.choiceExecutor.execute(SN(n))}catch(n){if(Dt(n))return;lt(n,"Error running template from folder")}}Wt();pc();var Jye="\u2190 Back",ebe="Select a choice";function _E(r){return zs(r)?`QuickAdd couldn't read the contents of "${r.name}". They're still in data.json.`:`Folder "${r.name}" is empty.`}var tbe="Empty",rbe="Unreadable";function nbe(r){return IN(r)?zs(r)?rbe:tbe:""}var TE="quickadd:run-template-from-folder",ibe="New note from template\u2026",ev="quickadd:back";function IN(r){return r.type==="Multi"&&r.id!==ev&&st(r).length===0}var obe=.5;function sbe(r){return r.replace(/\[\[([^\]|]+)\|([^\]]+)\]\]/g,"$2").replace(/\[\[([^\]]+)\]\]/g,"$1").replace(/\[([^\]]*)\]\([^)]*\)/g,"$1").replace(/(\*\*|__)(.+?)\1/g,"$2").replace(/\*(.+?)\*/g,"$1").replace(/`([^`]+)`/g,"$1").replace(/~~(.+?)~~/g,"$1")}function PN(r){return(r.settings.templateFolderLauncherRow??"bottom")!=="off"&&DN(r)}function abe(){return{id:TE,name:ibe,type:"Template",command:!1}}var yf=class r extends xs.FuzzySuggestModal{constructor(t,n,i){super(t.app);this.plugin=t;this.choices=n;this.focusedProperty=null;this.triggerContext=null;this.placeholderStack=[];this.selectionDispatched=!1;this.breadcrumbById=new Map;this.markdownComponent=new xs.Component;this.warnRenderFailure=mp("Could not render a choice name as Markdown; showing it as plain text");if(this.choiceExecutor=i?.choiceExecutor??new Ri(this.app,this.plugin),this.focusedProperty=i&&"focusedProperty"in i?i.focusedProperty??null:OT(this.app),this.triggerContext=i&&"triggerContext"in i?i.triggerContext??null:{activeFile:this.app.workspace.getActiveFile()},this.placeholderStack=i?.placeholderStack??[],this.completion=i?.completion,this.currentPlaceholder=i?.placeholder?.trim()||ebe,this.setPlaceholder(this.currentPlaceholder),this.markdownComponent.load(),i?.includeTemplateFolderRow){let o=this.plugin.settings.templateFolderLauncherRow??"bottom";if(PN(this.plugin)){let s=abe();this.choices=o==="top"?[s,...this.choices]:[...this.choices,s]}}}static Open(t,n,i){new r(t,n,i).open()}onClose(){super.onClose(),this.markdownComponent.unload(),this.completion&&!this.selectionDispatched&&this.completion(rn())}getSuggestions(t){let n=t.trim();if(!n||!le.getState().searchNestedChoices)return super.getSuggestions(n);let i=(0,xs.prepareFuzzySearch)(n),o=[];for(let s of this.getNestedSearchCandidates()){let a=i(s.text);a&&(s.nameOffset>0&&a.matches.length>0&&a.matches.every(([,l])=>l<=s.nameOffset)&&(a.score-=obe),o.push({item:s.choice,match:a}))}return o.sort((s,a)=>a.match.score-s.match.score),o}getNestedSearchCandidates(){if(!this.nestedSearchCandidates){let t=this.choices.filter(n=>n.id!==ev&&n.id!==TE);this.nestedSearchCandidates=dy(t).map(({choice:n,path:i})=>{let o=i.slice(0,-1);o.length>0&&this.breadcrumbById.set(n.id,o.map(sbe).join(" / "));let s=i.join(" / ");return{choice:n,text:s,nameOffset:s.length-n.name.length}})}return this.nestedSearchCandidates}selectSuggestion(t,n){if(IN(t.item)){if("repeat"in n&&n.repeat)return;new xs.Notice(_E(t.item)),this.inputEl.focus();return}this.selectionDispatched=!0,super.selectSuggestion(t,n)}renderSuggestion(t,n){n.empty(),n.classList.remove("mod-complex");let i=this.breadcrumbById.get(t.item.id),o=n.createDiv({cls:"quickadd-choice-suggestion-content"});this.renderChoiceIcon(t.item,o);let s;if(i){n.classList.add("mod-complex");let c=o.createDiv({cls:"suggestion-content quickadd-choice-suggestion-text"});s=c.createDiv({cls:"suggestion-title"}),c.createDiv({cls:"suggestion-note",text:i})}else s=o.createDiv({cls:"quickadd-choice-suggestion-title quickadd-choice-suggestion-text"});xs.MarkdownRenderer.render(this.app,t.item.name,s,"",this.markdownComponent).catch(c=>{s.textContent=t.item.name,this.warnRenderFailure(c)}),n.classList.add("quickadd-choice-suggestion"),t.item.id===ev&&n.classList.add("quickadd-choice-suggestion-back"),t.item.id===TE&&n.classList.add("quickadd-choice-suggestion-run-template");let a=nbe(t.item),l=a!=="";if(n.classList.toggle("quickadd-choice-suggestion-empty",l),l){n.setAttribute("aria-disabled","true");let c=Hr(o,"span");c.classList.add("quickadd-choice-suggestion-empty-flair"),c.textContent=a,o.appendChild(c)}else n.removeAttribute("aria-disabled")}renderChoiceIcon(t,n){let i=this.getChoiceSuggestionIcon(t);if(!i)return;let o=Hr(n,"span");o.classList.add("quickadd-choice-icon"),o.setAttribute("aria-hidden","true"),n.appendChild(o),(0,xs.setIcon)(o,i)}getChoiceSuggestionIcon(t){if(t.id!==ev)return t.id===TE?"file-plus":bm(t)}getItemText(t){return t.name}getItems(){return this.choices}settleCompletion(t,n){t.then(()=>this.completion?.(),i=>{Zf(i,n),this.completion?.(i)})}onChooseItem(t,n){if(t.id===TE){this.settleCompletion(HD(this.app,this.plugin,{choiceExecutor:this.choiceExecutor}),"Could not run a template from that folder");return}if(t.type==="Multi")this.onChooseMultiType(t);else{let i=this.choiceExecutor.executeWithFocusedProperty?this.choiceExecutor.executeWithFocusedProperty(t,this.focusedProperty,this.triggerContext):this.choiceExecutor.execute(t);this.settleCompletion(i,`Could not run "${t.name}"`)}}onChooseMultiType(t){let n=t.id===ev;if(!n&&IN(t)){new xs.Notice(_E(t)),this.completion?.();return}let i=[...st(t)];if(!n){let a=new ng(Jye).addChoices(this.choices);a.id=ev,i.push(a)}let o=n?this.placeholderStack[this.placeholderStack.length-1]:t.placeholder?.trim()||t.name,s=n?this.placeholderStack.slice(0,-1):[...this.placeholderStack,this.currentPlaceholder];r.Open(this.plugin,i,{choiceExecutor:this.choiceExecutor,focusedProperty:this.focusedProperty,triggerContext:this.triggerContext,placeholder:o,placeholderStack:s,completion:this.completion})}};It();Tt();Ns();Me();lN();js();QP();var JK=require("obsidian");Cu();$m();Tt();Kr();Ii();qt();Me();zT();js();yl();Tt();$m();Ey();uh();yl();Py();ip();Ru();V1();js();var AE=class extends bl{constructor(t,n,i){super(t);this.app=t;this.plugin=n;this.choiceExecutor=i;this.requirements=new Map;this.templatesToScan=new Set;this.scannedTemplateRefDepths=new Map;this.scanningPathContext=!1;this.scanningScope="generic";this.scanningSoleValue=!1;this.dateParser=Tl,i&&(this.variables=new Map(i.variables))}warn(){}reportProblem(){}async scanString(t,n=!1,i="generic"){let o=this.scanningPathContext,s=this.scanningScope,a=this.scanningSoleValue;this.scanningPathContext=n,this.scanningScope=i,this.scanningSoleValue=I_(i,t);try{let l=await this.replaceGlobalVarInString(t);if(this.scanVariableTokens(l),this.scanDateTokens(l),this.scanFileTokens(l),n){if(new RegExp(cc.source,"i").test(l)){let c=this.requirements.get("value");c&&(c.pathContext=!0)}if(new RegExp(kT.source,"i").test(l)){let c=this.requirements.get("mvalue");c&&(c.pathContext=!0)}}await this.format(l)}finally{this.scanningPathContext=o,this.scanningScope=s,this.scanningSoleValue=a}}markScanContext(t){this.scanningPathContext&&(t.pathContext=!0)}async format(t){let n=t;n=await this.replaceGlobalVarInString(n),n=this.replaceDateInString(n),n=this.replaceTimeInString(n),n=await this.replaceValueInString(n),n=await this.replaceSelectedInString(n),n=await this.replaceClipboardInString(n),n=await this.replaceDateVariableInString(n),n=await this.replaceVariableInString(n),n=await this.replaceFieldVarInString(n),n=await this.replaceFileInString(n),n=await this.replaceMathValueInString(n),n=this.replaceRandomInString(n);{let i=new RegExp($s.source,"gi"),o;for(;(o=i.exec(n))!==null;){let s=o[1];s&&this.templatesToScan.add(s)}}return n}async replaceGlobalVarInString(t){let n=t,i=0,o=new RegExp(fl.source,"gi");for(;o.test(n)&&!(++i>5);)n=n.replace(o,(s,a)=>{let l=String(a??"").trim();if(!l)return s;let c=this.plugin?.settings?.globalVariables?.[l];return typeof c=="string"?c:""});return n}scanVariableTokens(t){let n=new RegExp(Hd.source,"gi"),i;for(;(i=n.exec(t))!==null;){let o=(i[1]??"").trim();if(!o)continue;let s=Dy(o,{warn:this.warnSink});if(!s)continue;let{variableName:a,variableKey:l,label:c,defaultValue:u,displayValues:d,hasOptions:f}=s;if(!a)continue;let p=f&&c?c:a,m=!f&&c?c:void 0,v=l;if(this.requirements.has(v)){let g=this.requirements.get(v);if(this.markScanContext(g),f&&!this.hasOptionList(g)&&(g.type=this.optionFieldType(s),g.label=p,this.applyOptionFields(g,s),g.defaultValue!==void 0&&!s.allowCustomInput)){let y=JP(g.defaultValue);g.defaultValue=s.suggestedValues.includes(y)?y:void 0}u&&g.defaultValue===void 0&&(g.defaultValue=u),!g.displayOptions&&d&&(g.displayOptions=d),g.optional=(g.optional??!1)&&s.optional}else{let g=!f&&s.inputTypeOverride==="checkbox",y=!f&&s.inputTypeOverride==="number",w=!f&&s.inputTypeOverride==="slider",x=s.inputTypeOverride==="multiline"||this.plugin.settings.inputPrompt==="multi-line"?"textarea":"text",C={id:v,label:p,type:f?this.optionFieldType(s):g?"dropdown":y?"number":w?"slider":x,description:m,optional:s.optional};f?this.applyOptionFields(C,s):g?C.options=["true","false"]:y?C.numericConfig=s.numericConfig:w&&(C.numericConfig=s.numericConfig,C.sliderConfig=s.sliderConfig),u&&(C.defaultValue=u),this.markScanContext(C),this.requirements.set(v,C)}}}optionFieldType(t){return t.allowCustomInput||t.multiSelect?"suggester":"dropdown"}hasOptionList(t){return Array.isArray(t.options)&&t.options.length>0}applyOptionFields(t,n){t.options=n.suggestedValues,n.displayValues&&(t.displayOptions=n.displayValues),n.multiSelect?t.multiEmit=n.multiEmit??"text":delete t.multiEmit,n.allowCustomInput||n.multiSelect?t.suggesterConfig={allowCustomInput:n.allowCustomInput,caseSensitive:!1,multiSelect:n.multiSelect??!1}:delete t.suggesterConfig}scanDateTokens(t){let n=new RegExp(gu.source,"gi"),i;for(;(i=n.exec(t))!==null;){let o=i[1]?.trim();if(!o)continue;let{defaultValue:s,optional:a,withTime:l}=Iy(i[3]),c=i[2]?.trim()||(l?"YYYY-MM-DD HH:mm":"YYYY-MM-DD"),u=this.requirements.get(o);u?(u.type==="date"&&s&&u.defaultValue===void 0&&(u.defaultValue=s),u.optional=(u.optional??!1)&&a,u.type==="date"&&l&&!u.withTime&&(u.withTime=!0,i[2]?.trim()||(u.dateFormat="YYYY-MM-DD HH:mm"))):this.requirements.set(o,{id:o,label:o,type:"date",defaultValue:s,dateFormat:c,withTime:l,optional:a,source:"collected"})}}async promptForValue(t){let n="value";if(!this.requirements.has(n)){let i=this.valuePromptContext?.inputTypeOverride==="checkbox",o=this.valuePromptContext?.inputTypeOverride==="number",s=this.valuePromptContext?.inputTypeOverride==="slider",a=F_(this.scanningScope,this.scanningSoleValue);this.requirements.set(n,{id:n,label:a.title||t||"Enter value",type:i?"dropdown":o?"number":s?"slider":this.valuePromptContext?.inputTypeOverride==="multiline"||this.plugin.settings.inputPrompt==="multi-line"?"textarea":"text",description:this.valuePromptContext?.description,placeholder:a.placeholder,defaultValue:this.valuePromptContext?.defaultValue,numericConfig:this.valuePromptContext?.numericConfig,sliderConfig:this.valuePromptContext?.sliderConfig,options:i?["true","false"]:void 0,source:"collected",optional:this.valuePromptContext?.optional})}return this.markScanContext(this.requirements.get(n)),""}async promptForVariable(t,n){if(!t)return"";let i=n?.variableKey??t;if(n?.type==="VDATE")return n.defaultValue??"@date:1970-01-01T00:00:00.000Z";if(!this.requirements.has(i)){let o=Ay(t).map(f=>f.trim()).filter(Boolean),s=o.length>1,a=!s&&n?.inputTypeOverride==="number",l=!s&&n?.inputTypeOverride==="slider",c=!s&&n?.inputTypeOverride==="checkbox",u=n?.inputTypeOverride==="multiline"||this.plugin.settings.inputPrompt==="multi-line"?"textarea":"text",d={id:i,label:t,type:s||c?"dropdown":a?"number":l?"slider":u,description:n?.description,numericConfig:n?.numericConfig,sliderConfig:n?.sliderConfig,source:"collected"};s?d.options=o:c&&(d.options=["true","false"]),n?.defaultValue&&(d.defaultValue=n.defaultValue),this.requirements.set(i,d)}return this.markScanContext(this.requirements.get(i)),n?.defaultValue??""}async promptForMathValue(){let t="mvalue";return this.requirements.has(t)||this.requirements.set(t,{id:t,label:"Math expression",type:"text",placeholder:"e.g., 2+2*3"}),this.markScanContext(this.requirements.get(t)),""}async suggestForField(t){let n=Yi.parse(t),i=`${jd}${t}`;if(!this.requirements.has(i)){let o={id:i,label:n.fieldName||t,type:"field-suggest",source:"collected",runtimeOnly:n.multiSelect};if(!n.multiSelect&&n.filters.defaultFrom==="active"){let s=cD(this.app,this.choiceExecutor?.triggerContext?.activeFile??null,n.fieldName),a=(typeof s=="string"?s:void 0)??n.filters.defaultValue;a!==void 0&&(o.defaultValue=a)}this.requirements.set(i,o)}return""}scanFileTokens(t){let n=new RegExp(AT.source,"gi"),i;for(;(i=n.exec(t))!==null;){let o=D_(i[1]??"");o&&this.recordFileRequirement(o)}}recordFileRequirement(t){let n=t.variableKey,i=this.requirements.get(n);if(i){i.optional=(i.optional??!1)&&t.optional,i.type="file-picker",i.suggesterConfig={allowCustomInput:(i.suggesterConfig?.allowCustomInput??!1)||t.allowCustomInput,caseSensitive:!1,multiSelect:(i.suggesterConfig?.multiSelect??!1)||t.multiSelect};return}let o=zi.filterFiles(this.app.vault.getMarkdownFiles(),t.filter,u=>this.app.metadataCache.getFileCache(u)),s=o.map(u=>`${vl}${u.path}`),a=Ec(o,u=>this.app.metadataCache.getFileCache(u)),l=t.allowCustomInput||s.length===0,c=t.mode==="name"?`File from ${t.folderPath}`:`File from ${t.folderPath} (${t.mode})`;this.requirements.set(n,{id:n,label:t.label??c,type:"file-picker",source:"collected",options:s,displayOptions:a,optional:t.optional,suggesterConfig:{allowCustomInput:l,caseSensitive:!1,multiSelect:t.multiSelect}})}suggestForFile(t){return""}async suggestForValue(t,n,i){return""}getVariableValue(t){return""}async getTemplateContent(t){return""}async getSelectedText(){return""}async getClipboardContent(){return""}getCurrentFileLink(){return null}getCurrentFileName(){return null}async getMacroValue(t,n){return""}isTemplatePropertyTypesEnabled(){return!1}};Ey();var lbe=["text","number","textarea","dropdown","slider","date","field-suggest","file-picker","suggester"];function cbe(r){return typeof r=="string"&&lbe.includes(r)}function ube(r){if(!r||typeof r!="object")return null;let e=r,t=e.id,n=e.type;if(typeof t!="string"||!cbe(n))return null;let i=dbe(e.numericConfig),o=pbe(e.sliderConfig),s=n==="slider"&&!o?"number":n;return{id:t,label:typeof e.label=="string"?e.label:t,type:s,placeholder:typeof e.placeholder=="string"?e.placeholder:void 0,defaultValue:typeof e.defaultValue=="string"?e.defaultValue:void 0,numericConfig:o??i,sliderConfig:o,options:Array.isArray(e.options)?e.options.filter(a=>typeof a=="string"):void 0,dateFormat:typeof e.dateFormat=="string"?e.dateFormat:void 0,description:typeof e.description=="string"?e.description:void 0,optional:typeof e.optional=="boolean"?e.optional:void 0,source:"script"}}function dbe(r){if(!r||typeof r!="object")return;let e=r,t=typeof e.min=="number"&&Number.isFinite(e.min)?e.min:void 0,n=typeof e.max=="number"&&Number.isFinite(e.max)?e.max:void 0,i=typeof e.step=="number"&&Number.isFinite(e.step)&&e.step>0?e.step:void 0;if(t!==void 0&&n!==void 0&&n<t)return i===void 0?void 0:{step:i};let o={};return t!==void 0&&(o.min=t),n!==void 0&&(o.max=n),i!==void 0&&(o.step=i),Object.keys(o).length>0?o:void 0}function pbe(r){if(!r||typeof r!="object")return;let e=r,t=typeof e.min=="number"?e.min:void 0,n=typeof e.max=="number"?e.max:void 0,i=e.step===void 0?1:typeof e.step=="number"?e.step:void 0;if(!(t===void 0||n===void 0||i===void 0||!Number.isFinite(t)||!Number.isFinite(n)||!Number.isFinite(i)||n<=t||i<=0))return{min:t,max:n,step:i}}function fbe(r){let e=t=>{if(!t||typeof t!="object"&&typeof t!="function")return[];let n=t.quickadd;if(!n||typeof n!="object")return[];let i=n.inputs;return Array.isArray(i)?i:[]};return e(r)}async function e7(r,e){let t=fo(r,e);return t?await r.vault.cachedRead(t):""}function mbe(r){let e=new Set,t=new RegExp($s.source,"gi"),n;for(;(n=t.exec(r))!==null;)n[1]&&e.add(n[1]);return e}async function yd(r,e,t,n=new Set,i=0,o="generic"){let s=P_(o),a=mbe(t);e.templatesToScan.clear(),await e.scanString(t,s,o);let l=[...e.templatesToScan].filter(c=>a.has(c));if(e.templatesToScan.clear(),!(i>=Y_))for(let c of l){if(n.has(c))continue;let u=`${s?"path":"content"}:${c}`,d=e.scannedTemplateRefDepths.get(u);if(!(d!==void 0&&d<=i)){e.scannedTemplateRefDepths.set(u,i),n.add(c);try{await yd(r,e,await e7(r,c),n,i+1,o)}finally{n.delete(c)}}}}async function t7(r,e,t){if(await e.scanString(t,!0,"templatePath"),_u(t)){F.logMessage(`Preflight: template path "${t}" uses format syntax; its body's prompts are collected at run time, not in the one-page form.`);return}await yd(r,e,await e7(r,t),new Set([t]),0,"noteBody")}async function hbe(r,e,t,n){let i=new AE(r,e,t);if(n.fileNameFormat?.enabled&&await yd(r,i,n.fileNameFormat.format,void 0,0,"noteTitle"),n.folder?.enabled)for(let o of n.folder.folders??[])await yd(r,i,o,void 0,0,"folder");return n.templatePath&&await t7(r,i,n.templatePath),i}function gbe(r){let e=Nn(r);return e?e.editor.getSelection():""}async function vbe(r,e,t,n,i){let o=new AE(r,e,t);await yd(r,o,n.captureTo,void 0,0,"captureTarget"),n.format?.enabled&&await yd(r,o,n.format.format,void 0,0,"captureText"),n.insertAfter?.enabled&&!n.insertAfter.promptHeading&&await yd(r,o,n.insertAfter.after,void 0,0,"lineTarget"),n.insertBefore?.enabled&&await yd(r,o,n.insertBefore.before,void 0,0,"lineTarget");let s=n.createFileIfItDoesntExist;s?.enabled&&s.createWithTemplate&&s.template&&await t7(r,o,s.template);let a=qD({isFolder:l=>im(r,l),markdownFileExists:l=>r.vault.getAbstractFileByPath(VD(l))instanceof JK.TFile},n.captureTo??"",n.captureToActiveFile);if(a){let l=[];switch(a.kind){case"property":l=sm(r,a.field,a.value,a.filter);break;case"filter":l=om(r,a.filter);break;case"tag":l=Jv(r,a.tag);break;case"folder":l=rs(r,a.folderPathSlash);break}let c=mf(l,hf(r)),u=c.map(p=>p.path),d=Ec(c,p=>r.metadataCache?.getFileCache(p)??null),f=n.createFileIfItDoesntExist?.enabled??!1;u.length===0&&f?o.requirements.set(Gd,{id:Gd,label:"Select capture target file",type:"file-picker",source:"collected",options:u,displayOptions:d,runtimeOnly:!0,placeholder:"Type a new note name in the capture target picker"}):o.requirements.set(Gd,{id:Gd,label:"Select capture target file",type:"dropdown",options:u,displayOptions:d,placeholder:u.length?void 0:"No files found in target scope"})}if(i){let l=n.useSelectionAsCaptureValue,c=e.settings.useSelectionAsCaptureValue??!0;if(typeof l=="boolean"?l:c){let d=t.variables.get("value");if(d==null){let f=gbe(r);f.trim().length>0&&t.variables.set("value",f)}}}return o}async function ybe(r,e,t){let n=[],i=Dr(e?.macro?.commands);for(let o of i){if(o?.type!=="UserScript")continue;let s=o;try{let a=WT(s),l=a!==void 0?t?.get(a):void 0;l===void 0&&(l=await ka(s,r,{reportLoadErrors:!1}),a!==void 0&&l!==void 0&&t?.set(a,l));let c=fbe(l);for(let u of c){let d=ube(u);d&&n.push(d)}}catch(a){let l=s.path??s.id,c=a instanceof Error?a.message:String(a);if(VB(a)){F.logMessage(`QuickAdd preflight could not inspect user script '${l}': ${c}`);continue}F.logWarning(`Preflight could not inspect user script '${l}': ${c}`)}}return n}async function kE(r,e,t,n,i){let o=null,s=[];if(n.type==="Template")o=await hbe(r,e,t,n);else if(n.type==="Capture")o=await vbe(r,e,t,n,i?.seedCaptureSelectionAsValue??!1);else if(n.type==="Macro")s=await ybe(r,n,i?.preloadedUserScripts);else return[];let a=new Map;for(let l of o?Array.from(o.requirements.values()):[])a.set(l.id,l);for(let l of s)a.has(l.id)||a.set(l.id,l);return Array.from(a.values())}function SE(r,e){return r.filter(t=>{let n=j_(e,t.id);return n?e.get(n)==null:!0})}function r7(r,e){let t=r.trim();if(!t)return[];let n=Array.from(e.keys()).sort((s,a)=>a.length-s.length),i=[],o=t;for(;o.length>0;){let s=n.find(a=>o===a||o.startsWith(`${a}, `));if(!s)break;i.push(s),o=o===s?"":o.slice(s.length+2)}if(o.length>0)for(let s of o.split(",")){let a=s.trim();a&&i.push(a)}return i}function bbe(r,e,t){let n=r.filter(o=>t||e.includes(o)),i=new Set(n);return[...e.filter(o=>i.has(o)),...n.filter((o,s)=>!e.includes(o)&&n.indexOf(o)===s)]}function wbe(r,e){if(r.type!=="Template"||e!=="value")return!1;let t=r,n=t.fileNameFormat?.enabled?t.fileNameFormat.format:Rs;return WR(t,n)}async function n7(r,e,t,n){try{let i=await kE(r,e,t,n,{seedCaptureSelectionAsValue:!0,preloadedUserScripts:t.preloadedUserScripts});if(i.length===0)return!1;let o=SE(i,t.variables);if(o.length===0)return!1;let s=o.filter(p=>!p.runtimeOnly&&!wbe(n,p.id));if(s.length===0)return!1;let a=async p=>{try{let m=new hh(r,e),v=[];if(n.type==="Template"){let g=n;if(g.fileNameFormat?.enabled){m.setTargetFolderPath(zA(g.folder)??"Folder/Name");for(let[y,w]of Object.entries(p))m.variables.set(y,w);v.push({label:"File name",text:await m.format(g.fileNameFormat.format),diagnostics:m.diagnostics.list()})}}return v}catch{return[]}},l=t.promptProvider,c=null,u;l?u=await l.requestInputs(s):(c=new zg(r,s,t.variables,a),u=await c.waitForClose);let d=new Map,f=new Map;for(let p of s){if(p.id.startsWith(Cy)){let m=p.options??[],v=p.displayOptions??m;d.set(p.id,{options:m,displayToValue:new Map(m.map((g,y)=>[(v[y]??g).trim(),g])),allowCustom:p.suggesterConfig?.allowCustomInput??!1,multiSelect:p.suggesterConfig?.multiSelect??!1})}if(p.suggesterConfig?.multiSelect&&!p.id.startsWith(Cy)){let m=p.options??[],v=p.displayOptions??m,g=new Map;m.forEach((y,w)=>{g.set((v[w]??y).trim(),y)}),f.set(p.id,{emit:p.multiEmit??"text",allowCustom:p.suggesterConfig.allowCustomInput??!1,displayToValue:g})}}return Object.entries(u).forEach(([p,m])=>{let v=d.get(p);if(v!==void 0){let w=c?.fileSelections.get(p)??(Array.isArray(m)?m.map(String):void 0)??(v.multiSelect?r7(String(m),v.displayToValue).map(_=>v.displayToValue.get(_)??_):[String(m)]),C=bbe(w,v.options,v.allowCustom).map(_=>DV(_,v.options));t.variables.set(p,v.multiSelect?C:C[0]??"");return}let g=f.get(p);if(g!==void 0){let w=(c?.multiSelections.get(p)??r7(String(m),g.displayToValue)).filter(x=>g.allowCustom||g.displayToValue.has(x)).map(x=>g.displayToValue.get(x)??x);t.variables.set(p,g.emit==="linklist"?w.map(W_):w);return}t.variables.set(p,m)}),!0}catch(i){if(i instanceof Nt)throw i;return t.promptProvider||F.logWarning(`One-page input failed for choice "${n.name}"; falling back to step-by-step prompts: ${i instanceof Error?i.message:String(i)}`),!1}}Ns();Co();zr();Cr();qt();Em();rm();Wt();var Ri=class{constructor(e,t){this.app=e;this.plugin=t;this.variables=new Map;this.interactive=!0;this.preloadedUserScripts=new Map;this.focusedProperty=null;this.triggerContext=null;this.pendingAbort=null;this.pendingResult=null;this.executionDepth=0}signalAbort(e){this.pendingAbort=e}consumeAbortSignal(){let e=this.pendingAbort;return this.pendingAbort=null,e??null}recordExecutionResult(e){this.pendingResult=e}beginExecutionContext(){this.executionDepth===0&&(this.focusedProperty=this.focusedPropertyOverride!==void 0?this.focusedPropertyOverride:OT(this.app),this.triggerContext=this.triggerContextOverride!==void 0?this.triggerContextOverride:{activeFile:this.app.workspace.getActiveFile()}),this.executionDepth++}endExecutionContext(){this.executionDepth=Math.max(0,this.executionDepth-1),this.executionDepth===0&&(this.focusedProperty=null,this.triggerContext=null,this.preloadedUserScripts.clear())}async execute(e){this.pendingAbort=null;let t=this.pendingResult;this.beginExecutionContext();let n=Xv(this.app),i=Gi.getInstance();i.beginExecutionScope();try{switch(await this.runOnePagePreflightIfEnabled(e),e.type){case"Template":{let o=e;await this.onChooseTemplateType(o,n);break}case"Capture":{let o=e;await this.onChooseCaptureType(o,n);break}case"Macro":{let o=e;await this.onChooseMacroType(o,n);break}case"Multi":{let o=e;await this.onChooseMultiType(o);break}default:break}if(this.pendingAbort){i.rollbackExecutionScope();return}i.commitExecutionScope()}catch(o){throw i.rollbackExecutionScope(),o}finally{this.pendingResult=t,this.endExecutionContext()}}async executeWithFocusedProperty(e,t,n){let i=this.focusedPropertyOverride,o=this.triggerContextOverride;this.focusedPropertyOverride=t,this.triggerContextOverride=n;try{await this.execute(e)}finally{this.focusedPropertyOverride=i,this.triggerContextOverride=o}}async executeWithOutcome(e){this.pendingAbort=null,this.pendingResult=null,this.beginExecutionContext();let t=Xv(this.app),n=Gi.getInstance();n.beginExecutionScope();try{if(await this.runOnePagePreflightIfEnabled(e),e.type==="Template"?await this.onChooseTemplateType(e,t):await this.onChooseCaptureType(e,t),this.pendingAbort){n.rollbackExecutionScope();let o=this.consumeAbortSignal(),s=o instanceof St;return{status:"cancelled",cancelKind:s?"user":"aborted",reason:s?void 0:o?.message}}n.commitExecutionScope();let i=this.pendingResult;return this.pendingResult=null,i??{status:"error"}}catch(i){return n.rollbackExecutionScope(),i instanceof St?{status:"cancelled",cancelKind:"user"}:i instanceof Nt?{status:"cancelled",cancelKind:"aborted",reason:i.message}:(lt(i,"Error executing choice from URI"),{status:"error",reason:i instanceof Error?i.message:String(i)})}finally{this.endExecutionContext()}}async runOnePagePreflightIfEnabled(e){let t=le.getState().onePageInputEnabled,n=e.onePageInput,i=this.promptProvider!=null;if((n==="always"||n!=="never"&&(t||i))&&(e.type==="Template"||e.type==="Capture"||e.type==="Macro"))try{await n7(this.app,this.plugin,this,e)}catch(s){throw Dt(s)?new St("One-page input cancelled by user"):s}}async onChooseTemplateType(e,t){await new RD(this.app,this.plugin,e,this,t).run()}async onChooseCaptureType(e,t){await new zD(this.app,this.plugin,e,this,t).run()}async onChooseMacroType(e,t){let n=new Vl(this.app,this.plugin,e,this,this.variables,this.preloadedUserScripts,void 0,t);await n.run(),Object.entries(n.params.variables).forEach(([i,o])=>{this.variables.set(i,o)})}async onChooseMultiType(e){let t=st(e);if(this.promptProvider||this.interactive===!1){let n=this.promptProvider?"Run one of its choices directly.":"Run one of its choices directly, or re-run with the ui flag.";this.signalAbort(new Ee(t.length===0?_E(e):`"${e.name}" is a folder of choices, and picking from it needs someone at the window. ${n}`));return}if(t.length===0){new i7.Notice(_E(e));return}await new Promise((n,i)=>{yf.Open(this.plugin,t,{choiceExecutor:this,focusedProperty:this.focusedProperty,triggerContext:this.triggerContext,placeholder:e.placeholder?.trim()||e.name,completion:o=>o===void 0?n():i(o)})})}};qt();var o7=require("obsidian");var Cbe="QuickAdd: No choices yet. Create your first one in Settings \u2192 QuickAdd.";function FN(r){let e=Array.isArray(r.settings.choices)?r.settings.choices:[];if(!(e.length>0||PN(r))){new o7.Notice(Cbe,8e3),fg(r.app,r.manifest.id,{notice:!1});return}yf.Open(r,e,{includeTemplateFolderRow:!0})}uN();Me();Me();qt();var s7={description:"Use QuickAdd template folder instead of Obsidian templates plugin folder / Templater templates folder.",migrate:async r=>{try{let e=r.app.plugins.plugins.templater,t=r.app.internalPlugins.plugins.templates;if(!e&&!t){F.logMessage("No template plugin found. Skipping migration.");return}let n=[];if(t){let s=t.instance.options;s.folder&&(n.push(s.folder),F.logMessage("Migrated template folder path to Obsidian Templates' setting."))}if(e){let s=e.settings;s.template_folder&&(n.push(s.template_folder),F.logMessage("Migrated template folder path to Templaters setting."))}let i=Wi(r.settings.templateFolderPaths),o=Wi([...i,...n]);o.length>0&&(r.settings.templateFolderPaths=o)}catch(e){throw F.logError("Failed to migrate template folder path."),e}}};yi();function jD(r){return r===null||typeof r!="object"||!("type"in r)||!("choices"in r)?!1:r.type==="Multi"&&Array.isArray(r.choices)}function GD(r){return r===null||typeof r!="object"||!("choice"in r)?!1:r.choice!==void 0}Wt();Ii();function a7(r){return typeof r=="object"&&r!==null&&"type"in r&&r.type==="Template"&&"incrementFileName"in r}function l7(r){for(let e of r)jD(e)&&(e.choices=l7(e.choices)),a7(e)&&(e.setFileExistsBehavior=!0,e.fileExistsMode="Increment the file name",delete e.incrementFileName);return r}function xbe(r){for(let e of r)for(let t of Dr(zn(e)))GD(t)&&a7(t.choice)&&(t.choice.setFileExistsBehavior=!0,t.choice.fileExistsMode="Increment the file name",delete t.choice.incrementFileName);return r}var Ebe={description:"'Increment file name' setting moved to 'Set default behavior if file already exists' setting",migrate:async r=>{let e=r.settings,t=!vm(r.settings.choices)&&!Di(e.macros);if(Array.isArray(r.settings.choices)){let o=gt(r.settings.choices);r.settings.choices=gt(l7(o))}let n=gt(Fh(e.macros)),i=xbe(n);if(Array.isArray(e.macros)&&(e.macros=i),!t)return{complete:!1}}},c7=Ebe;yi();function u7(r){return typeof r=="object"&&r!==null&&"type"in r&&r.type==="Template"}function Tbe(r){return r.fileExistsBehavior?r.fileExistsBehavior:r.setFileExistsBehavior?{kind:"apply",mode:Wj(r.fileExistsMode)??"increment"}:r.incrementFileName?{kind:"apply",mode:"increment"}:{kind:"prompt"}}function d7(r){r.fileExistsBehavior=Tbe(r),delete r.incrementFileName,delete r.setFileExistsBehavior,delete r.fileExistsMode}var _be={description:"Re-run template file collision normalization for users with older migration state",migrate:async r=>{let e=r.settings,t=!cg(e);if(Array.isArray(r.settings.choices)&&(r.settings.choices=gt(r.settings.choices)),Array.isArray(e.macros)&&(e.macros=gt(e.macros)),ug(r,n=>{u7(n)&&d7(n)}),!t)return{complete:!1}}},YD=_be;var Abe={description:"Repair template file collision settings that may have been left in legacy format",migrate:YD.migrate},p7=Abe;Wt();function MN(r){return Ye(r)&&r.type==="Capture"}yi();Wt();Ii();function f7(r){for(let e of r)jD(e)&&(e.choices=f7(e.choices)),MN(e)&&e.insertAfter?.enabled&&e.prepend&&(e.prepend=!1);return r}function kbe(r){for(let e of r)for(let t of Dr(zn(e)))GD(t)&&MN(t.choice)&&t.choice.insertAfter?.enabled&&t.choice.prepend&&(t.choice.prepend=!1);return r}var Sbe={description:"Mutual exclusion of insertAfter and writeToBottomOfFile settings. If insertAfter is enabled, writeToBottomOfFile is disabled. To support changes in settings UI.",migrate:async r=>{let e=r.settings,t=!vm(r.settings.choices)&&!Di(e.macros);if(Array.isArray(r.settings.choices)){let o=gt(r.settings.choices);r.settings.choices=f7(o)}let n=gt(Fh(e.macros)),i=kbe(n);if(Array.isArray(e.macros)&&(e.macros=i),!t)return{complete:!1}}},m7=Sbe;It();var Dbe={description:"Set version to the current plugin version.",migrate:async r=>{le.setState({version:r.manifest.version})}},h7=Dbe;es();It();yi();var Ibe={description:"Add default AI providers to the settings.",migrate:async r=>{let e=le.getState().ai,t=gt(CT);if("OpenAIApiKey"in e&&typeof e.OpenAIApiKey=="string"){let n=t.find(i=>i.name==="OpenAI");n&&(n.apiKey=e.OpenAIApiKey)}"OpenAIApiKey"in e&&delete e.OpenAIApiKey,le.setState({ai:{...le.getState().ai,providers:t}})}},g7=Ibe;Me();Wt();Ii();var Pbe={description:"Remove macro indirection - embed macros directly in macro choices",migrate:async r=>{let e=r.settings;if(vm(e.choices))return F.logMessage("QuickAdd could not read part of the choice list, so legacy macros were left in place to be migrated later."),{complete:!1};if(!Array.isArray(e.choices))return F.logMessage("QuickAdd could not read the choice list, so legacy macros were left in place to be migrated later."),{complete:!1};if(Di(e.macros))return F.logMessage("QuickAdd could not read the legacy macro list, so it was left in place to be migrated later."),{complete:!1};let t=Fh(e.macros),n=new Map,i=Un(e.choices);for(let o of i)if(o.type==="Macro"){let s=o;if(s.macroId){let a=s.macroId;n.has(a)||n.set(a,[]),n.get(a).push(s)}}for(let o of t){if(!o||typeof o!="object"||typeof o.id!="string"||o.id==="")continue;let s=n.get(o.id)??i.filter(a=>a.type==="Macro"&&a.macro?.id===o.id);if(s.length===0){let a=new rg(o.name);a.macro={id:o.id,name:o.name,commands:o.commands||[]},a.runOnStartup=o.runOnStartup||!1,e.choices.push(a)}else for(let a of s)a.macro={id:o.id,name:o.name,commands:o.commands||[]},a.runOnStartup??(a.runOnStartup=o.runOnStartup??!1),delete a.macroId}for(let o of i)if(o.type==="Macro"){let s=o;s.macroId&&(F.logMessage(`Removing orphaned macroId reference: ${s.macroId}`),delete s.macroId)}"macros"in e&&delete e.macros}},v7=Pbe;Me();function KD(r){if(r==null)return null;if(typeof r=="boolean")return{enabled:r};if(typeof r!="object")return null;let e=r;return{enabled:typeof e.enabled=="boolean"?e.enabled:void 0,direction:e.direction==="horizontal"||e.direction==="vertical"?e.direction:void 0,focus:typeof e.focus=="boolean"?e.focus:void 0}}function QD(r,e){let t=r.direction==="horizontal"?"horizontal":"vertical",n=typeof e=="string"&&e!=="default"?e:"default";return pn({location:r.enabled?"split":"tab",direction:t,focus:r.focus??!0,mode:n})}var Fbe={description:"Migrate legacy openFileInNewTab settings to new fileOpening format",migrate:async r=>{F.logMessage("Starting migration of file opening settings...");let e=cg(r.settings),t=0;if(ug(r,i=>{if(i.type!=="Template"&&i.type!=="Capture")return;let o=i,s=o.openFileInNewTab,a=o.openFileInMode,l=KD(s);if(!o.fileOpening&&l){let c={enabled:l?.enabled??!1,direction:l?.direction??"vertical",focus:l?.focus??!0};o.fileOpening=QD(c,a??"default"),t++,F.logMessage(`Migrated file opening settings for choice: ${i.name}`)}}),F.logMessage(`Migration complete. Migrated ${t} choices.`),e)return{complete:!1}}},y7=Fbe;Me();var Mbe={description:"Backfill missing file opening defaults for older choices",migrate:async r=>{F.logMessage("Starting file opening defaults backfill...");let e=cg(r.settings),t=0;if(ug(r,i=>{if(i.type!=="Template"&&i.type!=="Capture")return;let o=i,s=typeof o.fileOpening=="object"&&o.fileOpening!==null?o.fileOpening:void 0,a=o,l=a.openFileInNewTab,c=a.openFileInMode,u=KD(l);(!s||s.location==null||s.direction==null||s.mode==null||s.focus==null)&&(!s&&u?o.fileOpening=QD(u,c):o.fileOpening=pn(s),t++)}),F.logMessage(`File opening defaults backfill complete. Updated ${t} choice(s).`),e)return{complete:!1}}},b7=Mbe;It();yi();var Rbe={description:"Ensure every AI provider has a discovery mode so browsing works without models.dev",migrate:async r=>{let t=le.getState().ai.providers??[],n=!1;for(let i of t)i.modelSource||(i.modelSource="auto",n=!0);n&&le.setState(i=>({...i,ai:{...i.ai,providers:gt(t)}}))}},w7=Rbe;yi();Me();It();yi();Kp();var $be={description:"Move AI provider API keys into Obsidian SecretStorage",migrate:async r=>{let e=le.getState().ai.providers??[],t=()=>e.some(o=>(o.apiKey?.trim()??"")!==""),n=r.app?.secretStorage;if(!n?.getSecret||!n?.setSecret)return t()?(F.logWarning("SecretStorage unavailable; deferring AI provider API key migration until it is available."),{complete:!1}):void 0;let i=!1;for(let o of e){let s=o.apiKey?.trim(),a=o.apiKeyRef?.trim();if(a){try{let l=await Promise.resolve(n.getSecret(a));!l&&s?(await Promise.resolve(n.setSecret(a,s)),o.apiKey="",i=!0):l&&s&&(o.apiKey="",i=!0)}catch(l){F.logWarning(`Failed to migrate secret for ${o.name}: ${l.message??l}`)}continue}if(s)try{let l=await PY(r.app,o,s);l&&(o.apiKeyRef=l,o.apiKey="",i=!0)}catch(l){F.logWarning(`Failed to store API key for ${o.name}: ${l.message??l}`)}}if(i&&le.setState(o=>({...o,ai:{...o.ai,providers:gt(e)}})),t())return{complete:!1}}},C7=$be;qt();var x7={description:"Move the single template folder path into the multi-folder list.",migrate:async r=>{let e=r.settings,t=Wi(e.templateFolderPaths);t.length>0?e.templateFolderPaths=t:e.templateFolderPaths=Wi([e.templateFolderPath]),delete e.templateFolderPath}};es();Kr();It();yi();Me();function Obe(r){for(let e of[r,`https://${r}`])try{let t=new URL(e).hostname.toLowerCase();if(t)return t}catch{}return""}function Nbe(r){let e=Obe(r.endpoint??"");return e==="api.openai.com"?"openai":e==="generativelanguage.googleapis.com"?"google":e==="api.anthropic.com"?"anthropic":null}function Lbe(r,e,t){let n=new Set(e==="anthropic"?[]:B2[e]);r.models=r.models.filter(o=>!n.has(o.name));let i=new Map(r.models.map(o=>[o.name,o]));for(let o of Lv[e]){let s=i.get(o.name);s?(s.maxTokens=o.maxTokens,s.maxOutputTokens=o.maxOutputTokens,s.supportsTemperature=o.supportsTemperature):t.has(o.name)||r.models.push({...o})}}var Bbe={temperature:1,top_p:1,frequency_penalty:0,presence_penalty:0};function Ube(r){return r.type==="AIAssistant"}var Vbe={description:"Refresh built-in AI provider model lists: drop retired models, add the current generation, and turn on auto-sync.",migrate:async r=>{let e=le.getState(),t=gt(e.ai.providers??[]),n=gt(e.choices??[]),i=new Set;for(let l of t){let c=Nbe(l);if(!c)continue;let u=new Set(t.filter(p=>p!==l).flatMap(p=>p.models.map(m=>m.name))),d=l.models.map(p=>p.name);Lbe(l,c,u);let f=new Set(l.models.map(p=>p.name));for(let p of d)f.has(p)||i.add(p);l.autoSyncModels=!0,c==="openai"&&(l.modelSource="modelsDev")}let o=new Set(t.flatMap(l=>l.models.map(c=>c.name))),s=new Set([...i].filter(l=>!o.has(l)));gS({choices:n},l=>{if(!Ube(l))return;l.model&&s.has(l.model)&&(F.logMessage(`AI command "${l.name}" used ${l.model}, which its provider has retired. It now asks for a model when it runs.`),l.model="Ask me");let c=l.modelParameters;if(c&&typeof c=="object")for(let[u,d]of Object.entries(Bbe))c[u]===d&&delete c[u]});let a=s.has(e.ai.defaultModel)?"Ask me":e.ai.defaultModel;le.setState({choices:n,ai:{...le.getState().ai,defaultModel:a,providers:t}})}},E7=Vbe;es();It();yi();Me();function qbe(r,e){return r.find(t=>t.models.some(n=>n.name===e))}var Wbe={description:"Pin AI commands' models to the provider they currently resolve to, and give every provider a stable id.",migrate:async r=>{let e=le.getState(),t=gt(e.ai.providers??[]),n=gt(e.choices??[]);bT(t),vS(n,t,(s,a)=>{F.logMessage(`Pinned AI command "${s.name}"'s model to ${a.providerId}/${a.name}.`)});let i,o=e.ai.defaultModel;if(e.ai.defaultModelRef&&e.ai.defaultModelRef.name===o)i=e.ai.defaultModelRef;else if(o&&o!=="Ask me"){let s=qbe(t,o);s?.id&&(i={providerId:s.id,name:o},F.logMessage(`Pinned the default model to ${s.id}/${o}.`))}le.setState({choices:n,ai:{...le.getState().ai,providers:t,...i?{defaultModelRef:i}:{}}})}},T7=Wbe;It();var RN={useQuickAddTemplateFolder:s7,incrementFileNameSettingMoveToDefaultBehavior:c7,consolidateFileExistsBehavior:YD,repairTemplateFileExistsBehavior:p7,mutualExclusionInsertAfterAndWriteToBottomOfFile:m7,setVersionAfterUpdateModalRelease:h7,addDefaultAIProviders:g7,removeMacroIndirection:v7,migrateFileOpeningSettings:y7,backfillFileOpeningDefaults:b7,setProviderModelDiscoveryMode:w7,migrateProviderApiKeysToSecretStorage:C7,migrateToMultipleTemplateFolders:x7,refreshStaleDefaultModelSeeds:E7,pinAiModelRefs:T7};async function zbe(r){let e=Object.keys(RN).filter(t=>!r.settings.migrations[t]);if(e.length===0){F.logMessage("No migrations to run.");return}le.replaceState(gt(r.settings));for(let t of e){F.logMessage(`Running migration ${t}: ${RN[t].description}`);let n=gt(r.settings),i=le.getState();try{let o=await RN[t].migrate(r);le.getState()!==i&&(r.settings=gt(le.getState()));let s=o?.complete===!1;s||(r.settings.migrations[t]=!0),le.replaceState(gt(r.settings)),F.logMessage(s?`Migration ${t} incomplete; will retry on a later launch.`:`Migration ${t} successful.`)}catch(o){F.logError(`Migration '${t}' was unsuccessful. Please create an issue with the following error message:
|
||
|
||
${o}
|
||
|
||
QuickAdd will now revert to backup.`),r.settings=n,le.replaceState(gt(r.settings))}}r.saveSettings()}var _7=zbe;It();var zl=require("obsidian");Me();async function Hbe(r,e,t){let n=await(0,zl.requestUrl)({url:`https://api.github.com/repos/${r}/${e}/releases`,throw:!1}),i=n.json;if(n.status>=400||!Array.isArray(i)){let a=typeof i=="object"&&i!==null&&"message"in i&&typeof i.message=="string"?i.message:"Unknown error";throw new Error(`Failed to fetch releases: ${a}`)}let o=i,s=o.findIndex(a=>a.tag_name===t);if(s===-1)throw new Error(`Could not find release with tag ${t}`);return o.slice(0,s).filter(a=>!a.draft&&!a.prerelease)}var $N=/^https:\/\/github\.com\/user-attachments\/assets\/[A-Za-z0-9-]+$/,A7=/^\[!\[[^\]]*\]\(([^)\s"]+)\)\]\((https:\/\/github\.com\/user-attachments\/assets\/[A-Za-z0-9-]+)\)$/,jbe=/^<!--\s*poster:\s*(https:\/\/[^\s"'>]+)\s*-->$/;function Gbe(r,e){let t=e?` poster="${e}"`:"";return`<video controls preload="metadata" playsinline style="width: 100%; border-radius: 8px;" src="${r}"${t}></video>`}function Ybe(r){let e=r.split(`
|
||
`),t=new Set;for(let s of e){let a=s.trim();$N.test(a)&&t.add(a)}let n=new Map;for(let s of e){let a=s.trim().match(A7);a&&t.has(a[2])&&n.set(a[2],a[1])}let i=new Set;for(let s=0;s<e.length;s++)if($N.test(e[s].trim()))for(let a of[1,-1]){let l=s+a;for(;l>=0&&l<e.length&&e[l].trim()==="";)l+=a;let c=l>=0&&l<e.length?e[l].trim().match(jbe):null;if(c){n.set(e[s].trim(),c[1]),i.add(l);break}}let o=[];for(let s=0;s<e.length;s++){let a=e[s],l=a.trim();if(i.has(s))continue;let c=l.match(A7);if(!(c&&t.has(c[2]))){if($N.test(l)){o.push(Gbe(l,n.get(l)));continue}o.push(a)}}return o.join(`
|
||
`)}function Kbe(r,e=1){let t=r.split(`
|
||
`);for(let n=0;n<t.length;n++)t[n].startsWith("#")&&(t[n]="#".repeat(e)+t[n]);return t.join(`
|
||
`)}var XD=class extends zl.Modal{constructor(t,n){super(t);this.markdownComponent=new zl.Component;this.isClosed=!1;this.previousVersion=n,this.releaseNotesPromise=Hbe("chhoumann","quickadd",n),this.releaseNotesPromise.then(i=>{if(!this.isClosed){if(this.releases=i,this.releases.length===0){this.close();return}this.display()}}).catch(i=>{F.logError(`Failed to fetch release notes: ${i}`)})}onOpen(){let{contentEl:t}=this;t.empty(),t.createEl("h1",{text:"Fetching release notes..."}),this.addCloseFooter()}addCloseFooter(){let t=this.contentEl.createDiv("quickadd-update-modal-footer");new zl.ButtonComponent(t).setButtonText("Done").setCta().onClick(()=>this.close())}onClose(){let{contentEl:t}=this;this.isClosed=!0,this.markdownComponent.unload(),t.empty()}display(){let{contentEl:t}=this;t.empty(),t.classList.add("quickadd-update-modal-container");let n=`### New in QuickAdd v${this.releases[0].tag_name}
|
||
`,i="Thank you for using QuickAdd! If you like the plugin, please consider supporting me by buying me a coffee. With your sponsorship, I'll be able to contribute more to my existing projects, start new ones, and be more responsive to issues & feature requests.",o='<div class="quickadd-bmac-container"><a href="https://www.buymeacoffee.com/chhoumann" target="_blank"><img src="https://cdn.buymeacoffee.com/buttons/v2/default-yellow.png" alt="Buy Me A Coffee" style="height: 40px !important;width: 144px !important;" ></a></div>',s=t.createDiv("quickadd-update-modal"),a=this.releases.map(d=>Ybe(d.body??"")).join(`
|
||
---
|
||
`),l=`And now, here is everything new in QuickAdd since your last update (v${this.previousVersion}):`,u=`${n}
|
||
${i}
|
||
${o}
|
||
I'd love to get your feedback on QuickAdd! Please fill out this <a href="https://forms.gle/WRq1ewcKK8qmkqps6">feedback form</a> to let me know what you think.
|
||
|
||
${l}
|
||
|
||
---
|
||
|
||
${Kbe(a)}`;this.markdownComponent.load(),zl.MarkdownRenderer.render(this.app,u,s,this.app.vault.getRoot().path,this.markdownComponent),this.addCloseFooter()}};lD();zr();Co();var Qbe=25e3,Xbe=6e4,Zbe=3e4,Jbe=75e3,ewe=32;function twe(r,e){if(r.length!==e.length)return!1;let t=0;for(let n=0;n<r.length;n++)t|=r.charCodeAt(n)^e.charCodeAt(n);return t===0}function rwe(r){if(r.origin||r.referer)return!1;let e=(r.host??"").split(":")[0];return e==="127.0.0.1"||e==="localhost"}function nwe(r){try{let e=window.require;return e?e(r):null}catch{return null}}function ZD(){let r=window.crypto;if(r?.randomUUID)return r.randomUUID();if(r?.getRandomValues){let e=r.getRandomValues(new Uint8Array(16));return Array.from(e,t=>t.toString(16).padStart(2,"0")).join("")}throw new Error("Interactive prompts require a secure random source (crypto), which is unavailable here.")}var JD="No pending prompt for that requestId",ON="The interactive client disconnected, so the run was ended.";function iwe(r,e){if(e.cancelled!==void 0&&typeof e.cancelled!="boolean")return`The "cancelled" flag must be the literal true (or omitted). A cancel that is not recognised would otherwise be answered on the user's behalf.`;if(e.cancelled===!0)return null;if(r==="confirm"){let t=e.value;if(!(t===!0||t===!1||t==="true"||t==="false"))return`A confirm prompt needs a boolean reply, or {"cancelled": true} if the user dismissed it. Got ${owe(t)}.`}return null}function owe(r){return r===void 0?"no value":r===null?"null":typeof r=="string"?JSON.stringify(r.slice(0,40)):typeof r=="number"||typeof r=="boolean"?String(r):Array.isArray(r)?"an array":typeof r}var NN=class{constructor(){this.server=null;this.port=0;this.sessions=new Map;this.startPromise=null;this.generation=0}async ensureStarted(){if(this.server)return this.port;if(this.startPromise)return this.startPromise;let e=nwe("http");if(!e)throw new Error("Interactive prompts require desktop Obsidian (Node http is unavailable).");let t=this.generation;return this.startPromise=new Promise((n,i)=>{let o=e.createServer((s,a)=>{this.handle(s,a)});o.on("error",s=>{this.generation===t&&(this.startPromise=null),i(s)}),o.listen(0,"127.0.0.1",()=>{if(this.generation!==t){o.close(),i(new Error("Interactive server stopped during startup."));return}let s=o.address();this.port=typeof s=="object"&&s?s.port:0,this.server=o,n(this.port)})}),this.startPromise}createSession(){if(this.sessions.size>=ewe)throw new Error("Too many active interactive sessions.");let e=ZD(),t=ZD()+ZD(),n={id:e,token:t,queue:[],waiter:null,waiterTimer:null,pending:new Map,finished:!1,aborted:!1,cleanupTimer:null,attached:!1,attachTimer:null,pollWatchdog:null};return n.attachTimer=window.setTimeout(()=>{!n.attached&&!n.finished&&this.finish(n.id,{kind:"error",error:"No client attached to the interactive session."})},Zbe),this.sessions.set(e,n),{id:e,token:t}}emitPrompt(e,t){let n=this.sessions.get(e);if(!n)return Promise.reject(new Error("Unknown session"));if(n.finished)return Promise.reject(new Ee(ON));if(n.aborted)return Promise.reject(new St(yu));let i=ZD();return new Promise((o,s)=>{n.pending.set(i,{resolve:o,reject:s,promptType:t.type}),this.push(n,{kind:"prompt",requestId:i,prompt:t})})}finish(e,t){let n=this.sessions.get(e);if(!(!n||n.finished)){n.finished=!0,n.attachTimer&&(window.clearTimeout(n.attachTimer),n.attachTimer=null),n.pollWatchdog&&(window.clearTimeout(n.pollWatchdog),n.pollWatchdog=null);for(let[,i]of n.pending)i.reject(new Ee(ON));n.pending.clear(),this.push(n,t),n.cleanupTimer=window.setTimeout(()=>this.destroySession(n),Xbe)}}abortSession(e){let t=this.sessions.get(e);if(!t||t.finished)return null;t.aborted=!0;let n=[...t.pending.values()];t.pending.clear();for(let i of n)i.reject(new St(yu));return t.queue=t.queue.filter(i=>i.kind!=="prompt"),n.length}stop(){this.generation++;for(let e of this.sessions.values()){e.waiterTimer&&window.clearTimeout(e.waiterTimer),e.cleanupTimer&&window.clearTimeout(e.cleanupTimer),e.attachTimer&&window.clearTimeout(e.attachTimer),e.pollWatchdog&&window.clearTimeout(e.pollWatchdog);for(let[,t]of e.pending)t.reject(new Ee("QuickAdd was unloaded during an interactive run."));if(e.waiter){let t=e.waiter;e.waiter=null,t({kind:"error",error:"QuickAdd unloaded"})}}this.sessions.clear(),this.server?.close(),this.server=null,this.port=0,this.startPromise=null}push(e,t){if(e.waiter){let n=e.waiter;e.waiter=null,e.waiterTimer&&(window.clearTimeout(e.waiterTimer),e.waiterTimer=null),n(t)}else e.queue.push(t)}destroySession(e){e.waiterTimer&&window.clearTimeout(e.waiterTimer),e.cleanupTimer&&window.clearTimeout(e.cleanupTimer),e.attachTimer&&window.clearTimeout(e.attachTimer),e.pollWatchdog&&window.clearTimeout(e.pollWatchdog);for(let[,t]of e.pending)t.reject(new Ee(ON));e.pending.clear(),this.sessions.delete(e.id),this.sessions.size===0&&(this.server?.close(),this.server=null,this.port=0,this.startPromise=null)}authed(e,t){return!!e&&!!t&&twe(e.token,t)}originAllowed(e){return rwe({origin:e.headers.origin,referer:e.headers.referer,host:e.headers.host})}submitReply(e,t,n,i=!1){let o=this.sessions.get(e);if(!o)return!1;let s=o.pending.get(t);return s?(o.pending.delete(t),i===!0?s.promptType==="info"?s.resolve(n):s.reject(new St(yu)):s.resolve(n),!0):!1}pendingPromptType(e,t){return e.pending.get(t)?.promptType}send(e,t,n){let i=JSON.stringify(n);e.writeHead(t,{"content-type":"application/json","cache-control":"no-store"}),e.end(i)}async drainBody(e){let t=0;for await(let n of e)if(t+=n.length,t>1e6)throw new Error("Request body too large")}async readBody(e){let t=[],n=0;for await(let i of e){if(n+=i.length,n>1e6)throw new Error("Request body too large");t.push(i)}return t.length===0?{}:JSON.parse(Buffer.concat(t).toString("utf8"))}async handle(e,t){try{if(!this.originAllowed(e)){this.send(t,403,{ok:!1,error:"Forbidden"});return}let n=new URL(e.url??"/","http://127.0.0.1"),i=n.searchParams.get("session"),o=n.searchParams.get("token"),s=i?this.sessions.get(i):void 0;if(!this.authed(s,o)){this.send(t,404,{ok:!1,error:"Unknown session or token"});return}if(e.method==="GET"&&n.pathname==="/poll"){this.handlePoll(s,t);return}if(e.method==="POST"&&n.pathname==="/abort"){await this.drainBody(e);let a=this.abortSession(s.id);if(a===null){this.send(t,409,{ok:!1,error:"The interactive session has already ended"});return}this.send(t,200,{ok:!0,interrupted:a});return}if(e.method==="POST"&&n.pathname==="/reply"){let a=await this.readBody(e),l=this.submitWireReply(s.id,a);l.ok?this.send(t,200,{ok:!0}):this.send(t,l.status,{ok:!1,error:l.error});return}this.send(t,404,{ok:!1,error:"Not found"})}catch(n){this.send(t,400,{ok:!1,error:n instanceof Error?n.message:String(n)})}}handlePoll(e,t){e.attached||(e.attached=!0,e.attachTimer&&(window.clearTimeout(e.attachTimer),e.attachTimer=null)),e.pollWatchdog&&window.clearTimeout(e.pollWatchdog),e.pollWatchdog=window.setTimeout(()=>{this.finish(e.id,{kind:"error",error:"Interactive client disconnected."})},Jbe);let n=e.queue.shift();if(n){this.send(t,200,n);return}if(e.waiter){this.send(t,200,{kind:"idle"});return}let i=o=>this.send(t,200,o);e.waiter=i,e.waiterTimer=window.setTimeout(()=>{e.waiter===i&&(e.waiter=null,e.waiterTimer=null,this.send(t,200,{kind:"idle"}))},Qbe),t.on("close",()=>{e.waiter===i&&(e.waiterTimer&&window.clearTimeout(e.waiterTimer),e.waiter=null,e.waiterTimer=null)})}submitWireReply(e,t){let n=this.sessions.get(e);if(!n)return{ok:!1,status:409,error:JD};if(!t.requestId)return{ok:!1,status:409,error:JD};let i=this.pendingPromptType(n,t.requestId);if(!i)return{ok:!1,status:409,error:JD};let o=iwe(i,t);return o?{ok:!1,status:400,error:o}:this.submitReply(n.id,t.requestId,t.value,t.cancelled)?{ok:!0}:{ok:!1,status:409,error:JD}}},ua=new NN;function LN(r){if(!r||typeof r!="string")return null;let e=r.split("-")[0]?.split("+")[0]?.trim();if(!e)return null;let t=e.split(".");if(t.length!==3)return null;let n=Number.parseInt(t[0]??"",10),i=Number.parseInt(t[1]??"",10),o=Number.parseInt(t[2]??"",10);return Number.isNaN(n)||Number.isNaN(i)||Number.isNaN(o)||n<0||i<0||o<0?null:{major:n,minor:i,patch:o}}Wt();Z1();qt();Me();Ux();var bf="\0qa-idx:";function swe(r){return r===void 0?"no value":r===null?"null":typeof r=="string"?JSON.stringify(r.slice(0,40)):typeof r=="number"||typeof r=="boolean"?String(r):Array.isArray(r)?"an array":typeof r}var eI=class{constructor(e,t=ua){this.sessionId=e;this.server=t}async suggester(e,t,n,i=!1){let o=typeof e=="function"?t.map((c,u,d)=>String(e(c,u,d))):e.map(c=>String(c)),s=t.map((c,u)=>({title:o[u]??String(c),value:`${bf}${u}`})),a=await this.server.emitPrompt(this.sessionId,{type:"suggester",placeholder:n,allowCustomInput:i,items:s});if(a==null)return"";let l=String(a);if(l.startsWith(bf)){let c=Number(l.slice(bf.length));if(Number.isInteger(c)&&c>=0&&c<t.length)return t[c]}return l}async suggesterMulti(e,t,n){let i=t.map((a,l)=>({title:e[l]??String(a),value:`${bf}${l}`})),o=[];for(let a of n?.preselected??[]){let l=t.indexOf(a);if(l>=0)o.push(`${bf}${l}`);else{let c=String(a);i.push({title:c,value:c}),o.push(c)}}let s=await this.server.emitPrompt(this.sessionId,{type:"multiselect",placeholder:n?.placeholder,allowCustomInput:n?.allowCustomInput??!1,items:i,preselected:o});return Array.isArray(s)?s.map(a=>{let l=String(a);if(l.startsWith(bf)){let c=Number(l.slice(bf.length));if(Number.isInteger(c)&&c>=0&&c<t.length)return t[c]}return l}):[]}async inputPrompt(e,t,n){return this.textPrompt(e,t,n,!1)}async wideInputPrompt(e,t,n){return this.textPrompt(e,t,n,!0)}async textPrompt(e,t,n,i){let o=await this.server.emitPrompt(this.sessionId,{type:"input",header:e,placeholder:t,defaultValue:n,multiline:i});return o==null?"":String(o)}async datePrompt(e,t){let n=await this.server.emitPrompt(this.sessionId,{type:"date",header:e,placeholder:t?.placeholder,defaultValue:t?.defaultValue,dateFormat:t?.dateFormat,withTime:t?.withTime}),i=String(n??"");if(!i)return"";let o=i.startsWith("@date:")?i.slice(6):i,s=t?.dateFormat;return(s?Nl(o,s):null)??o}async yesNoPrompt(e,t){let n=await this.server.emitPrompt(this.sessionId,{type:"confirm",header:e,text:t});if(n===!0||n==="true")return!0;if(n===!1||n==="false")return!1;throw new Error(`A confirm prompt needs a boolean reply, or {"cancelled": true} if the user dismissed it. Got ${swe(n)}.`)}async checkboxPrompt(e,t,n){let i=new Set(t??[]),o=await this.server.emitPrompt(this.sessionId,{type:"checkbox",header:n,items:e.map(s=>({title:String(s),value:String(s),checked:i.has(s)}))});return Array.isArray(o)?o.map(s=>String(s)):[]}async infoDialog(e,t){await this.server.emitPrompt(this.sessionId,{type:"info",header:e,text:Array.isArray(t)?t:[t]})}async requestInputs(e){let t=e.map(s=>({id:s.id,label:s.label??s.id,type:s.type==="file-picker"?"suggester":s.type,placeholder:s.placeholder,defaultValue:s.defaultValue,description:s.description,options:s.options,displayOptions:s.displayOptions,dateFormat:s.dateFormat,optional:s.optional,numericConfig:s.numericConfig,suggesterConfig:s.suggesterConfig?{allowCustomInput:s.suggesterConfig.allowCustomInput,multiSelect:s.suggesterConfig.multiSelect}:void 0})),n=await this.server.emitPrompt(this.sessionId,{type:"form",fields:t});if(!n||typeof n!="object")return{};let i=new Set(e.filter(s=>s.type==="date").map(s=>s.id)),o={};for(let[s,a]of Object.entries(n)){if(Array.isArray(a)){o[s]=a.map(c=>String(c));continue}let l=a==null?"":String(a);l&&i.has(s)&&!l.startsWith("@date:")&&(l=`@date:${l}`),o[s]=l}return o}};Wt();var k7={choice:{value:"<name>",description:"Choice name"},id:{value:"<id>",description:"Choice id"},vars:{value:"<json>",description:"Variables object as JSON"},ui:{description:"Allow interactive prompts"},verify:{description:"Report the verified outcome for Template/Capture choices (file path and effect on success, honest failure when the engine swallows an error)"}},awe={type:{value:"<Template|Capture|Macro|Multi>",description:"Filter by choice type"},commands:{description:"Only include command-enabled choices"}},lwe={path:{value:"<vault-path>",description:"Path to a template file in the vault"},vars:{value:"<json>",description:"Variables object as JSON"},ui:{description:"Allow interactive prompts"}},cwe={choice:{value:"<name>",description:"Choice name"},id:{value:"<id>",description:"Choice id"},vars:{value:"<json>",description:"Variables object as JSON"},fields:{description:"Include full field metadata (options, defaults, widget config)"}},uwe={choice:{value:"<name>",description:"Choice name"},id:{value:"<id>",description:"Choice id"},vars:{value:"<json>",description:"Variables object as JSON (pre-seeded inputs)"}},dwe={path:{value:"<vault-path>",description:"Path to a .quickadd.json package file in the vault"},decode:{description:"Inline decoded contents for each bundled file"}},pwe=new Set(["choice","id","vars","ui","verify"]),S7=new Set(["path","vars","ui"]),fwe=new Set(["choice","id","vars","fields"]),mwe=new Set(["choice","id","vars"]),Tn={runDefault:"quickadd",run:"quickadd:run",runTemplate:"quickadd:run-template",list:"quickadd:list",check:"quickadd:check",preview:"quickadd:package-preview",interactive:"quickadd:interactive"},hwe=new Set(["template","capture","macro","multi"]);function _r(r){return JSON.stringify(r)}function tv(r){if(r===void 0)return!1;let e=r.toLowerCase();return e==="true"||e==="1"||e==="yes"||e==="on"}function gwe(r){let e;try{e=JSON.parse(r)}catch(t){throw new Error(`Invalid vars JSON: ${t instanceof Error?t.message:String(t)}`)}if(!e||typeof e!="object"||Array.isArray(e))throw new Error("Invalid vars JSON: expected an object");return e}function tI(r,e){let t={};typeof r.vars=="string"&&Object.assign(t,gwe(r.vars));for(let[n,i]of Object.entries(r)){if(n.startsWith("value-")){let o=n.slice(6);o&&(t[o]=i);continue}e.has(n)||(t[n]=i)}return t}function I7(r,e=[]){let t=[];for(let n of gn(r)){if(!Ye(n))continue;let i=[...e,n.name],o=i.join(" / "),s=n.type==="Multi";t.push({id:n.id,name:n.name,type:n.type,command:n.command,path:o,runnable:!s}),s&&t.push(...I7(st(n),i))}return t}function BN(r,e){if(typeof e.id=="string"&&e.id.trim().length>0)return r.getChoiceById(e.id);if(typeof e.choice=="string"&&e.choice.trim().length>0)return r.getChoiceByName(e.choice);throw new Error("Missing choice selector. Provide either choice=<name> or id=<id>")}function UN(r){return{id:r.id,label:r.label,type:r.type,source:r.source??"collected",placeholder:r.placeholder,defaultValue:r.defaultValue,description:r.description,optionCount:r.options?.length??0}}function vwe(r){return{...UN(r),options:r.options,displayOptions:r.displayOptions,dateFormat:r.dateFormat,withTime:r.withTime,optional:r.optional,runtimeOnly:r.runtimeOnly,multiEmit:r.multiEmit,filters:r.filters,numericConfig:r.numericConfig,sliderConfig:r.sliderConfig,suggesterConfig:r.suggesterConfig}}function VN(r,e){for(let[t,n]of Object.entries(e))r.variables.set(t,n)}function zo(r){return{id:r.id,name:r.name,type:r.type}}async function P7(r,e,t,n,i,o=!1){let s=Date.now();try{if(n.type==="Multi")return _r({ok:!1,command:t,error:"Multi choices are interactive and cannot be run via CLI.",choice:zo(n)});let a=tI(e,i),l=new Ri(r.app,r);VN(l,a);let c=tv(e.ui);if(l.interactive=c,!c){let f=await kE(r.app,r,l,n,{preloadedUserScripts:l.preloadedUserScripts}),p=SE(f,l.variables);if(p.length>0)return _r({ok:!1,command:t,error:"Missing required inputs for non-interactive CLI run.",choice:zo(n),missing:p.map(UN),missingFlags:p.map(m=>`value-${m.id}=<value>`)})}if(o&&(n.type==="Template"||n.type==="Capture")&&typeof l.executeWithOutcome=="function"){let f=await l.executeWithOutcome(n),p=Date.now()-s;return f.status==="success"?_r({ok:!0,command:t,choice:zo(n),file:f.file?.path,verified:!0,effect:f.effect,durationMs:p}):f.status==="cancelled"?_r({ok:!1,command:t,error:f.reason||(f.cancelKind==="user"?"Execution cancelled by user":"Execution aborted"),aborted:!0,choice:zo(n),durationMs:p}):_r({ok:!1,command:t,error:f.reason||"Choice execution failed; no file was created.",choice:zo(n),durationMs:p})}await l.execute(n);let u=l.consumeAbortSignal?.(),d=Date.now()-s;return _r(u?{ok:!1,command:t,error:u.message||"Choice execution aborted",aborted:!0,choice:zo(n),durationMs:d}:{ok:!0,command:t,choice:zo(n),verified:!1,effect:"unknown",durationMs:d})}catch(a){return _r({ok:!1,command:t,error:a instanceof Error?a.message:String(a)})}}async function D7(r,e,t){let n;try{n=BN(r,e)}catch(i){return _r({ok:!1,command:t,error:i instanceof Error?i.message:String(i)})}return P7(r,e,t,n,pwe,tv(e.verify))}async function ywe(r,e){let t=Tn.runTemplate;try{let n=typeof e.path=="string"?e.path.trim():"";if(!n)return _r({ok:!1,command:t,error:"Missing template path. Provide path=<vault-path>."});let i=fo(r.app,n);if(!i)return _r({ok:!1,command:t,error:`No template file found at '${n}'.`});let o=SN(i.path);if(!tv(e.ui)){let a=tI(e,S7).value;if(a==null||String(a).trim().length===0)return _r({ok:!1,command:t,error:"Missing required inputs for non-interactive CLI run.",choice:zo(o),missing:[{id:"value",label:"New note name",type:"text",source:"collected",optionCount:0}],missingFlags:["value-value=<value>"]})}return await P7(r,e,t,o,S7,!0)}catch(n){return _r({ok:!1,command:t,error:n instanceof Error?n.message:String(n)})}}function bwe(r,e){try{let t=typeof e.type=="string"?e.type.trim():"",n=t.toLowerCase(),i=tv(e.commands);if(n&&!hwe.has(n))return _r({ok:!1,command:Tn.list,error:`Invalid type filter '${t}'.`});let s=I7(r.settings.choices).filter(a=>!(n&&a.type.toLowerCase()!==n||i&&!a.command));return _r({ok:!0,command:Tn.list,count:s.length,choices:s})}catch(t){return _r({ok:!1,command:Tn.list,error:t instanceof Error?t.message:String(t)})}}async function wwe(r,e){try{let t=BN(r,e);if(t.type==="Multi")return _r({ok:!1,command:Tn.check,error:"Multi choices are interactive and cannot be checked via CLI.",choice:zo(t)});let n=tI(e,fwe),i=new Ri(r.app,r);VN(i,n);let o=await kE(r.app,r,i,t),s=SE(o,i.variables),a=tv(e.fields)?vwe:UN;return _r({ok:s.length===0,command:Tn.check,choice:zo(t),requiredInputCount:o.length,missingInputCount:s.length,missing:s.map(a),missingFlags:s.map(l=>`value-${l.id}=<value>`)})}catch(t){return _r({ok:!1,command:Tn.check,error:t instanceof Error?t.message:String(t)})}}async function Cwe(r,e){let t=Tn.interactive,n;try{n=BN(r,e)}catch(i){return _r({ok:!1,command:t,error:i instanceof Error?i.message:String(i)})}if(n.type==="Multi")return _r({ok:!1,command:t,error:"Multi choices cannot be run interactively via CLI.",choice:zo(n)});try{let i=await ua.ensureStarted(),{id:o,token:s}=ua.createSession(),a=new Ri(r.app,r);return VN(a,tI(e,mwe)),a.interactive=!0,a.promptProvider=new eI(o),(async()=>{try{if((n.type==="Template"||n.type==="Capture")&&typeof a.executeWithOutcome=="function"){let c=await a.executeWithOutcome(n);if(c.status==="success"){ua.finish(o,{kind:"done",result:{ok:!0,choice:zo(n),file:c.file?.path,verified:!0,effect:c.effect}});return}ua.finish(o,{kind:"error",error:c.status==="cancelled"?c.reason||(c.cancelKind==="user"?"Execution cancelled by user":"Execution aborted"):c.reason||"Choice execution failed; no file was created."});return}await a.execute(n);let l=a.consumeAbortSignal?.();if(l){ua.finish(o,{kind:"error",error:l.message||"Choice execution aborted"});return}ua.finish(o,{kind:"done",result:{ok:!0,choice:zo(n),verified:!1,effect:"unknown"}})}catch(l){ua.finish(o,{kind:"error",error:l instanceof Error?l.message:String(l)})}})(),_r({ok:!0,command:t,choice:zo(n),host:"127.0.0.1",port:i,sessionId:o,token:s,capabilities:["abort","outcome-effect"]})}catch(i){return _r({ok:!1,command:t,error:i instanceof Error?i.message:String(i)})}}async function xwe(r,e){try{let t=typeof e.path=="string"?e.path.trim():"";if(!t)return _r({ok:!1,command:Tn.preview,error:"Missing package path. Provide path=<vault-path>."});let{pkg:n}=await h4(r.app,t),i=await xS(r.app,r.settings.choices,n),o={ok:!0,command:Tn.preview,preview:i};return tv(e.decode)&&(o.contents=i.files.map(s=>({path:s.originalPath,...wS(n,s.originalPath)}))),_r(o)}catch(t){return _r({ok:!1,command:Tn.preview,error:t instanceof Error?t.message:String(t)})}}function F7(r){let e=r;if(typeof e.registerCliHandler!="function")return F.logMessage("Skipping QuickAdd CLI handler registration: registerCliHandler is unavailable."),!1;let t=e.registerCliHandler.bind(e);return t(Tn.runDefault,"Run a QuickAdd choice (ok:true reports the choice ran without aborting; check verified to know QuickAdd confirmed the run, and effect to know whether the vault changed: created/changed/unchanged/unknown)",k7,n=>D7(r,n,Tn.runDefault)),t(Tn.run,"Run a QuickAdd choice (ok:true reports the choice ran without aborting; check verified to know QuickAdd confirmed the run, and effect to know whether the vault changed: created/changed/unchanged/unknown)",k7,n=>D7(r,n,Tn.run)),t(Tn.runTemplate,"Create a new note from a template file (no Template choice required)",lwe,n=>ywe(r,n)),t(Tn.list,"List QuickAdd choices",awe,n=>bwe(r,n)),t(Tn.check,"Check missing inputs for a QuickAdd choice",cwe,n=>wwe(r,n)),t(Tn.preview,"Preview a QuickAdd package before importing (files + capabilities)",dwe,n=>xwe(r,n)),t(Tn.interactive,"Run a choice interactively: forwards its runtime prompts to the caller over a local server (returns host/port/sessionId/token to attach)",uwe,n=>Cwe(r,n)),F.logMessage("Registered QuickAdd CLI handlers."),!0}var wf={run:"Run",runTemplateFromFolder:"New note from template",applyTemplate:"Apply template to active note",reloadDev:"Reload (dev)",openSettings:"Open settings"};gl();cN();var Ewe=new Set(["shortcuts:","obsidian:"]);function rI(r){return typeof r=="string"&&r.length>0?r:void 0}function M7(r){let e=rI(r["x-success"]),t=rI(r["x-error"]),n=rI(r["x-cancel"]);if(e||t||n)return{success:e,error:t,cancel:n,any:!0};let i=rI(r["x-callback-url"]);return i?{success:i,cancel:i,any:!0}:{any:!1}}function R7(r){return[r.success,r.error,r.cancel].filter(e=>typeof e=="string"&&e.length>0)}function qN(r){try{let e=new URL(r).protocol.toLowerCase();return Ewe.has(e)}catch{return!1}}function $7(r,e){let t=new URL(r);for(let[n,i]of Object.entries(e))t.searchParams.set(n,i);return t.toString()}function O7(r,e){return"obsidian://open?vault="+encodeURIComponent(r)+"&file="+encodeURIComponent(e)}var Twe=1e3,nI=class extends rv.Plugin{constructor(){super(...arguments);this.requestSave=(0,rv.debounce)(()=>{(async()=>await this.saveData(this.settings))()},Twe)}get api(){return Yg.GetApi(this.app,this,new Ri(this.app,this))}async onload(){F.logMessage("Loading QuickAdd"),gV(this),await this.loadSettings(),le.replaceState(this.settings),this.unsubscribeSettingsStore=le.subscribe(o=>{this.settings=o,this.requestSave()}),this.addCommand({id:"runQuickAdd",name:wf.run,callback:()=>{FN(this)}}),this.addCommand({id:"runTemplateFromFolder",name:wf.runTemplateFromFolder,callback:()=>{HD(this.app,this,{choiceExecutor:new Ri(this.app,this)})}}),this.addCommand({id:"applyTemplateToActiveFile",name:wf.applyTemplate,checkCallback:o=>{let s=this.app.workspace.getActiveFile(),a=s?.extension==="md";if(o)return a;a&&vE(this.app,this,{file:s,choiceExecutor:new Ri(this.app,this)})}}),this.registerEvent(this.app.workspace.on("file-menu",(o,s)=>{s instanceof rv.TFile&&s.extension==="md"&&o.addItem(a=>a.setTitle(`QuickAdd: ${wf.applyTemplate}`).setIcon("file-plus").onClick(()=>{vE(this.app,this,{file:s,choiceExecutor:new Ri(this.app,this)})}))})),this.addCommand({id:"reloadQuickAdd",name:wf.reloadDev,checkCallback:o=>{if(o)return this.settings.devMode;let s=this.manifest.id,a=this.app.plugins;a.disablePlugin(s).then(()=>a.enablePlugin(s))}});let t=Hc.getInstance();t.startAutomaticCleanup(o=>this.registerInterval(o)),t.registerInvalidationListeners(this.app,o=>this.registerEvent(o)),this.addCommand({id:"openQuickAddSettings",name:wf.openSettings,callback:()=>{fg(this.app,this.manifest.id)}}),this.registerObsidianProtocolHandler("quickadd",async o=>{let s=o,a=this.settings.enableUriCallbacks?M7(s):{any:!1};if(!a.any){await this.runUriChoiceLegacy(s);return}let l=R7(a).filter(f=>!qN(f));if(l.length>0){F.logWarning(`QuickAdd URI: ignoring disallowed callback URL(s): ${l.join(", ")}`),a.error&&qN(a.error)&&this.openUriCallback(a.error,{status:"error",errorCode:"bad-callback-url"});return}if(!s.choice){F.logWarning("URI was executed without a `choice` parameter."),this.fireUriError(a,"choice-not-found");return}let c=this.getChoice("name",s.choice);if(!c){F.logWarning(`URI could not find any choice named '${s.choice}'`),this.fireUriError(a,"choice-not-found");return}if(this.warnIfChoiceNameAmbiguous(s.choice),c.type!=="Template"&&c.type!=="Capture"){F.logWarning(`QuickAdd URI x-callback supports Template and Capture choices only ('${c.name}' is ${c.type}). A URI with x-* callback params cannot run a ${c.type} choice while "Enable URI callbacks" is on; remove the x-* params to run it on the legacy path.`),this.fireUriError(a,"unsupported-choice-type");return}let u=new Ri(this.app,this);this.applyUriValueParameters(u,s);let d=await u.executeWithOutcome(c);switch(d.status){case"success":this.fireUriSuccess(a,d.file,d.effect);break;case"cancelled":d.cancelKind==="user"?this.fireUriCancel(a):this.fireUriError(a,"execution-aborted");break;case"error":this.fireUriError(a,"execution-failed");break}}),F.register(new Rx).register(new SS(this)),L4(this),this.settings.enableRibbonIcon&&this.addRibbonIcon("file-plus","QuickAdd",()=>{FN(this)}),this.addSettingTab(new kS(this.app,this)),this.addCommandsForChoices(this.settings.choices);try{await _7(this)}catch(o){lt(o,"QuickAdd could not run its settings migrations")}let n=()=>{try{F7(this)}catch(o){lt(o,"QuickAdd could not register its CLI handlers")}};this.app.workspace.layoutReady?n():this.app.workspace.onLayoutReady(n);let i=async()=>{try{await new FD(this.app,this,this.settings.choices,new Ri(this.app,this)).run()}catch(o){lt(o,"QuickAdd could not run its startup macros")}};this.app.workspace.layoutReady?i():this.app.workspace.onLayoutReady(i),this.app.workspace.onLayoutReady(()=>{window.setTimeout(()=>{MY(this.app)},5e3)}),this.announceUpdate()}async runUriChoiceLegacy(t){if(!t.choice){F.logWarning("URI was executed without a `choice` parameter.");return}let n=this.getChoice("name",t.choice);if(!n){lt(new Error(`URI could not find any choice named '${t.choice}'`),"URI handler error");return}this.warnIfChoiceNameAmbiguous(t.choice);let i=new Ri(this.app,this);this.applyUriValueParameters(i,t);try{await i.execute(n)}catch(o){Zf(o,`Could not run "${n.name}"`)}}applyUriValueParameters(t,n){Object.entries(n).filter(([i])=>i.startsWith("value-")).forEach(([i,o])=>{let s=i.slice(6);s&&typeof o=="string"&&!vD(s)&&t.variables.set(s,o)})}fireUriSuccess(t,n,i){let o={status:"success",effect:i};n&&(o.path=n.path,o.url=O7(this.app.vault.getName(),n.path)),t.success&&this.openUriCallback(t.success,o)}fireUriError(t,n){t.error&&this.openUriCallback(t.error,{status:"error",errorCode:n})}fireUriCancel(t){t.cancel&&this.openUriCallback(t.cancel,{status:"cancel"})}openUriCallback(t,n){vB(()=>{window.open($7(t,n))},"QuickAdd URI: failed to open callback URL")}onunload(){F.logMessage("Unloading QuickAdd"),this.requestSave.run(),this.unsubscribeSettingsStore?.call(this),Vv.loggers.forEach(n=>{n instanceof Rx&&n.clearErrorLog()}),Hc.getInstance().destroy(),ua.stop()}async loadSettings(){let t=await this.loadData(),n=Object.assign({},ET,t);typeof n.announceUpdates=="boolean"&&(n.announceUpdates=n.announceUpdates?"all":"none"),Array.isArray(n.choices)&&(n.choices=KU(n.choices)),this.settings=n}async saveSettings(){this.requestSave.cancel(),await this.saveData(this.settings)}addCommandsForChoices(t){for(let n of gn(t))if(Ye(n))try{this.addCommandForChoice(n)}catch(i){lt(i,"Could not add a command for a QuickAdd choice")}}addCommandForChoice(t){if(t.type==="Multi"&&this.addCommandsForChoices(st(t)),t.command){let n=t.id;this.addCommand({id:`choice:${n}`,name:t.name,icon:bm(t),callback:async()=>{let i;try{i=this.getChoiceById(n),await new Ri(this.app,this).execute(i)}catch(o){Zf(o,`Could not run "${i?.name??t.name}"`)}}})}}getChoiceById(t){let n=this.getChoice("id",t);if(!n)throw new Error(`Choice ${t} not found`);return n}getChoiceByName(t){let n=this.getChoice("name",t);if(!n)throw new Error(`Choice ${t} not found`);return n}getChoice(t,n,i=this.settings.choices){for(let o of gn(i))if(Ye(o)){if(o[t]===n)return o;if(o.type==="Multi"){let s=this.getChoice(t,n,st(o));if(s)return s}}return null}countChoicesByName(t,n=this.settings.choices){let i=0;for(let o of gn(n))Ye(o)&&(o.name===t&&i++,o.type==="Multi"&&(i+=this.countChoicesByName(t,st(o))));return i}warnIfChoiceNameAmbiguous(t){let n=this.countChoicesByName(t);n>1&&F.logWarning(`QuickAdd URI: ${n} choices are named '${t}'. Ran the first match \u2014 rename choices to keep names unique so URIs target the right one.`)}removeCommandForChoice(t,n){if(n?.recursive&&t.type==="Multi")for(let i of st(t))Ye(i)&&this.removeCommandForChoice(i,n);B0(this.app,`quickadd:choice:${t.id}`)}getTemplateFiles(){let t=Wi(this.settings.templateFolderPaths);return this.app.vault.getFiles().filter(n=>BT(n.path)).filter(n=>$0(n.path,t))}announceUpdate(){let t=(l,c)=>{let u=LN(l),d=LN(c);return!u||!d?!0:u.major!==d.major?u.major>d.major:u.minor>d.minor},n=this.manifest.version,i=this.settings.version;if(n===i)return;let o=this.settings.announceUpdates,s=!0;if((o==="none"||o==="major"&&!t(n,i))&&(s=!1),this.settings.version=n,this.saveSettings(),!s)return;new XD(this.app,i).open()}};
|
||
|
||
/* nosourcemap */ |