varD4=Object.create;varzh=Object.defineProperty;varF4=Object.getOwnPropertyDescriptor;varP4=Object.getOwnPropertyNames;varM4=Object.getPrototypeOf,$4=Object.prototype.hasOwnProperty;varU$=r=>{throwTypeError(r)};varO4=(r,e,t)=>einr?zh(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t;varE=(r,e,t)=>()=>{if(t)throwt[0];try{returnr&&(e=r(r=0)),e}catch(n){throwt=[n],n}};varR4=(r,e)=>()=>{try{returne||r((e={exports:{}}).exports,e),e.exports}catch(t){throwe=0,t}},fw=(r,e)=>{for(vartine)zh(r,t,{get:e[t],enumerable:!0})},H$=(r,e,t,n)=>{if(e&&typeofe=="object"||typeofe=="function")for(letiofP4(e))!$4.call(r,i)&&i!==t&&zh(r,i,{get:()=>e[i],enumerable:!(n=F4(e,i))||n.enumerable});returnr};varz$=(r,e,t)=>(t=r!=null?D4(M4(r)):{},H$(e||!r||!r.__esModule?zh(t,"default",{value:r,enumerable:!0}):t,r)),N4=r=>H$(zh({},"__esModule",{value:!0}),r);varhe=(r,e,t)=>O4(r,typeofe!="symbol"?e+"":e,t),m_=(r,e,t)=>e.has(r)||U$("Cannot "+t);varV=(r,e,t)=>(m_(r,e,"read from private field"),t?t.call(r):e.get(r)),rt=(r,e,t)=>e.has(r)?U$("Cannot add the same private member more than once"):einstanceofWeakSet?e.add(r):e.set(r,t),Ge=(r,e,t,n)=>(m_(r,e,"write to private field"),n?n.call(r,t):e.set(r,t),t),lt=(r,e,t)=>(m_(r,e,"access private method"),t);var$R,OR,RR=E(()=>{$R=r=>{lete,t=newSet,n=(c,u)=>{letd=typeofc=="function"?c(e):c;if(!Object.is(d,e)){letp=e;e=u??(typeofd!="object"||d===null)?d:Object.assign({},e,d),t.forEach(f=>f(e,p))}},i=()=>e,a={setState:n,getState:i,getInitialState:()=>l,subscribe:c=>(t.add(c),()=>t.delete(c))},l=e=r(n,i,a);returna},OR=(r=>r?$R(r):$R)});functionEg(r){if(r.kind)returnr.kind;lete=(r.name??"").toLowerCase(),t=s8(r.endpoint),n=i=>t===i||t.endsWith(`.${i}`);returne==="anthropic"||n("api.anthropic.com")?"anthropic":e==="gemini"||n("generativelanguage.googleapis.com")?"gemini":"openai"}functions8(r){lete=(r??"").trim();if(!e)return"";for(lettof[e,`https://${e}`])try{returnnewURL(t).hostname.toLowerCase()}catch{}return""}functiona8(r){returnr.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"")||"provider"}functionnC(r,e){lett=a8(r),n=newSet(e.map(o=>o.id).filter(o=>!!o)),i=t;for(leto=2;n.has(i);o++)i=`${t}-${o}`;returni}functioniC(r){lete=!1,t=newSet;for(letnofr){if(n.id&&!t.has(n.id)){t.add(n.id);continue}n.id=nC(n.id??n.name,r),t.add(n.id),e=!0}returne}functionpc(r,e){returne&&e.name===r?e:void0}functionoC(r){returnTg[r].map(e=>({...e}))}varTg,NR,l8,c8,sC,ro=E(()=>{Tg={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,maxO
`)}function Sg(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 aC(r){return Sg(r).map(([e,t])=>`${e}=${t}`).join(", ")}var Kp,td=E(()=>{Kp={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 lC,wA=E(()=>{ro();td();lC={choices:[],inputPrompt:"single-line",persistInputPromptDrafts:!0,useSelectionAsCaptureValue:!0,namePastedImagesAfterNoteTitle:!1,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:Kp,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:sC,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 Ve(r){if(typeof structuredClone=="function")try{return structuredClone(r)}catch{}return fc(r,new Map)}function fc(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(fc(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(fc(o,e),fc(s,e));return i}if(r instanceof Set){let i=new Set;e.set(r,i);for(let o of r.values())i.add(fc(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(fc(r.buffer,e),r.byteOffset,r.byteLength);return e.set(r,a),a}let i=r,o=fc(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:fc(o,e),writable:!0,enumerable:!0,configurable:!0});return n}var Jr=E(()=>{});var X,dt=E(()=>{RR();wA();Jr();X=(()=>{let r=OR((i,o)=>({...Ve(lC)})),{getState:e,setState:t,subscribe:n}=r;return{getState:e,replaceState:i=>t(i,!0),setState:t,subscribe:n}})()});var rd,_g,I,Ie=E(()=>{rd=class rd{register(e){return rd.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;rd.loggers.forEach(o=>o.logError(t,n,i))}logWarning(e){let t=e instanceof Error?e.message:e,n=e in
${e}`}asyncfunctionPN(r,e,t,n){leti=t.destination;if(i?.type!=="specifiedFile")return!1;leto=$g(r,i);if(!o)thrownewError(`Append link target file not found or is not a Markdown file: ${i.path}`);lets=CC(r,e,{sourcePath:o.path,linkType:"link"}),a;returnawaitr.vault.process(o,l=>{letc=D8(l,s);returna={filePath:o.path,before:l,after:c,edits:[{from:l.length,to:l.length,text:c.slice(l.length)}]},c}),a&&n?.(a),!0}asyncfunctionF8(r){lete=window.navigator?.clipboard;if(!e?.writeText)returnI.logMessage("QuickAdd: Clipboard API is unavailable."),!1;try{returnawaite.writeText(r),!0}catch(t){returnI.logMessage(`QuickAdd: Could not copy link to clipboard: ${tinstanceofError?t.message:String(t)}`),!1}}asyncfunctionMN(r){lete=I8(r);returnawaitF8(e)?(newMg.Notice(`Copied link to '${r.basename}' to clipboard.`,FN),!0):(newMg.Notice(`Created '${r.basename}', but QuickAdd could not copy its link to the clipboard.`,FN),!1)}varMg,FN,Og=E(()=>{Mg=require("obsidian");Ie();wc();FN=4e3});functionio(r){if(r.nodeType===Node.DOCUMENT_NODE)returnr;lete=r.ownerDocument;if(!e)thrownewError("Unable to resolve owner document for DOM node.");returne}functionRg(r){lete=io(r).defaultView;if(!e)thrownewError("Unable to resolve owner window for DOM node.");returne}functioner(r,e){returnio(r).win.createEl(e)}functionNg(r,e){returnio(r).createTextNode(e)}varbs=E(()=>{});functionxC(r){for(leteofr.workspace.getLeavesOfType("markdown")){lett=e.view;if(!(!t.containerEl||!t.file||t.file.extension!=="md"))try{letn=io(t.containerEl).activeElement;if(!n||!t.containerEl.contains(n)||!n.closest(".metadata-property-value")||n.matches(P8))continue;leto=n.closest(".metadata-property")?.getAttribute("data-property-key");if(!o)continue;return{file:t.file,key:o}}catch{continue}}returnnull}functionM8(r,e,t){letn=NN(r,e),i=r[n];if(Array.isArray(i)){i.push(t);return}if(i==null||i===""){r[n]=t;return}if(typeofi=="string"){r[n]=`${i}${t}`;return}thrownewError(`Cannot append link to frontmatter property '${n}' because it contains a ${typeofi} value.`)}functionRN(r,e,t,n=ud){leti=NN(r,e),o=r[i];if(Array.isArray(o)){o.push(t);return}if(o===null||o===""){r[i]=[t];return}if(o===void0){if(n==="error")thrownewError(`Cannot append link to frontmatter property '${i}' because it does not exist.`);r[i]=[t];return}if(typeofo=="object")thrownewError(`Cannot append link to frontmatter property '${i}' because it contains an object value.`);if(n!=="alwaysAppend")thrownewError(`Cannot append link to frontmatter property '${i}' because it is not a list and the link-handling mode is '${$N[n]}'. Choose '${$N.alwaysAppend}' to convert it into a list and append.`);r[i]=[o,t]}functionNN(r,e){if(e=e.trim(),!e)thrownewError("Cannot append link to an empty frontmatter property key.");lett=ON(e),n=Object.keys(r).filter(i=>ON(i)===t);if(n.length>1)thrownewError(`Cannot append link to frontmatter property '${e}' because the note has multiple properties that normalize to that key.`);returnn[0]??e}functionON(r){returnr.trim().toLowerCase()}asyncfunctionLN(r,e,t){letn=r.fileManager.generateMarkdownLink(t,e.file.path);try{returnawaitr.fileManager.processFrontMatter(e.file,i=>{M8(i,e.key,n)}),!0}catch(i){returnI.logError(`QuickAdd: created the file but could not append the link to frontmatter property '${e.key}' in '${e.file.path}': ${iinstanceofError?i.message:String(i)}`),!1}}var$N,P8,Lg=E(()=>{Ie();wc();bs();$N={alwaysAppend:"Create or convert",createProperty:"Create if missing",error:"Require list"},P8=['input[type="number"]','input[type="date"]','input[type="datetime-local"]','input[type="time"]','input[type="month"]','input[type="checkbox"]'].join(", ")});functionVN(r,e,t,n){leti=No(e,t);returni?NA(r,i.editor,n):null}functionNA(r,e,t){if(r.cursor.kind==="none")returnnull;letn=r.content.replace(/\r\n?/g,`
`+n,cursor:i+(d?0:1)}]}elsereturnnull;letl=[],c=[],u=0;a.sort((d,p)=>o(d.from)-o(p.from));for(letdofa)l.push(o(d.from)+u+d.cursor),c.push(o(d.from)+u+d.text.length-(t==="newLineAbove"?1:0)),u+=d.text.length-(o(d.to??d.from)-o(d.from));returne.transaction({changes:a.map(({from:d,to:p,text:f})=>({from:d,to:p,text:f}))}),e.setSelections(c.map(d=>({anchor:e.offsetToPos(d)}))),{offsets:l,content:e.getValue()}}functionNo(r,e){lett=xn(r);returnt?.file?.path===e.path?t:null}functionLA(r,e){try{lett=xn(e);returnt?(t.editor.replaceSelection(r),!0):(I.logError(`unable to append '${r}' to current line.`),!1)}catch{returnI.logError(`unable to append '${r}' to current line.`),!1}}functionVA(r,e,t){try{letn=xn(t);if(!n)returnI.logError(`unable to insert '${r}' on new line ${e}.`),!1;leti=n.editor,s=i.getCursor().line,a=r.split(`
`+r,{line:s,ch:u.length}),i.setCursor({line:s+l,ch:c})}return!0}catch{returnI.logError(`unable to insert '${r}' on new line ${e}.`),!1}}functionBA(r,e){returnVA(r,"above",e)}functionqA(r,e){returnVA(r,"below",e)}function$8(r,e,t,n,i){leto=c=>r.posToOffset(c),s=e.map(c=>{let[u,d]=o(c.anchor)<=o(c.head)?[c.anchor,c.head]:[c.head,c.anchor];return{from:u,to:d,text:n(r.getRange(u,d))}}).sort((c,u)=>o(c.from)-o(u.from)),a=s.map(({from:c,to:u,text:d})=>t==="replaceSelection"?{from:c,to:u,text:d}:{from:u,text:d}),l=[];if(t==="replaceSelection"){letc=0;for(let{from:u,to:d,text:p}ofs)l.push(o(u)+c+p.length),c+=p.length-(o(d)-o(u))}i(a,()=>r.transaction({changes:a})),t==="replaceSelection"&&r.setSelections(l.map(c=>({anchor:r.offsetToPos(c)})))}asyncfunctionBN(r,e,t="replaceSelection",n={}){let{requireActiveView:i=!0,frontmatterProperty:o,frontmatterHandling:s=ud,textForSelection:a,onEditorTextMutation:l}=n,c=r.workspace.getActiveViewOfType(EC.MarkdownView);if(!c){letg="Cannot append link because no active Markdown view is available.";if(i)thrownewError(g);I.logMessage(g);return}if(t==="inFrontmatter"){letg=c.file;if(!g)thrownewError("Cannot append link because the active Markdown view has no file.");awaitr.fileManager.processFrontMatter(g,v=>{RN(v,o??"",e,s)});return}letu=c.editor;if(!u){letg="Cannot append link because the active Markdown view has no editor.";if(i)thrownewError(g);I.logMessage(g);return}letd=(g,v)=>{if(!l){v();return}lety=u.getValue(),b=g.map(x=>({from:u.posToOffset(x.from),to:u.posToOffset(x.to??x.from),text:x.text}));v(),l({filePath:c.file?.path??null,before:y,after:u.getValue(),edits:b})},p=u.listSelections().map(g=>({anchor:{...g.anchor},head:{...g.head}}));if(a&&p.length>0&&(t==="replaceSelection"||t==="afterSelection")){$8(u,p,t,a,d);return}if(t==="replaceSelection"){letg=p.map(({anchor:v,head:y})=>({from:u.posToOffset(v)<=u.posToOffset(y)?v:y,to:u.posToOffset(v)<=u.posToOffset(y)?y:v,text:e}));d(g,()=>u.replaceSelection(e));return}letf=({line:g,ch:v})=>u.posToOffset({line:g,ch:v}),m=p.sort((g,v)=>f(v.head)-f(g.head));for(letgofm){letv=f(g.anchor)>f(g.head)?g.anchor:g.head;switch(t){case"afterSelection":{d([{from:v,text:e}],()=>u.replaceRange(e,v));break}case"endOfLine":case"newLine":{lety=u.getLine(v.line).length,b=t==="newLine"&&y>0?`
`:"",x={line:v.line,ch:y};d([{from:x,text:b+e}],()=>u.replaceRange(b+e,x));break}}}}asyncfunctionTC(r,e,t,n){if(!t?.enabled)return!1;leti=bc(t),o=r.workspace.getActiveViewOfType(EC.MarkdownView),s=i.placement!=="inFrontmatter";if(!o||!o.file||s&&!o.editor){if(t.requireActiveFile)thrownewError("Cannot append link because no active Markdown view is available.");return!1}leta=o.file.path,l=CC(r,e,{sourcePath:a,linkType:i.linkType,placement:i.placement}),c=i.displayText==="selection"?u=>CC(r,e,{sourcePath:a,linkType:i.linkType,placement:i.placement,alias:u}):void0;returnawaitBN(r,l,i.placement,{requireActiveView:!1,frontmatterProperty:i.frontmatterProperty,frontmatterHandling:i.frontmatterHandling,textForSelection:c,onEditorTextMutation:n}),!0}functionUA(r,e,t,n){returnVg(r,e,[t],n)}functionVg(r,e,t,n){try{if(e.extension!=="md"||!t.length||t.some(c=>!Number.isSafeInteger(c)||c<0||c>n.length))return!1;leti=r.workspace.getActiveViewOfType(EC.MarkdownView);if(!i||i.file?.path!==e.path||i.getMode()==="preview")return!1;leto=i.editor;if(!o)return!1;lets=o.getValue(),a=t;if(s!==n){if(s!==n.replace(/\r\n?/g,`
`).length)}a.length===1?o.setCursor(o.offsetToPos(a[0])):o.setSelections(a.map(c=>({anchor:o.offsetToPos(c)})));letl=i.containerEl?.ownerDocument;returnl&&l.activeElement===l.body&&o.focus(),!0}catch{returnI.logMessage(`Unable to place cursor after capture in '${e.path}'.`),!1}}varEC,Bg=E(()=>{EC=require("obsidian");ys();Ie();wc();Og();Lg()});functionkC(r){returnNt.test(r)||cr.test(r)||wn.test(r)}functionVn(r,e){lett=e.trim().replace(/^\/+/,"");if(!t)returnnull;letn=kC(t)?t:`${t}.md`,i=r.vault.getAbstractFileByPath(n);returniinstanceofqN.TFile?i:null}functionri(r){if(!Array.isArray(r))return[];lete=newSet,t=[];for(letnofr){if(typeofn!="string")continue;leti=n.trim().replace(/^\/+/,"").replace(/\/+$/,"");!i||e.has(i)||(e.add(i),t.push(i))}returnt}functionHA(r,e){returne.length===0?!0:e.some(t=>r===t||r.startsWith(`${t}/`))}varqN,qg=E(()=>{qN=require("obsidian");Xe()});functionHN(r){if(!r)return!1;lete=r,t=e.getViewState?.();return!!e.pinned||!!t?.pinned||!!t?.state?.pinned}functionUg(r){lete=r.workspace;return(e.rootSplit?e.getMostRecentLeaf?.(e.rootSplit):null)??e.getMostRecentLeaf?.()??null}functionO8(r){lete=[];returnr.workspace.iterateRootLeaves(t=>{e.includes(t)||e.push(t)}),e}functionUN(r){returnr.parent?.id??r.parent??null}functionR8(r,e){lett=UN(e),n=r.filter(s=>s===e||HN(s)?!1:t===null||UN(s)!==t);if(n.length===0)returnnull;leti=r.indexOf(e);return(i===-1?r:[...r.slice(i+1),...r.slice(0,i)]).find(s=>n.includes(s))??n[0]}functionN8(r){returnrinstanceofJp.TFile?!0:typeofr=="object"&&r!==null&&"path"inr&&typeofr.path=="string"&&"extension"inr&&typeofr.extension=="string"}functionL8(r,e,t,n){if(n&&(e==="tab"||e==="reuse")&&HN(n))returnR8(O8(r),n)??r.workspace.getLeaf("tab");switch(e){case"reuse":returnr.workspace.getLeaf(!1);case"tab":returnr.workspace.getLeaf("tab");case"split":returnr.workspace.getLeaf("split",t);case"window":returnr.workspace.getLeaf("window");case"left-sidebar":returnr.workspace.getLeftLeaf(!0);case"right-sidebar":returnr.workspace.getRightLeaf(!0);default:returnr.workspace.getLeaf("tab")}}asyncfunctionHg(r,e,t={}){let{location:n="tab",direction:i="vertical",mode:o,focus:s=!0,eState:a,originLeaf:l}=t,c=typeofe=="string"?r.vault.getAbstractFileByPath(e):e;if(!N8(c)){letf=typeofe=="string"?e:e.path;thrownewError(`File not found: ${f}`)}letu=l??Ug(r),d=s?null:r.workspace.activeLeaf,p=L8(r,n,i,u);if(!p)thrownewError("Could not obtain a workspace leaf.");if(d&&r.workspace.activeLeaf!==d&&r.workspace.setActiveLeaf(d,{focus:!1}),s?awaitp.openFile(c):awaitp.openFile(c,{active:!1}),o&&o!=="default"&&!(typeofo=="object"&&o.mode==="default")){letf=p.getViewState(),m={...f.state??{}};o==="preview"||typeofo=="object"&&o.mode==="preview"?(m.mode="preview",deletem.source):o==="source"?(m.mode="source",m.source=!0):o==="live"||o==="live-preview"?(m.mode="source",m.source=!1):typeofo=="object"&&o.mode==="source"&&(m.mode="source",m.source=o.source),awaitp.setViewState({...f,...!s&&{active:!1},state:{...m,...a}})}returns&&r.workspace.setActiveLeaf(p,{focus:!0}),p}functionzA(r){return(0,Jp.normalizePath)(r).replace(/\/{2,}/g,"/").replace(/^\/+/,"")}functionzN(r,e){returnzA(r)===zA(e)}functionWA(r,e,t=!0){letn;returnr.workspace.iterateRootLeaves(i=>{if(n&&n===r.workspace.activeLeaf)return;leto=i.view;if(oinstanceofJp.FileView&&o.file&&(o.file===e||zN(e.path,o.file.path))){n=i;return}}),n!==void0?(t&&r.workspace.setActiveLeaf(n,{focus:!0}),n):null}varJp,WN=E(()=>{Jp=require("obsidian")});functionll(r){lete=0,t=0,n=!1,i=0,o=0,s=0;for(;e<=r.length;){leta=r.indexOf(`
`.repeat(e)+r}}varV8,B8,q8,zg=E(()=>{V8=/^ {0,3}(`{3,})(.*)$/,B8="No ```js (or ```javascript) code block found in the note.",q8="The ```js code block is empty."});functionGN(r){returnrinstanceofSC}functionH8(r){returnr.charCodeAt(0)===65279?r.slice(1):r}functionz8(r){returnH8(r).trimStart().slice(0,U8).toLowerCase()}functionW8(r){return/^<(?:!doctype\s+html|html\b|head\b|body\b|script\b|meta\b|title\b|div\b)/.test(z8(r))}functionjA(r,e){lett=newSC(r);throwe.reportLoadErrors!==!1&&Ze(t),t}functionj8(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.`}functionG8(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.`}functionY8(r,e){lett=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.`}functionK8(r){returnYN(r)?(rinstanceofError?r.message:String(r)).match(/Cannot find module ['"]([^'"]+)['"]/)?.[1]:void0}functionYN(r){return!r||typeofr!="object"?!1:r.code==="MODULE_NOT_FOUND"?!0:(rinstanceofError?r.message:String(r)).includes("Cannot find module")}functionQ8(r){returnr!==null&&typeofr=="object"}functionX8(r){returntypeofr.entry=="function"?!0:Object.entries(r).some(([e,t])=>e!=="settings"&&e!=="quickadd"&&typeoft=="function")}functionZ8(r){returntypeofr=="function"?!0:Q8(r)?X8(r):!1}functiondd(r){lete=r.split("::").map(t=>t.trim()).filter(Boolean);return{basename:e[0],memberAccess:e.slice(1)}}functionAC(r){lete=r.path??r.id;if(e===void0)return;let{memberAccess:t}=dd(r.name??"");returnt&&t.length>0?`${e}::${t.join("::")}`:e}asyncfunctionLo(r,e,t={}){letn=e.vault.getAbstractFileByPath(r.path);if(!n){I.logError(`failed to load file ${r.path}.`);return}if(ninstanceof_C.TFile){leti=m=>window.require&&window.require(m),o={},s={exports:o},a=awaite.vault.read(n),l=a;if(Nt.test(n.path)){let{code:m,error:g}=ll(a);if(m===null||m.length===0){t.reportLoadErrors!==!1&&new_C.Notice(`QuickAdd: ${g} (${r.path})`);return}l=m}W8(l)&&jA(j8(r.path),t);try{newFunction("require","module","exports",l)(i,s,o)}catch(m){throwYN(m)&&jA(Y8(r.path,K8(m)),t),m}letc=o.default||s.exports;if(!c)return;letu=c,d=!!o.default,{memberAccess:p}=dd(r.name),f=!!(p&&p.length>0);if(p&&p.length>0){letm;for(;m=p.shift();)u=u[m]}returnd&&!f&&!Z8(u)&&jA(G8(r.path),t),u}}var_C,U8,SC,IC=E(()=>{_C=require("obsidian");Xe();Ie();zg();xt();U8=1024,SC=classextendsError{constructor(e){super(e),this.name="UserScriptLoadError"}}});functionef(r){if(r==null||typeofr!="string"&&typeofr!="number"&&typeofr!="boolean")return"";lete=String(r).trim();returne.startsWith("#")?e.substring(1).trim():e}functionWg(r){returnr==null?[]:(Array.isArray(r)?r:typeofr=="string"?r.split(/,|\s+/):[r]).map(ef).filter(Boolean)}varGA=E(()=>{});varxi,pd=E(()=>{GA();xi=class{staticfilterFiles(e,t,n){leti=this.applyInclusionFilters(e,t,n);returnthis.applyExclusionFilters(i,t,n)}staticapplyInclusionFilters(e,t,n){leti=e,o=this.getIncludeFolders(t);returno.length>0&&(i=i.filter(s=>o.some(a=>this.matchesFolder(s,a)))),t.tags&&t.tags.length>0&&(i=i.filter(s=>this.matchesTags(s,t.tags??[],n,"all"))),i}staticapplyExclusionFilters(e,t,n){returne.filter(i=>!(t.excludeFolders?.length&&t.excludeFolders.some(o=>this.matchesFolder(i,o)))&&!(t.excludeTags?.length&&this.matchesTags(i,t.excludeTags,n,"any"))&&!(t.excludeFiles?.length&&t.excludeFiles.some(o=>this.matchesFile(i,o))))}staticgetIncludeFolders(e){lett=e.folders?.length?e.folders:e.folder?[e.folder]:[];return[...newSet(t.map(n=>this.normalizePath(n)).filter(Boolean))]}staticmatchesFolder(e,t){letn=this.normalizePath(t),
${s}`)}default:return i}}var lQ,ix=E(()=>{rx();lQ=new Set(["auto","inline","spaced","yaml","markdown"])});function sx(r,e){return r.length<=e?r:`${r.slice(0,e)}\u2026`}function pQ(r){let e=r.map(t=>`"${t}"`);return e.length<=1?e.join(""):`${e.slice(0,-1).join(", ")}or${e[e.length-1]}`}function V1(r,e){let t=sx(r,32),n=`{{FIELD:${sx(e,48)}}}`,i=dQ.get(r);if(i)return`UnknownFIELDfilter"${t}"-${i}.Ignoredin${n}.`;let o=O1(r,ox);return o.length>0?`UnknownFIELDfilter"${t}"-didyoumean${pQ(o)}?Ignoredin${n}.`:`UnknownFIELDfilter"${t}"in${n}wasignored.Supportedfilters:${ox.join(", ")}.`}function fQ(r,e){let t=sx(r,32);return`FIELDfilter"${t}"needsavalue-write"${t}:value".Ignoredin{{FIELD:${sx(e,48)}}}.`}function mQ(r,e,t){(t.warn??wf)(V1(r,e))}var ox,dQ,oi,hl=E(()=>{dv();xc();R1();ix();ox=["folder","tag","inline","inline-code-blocks","exclude-folder","exclude-tag","exclude-file","default","default-from","default-empty","default-always","case-sensitive","multi","format"],dQ=new Map([["case-insensitive",'matching is already case-insensitive; use "case-sensitive:true" to match exactly']]);oi=class{static parse(e,t){let n=qo(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=Uo(u);if(!d){let m=u.toLowerCase();t?.warnUnknown&&m&&(t.warn??wf)(ox.includes(m)?fQ(m,e):V1(m,e));continue}let p=d.key,f=d.value;if(!ox.includes(p)){t?.warnUnknown&&mQ(p,e,t);continue}switch(p){case"multi":s=Cc(f);break;case"format":l=!0,a=nx(f,`{{FIELD:${e}}}`,t?.warn)??"auto";break;case"folder":o.folders??(o.folders=[]),o.folders.push(f),o.folder||(o.folder=f);break;case"tag":{o.tags??(o.tags=[]);let m=f.startsWith("#")?f.substring(1):f;o.tags.push(m);break}case"inline":o.inline=f.toLowerCase()==="true";break;case"inline-code-blocks":o.inlineCodeBlocks??(o.inlineCodeBlocks=[]),o.inlineCodeBlocks.push(...f.split(",").map(m=>m.trim().toLowerCase()).filter(m=>m.length>0));break;case"default":o.defaultValue=f;break;case"default-from":o.defaultFrom=f.toLowerCase();break;case"default-empty":o.defaultEmpty=f.toLowerCase()==="true";break;case"default-always":o.defaultAlways=f.toLowerCase()==="true";break;case"case-sensitive":o.caseSensitive=f.toLowerCase()==="true";break;case"exclude-folder":o.excludeFolders??(o.excludeFolders=[]),o.excludeFolders.push(f);break;case"exclude-tag":{o.excludeTags??(o.excludeTags=[]);let m=f.startsWith("#")?f.substring(1):f;o.excludeTags.push(m);break}case"exclude-file":o.excludeFiles??(o.excludeFiles=[]),o.excludeFiles.push(f);break}}return!s&&l&&(t?.warn?.(`QuickAdd:|format:needs|multiin"{{FIELD:${e}}}";ignoring.`),a="auto"),{fieldName:i,filters:o,...s?{multiSelect:s}:{},...a!=="auto"?{multiFormat:a}:{}}}}});function jI(r){return r.replace(/^\/+|\/+$/g,"")}function hv(r,e=t=>t){return JSON.stringify([...r].map(e).sort())}function B1(r,e){let t=[`folder=${jI(r)}`];return e.folders?.length&&t.push(`folders=${hv(e.folders,jI)}`),e.tags?.length&&t.push(`tags=${hv(e.tags)}`),e.excludeFolders?.length&&t.push(`xfolder=${hv(e.excludeFolders,jI)}`),e.excludeTags?.length&&t.push(`xtag=${hv(e.excludeTags)}`),e.excludeFiles?.length&&t.push(`xfile=${hv(e.excludeFiles)}`),t.join("|")}function gQ(r){let{folderPath:e,mode:t,label:n,optional:i,allowCustomInput:o,multiSelect:s,filter:a}=r,l=[B1(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 ax(r,e){if(!r)return null;let t=qo(r),n=(t.shift()??"").trim();if(!n)return null;let i=t,o=ws(i,"optional");i=o.remaining;let s=o.found,a=ws(i,"custom");i=a.remaining;let l=a.found,c=ws(i,"multi");i=c.remaining;let u=c.found,d="name",p=[];for(let w of i){let T=w.trim().toLowerCase();if(hQ.has(T)){d=T;continue}p.push(w)}let f,m;for(let w of p){let T=Uo(w);T&&(T.key==="label"&&T.value?f=T.value:T.key==="name"&&T.value&&(m=T.value))}let g=oi.parse(r,{warn:e?.warn}),v=u||(g.multiSelect??!1),y=g.multiFormat??"auto",b={folder:n,tags:g.filters.tags,excludeFolders:g.filters.excludeFolders,excludeTags:g.filt
`:" ");try{return$Q(e,T),T}catch(C){returnI.logError(`Failed to insert image link: ${CinstanceofError?C.message:String(C)}`),newCv.Notice("QuickAdd: saved the image but could not insert its link."),""}}asyncfunctiong(y){letb=newDate,x=FQ(y);if(x.length===0)returnI.logMessage("QuickAdd: image ingest skipped (no-images)."),"";if(i)returnnewCv.Notice("QuickAdd: an image is still being saved \u2014 drop again in a moment."),I.logMessage("QuickAdd: image ingest skipped (busy)."),"";letw="";returni=(async()=>{w=awaitm(x,b)})().finally(()=>{i=null}),awaiti,w.length>0&&I.logMessage(`QuickAdd: ingested ${x.length} image(s) into the active prompt.`),w}e.addEventListener("paste",u),e.addEventListener("dragenter",d),e.addEventListener("dragover",d),e.addEventListener("dragleave",p),e.addEventListener("drop",f),e.addEventListener("compositionstart",a),e.addEventListener("compositionend",l);letv={isBusy:()=>i!==null,whenIdle:()=>i??Promise.resolve(),ingestFiles:g,detach:()=>{o=!0,p(),e.removeEventListener("paste",u),e.removeEventListener("dragenter",d),e.removeEventListener("dragover",d),e.removeEventListener("dragleave",p),e.removeEventListener("drop",f),e.removeEventListener("compositionstart",a),e.removeEventListener("compositionend",l);lety=px.findIndex(b=>b.handle===v);y>=0&&px.splice(y,1)}};returnpx.push({handle:v,inputEl:e}),v}asyncfunctionQ1(r){lete=AQ();if(!e)returnI.logMessage("QuickAdd: image ingest skipped (no-active-prompt)."),{ok:!1,reason:"no-active-prompt"};if(e.handle.isBusy())returnI.logMessage("QuickAdd: image ingest skipped (busy)."),{ok:!1,reason:"busy"};lett=awaite.handle.ingestFiles(r);returnt.length===0?{ok:!1,reason:"no-images"}:{ok:!0,inserted:t}}functionj1(r,e,t){switch(r){case"paste":{if(e.getData("text/plain").length>0)return{kind:"stand-down"};letn=G1(e).map(i=>({origin:"bytes",...i,naming:{kind:"paste-name"}}));returnn.length>0?{kind:"take",images:n}:{kind:"stand-down"}}case"drop":{letn=IQ(e,t);if(n.length>0)return{kind:"take",images:n};leti=G1(e).map(o=>({origin:"bytes",...o,naming:X1(o)}));returni.length>0?{kind:"take",images:i}:{kind:"stand-down"}}default:returnfx(r)}}functionIQ(r,e){lett=[];for(letnofr.getData("text/plain").split(/\r?\n/u)){leti=n.trim();if(i.length===0||i.toLowerCase().startsWith("file://")||Dr(i))continue;leto=e.vault.getAbstractFileByPath(i);DQ(o)&&t.push({origin:"vault",file:o})}returnt}functionDQ(r){returnr!==null&&"extension"inr&&typeofr.extension=="string"&&H1(r.extension)}functionG1(r){lete=[],t=0;for(letoofArray.from(r.items??[])){if(o.kind!=="file"||(t++,!vl(o.type)))continue;lets=o.getAsFile();s&&e.push({file:s,mimeType:o.type})}if(t>0&&e.length===t)returne;if(e.length===0){leto=[];for(letsofArray.from(r.files??[]))vl(s.type)&&o.push({file:s,mimeType:s.type});returno}letn=[...e],i=newSet(e.map(({file:o,mimeType:s})=>`${o.name}\0${o.size}\0${s}\0${o.lastModified}`));for(letoofArray.from(r.files??[])){if(!vl(o.type))continue;lets=`${o.name}\0${o.size}\0${o.type}\0${o.lastModified}`;i.has(s)||(i.add(s),n.push({file:o,mimeType:o.type}))}returnn}functionFQ(r){returnr.flatMap(e=>{if(!vl(e.type))return[];lett={file:e,mimeType:e.type};return[{origin:"bytes",...t,naming:X1(t)}]})}functionX1(r){lete=W1(r.file.name);returne===null?{kind:"clipboard-stamp"}:{kind:"original-stem",stem:e}}functionPQ(r,e,t){switch(r.naming.kind){case"clipboard-stamp":returnz1(r.mimeType,e);case"paste-name":returnlx({extension:gl[r.mimeType],sourcePath:t,now:e,nameAfterNoteTitle:X.getState().namePastedImagesAfterNoteTitle});case"original-stem":return`${r.naming.stem}.${gl[r.mimeType]}`;default:returnfx(r.naming)}}functionY1(r){returnArray.from(r.types??[]).some(e=>e==="Files"||vl(e))}functionfx(r){thrownewError(`Unexpected image intake value: ${String(r)}`)}functionMQ(r){lete=K1.then(r,r);returnK1=e.catch(()=>{}),e}function$Q(r,e){r.focus();lett=!1;try{t=r.ownerDocument.execCommand("insertText",!1,e)}catch{t=!1}if(t)return;letn=r.selectionStart??r.value.length,i=r.selectionEnd??n;r.setRangeText(e,n,i,"end"),r.dispatchEve
`)}if(typeofr=="string"||typeofr=="boolean"||typeofr=="number"&&Number.isFinite(r))returnString(r);thrownewError("{{PROPERTY}} only expands text, finite numbers, checkboxes, and lists of text.")}functionG2(r){returnj2.map(e=>({key:e,present:r.has(e),value:r.get(e)}))}functionY2(r,e){for(lettofe)t.present?r.set(t.key,t.value):r.delete(t.key)}functionK2(r,e,t){for(letiofj2)if(!(!r.has(i)||r.get(i)===void0))thrownewError(`Property Capture cannot seed '${i}' because that variable is already set. Rename your {{VALUE:${i}}} prompt (or other writer of this key) so it does not collide with the property snapshot.`);letn;t!=null&&(n=SX(t,e)),r.set("propertyKey",e),r.set("propertyValue",n),r.set("list",Array.isArray(n)?[...n]:[])}functionSX(r,e){if(typeofr=="string"||typeofr=="boolean"||typeofr=="number"&&Number.isFinite(r))returnr;if(Array.isArray(r)&&r.every(t=>typeoft=="string"))return[...r];thrownewError(`Property '${e}' supports text, finite numbers, checkboxes, and lists of text only.`)}functionMv(r,e){if(Object.prototype.hasOwnProperty.call(r,e))returne;lett=Object.keys(r).filter(n=>n.trim().toLowerCase()===e.trim().toLowerCase());if(t.length>1)thrownewError(`Property '${e}' matches multiple properties in the target note.`);returnt[0]??e}functionQ2(r){returnr.split(/\r?\n/).map(e=>e.trim()).filter(e=>e!=="")}functionX2(r){returntypeofr=="string"?Q2(r).length===0:Array.isArray(r)&&r.length===0}functionU2(r,e){if(typeofr=="string"||typeofr=="boolean"||typeofr=="number"&&Number.isFinite(r))returnr;if(Array.isArray(r)&&r.every(t=>typeoft=="string"))return[...r];thrownewError(`Property '${e}' supports text, finite numbers, checkboxes, and lists of text only.`)}function_X(r,e){if(r===null&&["tags","aliases","cssclasses"].includes(e.toLowerCase()))return"list";if(r===null)returnnull;switch(r.toLowerCase()){case"text":return"text";case"number":return"number";case"checkbox":case"boolean":return"checkbox";case"list":case"multitext":case"tags":case"aliases":return"list";case"date":return"date";case"datetime":return"datetime";default:thrownewError(`Property '${e}' has unsupported type '${r}'.`)}}functionMx(r){returnArray.isArray(r)?"list":typeofr=="boolean"?"checkbox":typeofr=="number"?"number":"text"}functionAX(r,e,t){letn=Mx(r);if(e==="date"||e==="datetime"){if(typeofr=="string"&&(r===""||(e==="date"?/^\d{4}-\d{2}-\d{2}$/:/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}(?::\d{2}(?:\.\d+)?)?(?:Z|[+-]\d{2}:\d{2})?$/).test(r)&&Number.isFinite(Date.parse(r))&&newDate(r.slice(0,10)).toISOString().slice(0,10)===r.slice(0,10)))return}elseif(n===e)return;thrownewError(`Property '${t}' requires ${e}; the capture is ${n}. Use a matching typed VALUE token or value.`)}functionZ2(r){let{frontmatter:e,config:t}=r,n=Mv(e,r.key),i=Object.prototype.hasOwnProperty.call(e,n);if(!i&&!t.createIfMissing)thrownewError(`Property '${n}' is missing. Enable 'Create property if missing' to add it.`);leto=i?e[n]:void0,s=U2(r.value,n),a=o==null?null:U2(o,n),l=_X(r.registeredType,n)??(a===null?null:Mx(a)),c=typeofs=="string"?Q2(s):null;if(t.action==="addToList"){if(a!==null&&!Array.isArray(a))thrownewError(`Property '${n}' is ${Mx(a)}. 'Add to list' requires a list.`);if(l!==null&&l!=="list")thrownewError(`Property '${n}' is ${l}. 'Add to list' requires a list.`);letd=c??s;if(!Array.isArray(d))thrownewError(`Property '${n}' requires text or a list of text to add.`);returnd.length===0?a??[]:r.compose?[...newSet(d)]:[...newSet([...a??[],...d])]}if(l==="list"&&a!==null&&!Array.isArray(a))thrownewError(`Property '${n}' contains ${Mx(a)}. Set a list only after correcting the existing property to a list.`);if(l===null&&c!==null&&c.length>1)thrownewError(`Property '${n}' has no type yet, so ${c.length} lines could be one text value or a list. Use 'Add to list' to write them as list items, or set the property's type in Obsidian first - Text keeps the lines as one value.`);letu=l==="list"?c??s:s;returnl!==null&&AX(u,l,n),Array.isArray(u)?[...newSet(u)]:u}functionJ2(r){lete=(0,Fd.getFrontMatterInfo)(r);if
${(0,Fd.stringifyYaml)(e)}---
${n}`}var Fd,j2,wD=E(()=>{Fd=require("obsidian");Xe();j2=["propertyKey","propertyValue","list"]});var tV,$x,Lc,Pd=E(()=>{hD();gD();gD();bD();R2();tV=require("obsidian");Xe();lo();V2();Ie();rx();hl();q2();wD();hD();bD();$x=10,Lc=class extends Fx{constructor(){super(...arguments);this.linkToCurrentFileBehavior="required";this.targetFolderPath=null;this.propertyTokenExpanded=!1}runClocks(){return this.clocks}setTemplateInclusionState(t){this.templateInclusion=t}replaceDateInString(t){return F2(t,{clocks:()=>this.runClocks(),applyCase:(n,i,o)=>this.applyCaseOption(n,i,o)})}replaceTimeInString(t){return P2(t,{clocks:()=>this.runClocks(),applyCase:(n,i,o)=>this.applyCaseOption(n,i,o)})}async replaceSelectedInString(t){if(!SA.test(t))return t;let n=await this.getSelectedText(),i=new RegExp(SA.source,"gi");return t.replace(i,()=>n)}async replaceClipboardInString(t){if(!_A.test(t))return t;let n=await this.getClipboardContent(),i=new RegExp(_A.source,"gi");return t.replace(i,()=>n)}async replaceLinkToCurrentFileInString(t){if(!EA.test(t))return t;let n=this.getCurrentFileLink();if(!n){if(this.linkToCurrentFileBehavior==="required")throw new Error("Unable to get current file path. Make sure you have a file open in the editor.");I.logMessage("Skipping {{LINKCURRENT}} replacement because no active file is available.")}let i=new RegExp(EA.source,"gi");return t.replace(i,()=>n??"")}replaceLinkToCurrentSectionInString(t){if(!TA.test(t))return t;let n=this.getCurrentFileLinkToSection();if(!n){if(this.linkToCurrentFileBehavior==="required")throw new Error("Unable to get current file path. Make sure you have a file open in the editor.");I.logMessage("Skipping {{LINKSECTION}} replacement because no active file is available.")}let i=new RegExp(TA.source,"gi");return t.replace(i,()=>n??"")}replaceCurrentFileLinksInString(t){return this.replaceCurrentFileTokensInString(t,{links:!0})}replaceCurrentFileTokensInString(t,n){return O2(t,n,{LINKCURRENT:()=>this.getCurrentFileLink(),LINKSECTION:()=>this.getCurrentFileLinkToSection(),FILENAMECURRENT:()=>this.getCurrentFileName(),FOLDER:()=>this.targetFolderPath??"",FOLDERCURRENT:()=>this.getCurrentFolderPath(),TITLE:()=>this.getVariableValue("title")},this.linkToCurrentFileBehavior)}async replaceCurrentFileNameInString(t){return this.replaceCurrentFileTokensInString(t,{fileName:!0})}setLinkToCurrentFileBehavior(t){this.linkToCurrentFileBehavior=t}setTargetFolderPath(t){if(t==null){this.targetFolderPath=null;return}let n=t.trim();this.targetFolderPath=n==="/"?"":n.replace(/^\/+/,"").replace(/\/+$/,"")}replaceTargetFolderInString(t){return this.replaceCurrentFileTokensInString(t,{folder:!0})}getCurrentFileLinkToSection(){return null}getCurrentFolderPath(){return null}async replaceFieldVarInString(t){let n=new RegExp(cC.source,"gi"),i="",o=0,s;for(;(s=n.exec(t))!==null;){i+=t.slice(o,s.index);let a=s[1]+(s[2]||"");if(a){let l=this.getFieldVariableKey(a),c=oi.parse(a,{warnUnknown:!0,warn:this.warnSink});this.hasConcreteVariable(l)||this.variables.set(l,await this.suggestForField(a,c));let u=this.hasConcreteVariable(l)?this.variables.get(l):this.getVariableValue(l);(!c.multiFormat||c.multiFormat==="auto")&&this.retainSingleTokenValue(t,s.index,s.index+s[0].length,u);let d;Array.isArray(u)?d=this.renderCollectedOrArrayValue({input:t,matchStart:s.index,matchEnd:s.index+s[0].length,rawValue:u,fallbackKey:c.fieldName,heuristicEnabled:!1,multiFormat:c.multiFormat??"auto"})??u.join(","):d=Ed(t,s.index,s.index+s[0].length,String(u??"")),i+=d}else i+=s[0];o=n.lastIndex}return i+t.slice(o)}getFieldVariableKey(t){return`${sd}${t}`}async replaceFileInString(t){let n=new RegExp(uC.source,"gi"),i="",o=0,s;for(;(s=n.exec(t))!==null;){i+=t.slice(o,s.index);let a=ax(s[1]??"",{warn:this.warnSink});if(!a){i+=s[0],o=n.lastIndex;continue}let l=a.variableKey;this.hasConcreteVariable(l)||this.variables.set(l,await this.suggestForFile(a));let c=L2(this.variables.get(l),a.mode,u=>this.getFileLinkForStoredValue(u));if(Array.isArray(c)){let u=this.renderCollectedOrArrayValue({input:t,matchStart:s.index,matchEnd:s.index+s[0].lengt
`,o+=2):c==="\\"?(i+="\\",o+=2):(i+="\\",o+=1):(i+=l,o+=1)}returni}replaceRandomInString(t){letn=t;for(;AA.test(n);){leti=AA.exec(n);if(!i||!i[1])continue;leto=parseInt(i[1]);if(o<=0||o>100)thrownewError(`Random string length must be between 1 and 100. Got: ${o}`);lets="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",a="";for(letl=0;l<o;l++)a+=s.charAt(Math.floor(Math.random()*s.length));n=n.replace(i[0],a)}returnn}replaceTitleInString(t){returnthis.replaceCurrentFileTokensInString(t,{title:!0})}consumePropertyTokenExpanded(){lett=this.propertyTokenExpanded;returnthis.propertyTokenExpanded=!1,t}replacePropertyInString(t){if(!Ag.test(t))returnt;if(this.promptScope!=="propertyValue")thrownewError("{{PROPERTY}} can only be used in a property Capture format.");this.propertyTokenExpanded=!0;letn=this.variables.get("propertyValue");/^{{PROPERTY}}$/i.test(t.trim())&&t.trim()===t&&this.retainSingleTokenValue(t,0,t.length,n===void0?"":n);leti=W2(n);returnt.replace(newRegExp(Ag.source,"gi"),()=>i)}}});functionnV(r){returnr<=31||r===127||r===8232||r===8233}functionPX(r){lete="",t=0;for(;t<r.length;){letn=t;for(;n<r.length&&r.charCodeAt(n)===32;)n++;if(n<r.length&&nV(r.charCodeAt(n))){for(;n<r.length&&nV(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}returne}functioniV(r,e){lett=r.length;for(;t>0&&e.includes(r[t-1]);)t--;returnr.slice(0,t)}functionMd(r){returnMX.filter(e=>r.includes(e))}functionsV(r){return`A file or folder name cannot contain ${cV(r)}, so this choice would fail at run time. ${lV}`}functionaV(r,e){return`Cannot create "${e}": a file or folder name cannot contain ${cV(r)}. ${lV}`}functioncV(r){returnr.map(e=>`"${e}"`).join(", ")}functionWn(r,e="File path"){let{path:t,problems:n}=dV(r,e);if(n.length>0)thrownewError(n[0]);returnt}functionuV(r,e="File path"){returndV(r,e)}functiondV(r,e){lett=[],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):$X(o,e,t)).join("/"),problems:t}}function$X(r,e,t){if(r.length===0)returnr;letn=DX.test(r),i=FX.test(r),o=PX(r);n&&(o=o.replace(/^ /u,"")),i&&(o=o.replace(/ $/u,""));lets=iV(o," ");returns==="."||s===".."?(t.push(`${e} cannot contain "." or ".." path segments.`),s):(o=iV(o,". "),o||t.push(`${e} contains an empty path segment after formatting.`),o)}varoV,DX,FX,MX,lV,da=E(()=>{oV="\0-\x7F\u2028\u2029",DX=newRegExp(`^ *[${oV}]`,"u"),FX=newRegExp(`[${oV}] *$`,"u");MX=[":"];lV="Check your own text and tokens like {{TIME}}, which is HH:mm."});functionBc(r,e){lett=r,n=newRegExp(dC.source,"gi"),i=0;for(;n.test(t)&&!(++i>5);)t=t.replace(n,(o,s)=>{leta=String(s??"").trim();if(!a)returno;letl=e?.[a];returntypeofl=="string"?l:""});returnt}var$v=E(()=>{Xe()});vargt,Qt,po,Cl=E(()=>{(function(r){r[r.AM=0]="AM",r[r.PM=1]="PM"})(gt||(gt={}));(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"})(Qt||(Qt={}));(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"})(po||(po={}))});functionFs(r,e){r.assign("day",e.getDate()),r.assign("month",e.getMonth()+1),r.assign("year",e.getFullYear())}functionBx(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?gt.AM:gt.PM)}functionxl(r,e){r.imply("day",e.getDate()),r.imply("month",e.getMonth()+1),r.imply("year",e.getFullYear())}functionOv(r,e){r.imply("hour",e.getHours()),r.imply("minute",e.getMinutes()),r.imply("second",e.getSeconds()),r.imply("millisecond",e.getMilliseconds()),r.imply
`)),Object.assign(o,db("anthropic",e.modelParams??{})),e.tools&&e.tools.length>0&&(o.tools=e.tools.map(s=>({name:s.name,description:s.description,input_schema:s.parameters})),e.toolChoice?o.tool_choice=Une(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:fb(e.responseFormat.schema)}}),o}function Une(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 Hne(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 zne(r,e){let t=[],n=[];for(let s of e.messages)if(s.role==="system")s.content&&t.push(s.content);else if(s.role==="user")n.push({role:"user",parts:[{text:s.content}]});else if(s.role==="assistant")if(Array.isArray(s.providerRaw))n.push({role:"model",parts:s.providerRaw});else{let a=[];s.content&&a.push({text:s.content});for(let l of s.toolCalls??[])a.push({functionCall:{name:l.name,args:l.args??{}}});n.push({role:"model",parts:a})}else n.push({role:"user",parts:s.results.map(a=>({functionResponse:{name:a.name,response:a.isError?{error:a.content}:{result:a.content}}}))});let i={contents:n};t.length>0&&(i.systemInstruction={role:"system",parts:[{text:t.join(`
`,". "," "],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 p=d+a.length;if(p<=0||p>=r.length)continue;let f=Math.abs(p-e);f<i&&(i=f,n=p)}}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 Jne(r){let e=new RegExp(od.source,"gi"),t;for(;(t=e.exec(r))!==null;)if(t[1].split("|")[0].trim().toLowerCase()==="chunk")return!0;return!1}function eie(r){return Oo.test(r)||hc.test(r)||dC.test(r)||tl.test(r)}function tie(r){return Pz.some(e=>r.includes(e))}function rie(r){return Pz.slice().sort((e,t)=>t.length-e.length).reduce((e,t)=>e.split(t).join(" "),r)}function $z(r){if(r>dk)throw new Error(`QuickAddwouldsplitthischunkedAIrequestintomorethan${dk}prompts,whichexceedsthesafetylimit.Increasethechunksize,usealargerchunkseparator,orreducetheinputtext.`)}function nie(r,e,t){let n=Math.max(1,Math.floor(e)),i=[r],o=0;for(;i.length>0;){let s=i.pop(),l=Ui(s)<=n?null:Mz(s);if(!l){t.push(s),o+=1,$z(o);continue}i.push(l[1],l[0])}}function iie(r){let e=r.flags.replace(/[gy]/g,"");return new RegExp(r.source+"|",e).exec("").length-1}function sie(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(iie(e)>0||oie.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 aie(r,e,t,n){let i=[];if(r.forEach((l,c)=>{let u=[];nie(l,t,u),u.forEach((d,p)=>{i.push({text:d,joiner:p===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=Ui(l.text)+Math.max(1,Ui(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 lie(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 c0(r,e,t){if(X.getState().disableOnlineFeatures)throw new Error("Online features are disabled in settings. Enable them to use the AI Assistant.");let n=Kd(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 p=e.chunkSeparator||/\n/g,{chunks:f,separators:m}=sie(u,p),g=await t(c,{chunk:l0});if(!(Jne(c)||eie(c)&&tie(g)))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,b=hU(y),x=rie(g),w=Ui(l)+Ui(x);if(w>=y)throw new Error(`Theestimatedpromptoverhead(${w}tokens)exceedsthemodel's entire context window (${y} tokens). Shorten the system prompt or prompt template, or use a model with a larger context window.`);let{budget:T,clamped:C}=lie(b-w,e.maxChunkTokens);C&&I.logMessage(`[ChunkedPrompt] Requested max chunk tokens (${e.maxChunkTokens}) exceeds this model'sestimatedinputbudget;using${T}estimatedtokensperchunkinstead.`);let S=e.shouldMerge??!0,A=aie(f,m,T,S);$z(A.length);let D=gb(r,i,o,s,l,d),P=["prompting",`${A.length}promptsbeingsent.`];n.setMessage(P[0],P[1]);let U=new uk(5,1e3*30),K=!1,W=0,ee=Promise.resolve(),me=G=>{let ie=ee.then(()=>{if(K)throw new Error("Chunked prompt stopped after an earlier failure.");return t(c,{chunk:G})});return ee=ie.then(()=>{},()=>{}),ie},O=async(G,ie=0)=>{if(K)throw new Error("Chunked prompt stopped after an earlier failure.");let xe;try{xe=await me(G)}catch(ue){throw K=!0,ue}try{return[(await U.add(()=>{if(K)throw new Error("Chunked prompt stopped after an earlier failure.");if(W+=1,W>dk)throw new Error(`ChunkedAIrequestexceededthesafetylimitof${dk}providerrequests.`);return D(xe)})).content]}catch(ue){let be=Mz(G);if(ie>=Xne||!be||!YU(ue))throw K=!0,ue;
`),we=At(Iu,xp,Cp).desc("newline"),qe=At(we,De);o.all=Z,o.alt=At,o.any=di,o.cr=Cp,o.createLanguage=function(k){var R={};for(var q in k)({}).hasOwnProperty.call(k,q)&&(function(J){R[J]=zt(function(){return k[J](R)})})(q);return R},o.crlf=Iu,o.custom=function(k){return o(k(S,A))},o.digit=Pt,o.digits=It,o.empty=rr,o.end=qe,o.eof=De,o.fail=Je,o.formatError=Oe,o.index=Qn,o.isParser=w,o.lazy=zt,o.letter=pi,o.letters=Di,o.lf=xp,o.lookahead=mt,o.makeFailure=A,o.makeSuccess=S,o.newline=we,o.noneOf=function(k){return Qe(function(R){return k.indexOf(R)<0}).desc("noneof'"+k+"'")},o.notFollowedBy=Ft,o.of=Fe,o.oneOf=function(k){for(var R=k.split(""),q=0;q<R.length;q++)R[q]="'"+R[q]+"'";return Qe(function(J){return k.indexOf(J)>=0}).desc(R)},o.optWhitespace=Au,o.Parser=o,o.range=function(k,R){return Qe(function(q){return k<=q&&q<=R}).desc(k+"-"+R)},o.regex=ve,o.regexp=ve,o.sepBy=mr,o.sepBy1=zr,o.seq=He,o.seqMap=Le,o.seqObj=function(){for(var k,R={},q=0,J=(k=arguments,Array.prototype.slice.call(k)),se=J.length,oe=0;oe<se;oe+=1){var de=J[oe];if(!w(de)){if(T(de)&&de.length===2&&typeof de[0]=="string"&&w(de[1])){var $e=de[0];if(Object.prototype.hasOwnProperty.call(R,$e))throw new Error("seqObj:duplicatekey"+$e);R[$e]=!0,q++;continue}throw new Error("seqObjargumentsmustbeparsersor[string,parser]arraypairs.")}}if(q===0)throw new Error("seqObjexpectsatleastonenamedparser,foundzero");return o(function(vt,nr){for(var lr,Wr={},Wt=0;Wt<se;Wt+=1){var Xn,Gs;if(T(J[Wt])?(Xn=J[Wt][0],Gs=J[Wt][1]):(Xn=null,Gs=J[Wt]),!(lr=D(Gs._(vt,nr),lr)).status)return lr;Xn&&(Wr[Xn]=lr.value),nr=lr.index}return D(S(nr,Wr),lr)})},o.string=ge,o.succeed=Fe,o.takeWhile=function(k){return me(k),o(function(R,q){for(var J=q;J<R.length&&k(W(R,J));)J++;return S(J,R.slice(q,J))})},o.test=Qe,o.whitespace=wp,o["fantasy-land/empty"]=rr,o["fantasy-land/of"]=Fe,o.Binary={bitSeq:f,bitSeqObj:function(k){p();var R={},q=0,J=c(function(oe){if(T(oe)){var de=oe;if(de.length!==2)throw new Error("["+de.join(",")+"]shouldbelength2,gotlength"+de.length);if(O(de[0]),ee(de[1]),Object.prototype.hasOwnProperty.call(R,de[0]))throw new Error("duplicatekeyinbitSeqObj:"+de[0]);return R[de[0]]=!0,q++,de}return ee(oe),[null,oe]},k);if(q<1)throw new Error("bitSeqObjexpectsatleastonenamedpair,got["+k.join(",")+"]");var se=c(function(oe){return oe[0]},J);return f(c(function(oe){return oe[1]},J)).map(function(oe){return l(function(de,$e){return $e[0]!==null&&(de[$e[0]]=$e[1]),de},{},c(function(de,$e){return[de,oe[$e]]},se))})},byte:function(k){if(p(),ee(k),k>255)throw new Error("Valuespecifiedtobyteconstructor("+k+"=0x"+k.toString(16)+")islargerinvaluethanasinglebyte.");var R=(k>15?"0x":"0x0")+k.toString(16);return o(function(q,J){var se=W(q,J);return se===k?S(J+1,se):A(J,R)})},buffer:function(k){return m("buffer",k).map(function(R){return Buffer.from(R)})},encodedString:function(k,R){return m("string",R).map(function(q){return q.toString(k)})},uintBE:v,uint8BE:v(1),uint16BE:v(2),uint32BE:v(4),uintLE:y,uint8LE:y(1),uint16LE:y(2),uint32LE:y(4),intBE:b,int8BE:b(1),int16BE:b(2),int32BE:b(4),intLE:x,int8LE:x(1),int16LE:x(2),int32LE:x(4),floatBE:m("floatBE",4).map(function(k){return k.readFloatBE(0)}),floatLE:m("floatLE",4).map(function(k){return k.readFloatLE(0)}),doubleBE:m("doubleBE",8).map(function(k){return k.readDoubleBE(0)}),doubleLE:m("doubleLE",8).map(function(k){return k.readDoubleLE(0)})},t.exports=o}])})})(Ik,Ik.exports);var $=Ik.exports,tM=()=>/[#*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
`)[0];let n=t.substring(2).trim();return $.makeSuccess(e+t.length,n)}),namedField:r=>$.alt(r.explicitNamedField,mse(Ws.field).map(([e,t])=>Fk.named(hse(t),e))),sortField:r=>$.seqMap(Ws.field.skip($.optWhitespace),$.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 _W(()=>({type:e,fields:[],showId:!0}),$.seqMap($.regexp(/WITHOUT\s+ID/i).skip($.optWhitespace).atMost(1),$.sepBy(r.namedField,$.string(",").trim($.optWhitespace)),(t,n)=>({type:e,fields:n,showId:t.length==0})));case"list":return _W(()=>({type:e,format:void 0,showId:!0}),$.seqMap($.regexp(/WITHOUT\s+ID/i).skip($.optWhitespace).atMost(1),Ws.field.atMost(1),(t,n)=>({type:e,format:n.length==1?n[0]:void 0,showId:t.length==0})));case"task":return $.succeed({type:e});case"calendar":return $.whitespace.then($.seqMap(r.namedField,t=>({type:e,showId:!0,field:t})));default:return $.fail(`Unrecognized query type '${e}'`)}}).desc("TABLEorLISTorTASKorCALENDAR"),fromClause:r=>$.seqMap($.regexp(/FROM/i),$.whitespace,Ws.source,(e,t,n)=>n),whereClause:r=>$.seqMap($.regexp(/WHERE/i),$.whitespace,Ws.field,(e,t,n)=>({type:"where",clause:n})).desc("WHERE<expression>"),sortByClause:r=>$.seqMap($.regexp(/SORT/i),$.whitespace,r.sortField.sepBy1($.string(",").trim($.optWhitespace)),(e,t,n)=>({type:"sort",fields:n})).desc("SORTfield[ASC/DESC]"),limitClause:r=>$.seqMap($.regexp(/LIMIT/i),$.whitespace,Ws.field,(e,t,n)=>({type:"limit",amount:n})).desc("LIMIT<value>"),flattenClause:r=>$.seqMap($.regexp(/FLATTEN/i).skip($.whitespace),r.namedField,(e,t)=>({type:"flatten",field:t})).desc("FLATTEN<value>[AS<name>]"),groupByClause:r=>$.seqMap($.regexp(/GROUP BY/i).skip($.whitespace),r.namedField,(e,t)=>({type:"group",field:t})).desc("GROUPBY<value>[AS<name>]"),clause:r=>$.alt(r.fromClause,r.whereClause,r.sortByClause,r.limitClause,r.groupByClause,r.flattenClause),query:r=>$.seqMap(r.headerClause.trim(_0),r.fromClause.trim(_0).atMost(1),r.clause.trim(_0).many(),(e,t,n)=>({header:e,source:t.length==0?Ta.folder(""):t[0],operations:n,settings:eM}))}),_0=$.alt($.whitespace,_3.comment).many().map(r=>r.join("")),gse=r=>r?r.plugins.plugins.dataview?.api:window.DataviewAPI,vse=r=>r.plugins.enabledPlugins.has("dataview");ka.DATE_SHORTHANDS=j0;ka.DURATION_TYPES=W0;ka.EXPRESSION=Ws;ka.KEYWORDS=G0;ka.QUERY_LANGUAGE=_3;ka.getAPI=gse;ka.isPluginEnabled=vse;ka.parseField=fse});function Rk(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 rM=E(()=>{});function Nk(r){return r.replace(/[\\"]/g,"\\$&")}functionyse(r){returnr.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}functionI3(r){returnNk(yse(r))}functionD3(r){returntypeofr=="object"&&r!==null&&"path"inr&&typeofr.path=="string"}varnM,Fb,F3=E(()=>{nM=z$(A3());Ie();rM();Fb=class{staticgetDataviewAPI(e){lett=(0,nM.getAPI)(e);returnt||(I.logMessage("Dataview plugin is not installed or enabled"),null)}staticasyncgetFieldValues(e,t){returnthis.queryFieldValues(e,t)}staticasyncgetFieldValuesWithFilter(e,t,n={}){returnthis.queryFieldValues(e,t,n)}staticasyncqueryFieldValues(e,t,n){leti=newSet,o=this.getDataviewAPI(e);if(!o)returni;try{leta=`field("${Nk(t)}")`,l=[a],c=(n?.folders?.length?n.folders:n?.folder?[n.folder]:[]).map(g=>g.replace(/^\/+|\/+$/g,"")).filter(Boolean);if(c.length>0){letg=c.map(v=>`regexmatch("^${I3(v)}/", file.path)`);l.push(`(${g.join(" OR ")})`)}n?.tags?.length&&n.tags.forEach(g=>{letv=g.startsWith("#")?g:`#${g}`;l.push(`contains(file.tags, "${Nk(v)}")`)}),n?.excludeFolders?.length&&n.excludeFolders.forEach(g=>{letv=g.replace(/^\/+|\/+$/g,"");l.push(`!regexmatch("^${I3(v)}/", file.path)`)}),n?.excludeTags?.length&&n.excludeTags.forEach(g=>{letv=g.starts
`),o=[],s=null;for(let a of i){if(!s){let l=this.matchFenceOpen(a);l?s={...l,lines:[a]}:o.push(a);continue}if(this.matchFenceClose(a,s.length)){let l=s.info.trim().split(/\s+/)[0]?.toLowerCase();if(n.size>0&&l!==void 0&&l.length>0&&n.has(l))for(let u=1;u<s.lines.length;u++)o.push(s.lines[u]);s=null}else s.lines.push(a)}if(s)for(let a of s.lines)o.push(a);return o.join(`
`:"",a=n.length+o.length,l=a+e.length;return{content:`${n}${o}${e}${s}${i}`,insertedStartOffset:a,insertedEndOffset:l}}functionZ3(r,e){returnop(r,e).content}varX3,Q3,Rse,wu=E(()=>{X3=require("obsidian"),Q3=/^[^\S\r\n]*\r?\n/,Rse=/^\r?\n/});functionRb(r){lete=ql(r),t=/\{\{CURSOR\}\}/i.exec(r.slice(e));return{content:zn(r),offsets:t?[zn(r.slice(0,e)).length+t.index]:[]}}functionhM(r,e){if(r.content===e)returnr;lett=ql(r.content),n=ql(e);returnr.offsets.some(i=>i<t)||r.content.slice(t)!==e.slice(n)?null:{content:e,offsets:r.offsets.map(i=>i+n-t)}}vargM=E(()=>{wl();wu()});varNb,mh,vM=E(()=>{Nb=require("obsidian");Xe();Ie();ht();la();mh=class{constructor(e){this.app=e}asynccreateFolder(e){awaitthis.app.vault.adapter.exists(e)||awaitthis.app.vault.createFolder(e)}stripLeadingSlash(e){returne.replace(/^\/+/,"")}normalizeMarkdownFilePath(e,t){letn=this.stripLeadingSlash(e),i=n?`${n}/`:"",o=this.stripLeadingSlash(t).replace(Nt,"");return`${i}${o}.md`}asyncfileExists(e){returnawaitthis.app.vault.adapter.exists(e)}getFileByPath(e){lett=this.app.vault.getAbstractFileByPath(e);if(!t)throwI.logError(`${e} not found`),newError(`${e} not found`);if(tinstanceofNb.TFolder)throwI.logError(`${e} found but it's a folder`),newError(`${e} found but it's a folder`);if(!(tinstanceofNb.TFile))thrownewError(`${e} is not a file`);returnt}asynccreateFileWithInput(e,t,n={}){if(Dr(e))thrownewError(`Refusing to create a file outside the vault: "${e}".`);leti=e.match(/(.*)[/\\]/),o="";i&&(o=i[1]);lets=this.app.vault.getAbstractFileByPath(o);(!s||!(sinstanceofNb.TFolder))&&awaitthis.createFolder(o);leta=()=>this.app.vault.create(e,t);returnn.suppressTemplaterOnCreate&&e.toLowerCase().endsWith(".md")?awaitOA(this.app,e,a):awaita()}}});asyncfunctionwo(r,e){try{returnr.promptProvider?awaite.remote(r.promptProvider):r.interactive===!1?awaite.headless():awaite.app()}catch(t){throwot(t)?newat("Input cancelled by user"):t}}varsp=E(()=>{ur();xt()});asyncfunctionCo(r,e){lett=e.items.map((s,a)=>`${Lse}${a}`),n=awaitr.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)returne.items[o].value;if(i==="")thrownewat("Input cancelled by user");if(e.allowCustomInput)returni;thrownewError(`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.`)}varLse,ap=E(()=>{ur();Lse="\0qa-eng:"});functionyM(r){lete=r.map(n=>n||"/");return`Folder must be under: ${e.length>3?`${e.slice(0,3).join(", ")}...`:e.join(", ")}`}varWk,Vse,Aa,jk,J3=E(()=>{Wk=require("obsidian");vM();Zo();Ol();wv();Ni();Yn();sp();ap();Vse=3,Aa=classextendsError{constructor(e){super(e),this.name="InvalidFolderPathError"}},jk=classextendsmh{asyncgetOrCreateFolder(e,t){letn=this.buildFolderSelectionContext(e,{...t,topItems:e.length>0?[]:t.topItems??[]});if(!this.shouldPromptForFolder(n))returnawaitthis.handleSingleSelection(n);leti=this.buildFolderSelectionContext(e,t),o=awaitthis.promptUntilAllowed(i,t.executor);returno.isEmpty?"":o.resolved}buildFolderSelectionContext(e,t){letn=t.allowCreate??!1,i=t.allowedRoots?.map(s=>this.normalizeFolderPath(s))??[];return{...this.buildFolderSuggestions(e,t.topItems??[],i.length>0?i:void0),allowCreate:n,allowedRoots:i,placeholder:t.placeholder}}shouldPromptForFolder(e){returne.items.length>1||e.allowCreate&&e.items.length===0}asyncpromptForFolder(e,t){letn=e.placeholder??"Choose a folder or type to create one";returnString(awaitwo(t,{remote:i=>Co(i,{items:e.items.map((o,s)=>({value:o,title:e.displayItems[s]??o})),placeholder:n,allowCustomInput:e.allowCreate,what:"the folder chooser"}),headless:()=>{thrownewye("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:()=>e.allowCreate?Mr.Suggest(this.app,e.displayItems,e.items,{placeholder:n,renderItem:(i,o)=>{this.renderFolderSugges
${a}`:`${a}
${s}`;return await this.app.vault.modify(t,l),t}catch(o){if(EM(o))throw o;return this.noteTemplateFileFailure(o,"Could not append to file with template"),Ze(o,"Could not append to file with template"),null}}async getTemplateContent(t){let n=Vn(this.app,t);if(!n)throw new Error(`Templatefilenotfoundatpath"${t}".`);return await this.app.vault.cachedRead(n)}}});var rj={};fw(rj,{SingleTemplateEngine:()=>vh});var vh,TM=E(()=>{Kk();Ie();Cu();vh=class extends xu{constructor(t,n,i,o,s){super(t,n,o,s);this.templatePath=i;this.promptScope="noteBody";this.preserveCursorMarkers=!1}setPreserveCursorMarkers(t){this.preserveCursorMarkers=t}setPromptScope(t){this.promptScope=t}setDestinationPath(t){this.formatter.setTitle(Ia(t)),this.formatter.setTargetFolderPath(Ai(t))}async run(){let t=await this.resolveTemplateSourcePath(this.templatePath),n=await this.getTemplateContent(t);return n||I.logError(`Template${t}notfound.`),n=await this.formatter.withTemplatePropertyCollection(()=>this.formatter.withPromptScope(this.promptScope,n,()=>this.preserveCursorMarkers?this.formatter.formatTemplateContent(n):this.formatter.formatFileContent(n))),n}getAndClearTemplatePropertyVars(){return this.formatter.getAndClearTemplatePropertyVars()}}});var nj={};fw(nj,{SingleInlineScriptEngine:()=>kM});var kM,ij=E(()=>{Ob();kM=class extends _a{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 oj,ji,lp=E(()=>{wl();Qz();L3();$v();oj=require("obsidian");Xe();Zo();f0();U3();Ld();hl();lo();uo();Bk();ys();Pd();Sf();j3();ur();Yn();xt();ji=class extends Lc{constructor(t,n,i,o){super(t);this.app=t;this.plugin=n;this.choiceExecutor=i;this.contentValuePromptsAcceptImagePaste=!1;this.preserveTemplateCursorMarkers=!1;this.skipPropertyExpansion=!1;this.dateParser=o||Qo,i&&(this.variables=i?.variables)}runClocks(){return this.choiceExecutor?.clocks??this.clocks}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),this.formatScalarTokens(n)}async formatScalarTokens(t){let n=t;return 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),this.skipPropertyExpansion||(n=this.replacePropertyInString(n)),this.promptScope==="captureText"||this.promptScope==="noteBody"&&this.preserveTemplateCursorMarkers?n:zn(n)}async replaceGlobalVarInString(t){return Bc(t,this.plugin?.settings?.globalVariables)}async formatFileName(t,n="generic"){if(Ro.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(Ro.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 formatPropertyName(t){return await this.withPromptScope("propertyName",t,async()=>this.replaceCurrentFileTokensInString(await this.format(t),{links:!0,fileName:!0,folder:!0,activeFolder:"content",title:!0}))}async formatPropertyValue(t){let n=await this.preserveSingleTokenValue(t,()=>this.withPromptScope("propertyValue",t,async()=>{this.skipPropertyExpansion=!0;let i;try{i=await this.format(t)}finally{this.skipPropertyExpansion=!1}return i=this.replaceCurrentFileTokensInString(i,{links:!0,fileName:!0,folder:!0,activeFolder:"content",title:!0}),this.replacePropertyInString(i)}));return typeof n=="string"?zn(n):Array.isArray(n)?n.map(i=>typeof i=="str
`)}functionzse(r){returnr==null||r===""||Array.isArray(r)&&r.length===0}functionuj(r){returntypeofr=="string"?r.length>0?[r]:[]:!Array.isArray(r)||!r.every(e=>typeofe=="string")?null:r}functiondj(r,e){lett=uj(r),n=uj(e);if(t===null||n===null)return;leti=[],o=newSet(t);for(letsofn)s.length===0||o.has(s)||(o.add(s),i.push(s));if(i.length!==0)return[...t,...i]}varXk,Bb,yh,Zk=E(()=>{Xk=require("obsidian");Ie();ht();Gk();Jm();Sv();If();Cu();wu();Bg();gM();Kk();da();_f();Bb=[{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."}];yh=classextendsxu{constructor(t,n,i,o,s,a,l){super(t,n,a);this.targetFile=i;this.templatePath=o;this.mode=s;this.cursorView=null;this.resolvedTemplatePath=l??null}placeCursor(t){this.mode==="cursor"&&No(this.app,t)!==this.cursorView||super.placeCursor(t)}asyncrun(){awaitthis.apply()}asyncgetResolvedTemplatePath(){returnthis.resolvedTemplatePath===null&&(this.resolvedTemplatePath=awaitthis.resolveTemplateSourcePath(this.templatePath)),this.resolvedTemplatePath}asyncapply(){switch(this.cursorPlacement=null,$n(this.templatePath,"Cannot apply template: no template path given."),this.mode){case"replace":returnawaitthis.overwriteFileWithTemplate(this.targetFile,awaitthis.getResolvedTemplatePath());case"top":case"bottom":returnawaitthis.insertTemplateIntoFile(this.mode);case"cursor":returnawaitthis.insertTemplateAtCursor()}}asynccomputeChoiceTargetPath(t){letn=t.folder,i;if(this.formatter.setTargetFolderPath(null),n?.enabled){if(n.chooseWhenCreatingNote)returnnull;if(n.createInSameFolderAsActiveFile)i=this.targetFile.parent?.path??"";else{if(n.chooseFromSubfolders)returnnull;if(n.folders.length===1)i=awaitthis.formatter.formatFolderPath(n.folders[0]);elsereturnnull}}elsei=this.targetFile.parent?.path??"";i==="/"&&(i="");leto=this.targetFile.basename,s=!1;if(t.fileNameFormat?.enabled&&t.fileNameFormat.format){this.formatter.setTargetFolderPath(i);leta=awaitthis.formatter.formatFileName(t.fileNameFormat.format,"generic"),l=Wn(a,"File name"),c=this.stripDuplicateFolderPrefix(l,i);o=c.fileName,s=this.shouldTreatFormattedNameAsVaultRelativePath(l,c.strippedPrefix,n?.enabled??!1)}returno.slice(o.lastIndexOf("/")+1).trim()?this.normalizeTemplateFilePath(s?"":i,o,awaitthis.getResolvedTemplatePath()):null}asyncinsertTemplateIntoFile(t){let{formatted:n,templatePropertyVars:i}=awaitthis.formatTemplateForTargetFile(),{frontmatterYaml:o,body:s}=cj(n),a=this.cursorPlacement;return(s.trim().length>0||a)&&awaitthis.app.vault.process(this.targetFile,l=>{letc=Hse(l,s,t);if(a&&c.insertedStartOffset!==null){letu=c.insertedStartOffset-(n.length-s.length);this.cursorPlacement={content:c.content,offsets:a.offsets.map(d=>u+d)}}returnc.content}),awaitthis.mergeFrontmatterProperties(o,i),awaitthis.rebaseCursorAfterFileChanges(this.targetFile),this.targetFile}asyncinsertTemplateAtCursor(){lett=No(this.app,this.targetFile);$n(t,"Cannot insert at cursor: the note is not open in the active editor."),this.cursorView=t;letn=t.editor,{formatted:i,templatePropertyVars:o}=awaitthis.formatTemplateForTargetFile();$n(t.file===this.targetFile&&t.editor===n&&this.app.workspace.getLeavesOfType("markdown").some(c=>c.view===t),"Cannot insert at cursor: the original editor was closed or changed notes.");let{frontmatterYaml:s,body:a}=cj(i),l=this.cursorPlacement?.offsets[0];returnl!==void0?this.cursorPlacement=NA({content:a,cursor:{kind:"offset",value:l-(i.length-a.length),source:"marker"}},n,"currentLine"):a.trim().length>0&&n.replaceSelection(a),this.cursorPlacement&&s&&awaitt.save(),awaitthis.mergeFrontmatterProperties(s,o),s&&awaitthis.rebaseCursorAfterFileChanges(this.targetFile),this.targetFile}asyncformat
>`);this.choiceExecutor.variables.set(n,t),this.choiceExecutor.variables.set(`${n}-quoted`,i)}assertAssignableName(e){xS(e)}}});function ZM(r){return(r??"").trim().replace(/\\/g,"/").replace(/\/+/g,"/").replace(/^\/+|\/+$/g,"").normalize("NFC")}function JM(r,e){return e.some(t=>r===t||r.startsWith(`${t}/`))}function pp(r,e){let t=(e??[]).map(n=>ZM(n)).filter(n=>n.length>0);return t.length===0?!0:r?JM(r.normalize("NFC"),t):!1}var TS=E(()=>{});function fp(r,e={}){let t=(r??"").trim();if(!t)throw new ns("Path is empty.");let n=t.replace(/\\/g,"/").normalize("NFC");if(n.startsWith("/")||/^[a-zA-Z]:/.test(n))throw new ns(`Refusingtowritetoanabsolutepathoutsidethevault:"${n}".`);let i=n.replace(/\/+/g,"/").replace(/^\/+|\/+$/g,""),o=i.split("/").filter(a=>a.length>0);if(o.length===0)throw new ns("Path is empty after normalization.");for(let a of o){if(a==="."||a==="..")throw new ns(`Refusingpathwithatraversalsegment("${a}"):"${i}".`);if(a.startsWith("."))throw new ns(`Refusingtowriteintoadot/configpathsegment("${a}"):"${i}".`);Hae(a,i)}let s=(e.allowedRoots??[]).map(a=>ZM(a)).filter(a=>a.length>0);if(s.length>0&&!JM(i,s))throw new ns(`Path"${i}"isnotunderanallowedroot(${s.join(", ")}).`);return i}function Hae(r,e){if(vv.test(r))throw new ns(`Pathsegment"${r}"containscontrolcharacters:"${e}".`);if(yv.test(r))throw new ns(`Pathsegment"${r}"containsanillegalcharacter(\\:*?" < > |): "${e}".`);if(bv.test(r))throw new ns(`Path segment "${r}" cannot end with a space or a period: "${e}".`);let t=r.split(".")[0]??"";if(t&&kd(t))throw new ns(`Path segment "${r}" is a reserved device name: "${e}".`)}var ns,dG=E(()=>{wv();TS();ns=class extends Error{constructor(e){super(e),this.name="UnsafeVaultPathError"}}});function Ph(r,e){let t=Object.entries(r),n=new Set(t.map(([o])=>o));if(pG(e.only,n,"only"),pG(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 Jb(r){return{...r,__qaTool:!0}}function pG(r,e,t){if(!r)return;let n=r.filter(i=>!e.has(i));n.length!==0&&I.logWarning(`AI tools: ${t} listed unknown tool name(s) ${n.map(i=>`"${i}"`).join(",")}. Valid names: ${[...e].join(",")}.`)}var kS=E(()=>{Ie()});function bG(r,e={}){let t=e.allowedRoots,n={read_note:mp({description:"Readanote's full markdown content by vault path.",inputSchema:hp({path:is("Vault path to the note, e.g. Notes/Foo.md")},["path"]),readOnly:!0,execute:async({path:i})=>{let o=fp(String(i),{allowedRoots:t}),s=r.vault.getAbstractFileByPath(o);if(!(s instanceof t$.TFile))return{found:!1,path:o};let a=await r.vault.cachedRead(s);return{found:!0,path:o,content:a.length>fG?a.slice(0,fG)+`
\u2026[truncated]`:a}}}),list_notes:mp({description:"List markdown notes, optionally within a folder.",inputSchema:hp({folder:is("Folder to list (omit for the whole vault)."),limit:mG("Max results (default 100, capped at 200).")},[]),readOnly:!0,execute:async({folder:i,limit:o})=>{let s=i?fp(String(i),{allowedRoots:t}):"",a=vG(gG(o,zae),1,Wae),l=Bo(r,s).filter(c=>pp(c.path,t));return{total:l.length,notes:l.slice(0,a).map(c=>({path:c.path,basename:c.basename}))}}}),search_notes:mp({description:"Search notes by name and/or content. Returns matching paths with a short snippet.",inputSchema:hp({query:is("Text to search for."),in:hG(["name","content","both"],"Where to search (default both)."),limit:mG("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=vG(gG(s,jae),1,Gae),u=r.vault.getMarkdownFiles().filter(m=>pp(m.path,t)),d=[],p=0,f=!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(p>=Yae){f=!0;continue}p++;let v=await r.vault.cachedRead(m),y=v.toLowerCase().indexOf(a);y>=0&&d.push({path:m.path,snippet:Qae(v,y)})}}return{results:d,scannedFiles:p,truncated:d.length>=c||f}}}),get_property_values:mp({description:"List the distinct values a frontmatter property takes across the vault (e.g. existing tags or statuses).",inputSchema:hp({field:is("Frontmatter property name."),folder:is("Optional folder scope.")},["field"]),readOnly:!0,execute:async({field:i,folder:o})=>{let s=o?fp(String(o),{allowedRoots:t}):"",a=(o?Bo(r,s):r.vault.getMarkdownFiles()).filter(c=>pp(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 p of Array.isArray(d)?d:[d])if(typeof p!="object"){let f=String(p).trim();f&&l.add(f)}}}return{field:String(i),values:[...l].sort().slice(0,200)}}}),create_note:mp({description:"Create a new markdown note. Fails if the path already exists.",inputSchema:hp({path:is("Vault path for the new note."),content:is("Initial markdown content.")},["path"]),needsApproval:!0,execute:async({path:i,content:o})=>{let s=fp(e$(String(i)),{allowedRoots:t});return await Km(r,s),await Kae(r,s),{created:!0,path:(await r.vault.create(s,String(o??""))).path}}}),append_to_note:mp({description:"Append text to an existing note (frontmatter-aware for top inserts).",inputSchema:hp({path:is("Vault path to the existing note."),content:is("Markdown to append."),position:hG(["top","bottom"],"Where to add it (default bottom).")},["path","content"]),needsApproval:!0,execute:async({path:i,content:o,position:s})=>{let a=fp(e$(String(i)),{allowedRoots:t}),l=yG(r,a);await Km(r,a);let c=await r.vault.read(l),u=String(o),d=s==="top"?Z3(c,u.endsWith(`
`}${u}`;return await r.vault.modify(l,d),{appended:!0,path:a}}}),insert_under_heading:mp({description:"Insert markdown under an existing heading (matched exactly). Errors if the heading is not found.",inputSchema:hp({path:is("Vault path to the existing note."),heading:is("Exact heading text (without the # markers)."),content:is("Markdown to insert under the heading.")},["path","heading","content"]),needsApproval:!0,execute:async({path:i,heading:o,content:s})=>{let a=fp(e$(String(i)),{allowedRoots:t}),l=yG(r,a);await Km(r,a);let c=r.metadataCache.getFileCache(l)?.headings??[],u=c.find(f=>f.heading===String(o));if(!u)throw new Error(`Heading "${o}" not found in ${a}`);let d=await r.vault.read(l),p=Xae(d,u.position.start.line,u.level,String(s),c);return await r.vault.modify(l,p),{inserted:!0,path:a,heading:String(o)}}})};return Ph(n,e)}function mp(r){return{...r,__qaTool:!0}}function hp(r,e){return{type:"object",properties:r,required:e}}function is(r){return{type:"string",description:r}}function mG(r){return{type:"integer",description:r}}function hG(r,e){return{type:"string",enum:r,description:e}}function gG(r,e){let t=Number(r);return Number.isFinite(t)?Math.floor(t):e}function vG(r,e,t){return Math.max(e,Math.min(t,r))}function e$(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 yG(r,e){let t=r.vault.getAbstractFileByPath(e);if(!(t instanceof t$.TFile))throw new Error(`Note not found: ${e}`);return t}async function Kae(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 Qae(r,e){let t=Math.max(0,e-40);return r.slice(t,e+80).replace(/\s+/g," ").trim()}function Xae(r,e,t,n,i){let o=r.split(`
`)}var t$,fG,zae,Wae,jae,Gae,Yae,wG=E(()=>{t$=require("obsidian");ht();wu();TS();dG();TP();kS();fG=16e3,zae=100,Wae=200,jae=25,Gae=50,Yae=400});function xG(r,e={}){let t=e.allowedRoots,n=()=>{let s=r.workspace.getActiveFile();return!(s instanceof SS.TFile)||s.extension!=="md"?null:pp(s.path,t)?s:null},i=()=>{let s=r.workspace.getActiveViewOfType(SS.MarkdownView);return s&&pp(s.file?.path,t)?s:null},o={get_active_note:Jb({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>CG?a.slice(0,CG)+`
\u2026[truncated]`:a}}}}),get_selection:Jb({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 Ph(o,e)}var SS,CG,EG=E(()=>{SS=require("obsidian");TS();kS();CG=16e3});function TG(r={}){let e={get_date:Jb({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:aa({format:t!=null?String(t):void 0,offset:n!=null?Number(n):void 0})})})};return Ph(e,r)}var kG=E(()=>{ht();kS()});function _G(r,e,t,n){async function i(s,a){let l=X.getState();if(l.disableOnlineFeatures)throw new Error("Rejecting request to `prompt` via API AI module. Online features are disabled in settings.");let{model:c,provider:u}=jy(s),d=await Ca(r,u);return a?.assignToVariable&&xS(a.assignToVariable),{model:c,provider:u,apiKey:d,modelOptions:a?.modelOptions??{},outputVariableName:a?.assignToVariable||a?.variableName||"output",showAssistantMessages:a?.showAssistantMessages??!0,systemPrompt:a?.systemPrompt??l.ai.defaultSystemPrompt}}function o(s,a,l){if(!s)return Ze(new Error("AI Assistant returned null"),l),{};if(a?.shouldAssignVariables||a?.assignToVariable)for(let[c,u]of Object.entries(s))t.variables.set(c,u);return s}return{prompt:async(s,a,l)=>{let c=await Lz(r,{...await i(a,l),prompt:s},(u,d)=>n(u,d,!1));return o(c,l,"AI Prompt error")},chunkedPrompt:async(s,a,l,c,u)=>{let d=await c0(r,{...await i(l,c),text:s,promptTemplate:a,chunkSeparator:c?.chunkSeparator??/\n/,resultJoiner:c?.chunkJoiner??`
`,shouldMerge:c?.shouldMerge??!0,maxChunkTokens:c?.maxChunkTokens},(p,f)=>n(p,{...u,...f},!1));return o(d,c,"Chunked AI Prompt error")},getModels:()=>bU(),getMaxTokens:s=>jy(s).model.maxTokens,estimateTokens(s){return Ui(s)},countTokens(s,a){return SG||(SG=!0,I.logMessage("quickAddApi.ai.countTokens is deprecated and now returns a provider-agnostic estimate (the model argument is ignored). Use estimateTokens(text) instead.")),Ui(s)},getRequestLogs(s=10){return yz(s)},getRequestLogById(s){return wz(s)},getLastRequestLog(){return Cz()},clearRequestLogs(){xz()},agent:s=>new ES(r,e,t,s),tool:s=>({...s,__qaTool:!0}),stepCountIs:s=>({stepNumber:a})=>a>=s,hasToolCall:s=>({toolCallNames:a})=>a.includes(s),tools:{vault:s=>bG(r,s),workspace:s=>xG(r,s),system:s=>TG(s)}}}var SG,AG=E(()=>{u0();Tm();Yd();Wy();uG();QM();wG();EG();kG();dt();xt();Ie();SG=!1});function IG(r){return{getFieldValues:async(e,t)=>{let n=t?.includeInlineCodeBlocks?.map(a=>a.trim().toLowerCase()).filter(a=>a.length>0),i={folder:t?.folder,folders:t?.folders,tags:t?.tags,inline:t?.includeInline??!1,inlineCodeBlocks:n},o=r.vault.getMarkdownFiles();o=xi.filterFiles(o,i,a=>r.metadataCache.getFileCache(a));let s=new Set;for(let a of o){let c=r.metadataCache.getFileCache(a)?.frontmatter?.[e];if(c!=null){if(Array.isArray(c))c.forEach(u=>{if(u==null||typeof u=="object")return;let d=String(u).trim();d&&s.add(d)});else if(typeof c!="object"){let u=String(c).trim();u&&s.add(u)}}if(i.inline)try{let u=await r.vault.read(a);fh.getFieldValues(u,e,{includeCodeBlocks:n}).forEach(p=>s.add(p))}catch{}}return Array.from(s).sort()},clearCache:e=>{Vl.getInstance().clear(e)}}}var DG=E(()=>{Lk();pd();oM()});function FG(r){return Array.from(r.entries())}function PG(r,e){r.clear();for(let[t,n]of e)r.set(t,n)}var ci,Mh,r$=E(()=>{lp();SM();Zk();ys();xh();xt();ht();_M();rG();AG();DG();ci=class ci{static GetApi(e,t,n){let i=async(o,s,a=!0)=>{let l=a?FG(n.variables):null;s&&Object.keys(s).forEach(u=>{n.variables.set(u,s[u])});let c=await new ji(e,t,n).formatFileContent(o);return a&&l&&PG(n.variables,l),c};return{requestInputs:o=>tG(e,n,o),inputPrompt:(o,s,a,l)=>{let c=n?.promptProvider;return c?c.inputPrompt(o,s,a):ci.inputPrompt(e,o,s,a,l)},datePrompt:(o,s)=>{let a=n?.promptProvider;return a?a.datePrompt(o,s):ci.datePrompt(e,o,s)},wideInputPrompt:(o,s,a,l)=>{let c=n?.promptProvider;return c?c.wideInputPrompt(o,s,a):ci.wideInputPrompt(e,o,s,a,l)},yesNoPrompt:(o,s)=>{let a=n?.promptProvider;return a?a.yesNoPrompt(o,s):ci.yesNoPrompt(e,o,s)},infoDialog:(o,s)=>{let a=n?.promptProvider;return a?a.infoDialog(o,s):ci.infoDialog(e,o,s)},suggester:(o,s,a,l=!1,c)=>{let u=n?.promptProvider;return u?u.suggester(o,s,a,l):ci.suggester(e,o,s,a,l,c)},checkboxPrompt:(o,s,a)=>{let l=n?.promptProvider;return l?l.checkboxPrompt(o,s,a):ci.checkboxPrompt(e,o,s,a)},executeChoice:async(o,s,a)=>{let l;try{l=t.getChoiceByName(o)}catch{l=void 0}if(!l){Ze(new Error(`Choice named '${o}' not found`),"API executeChoice error");return}if(!Ch(n,a?.date)){Ze(new Error(`Could not parse date origin '${String(a?.date)}'`),"API executeChoice error");return}s&&Object.keys(s).forEach(u=>{n.variables.set(u,s[u])}),await n.execute(l);let c=n.consumeAbortSignal?.();if(n.variables.clear(),c)throw c},applyTemplateToActiveFile:async(o,s)=>{if(!o)throw new Error("applyTemplateToActiveFile requires a template path.");if(!wh(o))throw new Error("applyTemplateToActiveFile only supports markdown templates. Canvas and base templates cannot be applied to a markdown note.");if(s?.mode!==void 0&&!pj(s.mode))throw new Error(`Invalid mode '${String(s.mode)}'. Valid modes: ${Bb.map(l=>l.id).join(", ")}.`);let a=FG(n.variables);try{return await qb(e,t,{templatePath:o,mode:s?.mode,choiceExecutor:n})}finally{PG(n.variables,a)}},format:i,ai:_G(e,t,n,i),utility:{getClipboard:async()=>await navigator.clipboard.readText(),setClipboard:async o=>await navigator.clipboard.writeText(o),getSelection:()=>sl(e),getSelectedText:()=>{let o=xn(e);return o?o.editor.somethingSelected()?o.editor.getSelection():(Ze(new Error("No text selected"),"Could not get selected t
`)}var ew=E(()=>{});async function LG(r,e){return r.mode==="script"?await e.evaluateScriptCondition(r):Zae(r,e.variables)}function Zae(r,e){let t=r.variableName?.trim();if(!t)return I.logWarning("Conditional command skipped: No variable name configured."),!1;if(!(t in e))return I.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(Nc(r.operator)){let i=I2(r);return i===void 0?(I.logWarning(`Conditional command: Operator '${r.operator}' requires a comparison value.`),!1):r.operator==="contains"?NG(n,i,r):r.operator==="notContains"?!NG(n,i,r):Jae(n,i,r)}return!1}function NG(r,e,t){if(r==null)return!1;if(typeof e=="string"&&e.length===0)return I.logWarning("Conditional command: 'contains' operator requires a non-empty comparison value."),!1;if(Array.isArray(r))return r.map(o=>mD(o,t.valueType)).some(o=>o===e);if(typeof r=="string")return r.includes(ua(e));if(typeof r=="number"&&typeof e=="number")return r===e;let n=ua(r),i=ua(e);return typeof n=="string"&&n.includes(i)}function Jae(r,e,t){let n=mD(r,t.valueType);switch(t.operator){case"equals":return n===e;case"notEquals":return n!==e;case"lessThan":return _S(n,e,(i,o)=>i<o);case"lessThanOrEqual":return _S(n,e,(i,o)=>i<=o);case"greaterThan":return _S(n,e,(i,o)=>i>o);case"greaterThanOrEqual":return _S(n,e,(i,o)=>i>=o);default:return!1}}function _S(r,e,t){let n=Number(r),i=Number(e);return Number.isNaN(n)||Number.isNaN(i)?(I.logWarning("Conditional command numeric comparison failed: non-numeric value encountered."),!1):t(n,i)}var VG=E(()=>{Ie();Id()});function BG(r,e=void 0){return r==="horizontal"?"horizontal":r==="vertical"?"vertical":e}function Tu(r,e,t){return t?{location:r,direction:t,focus:e,mode:"default"}:{location:r,focus:e,mode:"default"}}function qG(r){let e=r.focus??!0;if(r.location)switch(r.location){case"reuse":return Tu("reuse",e);case"tab":return Tu("tab",e);case"split":return Tu("split",e,BG(r.direction,"vertical"));case"window":return Tu("window",e);case"left-sidebar":return Tu("left-sidebar",e);case"right-sidebar":return Tu("right-sidebar",e);default:break}let t=r.openInNewTab??!1,n=BG(r.direction);return t?Tu("split",e,n??"vertical"):Tu("reuse",e)}var UG=E(()=>{eT()});function HG(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 zG=E(()=>{});function WG(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"?tle.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 jG(r){return`${r.scriptPath}::${r.exportName??"default"}`}var ele,GG,tle,_a,Ob=E(()=>{lj();Qk();ele=z$(require("obsidian"));Ie();xt();vr();r$();OG();i$();_s();ht();ho();qF();BF();UF();HF();zF();WF();jF();GF();YF();KF();ew();lp();ht();GG=require("obsidian");Ni();VG();$b();UG();zG();un();Ah();uS();Dh();tle=new Map([["InfiniteAIAssistant",'QuickAddhasremovedthe"Infinite AI Assistant"commandtype-noreleasedversioncouldeverrunone.Deletethestepfromthemacro.ForchunkedAIprompts,usequickAddApi.ai.chunkedPrompt()inauserscript.']]);_a=class extends $h{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??n
%cAn async derived, \`${r}\` (${e}) was not read immediately after it resolved. This often indicates an unnecessary waterfall, which can slow down your app
%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
%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/lifecycle_double_unmount`,Ha,za):console.warn("https://svelte.dev/e/lifecycle_double_unmount")}function tO(){Q?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",Ha,za):console.warn("https://svelte.dev/e/select_multiple_invalid_value")}function Tw(r){Q?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`,Ha,za):console.warn("https://svelte.dev/e/state_proxy_equality_mismatch")}function rO(){Q?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",Ha,za):console.warn("https://svelte.dev/e/svelte_boundary_reset_noop")}var Me=!1;function jr(r){Me=r}var Ye;function Vt(r){if(r===null)throw Fu(),qa;return Ye=r}function fn(){return Vt(Nn(Ye))}function N(r){if(Me){if(Nn(Ye)!==null)throw Fu(),qa;Ye=r}}function Gr(r=1){if(Me){for(var e=r,t=Ye;e--;)t=Nn(t);Ye=t}}function Ks(r=!0){for(var e=0,t=Ye;;){if(t.nodeType===Gi){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=Nn(t);r&&t.remove(),t=i}}function Qh(r){if(!r||r.nodeType!==Gi)throw Fu(),qa;return r.data}function kw(r){return r===this.v}function Sw(r,e){return r!=r?e==e:r!==e||r!==null&&typeof r=="object"||typeof r=="function"}function _w(r){return!Sw(r,this.v)}function nO(r){if(Q){let e=new Error(`invariant_violation
An invariant violation occurred, meaning Svelte'sinternalassumptionswereflawed.ThisisabuginSvelte,notyourapp\u2014pleaseopenanissueathttps://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 Aw(r){if(Q){let e=new Error(`lifecycle_outside_component
\`${r}(...)\` can only be used during component initialisation
https://svelte.dev/e/lifecycle_outside_component`);throwe.name="Svelte error",e}elsethrownewError("https://svelte.dev/e/lifecycle_outside_component")}functionoO(){if(Q){letr=newError("async_derived_orphan\nCannot create a `$derived(...)` with an `await` expression outside of an effect tree\nhttps://svelte.dev/e/async_derived_orphan");throwr.name="Svelte error",r}elsethrownewError("https://svelte.dev/e/async_derived_orphan")}functionb_(){if(Q){letr=newError("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");throwr.name="Svelte error",r}elsethrownewError("https://svelte.dev/e/bind_invalid_checkbox_value")}functionsO(){if(Q){letr=newError(`derived_references_self
A derived value cannot reference itself recursively
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
\`${r}\` cannot be used inside an effect cleanup function
https://svelte.dev/e/effect_in_teardown`);throwe.name="Svelte error",e}elsethrownewError("https://svelte.dev/e/effect_in_teardown")}functioncO(){if(Q){letr=newError("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");throwr.name="Svelte error",r}elsethrownewError("https://svelte.dev/e/effect_in_unowned_derived")}functionuO(r){if(Q){lete=newError(`effect_orphan
\`${r}\` can only be used inside an effect (e.g. during component initialisation)
https://svelte.dev/e/hydration_failed`);throwr.name="Svelte error",r}elsethrownewError("https://svelte.dev/e/hydration_failed")}functionfO(){if(Q){letr=newError("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");throwr.name="Svelte error",r}elsethrownewError("https://svelte.dev/e/invalid_snippet")}functionmO(r){if(Q){lete=newError(`props_invalid_value
Cannot do \`bind:${r}={undefined}\` when \`${r}\` has a fallback value
The \`${r}\` rune is only available inside \`.svelte\` and \`.svelte.js/ts\` files
https://svelte.dev/e/rune_outside_svelte`);throwe.name="Svelte error",e}elsethrownewError("https://svelte.dev/e/rune_outside_svelte")}functiongO(){if(Q){letr=newError("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");throwr.name="Svelte error",r}elsethrownewError("https://svelte.dev/e/state_descriptors_fixed")}functionvO(){if(Q){letr=newError("state_prototype_fixed\nCannot set prototype of `$state` object\nhttps://svelte.dev/e/state_prototype_fixed");throwr.name="Svelte error",r}elsethrownewError("https://svelte.dev/e/state_prototype_fixed")}functionyO(){if(Q){letr=newError("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");throwr.name="Svelte error",r}elsethrownewError("https://svelte.dev/e/state_unsafe_mutation")}functionbO(){if(Q){letr=newError("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");throwr.name="Svelte error",r}elsethrownewError("https://svelte.dev/e/svelte_boundary_reset_onerror")}varAr=!1,Wa=!1,ss=!1;varV4="font-weight: bold",B4="font-weight: normal";functionC_(r){Q?console.warn(`%c[svelte] state_snapshot_uncloneable
`),n=[];for(leti=0;i<t.length;i++){leto=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)}}returnn}functionCO(r,e){if(!Q)thrownewError("invariant(...) was not guarded by if (DEV)");r||nO(e)}varct=null;functionja(r){ct=r}varQs=null;functionSp(r){Qs=r}varls=null;functionDw(r){ls=r}functionpe(r,e=!1,t){ct={p:ct,i:!1,c:null,e:null,s:r,x:null,r:Pe,l:Wa&&!e?{s:null,u:null,$:[]}:null},Q&&(ct.function=t,ls=t)}functionfe(r){vare=ct,t=e.e;if(t!==null){e.e=null;for(varnoft)x_(n)}returnr!==void0&&(e.x=r),e.i=!0,ct=e.p,Q&&(ls=ct?.function??null),Jh(r)}functionJh(r={}){returnpn(r,ww,{value:!0}),r}functioncs(){return!Wa||ct!==null&&ct.l===null}varMu=[];functionxO(){varr=Mu;Mu=[],yw(r)}functionyr(r){if(Mu.length===0&&!$u){vare=Mu;queueMicrotask(()=>{e===Mu&&xO()})}Mu.push(r)}functionEO(){for(;Mu.length>0;)xO()}varH4=-7169;functionBt(r,e){r.f=r.f&H4|e}function_p(r){(r.f&512)!==0||r.deps===null?Bt(r,1024):Bt(r,4096)}functionTO(r){if(r!==null)for(leteofr)(e.f&2)===0||(e.f&65536)===0||(e.f^=65536,TO(e.deps))}functionFw(r,e,t){(r.f&2048)!==0?e.add(r):(r.f&4096)!==0&&t.add(r),TO(r.deps),Bt(r,1024)}varkO=!1,Pw=!1;functionE_(r){vare=Pw;try{returnPw=!1,[r(),Pw]}finally{Pw=e}}functionNu(r){Me&&gn(r)!==null&&Ip(r)}varSO=!1;functionMw(){SO||(SO=!0,document.addEventListener("reset",r=>{Promise.resolve().then(()=>{if(!r.defaultPrevented)for(leteofr.target.elements)e[tc]?.()})},{capture:!0}))}functionAo(r){vare=ze,t=Pe;Qr(null),Xr(null);try{returnr()}finally{Qr(e),Xr(t)}}function$w(r,e,t,n=t){r.addEventListener(e,()=>Ao(t));leti=r[tc];i?r[tc]=()=>{i(),n(!0)}:r[tc]=()=>n(!0),Mw()}functionOw(r,e,t,n){leti=cs()?nc:Lu;varo=r.filter(f=>!f.settled),s=e.map(i);if(Q&&s.forEach((f,m)=>{f.label=e[m].toString().replace("() => ","").replaceAll("$.eager(() => ","$state.eager(").replace(/\$\.get\((.+?)\)/g,(g,v)=>v)}),t.length===0&&o.length===0){n(s);return}vara=Pe,l=_O(),c=o.length===1?o[0].promise:o.length>1?Promise.all(o.map(f=>f.promise)):null;functionu(f){if((a.f&16384)===0){l();try{n([...s,...f])}catch(m){Mi(m,a)}Dp()}}vard=T_();if(t.length===0){c.then(()=>u([])).finally(d);return}functionp(){Promise.all(t.map(f=>S_(f))).then(u).catch(f=>Mi(f,a)).finally(d)}c?c.then(()=>{l(),p(),Dp()}):p()}function_O(){varr=Pe,e=ze,t=ct,n=Ne;if(Q)vari=Qs;returnfunction(s=!0){Xr(r),Qr(e),ja(t),s&&(r.f&16384)===0&&(n?.activate(),n?.apply()),Q&&(k_(null),Sp(i))}}varW4=!1;functionDp(r=!0){W4=!1,Xr(null),Qr(null),ja(null),r&&Ne?.deactivate(),Q&&(k_(null),Sp(null))}functionT_(){varr=Pe,e=r.b,t=Ne,n=!!e?.is_rendered();returne?.update_pending_count(1,t),t.increment(n,r),()=>{e?.update_pending_count(-1,t),t.decrement(n,r)}}var$i=null;functionk_(r){$i=r}vartg=newSet;functionnc(r){vare=2050;Pe!==null&&(Pe.f|=524288);lett={ctx:ct,deps:null,effects:null,equals:kw,f:e,fn:r,reactions:null,rv:0,v:jt,wv:0,parent:Pe,ac:null};returnQ&&ss&&(t.created=as("created at")),t}varFp=Symbol("obsolete");functionS_(r,e,t){letn=Pe;n===null&&oO();vari=void0,o=ti(jt);Q&&(o.label=e??r.toString());vars=!ze,a=newSet;returnDO(()=>{varl=Pe;Q&&($i={effect:l,effect_deps:newSet,warned:!1});varc=bw();i=c.promise;try{Promise.resolve(r()).then(c.resolve,f=>{f!==Ua&&c.reject(f)}).finally(Dp)}catch(f){c.reject(f),Dp()}if(Q){if($i){if(l.deps!==null)for(letf=0;f<fi;f+=1)$i.effect_deps.add(l.deps[f]);if(vn!==null)for(letf=0;f<vn.length;f+=1)$i.effect_deps.add(vn[f])}$i=null}varu=Ne;if(s){if((l.f&32768)!==0)vard=T_();if(n.b?.is_rendered())u.async_deriveds.get(l)?.reject(Fp);elsefor(letfofa.values())f.reject(Fp);a.add(c),u.async_deriveds.set(l,c)}letp=(f,m=void0)=>{Q&&($i=null),d?.(),a.delete(c),m!==Fp&&(u.activate(),m?(o.f|=8388608,ds(o,m)):((o.f&8388608)!==0&&(o.f^=8388608),Q&&t!==void0&&!o.equals(f)&&(tg.add(o),setTimeout(()=>{tg.has(o)&&(l.f&16384)===0&&(X$(o.label,t),tg.delete(o))})),ds(o,f)),u.deactivate())};c.promise.then(p,f=>p(null,f||"unknown"))}),hn(()=>{for(letlofa)l.reject(Fp)}),Q&&(o.f|=
`).some(a=>a.startsWith("https://svelte.dev/e/")))throws;returns!==qa&&console.warn("Failed to hydrate: ",s),e.recover===!1&&pO(),Hw(),Ip(t),jr(!1),Zu(r,e)}finally{jr(n),Vt(i)}}varZw=newMap;functiongR(r,{target:e,anchor:t,props:n={},events:i,context:o,intro:s=!0,transformError:a}){Hw();varl=void0,c=XO(()=>{varu=t??e.appendChild(wr());hg(u,{pending:()=>{}},f=>{pe({});varm=ct;if(o&&(m.c=o),i&&(n.$$events=i),Me&&Xi(f,null),rA=s,l=r(f,n)||Jh(),rA=!0,Me&&(Pe.nodes.end=Ye,Ye===null||Ye.nodeType!==Gi||Ye.data!=="]"))throwFu(),qa;fe()},a);vard=newSet,p=f=>{for(varm=0;m<f.length;m++){varg=f[m];if(!d.has(g)){d.add(g);varv=uR(g);for(letxof[e,document]){vary=Zw.get(x);y===void0&&(y=newMap,Zw.set(x,y));varb=y.get(g);b===void0?(x.addEventListener(g,Kw,{passive:v}),y.set(g,1)):y.set(g,b+1)}}}};returnp(Ep(Y_)),Yw.add(p),()=>{for(varfofd)for(letvof[e,document]){varm=Zw.get(v),g=m.get(f);--g==0?(v.removeEventListener(f,Kw),m.delete(f),m.size===0&&Zw.delete(v)):m.set(f,g)}Yw.delete(p),u!==t&&u.parentNode?.removeChild(u)}});returnnA.set(l,c),l}varnA=newWeakMap;functionjp(r,e){lett=nA.get(r);returnt?(nA.delete(r),t(e)):(Q&&eO(),Promise.resolve())}varms,oa,to,Ju,gg,vg,Jw,hs=class{constructor(e,t=!0){he(this,"anchor");rt(this,ms,newMap);rt(this,oa,newMap);rt(this,to,newMap);rt(this,Ju,newSet);rt(this,gg,!0);rt(this,vg,e=>{if(V(this,ms).has(e)){vart=V(this,ms).get(e),n=V(this,oa).get(t);if(n)Hp(n),V(this,Ju).delete(t);else{vari=V(this,to).get(t);i&&(Hp(i.effect),V(this,oa).set(t,i.effect),V(this,to).delete(t),Q&&(i.fragment.lastChild[y_]=this.anchor),i.fragment.lastChild.remove(),this.anchor.before(i.fragment),n=i.effect)}for(let[o,s]ofV(this,ms)){if(V(this,ms).delete(o),o===e)break;leta=V(this,to).get(s);a&&(br(a.effect),V(this,to).delete(s))}for(let[o,s]ofV(this,oa)){if(o===t||V(this,Ju).has(o))continue;leta=()=>{if(Array.from(V(this,ms).values()).includes(o)){varc=document.createDocumentFragment();zp(s,c),c.append(wr()),V(this,to).set(o,{effect:s,fragment:c})}elsebr(s);V(this,Ju).delete(o),V(this,oa).delete(o)};V(this,gg)||!n?(V(this,Ju).add(o),ta(s,a,!1)):a()}}});rt(this,Jw,e=>{V(this,ms).delete(e);lett=Array.from(V(this,ms).values());for(let[n,i]ofV(this,to))t.includes(n)||(br(i.effect),V(this,to).delete(n))});this.anchor=e,Ge(this,gg,t)}ensure(e,t){varn=Ne,i=zw();if(t&&!V(this,oa).has(e)&&!V(this,to).has(e))if(i){varo=document.createDocumentFragment(),s=wr();o.append(s),V(this,to).set(e,{effect:Zr(()=>t(s)),fragment:o})}elseV(this,oa).set(e,Zr(()=>t(this.anchor)));if(V(this,ms).set(n,e),i){for(let[a,l]ofV(this,oa))a===e?n.unskip_effect(l):n.skip_effect(l);for(let[a,l]ofV(this,to))a===e?n.unskip_effect(l.effect):n.skip_effect(l.effect);n.oncommit(V(this,vg)),n.ondiscard(V(this,Jw))}elseMe&&(this.anchor=Ye),V(this,vg).call(this,n)}};ms=newWeakMap,oa=newWeakMap,to=newWeakMap,Ju=newWeakMap,gg=newWeakMap,vg=newWeakMap,Jw=newWeakMap;functionyg(r,e,...t){varn=newhs(r);gi(()=>{leti=e()??null;Q&&i==null&&fO(),n.ensure(i,i&&(o=>i(o,...t)))},65536)}if(Q){letr=function(e){if(!(einglobalThis)){lett;Object.defineProperty(globalThis,e,{configurable:!0,get:()=>{if(t!==void0)returnt;hO(e)},set:n=>{t=n}})}};r("$state"),r("$effect"),r("$derived"),r("$inspect"),r("$props"),r("$bindable")}functioneC(r){ct===null&&Aw("onMount"),Wa&&ct.l!==null?gY(ct).m.push(r):Yt(()=>{lete=kt(r);if(typeofe=="function")returne})}functiongY(r){vare=r.l;returne.u??(e.u={a:[],b:[],m:[]})}varbR=newMap;functionwR(r,e){vart=bR.get(r);t||(t=newSet,bR.set(r,t)),t.add(e)}functionY(r,e,t=!1){varn;Me&&(n=Ye,fn());vari=newhs(r),o=t?65536:0;functions(a,l){if(Me){varc=Qh(n);if(a!==parseInt(c.substring(1))){varu=Ks();Vt(u),i.anchor=u,jr(!1),i.ensure(a,l),jr(!0);return}}i.ensure(a,l)}gi(()=>{vara=!1;e((l,c=0)=>{a=!0,s(c,l)}),a||s(-1,null)},o)}varwY=Symbol("NaN");functionbg(r,e,t){Me&&fn();varn=newhs(r),i=!cs();gi(()=>{varo=e();o!==o&&(o=wY),i&&o!==null&&typeofo=="object"&&(o={}),n.ensure(o,t)})}functionxg(r,e){returne}functionkY(r,e,t){for(varn=[],i=e.length,o,s=e.length,a=0;a<i;a++){letd=e
\r\f\xA0\v\uFEFF`];function AR(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||SR.includes(n[s-1]))&&(a===n.length||SR.includes(n[a]))?n=(s===0?"":n.substring(0,s))+n.substring(a+1):s=a}}return n===""?null:n}function _R(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 aA(r){return r[0]!=="-"||r[1]!=="-"?r.toLowerCase():r}function IR(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(/\/\*.*?\*\//g,"").trim();var o=!1,s=0,a=!1,l=[];n&&l.push(...Object.keys(n).map(aA)),i&&l.push(...Object.keys(i).map(aA));var c=0,u=-1;let g=r.length;for(var d=0;d<g;d++){var p=r[d];if(a?p==="/"&&r[d-1]==="*"&&(a=!1):o?o===p&&(o=!1):p==="/"&&r[d+1]==="*"?a=!0:p==='"'||p==="'"?o=p:p==="("?s++:p===")"&&s--,!a&&o===!1&&s===0){if(p===":"&&u===-1)u=d;else if(p===";"||d===g-1){if(u!==-1){var f=aA(r.substring(c,u).trim());if(!l.includes(f)){p!==";"&&d++;var m=r.substring(c,d).trim();t+=" "+m+";"}}c=d+1,u=-1}}}}return n&&(t+=_R(n)),i&&(t+=_R(i,!0)),t=t.trim(),t===""?null:t}return r==null?null:String(r)}function it(r,e,t,n,i,o){var s=r[jh];if(Me||s!==t||s===void 0){var a=AR(t,n,o);(!Me||a!==r.getAttribute("class"))&&(a==null?r.removeAttribute("class"):e?r.className=a:r.setAttribute("class",a)),r[jh]=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 lA(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 Gp(r,e,t,n){var i=r[Gh];if(Me||i!==e){var o=IR(e,n);(!Me||o!==r.getAttribute("style"))&&(o==null?r.removeAttribute("style"):r.style.cssText=o),r[Gh]=e}else n&&(Array.isArray(n)?(lA(r,t?.[0],n[0]),lA(r,t?.[1],n[1],"important")):lA(r,t,n));return n}function cA(r,e){e?r.hasAttribute("selected")||r.setAttribute("selected",""):r.removeAttribute("selected")}function $Y(r,e){var t=r.__defaultValue,n=r.multiple,i=n?t??[]:null;if(!(n&&!ko(i))){var o=r.selectedIndex,s=e&&n?new Set(r.selectedOptions):null;for(var a of r.options){var l=Yp(a);cA(a,n?i.includes(l):Uw(l,t))}if(e)if(s!==null)for(a of r.options){var c=s.has(a);a.selected!==c&&(a.selected=c)}else r.selectedIndex!==o&&(r.selectedIndex=o)}}function uc(r,e,t=!1){if(r.multiple){if(e==null)return;if(!ko(e))return tO();for(var n of r.options)n.selected=e.includes(Yp(n));return}for(n of r.options){var i=Yp(n);if(Uw(i,e)){n.selected=!0;return}}(!t||e!==void 0)&&(r.selectedIndex=-1)}function dc(r){var e=new MutationObserver(t=>{t.every(OY)||("__defaultValue"in r&&$Y(r,!1),"__value"in r&&uc(r,r.__value))});e.observe(r,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["value"]}),hn(()=>{e.disconnect()})}function uA(r,e,t=e){var n=new WeakSet,i=!0;$w(r,"change",o=>{var s=o?"[selected]":":checked",a;if(r.multiple)a=[].map.call(r.querySelectorAll(s),Yp);else{var l=r.querySelector(s)??r.querySelector("option:not([disabled])");a=l&&Yp(l)}t(a),r.__value=a,Ne!==null&&n.add(Ne)}),$r(()=>{var o=e();if(r===document.activeElement){var s=Ar?Xs:Ne;if(n.has(s))return}if(uc(r,o,i),i&&o===void 0){var a=r.querySelector(":checked");a!==null&&(o=Yp(a),t(o))}r.__value=o,i=!1})}function Yp(r){return"__value"in r?r.__value:r.value}function OY(r){if(r.target.closest("selectedcontent")!==null)return!0;if(r.type==="childList"){var e=[...r.addedNodes,...r.removedNodes];return e.length>0&&e.every(t=>t.nodeName==="SELECTEDCONTENT")}return!1}var VY=Symbol("is custom element"),BY=Symbol("is html"),qY=Ew?"link":"LINK";var UY=Ew?"progress":"PROGRESS";function Rt(r){if(Me){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[tc]=t,yr(t),Mw()}}function bi(r,e){var t=pA(r);t.value===(t.value=e??void 0)||r.value===e&&(e!==0||r.nodeName!==UY)||(r.value=e??"")}function ed(r,e){var t=pA(r);t.checked!==(t.checked=e??void 0)&&(r
`).map(b=>b.trim()).filter(b=>b.length>0),g=DA(m[0]??"(empty text card)",90),v=[`${m.length} line${m.length===1?"":"s"}`];c&&v.push(c);lety=v.join(" \xB7 ");return{id:a.id,type:l,title:g,subtitle:y,searchText:`${a.id}${g}${y}`.toLowerCase(),capturable:!0,capturableReason:""}}if(l==="file"){letf=u8(a.file),m=Nt.test(f),g=m?"":"Canvas file cards must link to markdown files (.md).",v=DA(f.split("/").pop()??f,90),y=[DA(f,120)];c&&y.push(c),m||y.push("Not capturable in this version");letb=y.join(" \xB7 ");return{id:a.id,type:l,title:v,subtitle:b,searchText:`${a.id}${v}${b}`.toLowerCase(),capturable:m,capturableReason:g}}letd=`Unsupported node (${typeofa.type=="string"&&a.type.length>0?a.type:"unknown"})`,p=c||"Type is not currently capturable";return{id:a.id,type:l,title:d,subtitle:p,searchText:`${a.id}${d}${p}`.toLowerCase(),capturable:!1,capturableReason:"This Canvas node type is not capturable."}}),s={text:0,file:1,other:2};returno.sort((a,l)=>{letc=s[a.type]-s[l.type];returnc!==0?c:a.title.localeCompare(l.title)})}catch{return[]}}ht();Kg();ks();rn();bt();Xe();varQ5=["noteContent","propertyValue","captureTarget","fileName","lineTarget"],X5=["captureTarget","fileName"],Un=Q5,o1=3;functionBe(r,e,t=r.endsWith(":}}")?2:0){return{insert:r,description:e,caretOffset:t}}varZ5=[{regex:KR,contexts:Un,suggestion:Be("{{VALUE}}","Asks you for text when the choice runs")},{regex:QR,contexts:Un,suggestion:Be("{{VALUE:}}","Asks once and reuses the answer by name, or lists options to pick from"),expansions:()=>[Be("{{VALUE:title}}",'Asks once, then reuses the answer as "title"'),Be("{{VALUE:option1,option2,option3}}","Asks you to pick one of these options"),Be("{{VALUE:option1,option2,option3|custom}}","Same, but you can also type your own"),Be("{{VALUE:title|label:Note title}}","Words the prompt yourself"),Be("{{VALUE:option1,option2|label:Pick one}}","A list with your own prompt text"),Be("{{VALUE:title|label:Note title|default:Untitled}}","Opens the prompt with an answer already filled in"),Be("{{VALUE:<items>|text:<display items>}}","Shows one label in the list and inserts another"),Be("{{VALUE:option1,option2|name:category}}","Names the pick, so {{VALUE:category}} reuses it"),Be("{{VALUE:title|case:kebab}}","Reshapes the answer; type |case: for every style"),Be("{{VALUE:title|trim}}","Trims whitespace off the answer"),Be("{{VALUE:title|optional}}","Lets the prompt be skipped, leaving it empty")]},{regex:YR,contexts:Un,suggestion:Be("{{NAME}}","Another name for {{VALUE}}; they do the same thing")},{regex:XR,contexts:Un,suggestion:Be("{{VDATE:}}",'Asks you for a date; "tomorrow" works'),expansions:()=>[Be("{{VDATE:date,YYYY-MM-DD}}",'Asks for a date, reused by name as "date"'),Be("{{VDATE:date,YYYY-MM-DD|today}}","Same, with today filled in"),Be("{{VDATE:dueDate,YYYY-MM-DD|next monday}}","Same, starting at next Monday"),Be("{{VDATE:dueDate,YYYY-MM-DD|optional}}","Same, but skippable"),Be("{{VDATE:date,dddd, MMMM Do, YYYY|case:lower}}","Lowercases the picked date after formatting")]},{regex:nN,contexts:Un,suggestion:Be("{{FIELD:}}","Suggests values a property already has in your vault, like {{FIELD:project}}")},{regex:lN,contexts:["noteContent","propertyValue"],suggestion:Be("{{PROPERTY}}","Inserts the property's current value (property Captures only)")},{regex:cN,contexts:["noteContent"],suggestion:Be("{{CURSOR}}","Places the cursor here (Capture and Template bodies)")},{regex:rN,contexts:Un,suggestion:Be("{{FILE:}}","Picks a note from a folder"),expansions:({context:r})=>{lete=[Be("{{FILE:<folder>}}","Picks a note from that folder and inserts its name")];returnX5.includes(r)||e.push(Be("{{FILE:<folder>|link}}","Same, but inserts a link to the note"),Be("{{FILE:<folder>|path}}","Same, but inserts its full path"),Be("{{FILE:<folder>|optional}}","Same, but skippable")),e.push(Be("{{FILE:<folder>|custom}}","Same, but you can also type a name that is not there yet")),e}},{regex:sN,contexts:Un,suggestion:Be("{{MVALUE}}","Asks you for a math formula (LaTeX), with a live preview")},{regex:jR,contexts:Un,suggestion:Be("{{DAT
/* 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 St(r,e){pe(e,!0),We(r,aK);let t=ne(e,"checked",15),n=ne(e,"disabled",3,!1),i=ne(e,"ariaLabel",3,void 0),o=ne(e,"onchange",3,void 0),s=F(()=>t()??!1);function a(){n()||(t(!h(s)),o()?.(t()))}function l(p){(p.key==="Enter"||p.key==="")&&(p.preventDefault(),a())}var c=sK();let u;var d=B(c);Rt(d),N(c),re(()=>{u=it(c,1,"checkbox-containersvelte-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),ed(d,h(s))}),Ae("click",c,a),Ae("keydown",c,l),M(r,c),fe()}nt(["click","keydown"]);var lK=L("<option></option>"),cK=L('<select class="dropdown"></select>');function ft(r,e){pe(e,!0);let t=ne(e,"value",15,""),n=ne(e,"disabled",3,!1),i=ne(e,"ariaLabel",3,void 0),o=ne(e,"onchange",3,void 0);var s=cK();Ot(s,21,()=>e.options,a=>a.value,(a,l)=>{var c=lK(),u=le(c,!0),d={};re(()=>{ae(u,h(l).label),d!==(d=h(l).value)&&(c.value=(c.__value=d)??"")}),M(a,c)}),N(s),dc(s),re(()=>{s.disabled=n(),ke(s,"aria-label",i())}),Ae("change",s,()=>o()?.(t())),uA(s,t),M(r,s),fe()}nt(["change"]);var l1=require("obsidian"),uK=L('<span class="quickadd-icon svelte-1fiwm9k"></span>'),dK={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 Et(r,e){pe(e,!0),We(r,dK);let t=ne(e,"size",3,16),n=Ce(void 0);Yt(()=>{if(!h(n)||!e.iconId)return;(0,l1.setIcon)(h(n),e.iconId);let o=h(n).querySelector("svg");o&&(o.setAttribute("width",`${t()}`),o.setAttribute("height",`${t()}`))});var i=uK();Ci(i,o=>j(n,o),()=>h(n)),M(r,i),fe()}Ds();Ie();xt();function Ef(r){return r==="Multi"?"folder":"choice"}function u2(r){return r==="Multi"?"Folder":"Choice"}function VQ(r){return`${u2(r)} name`}async function wx(r,e,t){try{let i=(await ar.Prompt(r,VQ(t),void 0,e)).trim();return!i||i===e?null:i}catch(n){return ot(n)||I.logError(nl(n,"Could not rename")),null}}var BQ=L('<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 kv(r,e){pe(e,!0);let t=ne(e,"name",15);async function n(){let u=await wx(e.app,t());u&&t(u)}var i=BQ(),o=B(i),s=B(o),a=le(s,!0),l=_(s,2),c=B(l);Et(c,{iconId:"pencil",size:16}),N(l),N(o),N(i),re(()=>{ke(o,"aria-label",`Rename ${t()}`),ae(a,t())}),Ae("click",o,n),M(r,i),fe()}nt(["click"]);ks();rn();var si=class extends xr{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=>kn(s))}getSuggestions(t){let n=Ac(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=iv(t),o=iv(this.getCurrentQuery());t.toLowerCase().endsWith(".md")&&o.toLowerCase().startsWith(`${i.toLowerCase()}.`)&&(o=i),this.renderMatch(n,i,o)}getCurrentQuery(){return this.inputEl.value}};function qQ(r){return r?Array.isArray(r)?r:[r]:[]}function Sd(r,e){let t=qQ(e(r));return{destroy(){t.forEach(n=>n.destroy())}}}var UQ=L("<textarea></textarea>"),HQ=L('<input type="text"/>'),zQ=L('<!> <div aria-live="polite"> </div>',1);function sn(r,e){pe(e,!0);let t=ne(e,"value",15,""),n=ne(e,"placeholder",3,void 0),i=ne(e,"inputKind",3,"text"),o=ne(e,"required",3,!1),s=ne(e,"requiredMessage",3,"This field is required"),a=ne(e,"disabled",3,!1),l=ne(e,"validator",3,void 0),c=ne(e,"trim",3,!0),u=ne(e,"suggestions",3,void 0),d=ne(e,"maxSuggestions",3,1/0),p=ne(e,"makeSuggesters",19,()=>[]),f=ne(e,"app",3,void 0),m=ne(e,"id",3,void 0),g=ne(e,"ariaLabel",3,void 0),v=ne(e,"onChange",3,void 0),y=Ce(!1),b=Ce(""),x=Ce("neutral"),w=0,T=!1,C=`qa-hint-${Math.random().toString(36).slice(2)}`,S=te=>c()?te
section.</div>`),GB=L("<!> <!>",1),O9=L(`<div class="setting-item-description">Inline insertion needs a single-line target. The line break (\\n) can't be
matchedonthesameline\u2014removeit,orturnoff"Inline insertion".</div>`),YB=L("<!> <!> <!>",1),R9=L(`<div class="setting-item-description">No sorting: newest-first prepends the new section above existing ones;
oldest-firstappendsitbelow.</div>`),N9=L(`<div class="setting-item-description">This heading uses a date token QuickAdd can't auto-read for sorting. Pick
"Date"andentertheformat,orsectionsstayininsertionorder.</div>`),L9=L(`<div class="setting-item-description">The "Insert after" heading is created at its sorted position among ALL
eachsection.</div> <!> <!> <!> <!> <!> <!>`,1),V9=L("<!> <!> <!> <!> <!>",1);function WD(r,e){pe(e,!0);let t=ne(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=no,!0);let n=[O=>new Sn(e.app,O,e.plugin,"lineTarget")],i=[{value:"auto",label:"Auto (headings only)"},{value:"skip",label:"Always skip"},{value:"none",label:"Never skip"}],o=F(()=>t().inline?[{value:no,label:"Top"},{value:nd,label:"Bottom"},{value:id,label:"Cursor"}]:[{value:no,label:"Top"},{value:nd,label:"Bottom"},{value:id,label:"Cursor"},{value:vs,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=Ce(!!t().orderBy),u=F(()=>t().createIfNotFoundLocation===vs),d=F(()=>t().createIfNotFound&&h(u)),p=F(()=>new jf(e.app,e.plugin)),f=Ce(!1);Yt(()=>{let O=t().after??"",H=h(p);if(!t().inline||O===""){j(f,!1);return}let ce=!1;return H.format(O).then(te=>{ce||j(f,/[\n\r]/.test(te),!0)}).catch(()=>{ce||j(f,!1)}),()=>{ce=!0}});letm=F(()=>t().orderBy??{by:"insertion",direction:"desc",unparseable:"bottom"}),g=F(()=>/\{\{V?DATE\b/i.test(t().after??"")),v=F(()=>h(d)&&t().orderBy?.by==="insertion"&&h(g)&&!zD(t().after??""));Yt(()=>{if(!h(d))return;letO=zD(t().after??"");if(!t().orderBy){t(t().orderBy={by:O?"date":"insertion",direction:"desc",dateFormat:O,unparseable:"bottom"},!0);return}!h(c)&&(t().orderBy.by==="insertion"||t().orderBy.by==="date")&&(t(t().orderBy.by=O?"date":"insertion",!0),t(t().orderBy.dateFormat=O,!0))});functiony(O){t(t().createIfNotFoundLocation=O,!0),O===vs?t(t().inline=!1,!0):(t(t().orderBy=void0,!0),j(c,!1))}functionb(O){j(c,!0),t().orderBy&&t(t().orderBy.by=O,!0)}functionx(O){t().promptHeading||O&&!t().after.startsWith("#")&&(t(t().considerSubsections=!1,!0),newKB.Notice("Consider subsections requires the target to be a heading (starts with #)"))}functionw(O){O&&(t(t().inline=!1,!0),t(t().replaceExisting=!1,!0))}varT=V9(),C=Te(T);Se(C,{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:H=>{St(H,{onchange:w,getchecked(){returnt().promptHeading},setchecked(ce){t(t().promptHeading=ce,!0)}})},$$slots:{control:!0}});varS=_(C,2);{varA=O=>{varH=$9();M(O,H)},D=O=>{varH=YB(),ce=Te(H);Ti(ce,{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:(xe,ue=Ct)=>{varbe=GB(),Ke=Te(be);sn(Ke,{getid(){returnue()},placeholder:"Insert after",required:!0,requiredMessage:"Insert after text is required",getmakeSuggesters(){returnn},getvalue(){returnt().after},setvalue(Ee){t(t().after=Ee,!0)}});varOe=_(Ke,2);fo(Oe,{getvalue(){returnt().after},formatterKind:"lineTarget",getapp(){returne.app},getplugin(){returne.plugin}}),M(xe,be)},$$slots:{default:!0}});varte=_(ce,2);{letie=ue=>{St(ue,{getdisabled(){returnh(u)},getchecked(){returnt().inline},setchecked(be){t(t().inline=be,!0)}})},xe=F(()=>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).");Se(te,{name:"Inline insertion",getdesc(){returnh
Inordertobeiterable,non-arrayobjectsmusthavea[Symbol.iterator]()method.`)}function pZ(){throw new TypeError(`Invalidattempttodestructurenon-iterableinstance.
Inordertobeiterable,non-arrayobjectsmusthavea[Symbol.iterator]()method.`)}function Ud(r,e){var t=typeof Symbol<"u"&&r[Symbol.iterator]||r["@@iterator"];if(!t){if(Array.isArray(r)||(t=uF(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(`Invalidattempttoiteratenon-iterableinstance.
file's folder (or you'll be prompted to pick one if no file is open).</div>`),FJ=L('<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),PJ=L("<!> <!> <!> <!> <!> <!> <!> <!> <!> <!> <!> <!> <!> <!> <!> <!> <!> <!> <!> <!> <!>",1);functionwF(r,e){pe(e,!0);lett=ne(e,"choice",15),n=F(()=>e.plugin.getTemplateFiles().map(ge=>ge.path)),i=F(()=>Il(Vo(e.app)));functiono(ge){letve=ge.trim();returnve?cl(ve)?{valid:!0,message:"Contains format syntax \u2014 resolved at run time."}:Vn(e.app,ve)!==null||"Template not found":!0}lets=[ge=>newSn(e.app,ge,e.plugin,"fileName")],a=F(()=>yF(t(),t().fileNameFormat.enabled?t().fileNameFormat.format:Or)),l=F(()=>h(a)?"Show matching notes and unresolved links in the note-title prompt.":"Only available when the file name prompt is the default note title: no custom format, {{VALUE}}, or {{NAME}}."),c=F(()=>Gq(t().folder)),u=F(()=>Qq[h(c)]),d=F(()=>h(c)==="specified"&&t().folder.folders.length===0);functionp(ge){t(t().folder=Yq(t().folder,ge),!0)}letf=Ce(""),m;functiong(ge){returnm=newbE(e.app,ge,h(i),t().folder.folders),m}Yt(()=>{m?.updateCurrentItems(t().folder.folders)});functionv(){letge=h(f).trim();if(ge){if(t().folder.folders.some(ve=>ve===ge)){I.logWarning("cannot add same folder twice.");return}t().folder.folders.push(ge),j(f,"")}}functiony(ge){ge.key==="Enter"&&v()}letb=F(()=>sq(t().fileExistsBehavior)),x=F(()=>h(b)!=="prompt"&&h(b)!=="keep"),w=F(()=>nq(h(b)==="update"?"update":"create")),T=F(()=>t().fileExistsBehavior.kind==="apply"?t().fileExistsBehavior.mode:h(w)[0].id);functionC(ge){t(t().fileExistsBehavior=aq(ge,t().fileExistsBehavior),!0)}functionS(ge){t(t().fileExistsBehavior={kind:"apply",mode:ge},!0)}varA=PJ(),D=Te(A);kv(D,{getapp(){returne.app},getname(){returnt().name},setname(ge){t(t().name=ge,!0)}});varP=_(D,2);Se(P,{name:"Template",heading:!0});varU=_(P,2);Ti(U,{name:"Template path",desc:"Path to the template this choice creates notes from.",children:(ve,Fe=Ct)=>{sn(ve,{getid(){returnFe()},getvalue(){returnt().templatePath},placeholder:"Template path",getapp(){returne.app},getsuggestions(){returnh(n)},maxSuggestions:50,validator:o,onChange:Je=>t(t().templatePath=Je.trim(),!0)})},$$slots:{default:!0}});varK=_(U,2);Ti(K,{name:"File name format",desc:"Set the file name format. When off, QuickAdd asks for the note title.",getbodyVisible(){returnt().fileNameFormat.enabled},control:Fe=>{St(Fe,{getchecked(){returnt().fileNameFormat.enabled},setchecked(Je){t(t().fileNameFormat.enabled=Je,!0)}})},children:(Fe,Je=Ct)=>{varmt=IJ(),Ft=Te(mt);sn(Ft,{getid(){returnJe()},placeholder:"File name format",getmakeSuggesters(){returns},getvalue(){returnt().fileNameFormat.format},setvalue(rr){t(t().fileNameFormat.format=rr,!0)}});varQe=_(Ft,2);Vd(Qe,{getvalue(){returnt().fileNameFormat.format}});varzt=_(Qe,2);{letrr=F(()=>RE(t().folder));fo(zt,{getvalue(){returnt().fileNameFormat.format},formatterKind:"fileName",gettargetFolderPath(){returnh(rr)},getapp(){returne.app},getplugin(){returne.plugin}})}M(Fe,mt)},$$slots:{control:!0,default:!0}});varW=_(K,2);Se(W,{name:"Location",heading:!0});varee=_(W,2);Se(ee,{name:"New note location",getdesc(){returnh(u)},control:ve=>{ft(ve,{getvalue(){returnh(c)},getoptions(){returnKq},ariaLabel:"New note location",onchange:p})},$$slots:{control:!0}});varme=_(ee,2);{varO=ge=>{varve=FJ(),Fe=Te(ve),Je=B(Fe),mt=B(Je);vF(mt,{getfolders(){returnt().folder.folders},onChange:Z=>t(t().folder.folders=Z,!0)}),N(Je);varFt=_(Je,2),Qe=B(Ft);Rt(Qe),$r(()=>wi(Qe,()=>h(f),Z=>j(f,Z))),Jt(Qe,(Z,De)=>Sd?.(Z,De),()=>g);varzt=_(Qe,2);N(Ft),N(Fe);varrr=_(Fe,2);{varQn=Z=>{varDe=DJ();M(Z,De)};Y(rr,Z=>{h(d)&&Z(Qn)})}vardi=_(rr,2);Se(di,{name:"Include subfolders",desc:"Get prompted to choose from both the selected folders and their subfolders when creating the note.",control:De=>{St(
/* 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-a7rp4hbutton: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). */
/* 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
/* 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;}
}`};functionWm(r,e){pe(e,!0),We(r,bte);lett=ne(e,"choices",31,()=>ut([])),n=ne(e,"forceDragDisabled",3,!1),i=ne(e,"isEmptyFolder",3,!1),o=ne(e,"nested",3,!1),s=F(()=>{letT=newSet;returnLr(t()).filter(C=>{if(!Ue(C))return!1;letS=C.id;returntypeofS!="string"||S===""||T.has(S)?!1:(T.add(S),!0)})}),a=F(()=>e.rootReorder??e.actions.onReorderChoices),l=0,c=dH.Platform.isMobile,u=Ce(""),d=gm(),p=F(()=>n()||!c&&!d.armed),f=Ce(void0),m=null;functiong(T){if(n())return;d.markStarted();letC=T.detail.items;m=fm(C,T.detail.info.id)??m,j(u,T.detail.info.id,!0),t(qi(C))}functionv(T){if(n())return;j(u,"");letC=qi(T.detail.items),S=T.detail.info.id;T.detail.info.trigger===jn.DROPPED_INTO_ANOTHER?C=C.filter(A=>A.id!==S):m?.item.id===S&&!C.some(A=>A.id===S)&&(C=[...C],C.splice(Math.min(m.index,C.length),0,m.item)),m=null,t(C),d.reset(),e.actions.onReorderChoices(t())}lety=()=>{n()||d.startDrag()};functionb(T,C){if(n())return;letS=document.activeElement?.getAttribute("aria-label"),A=qi(h(s)),D=mm(A,T.id,C);if(!D)return;letP=D.findIndex(U=>U.id===T.id);t(D),e.actions.onReorderChoices(t()),Hd(`Moved ${T.name} to position ${P+1} of ${D.length}`),S&&vm(h(f),S)}varx=yte();letw;Ot(x,29,()=>qi(h(s)),T=>T.id,(T,C)=>{varS=vte(),A=B(S);{varD=U=>{{letK=F(()=>e.roots??t()),W=F(()=>n()?void0:()=>b(h(C),-1)),ee=F(()=>n()?void0:()=>b(h(C),1));dP(U,{getapp(){returne.app},getroots(){returnh(K)},getdragDisabled(){returnh(p)},startDrag:y,getactions(){returne.actions},getchoice(){returnh(C)},getonMoveUp(){returnh(W)},getonMoveDown(){returnh(ee)}})}},P=U=>{{letK=F(()=>e.roots??t()),W=F(()=>n()?void0:()=>b(h(C),-1)),ee=F(()=>n()?void0:()=>b(h(C),1));pP(U,{getapp(){returne.app},getroots(){returnh(K)},getdragDisabled(){returnh(p)},startDrag:y,getactions(){returne.actions},getcollapseId(){returnh(u)},getforceDragDisabled(){returnn()},getrootReorder(){returnh(a)},getchoice(){returnh(C)},getonMoveUp(){returnh(W)},getonMoveDown(){returnh(ee)}})}};Y(A,U=>{h(C).type!=="Multi"?U(D):U(P,-1)})}N(S),sA(S,()=>uH,()=>({duration:l})),M(T,S)}),N(x),Ci(x,T=>j(f,T),()=>h(f)),Jt(x,(T,C)=>pm?.(T,C),()=>hm({items:h(s),dragDisabled:h(p),flipDurationMs:l,dropTargetClasses:o()?["qa-folder-droptarget"]:[]})),re(()=>w=it(x,1,"choiceList svelte-2ry05y",null,w,{"qa-nested":o(),"qa-folder-empty":i(),"qa-empty":h(s).length===0})),Po("consider",x,g),Po("finalize",x,v),M(r,x),fe()}varwte=L('<pre class="qaChoicesUnavailableDetail svelte-1fs8ikt"> </pre>'),Cte=L(`<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>`),xte={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;}"};functionjm(r,e){We(r,xte);lett=ne(e,"what",3,"your choices"),n=ne(e,"detail",3,"");vari=Cte(),o=B(i),s=B(o);Et(s,{iconId:"alert-triangle",size:16});vara=_(s,2),l=le(a);N(o);varc=_(o,6);{varu=d=>{varp=wte(),f=le(p,!0);re(()=>ae(f,n())),M(d,p)};Y(c,d=>{n()&&d(u)})}N(i),re(()=>ae(l,`QuickAdd couldn't display ${t()??""}`)),M(r,i)}xt();vargH=require("obsidian");Ie();xt();varmH=require("obsidian");bt();Ie();bt();varfP=newWeakMap;functionpH(r){lete=fP.get(r);if(e)returne;lett=i1(r);returnfP.set(r,t),t}functionfH(r){returnfP.has(r)}functionmP(r,e){if(!Array.isArray(r))returnr;lett=fH(r),{choices:n,repaired:i}=pH(r);if(t)returnn;for(let{choice:o}ofi)if(o.command)try{e.enableCommand(o)}catch(s){I.logError(`Could not register a command for the repaired choice "${o.name}": ${sinstanceofError?s.message:String(s)}`)}returnn}functionhH(r,e){lett=e.trim();if(!t)returnr;letn=(0,mH.prepareFuzzySearch)(t),i=o=>{if(!Ue(o))returnnull;lets=!!n(o.name??"");if(o.type!=="Multi")returns?o:null;leta=et(o).map(l=>i(l)).filter(l=>l!==null);returns||a.length>0?{...o,collapsed:!1,choices:a}:null};returnr.map(o=>i(o)).filter(o=>o!==null)}functionhP(r){returnUe(r)?r.command?!0:et(r).some(hP):!1}functionrb(r,e){if(!Ue(r))returnr;if(r.id===e.id)return{...r,...e};if(ml(r)){lett=et(r).map(i=>rb(i,e));return{...r,choices:t}}returnr}functionvH(r){functione(){r.saveChoices(Xc(r.choices))}asyncfunctiont(g,v,y,b=!1){letx=iH(v,r.choices),w=rP(v,x);if(r.choices=UU(r.choices,w,y),!y&&r.filterQuery.trim().length>0&&(r.filterQuery=""),e(),v==="Multi")awaita(w);elseif(!b)try{awaits(w)}catch(T){I.logError(`Failed to configure the new choice: ${TinstanceofError?T.message:String(T)}`),e()}awaitn(w.id)}asyncfunctionn(g){awaitac();try{document.querySelector(`[data-choice-id="${g}"]`)?.scrollIntoView({block:"nearest"})}catch{}}functioni(g){returnQy(r.choices,g.id)??g}asyncfunctiono(g){letv=i(g);awaitNU(v,r.app)&&(r.choices=Xy(r.choices,g.id).updated,r.commandRegistry.disableCommand(v,{recursive:!0}),e())}asyncfunctions(g){letv=i(g),y=awaitLU(v,r.app,r.plugin);y&&(r.choices=r.choices.map(b=>rb(b,y)),r.commandRegistry.updateCommand(v,y),e())}asyncfunctiona(g){if(!g)return;letv=awaitwx(r.app,g.name,g.type);if(!v)return;lety=i(g),b={...y,name:v};r.choices=r.choices.map(x=>rb(x,b)),r.commandRegistry.updateCommand(y,b),e()}functionl(g){letv=VU(i(g));r.choices=r.choices.map(y=>rb(y,v)),v.command?r.commandRegistry.enableCommand(v):r.commandRegistry.disableCommand(v),e()}asyncfunctionc(g){letv=awaitOU(i(g),r.app);r.choices=oP(r.choices,g.id,v)??[...r.choices,v],hP(v)&&r.commandRegistry.enableCommand(v),e(),newgH.Notice(`Duplicated "${g.name}".`),awaitn(v.id)}functionu(g,v){r.choices=v===uP?qU(r.choices,g.id):BU(r.choices,g.id,v),e()}functiond(g){r.choices=g,e()}functionp(g,v){r.choices=HU(r.choices,g,v),e()}functionf(g){r.choices=aP(r.choices,g.id,!g.collapsed),e()}functionm(g,v){return(y,...b)=>{letx=Ef(y?.type),w=y?.name?`the ${x} \u201C${y.name}\u201D`:`that ${x}`;ld(`Couldn't ${g}${w}`,v)(y,...b)}}return{onDeleteChoice:m("delete",o),onConfigureChoice:m("open the settings for",s),onToggleComman
text,orrunamacro.Groupthemwithfolders.<aclass="quickadd-docs-link"target="_blank"rel="noopener noreferrer">Learnmore</a></p> <div class="choiceEmptyActions svelte-1r4uuo1"><!></div></div>`),Tte=L('<button class="search-input-clear-button qaFilterClearButton svelte-1r4uuo1" aria-label="Clear filter"></button>'),kte=L('<div class="choiceFilterEmpty svelte-1r4uuo1">No choices match your filter.</div>'),Ste=L('<button type="button" class="qaAIAssistantBtn clickable-icon svelte-1r4uuo1" aria-label="Configure AI Assistant" title="Configure AI Assistant"><!></button>'),_te=L('<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),Ate=L("<div><!></div>"),Ite={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:00auto;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.5rem1rem;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
/* 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;}
${$e??""}`),[()=>h(a).missingChoices.map($e=>h(f).get($e)??$e).join(", ")]),M(se,oe)};Y(k,se=>{h(a).missingChoices.length>0&&se(R)})}var q=_(k,2);{var J=se=>{var oe=Jte(),de=_(B(oe),2);Ot(de,21,()=>h(a).missingAssets,$e=>$e.path,($e,vt)=>{var nr=Zte(),lr=B(nr),Wr=_(lr),Wt=le(Wr);N(nr),re(()=>{ae(lr,`${h(vt).path??""}`),ae(Wt,`(${t[h(vt).kind]??""})`)}),M($e,nr)}),N(de),N(oe),M(se,oe)};Y(q,se=>{h(a).missingAssets.length>0&&se(J)})}N(qe),M(we,qe)};Y(mt,we=>{h(a)&&we(Ft)})}var Qe=_(mt,2),zt=B(Qe),rr=B(zt),Qn=B(rr);{var di=we=>{var qe=ra("Copying\u2026");M(we,qe)},Z=we=>{var qe=ra("Copy JSON");M(we,qe)};Y(Qn,we=>{h(l)==="copy"?we(di):we(Z,-1)})}N(rr),N(zt);var De=_(zt,2),Pt=B(De),It=_(B(Pt),2),pi=B(It);Rt(pi);var Di=_(pi,2),Au=B(Di);{var wp=we=>{var qe=ra("Saving\u2026");M(we,qe)},Cp=we=>{var qe=ra("Save to file");M(we,qe)};Y(Au,we=>{h(l)==="save"?we(wp):we(Cp,-1)})}N(Di),N(It),N(Pt),N(De),N(Qe);var xp=_(Qe,2),Iu=le(xp);N(D),re(()=>{ae(xe,h(p).rootCount),ae(Ke,h(p).totalChoices),ae(He,h(p).dependencyCount),ae(mr,h(p).userScripts+h(p).conditionalScripts),ae(ve,h(p).templateFiles+h(p).captureTemplates),rr.disabled=h(l)!==null,Di.disabled=h(l)!==null,Iu.disabled=h(l)!==null}),wi(U,()=>h(n),we=>j(n,we)),Ae("click",W,b),Ae("click",ee,x),Ae("click",rr,C),wi(pi,()=>h(s),we=>j(s,we)),Ae("click",Di,S),Ae("click",Iu,function(...we){e.close?.apply(this,we)}),M(r,D),fe()}nt(["click","change"]);var HT=class extends LH.Modal{constructor(t,n,i){super(t);this.plugin=n;this.choices=i;this.handle=null}onOpen(){this.modalEl.addClass("quickAddModal","packageExportModal"),this.handle=Li(this.contentEl,wP,{app:this.app,plugin:this.plugin,allChoices:this.choices,close:()=>this.close()},{what:"the package exporter"})}onClose(){this.handle?.destroy(),this.handle=null}};var uz=require("obsidian");var ab=require("obsidian");dt();ht();var LP=require("obsidian");Ss();vr();vr();bt();un();function nre(r){return r.type==="Multi"}function ire(r){return r.type==="Macro"}function CP(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),nre(r))if(Array.isArray(r.choices))for(let n of r.choices)CP(n,e,t);else sr(r.choices)&&e.onUnreadable?.();ire(r)&&zT(Er(r.macro),e,t)}}}function zT(r,e,t){if(!Array.isArray(r)){sr(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))&&(zT(i.thenCommands,e,t),zT(i.elseCommands,e,t));let s=n,a=n.type==="NestedChoice"||s.choice&&typeof s.choice=="object"?s.choice:void 0;a&&CP(a,e,t)}}function xP(r,e){let t=new Set;if(Array.isArray(r.choices))for(let i of r.choices)CP(i,e,t);else e.onUnreadable?.();let n=r.macros;if(Array.isArray(n))for(let i of n)zT(Er(i),e,t);else sr(n)&&e.onUnreadable?.()}function Gm(r){let e=!1;return xP(r,{onUnreadable:()=>{e=!0}}),e}function Ym(r,e){xP(r.settings,{onChoice:e})}function WT(r,e){xP(r,{onCommand:e})}function ore(r){return r.type==="AIAssistant"}function jT(r,e,t){let n=0;return WT({choices:r},i=>{if(!ore(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}Ie();bt();Jr();la();TP();Ss();vr();bt();un();Ml();function GT(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&&iu(a.macro)&&(a.macro.id=Kt()),kP(Er(a.macro),e,t,s,n)}if(r.type==="Multi"){let a=r;Array.isArray(a.choices)&&(a.choices=a.choices.filter(l=>Ue(l)&&t.has(l.id)).map(l=>GT(l,e,t,n)))}return r}function kP(r,e,t,n,i){for(let o of Ht(r))if(qr(o))switch(fU(o,i),n&&(o.id=Kt()),o.type){case"Choice":{let s=o,a=e.get(s.choiceId);a&&(s.choiceId=a);break}case"Conditional":{let s=o;kP(s.thenCommands,e,t,n,i),kP(s.elseCommands,e,t,n,i);break}case"NestedChoice":{let s=o;s.choice&&t.has(s.choice.id)&&(s.choice=GT(s.ch
`?(n>e&&(e=n),n=0,t++):n++;n>e&&(e=n);leti=r.length/t;returne>1e3||i>250}functionQT(r,e){lett=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{letn=au(t.content),i=n.length>qH,o=i?n.slice(0,qH):n;return{found:!0,text:o,truncated:i,sizeBytes:xre(n),looksMinified:Ere(o)}}catch(n){return{found:!0,text:"",truncated:!1,sizeBytes:0,looksMinified:!1,error:ninstanceofError?n.message:String(n)}}}functionWH(r){returnr.summary.hasCritical}functionjH(r,e){returnr.criticalScriptPaths.every(t=>e.has(t))}varGH=require("obsidian");un();vr();bt();functionib(r){lete;try{e=JSON.parse(r)}catch(o){thrownewError(`Package content is not valid JSON: ${o?.message??o}`)}if(!PH(e))thrownewError("Content is not a valid QuickAdd package.");if(e.schemaVersion>1)thrownewError(`Package schema version ${e.schemaVersion} is newer than this plugin supports (${1}).`);lett=Tre(e.assets);if(t!==null)thrownewError(`Package contains duplicate asset path "${t}". Each asset must have a unique path.`);letn=kre(e.choices);if(n!==null)thrownewError(`Package contains conflicting definitions for choice "${n}". Each choice id must describe the same choice everywhere it appears.`);leti=Sre(e.choices);if(i!==null)thrownewError(`Package choice "${i}" names a parent that does not list it as a child. Each parented choice must appear inside its parent.`);returne}functionTre(r){lete=newSet;for(lettofr){letn=(0,GH.normalizePath)(t.originalPath??"");if(e.has(n))returnt.originalPath;e.add(n)}returnnull}functionkre(r){lete=newMap,t=null,n=i=>{if(t!==null||!i||typeofi!="object")return;leto=i.id;if(typeofo=="string"){lets=NP(i),a=e.get(o);if(a===void0)e.set(o,s);elseif(a!==s){t=o;return}}if(i.type==="Multi"){lets=i;if(Array.isArray(s.choices))for(letaofs.choices)n(a)}i.type==="Macro"&&RP(Ht(Er(i.macro)),n)};for(letiofr){if(t!==null)break;n(i?.choice)}returnt}functionRP(r,e){if(Array.isArray(r)){for(lettofr)if(t){if(t.type==="NestedChoice")e(t.choice);elseif(t.type==="Conditional"){letn=t;RP(n.thenCommands,e),RP(n.elseCommands,e)}}}}functionNP(r){if(r===null||typeofr!="object"){letn=JSON.stringify(r);returnn===void0?"\0undefined":n}if(Array.isArray(r))return`[${r.map(NP).join(",")}]`;lete=r;return`{${Object.keys(e).sort().map(n=>`${JSON.stringify(n)}:${NP(e[n])}`).join(",")}}`}functionSre(r){lete=newMap(r.map(t=>[t.choice.id,t]));for(lettofr){letn=t.parentChoiceId;if(n===null)continue;leti=e.get(n);if(!i)continue;leto=i.choice;if(!et(o).some(a=>a?.id===t.choice.id))returnt.choice.id}returnnull}asyncfunctionYH(r,e){if(Dr(e))thrownewError(`Refusing to read a package outside the vault: "${e}".`);lett=(0,LP.normalizePath)(e.trim());if(!t)thrownewError("Package path cannot be empty.");if(!awaitr.vault.adapter.exists(t))thrownewError(`Package file not found: ${t}`);leti=awaitr.vault.adapter.read(t);return{pkg:ib(i),path:t}}asyncfunctionKH(r,e,t){letn=newMap(nn(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(letsoft.assets){leta=Dr(s.originalPath)?!1:awaitr.vault.adapter.exists(s.originalPath);o.push({originalPath:s.originalPath,exists:a,kind:s.kind})}return{choiceConflicts:i,assetConflicts:o}}asyncfunctionXT(r,e,t){letn=newSet([...t.assets.map(a=>a.originalPath),...HH(t)]),i=newSet;awaitPromise.all(Array.from(n,asynca=>{a&&(Dr(a)||awaitXH(r,a)&&i.add(a))}));leto=zH(e,t,i),{summary:s}=o;returnI.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_re(r){lett=(r??"").trim();if(!t)thrownewError("Package asset has an empty destination path.");letn=
/* 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
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 sb(r,e){pe(e,!0),We(r,Dre);let t=F(()=>Qm(e.flag)),n=F(()=>FP(e.flag)),i=F(()=>PP(e.flag));var o=Ire();let s;var a=le(o,!0);Jt(o,(l,c)=>ob?.(l,c),()=>h(i)),re(()=>{s=it(o,1,"qa-import-tag svelte-5jkd35",null,s,{critical:h(t)==="critical",warning:h(t)==="warning",info:h(t)==="info"}),ae(a,h(n))}),M(r,o),fe()}var Fre=L('<span class="qa-import-banner-detail svelte-tb9yz"> </span>'),Pre=L('<li><span class="qa-import-banner-tag svelte-tb9yz"><!></span><span class="qa-import-banner-title svelte-tb9yz"> </span> <!></li>'),Mre=L('<p class="qa-import-banner-note svelte-tb9yz">Takes effect after you reload the plugin or restart Obsidian.</p>'),$re=L('<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>'),Ore={hash:"svelte-tb9yz",code:`.qa-import-banner.svelte-tb9yz{background:var(--background-secondary);border:1pxsolidvar(--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-tb9yzh3: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-tb9yzli:where(.svelte-tb9yz){display:block;padding:0.4rem0.5rem;border-radius:var(--radius-s,4px);}.qa-import-banner-tag.svelte-tb9yz{display:inline-block;vertical-align:middle;margin:00.4rem0.15rem0;}
/* 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-tb9yzli.sev-critical:where(.svelte-tb9yz){background:var(--qa-sev-critical-wash);}.qa-import-banner-rows.svelte-tb9yzli.sev-warning:where(.svelte-tb9yz){background:var(--qa-sev-warning-wash);}.qa-import-banner-rows.svelte-tb9yzli.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 VP(r,e){pe(e,!0),We(r,Ore);let t=F(()=>e.preview.summary.runsOnStartup||e.preview.summary.registersCommandCount>0);var n=$re();let i;var o=B(n),s=B(o),a=B(s);Et(a,{iconId:"alert-triangle",size:17}),N(s),Gr(2),N(o);var l=_(o,2);Ot(l,21,()=>e.preview.capabilityRows,d=>d.flag+d.detail,(d,p)=>{var f=Pre();let m;var g=B(f),v=B(g);sb(v,{get flag(){return h(p).flag}}),N(g);var y=_(g),b=le(y,!0),x=_(y,2);{var w=T=>{var C=Fre(),S=le(C,!0);re(()=>ae(S,h(p).detail)),M(T,C)};Y(x,T=>{h(p).detail&&T(w)})}N(f),re(()=>{m=it(f,1,"svelte-tb9yz",null,m,{"sev-critical":h(p).severity==="critical","sev-warning":h(p).severity==="warning","sev-info":h(p).severity==="info"}),ae(b,h(p).title)}),M(d,f)}),N(l);var c=_(l,2);{var u=d=>{var p=Mre();M(d,p)};Y(c,d=>{h(t)&&d(u)})}N(n),re(()=>i=it(n,1,"qa-import-banner svelte-tb9yz",null,i,{critical:e.preview.summary.hasCritical})),M(r,n),fe()}var Rre=L('<span class="qa-import-file-exec svelte-lmqem5">Executable</span>'),Nre=L('<span class="qa-import-file-reviewed svelte-lmqem5"><!> Reviewed</span>'),Lre=L('<span class="qa-import-file-orphan svelte-lmqem5">Unused</span>'),Vre=L("<option>Overwrite</option>"),Bre=L(`<pclass="qa-import-file-skip-warn svelte-lmqem5"role="note">Won't be written. Any choice that uses this script will run whatever
/* --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.05rem0.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:11auto;min-width:0;color:var(--text-normal);}.qa-import-file-field.svelte-lmqem5input:where(.svelte-lmqem5){flex:01300px;min-width:0;}.qa-import-file-field.svelte-lmqem5select:where(.svelte-lmqem5){flex:00auto;}
/* The native Obsidian input/dropdown focus box-shadow handles focus; no
custom outline (which would read as non-native). */.qa-import-file-field.svelte-lmqem5input: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.1rem0.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:2pxsolidvar(--interactive-accent);outline-offset:1px;}.qa-import-file-chevron.svelte-lmqem5{display:inline-flex;transition:transform180msease;}.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-rows200msease;}.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.4rem0.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.5rem0.6rem;border-radius:var(--radius-s,4px);background:var(--background-modifier-form-field);border:1pxsolidvar(--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:2pxsolidvar(--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-lmqem5input:where(.svelte-lmqem5),
}`};function BP(r,e){pe(e,!0),We(r,Gre);let t=ne(e,"reviewed",3,!1),n=Ce(!1),i=F(()=>h(n)?QT(e.pkg,e.file.originalPath):null),o=F(()=>`qa-file-preview-${e.file.originalPath.replace(/[^a-zA-Z0-9_-]/g,"-")}`);function s(ve){return ve<1024?`${ve}B`:ve<1024*1024?`${(ve/1024).toFixed(1)}KB`:`${(ve/(1024*1024)).toFixed(1)}MB`}function a(){j(n,!h(n)),h(n)&&e.file.requiresReview&&e.onReviewed(e.file.originalPath)}function l(ve){e.onPathInput(ve.currentTarget.value)}function c(ve){e.onModeChange(ve.currentTarget.value)}var u=jre();let d;var p=B(u),f=B(p);{let ve=F(()=>e.destinationExists?"file-warning":"file-plus");Et(f,{get iconId(){return h(ve)},size:16})}var m=_(f,2);let g;var v=le(m,!0),y=_(m,4),b=le(y,!0);N(p);var x=_(p,2),w=B(x);{var T=ve=>{var Fe=Rre();Jt(Fe,(Je,mt)=>ob?.(Je,mt),()=>"Runs as code when its choice runs. It can read, change, or delete files in your vault and access the network."),M(ve,Fe)};Y(w,ve=>{e.file.executable&&ve(T)})}var C=_(w,2);{var S=ve=>{var Fe=Nre(),Je=B(Fe);Et(Je,{iconId:"check",size:12}),Gr(),N(Fe),M(ve,Fe)};Y(C,ve=>{t()&&e.mode!=="skip"&&e.file.requiresReview&&ve(S)})}var A=_(C,2);{var D=ve=>{var Fe=Lre();Jt(Fe,(Je,mt)=>ob?.(Je,mt),()=>"Bundled in this package but not referenced by any choice."),M(ve,Fe)};Y(A,ve=>{e.file.orphan&&ve(D)})}var P=_(A,2),U=le(P,!0);N(x);var K=_(x,2),W=B(K),ee=_(B(W),2);Rt(ee),N(W);var me=_(W,2),O=_(B(me),2),H=B(O);H.value=H.__value="write";var ce=_(H);{var te=ve=>{var Fe=Vre();Fe.value=Fe.__value="overwrite",M(ve,Fe)};Y(ce,ve=>{e.destinationExists&&ve(te)})}var z=_(ce);z.value=z.__value="skip",N(O);var G;dc(O),N(me),N(K);var ie=_(K,2);{var xe=ve=>{var Fe=Bre();M(ve,Fe)};Y(ie,ve=>{e.file.requiresReview&&e.mode==="skip"&&ve(xe)})}var ue=_(ie,2),be=B(ue);let Ke;var Oe=B(be);Et(Oe,{iconId:"chevron-right",size:14}),N(be);var Ee=_(be,2),He=le(Ee,!0);N(ue);var Le=_(ue,2);let At;var mr=B(Le),zr=B(mr);{var ge=ve=>{var Fe=Wre(),Je=B(Fe);{var mt=Qe=>{var zt=qre(),rr=le(zt);re(()=>ae(rr,`Previewunavailable:${h(i).error??""}`)),M(Qe,zt)},Ft=Qe=>{var zt=zre(),rr=Te(zt);{var Qn=It=>{var pi=Ure();M(It,pi)};Y(rr,It=>{h(i).looksMinified&&It(Qn)})}var di=_(rr,2),Z=le(di,!0),De=_(di,2);{var Pt=It=>{var pi=Hre(),Di=le(pi);re(()=>ae(Di,`Previewtruncated.Thefull${e.file.executable?"script will run":"file will be imported"}.`)),M(It,pi)};Y(De,It=>{h(i).truncated&&It(Pt)})}re(()=>{ke(di,"aria-label",`Contentsof${e.file.originalPath??""}`),ae(Z,h(i).text)}),M(Qe,zt)};Y(Je,Qe=>{h(i).error?Qe(mt):Qe(Ft,-1)})}N(Fe),M(ve,Fe)};Y(zr,ve=>{h(i)&&ve(ge)})}N(mr),N(Le),N(u),re(ve=>{d=it(u,1,"qa-import-file svelte-lmqem5",null,d,{overwrite:e.destinationExists}),g=it(m,1,"qa-import-file-status svelte-lmqem5",null,g,{overwrite:e.destinationExists}),ae(v,e.destinationExists?"Will overwrite":"New file"),ae(b,e.destinationPath),ae(U,ve),bi(ee,e.destinationPath),ee.disabled=e.mode==="skip",G!==(G=e.mode)&&(O.value=(O.__value=G)??"",uc(O,G)),ke(ue,"aria-expanded",h(n)),ke(ue,"aria-controls",h(o)),Ke=it(be,1,"qa-import-file-chevron svelte-lmqem5",null,Ke,{open:h(n)}),ae(He,h(n)?"Hide contents":"View contents"),At=it(Le,1,"qa-import-file-preview-wrap svelte-lmqem5",null,At,{open:h(n)}),ke(Le,"id",h(o))},[()=>s(e.file.sizeBytes)]),Ae("input",ee,l),Ae("change",O,c),Ae("click",ue,a),M(r,u),fe()}nt(["input","change","click"]);var Yre=L('<p id="qa-import-ack-hint" class="ackGate-hint svelte-1n28r6s"> </p>'),Kre=L('<section><label class="ackGate-label svelte-1n28r6s"><input id="qa-import-ack-checkbox" type="checkbox" class="svelte-1n28r6s"/> <span> </span></label> <!></section>'),Qre={hash:"svelte-1n28r6s",code:".ackGate.svelte-1n28r6s {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-1n28r6s {border-color:var(--qa-sev-critical-border);}.ackGate-label.svelte-1n28r6s {display:flex;align-items:flex-start;gap:0.5rem;font-weight:600;cursor:pointer;}.ackGate-label.svelte-1n28r6s:has(input:where(.svelte-1n28r6s):disabled) {cursor:not-allowed;opacity
script${h(i)===1?"":"s"} above to enable this.`)),M(g,v)};Y(f,g=>{h(i)>0&&!e.fullyReviewed&&g(m)})}N(a),re(()=>{l=it(a,1,"ackGate svelte-1n28r6s",null,l,{critical:h(n)}),ed(u,t()),u.disabled=!e.fullyReviewed,ke(u,"aria-describedby",h(i)>0&&!e.fullyReviewed?"qa-import-ack-hint":void0),ae(p,h(s))}),Ae("change",u,g=>t(g.currentTarget.checked)),M(r,a),fe()}nt(["change"]);varUP=require("obsidian");la();functionZH(r,e){returnr==="skip"?r:e&&r==="write"?"overwrite":!e&&r==="overwrite"?"write":r}functionHP(r,e){return!e&&r==="overwrite"?"import":r}functionJH(r,e,t){letn=e(r),i=r.exists||t(n);return{mode:i?"overwrite":"write",destinationPath:n,destinationExists:i}}functionez(r,e){lett=e(r);return{mode:t?"overwrite":"write",destinationPath:r,destinationExists:t}}functiontz(r,e,t){letn=newMap;for(letiofr)n.set(i.originalPath,JH(i,e,t));returnn}functionrz(r,e,t,n){returnr.get(e.originalPath)??JH(e,t,n)}functionnz(r){lete=newMap;for(lettofr)e.set(t.choiceId,t.exists?"overwrite":"import");returne}functioniz(r,e,t){letn=newMap(r);returnn.set(e,t),n}functionoz(r,e,t,n){leti=r.get(e)??ez(e,n),o=newMap(r);returno.set(e,{...i,mode:t}),o}functionsz(r,e,t,n){leti=r.get(e)??ez(e,n),o=t.trim(),s=o||e,a=o||t,l=n(s),c=newMap(r);returnc.set(e,{...i,mode:ZH(i.mode,l),destinationPath:a,destinationExists:l}),{decisions:c,effectivePath:s}}functionaz(r,e,t){letn=r.get(e);if(!n||n.destinationExists===t)returnr;leti=newMap(r);returni.set(e,{...n,destinationExists:t,mode:ZH(n.mode,t)}),i}functionlz(r,e){returnr.map(t=>({choiceId:t.choiceId,mode:HP(e.get(t.choiceId)??"import",t.exists)}))}functioncz(r,e,t){returnr.map(n=>{leti=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}})}varJT=class{constructor(e){this.app=e;this.tokens=newMap}optimistic(e){lett=e.trim();return!t||Dr(t)?!1:!!this.app.vault.getAbstractFileByPath((0,UP.normalizePath)(t))}asyncresolve(e){lett=e.trim();if(!t||Dr(t))return!1;try{returnawaitthis.app.vault.adapter.exists((0,UP.normalizePath)(t))}catch{return!1}}schedule(e,t,n){leti=(this.tokens.get(e)??0)+1;this.tokens.set(e,i),this.resolve(t).then(o=>{this.tokens.get(e)===i&&n(o)})}};varXre=L('<span class="macroCommandType svelte-1qj0pve"> </span>'),Zre=L("<code> </code>"),Jre=L('<span class="macroCommandSummary svelte-1qj0pve"> </span>'),ene=L('<li class="svelte-1qj0pve"><span class="macroCommandName svelte-1qj0pve"> </span> <!> <!></li>'),tne=L('<ul class="macroCommands svelte-1qj0pve"></ul>'),rne={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);}"};functionzP(r,e){We(r,rne);lett={UserScript:"User script",Conditional:"Conditional",NestedChoice:"Nested choice",Obsidian:"Obsidian command",Choice:"Choice",Wait:"Wait",EditorCommand:"Editor command",AIAssistant:"AI assistant",OpenFile:"Open file"};functionn(o){returnt[o]??o}vari=tne();Ot(i,21,()=>e.commands,xg,(o,s)=>{vara=ene(),l=B(a),c=le(l,!0),u=_(l,2);{vard=v=>{sb(v,{getflag(){returnh(s).flag}})},p=v=>{vary=Xre(),b=le(y,!0);re(x=>ae(b,x),[()=>n(h(s).type)]),M(v,y)};Y(u,v=>{h(s).flag?v(d):v(p,-1)})}varf=_(u,2);{varm=v=>{vary=Zre(),b=le(y,!0);re(()=>ae(b,h(s).scriptPath)),M(v,y)},g=v=>{vary=Jre(),b=le(y,!0);re(()=>ae(b,h(s).summary)),M(v,y)};Y(f,v=>{h(s).scriptPath?v(m):h(s).summary&&v(g,1)})}N(a),re(()=>{Gp(a,`padding-left:${h(s).depth*1}rem`),ae(c,h(s).name)}),M(o,a)}),N(i),M(r,i)}varnne=L('<p class="svelte-s0203k">No choices found in this package.</p>'),ine=L('<div class="choiceExists svelte-s0203k">already in vault</div>'),o
/* 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-s0203k{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-s0203k:hover{color:var(--interactive-accent-hover,var(--text-accent));text-decoration:underline;}.macroToggle.svelte-s0203k:focus-visible{outline:2pxsolidvar(--interactive-accent);outline-offset:2px;}.macroRow.svelte-s0203ktd:where(.svelte-s0203k){background:var(--background-primary-alt,var(--background-secondary));}.choicesSection.svelte-s0203ktable:where(.svelte-s0203k){width:100%;border-collapse:collapse;table-layout:fixed;}.choicesSection.svelte-s0203kcol.colName:where(.svelte-s0203k){width:52%;}.choicesSection.svelte-s0203kcol.colLocation:where(.svelte-s0203k){width:26%;}.choicesSection.svelte-s0203kcol.colAction:where(.svelte-s0203k){width:22%;}.choicesSection.svelte-s0203kth:where(.svelte-s0203k),
/* 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-111ahcqli.script:where(.svelte-111ahcq){padding:0.25rem0.4rem;border-radius:var(--radius-s,4px);background:var(--qa-sev-critical-wash);}.warnLoc.svelte-111ahcq{color:var(--text-muted);font-size:var(--font-ui-smaller,0.8rem);}`};function jP(r,e){pe(e,!0),We(r,vne);var t=or(),n=Te(t);{var i=o=>{var s=gne(),a=B(s);{var l=d=>{var p=fne(),f=_(B(p),2);Ot(f,21,()=>e.preview.missingReferences,m=>m.path,(m,g)=>{var v=pne();let y;var b=B(v),x=le(b,!0),w=_(b),T=_(w),C=le(T,!0);N(v),re(()=>{y=it(v,1,"svelte-111ahcq",null,y,{script:h(g).asScript}),ae(x,h(g).path),ae(w,`:
${h(g).asScript?"not bundled, so it runs from whatever file exists at that path after import":"not bundled and not in your vault"}`),ae(C,h(g).breadcrumb)}),M(m,v)}),N(f),N(p),M(d,p)};Y(a,d=>{e.preview.missingReferences.length>0&&d(l)})}var c=_(a,2);{var u=d=>{var p=hne(),f=_(B(p),2);Ot(f,20,()=>e.preview.orphanAssets,m=>m,(m,g)=>{var v=mne(),y=B(v),b=le(y,!0);Gr(),N(v),re(()=>ae(b,g)),M(m,v)}),N(f),N(p),M(d,p)};Y(c,d=>{e.preview.orphanAssets.length>0&&d(u)})}N(s),M(o,s)};Y(n,o=>{e.preview&&(e.preview.missingReferences.length>0||e.preview.orphanAssets.length>0)&&o(i)})}M(r,t),fe()}var yne=L('<div class="errorMessage svelte-1nd6fqb"> </div>'),bne=L('<div class="info svelte-1nd6fqb">Analyzing package\u2026</div>'),wne=L('<p class="svelte-1nd6fqb">No files bundled with this package.</p>'),Cne=L('<h4> </h4> <div class="fileRows svelte-1nd6fqb"></div>',1),xne=L('<section class="filesSection svelte-1nd6fqb"><h3 class="svelte-1nd6fqb">Files</h3> <!></section> <!>',1),Ene=L('<section class="summary svelte-1nd6fqb"><!> <span class="svelte-1nd6fqb"> </span></section>'),Tne=L('<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> <!> <!> <!> <!>',1),kne=L('<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>'),Sne={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:2px4px;}.importPackageModal.svelte-1nd6fqb:where(.svelte-1nd6fqb){box-sizing:border-box;}.importPackageModal.svelte-1nd6fqb>section:where(.svelte-1nd6fqb){max-width:100%;}.pasteSection.svelte-1nd6fqblabel:where(.svelte-1nd6fqb){display:flex;flex-direction:column;gap:0.5rem;}.pasteSection.svelte-1nd6fqbtextarea: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.3rem0.6rem;padding:0.55rem0.75rem;border:1pxsolidvar(--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);}.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;}.summary.svelte-1nd6fqb{display:flex;align-items:center;gap:0.5rem;padding:0.55rem0.7rem;border-radius:var(--radius-m,8px);border:1pxsolidvar(--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;}.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),
`)}functionIne(r){for(leteofAne(r)){lett=_ne.exec(e);if(t)return{pluginId:t[1],frame:e.trim()}}returnnull}functionDne(r,e){return`${r.name}@${e}`}functionhz(r,e=Date.now){lett=r.manifest.id,n=newMap;r.registerDomEvent(window,"unhandledrejection",i=>{leto=i.reason,s=oinstanceofError?Ine(o):null;if(s?.pluginId!==t)return;if(ot(o)){i.preventDefault();return}leta=o,l=Dne(a,s.frame),c=e(),u=n.get(l);if(n.set(l,c),!(u!==void0&&c-u<fz)){if(n.size>=mz){for(let[d,p]ofn)c-p>=fz&&n.delete(d);if(n.size>=mz){letd=n.keys().next();!d.done&&d.value!==l&&n.delete(d.value)}}Ze(a,"A QuickAdd action failed")&&i.preventDefault()}})}vargz=require("obsidian");Ie();functionFne(r,e){try{lett=r.setting;return!t?.open||!t?.openTabById?(I.logMessage("QuickAdd: Obsidian internal settings API is unavailable."),!1):(t.open(),t.openTabById(e),!0)}catch(t){returnI.logMessage(`QuickAdd: Failed to open plugin settings automatically: ${t}`),!1}}functionZm(r,e,t){letn=Fne(r,e);return!n&&t?.notice!==!1&&newgz.Notice("QuickAdd: Unable to open settings automatically. Open Settings \u2192 QuickAdd manually."),n}Ob();bt();xt();varAS=class{constructor(e,t,n,i){this.app=e;this.plugin=t;this.choices=n;this.choiceExecutor=i}asyncrun(){lete=nn(this.choices).filter(t=>t.type==="Macro"&&t.runOnStartup);for(lettofe)try{awaitnew_a(this.app,this.plugin,t,this.choiceExecutor,newMap).run()}catch(n){Ze(n,`Startup macro '${t.name}' failed`)}}};var_6=require("obsidian");Ie();wc();ht();Og();Lg();functionIS(r,e){return!e.enabled||e.destination.type!=="specifiedFile"||$g(r,e.destination)?null:`Append link target file not found or is not a Markdown file: ${e.destination.path}`}asyncfunctionDS(r,e,t,n,i){t.enabled&&(t.destination?.type==="specifiedFile"?awaitPN(r,e,t,i):n&&!al(t.placement)?awaitLN(r,n,e):i?awaitTC(r,e,t,i):awaitTC(r,e,t))}asyncfunctionFS(r){try{awaitMN(r)}catch(e){I.logWarning(`Could not copy link to clipboard for '${r.path}': ${einstanceofError?e.message:String(e)}`)}}asyncfunctiongp({app:r,file:e,opening:t,originLeaf:n,forceFocus:i}){leto=Cn(t),s=i??o.focus??!0;returnWA(r,e,s)||awaitHg(r,e,{...o,...i===void0?{}:{focus:i},originLeaf:n}),s}varRh=require("obsidian");Jm();Xe();Zo();Ie();Dl();var$S=require("obsidian");ur();Dl();Sh();varYG=require("obsidian");lo();rn();functionPS(r,e,t){letn=e.lastIndexOf("/"),i=n>=0?e.slice(0,n):"",o=iv(n>=0?e.slice(n+1):e),s=t?.vault.getAbstractFileByPath(e),a=t&&sinstanceofYG.TFile?GI([s],d=>t.metadataCache.getFileCache(d))[0]:null,l=a?.primary??o,c=a?.secondary??i;r.addClass("mod-complex");letu=r.createDiv({cls:"suggestion-content"});u.createDiv({cls:"suggestion-title",text:l}),c&&u.createDiv({cls:"suggestion-note",text:c})}varMS=classextends$S.FuzzySuggestModal{constructor(t,n,i){super(t);this.settled=!1;this.rows=i.map(o=>({kind:"candidate",candidate:o})),this.action=Zc(n.existingNoteAction),this.promise=newPromise((o,s)=>{this.resolvePromise=o,this.rejectPromise=s}).then(o=>o.kind==="candidate"?Wb(o.candidate.item):Pa(o.title)),this.setPlaceholder(`Search notes or create ${n.name}`),this.open()}getItems(){returnthis.rows}getItemText(t){returnt.kind==="candidate"?t.candidate.display:t.title}getSuggestions(t){letn=t.trim(),i=xo(n),o=a=>a.kind==="candidate"&&a.candidate.exactKeys.includes(i),s=super.getSuggestions(n).sort((a,l)=>Number(o(l.item))-Number(o(a.item)));returnn&&!this.rows.some(o)&&s.unshift({item:{kind:"create",title:n},match:{score:Number.NEGATIVE_INFINITY,matches:[]}}),s}renderSuggestion({item:t},n){if(t.kind==="candidate"&&t.candidate.renderPath){leto=t.candidate;PS(n,t.candidate.renderPath),this.action!=="Open"&&n.querySelector(".suggestion-title")?.prepend(`${this.action}: `),o.renderAlias&&n.querySelector(".suggestion-content")?.createDiv({cls:"suggestion-note",text:`Alias: ${o.renderAlias}`});return}n.addClass("mod-complex");leti=n.createDiv({cls:"suggestion-content"});i.createDiv({cls:"suggestion-title",text:t.kind==="create"?`Create new note: ${t.title}`:t.candidate.unresolvedTitle??t.candidate.title}),t.kind==="create"?(0,$S.setIcon)(n.cre
`,1)[0];this.lastResolvedInsertAfterHeading=/^#+\s+\S/.test(f)?f.trim():null}let s=d$(o);if(p$(s))throw new ye("Insert-after target is empty after formatting.");let a=Eu(this.fileContent),l=this.isOrderedCreate()?l6(a,this.fileContent):a,{start:c,end:u}=f$(l,s);if(c===-1){if(this.choice.insertAfter?.createIfNotFound)return await this.createInsertAfterIfNotFound(t,o);throw new ye(`Insert-aftertargetnotfound:'${o}'.`)}let p;if(this.choice.insertAfter?.insertAtEnd){if(!this.file)throw new Error("Tried to get sections without file.");let f=Yl(a,c,this.considerSubsectionsForAnchor(a,c)),m=Math.max(f??a.length-1,u);p=sw(a,m,this.fileContent,n)}else{let f=this.choice.insertAfter?.blankLineAfterMatchMode??"auto";p=HS(a,u,this.fileContent,f)}return this.insertTextAfterPositionInBody(t,this.fileContent,p)}async insertBeforeHandler(t){let n=this.choice.insertBefore;if(!n)throw new ye("Insert-before settings are missing.");let i=await this.formatLocationString(await this.expandFormatTemplateEscapes(n.before)),o=d$(i);if(p$(o))throw new ye("Insert-before target is empty after formatting.");let s=Eu(this.fileContent),{start:a}=f$(s,o);if(a===-1){if(n.createIfNotFound)return await this.createInsertBeforeIfNotFound(t,i);throw new ye(`Insert-beforetargetnotfound:'${i}'.`)}return this.insertTextBeforePositionInBody(t,this.fileContent,a)}async insertAfterInlineHandler(t,n){if(s6(n))throw new ye("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 ye(`Inlineinsert-aftertargetnotfound:'${n}'.`)}let o=i+n.length,s=this.choice.insertAfter?.replaceExisting?a6(this.fileContent,o):o;return bl(t,this.fileContent.slice(0,o),this.fileContent.slice(s))}async createInsertAfterIfNotFound(t,n){let i=this.choice.insertAfter;if(i?.createIfNotFoundLocation===vs)return this.createInsertAfterOrdered(t,n);let o=bl(t,`${n}
`);return this.createMissingTarget({payload:o,location:i?.createIfNotFoundLocation,rawTarget:i.after,insertAtCursor:s=>{let a=s;if(i?.insertAtEnd){if(!this.file)throw new Error("Tried to get sections without file.");let l=Eu(this.fileContent),c=Yl(l,s,this.considerSubsectionsForAnchor(l,s));a=sw(l,c??l.length-1,this.fileContent,o.content)}return this.insertTextAfterPositionInBody(o,this.fileContent,a)}})}isOrderedCreate(){return!!this.choice.insertAfter?.createIfNotFound&&this.choice.insertAfter?.createIfNotFoundLocation===vs}considerSubsectionsForAnchor(t,n){return US(!!this.choice.insertAfter?.considerSubsections,t,n)}createInsertAfterOrdered(t,n){return p6({capture:t,targetString:n,fileContent:this.fileContent,insertAfter:this.choice.insertAfter,task:!!this.choice.task})}async createInsertBeforeIfNotFound(t,n){let i=this.choice.insertBefore;if(!i)throw new ye("Insert-before settings are missing.");let o=bl(t,"",`${t.content.endsWith(`
`);case id:{let s=xn(this.app);if(!s)throw new ye(`Unabletoinsertline'${i}'atcursorposition:noactivemarkdowneditor.`);try{return o(s.editor.getCursor().line)}catch{throw new ye(`Unabletoinsertline'${i}'atcursorposition.`)}}default:throw new ye(`UnknowncreateIfNotFoundLocation:${n}`)}}insertAtNoteBodyStartTracking(t){let n=op(this.fileContent,t.content);return Oc(t,n.content,n.insertedStartOffset===null||t.cursor.kind==="none"?null:n.insertedStartOffset+t.cursor.value)}insertTextAfterPositionInBody(t,n,i){let o=zS(t.content,n,i,!!this.choice.task,t.cursor.kind==="offset"?t.cursor.value:void 0);return Oc(t,o.content,o.insertedEndOffset)}insertTextBeforePositionInBody(t,n,i){let o=c6(t.content,n,i,t.cursor.kind==="offset"?t.cursor.value:void 0);return Oc(t,o.content,o.insertedEndOffset)}};ew();Ie();wD();_f();Sv();If();VM();wc();ht();xt();sp();ap();bf();Cu();var h6=require("obsidian");i$();Xe();ht();Ol();Jm();HM();da();la();Cu();sp();ap();Yn();RM();NM();var f6=require("obsidian");Xe();Yn();fE();pE();da();function m6(r,e){let t=r.trim().replace(/^\/+/,"");if(t==="")return{kind:"vault"};let n=Zf(t);if(n){if(!n.field)throw new ye("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=Xf(t);if(i){if(i.multiSelect)throw new ye("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=Wn(t,"Capture target file path");if(wn.test(o))throw new ye(`Captureto'.base'filesisnotsupported(${o}).UseaTemplatechoiceinstead.`);let s=o.endsWith("/"),a=o.replace(/\/+$/,"");if(s)return{kind:"folder",folder:a};if(Nt.test(o)||cr.test(o))return{kind:"file",path:o};let l=e.normalizeMarkdownFilePath("",a),u=e.getAbstractFileByPath(l)instanceof f6.TFile;return e.isFolder(a)&&!u?{kind:"folder",folder:a}:{kind:"file",path:o}}var jS=class extends $h{async getFormattedPathToCaptureTo(e){if(e){let s=this.app.workspace.getActiveFile();return $n(s,"Cannot capture to active file - no active file."),s.path}let t=this.getPreselectedCaptureTargetPath();if(t!==void 0){let s=fS({isFolder:a=>tf(this.app,a),markdownFileExists:a=>this.app.vault.getAbstractFileByPath(pS(a))instanceof h6.TFile},this.choice.captureTo??"",!1);if(s){let a=this.confinePreselectedToScope(s,t);if(a!==null)return this.normalizeCaptureFilePath(a)}}let n=this.choice.captureTo,i=await this.formatter.formatFileName(n,"captureTarget"),o=this.resolveCaptureTarget(i);switch(o.kind){case"vault":return this.selectFileInFolder("",!0);case"filter":return this.selectFileWithFilter(o.filter);case"property":return this.selectFileWithProperty(o.field,o.value,o.filter);case"folder":return this.selectFileInFolder(o.folder,!1);case"file":return this.normalizeCaptureFilePath(o.path)}}getPreselectedCaptureTargetPath(){return Nj(this.choiceExecutor?.variables,this.choice.id)}confinePreselectedToScope(e,t){let n=this.stripLeadingSlash(t);if(e.kind==="folder")return e.folderPathSlash&&!n.startsWith(e.folderPathSlash)?`${e.folderPathSlash}${n}`:n;if(this.resolveScopeFiles(e).some(a=>a.path===n))return n;if(!(this.choice.createFileIfItDoesntExist?.enabled??!1))return null;let s=new Set(this.app.vault.getMarkdownFiles().map(a=>a.basename.toLowerCase()));return this.captureTargetAlreadyExists(n,s)?null:n}resolveScopeFiles(e){return dS(this.app,e)}resolveCaptureTarget(e){return m6(e,{getAbstractFileByPath:t=>this.app.vault.getAbstractFileByPath(t),isFolder:t=>tf(this.app,t),normalizeMarkdownFilePath:(t,n)=>this.normalizeMarkdownFilePath(t,n)})}captureTargetExists(e,t){let n=t.startsWith(e)?t:`${e}${t}`,i;try{i=Wn(n,"Capture target file path")}catch{return!1}let o=[i];return/\.(md|canvas)$/i.test(i)||o.push(`${i}.md`,`${i}.canvas`),o.some(s=>!!this.app.vault.getAbstractFileByPath(s))}async selectFileInFolder(e,t){let n=e.endsWith("/")||t?e:`${e}/`,i=Bo(this.app,n),o=this.choice.createFileIfItDoesntExist?.enabled??!1;$n(o||i.length>0,`Folder${n}isempty.`);let s=await this.chooseCaptureTar
`),t}asynconFileExists(t,n,i=!1){leto=this.getFileByPath(t);if(!o)thrownewError("File not found");this.formatter.setTitle(o.basename),this.formatter.setDestinationFile(o);lets=awaitthis.collectIfFrontmatter(()=>this.formatter.formatContentOnly(n));this.mergeCapturePropertyVars(this.formatter.getAndClearTemplatePropertyVars());leta=awaitthis.app.vault.read(o);if(/{{CURSOR}}/i.test(s)&&Tf(s).cursor.kind==="none")return{file:o,newFileContent:a,captureContent:"",priorContent:a,cursor:{kind:"none"},markerOnly:!0};if(i)return{file:o,newFileContent:a,captureContent:s,priorContent:a,cursor:{kind:"none"}};letl=awaitthis.collectIfFrontmatter(()=>this.formatter.formatContentWithFile(s,this.choice,a,o));if(this.mergeCapturePropertyVars(this.formatter.getAndClearTemplatePropertyVars()),l.markerOnly)return{file:o,newFileContent:a,captureContent:l.captureContent,priorContent:a,cursor:l.cursor,markerOnly:!0};letc=awaitthis.app.vault.read(o),u=l.content,d=!0;if(c!==a){letp=JG(c,a,l.content);$n(p.isSuccess(),()=>`The file ${t} has been modified since the last read.
This is in order to prevent data loss.`),u=p.joinedResults(),d=!1}return{file:o,newFileContent:u,captureContent:l.captureContent,priorContent:c,cursor:l.cursor,cursorPlacementSafe:d}}asynconCreateFileIfItDoesntExist(t,n,i){Vb(t);leto=Ia(t);this.formatter.setTitle(o),this.formatter.setDestinationSourcePath(t);lets=awaitthis.collectIfFrontmatter(()=>this.formatter.formatContentOnly(n));if(this.mergeCapturePropertyVars(this.formatter.getAndClearTemplatePropertyVars()),/{{CURSOR}}/i.test(s)&&Tf(s).cursor.kind==="none")returnnull;leta="";if(this.choice.createFileIfItDoesntExist.createWithTemplate){letd=newvh(this.app,this.plugin,this.choice.createFileIfItDoesntExist.template,this.choiceExecutor);i?.enabled&&!i.requireActiveFile&&d.setLinkToCurrentFileBehavior("optional"),d.setTargetFolderPath(Ai(t)),d.setPromptRunContext({draftScopeId:`${this.choice.id}#${this.choice.createFileIfItDoesntExist.template}`,choiceName:this.choice.name,destination:t,destinationKind:"file"}),a=awaitd.run();letp=d.getAndClearTemplatePropertyVars();I.logMessage(`CaptureChoiceEngine: Collected ${p.size} template property variables`),p.size>0&&I.logMessage(`Variables: ${Array.from(p.keys()).join(", ")}`),this.templatePropertyVars=p}letl=awaitthis.createFileWithInput(t,a,{suppressTemplaterOnCreate:this.choice.createFileIfItDoesntExist.createWithTemplate});this.choice.createFileIfItDoesntExist.createWithTemplate&&this.templatePropertyVars&&hh(l,this.templatePropertyVars)&&awaitgh(this.app,l,this.templatePropertyVars),this.choice.createFileIfItDoesntExist.createWithTemplate&&a?awaityc(this.app,l):Xp(this.app)&&awaitbC(this.app,l);letc=awaitthis.app.vault.read(l),u=awaitthis.collectIfFrontmatter(()=>this.formatter.formatContentWithFile(s,this.choice,c,l));returnthis.mergeCapturePropertyVars(this.formatter.getAndClearTemplatePropertyVars()),{file:l,newFileContent:u.content,captureContent:u.captureContent,priorContent:c,cursor:u.cursor,cursorPlacementSafe:!0,markerOnly:u.markerOnly}}collectIfFrontmatter(t){returnthis.suppressFrontmatterCollection?t():this.formatter.withTemplatePropertyCollection(t)}mergeCapturePropertyVars(t){if(!(!t||t.size===0)){for(let[n,i]oft)this.capturePropertyVars.set(n,i);I.logMessage(`CaptureChoiceEngine: Accumulated ${this.capturePropertyVars.size} structured capture variables`)}}asyncapplyCapturePropertyVars(t){returnthis.capturePropertyVars.size===0?!1:hh(t,this.capturePropertyVars)?(I.logMessage(`CaptureChoiceEngine: Post-processing front matter with ${this.capturePropertyVars.size} capture variables`),awaitgh(this.app,t,this.capturePropertyVars),this.capturePropertyVars.clear(),!0):(this.capturePropertyVars.clear(),!1)}};Ob();varEo=require("obsidian");rn();xt();ur();dt();bt();Lg();varv$=require("obsidian");Xe();Zo();ht();xt();functionT6(r){lete=r.split("/").pop()??r,t=e.lastIndexOf(".");returnt>0?e.slice(0,t):e}functiony$(r){lete=newou(T6(r));returne.id=`folder-template:${r}`,e.templatePath=r,e.openFile=!0,e.fileNameFormat={enabled:!0,format:Or},e.discoverExistingNotesBeforeCreate=!0,e}functionb$(r){returnri(r.settings.templateFolderPaths).length>0}functionDle(r,e){lett=r.lastIndexOf("/"),n=t===-1?"":r.slice(0,t),i=e.createDiv({cls:"suggestion-content"});i.createDiv({cls:"suggestion-title",text:T6(r)}),n&&(e.classList.add("mod-complex"),i.createDiv({cls:"suggestion-note",text:n}))}asyncfunctionFle(r,e){letn=[...e].sort((i,o)=>i.path.localeCompare(o.path)).map(i=>i.path);try{returnawaitXt.Suggest(r,n,n,"New note from template",(i,o)=>Dle(i,o))}catch(i){if(ot(i))returnnull;throwi}}asyncfunctionYS(r,e,t){try{letn=t.templatePath?.trim()||void0;if(!n){if(!b$(e)){newv$.Notice("QuickAdd: Set a template folder in Settings \u2192 QuickAdd \u2192 Templates & properties to use \u201CNew note from template\u201D.",8e3),Zm(r,e.manifest.id,{notice:!1});return}leti=e.getTemplateFiles();if(i.length===0){newv$.Notice("QuickAdd: No template files found in your configured template folder(s).");return}leto=awaitFle(r,i);if(!o)return;n=o}awaitt.choiceExecutor.execute(y$(n))}catch(n){if(ot(n))re
QuickAddwillnowreverttobackup.`),r.settings=n,X.replaceState(Ve(r.settings))}}r.saveSettings()}var Y6=pce;dt();var Na=require("obsidian");Ie();async function fce(r,e,t){let n=await(0,Na.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 T$=/^https:\/\/github\.com\/user-attachments\/assets\/[A-Za-z0-9-]+$/,K6=/^\[!\[[^\]]*\]\(([^)\s"]+)\)\]\((https:\/\/github\.com\/user-attachments\/assets\/[A-Za-z0-9-]+)\)$/,mce=/^<!--\s*poster:\s*(https:\/\/[^\s"'>]+)\s*-->$/;function hce(r,e){let t=e?` poster="${e}"`:"";return`<video controls preload="metadata" playsinline style="width: 100%; border-radius: 8px;" src="${r}"${t}></video>`}function gce(r){let e=r.split(`
`),t=new Set;for(let s of e){let a=s.trim();T$.test(a)&&t.add(a)}let n=new Map;for(let s of e){let a=s.trim().match(K6);a&&t.has(a[2])&&n.set(a[2],a[1])}let i=new Set;for(let s=0;s<e.length;s++)if(T$.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(mce):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(K6);if(!(c&&t.has(c[2]))){if(T$.test(l)){o.push(hce(l,n.get(l)));continue}o.push(a)}}return o.join(`
`,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=>gce(d.body??"")).join(`
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.